:root,
html[data-theme="black"] {
  color-scheme: dark;
  --bg: #0b0f14;
  --surface: rgb(17 24 33 / 96%);
  --surface-muted: rgb(15 21 29 / 98%);
  --surface-strong: #16212c;
  --surface-hover: #172332;
  --text: #e6edf3;
  --muted: #8b98a8;
  --muted-strong: #c9d6e2;
  --line: #263241;
  --line-strong: #3a4a5c;
  --primary: #58a6ff;
  --primary-strong: #79b8ff;
  --primary-soft: #102235;
  --info: #31d27b;
  --info-soft: rgb(49 210 123 / 12%);
  --danger: #ff7b72;
  --danger-soft: rgb(248 81 73 / 12%);
  --warning: #f0b84f;
  --warning-soft: rgb(210 153 34 / 13%);
  --ok: #3fb950;
  --ok-soft: rgb(63 185 80 / 13%);
  --input-bg: #0d131a;
  --input-text: #e6edf3;
  --input-placeholder: #667789;
  --button-primary-text: #06111d;
  --button-secondary-bg: transparent;
  --topbar-bg: rgb(13 19 26 / 94%);
  --app-frame-bg:
    linear-gradient(rgb(38 50 65 / 16%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(38 50 65 / 13%) 1px, transparent 1px),
    linear-gradient(180deg, #0b0f14 0%, #080b10 100%);
  --sidebar-link-active-bg: #102235;
  --shadow: 0 18px 45px rgb(0 0 0 / 24%);
  --shadow-soft: 0 8px 22px rgb(0 0 0 / 18%);
}

html[data-theme="white"] {
  color-scheme: light;
  --bg: #eef3f8;
  --surface: rgb(255 255 255 / 96%);
  --surface-muted: #f7fafc;
  --surface-strong: #e7edf4;
  --surface-hover: #eef6ff;
  --text: #0f172a;
  --muted: #65758a;
  --muted-strong: #44546a;
  --line: #d7e0ea;
  --line-strong: #a9b7c7;
  --primary: #0f67b1;
  --primary-strong: #0b4f8c;
  --primary-soft: #e6f2ff;
  --info: #0f766e;
  --info-soft: rgb(15 118 110 / 10%);
  --danger: #b42318;
  --danger-soft: #fde8e7;
  --warning: #a15c07;
  --warning-soft: #fff3dc;
  --ok: #16784a;
  --ok-soft: #e1f5ea;
  --input-bg: #ffffff;
  --input-text: #0f172a;
  --input-placeholder: #64748b;
  --button-primary-text: #ffffff;
  --button-secondary-bg: #ffffff;
  --topbar-bg: rgb(255 255 255 / 94%);
  --app-frame-bg:
    linear-gradient(rgb(148 163 184 / 18%) 1px, transparent 1px),
    linear-gradient(90deg, rgb(148 163 184 / 14%) 1px, transparent 1px),
    linear-gradient(180deg, #f6f9fc 0%, #e9eff6 100%);
  --sidebar-link-active-bg: #e6f2ff;
  --shadow: 0 18px 45px rgb(15 23 42 / 8%);
  --shadow-soft: 0 8px 20px rgb(15 23 42 / 6%);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--app-frame-bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 16px;
  line-height: 1.45;
}

body {
  min-height: 100vh;
  margin: 0;
  background: var(--app-frame-bg);
}

a {
  color: inherit;
  text-decoration: none;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  appearance: none;
}

h1,
h2,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 1.55rem;
  line-height: 1.14;
}

h2 {
  margin-bottom: 5px;
  font-size: 1.05rem;
  line-height: 1.2;
}

p {
  margin-bottom: 0;
}

small {
  color: var(--muted);
  font-size: 0.78rem;
}

.eyebrow,
.section-kicker {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

.app-body {
  overflow-x: hidden;
}

.auth-layout {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.auth-shell {
  width: min(100%, 440px);
}

.login-panel {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
  padding: 28px;
}

.login-card {
  display: grid;
  gap: 20px;
}

.login-brand-row,
.sidebar-brand {
  display: grid;
  grid-template-columns: 40px minmax(0, 1fr);
  align-items: center;
  gap: 11px;
}

.login-brand-row strong,
.login-brand-row small,
.brand-copy strong,
.brand-copy small {
  display: block;
  overflow-wrap: anywhere;
}

.login-heading {
  display: grid;
  gap: 6px;
}

.login-heading p:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.auth-highlights {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.auth-highlights span {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 0.78rem;
  font-weight: 800;
  padding: 7px 8px;
  text-align: center;
}

.form-stack,
.admin-form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 6px;
  color: var(--text);
  font-size: 0.86rem;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--input-bg);
  color: var(--input-text);
  padding: 8px 10px;
}

textarea {
  min-height: 92px;
  resize: vertical;
}

select {
  appearance: none;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted-strong) 50%),
    linear-gradient(135deg, var(--muted-strong) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 18px,
    calc(100% - 12px) 18px;
  background-repeat: no-repeat;
  background-size:
    5px 5px,
    5px 5px;
  padding-right: 32px;
}

input::placeholder,
textarea::placeholder {
  color: var(--input-placeholder);
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(15 118 110 / 14%);
  outline: none;
}

.alert {
  border: 1px solid var(--line);
  border-radius: 6px;
  margin: 0;
  padding: 10px 12px;
  font-size: 0.88rem;
  font-weight: 750;
}

.alert-danger {
  border-color: #f0b8b4;
  background: var(--danger-soft);
  color: var(--danger);
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  align-self: start;
  height: 100vh;
  border-right: 1px solid var(--line);
  background: var(--surface);
  padding: 18px 12px;
}

.sidebar-brand {
  min-height: 48px;
  margin-bottom: 18px;
  padding: 3px 4px;
}

.brand-mark {
  display: grid;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 8px;
  background: var(--primary);
  color: var(--button-primary-text);
  font-size: 0.86rem;
  font-weight: 900;
}

.brand-copy strong {
  font-size: 0.96rem;
}

.sidebar-status {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  margin-bottom: 16px;
  padding: 12px;
}

.sidebar-status strong {
  display: block;
  font-size: 0.82rem;
}

.status-dot {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--ok);
  box-shadow: 0 0 0 4px var(--ok-soft);
}

.sidebar-status .status-dot {
  margin-top: 4px;
}

.theme-switch {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  margin-bottom: 0;
  padding: 4px;
}

.theme-switch button {
  display: grid;
  min-width: 32px;
  min-height: 32px;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--muted-strong);
  cursor: pointer;
  font-size: 0.76rem;
  font-weight: 850;
  padding: 0;
}

