:root {
  --bg: #f3f6f8;
  --bg-soft: #e9eff2;
  --surface: #ffffff;
  --surface-raised: #ffffff;
  --surface-soft: #f7f9fa;
  --sidebar: #0b1726;
  --sidebar-soft: #122236;
  --ink: #172438;
  --ink-strong: #0d192a;
  --muted: #6a788a;
  --muted-strong: #526174;
  --line: #dfe6ea;
  --line-strong: #cbd6dd;
  --primary: #176f67;
  --primary-strong: #0e5b55;
  --primary-soft: #dff3ef;
  --blue: #486fd8;
  --blue-soft: #e8eefc;
  --warning: #a66815;
  --warning-soft: #fff1d8;
  --danger: #b33d4a;
  --danger-soft: #fde7e9;
  --success: #16705b;
  --success-soft: #ddf4ec;
  --gold: #eabf68;
  --shadow-sm: 0 1px 2px rgba(12, 27, 43, .05), 0 8px 24px rgba(27, 48, 69, .04);
  --shadow-md: 0 20px 55px rgba(15, 31, 49, .13);
  --radius-sm: 10px;
  --radius: 16px;
  --radius-lg: 24px;
  --sidebar-width: 260px;
  --topbar-height: 76px;
  --ease: cubic-bezier(.2, .8, .2, 1);
}

:root[data-theme="dark"] {
  --bg: #08111f;
  --bg-soft: #0c1828;
  --surface: #101d2d;
  --surface-raised: #142235;
  --surface-soft: #0d1928;
  --sidebar: #07111e;
  --sidebar-soft: #102238;
  --ink: #dce6f0;
  --ink-strong: #f5f8fb;
  --muted: #91a0b2;
  --muted-strong: #adbac9;
  --line: #213147;
  --line-strong: #30445d;
  --primary: #55c9b7;
  --primary-strong: #75ddcd;
  --primary-soft: #113b3a;
  --blue: #82a4ff;
  --blue-soft: #1b2c55;
  --warning: #f0bd69;
  --warning-soft: #3b2d18;
  --danger: #ff8d99;
  --danger-soft: #3b2028;
  --success: #61d3ae;
  --success-soft: #133b33;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .2), 0 10px 30px rgba(0, 0, 0, .12);
  --shadow-md: 0 24px 65px rgba(0, 0, 0, .38);
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button,
a,
input,
select,
textarea {
  -webkit-tap-highlight-color: transparent;
}

button,
a {
  touch-action: manipulation;
}

button {
  border: 0;
}

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

img {
  display: block;
  max-width: 100%;
}

svg {
  flex: 0 0 auto;
}

::selection {
  color: #fff;
  background: var(--primary);
}

:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--blue) 45%, transparent);
  outline-offset: 2px;
}

::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

::-webkit-scrollbar-thumb {
  border: 3px solid transparent;
  border-radius: 999px;
  background: color-mix(in srgb, var(--muted) 45%, transparent);
  background-clip: padding-box;
}

.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;
}

.hidden {
  display: none !important;
}

.icon {
  display: inline-block;
  vertical-align: middle;
}

.icon.flip-x {
  transform: rotate(180deg);
}

.boot-screen {
  min-height: 100vh;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 18px;
  background:
    radial-gradient(circle at 48% 42%, color-mix(in srgb, var(--primary) 13%, transparent), transparent 30%),
    var(--bg);
}

.boot-mark,
.brand-mark {
  position: relative;
  display: grid;
  place-items: center;
  color: #071c20;
  background: linear-gradient(145deg, #6ee3cd, #5e86ff);
  box-shadow: 0 14px 30px rgba(41, 167, 152, .22);
}

.boot-mark {
  width: 62px;
  height: 62px;
  border-radius: 20px;
  font-size: 27px;
  font-weight: 850;
  animation: bootPulse 1.4s ease-in-out infinite;
}

.boot-copy {
  display: grid;
  gap: 3px;
  text-align: center;
}

.boot-copy strong {
  color: var(--ink-strong);
  font-size: 20px;
}

.boot-copy span {
  color: var(--muted);
  font-size: 13px;
}

@keyframes bootPulse {
  50% { transform: translateY(-4px); box-shadow: 0 20px 45px rgba(41, 167, 152, .3); }
}

.noscript {
  position: fixed;
  inset: auto 20px 20px;
  z-index: 9999;
  padding: 14px 18px;
  color: #fff;
  border-radius: 12px;
  background: #b33d4a;
  text-align: center;
}

/* Authentication */
.auth-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(360px, 47%) minmax(440px, 53%);
  background: var(--surface);
}

.auth-showcase {
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: clamp(34px, 5vw, 72px);
  color: #eef8f7;
  background:
    linear-gradient(145deg, rgba(7, 18, 31, .96), rgba(13, 43, 55, .93)),
    #0b1726;
}

.auth-showcase::before,
.auth-showcase::after {
  content: '';
  position: absolute;
  border-radius: 999px;
  filter: blur(2px);
  pointer-events: none;
}

.auth-showcase::before {
  width: 460px;
  height: 460px;
  top: -160px;
  right: -120px;
  background: radial-gradient(circle, rgba(74, 208, 186, .28), transparent 67%);
}

.auth-showcase::after {
  width: 520px;
  height: 520px;
  bottom: -240px;
  left: -220px;
  background: radial-gradient(circle, rgba(80, 116, 224, .24), transparent 68%);
}

.auth-brand,
.sidebar-brand,
.auth-mobile-brand {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 22px;
}

.brand-mark {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  border-radius: 13px;
  font-size: 19px;
  font-weight: 850;
}

.brand-copy {
  min-width: 0;
  display: grid;
  gap: 8px;
  line-height: 1.2;
}

.brand-copy strong {
  color: inherit;
  font-size: 18px;
  font-weight: 770;
  letter-spacing: -.02em;
  line-height: 1.05;
}

