:root,
:root[data-theme="clinical-red"] {
  --ink: #1d232a;
  --text: var(--ink);
  --muted: #626c78;
  --subtle: #8b95a1;
  --primary: #c8232c;
  --brand: var(--primary);
  --primary-dark: #a81c24;
  --primary-soft: #fdf2f2;
  --primary-border: #f3c8cc;
  --primary-ring: rgba(200, 35, 44, .14);
  --companion: #3a434f;
  --companion-soft: #f1f3f6;
  --companion-border: #dce1e8;
  --accent: #c8232c;
  --danger: #c8232c;
  --danger-soft: #fef1f1;
  --warning: #b86327;
  --warning-soft: #fff6eb;
  --success: #1f7a4d;
  --success-soft: #e9f7ef;
  --info: #2563a6;
  --info-soft: #edf4fc;
  --line: #e5e8ee;
  --border: var(--line);
  --surface: #ffffff;
  --surface-subtle: #fafbfd;
  --canvas: #f6f7f9;
  --table-head: #f4f6f9;
  --table-head-text: #4d5764;
  --table-stripe: #fbfcfd;
  --table-hover: #fdf6f6;
  --sidebar: #ffffff;
  --sidebar-border: #e5e8ee;
  --sidebar-divider: #eef0f4;
  --sidebar-brand-title: #1d232a;
  --sidebar-brand-sub: #6b7582;
  --sidebar-text: #3a434f;
  --sidebar-muted: #8b95a1;
  --sidebar-hover: #f3f5f8;
  --sidebar-hover-text: #1d232a;
  --sidebar-active: #fdf2f2;
  --sidebar-active-text: #c8232c;
  --sidebar-bar: #c8232c;
  --sidebar-icon: #6b7582;
  --sidebar-icon-active: #c8232c;
  --sidebar-foot-text: #6b7582;
  --sidebar-btn-border: #dfe4ec;
  --sidebar-scroll: rgba(29, 35, 42, .14);
  --login-brand-bg: #1d232a;
  --login-brand-muted: #b7c0cc;
  --login-brand-eyebrow: #ff8a90;
  --metric-accent-sub: #ffd9dc;
  --shadow-sm: 0 1px 2px rgba(20, 26, 36, .05);
  --shadow: 0 8px 28px rgba(20, 26, 36, .12);
  --radius-sm: 6px;
  --radius: 8px;
  --radius-lg: 12px;
  --sidebar-w: 214px;
  --topbar-h: 48px;
  font-family: Inter, -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  font-size: 13px;
  color: var(--ink);
  background: var(--canvas);
  font-synthesis: none;
}

:root[data-theme="crimson-navy"] {
  --ink: #172336;
  --muted: #5a6b82;
  --subtle: #8394ab;
  --primary: #c8232c;
  --primary-dark: #a81c24;
  --primary-soft: #fdf2f2;
  --primary-border: #f3c8cc;
  --companion: #1d3557;
  --companion-soft: #edf2f8;
  --companion-border: #cdd9ea;
  --line: #dfe5f0;
  --surface-subtle: #f7f9fc;
  --canvas: #f4f6fa;
  --table-head: #edf2f8;
  --table-head-text: #354c6b;
  --table-stripe: #fafbfd;
  --table-hover: #f2f6fc;
  --sidebar: #162842;
  --sidebar-border: #1e3554;
  --sidebar-divider: rgba(255, 255, 255, .09);
  --sidebar-brand-title: #ffffff;
  --sidebar-brand-sub: #9bb4d4;
  --sidebar-text: #c7d6ea;
  --sidebar-muted: #7f99ba;
  --sidebar-hover: rgba(255, 255, 255, .08);
  --sidebar-hover-text: #ffffff;
  --sidebar-active: rgba(255, 255, 255, .14);
  --sidebar-active-text: #ffffff;
  --sidebar-bar: #e0353e;
  --sidebar-icon: #9bb4d4;
  --sidebar-icon-active: #ff8a90;
  --sidebar-foot-text: #92adc9;
  --sidebar-btn-border: rgba(255, 255, 255, .16);
  --sidebar-scroll: rgba(255, 255, 255, .18);
  --login-brand-bg: #162842;
  --login-brand-muted: #b5c7df;
  --login-brand-eyebrow: #ff8a90;
}

:root[data-theme="crimson-champagne"] {
  --ink: #2b241d;
  --muted: #6e6255;
  --subtle: #998c7d;
  --primary: #c8232c;
  --primary-dark: #a81c24;
  --primary-soft: #fdf2f2;
  --primary-border: #f3c8cc;
  --companion: #b37e2a;
  --companion-soft: #fbf5e8;
  --companion-border: #ead8b3;
  --line: #eae3d8;
  --surface-subtle: #fcfaf6;
  --canvas: #faf8f5;
  --table-head: #f7f2e8;
  --table-head-text: #65533a;
  --table-stripe: #fdfcf9;
  --table-hover: #fbf5eb;
  --sidebar: #fffdf9;
  --sidebar-border: #ebe4d8;
  --sidebar-divider: #f0e8da;
  --sidebar-brand-title: #2b241d;
  --sidebar-brand-sub: #8a7b69;
  --sidebar-text: #4a4035;
  --sidebar-muted: #9b8c79;
  --sidebar-hover: #f8f2e6;
  --sidebar-hover-text: #2b241d;
  --sidebar-active: #fdf2f2;
  --sidebar-active-text: #c8232c;
  --sidebar-bar: #c8232c;
  --sidebar-icon: #a07d47;
  --sidebar-icon-active: #c8232c;
  --sidebar-foot-text: #8a7b69;
  --sidebar-btn-border: #e5dac7;
  --login-brand-bg: #2b241d;
  --login-brand-muted: #d1c4b2;
  --login-brand-eyebrow: #e7be72;
}

:root[data-theme="crimson-sage"] {
  --ink: #1e2d29;
  --muted: #586f69;
  --subtle: #839993;
  --primary: #c8232c;
  --primary-dark: #a81c24;
  --primary-soft: #fdf2f2;
  --primary-border: #f3c8cc;
  --companion: #3e7b6d;
  --companion-soft: #eef6f3;
  --companion-border: #cbe0d9;
  --line: #dfe8e4;
  --surface-subtle: #f7fbf9;
  --canvas: #f6f8f7;
  --table-head: #eff6f3;
  --table-head-text: #385e54;
  --table-stripe: #fbfdfd;
  --table-hover: #f2f9f6;
  --sidebar: #ffffff;
  --sidebar-border: #dfe8e4;
  --sidebar-divider: #e9f1ee;
  --sidebar-brand-title: #1e2d29;
  --sidebar-brand-sub: #5f7a73;
  --sidebar-text: #354a44;
  --sidebar-muted: #7c918b;
  --sidebar-hover: #eef6f3;
  --sidebar-hover-text: #1e2d29;
  --sidebar-active: #fdf2f2;
  --sidebar-active-text: #c8232c;
  --sidebar-bar: #c8232c;
  --sidebar-icon: #4d7e71;
  --sidebar-icon-active: #c8232c;
  --sidebar-foot-text: #5f7a73;
  --sidebar-btn-border: #d5e2dd;
  --login-brand-bg: #1f332e;
  --login-brand-muted: #b3ccc4;
  --login-brand-eyebrow: #87cbb9;
}

