:root {
  color-scheme: light;
  --page: #f3f5f6;
  --surface: #ffffff;
  --surface-raised: #fbfcfc;
  --surface-muted: #e9eef0;
  --surface-sunken: #dde5e8;
  --ink: #14252d;
  --muted: #4e616b;
  --faint: #6d7d85;
  --placeholder: #4e616b;
  --line: #b7c3c8;
  --line-strong: #7b8c94;
  --brand: #0d5963;
  --brand-strong: #08444c;
  --brand-soft: #d9ecee;
  --accent: #a8451b;
  --accent-soft: #f8e4d8;
  --success: #14633e;
  --success-soft: #dcefe5;
  --warning: #795000;
  --warning-soft: #f9edc9;
  --danger: #9f2932;
  --danger-soft: #f7dfe2;
  --info: #24588f;
  --info-soft: #dce9f7;
  --focus: #d85b17;
  --progress-label-ink: #14252d;
  --progress-label-bg: #ffffff;
  --type-xs: 0.75rem;
  --type-sm: 0.875rem;
  --type-base: 1rem;
  --type-lg: 1.125rem;
  --type-xl: 1.5rem;
  --type-display: clamp(1.75rem, 2.6vw, 2.35rem);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --shadow-sm: 0 1px 2px rgba(20, 37, 45, 0.08);
  --shadow-md: 0 8px 24px rgba(20, 37, 45, 0.1);
  --shadow-lg: 0 18px 48px rgba(20, 37, 45, 0.14);
  --shadow: var(--shadow-lg);
  --radius-xs: 4px;
  --radius-sm: 6px;
  --radius: 10px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --sidebar-width: 244px;
  --topbar-height: 64px;
  --grid-row-height: 44px;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 16px;
  line-height: 1.5;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #11191e;
  --surface: #18242b;
  --surface-raised: #1e2c34;
  --surface-muted: #263740;
  --surface-sunken: #30434d;
  --ink: #f1f5f6;
  --muted: #bdc9ce;
  --faint: #98a9b1;
  --placeholder: #bdc9ce;
  --line: #52656e;
  --line-strong: #7a8d95;
  --brand: #77c0c6;
  --brand-strong: #9bd3d7;
  --brand-soft: #263f45;
  --accent: #f08a53;
  --accent-soft: #4a3024;
  --success: #75c79a;
  --success-soft: #203d30;
  --warning: #f0c464;
  --warning-soft: #44391f;
  --danger: #ff9299;
  --danger-soft: #4d282d;
  --info: #88b9f0;
  --info-soft: #263a51;
  --focus: #ff9a5f;
  --progress-label-ink: #f1f5f6;
  --progress-label-bg: #18242b;
  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.28);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.32);
  --shadow-lg: 0 20px 52px rgba(0, 0, 0, 0.42);
  --shadow: var(--shadow-lg);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  max-width: 100%;
  min-width: 320px;
  min-height: 100%;
  margin: 0;
  overflow-x: hidden;
  background: var(--page);
  color: var(--ink);
}

body {
  min-height: 100vh;
  min-height: 100dvh;
  font-size: var(--type-base);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--brand-soft);
  color: var(--ink);
}

::placeholder {
  color: var(--placeholder);
  opacity: 1;
}

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

button,
a,
input,
select,
textarea,
[tabindex] {
  outline-offset: 3px;
}

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
}

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: 3px;
}

a:hover {
  color: var(--accent);
}

a:active {
  color: var(--brand-strong);
}