.brand-copy span {
  margin-top: 0;
  line-height: 1.4;
  color: rgba(226, 240, 243, .56);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.auth-pitch {
  position: relative;
  z-index: 1;
  max-width: 620px;
  margin: auto 0;
  padding: 60px 0;
}

.eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 18px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .15em;
  text-transform: uppercase;
}

.auth-showcase .eyebrow {
  color: #6ee3cd;
}

.eyebrow::before {
  content: '';
  width: 22px;
  height: 1px;
  background: currentColor;
}

.auth-pitch h1 {
  max-width: 610px;
  margin: 0;
  color: #fff;
  font-size: clamp(39px, 5.4vw, 72px);
  font-weight: 710;
  letter-spacing: -.055em;
  line-height: .98;
}

.auth-pitch h1 em {
  color: #6ee3cd;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
}

.auth-pitch > p {
  max-width: 530px;
  margin: 26px 0 0;
  color: rgba(226, 240, 243, .68);
  font-size: 16px;
  line-height: 1.75;
}

.auth-proof {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 40px;
}

.proof-item {
  min-width: 0;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 15px;
  background: rgba(255, 255, 255, .045);
  backdrop-filter: blur(12px);
}

.proof-item svg {
  color: #6ee3cd;
}

.proof-item strong,
.proof-item span {
  display: block;
}

.proof-item strong {
  margin-top: 10px;
  color: #fff;
  font-size: 13px;
}

.proof-item span {
  margin-top: 3px;
  overflow: hidden;
  color: rgba(226, 240, 243, .5);
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-footnote {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(226, 240, 243, .46);
  font-size: 11px;
}

.auth-panel {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 42px clamp(24px, 6vw, 96px);
  background:
    radial-gradient(circle at 80% 0, color-mix(in srgb, var(--primary-soft) 55%, transparent), transparent 30%),
    var(--surface);
}

.auth-card {
  width: min(100%, 440px);
  animation: riseIn .45s var(--ease) both;
}

@keyframes riseIn {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

.auth-mobile-brand {
  display: none;
  margin-bottom: 44px;
  color: var(--ink-strong);
}

.auth-heading {
  margin-bottom: 28px;
}

.auth-heading h2 {
  margin: 0 0 9px;
  color: var(--ink-strong);
  font-size: clamp(29px, 3.2vw, 38px);
  font-weight: 740;
  letter-spacing: -.04em;
  line-height: 1.12;
}

.auth-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.auth-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 5px;
  margin-bottom: 28px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 13px;
  background: var(--surface-soft);
}

.auth-tab {
  min-height: 38px;
  padding: 7px 10px;
  color: var(--muted);
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font-size: 12px;
  font-weight: 720;
  transition: .2s ease;
}

.auth-tab:hover {
  color: var(--ink);
}

.auth-tab.active {
  color: var(--ink-strong);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.auth-form,
.stack-form {
  display: grid;
  gap: 17px;
}

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

.field {
  display: grid;
  gap: 7px;
  min-width: 0;
}

.field > label,
.field-label {
  color: var(--muted-strong);
  font-size: 12px;
  font-weight: 720;
}

.field-hint {
  color: var(--muted);
  font-size: 11px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-wrap > svg {
  position: absolute;
  left: 14px;
  color: var(--muted);
  pointer-events: none;
}

.input-wrap > input,
.input-wrap > select {
  padding-left: 43px;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--ink-strong);
  border: 1px solid var(--line-strong);
  border-radius: 11px;
  outline: 0;
  background: var(--surface);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}

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

.input:hover,
.select:hover,
.textarea:hover {
  border-color: color-mix(in srgb, var(--primary) 45%, var(--line));
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 13%, transparent);
}

.input::placeholder,
.textarea::placeholder {
  color: color-mix(in srgb, var(--muted) 68%, transparent);
}

.input:disabled,
.select:disabled,
.textarea:disabled {
  cursor: not-allowed;
  opacity: .7;
  background: var(--surface-soft);
}

.input-action {
  position: absolute;
  right: 6px;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--muted);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.input-action.voice-action:hover,
.input-action.voice-listening {
  color: var(--primary);
  background: color-mix(in srgb, var(--primary) 14%, transparent);
}

.ocr-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.ocr-tools .field-hint {
  flex: 1 1 180px;
}

.input-action.voice-listening {
  animation: voicePulse 1.1s ease-in-out infinite;
}

@keyframes voicePulse {
  0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--primary) 30%, transparent); }
  50% { box-shadow: 0 0 0 6px color-mix(in srgb, var(--primary) 0%, transparent); }
}

.check-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  color: var(--muted-strong);
  font-size: 12px;
  cursor: pointer;
}

.check-row input,
.table-check {
  width: 16px;
  height: 16px;
  margin: 1px 0 0;
  accent-color: var(--primary);
}

.btn {
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 15px;
  border: 1px solid transparent;
  border-radius: 11px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 750;
  white-space: nowrap;
  transition: transform .16s var(--ease), background .16s ease, border-color .16s ease, color .16s ease, opacity .16s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  cursor: not-allowed;
  opacity: .58;
}

.btn-primary {
  color: #fff;
  background: var(--primary);
  box-shadow: 0 10px 22px color-mix(in srgb, var(--primary) 20%, transparent);
}

:root[data-theme="dark"] .btn-primary {
  color: #06241f;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-strong);
}

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

.btn-secondary:hover:not(:disabled) {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.btn-soft {
  color: var(--primary-strong);
  background: var(--primary-soft);
}

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

.btn-ghost {
  color: var(--muted-strong);
  background: transparent;
}

.btn-ghost:hover:not(:disabled) {
  color: var(--ink-strong);
  background: var(--surface-soft);
}

.btn-block {
  width: 100%;
}

.btn-sm {
  min-height: 34px;
  padding: 6px 10px;
  border-radius: 9px;
  font-size: 11px;
}

.btn-lg {
  min-height: 49px;
  padding: 12px 19px;
  border-radius: 13px;
  font-size: 13px;
}

.icon-btn {
  width: 39px;
  height: 39px;
  display: inline-grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface);
  cursor: pointer;
  transition: .16s ease;
}

