:root {
  --bg-top: #f8fafc;
  --bg-mid: #f4f7fb;
  --bg-bottom: #eef4fb;
  --surface: rgba(255, 255, 255, 0.94);
  --surface-strong: #ffffff;
  --surface-soft: #f8fafc;
  --text: #1e293b;
  --muted: #64748b;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --blue: #2563eb;
  --blue-dark: #1d4ed8;
  --blue-soft: #eff6ff;
  --success: #15803d;
  --success-soft: #ecfdf3;
  --danger: #b42318;
  --danger-soft: #fef3f2;
  --warning: #b54708;
  --warning-soft: #fffaeb;
  --info: #1d4ed8;
  --info-soft: #eff6ff;
  --radius-xl: 22px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f8fafc 0%, #f4f7fb 48%, #eef4fb 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.shell { max-width: 1180px; margin: 0 auto; }
.shell--page { padding: 18px 16px 36px; }
.page-shell { padding: 0; }

.panel {
  background: rgba(255, 255, 255, 0.96);
  border: 1px solid rgba(255,255,255,0.78);
  border-radius: var(--radius-xl);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow-sm);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  padding: 18px 20px;
  margin-bottom: 16px;
}

.brand-block { display: flex; flex-direction: column; }
.brand-link { text-decoration: none; color: inherit; }
.brand-row { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  background: #ffffff;
  color: var(--blue-dark);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-sm);
  font-weight: 700;
}
.topbar h1, .hero h2, h3 { margin: 0; }
.topbar h1 {
  font-size: 1.5rem;
  line-height: 1.1;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.025em;
}
.brand-subtitle { margin: 2px 0 0; font-size: 0.875rem; }

.topbar__actions,
.locale-switcher__buttons,
.filters__actions,
.page-actions,
.row-actions,
.toolbar-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.page-actions {
  justify-content: flex-start;
}

.topbar__actions {
  justify-content: flex-end;
  flex: 1;
}

.toolbar-group { justify-content: flex-end; }
.toolbar-group--stacked {
  width: 100%;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}
.toolbar-group--topline {
  width: 100%;
  justify-content: flex-end;
  gap: 14px;
}
.toolbar-label { font-size: 0.75rem; font-weight: 500; color: var(--muted); }
.muted { color: var(--muted); }

.language-switcher__form,
.account-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.language-switcher__select {
  width: auto;
  min-width: 142px;
  padding: 8px 38px 8px 12px;
  border-radius: 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #334155;
}

select.oc-select {
  padding-right: 2.9rem;
}

.topnav {
  width: 100%;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.topnav__link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: #334155;
  text-decoration: none;
  font-size: 0.82rem;
  font-weight: 500;
  box-shadow: var(--shadow-sm);
}

.topnav__link:hover {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #93c5fd;
}

.topnav__link.is-active {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #93c5fd;
}

.admin-page-header {
  padding: 18px 20px;
  margin-bottom: 16px;
}

.admin-page-header h2 {
  margin: 0 0 6px;
}

.admin-page-header p {
  margin: 0;
}

.admin-users-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.admin-form-panel,
.admin-list-panel,
.admin-user-edit-panel {
  padding: 18px;
}

.admin-panel-header {
  margin-bottom: 14px;
}

.admin-panel-header h3 {
  margin: 0;
}

.admin-user-form-grid {
  display: grid;
  gap: 12px;
}

.admin-user-form-grid--desktop {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.admin-user-form-field {
  min-width: 0;
}

.admin-user-form-field--span-2 {
  grid-column: span 2;
}

.admin-user-edit-panel {
  width: 100%;
}

.admin-user-edit-panel__header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8eef6;
}

.admin-user-edit-panel__header h2 {
  margin: 0 0 6px;
}

.admin-user-edit-panel__header p {
  margin: 0;
}

.admin-user-form-actions {
  margin-top: 18px;
  justify-content: flex-start;
  align-items: center;
  gap: 10px;
}

.admin-user-form-actions .button,
.admin-user-form-actions input[type="submit"] {
  width: auto;
  flex: 0 0 auto;
}

.admin-dashboard-panel,
.admin-records-page {
  padding: 20px;
}

.admin-dashboard-header {
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid #e8eef6;
}

.admin-dashboard-header h2 {
  margin: 0 0 6px;
}

.admin-dashboard-header p {
  margin: 0;
}