.theme-switch button:hover,
.theme-switch button.is-active {
  border-color: var(--line-strong);
  background: var(--sidebar-link-active-bg);
  color: var(--primary-strong);
}

.topbar-theme-switch {
  width: 76px;
  flex: 0 0 auto;
}

.theme-icon {
  width: 18px;
  height: 18px;
  display: block;
}

.auth-theme-bar {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 12px;
}

.auth-theme-bar .theme-switch {
  width: 76px;
}

.side-nav {
  display: grid;
  gap: 4px;
}

.nav-link {
  position: relative;
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  min-height: 46px;
  border-radius: 7px;
  color: var(--muted-strong);
  font-size: 0.88rem;
  font-weight: 760;
  padding: 6px 10px;
  transition:
    background 150ms ease,
    color 150ms ease,
    transform 150ms ease;
}

.nav-link:hover,
.nav-link.is-active {
  background: var(--sidebar-link-active-bg);
  color: var(--primary-strong);
}

.nav-link:hover {
  transform: translateX(1px);
}

.nav-link.is-active::before {
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 3px;
  border-radius: 999px;
  background: var(--primary);
  content: "";
}

.nav-glyph {
  display: grid;
  width: 32px;
  height: 32px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--surface-muted);
  color: var(--muted);
}

.nav-link.is-active .nav-glyph {
  border-color: rgb(88 166 255 / 34%);
  background: var(--surface);
  color: var(--primary);
}

.nav-icon {
  width: 17px;
  height: 17px;
  display: block;
}

.nav-copy {
  display: grid;
  min-width: 0;
  line-height: 1.12;
}

.nav-copy span,
.nav-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.nav-copy small {
  margin-top: 2px;
  font-size: 0.68rem;
  font-weight: 740;
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 76px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-bg);
  padding: 14px 26px;
}