.icon-btn:hover {
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 42%, var(--line));
  background: var(--primary-soft);
}

.icon-btn.danger:hover {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 30%, var(--line));
  background: var(--danger-soft);
}

.auth-message,
.inline-message {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 12px 13px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
  font-size: 12px;
}

.auth-message.danger,
.inline-message.danger {
  color: var(--danger);
  border-color: color-mix(in srgb, var(--danger) 24%, var(--line));
  background: var(--danger-soft);
}

.auth-message.success,
.inline-message.success {
  color: var(--success);
  border-color: color-mix(in srgb, var(--success) 24%, var(--line));
  background: var(--success-soft);
}

.auth-helper {
  margin-top: 22px;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
  text-align: center;
}

.captcha-wrap {
  min-height: 78px;
  overflow: hidden;
}

.captcha-wrap > div {
  transform-origin: left top;
}

/* Application shell */
.app-shell {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  background: var(--bg);
}

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  width: var(--sidebar-width);
  display: flex;
  flex-direction: column;
  padding: 24px 16px 18px;
  color: #dfe9f2;
  background:
    radial-gradient(circle at 30% 0, rgba(66, 187, 170, .11), transparent 28%),
    var(--sidebar);
  transition: transform .25s var(--ease);
}

.sidebar-brand {
  padding: 0 9px 25px;
  color: #f4f8fb;
}

.sidebar-brand .brand-copy strong,
.sidebar-brand .brand-copy span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.sidebar-close {
  display: none;
  margin-left: auto;
  color: #b8c7d6;
  background: transparent;
  cursor: pointer;
}

.workspace-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 1px 4px 20px;
  padding: 11px 12px;
  border: 1px solid rgba(255, 255, 255, .07);
  border-radius: 13px;
  background: rgba(255, 255, 255, .04);
}

.workspace-icon {
  width: 30px;
  height: 30px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #69d8c6;
  border-radius: 9px;
  background: rgba(85, 214, 190, .1);
}

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

.workspace-copy strong {
  overflow: hidden;
  color: #eaf2f7;
  font-size: 12px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.workspace-copy span {
  color: #718499;
  font-size: 10px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 0 3px;
}

.nav-group + .nav-group {
  margin-top: 21px;
}

.nav-label {
  display: block;
  padding: 0 10px 8px;
  color: #5f7389;
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .14em;
  text-transform: uppercase;
}

.nav-link {
  position: relative;
  min-height: 43px;
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 2px 0;
  padding: 9px 11px;
  color: #8fa1b3;
  border-radius: 11px;
  font-size: 12px;
  font-weight: 660;
  transition: color .16s ease, background .16s ease;
}

.nav-link:hover {
  color: #e7eff5;
  background: rgba(255, 255, 255, .045);
}

.nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, rgba(38, 145, 131, .42), rgba(54, 101, 165, .22));
}

.nav-link.active::before {
  content: '';
  position: absolute;
  left: -3px;
  width: 3px;
  height: 19px;
  border-radius: 4px;
  background: #67ddca;
  box-shadow: 0 0 16px rgba(103, 221, 202, .55);
}

.nav-link.active svg {
  color: #67ddca;
}

.nav-badge {
  min-width: 21px;
  margin-left: auto;
  padding: 2px 6px;
  color: #09211f;
  border-radius: 999px;
  background: #67ddca;
  font-size: 9px;
  font-weight: 850;
  text-align: center;
}

.sidebar-user {
  display: grid;
  grid-template-columns: 37px minmax(0, 1fr) 30px;
  align-items: center;
  gap: 10px;
  margin-top: 17px;
  padding: 12px 9px 0;
  border-top: 1px solid rgba(255, 255, 255, .07);
}

.avatar {
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: #0d2825;
  border-radius: 12px;
  background: linear-gradient(145deg, #79e4d0, #7297f1);
  font-size: 11px;
  font-weight: 850;
}

.sidebar-user .avatar {
  width: 37px;
  height: 37px;
}

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

.user-copy strong {
  overflow: hidden;
  color: #eaf2f7;
  font-size: 11px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-copy span {
  color: #718499;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.sidebar-logout {
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  color: #8396aa;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
}

.sidebar-logout:hover {
  color: #ff9ca5;
  background: rgba(255, 110, 124, .09);
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  z-index: 35;
  display: none;
  background: rgba(4, 12, 22, .62);
  backdrop-filter: blur(4px);
}

.app-main {
  min-width: 0;
  grid-column: 2;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-height);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 clamp(20px, 3vw, 42px);
  border-bottom: 1px solid color-mix(in srgb, var(--line) 78%, transparent);
  background: color-mix(in srgb, var(--bg) 87%, transparent);
  backdrop-filter: blur(18px);
}

.mobile-menu {
  display: none;
}

.topbar-title {
  min-width: 0;
  display: grid;
}

.topbar-title strong {
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 15px;
  letter-spacing: -.01em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-title span {
  color: var(--muted);
  font-size: 10px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 9px;
  margin-left: auto;
}

.connection-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 34px;
  padding: 6px 10px;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  font-size: 10px;
  font-weight: 700;
}

.connection-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 4px var(--success-soft);
}

.connection-pill.offline .connection-dot {
  background: var(--danger);
  box-shadow: 0 0 0 4px var(--danger-soft);
}

.page {
  width: min(100%, 1540px);
  margin: 0 auto;
  padding: clamp(22px, 3vw, 40px) clamp(18px, 3vw, 42px) 54px;
  animation: pageIn .28s var(--ease) both;
}

@keyframes pageIn {
  from { opacity: .3; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

.page-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 28px;
}

.page-heading-copy h1 {
  margin: 0;
  color: var(--ink-strong);
  font-size: clamp(25px, 3vw, 34px);
  font-weight: 750;
  letter-spacing: -.045em;
  line-height: 1.15;
}

.page-heading-copy p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 12px;
}

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