button,
.button {
  min-height: 42px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 1000;
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.app-loading {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 32px;
}

.loading-mark {
  width: 34px;
  height: 34px;
  margin: 0 auto 14px;
  border: 4px solid var(--brand-soft);
  border-top-color: var(--brand);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.login-layout {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: minmax(300px, 0.9fr) minmax(420px, 1.1fr);
  background:
    radial-gradient(circle at 12% 18%, rgba(255, 255, 255, 0.13), transparent 34%),
    linear-gradient(125deg, var(--brand-strong) 0 43%, var(--page) 43% 100%);
}

.login-story {
  display: flex;
  min-height: 100%;
  flex-direction: column;
  justify-content: space-between;
  padding: clamp(32px, 6vw, 84px);
  color: #f8fcfc;
}

.product-mark {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  font-weight: 750;
  letter-spacing: 0.04em;
}

.product-mark__symbol {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 12px 4px 12px 4px;
  font-size: 14px;
}

.login-story h1 {
  max-width: 640px;
  margin: 60px 0 18px;
  font-size: clamp(2.1rem, 4.8vw, 4.8rem);
  line-height: 1.08;
  letter-spacing: -0.035em;
}

.login-story p {
  max-width: 560px;
  color: #d8e8ea;
  font-size: 1.05rem;
}

.login-panel {
  display: grid;
  place-items: center;
  padding: clamp(22px, 5vw, 72px);
}

.login-card {
  width: min(100%, 520px);
  padding: clamp(26px, 4vw, 48px);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.login-card h2 {
  margin: 0 0 8px;
  font-size: 1.7rem;
}

.login-card__lead {
  margin: 0 0 28px;
  color: var(--muted);
}

.bootstrap-disclosure {
  margin-top: 24px;
  border-top: 1px solid var(--line);
  padding-top: 20px;
}

.bootstrap-disclosure summary {
  cursor: pointer;
  color: var(--brand);
  font-weight: 700;
}

.app-shell {
  display: grid;
  min-height: 100vh;
  min-height: 100dvh;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  grid-template-rows: var(--topbar-height) minmax(0, 1fr);
}

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

.app-shell--display .topbar,
.app-shell--display .page-main {
  grid-column: 1;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  height: 100vh;
  height: 100dvh;
  grid-row: 1 / -1;
  flex-direction: column;
  overflow-y: auto;
  border-right: 1px solid #33515a;
  background: #12313a;
  color: #eef7f7;
}

.sidebar__brand {
  display: flex;
  min-height: var(--topbar-height);
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-bottom: 1px solid #33515a;
}

.sidebar__brand small {
  display: block;
  color: #b9d0d4;
  font-weight: 500;
}

.sidebar__close {
  margin-left: auto;
}

.nav-list {
  display: grid;
  gap: 4px;
  margin: 0;
  padding: 18px 12px;
  list-style: none;
}

.nav-list a {
  display: flex;
  min-height: 44px;
  align-items: center;
  gap: 11px;
  padding: 10px 12px;
  border: 1px solid transparent;
  border-radius: 8px;
  color: #dceced;
  text-decoration: none;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease, transform 140ms ease;
}

.nav-list a:hover {
  border-color: #45646d;
  background: #1d424b;
  color: #ffffff;
}

.nav-list a[aria-current="page"] {
  border-color: #ee9a68;
  background: #f1e1d5;
  color: #3a2519;
  font-weight: 750;
}

.nav-list a:active {
  transform: translateY(1px);
}

.nav-icon {
  width: 22px;
  text-align: center;
  font-size: 0.9rem;
}

.sidebar__footer {
  margin-top: auto;
  padding: 14px 16px 20px;
  border-top: 1px solid #33515a;
  color: #c5d9dc;
  font-size: 0.82rem;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  min-width: 0;
  align-items: center;
  gap: 16px;
  padding: 9px clamp(14px, 2vw, 28px);
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--surface) 94%, transparent);
  backdrop-filter: blur(12px);
  box-shadow: var(--shadow-sm);
}

.mobile-menu-button {
  display: none;
}

.mobile-menu-backdrop {
  position: fixed;
  inset: 0;
  z-index: 25;
  display: none;
  padding: 0;
  border: 0;
  background: rgba(8, 24, 30, 0.62);
  cursor: pointer;
}

.global-search {
  position: relative;
  flex: 1 1 420px;
  max-width: 720px;
}

.global-search input {
  width: 100%;
  min-height: 42px;
  padding: 8px 44px 8px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-raised);
}

.global-search button {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 38px;
  min-height: 36px;
  border: 0;
  background: transparent;
  color: var(--brand);
  cursor: pointer;
}

.topbar__actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.user-chip {
  display: grid;
  min-width: 0;
  line-height: 1.2;
}

.user-chip small {
  color: var(--muted);
}

.page-main {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
  padding: clamp(14px, 2.4vw, 30px);
}

.page-view {
  width: 100%;
  max-width: 1800px;
  display: flex;
  min-height: calc(100vh - var(--topbar-height) - 60px);
  min-height: calc(100dvh - var(--topbar-height) - 60px);
  flex: 1;
  flex-direction: column;
  gap: 18px;
  margin-inline: auto;
}

.page-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 18px;
  padding-bottom: var(--space-4);
  border-bottom: 1px solid var(--line);
}