:root[data-theme="crimson-steel"] {
  --ink: #1b2838;
  --muted: #566b84;
  --subtle: #8095ae;
  --primary: #c8232c;
  --primary-dark: #a81c24;
  --primary-soft: #fdf2f2;
  --primary-border: #f3c8cc;
  --companion: #2563a6;
  --companion-soft: #eef5fc;
  --companion-border: #c9def5;
  --line: #dde6f2;
  --surface-subtle: #f7fafe;
  --canvas: #f4f7fb;
  --table-head: #edf4fc;
  --table-head-text: #2d527c;
  --table-stripe: #fafcff;
  --table-hover: #f1f7fe;
  --sidebar: #ffffff;
  --sidebar-border: #dde6f2;
  --sidebar-divider: #e8eff8;
  --sidebar-brand-title: #1b2838;
  --sidebar-brand-sub: #5e7490;
  --sidebar-text: #33465e;
  --sidebar-muted: #798ea8;
  --sidebar-hover: #eef5fc;
  --sidebar-hover-text: #1b2838;
  --sidebar-active: #fdf2f2;
  --sidebar-active-text: #c8232c;
  --sidebar-bar: #c8232c;
  --sidebar-icon: #3c6ea5;
  --sidebar-icon-active: #c8232c;
  --sidebar-foot-text: #5e7490;
  --sidebar-btn-border: #d3e0ef;
  --login-brand-bg: #1b2b40;
  --login-brand-muted: #b6c9e0;
  --login-brand-eyebrow: #8ab9f0;
}

* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; line-height: 1.45; background: var(--canvas); color: var(--ink); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .5; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 2px; font-size: 17px; font-weight: 700; letter-spacing: -.2px; color: var(--ink); }
h2 { margin-bottom: 8px; font-size: 14px; font-weight: 650; color: var(--ink); }
h3 { margin: 14px 0 8px; font-size: 13px; font-weight: 650; color: var(--ink); }
code { padding: 1px 6px; border-radius: 4px; background: var(--companion-soft); color: var(--companion); font-size: 12px; }
.muted { color: var(--muted); font-size: 12px; }
.ui-icon { display: inline-block; flex: 0 0 auto; vertical-align: middle; }

/* Buttons */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 5px;
  min-height: 30px; padding: 5px 12px; border: 1px solid var(--primary);
  border-radius: var(--radius-sm); background: var(--primary); color: #fff;
  font-weight: 600; font-size: 12.5px; line-height: 1.2; white-space: nowrap;
  transition: background .14s ease, border-color .14s ease, color .14s ease;
}
.button:hover { background: var(--primary-dark); border-color: var(--primary-dark); text-decoration: none; }
.button.secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button.secondary:hover { border-color: var(--companion-border); background: var(--companion-soft); color: var(--companion); }
.button.text { min-height: 26px; padding: 3px 6px; border-color: transparent; background: transparent; color: var(--primary); font-weight: 550; }
.button.text:hover { background: var(--primary-soft); text-decoration: none; }
.button.danger { border-color: var(--danger); background: var(--danger); color: #fff; }
.button.danger:hover { background: #a81c24; border-color: #a81c24; }
.button.danger.text { border-color: transparent; background: transparent; color: var(--danger); }
.button.danger.text:hover { background: var(--danger-soft); }
.button.small { min-height: 26px; padding: 3px 9px; font-size: 12px; }
.button-row, .page-actions, .sticky-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: 12px; }
.sticky-actions { justify-content: flex-end; }
.icon-button {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--muted); font-size: 18px; line-height: 1;
}
.icon-button:hover { background: var(--companion-soft); color: var(--ink); }
.text-danger { color: var(--danger); font-weight: 700; }