.announcement {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 13px;
  margin-bottom: 22px;
  padding: 14px 16px;
  color: #5e451d;
  border: 1px solid #efdba9;
  border-radius: 14px;
  background: linear-gradient(90deg, #fff5dc, #fffaf0);
}

:root[data-theme="dark"] .announcement {
  color: #f2d89d;
  border-color: #4a3b22;
  background: linear-gradient(90deg, #312716, #251f17);
}

.announcement-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: rgba(204, 147, 42, .13);
}

.announcement-copy {
  min-width: 0;
}

.announcement-copy strong {
  display: block;
  margin-bottom: 2px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .07em;
}

.announcement-copy p {
  margin: 0;
  font-size: 12px;
}

.hero-card {
  position: relative;
  min-height: 235px;
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, .55fr);
  align-items: center;
  gap: 26px;
  overflow: hidden;
  margin-bottom: 22px;
  padding: clamp(25px, 3.5vw, 43px);
  color: #eaf7f5;
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at 89% 15%, rgba(102, 224, 203, .24), transparent 27%),
    linear-gradient(125deg, #0b1b2b 10%, #123946 64%, #174c50);
  box-shadow: 0 22px 60px rgba(9, 29, 43, .15);
}

.hero-card::after {
  content: '';
  position: absolute;
  width: 280px;
  height: 280px;
  right: -100px;
  bottom: -155px;
  border: 1px solid rgba(255, 255, 255, .11);
  border-radius: 50%;
  box-shadow: 0 0 0 42px rgba(255, 255, 255, .025), 0 0 0 84px rgba(255, 255, 255, .02);
}

.hero-copy {
  position: relative;
  z-index: 2;
}

.hero-copy .eyebrow {
  margin-bottom: 12px;
  color: #6ee3cd;
}

.hero-copy h2 {
  max-width: 670px;
  margin: 0;
  color: #fff;
  font-size: clamp(28px, 4vw, 45px);
  font-weight: 660;
  letter-spacing: -.045em;
  line-height: 1.05;
}

.hero-copy h2 em {
  color: #78e2d0;
  font-family: Georgia, 'Times New Roman', serif;
  font-weight: 500;
}

.hero-copy p {
  max-width: 590px;
  margin: 15px 0 21px;
  color: rgba(229, 242, 244, .65);
  font-size: 13px;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
}

.hero-card .btn-primary {
  color: #07221f;
  background: #6ee3cd;
}

.hero-card .btn-secondary {
  color: #e9f3f4;
  border-color: rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
}

.hero-card .btn-secondary:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, .25);
  background: rgba(255, 255, 255, .11);
}

.hero-visual {
  position: relative;
  z-index: 1;
  display: grid;
  place-items: center;
}

.hero-orbit {
  position: relative;
  width: 180px;
  height: 180px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .1);
  border-radius: 50%;
}

.hero-orbit::before {
  content: '';
  position: absolute;
  inset: 22px;
  border: 1px dashed rgba(110, 227, 205, .28);
  border-radius: 50%;
  animation: orbit 18s linear infinite;
}

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

.hero-total {
  width: 106px;
  height: 106px;
  display: grid;
  place-content: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 50%;
  background: rgba(5, 25, 34, .42);
  text-align: center;
  backdrop-filter: blur(7px);
}

.hero-total strong {
  color: #fff;
  font-size: 29px;
  font-weight: 720;
  letter-spacing: -.04em;
}

.hero-total span {
  color: rgba(226, 241, 242, .52);
  font-size: 9px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.hero-dot {
  position: absolute;
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 10px;
  background: #173845;
  box-shadow: 0 10px 20px rgba(0, 0, 0, .18);
}

.hero-dot.one { top: 3px; right: 23px; color: #7be4d2; }
.hero-dot.two { bottom: 12px; left: 4px; color: #f3ca7b; }
.hero-dot.three { right: -5px; bottom: 38px; color: #99b3ff; }

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 18px;
  margin-bottom: 22px;
}

.metric-card {
  min-width: 0;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

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

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  color: var(--primary);
  border-radius: 11px;
  background: var(--primary-soft);
}

.metric-icon.warning { color: var(--warning); background: var(--warning-soft); }
.metric-icon.success { color: var(--success); background: var(--success-soft); }
.metric-icon.blue { color: var(--blue); background: var(--blue-soft); }

.metric-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
}

.metric-value {
  display: block;
  overflow: hidden;
  margin: 17px 0 3px;
  color: var(--ink-strong);
  font-size: clamp(25px, 2.4vw, 31px);
  font-weight: 730;
  letter-spacing: -.045em;
  line-height: 1;
  text-overflow: ellipsis;
}

.metric-label {
  color: var(--muted);
  font-size: 11px;
}

.dashboard-grid,
.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(300px, .55fr);
  gap: 20px;
}

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

.panel {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.panel + .panel {
  margin-top: 20px;
}

.settings-stack {
  min-width: 0;
  display: grid;
  align-content: start;
  gap: 20px;
}

.settings-stack > .panel + .panel {
  margin-top: 0;
}

.panel-header {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 18px;
  border-bottom: 1px solid var(--line);
}

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

.panel-heading h2,
.panel-heading h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 14px;
  font-weight: 740;
  letter-spacing: -.015em;
}

.panel-heading p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.panel-body {
  padding: 18px;
}

.panel-body.flush {
  padding: 0;
}

.panel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-top: 1px solid var(--line);
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--primary);
  background: transparent;
  cursor: pointer;
  font-size: 11px;
  font-weight: 750;
}

.activity-list,
.agent-list,
.simple-list {
  display: grid;
}

.activity-item,
.agent-item,
.simple-list-item {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--line);
}

.activity-item:last-child,
.agent-item:last-child,
.simple-list-item:last-child {
  border-bottom: 0;
}