.page-header h1 {
  margin: 0;
  font-size: var(--type-display);
  letter-spacing: -0.025em;
  line-height: 1.18;
}

.page-header p {
  max-width: 760px;
  margin: 5px 0 0;
  color: var(--muted);
}

.page-actions,
.toolbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.button,
button.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 8px 14px;
  border: 1px solid var(--brand);
  border-radius: var(--radius-sm);
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
  font-weight: 700;
  line-height: 1.2;
  text-decoration: none;
  box-shadow: var(--shadow-sm);
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease, color 140ms ease, transform 140ms ease;
}

.button:hover {
  border-color: var(--brand-strong);
  background: var(--brand-strong);
  color: #ffffff;
  box-shadow: var(--shadow-md);
}

.button:active {
  box-shadow: var(--shadow-sm);
  transform: translateY(1px);
}

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

.button--secondary:hover {
  background: var(--surface-muted);
  color: var(--ink);
}

.button--quiet {
  border-color: transparent;
  background: transparent;
  color: var(--brand);
  box-shadow: none;
}

.button--quiet:hover {
  border-color: var(--line);
  background: var(--brand-soft);
  color: var(--brand-strong);
  box-shadow: none;
}

.button--danger {
  border-color: var(--danger);
  background: var(--danger);
  color: #ffffff;
}

.button--danger:hover {
  border-color: color-mix(in srgb, var(--danger) 78%, #000000);
  background: color-mix(in srgb, var(--danger) 78%, #000000);
}

.button--small {
  min-height: 34px;
  padding: 5px 10px;
  font-size: 0.87rem;
}

.button[disabled],
button[disabled] {
  cursor: not-allowed;
  filter: saturate(0.35);
  opacity: 0.55;
  box-shadow: none;
  transform: none;
}

.card {
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--line);
}

.card__header h2,
.card__header h3 {
  margin: 0;
  font-size: var(--type-lg);
}

.card__body {
  padding: var(--space-4);
}

.filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
}

.field {
  display: grid;
  min-width: 140px;
  gap: 5px;
}

.field--grow {
  flex: 1 1 240px;
}

.field label,
.field-label {
  color: var(--muted);
  font-size: var(--type-sm);
  font-weight: 700;
}

.field input,
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  background: var(--surface-raised);
  transition: background-color 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}

.field input:hover,
.field select:hover,
.field textarea:hover,
.input:hover {
  border-color: var(--brand);
}

.field input:focus-visible,
.field select:focus-visible,
.field textarea:focus-visible,
.input:focus-visible {
  border-color: var(--brand);
  background: var(--surface);
  box-shadow: 0 0 0 3px var(--brand-soft);
}

.field textarea {
  min-height: 96px;
  resize: vertical;
}

.field input[aria-invalid="true"],
.field select[aria-invalid="true"],
.field textarea[aria-invalid="true"] {
  border-color: var(--danger);
  box-shadow: 0 0 0 2px var(--danger-soft);
}

.field-error {
  color: var(--danger);
  font-size: 0.8rem;
  font-weight: 650;
}

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

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

.data-grid-shell {
  --grid-row-height: 44px;
  position: relative;
  display: flex;
  min-height: 420px;
  flex: 1;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.data-grid-toolbar {
  display: flex;
  min-height: 42px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 5px 10px;
  border-bottom: 1px solid var(--line-strong);
  background: var(--surface-muted);
  color: var(--muted);
  font-size: var(--type-sm);
}

.row-height-resizer {
  display: inline-flex;
  min-height: 30px;
  align-items: center;
  gap: 6px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--surface);
  color: var(--ink);
  cursor: ns-resize;
  user-select: none;
}

.data-grid-scroll {
  position: relative;
  flex: 1;
  overflow: auto;
  overscroll-behavior-inline: contain;
}

.data-grid {
  width: max(100%, var(--grid-min-width, 920px));
  table-layout: fixed;
  border-collapse: separate;
  border-spacing: 0;
  background: var(--surface);
}

.data-grid th,
.data-grid td {
  height: var(--grid-row-height);
  padding: 8px 11px;
  overflow: hidden;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  text-align: left;
  text-overflow: ellipsis;
  vertical-align: middle;
  white-space: nowrap;
}

.data-grid th:last-child,
.data-grid td:last-child {
  border-right: 0;
}

.data-grid thead th {
  position: sticky;
  top: 0;
  z-index: 3;
  height: 42px;
  background: var(--surface-muted);
  color: var(--ink);
  font-size: var(--type-sm);
  font-weight: 760;
}