/* Theme Switcher */
.theme-switcher { position: relative; display: inline-block; }
.theme-trigger {
  list-style: none; display: inline-flex; align-items: center; gap: 6px;
  min-height: 28px; padding: 3px 10px; border: 1px solid var(--line);
  border-radius: 99px; background: var(--surface); color: var(--ink);
  font-size: 11.5px; font-weight: 600; cursor: pointer; user-select: none;
  transition: border-color .14s ease, background .14s ease, box-shadow .14s ease;
}
.theme-trigger::-webkit-details-marker { display: none; }
.theme-trigger::after {
  content: ''; display: inline-block; width: 10px; height: 10px; margin-left: 1px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235a6676' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: center; background-size: contain;
  transition: transform .15s ease;
}
.theme-switcher[open] > .theme-trigger { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-ring); }
.theme-switcher[open] > .theme-trigger::after { transform: rotate(180deg); }
.theme-trigger:hover { border-color: var(--companion-border); background: var(--companion-soft); }
.theme-swatches { display: inline-flex; align-items: center; gap: 3px; }
.theme-swatches i { display: inline-block; width: 9px; height: 9px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, .14); }
.theme-menu {
  position: absolute; right: 0; top: calc(100% + 6px); z-index: 160;
  min-width: 214px; padding: 6px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.theme-menu-title { padding: 4px 8px 6px; color: var(--subtle); font-size: 11px; font-weight: 650; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.theme-option {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 7px 8px; border: 1px solid transparent; border-radius: var(--radius-sm);
  background: transparent; color: var(--ink); font-size: 12px; text-align: left;
  transition: background .12s ease, border-color .12s ease;
}
.theme-option:hover { background: var(--companion-soft); }
.theme-option.active { background: var(--primary-soft); border-color: var(--primary-border); color: var(--primary); font-weight: 650; }
.theme-option-name { flex: 1; white-space: nowrap; }
.login-theme-bar { position: absolute; top: 18px; right: 20px; z-index: 5; }

/* App Shell */
.app-shell { min-height: 100vh; }
.sidebar {
  position: fixed; inset: 0 auto 0 0; z-index: 30; display: flex; flex-direction: column;
  width: var(--sidebar-w); background: var(--sidebar); color: var(--sidebar-text);
  border-right: 1px solid var(--sidebar-border);
  transition: width .18s ease, transform .18s ease, background .18s ease, border-color .18s ease;
}
.sidebar-brand {
  display: flex; align-items: center; gap: 9px; height: var(--topbar-h);
  padding: 0 12px; border-bottom: 1px solid var(--sidebar-divider); color: var(--sidebar-brand-title);
  overflow: hidden;
}
.sidebar-brand:hover { text-decoration: none; }
.official-logo { display: block; object-fit: contain; }
.sidebar-logo-surface {
  display: flex; width: 38px; height: 26px; padding: 2px 4px; border-radius: 5px;
  background: #ffffff; border: 1px solid var(--sidebar-divider);
  align-items: center; justify-content: center; flex: 0 0 auto;
}
.sidebar-official-logo { width: 100%; height: auto; }
.sidebar-brand-copy { min-width: 0; overflow: hidden; }
.sidebar-brand strong { display: block; font-size: 15px; line-height: 1.15; letter-spacing: .3px; white-space: nowrap; color: var(--sidebar-brand-title); }
.sidebar-brand small { display: block; color: var(--sidebar-brand-sub); font-size: 10px; white-space: nowrap; }
.sidebar-nav { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 8px 8px 18px; }
.sidebar-nav::-webkit-scrollbar { width: 5px; }
.sidebar-nav::-webkit-scrollbar-thumb { background: var(--sidebar-scroll); border-radius: 99px; }
.nav-group { margin-bottom: 6px; }
.nav-group-label {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  padding: 6px 8px 4px; border: 0; background: transparent;
  color: var(--sidebar-muted); font-size: 11px; font-weight: 650; letter-spacing: .4px; text-align: left;
}
.nav-group-label:hover { color: var(--sidebar-hover-text); }
.nav-group-chevron { transition: transform .15s ease; opacity: .75; }
.nav-group.collapsed .nav-group-chevron { transform: rotate(-90deg); }
.nav-group.collapsed .nav-group-links { display: none; }
.nav-group a {
  display: flex; align-items: center; gap: 9px; margin: 1px 0; padding: 6px 9px;
  border-radius: var(--radius-sm); color: var(--sidebar-text); font-size: 12.5px; line-height: 1.3;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: background .12s, color .12s;
}
.nav-group a:hover { background: var(--sidebar-hover); color: var(--sidebar-hover-text); text-decoration: none; }
.nav-group a.active { background: var(--sidebar-active); color: var(--sidebar-active-text); font-weight: 650; box-shadow: inset 3px 0 var(--sidebar-bar); }
.nav-icon { display: inline-flex; align-items: center; justify-content: center; width: 18px; height: 18px; flex: 0 0 auto; color: var(--sidebar-icon); }
.nav-group a.active .nav-icon { color: var(--sidebar-icon-active); }
.nav-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.sidebar-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 6px;
  padding: 8px 12px; border-top: 1px solid var(--sidebar-divider); color: var(--sidebar-foot-text); font-size: 11px;
}
.status-dot { display: inline-block; width: 6px; height: 6px; margin-right: 5px; border-radius: 50%; background: #22a06b; }
.sidebar-collapse-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; border: 1px solid var(--sidebar-btn-border);
  border-radius: var(--radius-sm); background: transparent; color: var(--sidebar-foot-text);
}
.sidebar-collapse-btn:hover { background: var(--sidebar-hover); color: var(--sidebar-hover-text); }

/* Collapsed Sidebar (desktop) */
.app-shell.sidebar-collapsed { --sidebar-w: 54px; }
.app-shell.sidebar-collapsed .sidebar-brand-copy,
.app-shell.sidebar-collapsed .nav-label,
.app-shell.sidebar-collapsed .nav-group-label,
.app-shell.sidebar-collapsed .sidebar-status-text { display: none; }
.app-shell.sidebar-collapsed .sidebar-brand { justify-content: center; padding: 0; }
.app-shell.sidebar-collapsed .sidebar-nav { padding: 8px 6px; }
.app-shell.sidebar-collapsed .nav-group.collapsed .nav-group-links { display: block; }
.app-shell.sidebar-collapsed .nav-group { margin-bottom: 8px; padding-bottom: 6px; border-bottom: 1px solid var(--sidebar-divider); }
.app-shell.sidebar-collapsed .nav-group:last-child { border-bottom: 0; }
.app-shell.sidebar-collapsed .nav-group a { justify-content: center; padding: 7px 0; }
.app-shell.sidebar-collapsed .sidebar-foot { justify-content: center; padding: 8px 6px; }

.main-shell { min-height: 100vh; margin-left: var(--sidebar-w); transition: margin-left .18s ease; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  height: var(--topbar-h); padding: 0 16px; border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(10px);
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.breadcrumb { display: flex; gap: 6px; align-items: center; color: var(--subtle); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.breadcrumb b { color: var(--line); font-weight: 400; }
.breadcrumb strong { color: var(--ink); font-weight: 650; }
.topbar-user { display: flex; align-items: center; gap: 8px; flex: 0 0 auto; }
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; border-radius: 50%; background: var(--companion-soft);
  color: var(--companion); border: 1px solid var(--companion-border); font-size: 12px; font-weight: 700;
}
.user-copy strong, .user-copy small { display: block; line-height: 1.2; }
.user-copy strong { font-size: 12px; }
.user-copy small { color: var(--muted); font-size: 10px; }
.menu-button { display: none; }
.sidebar-overlay { display: none; }

/* Page Content — High Density Full Width */
.page-content { width: 100%; max-width: none; margin: 0; padding: 12px 16px 24px; outline: none; }
.page-header {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  margin-bottom: 10px; flex-wrap: wrap;
}
.page-header-copy { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 10px; min-width: 0; }
.page-header h1 { margin: 0; font-size: 16px; }
.page-header p { margin: 0; color: var(--muted); font-size: 12px; }
.page-header .page-actions { margin: 0; gap: 6px; }

.panel {
  margin-bottom: 12px; padding: 12px 14px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-sm);
}
.panel.highlighted { border-top: 3px solid var(--primary); }
.panel > p:empty,
.panel > p.muted:empty { display: none; }
.panel > p:not(.form-error),
.panel > p.muted {
  margin: 0 0 10px; padding: 6px 10px; border-left: 3px solid var(--companion);
  border-radius: 4px; background: var(--companion-soft); color: var(--muted); font-size: 12px; line-height: 1.5;
}
.panel-title { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.panel-title h2 { margin: 0; font-size: 14px; white-space: nowrap; }
.panel-title select,
.batch-bar select { width: auto; min-width: 116px; height: 30px; min-height: 30px; padding: 3px 28px 3px 9px; background-position: right 8px center; flex: 0 0 auto; font-size: 12px; }
.panel-title > span { color: var(--muted); font-size: 11px; }
.detail-slot:empty { display: none; }

/* Notices & Cards */
.notice {
  margin-bottom: 10px; padding: 8px 12px; border: 1px solid var(--companion-border); border-left: 3px solid var(--companion);
  border-radius: var(--radius-sm); background: var(--companion-soft); color: var(--ink); font-size: 12px;
}
.notice strong { display: block; margin-bottom: 2px; font-size: 12.5px; color: var(--companion); }
.notice p { margin: 0; }
.notice-error { border-color: var(--primary-border); border-left-color: var(--danger); background: var(--danger-soft); color: var(--danger); }
.content-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 12px; }
.payment-channel-card header { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); }
.payment-channel-card header p { margin: 2px 0 0; color: var(--muted); font-size: 11.5px; }