.activity-icon {
  width: 35px;
  height: 35px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--primary);
  border-radius: 11px;
  background: var(--primary-soft);
}

.activity-copy,
.agent-copy,
.simple-copy {
  min-width: 0;
  flex: 1;
}

.activity-copy strong,
.agent-copy strong,
.simple-copy strong {
  display: block;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-copy span,
.agent-copy span,
.simple-copy span {
  display: block;
  overflow: hidden;
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.activity-time {
  flex: 0 0 auto;
  color: var(--muted);
  font-size: 9px;
}

.agent-rank {
  width: 28px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-align: center;
}

.agent-progress {
  width: 80px;
  height: 5px;
  overflow: hidden;
  border-radius: 99px;
  background: var(--bg-soft);
}

.agent-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--primary), var(--blue));
}

/* Toolbar and data tables */
.toolbar {
  display: flex;
  align-items: end;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.toolbar .field {
  min-width: 140px;
  flex: 0 1 175px;
}

.toolbar .field.grow {
  min-width: 220px;
  flex: 1 1 300px;
}

.toolbar .field > label {
  font-size: 10px;
}

.toolbar .input,
.toolbar .select {
  min-height: 40px;
  font-size: 12px;
}

.toolbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.result-summary {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 10px;
}

.result-summary strong {
  color: var(--ink);
}

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

.data-table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}

.data-table th,
.data-table td {
  padding: 13px 15px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.data-table th {
  color: var(--muted);
  background: var(--surface-soft);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .075em;
  text-transform: uppercase;
}

.data-table tbody tr {
  transition: background .15s ease;
}

.data-table tbody tr:hover {
  background: color-mix(in srgb, var(--primary-soft) 37%, transparent);
}

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

.cell-main {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 160px;
}

.mini-avatar,
.file-thumb {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  overflow: hidden;
  color: var(--primary);
  border-radius: 10px;
  background: var(--primary-soft);
  font-size: 10px;
  font-weight: 820;
}

.file-thumb img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

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

.cell-copy strong {
  max-width: 240px;
  overflow: hidden;
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 720;
  text-overflow: ellipsis;
}

.cell-copy span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 9px;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  font-size: 10px;
  letter-spacing: .01em;
}

.amount {
  color: var(--ink-strong);
  font-size: 11px;
  font-weight: 720;
  font-variant-numeric: tabular-nums;
}

.status-badge,
.role-badge,
.tiny-pill {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 780;
  letter-spacing: .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(--blue); background: var(--blue-soft); }
.role-badge.owner { color: #8d5a13; background: #fff0cc; }
.role-badge.calo { color: var(--primary); background: var(--primary-soft); }
:root[data-theme="dark"] .role-badge.owner { color: #f2c676; background: #3c2c13; }

.table-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 5px;
}

.table-actions .icon-btn {
  width: 31px;
  height: 31px;
  border-radius: 8px;
}

.bulk-bar {
  position: sticky;
  bottom: 16px;
  z-index: 15;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  width: min(620px, calc(100% - 24px));
  margin: -3px auto 15px;
  padding: 11px 13px 11px 16px;
  color: #eaf4f5;
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 14px;
  background: rgba(10, 28, 42, .94);
  box-shadow: 0 18px 45px rgba(8, 22, 35, .28);
  backdrop-filter: blur(16px);
}

.bulk-copy {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
}

.bulk-copy strong {
  min-width: 25px;
  padding: 3px 7px;
  color: #08201e;
  border-radius: 999px;
  background: #6ee3cd;
  text-align: center;
}

.bulk-actions {
  display: flex;
  gap: 6px;
}

.bulk-actions .btn {
  min-height: 34px;
}

.mobile-records {
  display: none;
}

.mobile-card {
  padding: 15px;
  border-bottom: 1px solid var(--line);
}

.mobile-card:last-child {
  border-bottom: 0;
}

.mobile-card-head,
.mobile-card-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.mobile-card-title {
  min-width: 0;
}

.mobile-card-title strong,
.mobile-card-title span {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.mobile-card-title strong {
  color: var(--ink-strong);
  font-size: 12px;
}

.mobile-card-title span {
  margin-top: 2px;
  color: var(--muted);
  font-size: 10px;
}

.mobile-card-meta {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin: 14px 0;
  padding: 12px;
  border-radius: 11px;
  background: var(--surface-soft);
}

.meta-item span,
.meta-item strong {
  display: block;
}

.meta-item span {
  color: var(--muted);
  font-size: 9px;
}

.meta-item strong {
  margin-top: 2px;
  color: var(--ink);
  font-size: 10px;
}

.pagination {
  display: flex;
  align-items: center;
  gap: 5px;
}

.page-btn {
  min-width: 31px;
  height: 31px;
  display: grid;
  place-items: center;
  color: var(--muted-strong);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  cursor: pointer;
  font-size: 10px;
}

.page-btn.active {
  color: #fff;
  border-color: var(--primary);
  background: var(--primary);
}

.page-btn:disabled {
  cursor: not-allowed;
  opacity: .45;
}

/* Charts and reports */
.donut-layout {
  display: grid;
  grid-template-columns: 145px minmax(0, 1fr);
  align-items: center;
  gap: 22px;
}

.donut {
  position: relative;
  width: 138px;
  height: 138px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--success) 0 var(--success-stop, 0%), var(--warning) var(--success-stop, 0%) var(--pending-stop, 0%), var(--danger) var(--pending-stop, 0%) 100%);
}

.donut::before {
  content: '';
  position: absolute;
  inset: 19px;
  border-radius: 50%;
  background: var(--surface);
}

.donut-label {
  position: relative;
  z-index: 1;
  text-align: center;
}

.donut-label strong,
.donut-label span {
  display: block;
}

.donut-label strong {
  color: var(--ink-strong);
  font-size: 24px;
  letter-spacing: -.04em;
}

.donut-label span {
  color: var(--muted);
  font-size: 9px;
  text-transform: uppercase;
}

.legend {
  display: grid;
  gap: 11px;
}