.data-grid tbody tr:hover td {
  background: color-mix(in srgb, var(--brand-soft) 45%, var(--surface));
}

.data-grid tbody tr[aria-selected="true"] td {
  background: var(--brand-soft);
  font-weight: 650;
}

.data-grid tbody tr:focus-within td {
  background: color-mix(in srgb, var(--brand-soft) 70%, var(--surface));
}

.data-grid tbody tr:last-child td {
  border-bottom: 0;
}

.column-resizer {
  position: absolute;
  top: 0;
  right: -5px;
  bottom: 0;
  z-index: 4;
  width: 10px;
  cursor: col-resize;
  touch-action: none;
}

.column-resizer::after {
  position: absolute;
  top: 20%;
  right: 4px;
  bottom: 20%;
  width: 2px;
  background: var(--line-strong);
  content: "";
}

.data-grid th {
  position: relative;
}

.grid-link {
  display: inline-flex;
  max-width: 100%;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.grid-empty {
  display: grid;
  min-height: 300px;
  place-items: center;
  padding: 30px;
  border-top: 0;
  color: var(--muted);
  text-align: center;
}

.grid-pagination {
  display: flex;
  min-height: 46px;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 7px 10px;
  border-top: 1px solid var(--line-strong);
  background: var(--surface-raised);
}

.split-pane {
  --master-width: 46%;
  display: grid;
  min-height: 520px;
  flex: 1;
  grid-template-columns: minmax(300px, var(--master-width)) 10px minmax(360px, 1fr);
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
}

.split-pane__master,
.split-pane__detail {
  display: flex;
  min-width: 0;
  min-height: 0;
  flex-direction: column;
  overflow: auto;
}

.splitter {
  position: relative;
  z-index: 4;
  border: 0;
  border-right: 1px solid var(--line-strong);
  border-left: 1px solid var(--line-strong);
  background: var(--surface-muted);
  cursor: col-resize;
  touch-action: none;
}

.splitter::after {
  position: absolute;
  top: 50%;
  left: 2px;
  width: 4px;
  height: 42px;
  border-radius: 4px;
  background: var(--line-strong);
  content: "";
  transform: translateY(-50%);
}

.detail-panel {
  padding: 20px;
}

.detail-list {
  display: grid;
  grid-template-columns: minmax(120px, 0.35fr) minmax(0, 1fr);
  margin: 0;
  border-top: 1px solid var(--line);
  border-left: 1px solid var(--line);
}

.detail-list dt,
.detail-list dd {
  min-width: 0;
  margin: 0;
  padding: 10px 12px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  overflow-wrap: anywhere;
}

.detail-list dt {
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
}

.status-badge {
  display: inline-flex;
  min-height: 26px;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border: 1px solid currentColor;
  border-radius: 999px;
  background: var(--surface);
  font-size: var(--type-xs);
  font-weight: 760;
  line-height: 1;
  letter-spacing: 0.01em;
}

.status-badge--success { color: var(--success); background: var(--success-soft); }
.status-badge--warning { color: var(--warning); background: var(--warning-soft); }
.status-badge--danger { color: var(--danger); background: var(--danger-soft); }
.status-badge--info { color: var(--info); background: var(--info-soft); }
.status-badge--neutral { color: var(--muted); background: var(--surface-muted); }

.progress-meter {
  display: grid;
  width: 100%;
  min-width: 112px;
  grid-template-columns: minmax(64px, 1fr) auto;
  align-items: center;
  gap: 7px;
}

.progress-track {
  position: relative;
  width: 100%;
  min-width: 64px;
  height: 12px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: var(--surface-sunken);
}

.progress-track__fill {
  height: 100%;
  background: var(--brand);
}

.progress-track__label {
  min-width: 4.25ch;
  padding: 2px 5px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xs);
  background: var(--progress-label-bg);
  color: var(--progress-label-ink);
  font-size: 0.75rem;
  font-weight: 760;
  line-height: 1.25;
  text-align: center;
}

.state-panel {
  display: grid;
  min-height: 320px;
  flex: 1;
  place-items: center;
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: var(--radius-md);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  text-align: center;
}

.state-panel__symbol {
  display: grid;
  width: 52px;
  height: 52px;
  margin: 0 auto 12px;
  place-items: center;
  border: 2px solid currentColor;
  border-radius: 50%;
  font-weight: 800;
}

.state-panel h2,
.state-panel h3 {
  margin: 0 0 6px;
}