.page-heading {
  min-width: 0;
}

.topbar-actions,
.operator-card {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.operator-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 6px 9px 6px 6px;
}

.operator-avatar {
  display: grid;
  width: 30px;
  height: 30px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 7px;
  background: var(--info-soft);
  color: var(--info);
  font-size: 0.8rem;
  font-weight: 900;
}

.operator-copy {
  display: grid;
  min-width: 0;
}

.operator-copy strong,
.operator-copy small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.operator-copy strong {
  font-size: 0.84rem;
}

.content {
  display: grid;
  gap: 18px;
  width: min(100%, 1320px);
  margin: 0 auto;
  padding: 22px 26px 34px;
}

.dashboard-command {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.command-copy {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.command-icon {
  display: grid;
  width: 42px;
  height: 42px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
}

.panel-icon {
  width: 21px;
  height: 21px;
  display: block;
}

.dashboard-command p:last-child {
  color: var(--muted);
  font-size: 0.92rem;
}

.command-status {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  align-items: start;
  gap: 10px;
  min-width: 238px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-muted);
  padding: 12px;
}

.command-status .status-dot {
  margin-top: 4px;
}

.command-status strong,
.command-status small {
  display: block;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(132px, 1fr));
  gap: 12px;
}

.metric,
.panel,
.resource-shell {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
}

.metric {
  display: grid;
  gap: 9px;
  min-height: 116px;
  padding: 14px;
}

.metric-link {
  cursor: pointer;
  outline: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.metric-link:hover,
.metric-link:focus-visible {
  border-color: var(--primary);
  box-shadow: var(--shadow);
  transform: translateY(-1px);
}

.metric-link:focus-visible {
  box-shadow:
    0 0 0 3px rgb(88 166 255 / 22%),
    var(--shadow);
}

.metric-link:hover .metric-icon,
.metric-link:focus-visible .metric-icon {
  color: var(--primary);
}

.metric-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.metric span,
.metric-head span {
  color: var(--muted);
  font-size: 0.8rem;
  font-weight: 820;
}

.metric-icon {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
  color: var(--muted-strong);
}

.metric strong {
  font-size: 1.95rem;
  line-height: 1;
}

.metric small {
  display: block;
}

.metric-tone-neutral {
  border-top: 3px solid var(--muted);
}

.metric-tone-info {
  border-top: 3px solid var(--info);
}

.metric-ok {
  border-top: 3px solid var(--ok);
}

.metric-danger {
  border-top: 3px solid var(--danger);
}

.metric-warning {
  border-top: 3px solid var(--warning);
}

.operations-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(280px, 0.8fr);
  gap: 16px;
  align-items: start;
}

.panel,
.resource-shell {
  overflow: hidden;
}

.section-head,
.resource-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px solid var(--line);
  padding: 15px 16px;
}

.section-head p,
.resource-head p {
  color: var(--muted);
  font-size: 0.86rem;
}

.section-kicker {
  color: var(--info);
}

.section-chip {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-muted);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 820;
  padding: 5px 9px;
}

.resource-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.priority-list {
  display: grid;
  gap: 0;
}

.priority-row {
  display: grid;
  grid-template-columns: 12px minmax(0, 1fr);
  gap: 11px;
  align-items: start;
  border-bottom: 1px solid var(--line);
  padding: 14px 16px;
}

.priority-row:last-child {
  border-bottom: 0;
}

.priority-row strong,
.priority-row small {
  display: block;
}

.priority-mark {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  margin-top: 5px;
}

.priority-danger {
  background: var(--danger);
}

.priority-warning {
  background: var(--warning);
}

.priority-ok {
  background: var(--ok);
}

.table-toolbar {
  display: flex;
  align-items: end;
  gap: 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface-muted);
  padding: 12px 16px;
}

.toolbar-search {
  width: min(100%, 360px);
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 720px;
  border-collapse: collapse;
}

.resource-table {
  border-collapse: separate;
  border-spacing: 0;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 14px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
}

th {
  background: var(--surface-muted);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 850;
  letter-spacing: 0;
  text-transform: uppercase;
}

td {
  font-size: 0.88rem;
}

.resource-row {
  transition:
    background 0.16s ease,
    box-shadow 0.16s ease;
}