/* Compact KPI Metrics */
.metric-grid, .metrics-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr));
  gap: 10px; margin-bottom: 12px;
}
.metric-card {
  position: relative; overflow: hidden; min-height: 74px; padding: 11px 14px;
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  box-shadow: var(--shadow-sm);
}
.metric-card.accent { border-color: var(--primary); background: linear-gradient(135deg, var(--primary), var(--primary-dark)); color: #fff; }
.metric-card-link { display: block; text-decoration: none; color: inherit; transition: border-color .15s, transform .12s, box-shadow .15s; }
.metric-card-link:hover { border-color: var(--companion); box-shadow: 0 3px 10px var(--primary-ring); transform: translateY(-1px); }
.metric-card-link.accent:hover { color: #fff; filter: brightness(1.04); }
.metric-card > span { display: block; margin-bottom: 4px; color: var(--muted); font-size: 11.5px; font-weight: 500; }
.metric-card.accent > span, .metric-card.accent small { color: var(--metric-accent-sub); }
.metric-card strong { display: block; margin-bottom: 2px; font-size: 21px; line-height: 1.2; letter-spacing: -.4px; font-variant-numeric: tabular-nums; }
.metric-card small { display: block; color: var(--subtle); font-size: 11px; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1.15fr; gap: 12px; }
.dashboard-grid .panel { margin: 0; }

/* Tabs */
.tabs { display: flex; gap: 2px; margin-bottom: 10px; border-bottom: 1px solid var(--line); }
.tabs.scrollable { overflow-x: auto; }
.tab {
  flex: 0 0 auto; padding: 7px 14px; border: 0; border-bottom: 2px solid transparent;
  background: transparent; color: var(--muted); font-size: 12.5px; font-weight: 500;
}
.tab:hover { color: var(--primary); }
.tab.active { border-color: var(--primary); color: var(--primary); font-weight: 700; }

/* Toolbars & Filters (Compact Single/Dense Rows) */
.toolbar, .filter-bar, .filters, .section-toolbar {
  display: flex; align-items: flex-end; flex-wrap: wrap; gap: 8px; margin-bottom: 10px;
}
.toolbar.end { justify-content: flex-end; align-items: center; }
.section-toolbar { justify-content: space-between; align-items: center; padding: 8px 10px; border-radius: var(--radius-sm); background: var(--surface-subtle); }
.section-toolbar p { margin: 2px 0 0; }
.toolbar > label:not(.form-field),
.filter-bar > label:not(.form-field),
.filters > label:not(.form-field) {
  display: inline-flex; align-items: center; gap: 6px; min-height: 32px; color: var(--muted); font-size: 12px; white-space: nowrap;
}
.toolbar .form-field,
.filter-bar .form-field { min-width: 132px; flex: 0 1 auto; margin: 0; gap: 3px; }
.toolbar input:not([type="checkbox"]),
.toolbar select,
.filter-bar input:not([type="checkbox"]),
.filter-bar select,
.filters select,
.filters input:not([type="checkbox"]) {
  width: auto; min-width: 120px; height: 32px; min-height: 32px; padding: 4px 10px; font-size: 12px;
}
.toolbar select,
.filter-bar select,
.filters select {
  padding-right: 28px;
  background-position: right 8px center;
}
.toolbar input[type="search"],
.filter-bar input[type="search"] { min-width: 185px; }
.toolbar .form-field input,
.toolbar .form-field select,
.filter-bar .form-field input,
.filter-bar .form-field select { width: 100%; }
.toolbar input[type="number"] { width: 106px; }
.toolbar input[type="date"],
.toolbar input[type="month"] { width: 136px; }
.toolbar input[type="datetime-local"] { width: 190px; min-width: 190px; }
.batch-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: 8px;
  margin-bottom: 8px; padding: 6px 10px; border: 1px solid var(--companion-border);
  border-radius: var(--radius-sm); background: var(--companion-soft); font-size: 12px;
}
.check-field input { accent-color: var(--primary); }
.form-hint { margin: 0 0 8px; color: var(--muted); font-size: 12px; line-height: 1.5; }
.filter-disclosure { width: 100%; margin: 2px 0; }
.filter-disclosure > summary {
  display: inline-flex; align-items: center; gap: 6px; color: var(--companion);
  cursor: pointer; font-size: 12px; font-weight: 600; padding: 5px 10px; user-select: none;
  border: 1px solid var(--companion-border); border-radius: var(--radius-sm); background: var(--companion-soft);
  transition: background .14s ease, border-color .14s ease;
}
.filter-disclosure > summary:hover { border-color: var(--companion); }
.filter-disclosure[open] > summary { margin-bottom: 8px; }
.filter-disclosure > .toolbar {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 10px 12px; align-items: end;
  padding: 10px 12px; border: 1px dashed var(--line); border-radius: var(--radius-sm);
  background: var(--surface-subtle); margin-bottom: 4px;
}
.filter-disclosure > .toolbar .form-field { min-width: 0; width: 100%; }
.filter-disclosure > .toolbar > label:not(.form-field) {
  display: flex; flex-direction: column; align-items: stretch; gap: 4px;
  min-width: 0; min-height: 0; white-space: normal;
}
.filter-disclosure > .toolbar input:not([type="checkbox"]),
.filter-disclosure > .toolbar select { width: 100%; min-width: 0; }
.filter-disclosure > .toolbar .lookup-control { grid-column: span 2; min-width: 0; width: 100%; }
.filter-disclosure > .toolbar .lookup-row input,
.filter-disclosure > .toolbar .lookup-row select { min-width: 0 !important; max-width: none; }
@media (max-width: 680px) {
  .filter-disclosure > .toolbar .lookup-control { grid-column: span 1; }
}

/* Searchable Lookup Widget */
.lookup-control { display: inline-flex; flex-direction: column; gap: 3px; min-width: 175px; }
.lookup-control > span { color: var(--muted); font-size: 11.5px; }
.lookup-row { display: flex; align-items: center; gap: 4px; }
.lookup-row input { flex: 1; min-width: 110px !important; }
.lookup-row select { flex: 1; min-width: 130px !important; max-width: 220px; }

/* High-Density Tables */
.table-wrap {
  width: 100%; overflow: auto; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface);
}
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12.5px; }
thead th {
  position: sticky; top: 0; z-index: 3; padding: 7px 10px;
  border-bottom: 1px solid var(--line); background: var(--table-head);
  color: var(--table-head-text); font-size: 11.5px; font-weight: 650; text-align: left; white-space: nowrap;
}
tbody td {
  max-width: 260px; padding: 7px 10px; border-bottom: 1px solid var(--line);
  vertical-align: middle; line-height: 1.35; overflow-wrap: anywhere;
}
tbody tr:nth-child(even) td { background: var(--table-stripe); }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--table-hover); }
td strong { font-weight: 600; color: var(--ink); }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 11px; line-height: 1.25; }
.cell-nowrap { white-space: nowrap; }
.cell-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.cell-clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.cell-details { margin-top: 4px; color: var(--muted); font-size: 11px; }
.cell-details summary { width: max-content; cursor: pointer; color: var(--companion); font-weight: 600; }
.cell-details dl {
  display: grid; grid-template-columns: max-content 1fr; gap: 3px 8px;
  min-width: 200px; margin: 5px 0 0; padding: 6px 8px;
  border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle);
}
.cell-details dt, .cell-details dd { margin: 0; }
.cell-details dd { color: var(--text); }