.state-panel p {
  max-width: 580px;
  margin: 0 auto 16px;
  color: var(--muted);
}

.state-panel--error { color: var(--danger); }
.state-panel--forbidden { color: var(--warning); }
.state-panel--empty { color: var(--muted); }

.inline-message {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 11px 13px;
  border: 1px solid currentColor;
  border-radius: 8px;
  font-size: 0.9rem;
}

.inline-message--error { color: var(--danger); background: var(--danger-soft); }
.inline-message--success { color: var(--success); background: var(--success-soft); }
.inline-message--info { color: var(--info); background: var(--info-soft); }

dialog {
  width: min(720px, calc(100vw - 28px));
  max-height: min(86vh, 900px);
  padding: 0;
  overflow: auto;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
}

dialog::backdrop {
  background: rgba(4, 18, 23, 0.65);
  backdrop-filter: blur(3px);
}

.dialog-header,
.dialog-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 20px;
}

.dialog-header {
  position: sticky;
  top: 0;
  z-index: 2;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.dialog-header h2 {
  margin: 0;
  font-size: var(--type-xl);
}

.dialog-body {
  padding: 20px;
}

.dialog-footer {
  position: sticky;
  bottom: 0;
  z-index: 2;
  border-top: 1px solid var(--line);
  background: var(--surface-muted);
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  width: min(380px, calc(100vw - 36px));
  gap: 9px;
}

.toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 13px 15px;
  border: 1px solid currentColor;
  border-radius: 9px;
  background: var(--surface);
  box-shadow: var(--shadow);
  font-weight: 650;
}

.toast--success { color: var(--success); }
.toast--error { color: var(--danger); }
.toast--info { color: var(--info); }

.section-stack {
  display: grid;
  gap: 14px;
}

.wrap-text {
  white-space: pre-wrap;
}

.audit-detail-json {
  max-height: 340px;
  margin: 0;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-muted);
  color: var(--ink);
  font-family: ui-monospace, "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  font-size: 0.84rem;
  line-height: 1.65;
  white-space: pre-wrap;
  word-break: break-word;
}

.field small,
.card__header small {
  color: var(--muted);
}

.card__header > div h2 {
  margin: 0;
}

.related-link-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.related-link {
  display: grid;
  min-height: 96px;
  align-content: center;
  gap: 5px;
  padding: 16px;
  color: var(--ink);
  text-decoration: none;
}

.related-link:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
}

.related-link span {
  color: var(--muted);
  font-size: 0.86rem;
}

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

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

.metric-card {
  position: relative;
  display: grid;
  min-height: 164px;
  align-content: start;
  gap: 7px;
  padding: 18px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--ink);
  text-decoration: none;
}

.metric-card::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 5px;
  background: var(--line-strong);
  content: "";
}

.metric-card--info::after { background: var(--info); }
.metric-card--success::after { background: var(--success); }
.metric-card--warning::after { background: var(--warning); }
.metric-card--danger::after { background: var(--danger); }

.metric-card:hover {
  border-color: var(--brand);
  background: var(--brand-soft);
  color: var(--ink);
  transform: translateY(-2px);
}

.metric-card:active {
  transform: translateY(0);
}

.metric-card__symbol {
  position: absolute;
  top: 14px;
  right: 16px;
  color: var(--muted);
  font-size: 1.25rem;
  font-weight: 800;
}

.metric-card__label {
  padding-right: 30px;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.metric-card__value {
  font-size: clamp(1.9rem, 4vw, 3rem);
  line-height: 1.08;
}

.metric-card__detail,
.metric-card__drill {
  color: var(--muted);
  font-size: 0.8rem;
}

.metric-card__drill {
  margin-top: auto;
  color: var(--brand);
  font-weight: 750;
}

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

.display-board {
  display: grid;
  min-height: 100%;
  align-content: start;
  gap: 22px;
  padding: clamp(4px, 1vw, 12px);
}

.display-board__section {
  display: grid;
  gap: 12px;
  padding: clamp(16px, 2.4vw, 28px);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-lg);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.display-board__section h2 {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.55rem);
}

.display-board .metric-card {
  min-height: 178px;
  background: var(--surface-raised);
}

.display-board__footer {
  padding: 14px;
  color: var(--muted);
  text-align: center;
  font-weight: 700;
}

.attachment-panel .data-grid-shell {
  min-height: 310px;
}