.resource-row:hover {
  background: color-mix(in srgb, var(--surface-hover) 55%, transparent);
  box-shadow: inset 3px 0 0 var(--primary);
}

.table-cell {
  color: var(--text);
}

.table-cell-primary {
  min-width: 220px;
  font-weight: 820;
}

.table-actions-heading,
.table-actions-cell {
  width: 190px;
}

.table-actions-cell {
  padding-right: 16px;
}

.table-code,
.table-money,
.table-status {
  display: inline-flex;
  min-height: 25px;
  align-items: center;
  border-radius: 6px;
  line-height: 1;
}

.table-code {
  max-width: 260px;
  padding: 0 8px;
  overflow: hidden;
  background: color-mix(in srgb, var(--surface-strong) 64%, transparent);
  color: var(--muted-strong);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 0.78rem;
  font-weight: 760;
  text-overflow: ellipsis;
}

.table-money {
  justify-content: flex-end;
  min-width: 74px;
  padding: 0 8px;
  background: var(--info-soft);
  color: var(--muted-strong);
  font-variant-numeric: tabular-nums;
  font-weight: 860;
}

.table-status {
  padding: 0 9px;
  border: 1px solid transparent;
  font-size: 0.75rem;
  font-weight: 880;
  text-transform: capitalize;
}

.table-status-active {
  border-color: color-mix(in srgb, var(--ok) 30%, transparent);
  background: var(--ok-soft);
  color: var(--ok);
}

.table-status-warning {
  border-color: color-mix(in srgb, var(--warning) 30%, transparent);
  background: var(--warning-soft);
  color: var(--warning);
}

.table-status-danger {
  border-color: color-mix(in srgb, var(--danger) 30%, transparent);
  background: var(--danger-soft);
  color: var(--danger);
}

.table-status-neutral {
  border-color: var(--line);
  background: color-mix(in srgb, var(--surface-strong) 65%, transparent);
  color: var(--muted-strong);
}

td strong,
td small {
  display: block;
}

tr:last-child td {
  border-bottom: 0;
}

.empty-cell {
  color: var(--muted);
  text-align: center;
}

.empty-state {
  display: grid;
  gap: 5px;
  justify-items: center;
  padding: 30px 16px;
}

.empty-state strong {
  color: var(--text);
  font-size: 0.96rem;
}

.empty-state span {
  max-width: 420px;
  white-space: normal;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 0.76rem;
  font-weight: 850;
}

.badge-ok {
  background: var(--ok-soft);
  color: var(--ok);
}

.badge-danger {
  background: var(--danger-soft);
  color: var(--danger);
}

.badge-warning {
  background: var(--warning-soft);
  color: var(--warning);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  border: 1px solid transparent;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.88rem;
  font-weight: 820;
  padding: 7px 12px;
  white-space: nowrap;
}

.button-icon {
  width: 16px;
  height: 16px;
  flex: 0 0 auto;
}

.button-primary {
  background: var(--primary);
  color: var(--button-primary-text);
}

.button-primary:hover {
  background: var(--primary-strong);
}

.button-secondary {
  border-color: var(--line-strong);
  background: var(--button-secondary-bg);
  color: var(--text);
}

.button-secondary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.button-ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--text);
}

.button-ghost:hover {
  border-color: var(--line-strong);
  background: var(--surface-muted);
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.row-actions form {
  margin: 0;
}

.row-action-button {
  display: inline-flex;
  min-height: 34px;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--button-secondary-bg);
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 800;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition:
    background 0.16s ease,
    border-color 0.16s ease,
    color 0.16s ease,
    box-shadow 0.16s ease;
}

.row-action-button .button-icon {
  width: 15px;
  height: 15px;
}

.row-action-edit {
  border-color: rgba(83, 161, 255, 0.34);
  background: rgba(83, 161, 255, 0.11);
  color: var(--primary);
}

.row-action-edit:hover,
.row-action-edit:focus-visible {
  border-color: var(--primary);
  background: rgba(83, 161, 255, 0.18);
  color: var(--primary);
  box-shadow: 0 0 0 3px rgba(83, 161, 255, 0.12);
  outline: none;
}

.row-action-remove {
  border-color: rgba(239, 68, 68, 0.3);
  background: rgba(239, 68, 68, 0.1);
  color: var(--danger);
}

