:root, html[data-theme="light"] {
  --bg-canvas: #f2f5f1;
  --bg-surface: #fff;
  --bg-subtle: #f5f7f4;
  --bg-glass: #fafffa;
  --border-hairline: #e1e8df;
  --border-strong: #cbd8cf;
  --text-primary: #15251f;
  --text-secondary: #4d6258;
  --text-tertiary: #626f68;
  --apple-blue: #166449;
  --apple-blue-hover: #0e533b;
  --apple-blue-active: #064532;
  --apple-blue-soft: #e9f4ed;
  --apple-blue-border: #badacd;
  --bg-dark-card: linear-gradient(135deg, #205b49, #163c32);
}

html[data-theme="dark"] {
  --bg-canvas: #111a17;
  --bg-surface: #192620;
  --bg-subtle: #1d2d25;
  --bg-glass: #18241f;
  --border-hairline: #304138;
  --border-strong: #44594d;
  --text-primary: #edf6ef;
  --text-secondary: #b9cbbf;
  --text-tertiary: #a0b5a7;
  --apple-blue: #9cddba;
  --apple-blue-hover: #b1edca;
  --apple-blue-active: #c9f6db;
  --apple-blue-soft: #223e31;
  --apple-blue-border: #456955;
  --bg-dark-card: linear-gradient(135deg, #235e4a, #17372e);
  color-scheme: dark;
}

:root {
  --ak-ink: #122a23;
  --ak-mint: #c7f69d;
  --ak-sidebar: 212px;
  --radius-bento: 14px;
  --font-sans: "Inter", system-ui, "Microsoft YaHei", sans-serif;
  --font-mono: "IBM Plex Mono", "Cascadia Mono", Consolas, monospace;
}

body { background: var(--bg-canvas); color: var(--text-primary); font-family: var(--font-sans); }
button, a, input, select, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--apple-blue); }
.btn { border-radius: 8px; min-height: 34px; }
.btn.sm { border-radius: 7px; min-height: 29px; }
.btn.primary { color: #fff; }
html[data-theme="dark"] .btn.primary { color: #10251b; }

.ak-brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  color: inherit;
  text-decoration: none;
  font-size: 24px;
  font-weight: 750;
  letter-spacing: -.05em;
  width: fit-content;
}
.ak-mark {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--ak-ink);
  color: var(--ak-mint);
  font: 700 15px var(--font-mono);
  letter-spacing: -.12em;
}
.ak-brand-accent { color: #55936c; }

#authSection.auth-wrap {
  width: min(1110px, calc(100% - 64px));
  max-width: none;
  min-height: min(720px, calc(100svh - 96px));
  margin: max(34px, 5.4vh) auto;
  padding: 0;
  display: grid;
  grid-template-columns: minmax(0, .95fr) minmax(0, 1.05fr);
  gap: 0;
  overflow: hidden;
  background: var(--bg-surface);
  border: 1px solid var(--border-hairline);
  border-radius: 22px;
  box-shadow: 0 20px 70px rgba(24, 48, 36, .09);
}
.ak-auth { padding: 30px 38px 24px; display: flex; flex-direction: column; gap: 34px; }
.ak-auth-content { width: min(350px, 100%); margin: auto; }
.ak-auth-heading h1 { margin: 0 0 8px; font-size: clamp(28px, 3vw, 37px); line-height: 1.16; letter-spacing: -.045em; }
.ak-auth-heading p, .ak-field-note { color: var(--text-secondary); font-size: 13px; line-height: 1.6; }
.ak-auth-heading p { margin: 0 0 27px; }
.ak-auth .segmented { margin-bottom: 22px; padding: 4px; border-radius: 10px; background: var(--bg-subtle); }
.ak-auth .seg-btn { border-radius: 7px; min-height: 32px; font-weight: 600; }
.ak-auth .seg-btn.active { color: #fff; background: #166449; }
.ak-auth .field { margin-bottom: 15px; }
.ak-auth .field label { display: block; margin-bottom: 6px; font-weight: 650; }
.ak-auth .field input { min-height: 44px; border-radius: 8px; font-size: 14px; }
.ak-auth .cf-box { margin: 10px 0 14px; padding: 0; border: 0; background: transparent; min-height: 56px; }
.ak-auth #turnstileWidget { width: 100%; }
.ak-verify { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 55px; padding: 0 13px; border: 1px solid var(--border-strong); border-radius: 8px; background: var(--bg-subtle); color: var(--text-primary); font: inherit; font-weight: 600; cursor: pointer; }
.ak-verify:hover { border-color: var(--apple-blue); }
.ak-verify #cfRealStatusIcon { display: grid; place-items: center; width: 25px; height: 25px; }
.ak-verify-box { width: 19px; height: 19px; border: 1px solid var(--apple-blue); border-radius: 4px; background: var(--bg-surface); }
.ak-auth #submitBtn { display: flex; justify-content: center; width: 100%; min-height: 44px; font-size: 14px; }
.ak-auth #authErr { margin: 8px 0 0; min-height: 1.4em; color: var(--apple-red); font-size: 12px; }
.ak-auth-footer { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.ak-auth-footer a, .ak-auth-footer button { border: 0; padding: 3px 0; background: transparent; color: var(--text-tertiary); font: inherit; font-size: 12px; text-decoration: none; cursor: pointer; }
.ak-auth-footer a:hover, .ak-auth-footer button:hover { color: var(--apple-blue); text-decoration: underline; }

.ak-auth-cover {
  min-width: 0;
  padding: 40px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 30px;
  overflow: hidden;
  background:
    repeating-linear-gradient(0deg, transparent, transparent 31px, rgba(177, 239, 204, .055) 32px),
    repeating-linear-gradient(90deg, transparent, transparent 31px, rgba(177, 239, 204, .055) 32px),
    radial-gradient(ellipse at 80% 20%, #2d6955, transparent 68%),
    var(--ak-ink);
  color: #f2fbf2;
}
.ak-cover-title { display: flex; align-items: center; gap: 10px; font: 650 12px var(--font-mono); letter-spacing: .095em; color: var(--ak-mint); }
.ak-cover-line { display: block; width: 19px; height: 2px; background: var(--ak-mint); }
.ak-terminal {
  align-self: center;
  width: min(340px, 98%);
  aspect-ratio: 1.7;
  background: #15352b;
  border: 1px solid #477e67;
  border-radius: 14px;
  box-shadow: 0 26px 65px #0b271d;
  transform: rotate(-6deg);
}
.ak-terminal-top { display: flex; align-items: center; gap: 6px; height: 35px; padding: 0 13px; border-bottom: 1px solid #35614e; }
.ak-terminal-top i { width: 6px; height: 6px; border-radius: 50%; background: #669985; }
.ak-terminal-code { display: flex; align-items: center; gap: 8px; margin: 34px 24px 0; color: var(--ak-mint); font: 700 28px var(--font-mono); }
.ak-terminal-code span { width: 28%; height: 9px; border-radius: 3px; background: currentColor; opacity: .76; }
.ak-terminal-code span + span { width: 41%; opacity: .29; }
.ak-terminal-code.secondary { padding-left: 25px; margin-top: 17px; opacity: .5; }
.ak-terminal-code.secondary span { height: 5px; }
.ak-cover-caption p { font-size: clamp(20px, 3vw, 32px); font-weight: 700; margin: 0 0 6px; letter-spacing: -.04em; }
.ak-cover-caption > span { color: #bdd8c8; font-size: 13px; }
.ak-cover-divider { margin: 0 9px; color: #80af97; }

#dashboardSection { padding-inline-start: var(--ak-sidebar); }
#dashboardSection .top-nav { z-index: 60; border-bottom: 1px solid var(--border-hairline); }
#dashboardSection .top-nav-inner { max-width: 1600px; width: 100%; height: auto; padding: 13px 26px; justify-content: flex-end; }
#dashboardSection .nav-right { flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
#dashboardSection .nav-left {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--ak-sidebar);
  height: 100dvh;
  align-items: stretch;
  flex-direction: column;
  gap: 36px;
  padding: 24px 14px;
  background: var(--ak-ink);
  color: #eef8f0;
  overflow-y: auto;
}
.nav-left .ak-brand { margin-left: 8px; }
.nav-left .ak-mark { color: var(--ak-ink); background: var(--ak-mint); }
.nav-left .ak-brand-accent { color: var(--ak-mint); }
#dashboardSection .nav-tabs { display: flex; flex-direction: column; align-items: stretch; gap: 4px; height: auto; overflow: visible; }
#dashboardSection .nav-tab { justify-content: flex-start; width: 100%; min-height: 42px; height: auto; padding: 0 12px; gap: 9px; border: 0; border-radius: 8px; color: #cee1d5 !important; font-size: 13px; }
#dashboardSection .nav-tab:hover { background: #224238; color: #fff !important; }
#dashboardSection .nav-tab.active { color: var(--ak-mint) !important; background: #284a3c; }
#dashboardSection .nav-tab.active::after { display: none; }
#dashboardSection .nav-badge { margin-left: auto; color: #e2f5e9; background: #34594b; }
.ak-nav-icon { display: inline-block; width: 18px; text-align: center; font-size: 16px; line-height: 1; }
#dashboardSection .main-container { max-width: 1600px; width: 100%; padding: 25px 26px 38px; }
#dashboardSection .hero-header { margin-bottom: 20px; padding: 3px 0 13px; align-items: end; }
#dashboardSection .hero-header h1 { margin: 0; font-size: clamp(23px, 3.1vw, 34px); letter-spacing: -.04em; }
#dashboardSection .status-line { color: var(--text-secondary); font-size: 12px; }
#dashboardSection .panel, #dashboardSection .bento-stat { box-shadow: 0 1px 2px #10251b08; border-radius: 13px; }
#dashboardSection .panel-head { padding: 12px 16px; }
#dashboardSection .bento-stat { border-top: 1px solid var(--border-hairline); }
#dashboardSection .bento-stat .k { font-weight: 650; letter-spacing: 0; }
#dashboardSection .panel-head h2 { letter-spacing: 0; }
#dashboardSection .bento-stat .v { font-variant-numeric: tabular-nums; letter-spacing: -.035em; }
#dashboardSection .nav-right .dropdown-menu { z-index: 61; }
.ak-quick-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; padding: 13px 16px; background: var(--apple-blue-soft); border: 1px solid var(--apple-blue-border); border-radius: 12px; }
.ak-quick-actions h2 { margin: 0; font-size: 14px; }
.ak-quick-actions p { margin: 4px 0 0; color: var(--text-secondary); font-size: 12px; }
.ak-quick-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
#tab-setup .panel-body > div:first-child { grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr)) !important; }

@media (max-width: 1050px) {
  :root { --ak-sidebar: 174px; }
  #dashboardSection .top-nav-inner, #dashboardSection .main-container { padding-inline: 16px; }
  #dashboardSection .hero-header { align-items: flex-start; }
}
@media (max-width: 780px) {
  #dashboardSection { padding-inline-start: 0; }
  #dashboardSection .top-nav { position: relative; }
  #dashboardSection .top-nav-inner { flex-direction: column; align-items: stretch; gap: 8px; padding: 0 0 9px; }
  #dashboardSection .nav-left { position: static; width: 100%; height: auto; padding: 12px 14px; gap: 10px; }
  #dashboardSection .nav-tabs { flex-direction: row; flex-wrap: wrap; gap: 4px; }
  #dashboardSection .nav-tab { width: auto; min-height: 36px; padding: 0 9px; }
  #dashboardSection .nav-right { padding-inline: 12px; justify-content: flex-start; }
  #dashboardSection .main-container { padding-top: 18px; }
  #authSection.auth-wrap { width: min(480px, calc(100% - 32px)); grid-template-columns: minmax(0, 1fr); min-height: min(630px, calc(100svh - 50px)); margin: 24px auto; }
  .ak-auth { padding: 24px; gap: 30px; }
  .ak-auth-cover { display: none; }
}
@media (max-height: 610px) and (max-width: 780px) {
  .ak-auth { gap: 22px; }
  .ak-auth-heading p, .ak-auth .segmented { margin-bottom: 15px; }
  .ak-auth .field { margin-bottom: 10px; }
}