.legend-item {
  display: grid;
  grid-template-columns: 8px minmax(0, 1fr) auto;
  align-items: center;
  gap: 9px;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}

.legend-dot.success { background: var(--success); }
.legend-dot.warning { background: var(--warning); }
.legend-dot.danger { background: var(--danger); }
.legend-item span { color: var(--muted); font-size: 10px; }
.legend-item strong { color: var(--ink); font-size: 10px; }

.bar-chart {
  min-height: 210px;
  display: flex;
  align-items: flex-end;
  gap: 11px;
  overflow-x: auto;
  padding: 22px 4px 0;
}

.bar-item {
  min-width: 52px;
  flex: 1;
  display: grid;
  justify-items: center;
  gap: 7px;
}

.bar-value {
  color: var(--muted-strong);
  font-size: 9px;
  font-weight: 720;
}

.bar-track {
  width: min(32px, 70%);
  height: 145px;
  display: flex;
  align-items: flex-end;
  overflow: hidden;
  border-radius: 8px 8px 3px 3px;
  background: var(--surface-soft);
}

.bar-fill {
  width: 100%;
  min-height: 3px;
  border-radius: inherit;
  background: linear-gradient(180deg, var(--primary), var(--blue));
  transition: height .5s var(--ease);
}

.bar-label {
  max-width: 70px;
  overflow: hidden;
  color: var(--muted);
  font-size: 9px;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 22px;
}

.summary-item {
  min-width: 0;
  padding: 19px 20px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.summary-item span,
.summary-item strong {
  display: block;
}

.summary-item span {
  color: var(--muted);
  font-size: 10px;
}

.summary-item strong {
  margin-top: 5px;
  color: var(--ink-strong);
  font-size: 18px;
  letter-spacing: -.025em;
}

/* Approval cards */
.approval-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.approval-card {
  min-width: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
}

.approval-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 17px;
  border-bottom: 1px solid var(--line);
}

.approval-id {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
}

.approval-head h3 {
  margin: 4px 0 0;
  color: var(--ink-strong);
  font-size: 15px;
}

.approval-stats {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
  padding: 17px;
}

.approval-stat {
  padding: 12px;
  border-radius: 10px;
  background: var(--surface-soft);
}

.approval-stat span,
.approval-stat strong {
  display: block;
}

.approval-stat span { color: var(--muted); font-size: 9px; }
.approval-stat strong { margin-top: 3px; color: var(--ink); font-size: 11px; }

.approval-items {
  max-height: 190px;
  overflow-y: auto;
  margin: 0 17px;
  border: 1px solid var(--line);
  border-radius: 10px;
}

.approval-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.approval-item:last-child { border-bottom: 0; }
.approval-item input { accent-color: var(--primary); }
.approval-item-copy { min-width: 0; flex: 1; }
.approval-item-copy strong,
.approval-item-copy span { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.approval-item-copy strong { color: var(--ink); font-size: 10px; }
.approval-item-copy span { color: var(--muted); font-size: 9px; }
.approval-note { margin: 13px 17px 0; color: var(--muted-strong); font-size: 10px; }
.approval-actions { display: flex; flex-wrap: wrap; gap: 9px; padding: 17px; }

/* Settings and profile */
.profile-card {
  position: relative;
  overflow: hidden;
  min-height: 258px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 24px;
  color: #eaf6f5;
  border-radius: var(--radius);
  background: linear-gradient(145deg, #0d2636, #174d4c);
  box-shadow: 0 16px 34px rgba(9, 29, 43, .14);
}

.profile-card::after {
  content: '';
  position: absolute;
  width: 180px;
  height: 180px;
  right: -70px;
  top: -100px;
  border: 25px solid rgba(255, 255, 255, .035);
  border-radius: 50%;
}

.profile-avatar {
  position: relative;
  z-index: 1;
  width: 64px;
  height: 64px;
  display: grid;
  place-items: center;
  color: #08221e;
  border: 3px solid rgba(255, 255, 255, .2);
  border-radius: 20px;
  background: linear-gradient(145deg, #7ce5d2, #81a2ff);
  font-size: 18px;
  font-weight: 850;
}

.profile-card h2 {
  position: relative;
  z-index: 1;
  margin: 16px 0 2px;
  color: #fff;
  font-size: 20px;
}

.profile-card > p {
  position: relative;
  z-index: 1;
  margin: 0;
  color: rgba(229, 242, 244, .58);
  font-size: 11px;
}

.profile-meta {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 11px;
  margin-top: 23px;
}

.profile-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 18px;
  color: rgba(232, 244, 246, .72);
  font-size: 10px;
}

@media (max-width: 680px) {
  .profile-card {
    min-height: 260px;
    padding: 25px 23px;
  }
}

.settings-section {
  padding: 22px;
}

.settings-section + .settings-section {
  border-top: 1px solid var(--line);
}

.settings-title {
  margin-bottom: 17px;
}

.settings-title h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 13px;
}

.settings-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.preference-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line);
}

.preference-row:last-child { border-bottom: 0; }
.preference-copy { min-width: 0; }
.preference-copy strong { display: block; color: var(--ink); font-size: 11px; }
.preference-copy span { display: block; margin-top: 2px; color: var(--muted); font-size: 10px; }

.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex: 0 0 auto;
}

.switch input { position: absolute; opacity: 0; }
.switch span { position: absolute; inset: 0; border-radius: 99px; background: var(--line-strong); cursor: pointer; transition: .2s ease; }
.switch span::after { content: ''; position: absolute; width: 18px; height: 18px; left: 3px; top: 3px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0,0,0,.18); transition: .2s var(--ease); }
.switch input:checked + span { background: var(--primary); }
.switch input:checked + span::after { transform: translateX(18px); }

.tab-bar {
  display: flex;
  gap: 5px;
  overflow-x: auto;
  margin-bottom: 20px;
  padding: 5px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface);
}