.row-action-remove:hover,
.row-action-remove:focus-visible {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.16);
  color: var(--danger);
  box-shadow: 0 0 0 3px rgba(239, 68, 68, 0.11);
  outline: none;
}

.form-panel {
  max-width: 1080px;
}

.admin-form {
  padding: 0;
}

.form-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
}

.form-layout.has-rail {
  grid-template-columns: minmax(0, 1fr) minmax(250px, 0.34fr);
}

.form-main {
  display: grid;
  gap: 18px;
  min-width: 0;
  padding: 16px;
}

.form-section {
  min-width: 0;
  border: 0;
  border-top: 1px solid var(--line);
  margin: 0;
  padding: 17px 0 0;
}

.form-section:first-child,
.form-section-plain {
  border-top: 0;
  padding-top: 0;
}

.form-section-head {
  display: grid;
  gap: 3px;
  margin-bottom: 13px;
}

.form-section legend {
  color: var(--text);
  font-size: 0.95rem;
  font-weight: 850;
  padding: 0;
}

.form-section-head p,
.form-rail p {
  color: var(--muted);
  font-size: 0.84rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 13px 12px;
}

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

.form-field-full {
  grid-column: 1 / -1;
}

.form-rail {
  display: grid;
  align-content: start;
  gap: 14px;
  border-left: 1px solid var(--line);
  background: var(--surface-muted);
  padding: 16px;
}

.form-rail strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.92rem;
}

.form-rail ol {
  display: grid;
  gap: 9px;
  margin: 0;
  padding-left: 18px;
}

.form-rail li {
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 760;
  padding-left: 2px;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-top: 6px;
}

.detail-hero {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow-soft);
  padding: 18px;
}

.detail-hero p:last-child {
  color: var(--muted);
}

.customer-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: -4px 0 16px;
}

.customer-tab {
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.84rem;
  font-weight: 850;
  padding: 8px 11px;
}

.customer-tab:hover,
.customer-tab.is-active {
  border-color: var(--primary);
  background: var(--primary-soft);
  color: var(--text);
}

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

.detail-panel {
  min-width: 0;
}

.compact-admin-form {
  margin-top: 0;
}

.operation-alert {
  display: grid;
  gap: 4px;
  margin: 14px 16px 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
}

.operation-alert span {
  color: var(--muted);
}

.operation-alert-danger {
  border-color: var(--danger);
  background: var(--danger-soft);
}

.definition-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  gap: 0;
  margin: 0;
}

.definition-list dt,
.definition-list dd {
  border-bottom: 1px solid var(--line);
  margin: 0;
  padding: 12px 16px;
}

.definition-list dt {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 850;
  text-transform: uppercase;
}

.definition-list dd {
  overflow-wrap: anywhere;
}

.compact-list {
  display: grid;
}

.compact-row {
  display: grid;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  padding: 13px 16px;
}

.compact-row:last-child {
  border-bottom: 0;
}

.compact-row strong,
.compact-row span,
.compact-row small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.compact-row span {
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 760;
}

.compact-empty {
  padding: 22px 16px;
}

@media (max-width: 1040px) {
  .app-shell {
    grid-template-columns: 224px minmax(0, 1fr);
  }

  .metric-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .operations-grid {
    grid-template-columns: 1fr;
  }

  .form-layout.has-rail {
    grid-template-columns: 1fr;
  }

  .form-rail {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}

@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .sidebar-status {
    display: none;
  }

  .side-nav {
    grid-template-columns: repeat(auto-fit, minmax(136px, 1fr));
  }

  .topbar {
    position: static;
  }

  .dashboard-command,
  .detail-hero,
  .section-head,
  .resource-head,
  .table-toolbar {
    align-items: stretch;
    flex-direction: column;
  }

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

  .command-status {
    min-width: 0;
  }

  .detail-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .auth-layout {
    padding: 14px;
  }

  .login-panel {
    padding: 20px;
  }

  .auth-highlights {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
  }

  .topbar,
  .content {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar-actions {
    justify-content: space-between;
  }

  .operator-card {
    min-width: 0;
  }

  .metric-grid {
    grid-template-columns: 1fr;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .definition-list {
    grid-template-columns: 1fr;
  }

  .toolbar-search {
    width: 100%;
  }
}