.result-history summary { cursor: pointer; color: var(--companion); font-weight: 600; white-space: nowrap; }
.result-history-items { display: grid; gap: 6px; min-width: 240px; margin-top: 6px; }
.result-history-item { display: grid; grid-template-columns: minmax(90px, 1fr) auto; gap: 2px 8px; padding: 6px 8px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle); }
.result-history-item small { color: var(--muted); }

/* Sticky Actions Column & Floating Action Menu */
.actions-column, td.actions-cell {
  position: sticky; right: 0; width: 1%; white-space: nowrap;
  background: var(--surface); box-shadow: -8px 0 12px -12px rgba(20, 26, 36, .3);
}
thead th.actions-column { z-index: 4; background: var(--table-head); }
tbody tr:nth-child(even) td.actions-cell { background: var(--table-stripe); }
tbody tr:hover td.actions-cell { background: var(--table-hover); }
td.actions-cell { z-index: 2; }
td.actions-cell.actions-open { z-index: 80 !important; }
.table-actions { display: inline-flex; align-items: center; gap: 2px; white-space: nowrap; }
.row-actions-menu { position: relative; display: inline-block; }
.row-actions-summary { cursor: pointer; list-style: none; }
.row-actions-summary::-webkit-details-marker { display: none; }
.row-actions-panel {
  position: absolute; right: 0; top: calc(100% + 4px); z-index: 60;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  min-width: 132px; padding: 5px; border: 1px solid var(--line);
  border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow);
}
.row-actions-panel.floating-fixed { position: fixed; right: auto; top: auto; margin: 0; z-index: 220; }
.row-actions-panel .button { justify-content: flex-start; width: 100%; padding: 5px 8px; }

/* Status Badges */
.badge {
  display: inline-flex; align-items: center; min-height: 20px; padding: 1px 7px;
  border-radius: 99px; background: var(--companion-soft); color: var(--companion);
  font-size: 11px; font-weight: 600; white-space: nowrap;
}
.status-active, .status-completed, .status-published, .status-approved, .status-settled, .status-sent, .status-received, .status-success, .status-paid, .status-reconciled { background: var(--success-soft); color: var(--success); }
.status-pending, .status-pending-review, .status-pending-reconciliation, .status-report-review, .status-testing, .status-pending-pickup, .status-waiting-report, .status-pending-payment, .status-processing, .status-sending, .status-unknown { background: var(--warning-soft); color: var(--warning); }
.status-rejected, .status-failed, .status-refunded, .status-overdue, .status-exception, .status-cancelled, .status-canceled, .status-inactive, .status-audit-failed, .status-closed { background: var(--danger-soft); color: var(--danger); }
.status-in-transit, .status-confirmed, .status-issued, .status-shipped, .status-picked-up, .status-delivered, .status-result-entered, .status-draft { background: var(--info-soft); color: var(--info); }

/* Pagination */
.pagination {
  display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px;
  padding-top: 10px; margin-top: 8px; border-top: 1px solid var(--line);
  color: var(--muted); font-size: 12px;
}
.pagination > div, .pagination-controls { display: flex; align-items: center; gap: 6px; white-space: nowrap; }
.pagination-controls > span { white-space: nowrap; }
.pagination select[data-page-size] {
  width: auto; min-width: 86px; height: 28px; min-height: 28px; padding: 2px 24px 2px 8px;
  background-position: right 6px center; background-size: 11px 11px; font-size: 12px;
}