.tab-button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  flex: 1 0 auto;
  padding: 7px 12px;
  color: var(--muted);
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 10px;
  font-weight: 720;
}

.tab-button.active {
  color: var(--primary);
  background: var(--primary-soft);
}

.security-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}

.security-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.security-card-icon {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  color: var(--primary);
  border-radius: 10px;
  background: var(--primary-soft);
}

.security-card strong,
.security-card span { display: block; }
.security-card strong { margin-top: 12px; color: var(--ink-strong); font-size: 21px; letter-spacing: -.03em; }
.security-card span { color: var(--muted); font-size: 10px; }

/* Modal and overlays */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  overflow-y: auto;
  padding: 20px;
  background: rgba(5, 13, 23, .66);
  backdrop-filter: blur(6px);
  animation: fadeIn .18s ease both;
}

@keyframes fadeIn { from { opacity: 0; } }

.modal {
  width: min(100%, 590px);
  max-height: calc(100vh - 40px);
  max-height: calc(100dvh - 40px);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface);
  box-shadow: var(--shadow-md);
  animation: modalIn .23s var(--ease) both;
}

@keyframes modalIn {
  from { opacity: .5; transform: scale(.97) translateY(8px); }
}

.modal.wide { width: min(100%, 850px); }
.modal.narrow { width: min(100%, 440px); }

.modal-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 15px;
  padding: 20px 22px 16px;
  border-bottom: 1px solid var(--line);
}

.modal-title h2 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
  letter-spacing: -.025em;
}

.modal-title p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
}

.modal-close {
  width: 34px;
  height: 34px;
  display: grid;
  flex: 0 0 auto;
  place-items: center;
  color: var(--muted);
  border-radius: 10px;
  background: var(--surface-soft);
  cursor: pointer;
}

.modal-body {
  overflow-y: auto;
  padding: 20px 22px;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-wrap: wrap;
  gap: 8px;
  padding: 14px 22px;
  border-top: 1px solid var(--line);
  background: var(--surface-soft);
}

.confirm-visual {
  width: 56px;
  height: 56px;
  display: grid;
  place-items: center;
  margin-bottom: 15px;
  color: var(--danger);
  border-radius: 17px;
  background: var(--danger-soft);
}

.confirm-copy h3 {
  margin: 0;
  color: var(--ink-strong);
  font-size: 18px;
}

.confirm-copy p {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

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

.detail-item {
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--surface-soft);
}

.detail-item.full { grid-column: 1 / -1; }
.detail-item span,
.detail-item strong { display: block; }
.detail-item span { color: var(--muted); font-size: 9px; text-transform: uppercase; letter-spacing: .06em; }
.detail-item strong { overflow-wrap: anywhere; margin-top: 4px; color: var(--ink); font-size: 11px; }

.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 9px;
  margin-top: 17px;
}

.gallery a {
  position: relative;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.gallery img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform .25s ease;
}

.gallery a:hover img { transform: scale(1.04); }

.upload-zone {
  position: relative;
  min-height: 120px;
  display: grid;
  place-items: center;
  padding: 18px;
  color: var(--muted);
  border: 1px dashed var(--line-strong);
  border-radius: 13px;
  background: var(--surface-soft);
  text-align: center;
  cursor: pointer;
  transition: .18s ease;
}

.upload-zone:hover,
.upload-zone.dragging {
  color: var(--primary);
  border-color: var(--primary);
  background: var(--primary-soft);
}

.upload-zone input {
  position: absolute;
  inset: 0;
  width: 100%;
  opacity: 0;
  cursor: pointer;
}

.upload-zone strong,
.upload-zone span { display: block; }
.upload-zone strong { margin-top: 7px; color: var(--ink); font-size: 11px; }
.upload-zone span { margin-top: 3px; font-size: 9px; }

.file-preview-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 7px;
  margin-top: 9px;
}

.file-preview {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border-radius: 9px;
  background: var(--surface-soft);
}

.file-preview img { width: 100%; height: 100%; object-fit: cover; }

/* Empty, loading and toast */
.empty-state {
  min-height: 250px;
  display: grid;
  place-content: center;
  justify-items: center;
  padding: 32px 20px;
  text-align: center;
}

.empty-illustration {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  color: var(--primary);
  border: 1px solid color-mix(in srgb, var(--primary) 19%, var(--line));
  border-radius: 18px;
  background: var(--primary-soft);
}

.empty-state h3 {
  margin: 16px 0 5px;
  color: var(--ink-strong);
  font-size: 14px;
}

.empty-state p {
  max-width: 360px;
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.6;
}

.empty-state .btn { margin-top: 16px; }

.skeleton {
  display: inline-block;
  overflow: hidden;
  border-radius: 7px;
  background: linear-gradient(90deg, var(--bg-soft) 20%, var(--surface-soft) 42%, var(--bg-soft) 64%);
  background-size: 200% 100%;
  animation: shimmer 1.35s linear infinite;
}

.skeleton.line { width: min(100%, 110px); height: 10px; }

@keyframes shimmer { to { background-position: -200% 0; } }

.spinner {
  width: 25px;
  height: 25px;
  display: inline-block;
  border: 2px solid color-mix(in srgb, currentColor 24%, transparent);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}

.spinner.small { width: 14px; height: 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

.loading-panel {
  min-height: 320px;
  display: grid;
  place-content: center;
  justify-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 11px;
}

.toast-root {
  position: fixed;
  z-index: 150;
  top: 18px;
  right: 18px;
  width: min(370px, calc(100% - 36px));
  display: grid;
  gap: 8px;
  pointer-events: none;
}

.toast {
  min-height: 50px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 13px;
  background: color-mix(in srgb, var(--surface-raised) 94%, transparent);
  box-shadow: var(--shadow-md);
  backdrop-filter: blur(18px);
  pointer-events: auto;
  animation: toastIn .25s var(--ease) both;
  font-size: 11px;
}

.toast.leaving { animation: toastOut .2s ease both; }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }
@keyframes toastOut { to { opacity: 0; transform: translateX(18px); } }
.toast-icon { width: 29px; height: 29px; display: grid; place-items: center; color: var(--blue); border-radius: 9px; background: var(--blue-soft); }
.toast.success .toast-icon { color: var(--success); background: var(--success-soft); }
.toast.danger .toast-icon { color: var(--danger); background: var(--danger-soft); }
.toast.warning .toast-icon { color: var(--warning); background: var(--warning-soft); }
.toast button { width: 28px; height: 28px; display: grid; place-items: center; color: var(--muted); border-radius: 8px; background: transparent; cursor: pointer; }

