:root {
  --a-bg: #f1f3fa;
  --a-surface: #ffffff;
  --a-surface-2: #f3f5fc;
  --a-ink: #0c1330;
  --a-ink-soft: #38415e;
  --a-muted: #6e7892;
  --a-faint: #9aa3ba;
  --a-line: #e0e4ef;
  --a-line-strong: #ccd3e5;
  --a-dark: #070d26;
  --a-dark-2: #0e1637;
  --a-lime: #c9d6ff;
  --a-green: #2f55f0;
  --a-coral: #d96044;
  --a-amber: #b6760e;
  --a-blue: #7b4dff;
  --a-radius: 18px;
  --a-sidebar: 240px;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background: var(--a-bg);
  color: var(--a-ink);
  font-family: "Avenir Next", "SF Pro Text", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1, "ss01" 1;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 2px solid #7b9c55;
  outline-offset: 2px;
}
a { color: inherit; text-decoration: none; }
svg { display: block; }
::selection { background: var(--a-lime); color: var(--a-dark); }
.svg-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.icon { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* ---------- Login ---------- */
.login-screen { display: grid; grid-template-columns: 1.12fr .88fr; min-height: 100vh; background: var(--a-surface); }
.login-visual {
  position: relative;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  min-height: 100vh;
  padding: 42px 54px;
  overflow: hidden;
  color: #f1f5ec;
  background:
    radial-gradient(90% 80% at 88% 10%, rgba(213, 243, 111, .15), transparent 55%),
    radial-gradient(70% 55% at 0% 100%, rgba(71, 116, 84, .28), transparent 70%),
    var(--a-dark);
}
.login-visual::after {
  content: "";
  position: absolute;
  right: -170px;
  bottom: -230px;
  width: 620px;
  height: 620px;
  border: 1px solid rgba(213, 243, 111, .13);
  border-radius: 50%;
  box-shadow: 0 0 0 80px rgba(213, 243, 111, .026), 0 0 0 160px rgba(213, 243, 111, .018);
}
.login-brand { position: relative; z-index: 2; display: flex; align-items: center; gap: 12px; width: max-content; }
.login-mark { display: grid; place-items: center; width: 40px; height: 40px; color: var(--a-dark); background: var(--a-lime); border-radius: 11px; }
.login-mark svg { width: 29px; height: 29px; fill: currentColor; }
.login-brand b { display: block; font-size: 17px; letter-spacing: .02em; }
.login-brand small { display: block; margin-top: 2px; color: #89978b; font-size: 8px; letter-spacing: .22em; }
.login-quote { position: relative; z-index: 2; max-width: 540px; margin: auto 0; }
.login-kicker { margin: 0 0 18px; color: #a8c36b; font-size: 9px; letter-spacing: .2em; font-weight: 600; }
.login-quote h1 { margin: 0; font-size: clamp(36px, 4.1vw, 58px); line-height: 1.22; letter-spacing: -.06em; font-weight: 480; }
.login-quote > p:last-child { max-width: 430px; margin: 23px 0 0; color: #91a094; font-size: 12px; line-height: 1.75; }
.login-orbit { position: relative; z-index: 2; display: flex; gap: 7px; align-items: center; }
.login-orbit span { width: 5px; height: 5px; border-radius: 50%; background: rgba(213, 243, 111, .25); }
.login-orbit span:first-child { width: 18px; border-radius: 5px; background: var(--a-lime); }
.login-panel { display: grid; place-items: center; padding: 40px; background: #f3f5fc; }
.login-card { width: min(390px, 100%); padding: 34px 32px 28px; background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 20px; box-shadow: 0 22px 60px rgba(36, 42, 33, .08); }
.login-card .login-kicker { color: #8f9c7c; margin-bottom: 9px; }
.login-card h2 { margin: 0; font-size: 27px; letter-spacing: -.045em; font-weight: 550; }
.login-help { margin: 10px 0 24px; color: var(--a-muted); font-size: 11px; line-height: 1.65; }
.login-help code { padding: 1px 4px; color: #5e6a55; background: #efecdf; border-radius: 4px; font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }
.login-field { display: flex; flex-direction: column; gap: 7px; color: #6e786e; font-size: 10px; font-weight: 550; }
.login-field input { width: 100%; height: 44px; padding: 0 12px; color: var(--a-ink); background: #f6f7fd; border: 1px solid var(--a-line); border-radius: 9px; outline: 0; font-size: 12px; }
.login-field input:focus { background: #ffffff; border-color: #9aad8f; }
.login-submit { display: flex; align-items: center; justify-content: space-between; width: 100%; height: 44px; margin-top: 17px; padding: 0 14px; color: #f2f5ed; background: var(--a-dark); border: 1px solid var(--a-dark); border-radius: 9px; font-size: 11px; font-weight: 600; transition: background .18s, transform .18s; }
.login-submit:hover { background: #25362a; }
.login-submit:active { transform: translateY(1px); }
.login-submit span { color: var(--a-lime); font-size: 16px; font-weight: 400; }
.login-error { margin: 10px 0 0; color: #b15841; font-size: 10px; }
.login-back { display: block; margin-top: 19px; color: #8b9388; font-size: 10px; text-align: center; }
.login-back:hover { color: var(--a-ink); }

/* ---------- Shell ---------- */
.admin-app { display: flex; min-height: 100vh; }
.admin-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 40;
  display: flex;
  flex-direction: column;
  width: var(--a-sidebar);
  padding: 23px 14px 15px;
  overflow-y: auto;
  color: #e7eee5;
  background:
    radial-gradient(100% 40% at 10% 0%, rgba(213, 243, 111, .1), transparent 60%),
    var(--a-dark);
  border-right: 1px solid rgba(255, 255, 255, .05);
}
.admin-brand { display: flex; align-items: center; gap: 10px; padding: 0 9px 23px; }
.admin-mark { display: grid; place-items: center; width: 34px; height: 34px; color: var(--a-dark); background: var(--a-lime); border-radius: 10px; }
.admin-mark svg { width: 25px; height: 25px; fill: currentColor; }
.admin-brand b { display: block; color: #f1f5ed; font-size: 15px; letter-spacing: .02em; }
.admin-brand small { display: block; margin-top: 2px; color: #79887b; font-size: 7px; letter-spacing: .2em; }
.admin-site-chip { display: flex; align-items: center; gap: 8px; margin: 0 3px 22px; padding: 9px 10px; background: rgba(255, 255, 255, .045); border: 1px solid rgba(255, 255, 255, .07); border-radius: 10px; }
.admin-site-dot { width: 5px; height: 5px; flex: 0 0 auto; border-radius: 50%; background: var(--a-lime); box-shadow: 0 0 0 3px rgba(213, 243, 111, .1); }
.admin-site-chip > div { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.admin-site-chip b { color: #e6ece4; font-size: 10px; font-weight: 550; }
.admin-site-chip small { margin-top: 1px; color: #77877a; font-size: 8px; }
.admin-site-chip > a { display: grid; place-items: center; width: 24px; height: 24px; color: #78887a; border-radius: 6px; }
.admin-site-chip > a:hover { color: var(--a-lime); background: rgba(255, 255, 255, .06); }
.admin-site-chip .icon { width: 13px; height: 13px; }
.admin-nav { display: flex; flex-direction: column; gap: 3px; }
.admin-nav-label { padding: 0 11px 7px; color: #657468; font-size: 8px; letter-spacing: .15em; font-weight: 600; }
.admin-nav-label.spaced { padding-top: 19px; }
.admin-nav button {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 11px;
  color: #aab7ab; background: transparent; border: 1px solid transparent; border-radius: 9px;
  font-size: 11px; text-align: left; transition: color .18s, background .18s;
}
.admin-nav button .icon { width: 16px; height: 16px; color: #89988c; }
.admin-nav button:hover { color: #eef3ea; background: rgba(255, 255, 255, .05); }
.admin-nav button.is-active { color: #162117; background: var(--a-lime); font-weight: 600; box-shadow: 0 6px 18px rgba(0, 0, 0, .13); }
.admin-nav button.is-active .icon { color: #162117; }
.admin-nav button small { margin-left: auto; color: #7e8d80; font-size: 8px; }
.admin-nav button.is-active small { color: rgba(17, 26, 21, .55); }
.admin-sidebar-bottom { margin-top: auto; padding-top: 26px; }
.admin-status-card { margin: 0 3px 12px; padding: 11px 12px; background: rgba(255, 255, 255, .035); border: 1px solid rgba(255, 255, 255, .06); border-radius: 10px; }
.admin-status-card > div { display: flex; align-items: center; justify-content: space-between; gap: 8px; color: #819084; font-size: 8px; }
.admin-status-card b { color: #d9e3d7; font-size: 9px; font-weight: 550; }
.admin-status-card p { margin: 4px 0 0; color: #66766a; font-size: 8px; }
.admin-account { display: flex; align-items: center; gap: 8px; padding: 8px 5px 2px; border-top: 1px solid rgba(255, 255, 255, .07); }
.admin-avatar { display: grid; place-items: center; width: 29px; height: 29px; flex: 0 0 auto; color: #2e3d2c; background: linear-gradient(135deg, #e2d2a2, #bcd18a); border-radius: 50%; font-size: 10px; font-weight: 650; }
.admin-account > div { flex: 1; display: flex; flex-direction: column; }
.admin-account b { color: #e6ece4; font-size: 10px; font-weight: 550; }
.admin-account small { color: #758478; font-size: 8px; }
.admin-account button { display: grid; place-items: center; width: 27px; height: 27px; color: #7d8c7f; background: transparent; border: 0; border-radius: 6px; }
.admin-account button:hover { color: #e1e8de; background: rgba(255, 255, 255, .06); }
.admin-account .icon { width: 14px; height: 14px; }

.admin-main { min-width: 0; flex: 1; margin-left: var(--a-sidebar); }
.admin-topbar {
  position: sticky; top: 0; z-index: 30;
  display: flex; align-items: center; justify-content: space-between; gap: 20px;
  min-height: 79px; padding: 15px 28px;
  background: rgba(241, 238, 230, .9); border-bottom: 1px solid rgba(211, 204, 188, .75);
  backdrop-filter: blur(16px); -webkit-backdrop-filter: blur(16px);
}
.admin-breadcrumb { display: flex; align-items: center; gap: 7px; margin: 0 0 5px; color: #92998f; font-size: 8px; letter-spacing: .13em; font-weight: 600; }
.admin-breadcrumb span { color: #b4b8ae; }
.admin-breadcrumb b { color: #4a554b; font-size: 9px; letter-spacing: .02em; }
.admin-topbar h1 { margin: 0; font-size: 22px; line-height: 1.1; letter-spacing: -.035em; font-weight: 550; }
.admin-topbar-actions { display: flex; align-items: center; gap: 8px; }
.save-state { display: inline-flex; align-items: center; gap: 5px; margin-right: 3px; color: #8d968b; font-size: 9px; white-space: nowrap; }
.save-state i { width: 4px; height: 4px; border-radius: 50%; background: #7ba56a; }
.save-state.is-dirty { color: #a37528; }
.save-state.is-dirty i { background: #c49338; }
.save-state.is-saving { color: #5d7862; }
.admin-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 11px; border: 1px solid transparent; border-radius: 8px;
  font-size: 10px; font-weight: 600; white-space: nowrap; transition: background .18s, border-color .18s, transform .18s;
}
.admin-btn:active { transform: translateY(1px); }
.admin-btn .icon { width: 14px; height: 14px; }
.admin-btn.primary { color: #f2f5ed; background: var(--a-dark); border-color: var(--a-dark); box-shadow: 0 4px 11px rgba(17, 26, 21, .12); }
.admin-btn.primary:hover { background: #26382b; }
.admin-btn.ghost { color: #58645a; background: var(--a-surface); border-color: var(--a-line); }
.admin-btn.ghost:hover { border-color: var(--a-line-strong); background: #ffffff; }
.admin-btn.is-disabled { opacity: .5; pointer-events: none; }

.admin-layout { display: grid; grid-template-columns: minmax(0, 1fr) 400px; gap: 18px; max-width: 1580px; margin: 0 auto; padding: 22px 28px 40px; align-items: start; }
.admin-editor { min-width: 0; display: flex; flex-direction: column; gap: 14px; }
.admin-preview { position: sticky; top: 101px; overflow: hidden; background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 16px; box-shadow: 0 10px 30px rgba(35, 39, 31, .05); }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 13px 14px; border-bottom: 1px solid var(--a-line); }
.preview-actions { display: flex; align-items: center; gap: 6px; }
.preview-switch { display: flex; gap: 2px; padding: 2px; background: #efebe1; border-radius: 6px; }
.preview-switch button { height: 22px; padding: 0 7px; color: #8b948a; background: transparent; border: 0; border-radius: 4px; font-size: 8px; white-space: nowrap; flex: 0 0 auto; }
.preview-switch button.is-active { color: #38483b; background: #ffffff; box-shadow: 0 1px 3px rgba(20, 32, 25, .08); font-weight: 600; }
.preview-head > div { display: flex; flex-direction: column; gap: 1px; }
.preview-live { display: flex; align-items: center; gap: 5px; color: #3e5845; font-size: 9px; font-weight: 650; }
.preview-live i { width: 4px; height: 4px; border-radius: 50%; background: #6fa061; box-shadow: 0 0 0 3px rgba(111, 160, 97, .1); }
.preview-head small { color: #9aa197; font-size: 8px; }
.preview-head button { display: grid; place-items: center; width: 27px; height: 27px; color: #869084; background: transparent; border: 1px solid transparent; border-radius: 6px; }
.preview-head button:hover { background: var(--a-surface-2); border-color: var(--a-line); }
.preview-head .icon { width: 13px; height: 13px; }
.preview-frame-wrap { height: min(72vh, 780px); min-height: 450px; padding: 9px; background: #e9e5db; }
.preview-frame-wrap iframe { width: 100%; height: 100%; display: block; background: var(--a-bg); border: 1px solid #d8d2c4; border-radius: 9px; }
.preview-frame-wrap iframe.is-desktop { transform-origin: top left; border-radius: 6px; }
.preview-note { margin: 0; padding: 10px 14px 12px; color: #9aa197; font-size: 8px; line-height: 1.5; }

/* ---------- Panels and forms ---------- */
.admin-panel { background: var(--a-surface); border: 1px solid var(--a-line); border-radius: var(--a-radius); box-shadow: 0 8px 25px rgba(35, 39, 31, .035); overflow: hidden; }
.panel-intro { padding: 20px 22px 17px; border-bottom: 1px solid #eee9de; background: linear-gradient(135deg, #ffffff, #f5f7fd); }
.panel-intro h2 { margin: 0; font-size: 16px; letter-spacing: -.025em; font-weight: 600; }
.panel-intro p { margin: 5px 0 0; color: var(--a-muted); font-size: 10px; line-height: 1.6; }
.admin-section { padding: 20px 22px; border-bottom: 1px solid #eee9de; }
.admin-section:last-child { border-bottom: 0; }
.section-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; margin-bottom: 14px; }
.section-head h3 { margin: 0; font-size: 12px; font-weight: 650; letter-spacing: -.01em; }
.section-head p { margin: 3px 0 0; color: #9aa197; font-size: 9px; line-height: 1.5; }
.section-head .admin-btn { flex: 0 0 auto; height: 29px; font-size: 9px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 14px; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field-grid.four { grid-template-columns: repeat(4, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field.full { grid-column: 1 / -1; }
.field label { display: flex; align-items: center; gap: 5px; color: #747e74; font-size: 9px; font-weight: 550; }
.field label span { color: #a8aea5; font-size: 8px; font-weight: 400; }
.control {
  width: 100%; min-height: 35px; padding: 7px 10px; color: var(--a-ink-soft);
  background: #f6f7fd; border: 1px solid var(--a-line); border-radius: 7px;
  outline: 0; font-size: 10px; line-height: 1.4; transition: background .16s, border-color .16s, box-shadow .16s;
}
.control:hover { border-color: #d7d1c3; }
.control:focus { background: #ffffff; border-color: #9caf91; box-shadow: 0 0 0 3px rgba(134, 158, 119, .08); }
textarea.control { min-height: 68px; resize: vertical; }
select.control { padding-right: 27px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%237d857c' stroke-width='1.6' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 8px center; appearance: none; }
.control[type="color"] { padding: 4px; height: 36px; cursor: pointer; }
.control::placeholder { color: #b0b5ac; }
.field-hint { margin: 0; color: #a0a79d; font-size: 8px; line-height: 1.45; }
.inline-note { display: flex; gap: 7px; align-items: flex-start; padding: 10px 12px; color: #758170; background: #f2f2e6; border: 1px solid #e7e7d8; border-radius: 8px; font-size: 9px; line-height: 1.5; }
.inline-note b { color: #596751; }
.inline-note .icon { width: 13px; height: 13px; margin-top: 1px; color: #7f9669; }
.form-actions { display: flex; gap: 8px; align-items: center; justify-content: flex-end; padding-top: 12px; }
.form-actions .admin-btn { height: 31px; }

/* ---------- KPI editor ---------- */
.kpi-editor-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.kpi-editor-card { padding: 14px; background: #f5f7fd; border: 1px solid #e9e4d8; border-radius: 11px; }
.kpi-editor-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.kpi-editor-head span { color: #59675a; font-size: 9px; font-weight: 650; }
.kpi-editor-head small { color: #a0a79d; font-size: 8px; }
.kpi-editor-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpi-editor-fields .field { gap: 4px; }
.kpi-editor-fields .control { min-height: 31px; padding: 5px 8px; font-size: 9px; background: #ffffff; }
.kpi-editor-fields .field.full { grid-column: 1 / -1; }
.kpi-preview-value { display: flex; align-items: baseline; gap: 2px; margin: 2px 0 10px; color: #2b392d; font-size: 25px; line-height: 1; letter-spacing: -.045em; }
.kpi-preview-value small { color: #869083; font-size: 10px; letter-spacing: 0; }
.kpi-preview-value em { margin-left: 3px; color: #8c958b; font-size: 9px; font-style: normal; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; border: 1px solid var(--a-line); border-radius: 9px; }
.editor-table { width: 100%; border-collapse: collapse; white-space: nowrap; }
.editor-table th { padding: 8px 10px; color: #969e94; background: #f3f5fc; border-bottom: 1px solid var(--a-line); font-size: 8px; font-weight: 600; text-align: left; }
.editor-table td { padding: 7px 10px; border-bottom: 1px solid #efebe2; color: #59637d; font-size: 9px; vertical-align: middle; }
.editor-table tbody tr:last-child td { border-bottom: 0; }
.editor-table tbody tr:hover { background: #faf8f2; }
.editor-table .muted { color: #a1a89e; }
.editor-table .num { font-variant-numeric: tabular-nums; }
.editor-table .right { text-align: right; }
.table-actions { display: flex; gap: 3px; align-items: center; justify-content: flex-end; }
.mini-btn { display: inline-flex; align-items: center; justify-content: center; gap: 4px; min-width: 26px; height: 25px; padding: 0 6px; color: #758077; background: transparent; border: 1px solid transparent; border-radius: 5px; font-size: 8px; }
.mini-btn:hover { color: var(--a-ink); background: var(--a-surface-2); border-color: var(--a-line); }
.mini-btn.danger:hover { color: #ab5e46; background: #f9ebe5; border-color: #eed8cd; }
.mini-btn .icon { width: 12px; height: 12px; }
.pill { display: inline-flex; align-items: center; gap: 3px; padding: 3px 6px; border-radius: 4px; font-size: 8px; font-weight: 550; white-space: nowrap; }
.pill.green { color: #2b7051; background: #e9eeff; }
.pill.amber { color: #8d6521; background: #f8efdc; }
.pill.red { color: #9a5842; background: #f9eae3; }
.pill.gray { color: #7a847a; background: #f1f3fa; }
.table-inline-input { width: 100%; min-width: 54px; padding: 4px 6px; background: #fbf9f3; border: 1px solid transparent; border-radius: 4px; outline: 0; font-size: 9px; color: #4f5b51; }
.table-inline-input:hover { border-color: var(--a-line); }
.table-inline-input:focus { background: #ffffff; border-color: #a0b394; }
.table-inline-input.num { width: 83px; text-align: right; }
.table-inline-input.short { width: 62px; }
.table-inline-select { min-width: 72px; padding: 4px 18px 4px 5px; background-color: #fbf9f3; border: 1px solid transparent; border-radius: 4px; outline: 0; font-size: 8px; color: #59637d; appearance: none; }
.table-inline-select:hover { border-color: var(--a-line); }
.empty-hint { padding: 24px 14px; color: #9ea59b; font-size: 9px; text-align: center; }

/* ---------- List cards / notifications ---------- */
.stack-list { display: flex; flex-direction: column; gap: 8px; }
.stack-item { display: grid; grid-template-columns: 24px 1fr 1fr 28px; gap: 8px; align-items: center; padding: 9px 10px; background: #f6f7fd; border: 1px solid #ebe6db; border-radius: 8px; }
.stack-item .index { color: #a3a99f; font-size: 8px; font-family: "SFMono-Regular", Consolas, monospace; }
.stack-item .control { min-height: 30px; padding: 5px 7px; font-size: 9px; background: #ffffff; }
.stack-item .stack-full { grid-column: 2 / -1; }
.stack-item .mini-btn { justify-self: end; }
.stack-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.stack-head b { font-size: 9px; color: #6d786d; font-weight: 550; }
.icon-row { display: flex; gap: 5px; align-items: center; flex-wrap: wrap; }

/* ---------- Logo / theme ---------- */
.logo-row { display: flex; align-items: center; gap: 13px; }
.logo-preview { display: grid; place-items: center; width: 54px; height: 54px; flex: 0 0 auto; color: var(--a-dark); background: var(--a-lime); border-radius: 13px; overflow: hidden; }
.logo-preview img { width: 100%; height: 100%; object-fit: cover; }
.logo-preview svg { width: 38px; height: 38px; fill: currentColor; }
.logo-fields { flex: 1; }
.logo-fields p { margin: 5px 0 0; color: #9aa197; font-size: 8px; }
.logo-actions { display: flex; gap: 7px; margin-top: 7px; }
.logo-actions .admin-btn { height: 27px; padding: 0 8px; font-size: 8px; }
.theme-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 9px; }
.theme-field { padding: 9px; background: #f5f7fd; border: 1px solid #ebe6db; border-radius: 8px; }
.theme-field label { display: block; color: #6f7993; font-size: 8px; margin-bottom: 5px; }
.theme-field .color-line { display: flex; align-items: center; gap: 5px; }
.theme-field input[type="color"] { width: 25px; height: 25px; padding: 2px; flex: 0 0 auto; border: 1px solid var(--a-line); border-radius: 5px; background: #ffffff; }
.theme-field input[type="text"] { min-width: 0; flex: 1; width: 100%; min-height: 25px; padding: 3px 5px; background: #ffffff; border: 1px solid var(--a-line); border-radius: 4px; outline: 0; font-size: 8px; font-family: "SFMono-Regular", Consolas, monospace; }
.switch-row { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 11px 12px; background: #f6f7fd; border: 1px solid #ebe6db; border-radius: 8px; }
.switch-row b { display: block; color: #5c685d; font-size: 9px; font-weight: 550; }
.switch-row small { display: block; margin-top: 2px; color: #9ba298; font-size: 8px; }
.switch { position: relative; display: inline-block; width: 34px; height: 19px; flex: 0 0 auto; }
.switch input { position: absolute; opacity: 0; pointer-events: none; }
.switch span { position: absolute; inset: 0; background: #d8d3c6; border-radius: 99px; transition: background .18s; }
.switch span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 15px; height: 15px; background: #ffffff; border-radius: 50%; box-shadow: 0 1px 3px rgba(20, 32, 25, .18); transition: transform .18s; }
.switch input:checked + span { background: #4c8063; }
.switch input:checked + span::after { transform: translateX(15px); }

/* ---------- Raw JSON ---------- */
.raw-toolbar { display: flex; align-items: center; gap: 7px; margin-bottom: 10px; }
.raw-toolbar .admin-btn { height: 29px; font-size: 9px; }
.raw-editor { width: 100%; min-height: 500px; padding: 15px 16px; color: #dce5d6; background: #171f19; border: 1px solid #2a362c; border-radius: 9px; outline: 0; font-family: "SFMono-Regular", "Cascadia Code", Consolas, monospace; font-size: 10px; line-height: 1.65; tab-size: 2; resize: vertical; }
.raw-editor:focus { border-color: #76905e; }
.raw-status { margin: 8px 0 0; color: #8e978c; font-size: 8px; }
.raw-status.is-error { color: #ae5d45; }
.danger-zone { border: 1px solid #efdbd3; background: #fdf6f2; }
.danger-zone .section-head h3 { color: #995c46; }
.danger-zone p { color: #a47768; }
.danger-zone .admin-btn.danger { color: #a1543d; background: #fffaf6; border-color: #e9d3ca; }
.danger-zone .admin-btn.danger:hover { background: #f8e7df; }

/* ---------- Modal ---------- */
.admin-modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 22px; background: rgba(17, 26, 21, .48); backdrop-filter: blur(4px); animation: fadeIn .2s both; }
.admin-modal { width: min(720px, 100%); max-height: calc(100vh - 44px); display: flex; flex-direction: column; background: var(--a-surface); border: 1px solid var(--a-line); border-radius: 17px; box-shadow: 0 30px 80px rgba(0, 0, 0, .22); animation: modalIn .26s cubic-bezier(.2, .75, .2, 1) both; }
.admin-modal-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 15px; padding: 18px 20px 14px; border-bottom: 1px solid var(--a-line); }
.modal-kicker { margin: 0 0 4px; color: #9ba298; font-size: 8px; letter-spacing: .16em; font-weight: 600; }
.admin-modal-head h2 { margin: 0; font-size: 18px; letter-spacing: -.035em; font-weight: 550; }
.admin-icon-btn { display: grid; place-items: center; width: 30px; height: 30px; color: #7e897f; background: var(--a-surface-2); border: 1px solid var(--a-line); border-radius: 7px; }
.admin-icon-btn:hover { color: var(--a-ink); background: #ffffff; }
.admin-icon-btn .icon { width: 15px; height: 15px; }
.admin-modal-body { padding: 18px 20px; overflow-y: auto; }
.admin-modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 13px 20px; border-top: 1px solid var(--a-line); background: #f6f7fd; border-radius: 0 0 17px 17px; }
.admin-modal-foot .admin-btn { height: 32px; }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalIn { from { opacity: 0; transform: translateY(9px) scale(.985); } to { opacity: 1; transform: none; } }
.modal-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 11px 13px; }
.modal-grid .field.full { grid-column: 1 / -1; }
.modal-subhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 20px 0 8px; }
.modal-subhead h3 { margin: 0; color: #59637d; font-size: 10px; font-weight: 650; }
.modal-subhead .mini-btn { border: 1px solid var(--a-line); background: #fbf9f3; }
.sub-rows { display: flex; flex-direction: column; gap: 7px; }
.sub-row { display: grid; grid-template-columns: repeat(5, 1fr) 27px; gap: 6px; padding: 8px; background: #f5f7fd; border: 1px solid #ebe6db; border-radius: 7px; }
.sub-row.voucher-row { grid-template-columns: 1fr 1fr 1fr 1fr 2fr 27px; }
.sub-row .control { min-height: 28px; padding: 4px 6px; font-size: 8.5px; background: #ffffff; }
.sub-row .mini-btn { align-self: center; }

/* ---------- Toast ---------- */
.admin-toast { position: fixed; right: 22px; bottom: 22px; z-index: 200; display: flex; align-items: center; gap: 8px; padding: 9px 13px 9px 9px; color: #eaf1e7; background: var(--a-dark); border: 1px solid rgba(255, 255, 255, .08); border-radius: 9px; box-shadow: 0 14px 34px rgba(17, 26, 21, .23); font-size: 10px; opacity: 0; transform: translateY(9px); pointer-events: none; transition: opacity .2s, transform .2s; }
.admin-toast.is-visible { opacity: 1; transform: none; }
.admin-toast > span { display: grid; place-items: center; width: 21px; height: 21px; color: var(--a-lime); background: rgba(213, 243, 111, .12); border-radius: 5px; }
.admin-toast .icon { width: 13px; height: 13px; }
.admin-toast b { font-weight: 500; }

/* ---------- Responsive ---------- */
@media (max-width: 1320px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr) 350px; gap: 14px; padding-left: 20px; padding-right: 20px; }
  .admin-topbar { padding-left: 20px; padding-right: 20px; }
}
@media (max-width: 1120px) {
  .admin-layout { grid-template-columns: minmax(0, 1fr); }
  .admin-preview { position: relative; top: auto; order: -1; }
  .preview-frame-wrap { height: 310px; min-height: 0; }
  .preview-note { display: none; }
}
@media (max-width: 820px) {
  .login-screen { grid-template-columns: 1fr; }
  .login-visual { display: none; }
  .login-panel { min-height: 100vh; padding: 22px; }
  .admin-app { display: block; }
  .admin-sidebar { position: relative; inset: auto; width: 100%; height: auto; max-height: none; overflow: visible; padding: 15px 14px 12px; }
  .admin-brand { padding: 0 3px 14px; }
  .admin-site-chip { display: none; }
  .admin-nav { flex-direction: row; overflow-x: auto; gap: 4px; padding-bottom: 3px; scrollbar-width: none; }
  .admin-nav::-webkit-scrollbar { display: none; }
  .admin-nav-label { display: none; }
  .admin-nav button { width: max-content; height: 34px; flex: 0 0 auto; padding: 0 10px; font-size: 10px; }
  .admin-nav button small { display: none; }
  .admin-sidebar-bottom { display: none; }
  .admin-main { margin-left: 0; }
  .admin-topbar { min-height: 69px; padding: 12px 14px; gap: 12px; }
  .admin-topbar h1 { font-size: 18px; }
  .save-state { display: none; }
  .admin-btn.ghost { display: none; }
  .admin-layout { padding: 14px; gap: 12px; }
  .admin-section, .panel-intro { padding-left: 14px; padding-right: 14px; }
  .field-grid, .field-grid.three, .field-grid.four, .kpi-editor-grid, .theme-grid { grid-template-columns: 1fr 1fr; }
  .kpi-editor-grid { grid-template-columns: 1fr; }
  .modal-grid { grid-template-columns: 1fr; }
  .modal-grid .field.full { grid-column: auto; }
  .sub-row, .sub-row.voucher-row { grid-template-columns: 1fr 1fr; }
  .sub-row .field.full { grid-column: 1 / -1; }
  .preview-frame-wrap { height: 280px; }
}
@media (max-width: 520px) {
  .login-panel { padding: 14px; }
  .login-card { padding: 26px 20px 22px; border-radius: 16px; }
  .admin-topbar-actions { gap: 5px; }
  .admin-btn.primary { padding: 0 9px; font-size: 9px; }
  .admin-btn.primary .icon { display: none; }
  .field-grid, .field-grid.three, .field-grid.four, .theme-grid { grid-template-columns: 1fr; }
  .stack-item { grid-template-columns: 20px 1fr 27px; }
  .stack-item .control:nth-child(3) { grid-column: 2 / 3; }
  .watch-preview { display: none; }
  .admin-preview { display: none; }
  .admin-toast { left: 12px; right: 12px; bottom: 12px; justify-content: center; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* nested procurement editors */
.voucher-edit { display: grid; grid-template-columns: 1fr 1fr 1fr 27px; gap: 6px; padding: 8px; background: #f5f7fd; border: 1px solid #ebe6db; border-radius: 7px; }
.voucher-edit .control { min-height: 28px; padding: 4px 6px; font-size: 8.5px; background: #ffffff; }
.voucher-edit .span-2 { grid-column: span 2; }
.voucher-edit .full { grid-column: 1 / -1; }
.voucher-edit .mini-btn { align-self: center; }
.milestone-edit { display: grid; grid-template-columns: 22px 1.7fr 1fr 1fr .9fr 1fr 27px; gap: 6px; align-items: center; padding: 8px; background: #f5f7fd; border: 1px solid #ebe6db; border-radius: 7px; }
.milestone-edit .control { min-height: 28px; padding: 4px 6px; font-size: 8.5px; background: #ffffff; }
.milestone-edit .mini-btn { justify-self: end; }
@media (max-width: 720px) {
  .voucher-edit { grid-template-columns: 1fr 1fr 27px; }
  .voucher-edit .full { grid-column: 1 / -1; }
  .milestone-edit { grid-template-columns: 20px 1fr 27px; }
  .milestone-edit .control:not(:first-of-type) { grid-column: 2 / -1; }
  .milestone-edit .mini-btn { grid-column: 3; grid-row: 1; }
}


/* logo based accents */
.login-mark, .admin-mark { background: #ffffff; overflow: hidden; padding: 0; }
.login-mark img, .admin-mark img { width: 100%; height: 100%; object-fit: cover; border-radius: inherit; }
.login-visual {
  background:
    radial-gradient(90% 80% at 88% 10%, rgba(76, 99, 255, .24), transparent 55%),
    radial-gradient(70% 55% at 0% 100%, rgba(123, 77, 255, .22), transparent 70%),
    var(--a-dark);
}
.login-mark { box-shadow: 0 10px 26px rgba(17, 32, 100, .3); }
.login-submit { background: linear-gradient(135deg, #2f55f0, #6d46f2); border-color: transparent; }
.login-submit:hover { background: linear-gradient(135deg, #2446d8, #5f37e8); }
.login-submit span { color: #ffcf66; }
.admin-nav button.is-active { background: linear-gradient(135deg, #2f55f0, #6d46f2); color: #ffffff; }
.admin-nav button.is-active .icon { color: #ffffff; }
.admin-nav button.is-active small { color: rgba(255, 255, 255, .7); }
.admin-nav button:hover { background: rgba(76, 99, 255, .1); }
.admin-sidebar {
  background:
    radial-gradient(100% 40% at 10% 0%, rgba(76, 99, 255, .2), transparent 60%),
    radial-gradient(90% 50% at 100% 90%, rgba(123, 77, 255, .16), transparent 65%),
    var(--a-dark);
}
.admin-brand small { color: #7c87a3; }
.admin-site-dot, .preview-live i { background: #ffb21a; box-shadow: 0 0 0 3px rgba(255, 178, 26, .12); }
.admin-btn.primary { background: linear-gradient(135deg, #2f55f0, #6d46f2); border-color: transparent; }
.admin-btn.primary:hover { background: linear-gradient(135deg, #2446d8, #5f37e8); }
.save-state i { background: #ffb21a; }
.save-state.is-dirty i { background: #b6760e; }
.section-head .admin-btn, .modal-subhead .mini-btn { color: var(--a-green); }
.voucher-edit, .sub-row, .milestone-edit { background: #f5f7fd; border-color: #e7ebf4; }
.raw-editor { background: #070d26; border-color: #202b52; }