/* States */
.empty-state, .state { padding: 34px 16px; color: var(--muted); text-align: center; }
.empty-state p, .state p { margin: 6px 0 0; font-size: 12.5px; }
.empty-icon { display: block; color: var(--subtle); font-size: 26px; }
.error-state { color: var(--danger); }
.error-state .button { margin-top: 10px; }
.spinner { display: inline-block; width: 22px; height: 22px; border: 2px solid var(--line); border-top-color: var(--primary); border-radius: 50%; animation: spin .75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Details & Forms */
.detail-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 12px; margin: 0; }
.detail-item { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.detail-item.wide, .detail-wide { grid-column: 1 / -1; }
.detail-item dt { margin-bottom: 2px; color: var(--muted); font-size: 11px; }
.detail-item dd { margin: 0; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; overflow-wrap: anywhere; }
.modal-body > dl:not(.detail-grid),
.panel dl:not(.detail-grid) {
  display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 4px 10px;
  margin: 8px 0 12px; padding: 8px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: var(--surface-subtle); font-size: 12px;
}
.modal-body > dl:not(.detail-grid) dt, .panel dl:not(.detail-grid) dt { color: var(--muted); font-weight: 550; }
.modal-body > dl:not(.detail-grid) dd, .panel dl:not(.detail-grid) dd { margin: 0; color: var(--ink); overflow-wrap: anywhere; }

.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 12px; }
.form-grid.cols-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-grid.cols-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.form-field { display: flex; flex-direction: column; gap: 4px; color: var(--muted); font-size: 12px; }
.form-field.wide { grid-column: 1 / -1; }
.form-field em { margin-left: 2px; color: var(--danger); font-style: normal; }
.searchable-picker { display: flex; flex-direction: column; gap: 4px; }
.searchable-input { font-size: 12px; min-height: 30px; background-color: var(--surface-subtle); }
.searchable-hint { font-size: 11px; min-height: 15px; line-height: 1.3; }
.json-preview { margin: 0; padding: 8px 10px; max-height: 220px; overflow: auto; border: 1px solid var(--line); border-radius: var(--radius-sm); background: var(--surface-subtle); font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; line-height: 1.45; white-space: pre-wrap; word-break: break-word; }
input, select, textarea {
  width: 100%; min-height: 32px; padding: 5px 10px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); outline: none; background-color: #fff; color: var(--ink);
  font-size: 12.5px; line-height: 1.4;
  transition: border-color .14s ease, box-shadow .14s ease, background-color .14s ease;
}
select {
  height: 32px;
  padding: 5px 30px 5px 10px;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  cursor: pointer;
  text-overflow: ellipsis;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%235a6676' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M4 6l4 4 4-4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  background-size: 13px 13px;
}
select::picker-icon {
  display: none;
}
select::-ms-expand {
  display: none;
}
select[multiple], select[size]:not([size="1"]) {
  height: auto;
  padding-right: 10px;
  background-image: none;
}
input:hover:not(:disabled):not([readonly]),
select:hover:not(:disabled),
textarea:hover:not(:disabled):not([readonly]) {
  border-color: var(--companion-border);
}
input:focus, select:focus, textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 2px var(--primary-ring); }
input[readonly], input:disabled, select:disabled, textarea:disabled {
  background-color: var(--surface-subtle); color: var(--muted); cursor: not-allowed;
}
select:disabled { opacity: .78; }
textarea { min-height: 78px; resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 15px; min-height: 15px; margin: 0; vertical-align: middle; }
.form-error { min-height: 18px; margin-top: 6px; color: var(--danger); font-size: 12px; }
.result-row { margin: 0 0 12px; padding: 12px; border: 1px solid var(--line); border-radius: var(--radius); }
.result-row legend { padding: 0 6px; color: var(--companion); font-size: 12.5px; font-weight: 700; }
.narrow-form { max-width: 560px; margin: 8px auto; padding: 12px; }

/* Modals, Drawers & Fullscreen Workspaces */
.modal-backdrop {
  position: fixed; inset: 0; z-index: 100; display: flex; align-items: center; justify-content: center;
  padding: 16px; background: rgba(15, 20, 28, .5); backdrop-filter: blur(2px);
}
.modal-backdrop.is-drawer { justify-content: flex-end; padding: 0; }
.modal-backdrop.is-fullscreen { padding: 14px; }
.modal {
  display: flex; flex-direction: column; width: min(580px, 100%); max-height: calc(100vh - 32px);
  overflow: hidden; border-radius: var(--radius-lg); background: #fff; box-shadow: 0 20px 64px rgba(15, 20, 28, .26);
}
.modal-wide { width: min(1120px, 95vw); }
.modal-drawer { width: min(1240px, 94vw); height: 100vh; max-height: 100vh; border-radius: 0; }
.modal-fullscreen { width: min(1440px, 96vw); height: calc(100vh - 28px); max-height: calc(100vh - 28px); }
.modal-header {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 11px 16px; border-bottom: 1px solid var(--line); background: var(--surface-subtle);
}
.modal-header h2 { margin: 0; font-size: 15px; }
.modal-body { flex: 1 1 auto; overflow-y: auto; padding: 14px 16px; }
.modal-footer {
  flex: 0 0 auto; display: flex; align-items: center; justify-content: flex-end; gap: 8px;
  padding: 10px 16px; border-top: 1px solid var(--line); background: var(--surface-subtle);
}