.attachment-panel .button.grid-link {
  min-height: 32px;
  padding-inline: 0;
  text-align: left;
}

.mobile-only {
  display: none;
}

@media (min-width: 1440px) {
  :root {
    --sidebar-width: 252px;
  }

  .page-main {
    padding: var(--space-6);
  }

  .page-view {
    gap: var(--space-5);
  }

  .data-grid-shell {
    --grid-row-height: 42px;
  }
}

@media (max-width: 1100px) {
  .split-pane {
    grid-template-columns: minmax(280px, var(--master-width)) 10px minmax(320px, 1fr);
  }

  .user-chip {
    display: none;
  }
}

@media (max-width: 820px) {
  :root {
    --topbar-height: 58px;
  }

  .login-layout {
    grid-template-columns: 1fr;
    background: var(--page);
  }

  .login-story {
    min-height: auto;
    padding: 28px 22px 46px;
    background: var(--brand-strong);
  }

  .login-story h1 {
    margin-top: 34px;
    font-size: 2.4rem;
  }

  .login-panel {
    padding: 22px 14px 44px;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    left: 0;
    width: min(82vw, 300px);
    transform: translateX(-105%);
    transition: transform 180ms ease;
  }

  .app-shell[data-menu-open="true"] .sidebar {
    transform: translateX(0);
    box-shadow: var(--shadow);
  }

  .app-shell[data-menu-open="true"] .mobile-menu-backdrop:not([hidden]) {
    display: block;
  }

  .topbar {
    grid-column: 1;
  }

  .mobile-menu-button,
  .mobile-only {
    display: inline-flex;
  }

  .button,
  .mobile-menu-button {
    min-width: 44px;
    min-height: 44px;
  }

  .button--small,
  .row-height-resizer,
  .attachment-panel .button.grid-link,
  [data-attachment-upload],
  [data-attachment-download],
  [data-attachment-delete] {
    min-width: 44px;
    min-height: 44px;
  }

  .column-resizer {
    top: 50%;
    right: -22px;
    bottom: auto;
    width: 44px;
    height: 44px;
    transform: translateY(-50%);
  }

  .data-grid thead th {
    height: 44px;
    overflow: visible;
  }

  .column-resizer::after {
    top: 6px;
    right: 21px;
    bottom: 6px;
  }

  .global-search {
    flex-basis: auto;
  }

  .page-main {
    padding: 14px;
  }

  .page-view {
    min-height: calc(100dvh - var(--topbar-height) - 28px);
  }

  .page-header {
    flex-direction: column;
  }

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

  .related-link-grid {
    grid-template-columns: 1fr;
  }

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

  .split-pane {
    display: flex;
    min-height: 0;
    flex-direction: column;
    overflow: visible;
    border: 0;
    gap: 12px;
  }

  .split-pane__master,
  .split-pane__detail {
    min-height: 420px;
    border: 1px solid var(--line-strong);
    border-radius: var(--radius);
  }

  .splitter {
    display: none;
  }
}

@media (max-width: 768px) {
  .topbar,
  .page-main,
  .page-view,
  .page-header,
  .filter-bar,
  .data-grid-shell {
    max-width: 100%;
    min-width: 0;
  }

  .page-actions {
    width: 100%;
  }

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

  .data-grid-scroll {
    max-width: 100%;
    overflow-x: auto;
  }

  dialog {
    max-width: calc(100vw - 24px);
  }
}

@media (max-width: 560px) {
  .topbar {
    gap: 8px;
    padding-inline: 9px;
  }

  .topbar__actions .button__label {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
  }

  .page-main {
    padding: 10px;
  }

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

  .field,
  .field--grow {
    width: 100%;
  }

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

}

@media (max-width: 375px) {
  :root {
    --type-display: 1.6rem;
  }

  .global-search {
    min-width: 0;
  }

  .page-actions .button {
    flex: 1 1 100%;
  }

  .card__header,
  .card__body,
  .dialog-header,
  .dialog-body,
  .dialog-footer {
    padding: var(--space-3);
  }

  .dialog-footer,
  .grid-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .detail-list {
    grid-template-columns: minmax(0, 1fr);
  }

  .toast-region {
    right: var(--space-2);
    bottom: var(--space-2);
    width: calc(100vw - 16px);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .filter-bar,
  .data-grid-toolbar,
  .grid-pagination {
    display: none !important;
  }

  .app-shell {
    display: block;
  }

  .page-main {
    overflow: visible;
    padding: 0;
  }
}