.admin-dashboard-grid {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.admin-dashboard-card {
  display: grid;
  gap: 6px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: #ffffff;
  text-decoration: none;
  color: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, transform .15s ease, box-shadow .15s ease;
}

.admin-dashboard-card:hover {
  border-color: #93c5fd;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
}

.admin-dashboard-card__title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #0f172a;
}

.admin-dashboard-card__description {
  font-size: 0.84rem;
  color: var(--muted);
  line-height: 1.45;
}

.admin-dashboard-card__meta {
  font-size: 0.82rem;
  color: #334155;
}

.admin-records-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 20px;
  align-items: start;
}

.admin-records-main {
  display: grid;
  gap: 16px;
}

.admin-records-section {
  padding-bottom: 16px;
  border-bottom: 1px solid #e8eef6;
}

.admin-records-section:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.admin-records-section h3,
.admin-records-action-box h3 {
  margin: 0 0 8px;
}

.admin-records-metric {
  margin: 0;
  font-size: 2rem;
  font-weight: 600;
  color: #0f172a;
}

.admin-records-sidebar {
  display: block;
}

.admin-records-action-box {
  background: #f8fbff;
  border: 1px solid #dbe7ff;
  border-radius: 16px;
  padding: 18px;
}

.admin-records-action-box p {
  margin: 0 0 14px;
}

.hero,
.filters,
.table-card,
.detail-card,
.card {
  margin-bottom: 16px;
}

.hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 24px;
}
.hero__copy { max-width: 700px; }
.hero__copy h2 {
  font-size: 1.7rem;
  line-height: 1.15;
  margin-bottom: 8px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: #0f172a;
}
.hero__copy p {
  margin: 0;
  font-size: 0.95rem;
  line-height: 1.6;
}

.hero__stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(88px, 1fr));
  gap: 10px;
}
.stat {
  background: rgba(255,255,255,0.9);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  min-width: 96px;
}
.stat span {
  display: block;
  font-size: 1.6rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 6px;
  color: #0f172a;
}
.stat small {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
}

.filters {
  padding: 20px 22px;
}
.section-heading { margin-bottom: 14px; }
.section-heading p { margin: 4px 0 0; font-size: 0.9rem; }
.filters__grid,
.form-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  align-items: end;
}
.filters__grid--five {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}
.filters__grid--six {
  grid-template-columns: repeat(6, minmax(0, 1fr));
}
.filter-field--search {
  grid-column: span 2;
}
.filters__actions--footer {
  justify-content: flex-start;
  margin-top: 14px;
  padding-top: 2px;
}
.filters__actions--footer .button,
.filters__actions--footer input[type="submit"] {
  width: auto;
  flex: 0 0 auto;
}
.stack-fields { display: grid; gap: 14px; margin-top: 14px; }

label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.84rem;
  font-weight: 500;
  color: #475569;
}

input, select, textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  color: var(--text);
  font: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color .15s ease, box-shadow .15s ease;
}

select {
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8' fill='none'%3E%3Cpath d='M1 1.5L6 6.5L11 1.5' stroke='%23475569' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
  background-size: 12px 8px;
  padding-right: 2.9rem;
}

select::-ms-expand {
  display: none;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: #93c5fd;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.12);
}
textarea { resize: vertical; min-height: 110px; }

.button {
  appearance: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  padding: 10px 14px;
  border-radius: 12px;
  border: 1px solid var(--blue);
  background: var(--blue);
  color: #ffffff;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.button:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.button--ghost {
  background: #ffffff;
  color: #334155;
  border-color: var(--line);
}
.button--ghost:hover {
  background: var(--blue-soft);
  color: var(--blue-dark);
  border-color: #93c5fd;
}
.button--sm { min-height: 36px; padding: 8px 12px; font-size: 0.82rem; }
.button--tiny { min-height: 32px; padding: 6px 10px; font-size: 0.78rem; border-radius: 10px; }
.is-active {
  background: var(--blue-soft) !important;
  border-color: #93c5fd !important;
  color: var(--blue-dark) !important;
}
.page-actions--left { justify-content: flex-start; }