/* Workspace Split / Summary Strip */
.workspace-summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 18px;
  margin-bottom: 12px; padding: 10px 12px; border: 1px solid var(--companion-border);
  border-radius: var(--radius); background: var(--companion-soft);
}
.workspace-summary-items { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: 12px; }
.workspace-summary-items span { color: var(--muted); }
.workspace-summary-items strong { color: var(--ink); font-weight: 650; }
.workspace-section {
  margin-bottom: 12px; padding: 12px; border: 1px solid var(--line);
  border-radius: var(--radius); background: #fff;
}
.workspace-section-head {
  display: flex; align-items: center; justify-content: space-between; gap: 8px;
  margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line);
}
.workspace-section-head h3 { margin: 0; font-size: 13px; color: var(--companion); }
.barcode-box { display: inline-flex; flex-direction: column; align-items: center; padding: 4px 10px; border: 1px solid var(--line); border-radius: var(--radius-sm); background: #fff; }
.barcode-box svg { display: block; max-width: 220px; height: 34px; }
.barcode-box small { margin-top: 2px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; letter-spacing: 1px; color: var(--ink); }

/* Toast */
.toast-root { position: fixed; bottom: 20px; right: 20px; z-index: 250; display: flex; flex-direction: column; gap: 8px; }
.toast {
  max-width: 380px; padding: 9px 14px; border: 1px solid #c3e2d0; border-radius: var(--radius);
  background: #edf9f2; color: #1f6b42; box-shadow: var(--shadow); font-size: 12.5px; animation: toast-in .18s ease;
}
.toast-error { border-color: #efcfcb; background: #fff3f1; color: var(--danger); }
@keyframes toast-in { from { transform: translateY(-6px); opacity: 0; } }

/* Login */
.login-page {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  background: #0d2a26;
}
.login-backdrop {
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  background: #0d2a26;
}
.login-bg-slide {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity 1.1s ease, transform 7s ease-out;
}
.login-bg-slide.is-active {
  opacity: 1;
  transform: scale(1);
}
.login-scrim {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(180deg, rgba(8, 28, 25, .36) 0%, rgba(8, 28, 25, .08) 38%, rgba(8, 28, 25, .74) 100%),
    linear-gradient(95deg, rgba(8, 28, 25, .44) 0%, rgba(8, 28, 25, .14) 52%, rgba(8, 28, 25, .34) 100%);
}
.login-stage {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 432px);
  gap: clamp(28px, 4vw, 64px);
  min-height: 100vh;
  max-width: 1560px;
  margin: 0 auto;
  padding: clamp(28px, 4vw, 52px) clamp(28px, 5vw, 72px);
}
.login-intro {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #ffffff;
}
.login-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  border: 1px solid rgba(255, 255, 255, .22);
  border-radius: 999px;
  background: rgba(11, 38, 34, .48);
  backdrop-filter: blur(10px);
  color: #eef8f5;
  font-size: 12px;
  font-weight: 500;
  letter-spacing: .5px;
}
.login-badge .status-dot { margin-right: 0; }
.login-intro-copy { max-width: 560px; padding-bottom: 6px; }
.login-intro-copy h1 {
  margin-bottom: 12px;
  font-size: clamp(30px, 2.8vw, 40px);
  font-weight: 700;
  line-height: 1.24;
  letter-spacing: -.015em;
  color: #ffffff;
  text-wrap: balance;
  text-shadow: 0 2px 18px rgba(6, 22, 19, .38);
}
.login-intro-copy p {
  margin: 0;
  color: rgba(238, 248, 245, .94);
  font-size: 14.5px;
  line-height: 1.7;
  text-wrap: pretty;
  text-shadow: 0 1px 12px rgba(6, 22, 19, .45);
}
.login-scene-switcher {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 22px;
}
.login-scene-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 32px;
  padding: 5px 13px;
  border: 1px solid rgba(255, 255, 255, .24);
  border-radius: 999px;
  background: rgba(10, 34, 30, .42);
  backdrop-filter: blur(8px);
  color: rgba(235, 246, 242, .82);
  font-size: 12px;
  font-weight: 500;
  transition: background-color .2s ease, border-color .2s ease, color .2s ease;
}
.login-scene-pill:hover {
  background: rgba(16, 52, 46, .64);
  border-color: rgba(255, 255, 255, .44);
  color: #ffffff;
}
.login-scene-pill.is-active {
  border-color: rgba(255, 255, 255, .72);
  background: rgba(23, 107, 91, .88);
  color: #ffffff;
}
.login-scene-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .52);
}
.login-scene-pill.is-active .login-scene-dot { background: #ffffff; }

.login-panel { display: flex; align-items: center; justify-content: flex-end; }
.login-card {
  width: min(432px, 100%);
  padding: 38px 36px 32px;
  border: 1px solid rgba(255, 255, 255, .75);
  border-radius: 18px;
  background: rgba(255, 255, 255, .96);
  backdrop-filter: blur(18px);
  box-shadow: 0 24px 64px rgba(6, 24, 21, .28);
}
.login-card-brand {
  display: flex;
  justify-content: center;
  padding-bottom: 20px;
  margin-bottom: 18px;
  border-bottom: 1px solid #edf2f0;
}
.login-official-logo { width: min(244px, 84%); height: auto; }
.mobile-official-logo { width: 116px; height: auto; margin-right: 4px; }
.eyebrow { display: block; margin-bottom: 14px; color: var(--login-brand-eyebrow); font-size: 10.5px; font-weight: 700; letter-spacing: 2px; }
.login-mode-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
  margin-bottom: 18px;
  border-radius: 10px;
  background: #eff4f2;
}
.login-mode-tab {
  min-height: 36px;
  padding: 6px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #5b706a;
  font-size: 13px;
  font-weight: 500;
  transition: background-color .16s ease, color .16s ease;
}
.login-mode-tab:hover { color: var(--primary); }
.login-mode-tab.is-active {
  background: #ffffff;
  color: var(--primary);
  font-weight: 600;
  box-shadow: 0 2px 6px rgba(16, 47, 42, .08);
}
.login-card-head { margin-bottom: 18px; }
.login-card-head.centered { text-align: center; }
.login-card h2 { margin-bottom: 5px; font-size: 21px; font-weight: 700; color: var(--ink); letter-spacing: -.2px; }
.login-card-head p { margin: 0; color: var(--muted); font-size: 12.5px; line-height: 1.55; }
.login-qr-panel { text-align: center; }
.login-qr-panel[hidden], #login-sms-form[hidden], #login-form[hidden] { display: none; }
.login-qr-frame {
  position: relative;
  width: 206px;
  height: 206px;
  margin: 0 auto 14px;
  padding: 12px;
  border: 1px solid #dce6e3;
  border-radius: 14px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}
