/* ===== 01. Foundations ===== */
:root {
  --bg: #f2f1ec;
  --bg-deep: #ebe9e2;
  --surface: #ffffff;
  --surface-soft: #f8f7f2;
  --surface-sunk: #f3f1ea;
  --ink: #17212d;
  --ink-soft: #3e4a55;
  --muted: #77818a;
  --muted-2: #9aa2a9;
  --line: #e6e1d7;
  --line-strong: #d7d1c5;
  --navy: #101a28;
  --navy-soft: #172536;
  --navy-line: rgba(255, 255, 255, 0.09);
  --teal: #0d6b5e;
  --teal-dark: #085247;
  --teal-soft: #e6f2ee;
  --teal-line: #c9e1da;
  --gold: #c28a3d;
  --gold-soft: #f6ead7;
  --amber: #b9741b;
  --amber-soft: #fbefdc;
  --red: #b0473c;
  --red-soft: #fbe9e6;
  --blue: #315f8e;
  --blue-soft: #e9f0f7;
  --radius-sm: 9px;
  --radius: 14px;
  --radius-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 26, 40, 0.04);
  --shadow: 0 1px 2px rgba(16, 26, 40, 0.03), 0 10px 32px rgba(16, 26, 40, 0.04);
  --shadow-lg: 0 28px 80px rgba(9, 16, 26, 0.2);
  --font-ui: -apple-system, BlinkMacSystemFont, "Segoe UI Variable", "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  --font-num: "Bahnschrift", "DIN Alternate", "SF Pro Display", "Segoe UI", sans-serif;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
}

* { box-sizing: border-box; }

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

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