.table-card { overflow: hidden; }
.table-card__header,
.detail-card__header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
}
.detail-card__header--top {
  align-items: flex-start;
  margin-bottom: 14px;
}
.table-card__header { padding: 20px 22px 14px; }
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
}
thead th {
  background: #eef4ff;
  color: #334155;
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  text-align: left;
  padding: 11px 22px;
  border-top: 1px solid #dbe7ff;
  border-bottom: 1px solid #dbe7ff;
}
tbody td {
  background: rgba(255,255,255,0.93);
  padding: 12px 22px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: middle;
  font-size: 0.88rem;
}
tbody tr:hover td { background: #f8fbff; }
.clickable-row {
  cursor: pointer;
}
.clickable-row:focus td {
  outline: 2px solid rgba(37, 99, 235, 0.22);
  outline-offset: -2px;
}
.table-secondary { margin-top: 4px; font-size: 0.8rem; color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.82rem; }

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 600;
}
.badge--success { background: var(--success-soft); color: var(--success); }
.badge--danger { background: var(--danger-soft); color: var(--danger); }
.badge--warning { background: var(--warning-soft); color: var(--warning); }
.badge--info { background: var(--info-soft); color: var(--info); }
.badge--muted { background: #f1f5f9; color: #475569; }

.flash {
  margin-bottom: 14px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid transparent;
  box-shadow: var(--shadow-sm);
}
.flash--notice { background: var(--success-soft); color: var(--success); border-color: #bbf7d0; }
.flash--alert { background: var(--danger-soft); color: var(--danger); border-color: #fecaca; }

.detail-shell {
  display: grid;
  gap: 16px;
}

.detail-hero {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  padding: 22px 24px;
}

.detail-hero__main h2 {
  margin: 4px 0 8px;
  font-size: 1.85rem;
  line-height: 1.1;
  font-weight: 600;
  color: #0f172a;
  letter-spacing: -0.03em;
}

.detail-hero__eyebrow {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.detail-hero__side {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 12px;
}

.detail-summary {
  padding: 18px 20px;
}

.detail-summary h3 {
  margin-bottom: 6px;
}

.detail-summary p {
  margin: 0;
}

.detail-grid {
  display: grid;
  grid-template-columns: 0.95fr 1.05fr;
  gap: 16px;
  margin-top: 8px;
}
.detail-grid--three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}
.detail-grid--cards {
  margin-top: 0;
}
.mini-card {
  background: rgba(248,250,252,0.72);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.detail-section {
  background: rgba(255,255,255,0.98);
  padding: 18px;
}
.detail-list {
  list-style: none;
  padding: 0;
  margin: 12px 0 0;
  display: grid;
  gap: 12px;
}
.detail-list li {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 10px;
  border-bottom: 1px solid #e5e7eb;
}
.detail-list li:last-child { padding-bottom: 0; border-bottom: 0; }
.detail-list span { color: var(--muted); }
.detail-list strong { text-align: right; }

pre {
  margin: 0;
  padding: 16px;
  border-radius: 14px;
  background: #0f172a;
  color: #dbeafe;
  overflow: auto;
  white-space: pre-wrap;
}

@media (max-width: 980px) {
  .topbar,
  .hero,
  .table-card__header,
  .detail-card__header,
  .detail-grid {
    flex-direction: column;
    align-items: stretch;
  }

  .admin-users-layout,
  .admin-records-layout {
    grid-template-columns: 1fr;
  }

  .admin-dashboard-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-group--stacked,
  .toolbar-group--topline,
  .topnav {
    align-items: stretch;
    justify-content: flex-start;
  }

  .hero__stats {
    grid-template-columns: 1fr;
    width: 100%;
  }

  .filters__grid,
  .filters__grid--five,
  .filters__grid--six,
  .form-grid,
  .detail-grid--three,
  .admin-user-form-grid--desktop {
    grid-template-columns: 1fr 1fr;
  }

  .filter-field--search {
    grid-column: span 2;
  }
}

@media (max-width: 700px) {
  .shell--page { padding: 12px 10px 24px; }
  .topbar, .hero, .filters, .detail-card { padding: 16px; }
  .table-card__header, thead th, tbody td { padding-left: 16px; padding-right: 16px; }
  .filters__grid, .filters__grid--five, .filters__grid--six, .form-grid, .detail-grid--three, .admin-user-form-grid--desktop { grid-template-columns: 1fr; }
  .filter-field--search {
    grid-column: span 1;
  }
  .row-actions {
    flex-wrap: wrap;
  }
  .hero__copy h2 { font-size: 1.4rem; }
  .language-switcher__form,
  .account-actions,
  .topnav {
    width: 100%;
  }
  .language-switcher__select,
  .topnav__link {
    width: 100%;
  }
}