.login-qr-image { width: 100%; height: 100%; object-fit: contain; display: block; }
.login-qr-image[hidden] { display: none; }
.login-qr-placeholder {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px;
  color: #5b706a;
  font-size: 12px;
  line-height: 1.55;
}
.login-qr-placeholder[hidden] { display: none; }
.login-qr-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: rgba(255, 255, 255, .93);
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
}
.login-qr-overlay[hidden] { display: none; }
.login-qr-status {
  margin: 0 0 12px;
  color: #425a54;
  font-size: 12.5px;
  line-height: 1.55;
}
.login-qr-actions {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding-top: 8px;
  border-top: 1px solid #eef3f1;
}
.login-sms-send {
  flex: 0 0 auto;
  min-height: 36px;
  margin-right: 5px;
  padding: 0 12px;
  border: 0;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.login-sms-send:hover:not(:disabled) { background: #d8ece6; }
.pending-shell {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px 20px;
  background: var(--canvas);
}
.pending-card {
  width: min(500px, 100%);
  padding: 36px 34px 30px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #ffffff;
  box-shadow: var(--shadow);
}
.pending-card h1 { margin: 14px 0 10px; font-size: 24px; }
.pending-lead { margin: 0 0 22px; color: var(--muted); font-size: 13.5px; line-height: 1.7; }
.pending-meta {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px 18px;
  margin: 0 0 24px;
  padding: 16px 18px;
  border: 1px solid #e7eeea;
  border-radius: 12px;
  background: #f8fbfa;
}
.pending-meta dt { color: var(--muted); font-size: 11.5px; margin-bottom: 4px; }
.pending-meta dd { margin: 0; color: var(--ink); font-size: 13.5px; font-weight: 600; }
.pending-actions { display: flex; gap: 12px; margin-bottom: 14px; }
.pending-actions .button { flex: 1; min-height: 44px; }
.login-alert {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  margin-bottom: 18px;
  padding: 10px 12px;
  border: 1px solid #f0cbc7;
  border-radius: 9px;
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  line-height: 1.5;
}
.login-alert[hidden] { display: none; }
.login-alert-icon { display: inline-flex; flex: 0 0 auto; width: 18px; height: 18px; margin-top: 1px; }
.login-alert-icon svg { width: 100%; height: 100%; }
.login-alert-text { flex: 1; min-width: 0; }
.login-field { margin-bottom: 18px; gap: 8px; font-size: 13px; font-weight: 500; color: #314843; }
.login-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
  border: 1px solid #d5e0dc;
  border-radius: 9px;
  background: #f9fbfa;
  transition: border-color .16s ease, box-shadow .16s ease, background-color .16s ease;
}
.login-input-wrap:focus-within {
  border-color: var(--primary);
  background: #ffffff;
  box-shadow: 0 0 0 3px rgba(23, 107, 91, .11);
}
.login-input-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 44px;
  flex: 0 0 auto;
  color: #7c908b;
  pointer-events: none;
}
.login-input-icon svg { width: 18px; height: 18px; }
.login-input-wrap:focus-within .login-input-icon { color: var(--primary); }
.login-input-wrap input {
  flex: 1;
  min-width: 0;
  min-height: 44px;
  padding: 10px 10px 10px 0;
  border: 0;
  border-radius: 9px;
  background: transparent;
  box-shadow: none;
  font-size: 14px;
  color: var(--ink);
}
.login-input-wrap input:focus { border: 0; box-shadow: none; }
.login-input-action {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  margin-right: 4px;
  padding: 0;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #7c908b;
  flex: 0 0 auto;
  transition: background-color .15s ease, color .15s ease;
}
.login-input-action[hidden] { display: none; }
.login-input-action:hover { background: #edf3f1; color: var(--ink); }
.login-input-action svg { width: 18px; height: 18px; }
.login-caps-hint { color: #a96923; font-size: 12px; font-weight: 500; }
.login-caps-hint[hidden] { display: none; }
.login-options { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 20px; }
.login-remember {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4f635e;
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
.login-remember input { width: 16px; min-height: 16px; margin: 0; accent-color: var(--primary); cursor: pointer; }
.login-button { width: 100%; min-height: 46px; border-radius: 9px; font-size: 15px; letter-spacing: 1px; }
.login-spinner {
  display: inline-block;
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, .35);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin .75s linear infinite;
}
.login-note { display: block; margin-top: 20px; color: #7e908b; font-size: 12px; line-height: 1.6; text-align: center; }

/* Rich Editor & Legacy Specifics */
#document-more[hidden] { display: none !important; }
.hospital-document-selector { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.legacy-rich-editor { border: 1px solid var(--border); border-radius: var(--radius); margin: 8px 0 14px; padding: 10px; background: #fff; }
.legacy-editor-surface { background: #fff; color: #111; overflow: auto; max-height: 55vh; contain: layout paint; isolation: isolate; }
.legacy-editor-surface .tiptap { outline: none; min-height: 180px; padding: 12px; }
.legacy-editor-surface .tiptap p { margin: 0 0 8px; }
.legacy-editor-surface .tiptap table { border-collapse: collapse; }
.legacy-editor-surface .tiptap td, .legacy-editor-surface .tiptap th { position: relative; }
.legacy-editor-surface .tiptap .selectedCell { outline: 2px solid var(--primary); }
.legacy-body-preview { width: 100%; min-height: 300px; border: 1px solid var(--border); border-radius: var(--radius-sm); background: #fff; }
[data-cross-filter] .form-field { min-width: min(360px, 100%); flex: 1 1 320px; max-width: 460px; }
.payment-log-list table { min-width: 820px; }
.payment-log-list th, .payment-log-list td { min-width: 80px; max-width: 210px; overflow-wrap: anywhere; }
.native-payment { display: grid; justify-items: center; gap: 10px; text-align: center; }
.native-payment img { display: block; width: 240px; height: 240px; max-width: 100%; border: 1px solid var(--border); border-radius: 10px; background: #fff; padding: 8px; }
.native-payment strong { font-size: 22px; color: var(--text); }
.summary-row td { background: var(--companion-soft) !important; font-weight: 700; color: var(--companion); }

/* Responsive */
@media (max-width: 1180px) {
  .dashboard-grid { grid-template-columns: 1fr; }
  .form-grid.cols-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { width: 230px !important; transform: translateX(-100%); }
  .menu-open .sidebar { transform: translateX(0); }
  .menu-open .sidebar-overlay { position: fixed; inset: 0; z-index: 25; display: block; border: 0; background: rgba(15, 20, 28, .45); }
  .main-shell { margin-left: 0 !important; }
  .menu-button { display: inline-flex; }
  .sidebar-collapse-btn { display: none; }
  .page-content { padding: 10px 12px 20px; }
  .login-stage { grid-template-columns: 1fr; padding: 28px 20px; align-content: center; }
  .login-intro { gap: 16px; }
  .login-intro-copy h1 { font-size: 28px; }
  .login-intro-copy p { font-size: 14px; }
  .login-panel { justify-content: center; }
}
@media (max-width: 680px) {
  .page-header { align-items: flex-start; }
  .page-header .page-actions { width: 100%; }
  .panel { padding: 10px; }
  .metric-grid, .metrics-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
  .user-copy, .theme-current-name { display: none; }
  .breadcrumb > span, .breadcrumb > b { display: none; }
  .form-grid, .form-grid.cols-3, .form-grid.cols-4, .detail-grid { grid-template-columns: 1fr; }
  .form-field.wide, .detail-item.wide, .detail-wide { grid-column: auto; }
  .modal-backdrop { align-items: flex-end; padding: 0; }
  .modal, .modal-wide, .modal-drawer, .modal-fullscreen { width: 100%; height: auto; max-height: 92vh; border-radius: 12px 12px 0 0; }
  .toast-root { top: auto; bottom: 12px; right: 10px; left: 10px; }
  .toast { max-width: none; }
  .login-stage { padding: 20px 16px; }
  .login-intro-copy p, .login-scene-switcher { display: none; }
  .login-intro-copy h1 { font-size: 22px; margin-bottom: 0; }
  .login-card { padding: 28px 22px 24px; border-radius: 14px; }
}

/* 渐进式登录图形验证码 */
.form-field[hidden],
#login-captcha-group[hidden] {
  display: none;
}

.login-captcha-row {
  display: flex;
  align-items: stretch;
  gap: 10px;
}

.login-captcha-row .login-input-wrap {
  flex: 1;
  min-width: 0;
}

.login-captcha-btn {
  padding: 0;
  border: 1px solid var(--border, #d8dfe6);
  border-radius: 10px;
  background: #f7f9fb;
  cursor: pointer;
  overflow: hidden;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.login-captcha-btn:hover {
  border-color: var(--primary, #176b5b);
}

.login-captcha-img {
  display: block;
  width: 120px;
  height: 40px;
  object-fit: contain;
}