.command-list {
  display: grid;
  gap: 6px;
}

.command-result {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px;
  color: var(--ink);
  border-radius: 11px;
  background: transparent;
  cursor: pointer;
  text-align: left;
}

.command-result:hover { background: var(--primary-soft); }

/* Responsive */
@media (max-width: 1180px) {
  :root { --sidebar-width: 232px; }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .dashboard-grid { grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); }
  .approval-grid { grid-template-columns: 1fr; }
}

@media (max-width: 920px) {
  .auth-shell { grid-template-columns: 1fr; }
  .auth-showcase { display: none; }
  .auth-panel { padding: 36px 24px; }
  .auth-mobile-brand { display: flex; }
  .app-shell { display: block; }
  .sidebar { transform: translateX(-102%); box-shadow: 20px 0 55px rgba(0, 0, 0, .25); }
  .sidebar.open { transform: translateX(0); }
  .sidebar.open + .sidebar-overlay { display: block; }
  .sidebar-close { display: grid; }
  .app-main { width: 100%; }
  .mobile-menu { display: grid; }
  .dashboard-grid,
  .two-column,
  .two-column.equal { grid-template-columns: 1fr; }
  .hero-card { grid-template-columns: 1fr minmax(200px, .45fr); }
  .security-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
  :root { --topbar-height: 65px; }
  .topbar { padding: 0 14px; gap: 10px; }
  .connection-pill { display: none; }
  .topbar-actions { gap: 6px; }
  .topbar-actions .icon-btn { width: 36px; height: 36px; }
  .page { padding: 20px 14px 42px; }
  .page-heading { align-items: flex-start; flex-direction: column; margin-bottom: 22px; }
  .page-actions { width: 100%; justify-content: flex-start; }
  .page-actions .btn { flex: 1; }
  .hero-card { min-height: 0; grid-template-columns: 1fr; padding: 26px 21px; }
  .hero-visual { display: none; }
  .hero-copy h2 { font-size: 30px; }
  .metric-grid { gap: 12px; }
  .metric-card { padding: 14px; }
  .metric-value { font-size: 23px; }
  .metric-label { font-size: 10px; }
  .metric-icon { width: 34px; height: 34px; }
  .panel-header { min-height: 60px; padding: 13px 14px; }
  .panel-body { padding: 14px; }
  .panel-footer { padding: 11px 14px; }
  .announcement { grid-template-columns: auto minmax(0, 1fr); }
  .announcement > .icon { display: none; }
  .toolbar { align-items: stretch; padding: 13px; }
  .toolbar .field,
  .toolbar .field.grow { min-width: calc(50% - 6px); flex: 1 1 calc(50% - 6px); }
  .toolbar .field.grow:first-child { min-width: 100%; flex-basis: 100%; }
  .toolbar-actions { width: 100%; margin-left: 0; }
  .toolbar-actions .btn { flex: 1; }
  .desktop-table { display: none; }
  .mobile-records { display: block; }
  .panel:has(.mobile-records) .panel-footer { flex-wrap: wrap; }
  .approval-grid { gap: 14px; }
  .summary-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .summary-item { padding: 16px; }
  .donut-layout { grid-template-columns: 120px minmax(0, 1fr); gap: 15px; }
  .donut { width: 115px; height: 115px; }
  .donut::before { inset: 16px; }
  .form-row { grid-template-columns: 1fr; }
  .security-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .modal-backdrop { align-items: end; padding: 0; }
  .modal,
  .modal.wide,
  .modal.narrow { width: 100%; max-height: 92dvh; border-radius: 20px 20px 0 0; animation-name: sheetIn; }
  @keyframes sheetIn { from { opacity: .7; transform: translateY(35px); } }
  .modal-header { padding: 18px 17px 14px; }
  .modal-body { padding: 17px; }
  .modal-footer { padding: 12px 17px calc(12px + env(safe-area-inset-bottom)); }
  .modal-footer .btn { flex: 1; }
  .gallery { grid-template-columns: repeat(2, 1fr); }
  .file-preview-list { grid-template-columns: repeat(4, 1fr); }
  .toast-root { top: 11px; right: 11px; width: calc(100% - 22px); }
  .bulk-bar { bottom: 10px; width: calc(100% - 12px); flex-direction: column; align-items: stretch; }
  .bulk-actions .btn { flex: 1; }
}

@media (max-width: 420px) {
  .auth-panel { padding: 28px 18px; }
  .auth-mobile-brand { margin-bottom: 25px; }
  .auth-tabs { gap: 3px; padding: 4px; }
  .auth-tab { padding: 7px 5px; font-size: 11px; }
  .captcha-wrap > div { transform: scale(.91); }
  .metric-grid { grid-template-columns: 1fr; }
  .toolbar .field,
  .toolbar .field.grow { min-width: 100%; flex-basis: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-item.full { grid-column: auto; }
  .security-grid { grid-template-columns: 1fr; }
  .donut-layout { grid-template-columns: 1fr; justify-items: center; }
  .legend { width: 100%; }
}

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

@media print {
  .sidebar,
  .topbar,
  .page-actions,
  .toolbar,
  .btn,
  .icon-btn { display: none !important; }
  .app-shell { display: block; }
  .app-main { width: 100%; }
  .page { max-width: none; padding: 0; }
  .panel,
  .summary-strip { box-shadow: none; break-inside: avoid; }
}