[hidden] { display: none !important; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
svg { display: block; }
img { max-width: 100%; }
::selection { background: #cde5dd; color: #0a3d35; }

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

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #d2cdc2; border: 3px solid transparent; background-clip: content-box; border-radius: 10px; }
::-webkit-scrollbar-thumb:hover { background: #bdb7aa; border: 3px solid transparent; background-clip: content-box; }

/* ===== 02. Boot ===== */
.boot {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-content: center;
  gap: 18px;
  background: var(--navy);
  color: #f7f4eb;
  text-align: center;
  transition: opacity 0.45s var(--ease), visibility 0.45s;
}
.boot.is-hidden { opacity: 0; visibility: hidden; }
.boot p { margin: 0; font-size: 12px; letter-spacing: 0.18em; color: #9cabac; }
.boot-mark { display: flex; align-items: flex-end; justify-content: center; gap: 5px; height: 32px; }
.boot-mark span { width: 5px; border-radius: 3px; background: #f4f0e5; animation: boot-bars 1s ease-in-out infinite; }
.boot-mark span:nth-child(1) { height: 14px; }
.boot-mark span:nth-child(2) { height: 26px; animation-delay: 0.12s; background: var(--gold); }
.boot-mark span:nth-child(3) { height: 20px; animation-delay: 0.24s; }
@keyframes boot-bars { 0%, 100% { transform: scaleY(0.55); opacity: 0.55; } 50% { transform: scaleY(1); opacity: 1; } }

/* ===== 03. Brand ===== */
.brand { display: inline-flex; align-items: center; gap: 12px; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; flex: 0 0 auto; border-radius: 10px; color: currentColor; background: rgba(255, 255, 255, 0.06); border: 1px solid rgba(255, 255, 255, 0.11); }
.brand-mark svg { width: 27px; height: 27px; }
.brand-light { color: #f8f5ed; }
.brand-text { display: flex; flex-direction: column; gap: 1px; line-height: 1; }
.brand-text strong { font-size: 20px; letter-spacing: 0.16em; font-weight: 700; }
.brand-text small { margin-top: 5px; font-size: 8px; letter-spacing: 0.16em; color: #8fa1a4; white-space: nowrap; }

/* ===== 04. Login ===== */
.login-view {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(440px, 0.92fr);
  background: #f3f1eb;
}
.login-visual {
  position: relative;
  overflow: hidden;
  min-height: 100vh;
  background:
    radial-gradient(ellipse 80% 60% at 15% 0%, rgba(36, 93, 81, 0.45), transparent 60%),
    radial-gradient(ellipse 70% 50% at 90% 100%, rgba(176, 126, 53, 0.18), transparent 58%),
    linear-gradient(145deg, #111c2a 0%, #0d1723 55%, #0b141e 100%);
  color: #f7f4eb;
}
.visual-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.035) 1px, transparent 1px);
  background-size: 62px 62px;
  mask-image: radial-gradient(ellipse 80% 85% at 45% 40%, #000 20%, transparent 78%);
  pointer-events: none;
}
.visual-glow {
  position: absolute;
  width: 520px;
  height: 520px;
  left: 43%;
  top: 48%;
  border: 1px solid rgba(215, 163, 90, 0.12);
  border-radius: 50%;
  box-shadow: 0 0 0 70px rgba(255, 255, 255, 0.018), 0 0 0 150px rgba(255, 255, 255, 0.012);
  pointer-events: none;
}
.login-visual-inner {
  position: relative;
  z-index: 2;
  width: min(720px, calc(100% - 96px));
  min-height: 100vh;
  margin: 0 auto;
  padding: 44px 0 32px;
  display: flex;
  flex-direction: column;
}
.login-copy { margin-top: clamp(64px, 13vh, 132px); }
.eyebrow { margin: 0 0 12px; font-size: 10px; letter-spacing: 0.24em; font-weight: 650; color: var(--teal); text-transform: uppercase; }
.eyebrow.light { color: #d7a35a; }
.login-copy h1 {
  margin: 0;
  max-width: 620px;
  font-size: clamp(42px, 4.7vw, 68px);
  line-height: 1.16;
  letter-spacing: -0.035em;
  font-weight: 600;
}
.login-lead { max-width: 530px; margin: 24px 0 0; font-size: 15px; line-height: 1.9; color: #aab7ba; }

.flow-steps { margin-top: clamp(52px, 9vh, 90px); display: grid; grid-template-columns: repeat(3, 1fr); gap: 0; }
.flow-step { padding: 18px 20px 0 0; border-top: 1px solid rgba(255, 255, 255, 0.14); }
.flow-step + .flow-step { padding-left: 20px; }
.flow-index { display: block; margin-bottom: 14px; font-family: var(--font-num); font-size: 11px; letter-spacing: 0.14em; color: #d7a35a; }
.flow-step strong { display: block; font-size: 14px; font-weight: 600; letter-spacing: 0.03em; }
.flow-step small { display: block; margin-top: 5px; font-size: 11px; line-height: 1.6; color: #849397; }
.flow-line { display: none; }

.login-quote { margin-top: auto; padding-top: 42px; }
.login-quote p { max-width: 510px; margin: 0 0 20px; font-size: 12px; line-height: 1.8; color: #86959a; }
.login-quote p::before { content: "— "; color: #d7a35a; }
.login-tags { display: flex; flex-wrap: wrap; gap: 8px; }
.login-tags span { padding: 5px 10px; border: 1px solid rgba(255, 255, 255, 0.1); border-radius: 999px; font-size: 9px; letter-spacing: 0.08em; color: #8d9c9f; }

.login-panel {
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 100vh;
  padding: 48px clamp(38px, 6vw, 92px) 26px;
  position: relative;
}
.login-card { width: 100%; max-width: 420px; margin: auto; animation: rise-in 0.7s var(--ease) both; }
.mobile-brand { display: none; margin-bottom: 44px; color: var(--ink); }
.mobile-brand .brand-mark { background: var(--navy); color: #f8f5ed; border-color: var(--navy); }
.mobile-brand .brand-text small { color: var(--muted); }
.login-heading { margin-bottom: 34px; }
.login-heading h2 { margin: 0; font-size: 31px; line-height: 1.2; letter-spacing: -0.035em; font-weight: 600; }
.login-heading > p:last-child { margin: 12px 0 0; color: var(--muted); font-size: 13px; }
.login-form { display: flex; flex-direction: column; gap: 19px; }

.field { display: flex; flex-direction: column; gap: 8px; }
.field-label, .field-label-row { font-size: 12px; font-weight: 600; color: var(--ink-soft); }
.field-label-row { display: flex; align-items: center; justify-content: space-between; }
.field-hint { font-size: 10px; font-weight: 400; color: var(--muted-2); letter-spacing: 0.02em; }
.input-with-icon { position: relative; display: flex; align-items: center; }
.input-with-icon > svg { position: absolute; left: 14px; width: 17px; height: 17px; color: #8b959c; pointer-events: none; }
.input-with-icon > input { padding-left: 42px; }
input, select, textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 13px;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color 0.18s, box-shadow 0.18s, background 0.18s;
}
input::placeholder, textarea::placeholder { color: #a5adb2; }
input:hover, select:hover, textarea:hover { border-color: #c3bcae; }
input:focus, select:focus, textarea:focus { border-color: var(--teal); box-shadow: 0 0 0 3px rgba(13, 107, 94, 0.1); }
input:disabled, select:disabled, textarea:disabled { background: #f1efe9; color: var(--muted); cursor: not-allowed; }
textarea { min-height: 112px; resize: vertical; line-height: 1.7; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='m7 10 5 5 5-5' fill='none' stroke='%2377818a' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 36px; }
.code-row { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.code-button { min-width: 110px; height: 44px; white-space: nowrap; }
.dev-code {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: -5px;
  padding: 10px 13px;
  font-size: 11px;
  color: #205c52;
  background: var(--teal-soft);
  border: 1px dashed var(--teal-line);
  border-radius: var(--radius-sm);
}
.dev-code span { font-family: var(--font-num); letter-spacing: 0.12em; font-size: 13px; font-weight: 600; }
.dev-code button { border: 0; padding: 0; color: var(--teal); background: none; font-size: 11px; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
.form-error { margin: -4px 0 0; padding: 10px 12px; border-radius: 8px; color: var(--red); background: var(--red-soft); font-size: 12px; line-height: 1.6; }
.form-error.success { color: var(--teal); background: var(--teal-soft); }
.login-legal { margin: 26px 0 0; font-size: 10px; line-height: 1.7; color: var(--muted-2); }
.login-footer { width: 100%; max-width: 420px; margin: 28px auto 0; display: flex; justify-content: space-between; gap: 12px; font-size: 10px; color: #9a9f9d; }

.demo-accounts { margin-top: 30px; }
.demo-title { display: flex; align-items: center; gap: 12px; font-size: 10px; letter-spacing: 0.13em; color: var(--muted-2); }
.demo-title span { height: 1px; flex: 1; background: var(--line); }
.demo-list { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 13px; }
.demo-chip { display: inline-flex; align-items: center; gap: 7px; padding: 6px 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); color: var(--ink-soft); font-size: 10px; cursor: pointer; transition: 0.18s; }
.demo-chip:hover { border-color: var(--teal-line); background: var(--teal-soft); color: var(--teal-dark); }
.demo-chip i { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.demo-chip small { color: var(--muted-2); }
.demo-note { margin: 10px 0 0; font-size: 10px; line-height: 1.65; color: var(--muted-2); }

/* ===== 05. Buttons & controls ===== */
.btn {
  --btn-bg: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 15px;
  border: 1px solid transparent;
  border-radius: 9px;
  background: var(--btn-bg);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 0.18s, border-color 0.18s, transform 0.12s, color 0.18s;
}
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }
.btn svg { width: 15px; height: 15px; }
.btn-primary { background: var(--teal); color: #fff; border-color: var(--teal); box-shadow: 0 1px 2px rgba(8, 82, 71, 0.2); }
.btn-primary:hover { background: var(--teal-dark); border-color: var(--teal-dark); }
.btn-dark { background: var(--navy); color: #f8f5ed; border-color: var(--navy); }
.btn-dark:hover { background: #1c2c3f; }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink-soft); }
.btn-ghost:hover { background: var(--surface-soft); border-color: #c3bcae; color: var(--ink); }
.btn-soft { background: var(--teal-soft); color: var(--teal-dark); border-color: transparent; }
.btn-soft:hover { background: #d9ece6; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #963a31; }
.btn-danger-soft { background: var(--red-soft); color: var(--red); border-color: transparent; }
.btn-quiet { padding: 6px 9px; min-height: 30px; background: transparent; border-color: transparent; color: var(--muted); }
.btn-quiet:hover { background: var(--surface-sunk); color: var(--ink); }
.btn-block { width: 100%; }
.btn-lg { min-height: 47px; font-size: 13px; border-radius: 10px; }
.btn-sm { min-height: 32px; padding: 6px 11px; font-size: 11px; }
.btn.is-loading { color: transparent !important; pointer-events: none; position: relative; }
.btn.is-loading::after { content: ""; position: absolute; width: 15px; height: 15px; border: 2px solid rgba(255, 255, 255, 0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.8s linear infinite; }
.btn-ghost.is-loading::after { border-color: rgba(23, 33, 45, 0.25); border-top-color: var(--ink); }

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: var(--muted);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  cursor: pointer;
  transition: 0.18s;
}
.icon-button svg { width: 18px; height: 18px; }
.icon-button:hover { background: var(--surface); border-color: var(--line); color: var(--ink); }
.icon-button.dark { color: #8c9b9f; }
.icon-button.dark:hover { color: #f7f3e9; background: rgba(255, 255, 255, 0.07); border-color: rgba(255, 255, 255, 0.1); }

.link-button { border: 0; padding: 0; background: none; color: var(--teal); font-size: 11px; font-weight: 600; cursor: pointer; }
.link-button:hover { color: var(--teal-dark); text-decoration: underline; text-underline-offset: 3px; }
.link-button.danger { color: var(--red); }

/* ===== 06. App shell ===== */
.app-shell { min-height: 100vh; display: grid; grid-template-columns: 252px minmax(0, 1fr); background: var(--bg); }
.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 40;
  display: flex;
  flex-direction: column;
  padding: 25px 16px 18px;
  color: #f6f2e9;
  background:
    radial-gradient(ellipse 70% 40% at 10% 4%, rgba(35, 92, 80, 0.32), transparent 65%),
    radial-gradient(ellipse 70% 30% at 100% 95%, rgba(170, 122, 53, 0.12), transparent 70%),
    var(--navy);
  overflow-y: auto;
}
.sidebar::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  opacity: 0.28;
  background-image: linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px), linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
  background-size: 52px 52px;
  mask-image: linear-gradient(to bottom, #000, transparent 45%);
}
.sidebar > * { position: relative; z-index: 1; }
.sidebar-brand { display: flex; align-items: center; justify-content: space-between; padding: 0 7px 26px; }
.sidebar-brand .brand-text strong { font-size: 19px; }
.sidebar-close { display: none; color: #9aabad; }
.main-nav { display: flex; flex-direction: column; gap: 4px; }
.nav-label { margin: 18px 11px 8px; font-size: 9px; letter-spacing: 0.18em; color: #637579; font-weight: 600; }
.nav-item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  min-height: 41px;
  padding: 9px 11px;
  color: #a2b0b2;
  background: transparent;
  border: 0;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  text-align: left;
  cursor: pointer;
  transition: color 0.18s, background 0.18s;
}
.nav-item svg { width: 17px; height: 17px; flex: 0 0 auto; opacity: 0.82; }
.nav-item:hover { color: #fff; background: rgba(255, 255, 255, 0.05); }
.nav-item.active { color: #fff; background: rgba(255, 255, 255, 0.08); }
.nav-item.active::before { content: ""; position: absolute; left: -16px; top: 11px; bottom: 11px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gold); }
.nav-item.active svg { color: #d7a35a; opacity: 1; }
.nav-item .nav-badge { margin-left: auto; min-width: 20px; padding: 1px 6px; border-radius: 999px; background: rgba(215, 163, 90, 0.14); color: #d7a35a; font-family: var(--font-num); font-size: 9px; text-align: center; }
.sidebar-note { margin: auto 2px 18px; padding: 15px; border: 1px solid rgba(255, 255, 255, 0.075); border-radius: 11px; background: rgba(255, 255, 255, 0.028); }
.sidebar-note-label { display: flex; align-items: center; gap: 7px; font-size: 9px; letter-spacing: 0.12em; color: #cfdbd9; font-weight: 600; }
.live-dot { width: 5px; height: 5px; border-radius: 50%; background: #56b8a4; box-shadow: 0 0 0 3px rgba(86, 184, 164, 0.12); }
.sidebar-note p { margin: 9px 0 11px; font-size: 10px; line-height: 1.7; color: #7f9194; }
.sidebar-note a { font-size: 10px; color: #d7a35a; }
.sidebar-note a:hover { color: #ecc584; }
.sidebar-note a span { margin-left: 4px; }
.sidebar-user { display: flex; align-items: center; gap: 9px; padding: 14px 6px 0; border-top: 1px solid rgba(255, 255, 255, 0.08); }
.avatar, .topbar-avatar { display: grid; place-items: center; flex: 0 0 auto; border-radius: 50%; background: linear-gradient(135deg, #d7a35a, #966326); color: #fff; font-size: 12px; font-weight: 700; }
.avatar { width: 33px; height: 33px; }
.sidebar-user-meta { display: flex; min-width: 0; flex: 1; flex-direction: column; }
.sidebar-user-meta strong { overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.sidebar-user-meta span { margin-top: 1px; font-size: 9px; color: #7c8e91; }
.settings-shortcut.is-active { color: #e8c78e; background: rgba(215, 163, 90, 0.12); border-color: rgba(215, 163, 90, 0.18); }

.app-body { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  min-height: 83px;
  padding: 0 clamp(22px, 3.4vw, 42px);
  border-bottom: 1px solid var(--line);
  background: rgba(242, 241, 236, 0.88);
  backdrop-filter: blur(14px);
  -webkit-backdrop-filter: blur(14px);
}
.topbar-left { display: flex; align-items: center; gap: 13px; min-width: 0; }
.menu-button { display: none; }
.page-heading p { margin: 0 0 3px; font-size: 9px; font-weight: 650; letter-spacing: 0.13em; color: var(--muted-2); text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: 20px; line-height: 1.2; letter-spacing: -0.02em; font-weight: 620; }
.topbar-right { display: flex; align-items: center; gap: 8px; }
.date-chip { margin-right: 5px; padding: 7px 11px; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); background: rgba(255, 255, 255, 0.55); font-family: var(--font-num); font-size: 10px; letter-spacing: 0.04em; }
.topbar-avatar { width: 32px; height: 32px; margin-left: 4px; }
.main-content { width: 100%; max-width: 1500px; margin: 0 auto; padding: 30px clamp(22px, 3.4vw, 42px) 64px; outline: none; }

.sidebar-mask { display: none; }

/* ===== 07. Page building blocks ===== */
.page-stack { display: flex; flex-direction: column; gap: 19px; animation: page-in 0.4s var(--ease) both; }
.page-intro { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; margin-bottom: 2px; }
.page-intro h2 { margin: 0; font-size: 22px; line-height: 1.3; letter-spacing: -0.025em; font-weight: 610; }
.page-intro p { max-width: 620px; margin: 7px 0 0; color: var(--muted); font-size: 12px; }
.page-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.panel-pad { padding: 21px 22px; }
.panel-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 19px 21px 0; }
.panel-header.with-border { padding-bottom: 15px; border-bottom: 1px solid var(--line); }
.panel-title { margin: 0; font-size: 13px; font-weight: 620; letter-spacing: -0.005em; }
.panel-subtitle { margin: 4px 0 0; font-size: 10px; color: var(--muted-2); }
.panel-tools { display: flex; align-items: center; gap: 7px; }
.panel-body { padding: 18px 21px 21px; }
.panel-link { display: inline-flex; align-items: center; gap: 4px; border: 0; background: none; color: var(--muted); font-size: 10px; cursor: pointer; }
.panel-link:hover { color: var(--teal); }
.panel-link svg { width: 13px; height: 13px; }

.grid-12 { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 19px; }
.span-4 { grid-column: span 4; }
.span-5 { grid-column: span 5; }
.span-6 { grid-column: span 6; }
.span-7 { grid-column: span 7; }
.span-8 { grid-column: span 8; }
.span-12 { grid-column: span 12; }

.kpi-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 15px; }
.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 158px;
  padding: 19px 20px 17px;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}
.kpi-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.kpi-label { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; color: var(--muted); }
.kpi-icon { display: grid; place-items: center; width: 31px; height: 31px; border-radius: 9px; color: var(--teal); background: var(--teal-soft); }
.kpi-icon svg { width: 16px; height: 16px; }
.kpi-icon.gold { color: var(--amber); background: var(--gold-soft); }
.kpi-icon.red { color: var(--red); background: var(--red-soft); }
.kpi-icon.blue { color: var(--blue); background: var(--blue-soft); }
.kpi-value { margin: 14px 0 0; font-family: var(--font-num); font-size: 31px; line-height: 1.1; letter-spacing: -0.03em; font-weight: 650; font-variant-numeric: tabular-nums; }
.kpi-value .unit { margin-left: 2px; font-family: var(--font-ui); font-size: 13px; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.kpi-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 15px; padding-top: 12px; border-top: 1px solid var(--line); font-size: 9px; color: var(--muted-2); }
.kpi-meta strong { color: var(--ink-soft); font-weight: 600; }
.kpi-meta .positive { color: var(--teal); }
.kpi-meta .negative { color: var(--red); }
.kpi-featured { color: #f8f5ed; background: linear-gradient(140deg, #122131 0%, #0f1b29 62%, #122e2a 100%); border-color: #122131; }
.kpi-featured::before { content: ""; position: absolute; width: 190px; height: 190px; right: -60px; top: -65px; border: 1px solid rgba(215, 163, 90, 0.24); border-radius: 50%; box-shadow: 0 0 0 35px rgba(255, 255, 255, 0.025), 0 0 0 72px rgba(255, 255, 255, 0.018); }
.kpi-featured::after { content: ""; position: absolute; width: 80px; height: 1px; right: 24px; bottom: 31px; background: linear-gradient(90deg, transparent, rgba(215, 163, 90, 0.55)); }
.kpi-featured .kpi-label { color: #97a8a9; }
.kpi-featured .kpi-value { color: #fff; }
.kpi-featured .kpi-value .unit { color: #a9b7b8; }
.kpi-featured .kpi-meta { border-top-color: rgba(255, 255, 255, 0.12); color: #93a4a6; }
.kpi-featured .kpi-meta strong { color: #e8c78e; }
.kpi-featured .kpi-icon { color: #e8c78e; background: rgba(215, 163, 90, 0.12); border: 1px solid rgba(215, 163, 90, 0.15); }

.chart-wrap { position: relative; min-height: 240px; padding: 0 3px 2px; }
.chart-wrap svg { width: 100%; height: auto; overflow: visible; }
.chart-legend { display: flex; align-items: center; gap: 15px; margin-top: 8px; font-size: 9px; color: var(--muted); }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.legend-dot { width: 7px; height: 7px; border-radius: 2px; background: var(--teal); }
.legend-dot.muted { background: #d9d4c9; }
.chart-grid-line { stroke: #ece8df; stroke-dasharray: 3 4; }
.chart-axis-text { fill: #9ba2a7; font-family: var(--font-num); font-size: 9px; }
.chart-bar { fill: #e3dfd5; transition: fill 0.2s; }
.chart-bar:hover { fill: #d1cabb; }
.chart-line { fill: none; stroke: var(--teal); stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.chart-area { fill: url(#areaGradient); }
.chart-point { fill: #fff; stroke: var(--teal); stroke-width: 2; }
.chart-value-label { fill: var(--teal-dark); font-family: var(--font-num); font-size: 8px; }
.chart-empty { display: grid; place-items: center; min-height: 220px; color: var(--muted-2); font-size: 11px; }

.method-list { display: flex; flex-direction: column; gap: 16px; padding-top: 4px; }
.method-row { display: grid; grid-template-columns: 1fr auto; gap: 6px 12px; align-items: center; }
.method-name { display: flex; align-items: center; gap: 7px; font-size: 11px; color: var(--ink-soft); }
.method-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--teal); }
.method-dot.c1 { background: #0d6b5e; }
.method-dot.c2 { background: #c28a3d; }
.method-dot.c3 { background: #315f8e; }
.method-dot.c4 { background: #9d6c83; }
.method-dot.c5 { background: #8a9188; }
.method-amount { font-family: var(--font-num); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.method-track { grid-column: 1 / -1; height: 4px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.method-bar { height: 100%; border-radius: inherit; background: var(--teal); }
.method-row:nth-child(2) .method-bar { background: var(--gold); }
.method-row:nth-child(3) .method-bar { background: var(--blue); }
.method-row:nth-child(4) .method-bar { background: #9d6c83; }
.method-row:nth-child(5) .method-bar { background: #8a9188; }
.method-empty { padding: 40px 0; text-align: center; color: var(--muted-2); font-size: 11px; }

.aging-list { display: flex; flex-direction: column; }
.aging-row { display: grid; grid-template-columns: 110px 1fr auto; align-items: center; gap: 12px; min-height: 43px; border-bottom: 1px solid var(--line); }
.aging-row:last-child { border-bottom: 0; }
.aging-label { font-size: 10px; color: var(--muted); }
.aging-bar-wrap { height: 5px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.aging-bar { height: 100%; border-radius: inherit; background: var(--teal); }
.aging-row.risk .aging-bar { background: var(--gold); }
.aging-row.danger .aging-bar { background: var(--red); }
.aging-amount { min-width: 86px; text-align: right; font-family: var(--font-num); font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; }
.aging-amount small { display: block; font-family: var(--font-ui); font-size: 8px; font-weight: 400; color: var(--muted-2); }

/* ===== 08. Tables ===== */
.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { padding: 10px 12px; border-bottom: 1px solid var(--line); color: var(--muted-2); font-size: 9px; font-weight: 600; letter-spacing: 0.07em; text-align: left; white-space: nowrap; }
td { padding: 13px 12px; border-bottom: 1px solid #f0ede6; font-size: 11px; color: var(--ink-soft); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background 0.15s; }
tbody tr:hover td { background: #fbfaf7; }
td:first-child, th:first-child { padding-left: 21px; }
td:last-child, th:last-child { padding-right: 21px; }
.table-main { font-size: 11px; font-weight: 600; color: var(--ink); }
.table-sub { margin-top: 3px; font-size: 9px; color: var(--muted-2); }
.table-nowrap { white-space: nowrap; }
.table-right { text-align: right; }
.table-money { font-family: var(--font-num); font-variant-numeric: tabular-nums; font-size: 11px; font-weight: 600; white-space: nowrap; }
.table-money.negative { color: var(--red); }
.table-money.muted { color: var(--muted); font-weight: 400; }
.table-actions { display: flex; justify-content: flex-end; gap: 4px; white-space: nowrap; }
.row-title { display: flex; align-items: center; gap: 10px; min-width: 0; }
.row-icon { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 8px; color: var(--teal); background: var(--teal-soft); font-family: var(--font-num); font-size: 10px; font-weight: 700; }
.row-icon.gold { color: var(--amber); background: var(--gold-soft); }
.table-link { color: var(--ink); font-weight: 600; border: 0; padding: 0; background: none; cursor: pointer; text-align: left; }
.table-link:hover { color: var(--teal); }

.status-cluster { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.text-danger { color: var(--red) !important; }
.rank-number { display: inline-grid; place-items: center; min-width: 20px; height: 17px; padding: 0 4px; border-radius: 4px; background: var(--surface-sunk); color: var(--muted-2); font-family: var(--font-num); font-size: 8px; }
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 4px 8px; border-radius: 999px; font-size: 9px; line-height: 1.3; font-weight: 600; white-space: nowrap; }
.badge::before { content: ""; width: 4px; height: 4px; border-radius: 50%; background: currentColor; }
.badge-paid { color: var(--teal); background: var(--teal-soft); }
.badge-partial { color: var(--amber); background: var(--amber-soft); }
.badge-unpaid { color: #68727b; background: #efeee9; }
.badge-overdue { color: var(--red); background: var(--red-soft); }
.badge-cancelled { color: #8b9298; background: #efefec; }
.badge-sent { color: var(--teal); background: var(--teal-soft); }
.badge-failed { color: var(--red); background: var(--red-soft); }
.badge-queued { color: var(--amber); background: var(--amber-soft); }
.badge-neutral { color: var(--blue); background: var(--blue-soft); }

.empty-state { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 9px; padding: 48px 20px; text-align: center; }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; border-radius: 13px; background: var(--surface-sunk); color: var(--muted-2); }
.empty-icon svg { width: 20px; height: 20px; }
.empty-state strong { font-size: 12px; font-weight: 600; }
.empty-state p { max-width: 330px; margin: 0; font-size: 10px; line-height: 1.7; color: var(--muted-2); }

.overdue-list { display: flex; flex-direction: column; }
.overdue-item { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 11px; padding: 12px 0; border-bottom: 1px solid var(--line); }
.overdue-item:first-child { padding-top: 0; }
.overdue-item:last-child { border-bottom: 0; padding-bottom: 0; }
.overdue-days { display: grid; place-items: center; width: 39px; height: 39px; border-radius: 10px; color: var(--red); background: var(--red-soft); font-family: var(--font-num); text-align: center; line-height: 1; }
.overdue-days strong { display: block; font-size: 13px; font-weight: 700; }
.overdue-days small { display: block; margin-top: 2px; font-family: var(--font-ui); font-size: 7px; }
.overdue-main { min-width: 0; }
.overdue-main strong { display: block; overflow: hidden; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.overdue-main span { display: block; overflow: hidden; margin-top: 3px; font-size: 9px; color: var(--muted-2); text-overflow: ellipsis; white-space: nowrap; }
.overdue-amount { text-align: right; font-family: var(--font-num); font-size: 11px; font-weight: 600; color: var(--red); white-space: nowrap; }
.overdue-amount small { display: block; margin-top: 3px; font-family: var(--font-ui); font-size: 8px; color: var(--muted-2); font-weight: 400; }

.activity-list { display: flex; flex-direction: column; }
.activity-item { position: relative; display: grid; grid-template-columns: 8px 1fr; gap: 10px; padding: 0 0 16px; }
.activity-item:last-child { padding-bottom: 0; }
.activity-dot { width: 6px; height: 6px; margin-top: 5px; border-radius: 50%; background: var(--teal); box-shadow: 0 0 0 3px var(--teal-soft); }
.activity-item:nth-child(3n) .activity-dot { background: var(--gold); box-shadow: 0 0 0 3px var(--gold-soft); }
.activity-content { min-width: 0; font-size: 10px; line-height: 1.55; color: var(--muted); }
.activity-content strong { font-weight: 600; color: var(--ink-soft); }
.activity-content time { display: block; margin-top: 2px; font-family: var(--font-num); font-size: 8px; color: var(--muted-2); }

/* ===== 09. Toolbars, filters, summaries ===== */
.toolbar { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 14px 18px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.toolbar-left, .toolbar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.search-box { position: relative; min-width: 210px; }
.search-box svg { position: absolute; left: 11px; top: 50%; width: 15px; height: 15px; color: var(--muted-2); transform: translateY(-50%); pointer-events: none; }
.search-box input { min-height: 35px; padding: 7px 12px 7px 34px; font-size: 11px; background: var(--surface-soft); border-color: var(--line); }
.filter-tabs { display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 9px; background: var(--surface-sunk); }
.filter-tab { min-height: 28px; padding: 4px 10px; border: 0; border-radius: 7px; background: transparent; color: var(--muted); font-size: 10px; font-weight: 500; cursor: pointer; transition: 0.15s; }
.filter-tab:hover { color: var(--ink); }
.filter-tab.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600; }
.filter-tab .count { margin-left: 4px; font-family: var(--font-num); font-size: 8px; color: var(--muted-2); }
.select-compact { width: auto; min-height: 35px; padding: 6px 32px 6px 11px; font-size: 10px; background-color: var(--surface); }
.range-control { display: flex; align-items: center; gap: 7px; padding: 4px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.range-control input[type="date"] { width: 126px; min-height: 30px; padding: 4px 7px; font-family: var(--font-num); font-size: 10px; border-color: transparent; background: transparent; }
.range-control input[type="date"]:hover { background: var(--surface-soft); }
.range-separator { color: var(--muted-2); font-size: 10px; }
.preset-pills { display: inline-flex; gap: 2px; padding: 3px; border-radius: 8px; background: var(--surface-sunk); }
.preset-pill { border: 0; background: none; padding: 4px 8px; border-radius: 6px; font-size: 9px; color: var(--muted); cursor: pointer; }
.preset-pill.active { background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); }
.summary-strip { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0; border-bottom: 1px solid var(--line); }
.summary-cell { padding: 16px 20px; border-right: 1px solid var(--line); }
.summary-cell:last-child { border-right: 0; }
.summary-cell span { display: block; font-size: 9px; color: var(--muted-2); }
.summary-cell strong { display: block; margin-top: 5px; font-family: var(--font-num); font-size: 18px; font-weight: 650; font-variant-numeric: tabular-nums; }
.summary-cell small { display: block; margin-top: 2px; color: var(--muted-2); font-size: 8px; }
.stat-mini-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.stat-mini { padding: 16px 18px; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); }
.stat-mini span { font-size: 9px; color: var(--muted-2); }
.stat-mini strong { display: block; margin-top: 7px; font-family: var(--font-num); font-size: 22px; font-weight: 650; letter-spacing: -0.02em; }
.stat-mini small { display: block; margin-top: 4px; font-size: 8px; color: var(--muted-2); }
.stat-mini.accent { background: var(--navy); border-color: var(--navy); color: #fff; }
.stat-mini.accent span, .stat-mini.accent small { color: #91a1a4; }
.stat-mini.accent strong { color: #e8c78e; }

.progress-line { display: flex; align-items: center; gap: 10px; }
.progress-track { flex: 1; height: 6px; border-radius: 99px; background: var(--surface-sunk); overflow: hidden; }
.progress-value { height: 100%; border-radius: inherit; background: var(--teal); }
.progress-caption { font-family: var(--font-num); font-size: 10px; color: var(--muted); white-space: nowrap; }

/* ===== 10. Orders & customers ===== */
.tabs-bar { display: flex; align-items: center; gap: 0; border-bottom: 1px solid var(--line); padding: 0 18px; overflow-x: auto; }
.tab { position: relative; min-height: 44px; padding: 12px 13px; border: 0; background: none; color: var(--muted); font-size: 10px; font-weight: 500; cursor: pointer; white-space: nowrap; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); font-weight: 600; }
.tab.active::after { content: ""; position: absolute; left: 12px; right: 12px; bottom: -1px; height: 2px; background: var(--teal); border-radius: 2px 2px 0 0; }
.tab .count { margin-left: 5px; padding: 0 5px; border-radius: 999px; background: var(--surface-sunk); font-family: var(--font-num); font-size: 8px; color: var(--muted); }
.tab.active .count { background: var(--teal-soft); color: var(--teal); }

.customer-cell { display: flex; align-items: center; gap: 9px; }
.customer-avatar { display: grid; place-items: center; width: 30px; height: 30px; flex: 0 0 auto; border-radius: 50%; background: var(--surface-sunk); color: var(--ink-soft); font-size: 10px; font-weight: 650; }
.customer-avatar.tone-1 { background: #e8f0ed; color: #31675c; }
.customer-avatar.tone-2 { background: #f5ead9; color: #8c632e; }
.customer-avatar.tone-3 { background: #e8eef5; color: #3c5d7e; }
.customer-avatar.tone-4 { background: #f0e9ee; color: #7b5269; }
.customer-avatar.tone-5 { background: #eeeee7; color: #6f6e59; }

/* ===== 11. Mail ===== */
.mail-status { display: flex; align-items: flex-start; gap: 13px; padding: 19px 21px; border-bottom: 1px solid var(--line); }
.mail-status-icon { display: grid; place-items: center; width: 37px; height: 37px; flex: 0 0 auto; border-radius: 10px; color: var(--teal); background: var(--teal-soft); }
.mail-status-icon svg { width: 18px; height: 18px; }
.mail-status-main { min-width: 0; }
.mail-status-main strong { display: block; font-size: 11px; font-weight: 600; }
.mail-status-main p { margin: 4px 0 0; font-size: 9px; line-height: 1.65; color: var(--muted-2); }
.status-line { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 9px; color: var(--muted); }
.status-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--teal); }
.status-dot.off { background: var(--amber); }
.mail-meta-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 16px 21px 20px; }
.meta-item span { display: block; font-size: 8px; color: var(--muted-2); }
.meta-item strong { display: block; margin-top: 3px; overflow: hidden; font-size: 9px; font-weight: 500; color: var(--ink-soft); text-overflow: ellipsis; white-space: nowrap; }
.compose-grid { display: grid; grid-template-columns: 1.05fr 0.95fr; gap: 19px; }
.compose-form { display: flex; flex-direction: column; gap: 13px; padding: 19px 21px 21px; }
.compose-form .field { gap: 6px; }
.compose-form input, .compose-form textarea { font-size: 11px; }
.compose-form textarea { min-height: 118px; }
.compose-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.compose-hint { font-size: 8px; color: var(--muted-2); }
.mail-preview { display: flex; flex-direction: column; min-height: 100%; border-left: 1px solid var(--line); background: #fbfaf7; border-radius: 0 var(--radius) var(--radius) 0; }
.preview-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 19px; border-bottom: 1px solid var(--line); }
.preview-head span { font-size: 9px; letter-spacing: 0.08em; color: var(--muted-2); }
.preview-body { flex: 1; padding: 22px; }
.preview-mail { max-width: 390px; margin: 0 auto; overflow: hidden; border: 1px solid #e4dfd4; border-radius: 10px; background: #fff; box-shadow: 0 12px 32px rgba(23, 33, 45, 0.07); }
.preview-top { padding: 15px 18px; background: var(--navy); color: #fff; }
.preview-top small { display: block; font-size: 6px; letter-spacing: 0.16em; color: #9cb0af; }
.preview-top strong { display: block; margin-top: 3px; font-size: 12px; letter-spacing: 0.1em; }
.preview-content { padding: 19px 18px; }
.preview-content h4 { margin: 0 0 8px; font-size: 13px; }
.preview-content p { margin: 0; font-size: 9px; line-height: 1.8; color: #6d777f; }
.preview-code { margin-top: 13px; padding: 11px; border: 1px solid #dce9e4; border-radius: 7px; background: #f2f7f5; color: var(--teal); font-family: var(--font-num); font-size: 19px; font-weight: 700; letter-spacing: 7px; text-align: center; }
.preview-cta { display: inline-block; margin-top: 13px; padding: 7px 12px; border-radius: 5px; background: var(--teal); color: #fff; font-size: 8px; }
.preview-foot { margin-top: 13px; padding-top: 9px; border-top: 1px solid #eeeae2; font-size: 7px; color: #9ba2a7; }

.mail-provider-guide { padding: 13px 14px; border: 1px solid var(--teal-line); border-radius: 9px; background: linear-gradient(135deg, #f3f9f6, #fbfaf7); }
.mail-provider-guide .guide-title { font-size: 10px; font-weight: 650; color: var(--teal-dark); }
.mail-provider-guide p { margin: 5px 0 0; font-size: 9px; line-height: 1.75; color: var(--muted); }
.mail-provider-guide a { display: inline-flex; align-items: center; gap: 4px; margin-top: 7px; color: var(--teal); font-size: 9px; font-weight: 600; }
.mail-provider-guide a svg { width: 11px; height: 11px; }
.mail-provider-guide a:hover { text-decoration: underline; text-underline-offset: 3px; }
.mail-config-fields { padding: 14px 14px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.mail-config-fields .form-section-title { margin: 0 0 1px; }
.mail-config-fields .checkbox-row { background: var(--surface); }
.mail-test-box { display: grid; grid-template-columns: 1.1fr 0.9fr; gap: 9px; align-items: stretch; }
.mail-test-box input { min-height: 42px; }
.mail-test-box .checkbox-row { align-items: center; }
.mail-console-note { display: flex; align-items: flex-start; gap: 9px; padding: 12px 13px; border: 1px dashed #e4d4b6; border-radius: 9px; background: #fdf8ee; color: #7f642f; font-size: 9px; line-height: 1.7; }
.mail-console-note svg { width: 15px; height: 15px; flex: 0 0 auto; margin-top: 1px; }
.modal-footer-hint { margin-right: auto; color: var(--muted-2); font-size: 9px; }

/* ===== 12. API docs ===== */
.api-hero { position: relative; overflow: hidden; display: grid; grid-template-columns: 1.3fr 0.7fr; gap: 30px; padding: 29px 30px; border-radius: var(--radius); background: linear-gradient(120deg, #111e2d, #102a27); color: #f8f5ed; }
.api-hero::before { content: ""; position: absolute; width: 340px; height: 340px; right: -110px; top: -180px; border: 1px solid rgba(215, 163, 90, 0.25); border-radius: 50%; box-shadow: 0 0 0 48px rgba(255, 255, 255, 0.02), 0 0 0 100px rgba(255, 255, 255, 0.014); }
.api-hero-copy { position: relative; z-index: 1; }
.api-hero h2 { margin: 0; font-size: 26px; line-height: 1.3; letter-spacing: -0.025em; font-weight: 600; }
.api-hero p { max-width: 560px; margin: 11px 0 0; font-size: 11px; line-height: 1.8; color: #a4b3b4; }
.api-base { position: relative; z-index: 1; align-self: center; padding: 16px 17px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px; background: rgba(255, 255, 255, 0.045); }
.api-base span { display: block; font-size: 8px; letter-spacing: 0.12em; color: #8fa3a3; }
.api-base code { display: block; margin-top: 7px; overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; font-size: 11px; color: #e8c78e; }
.api-key-row { display: flex; align-items: center; gap: 10px; }
.key-prefix { font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; color: var(--muted); }
.scope-chip { display: inline-block; margin: 2px 3px 2px 0; padding: 2px 6px; border-radius: 4px; background: var(--surface-sunk); color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; }
.endpoint-list { display: flex; flex-direction: column; }
.endpoint { display: grid; grid-template-columns: 62px 1fr auto; gap: 14px; align-items: start; padding: 18px 21px; border-bottom: 1px solid var(--line); }
.endpoint:last-child { border-bottom: 0; }
.endpoint-method { display: inline-flex; justify-content: center; padding: 4px 6px; border-radius: 5px; font-family: var(--font-num); font-size: 8px; font-weight: 700; letter-spacing: 0.04em; }
.endpoint-method.post { color: var(--teal); background: var(--teal-soft); }
.endpoint-method.get { color: var(--blue); background: var(--blue-soft); }
.endpoint-body code { display: block; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; color: var(--ink); word-break: break-all; }
.endpoint-body p { margin: 5px 0 0; font-size: 9px; line-height: 1.6; color: var(--muted-2); }
.endpoint-scope { padding-top: 3px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 8px; color: var(--muted-2); white-space: nowrap; }
.code-block { position: relative; overflow: auto; margin: 0; padding: 16px 18px; border-radius: 10px; background: #131f2d; color: #c6d4d1; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; line-height: 1.75; }
.code-block .c { color: #6d8587; }
.code-block .g { color: #8bd0ba; }
.code-block .y { color: #e2bd7f; }
.code-card { position: relative; }
.copy-code { position: absolute; top: 9px; right: 9px; z-index: 1; padding: 4px 7px; border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 5px; background: rgba(255, 255, 255, 0.05); color: #9fb1b1; font-size: 8px; cursor: pointer; }
.copy-code:hover { color: #fff; background: rgba(255, 255, 255, 0.1); }
.api-tip { display: flex; gap: 10px; padding: 14px 16px; border: 1px dashed var(--line-strong); border-radius: 10px; background: var(--surface-soft); font-size: 9px; line-height: 1.7; color: var(--muted); }
.api-tip svg { width: 15px; height: 15px; flex: 0 0 auto; color: var(--amber); }
.secret-box { padding: 14px; border: 1px solid #ead6b5; border-radius: 9px; background: #fdf7eb; }
.secret-box label { display: block; font-size: 9px; color: var(--amber); }
.secret-value { display: flex; align-items: center; gap: 8px; margin-top: 7px; }
.secret-value code { flex: 1; overflow-wrap: anywhere; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; color: #6e4a17; }
.scope-options { display: grid; grid-template-columns: 1fr 1fr; gap: 7px; }
.scope-option { display: flex; align-items: flex-start; gap: 7px; padding: 9px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); font-size: 9px; cursor: pointer; }
.scope-option:has(input:checked) { border-color: var(--teal-line); background: var(--teal-soft); }
.scope-option input { width: 14px; min-height: 14px; margin: 1px 0 0; accent-color: var(--teal); }
.scope-option strong { display: block; font-size: 9px; font-weight: 600; }
.scope-option span { display: block; margin-top: 2px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 7px; color: var(--muted-2); }

/* ===== 13. Settings ===== */
.settings-grid { display: grid; grid-template-columns: 1.35fr 0.65fr; gap: 19px; }
.settings-list { display: flex; flex-direction: column; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; min-height: 52px; padding: 12px 21px; border-bottom: 1px solid var(--line); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .label { font-size: 10px; color: var(--muted); }
.settings-row .value { font-size: 10px; font-weight: 500; color: var(--ink-soft); text-align: right; }
.settings-note { padding: 18px 21px; border-top: 1px solid var(--line); font-size: 9px; line-height: 1.8; color: var(--muted-2); }
.member-cell { display: flex; align-items: center; gap: 9px; }
.member-cell .avatar { width: 29px; height: 29px; font-size: 9px; }
.member-info strong { display: block; font-size: 10px; font-weight: 600; }
.member-info span { display: block; margin-top: 2px; font-size: 8px; color: var(--muted-2); }
.role-select { width: 86px; min-height: 29px; padding: 4px 25px 4px 8px; font-size: 9px; }
.you-badge { margin-left: 5px; padding: 1px 5px; border-radius: 3px; background: var(--gold-soft); color: var(--amber); font-size: 7px; font-weight: 600; }
.design-notes { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; padding: 18px 21px; }
.design-note { padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-soft); }
.design-note span { font-family: var(--font-num); font-size: 9px; color: var(--gold); }
.design-note strong { display: block; margin-top: 7px; font-size: 10px; font-weight: 600; }
.design-note p { margin: 4px 0 0; font-size: 8px; line-height: 1.7; color: var(--muted-2); }

/* ===== 14. Modal & toast ===== */
.modal-root { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 24px; background: rgba(13, 22, 33, 0.55); backdrop-filter: blur(5px); animation: fade-in 0.2s ease both; }
.modal {
  width: min(520px, 100%);
  max-height: calc(100vh - 48px);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 17px;
  box-shadow: var(--shadow-lg);
  animation: modal-in 0.28s var(--ease) both;
}
.modal-lg { width: min(720px, 100%); }
.modal-xl { width: min(900px, 100%); }
.modal-header { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 21px 23px 0; }
.modal-header h3 { margin: 0; font-size: 17px; letter-spacing: -0.02em; font-weight: 620; }
.modal-header p { margin: 4px 0 0; font-size: 10px; color: var(--muted-2); }
.modal-close { margin: -5px -6px 0 0; flex: 0 0 auto; }
.modal-body { overflow-y: auto; padding: 19px 23px 23px; }
.modal-footer { display: flex; align-items: center; justify-content: flex-end; gap: 8px; padding: 15px 23px; border-top: 1px solid var(--line); background: var(--surface-soft); }
.modal-footer .left { margin-right: auto; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .span-2 { grid-column: span 2; }
.form-grid .field { gap: 6px; }
.form-section-title { grid-column: 1 / -1; margin: 2px 0 -3px; padding-top: 5px; font-size: 9px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted-2); }
.form-note { font-size: 9px; line-height: 1.65; color: var(--muted-2); }
.checkbox-row { display: flex; align-items: flex-start; gap: 8px; padding: 10px 11px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface-soft); font-size: 9px; line-height: 1.6; color: var(--muted); cursor: pointer; }
.checkbox-row input { width: 14px; min-height: 14px; margin-top: 1px; accent-color: var(--teal); }
.detail-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 15px; }
.detail-item span { display: block; font-size: 8px; color: var(--muted-2); }
.detail-item strong { display: block; margin-top: 4px; font-size: 10px; font-weight: 600; }
.detail-item .big { font-family: var(--font-num); font-size: 19px; }
.detail-amount { padding: 17px 18px; border-radius: 11px; background: var(--navy); color: #fff; }
.detail-amount span { display: block; font-size: 8px; color: #92a4a6; }
.detail-amount strong { display: block; margin-top: 5px; font-family: var(--font-num); font-size: 29px; font-weight: 650; color: #e8c78e; }
.detail-amount small { display: block; margin-top: 3px; font-size: 8px; color: #839698; }
.detail-section { margin-top: 20px; }
.detail-section h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 9px; font-size: 9px; font-weight: 600; letter-spacing: 0.08em; color: var(--muted-2); }
.detail-section h4 span { font-family: var(--font-num); font-weight: 400; letter-spacing: 0; }
.mini-list { border: 1px solid var(--line); border-radius: 9px; overflow: hidden; }
.mini-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 13px; border-bottom: 1px solid var(--line); font-size: 9px; }
.mini-row:last-child { border-bottom: 0; }
.mini-row .main { min-width: 0; }
.mini-row strong { display: block; overflow: hidden; font-size: 9px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.mini-row span { display: block; margin-top: 2px; font-size: 8px; color: var(--muted-2); }
.mini-row .amount { font-family: var(--font-num); font-size: 10px; font-weight: 600; white-space: nowrap; }
.mini-button { width: 100%; border: 0; border-bottom: 1px solid var(--line); background: transparent; text-align: left; cursor: pointer; font: inherit; }
.mini-button:last-child { border-bottom: 0; }
.mini-button:hover { background: var(--surface-soft); }
body.modal-open { overflow: hidden; }

.confirm-copy { margin: 0; font-size: 11px; line-height: 1.8; color: var(--muted); }
.confirm-copy strong { color: var(--ink); }

.toast-root { position: fixed; right: 22px; bottom: 22px; z-index: 150; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { display: flex; align-items: flex-start; gap: 9px; max-width: 380px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); box-shadow: 0 16px 40px rgba(16, 26, 40, 0.14); color: var(--ink-soft); font-size: 10px; line-height: 1.6; pointer-events: auto; animation: toast-in 0.25s var(--ease) both; }
.toast::before { content: ""; width: 5px; height: 5px; flex: 0 0 auto; margin-top: 5px; border-radius: 50%; background: var(--teal); }
.toast.error::before { background: var(--red); }
.toast.warn::before { background: var(--amber); }
.toast.is-out { animation: toast-out 0.2s ease both; }

.noscript { position: fixed; inset: 0; z-index: 300; display: grid; place-items: center; background: var(--bg); color: var(--red); font-size: 14px; }
.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; }

/* ===== 15. Animations ===== */
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes rise-in { from { opacity: 0; transform: translateY(16px); } to { opacity: 1; transform: none; } }
@keyframes page-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
@keyframes modal-in { from { opacity: 0; transform: translateY(14px) scale(0.985); } to { opacity: 1; transform: none; } }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(6px); } }
@keyframes pulse-soft { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }
.skeleton { border-radius: 5px; background: linear-gradient(90deg, #efede7, #f7f5f0, #efede7); background-size: 200% 100%; animation: skeleton 1.2s ease infinite; }
@keyframes skeleton { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
.loading-page { display: grid; gap: 15px; }
.loading-page .skeleton-kpi { display: grid; grid-template-columns: repeat(4, 1fr); gap: 15px; }
.loading-page .skeleton-kpi i { height: 158px; border-radius: var(--radius); }
.loading-page .skeleton-panel { height: 310px; border-radius: var(--radius); }

/* ===== 16. Responsive ===== */
@media (max-width: 1280px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .span-8, .span-7, .span-5, .span-4 { grid-column: span 6; }
  .compose-grid { grid-template-columns: 1fr; }
  .mail-preview { border-left: 0; border-top: 1px solid var(--line); border-radius: 0 0 var(--radius) var(--radius); }
}
@media (max-width: 1100px) {
  .login-view { grid-template-columns: minmax(0, 1fr) minmax(420px, 0.85fr); }
  .login-visual-inner { width: calc(100% - 64px); }
  .login-copy h1 { font-size: clamp(40px, 4.4vw, 54px); }
  .flow-step small { display: none; }
  .settings-grid { grid-template-columns: 1fr; }
  .stat-mini-grid, .summary-strip { grid-template-columns: repeat(2, 1fr); }
  .summary-cell:nth-child(2) { border-right: 0; }
  .summary-cell:nth-child(-n+2) { border-bottom: 1px solid var(--line); }
}
@media (max-width: 980px) {
  .login-visual { display: none; }
  .login-view { grid-template-columns: 1fr; }
  .login-panel { min-height: 100vh; padding: 40px 30px 22px; }
  .mobile-brand { display: inline-flex; }
  .login-card { max-width: 440px; }
  .login-footer { max-width: 440px; }

  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; left: 0; top: 0; width: 262px; transform: translateX(-102%); transition: transform 0.3s var(--ease); box-shadow: 20px 0 60px rgba(8, 15, 24, 0.3); }
  .sidebar.is-open { transform: translateX(0); }
  .sidebar-close { display: inline-grid; }
  .sidebar-mask { display: block; position: fixed; inset: 0; z-index: 35; background: rgba(9, 16, 25, 0.45); backdrop-filter: blur(2px); }
  .menu-button { display: inline-grid; }
  .main-content { padding-top: 23px; }
  .topbar { min-height: 74px; }
  .topbar-avatar { display: none; }
  .page-heading h1 { font-size: 18px; }
}
@media (max-width: 760px) {
  .main-content { padding: 19px 16px 48px; }
  .topbar { padding: 0 16px; min-height: 69px; }
  .date-chip { display: none; }
  .page-intro { align-items: flex-start; flex-direction: column; gap: 13px; }
  .page-intro h2 { font-size: 19px; }
  .page-actions { width: 100%; }
  .page-actions .btn { flex: 1; }
  .kpi-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi { min-height: 138px; padding: 15px 16px 14px; }
  .kpi-value { font-size: 25px; }
  .kpi-label { font-size: 9px; }
  .kpi-icon { width: 27px; height: 27px; }
  .kpi-icon svg { width: 14px; height: 14px; }
  .kpi-meta { margin-top: 11px; padding-top: 9px; font-size: 8px; }
  .grid-12 { grid-template-columns: 1fr; gap: 13px; }
  .span-4, .span-5, .span-6, .span-7, .span-8, .span-12 { grid-column: span 1; }
  .panel-header { padding: 16px 16px 0; }
  .panel-body { padding: 15px 16px 16px; }
  .panel-header.with-border { padding-bottom: 13px; }
  .table-wrap { margin: 0 -1px; }
  th { padding: 9px 11px; }
  td { padding: 12px 11px; }
  td:first-child, th:first-child { padding-left: 16px; }
  td:last-child, th:last-child { padding-right: 16px; }
  .toolbar { padding: 12px 14px; }
  .toolbar-left, .toolbar-right { width: 100%; }
  .search-box { flex: 1; min-width: 160px; }
  .filter-tabs { max-width: 100%; overflow-x: auto; }
  .tabs-bar { padding: 0 13px; }
  .range-control { flex: 1; flex-wrap: wrap; }
  .range-control input[type="date"] { width: 118px; flex: 1; }
  .api-hero { grid-template-columns: 1fr; padding: 22px 20px; gap: 18px; }
  .api-hero h2 { font-size: 22px; }
  .endpoint { grid-template-columns: 54px 1fr; gap: 10px; padding: 15px 16px; }
  .endpoint-scope { display: none; }
  .compose-grid { gap: 13px; }
  .settings-grid { gap: 13px; }
  .design-notes { grid-template-columns: 1fr; }
  .modal-root { padding: 12px; place-items: end center; }
  .modal { max-height: calc(100vh - 24px); border-radius: 16px; }
  .modal-body { padding: 16px 18px 19px; }
  .modal-header { padding: 18px 18px 0; }
  .modal-footer { padding: 13px 18px; }
  .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: span 1; }
  .mail-test-box { grid-template-columns: 1fr; }
  .modal-footer-hint { display: none; }
  .detail-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
  .toast-root { left: 14px; right: 14px; bottom: 14px; }
  .toast { max-width: none; width: 100%; }
}
@media (max-width: 540px) {
  .login-panel { padding: 30px 20px 20px; }
  .mobile-brand { margin-bottom: 34px; }
  .login-heading h2 { font-size: 27px; }
  .login-heading { margin-bottom: 26px; }
  .login-form { gap: 16px; }
  .login-footer { flex-direction: column; gap: 4px; align-items: flex-start; }
  .kpi-grid { grid-template-columns: 1fr; }
  .kpi { min-height: 130px; }
  .kpi-value { font-size: 29px; }
  .stat-mini-grid, .summary-strip { grid-template-columns: 1fr; }
  .summary-cell { border-right: 0; border-bottom: 1px solid var(--line); }
  .summary-cell:last-child { border-bottom: 0; }
  .summary-cell:nth-child(2) { border-right: 0; }
  .scope-options { grid-template-columns: 1fr; }
  .detail-grid { grid-template-columns: 1fr; }
  .overdue-item { grid-template-columns: auto 1fr; }
  .overdue-amount { grid-column: 2; text-align: left; }
  .page-actions .btn { flex: 1 1 auto; }
  .toolbar-left { flex-direction: column; align-items: stretch; }
  .toolbar-left .filter-tabs { width: 100%; }
  .toolbar-left .filter-tabs .filter-tab { flex: 1; }
}

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