:root {
  --font: Inter, "SF Pro Display", "Segoe UI Variable", "Microsoft YaHei UI", "PingFang SC", sans-serif;
  --bg: #f4f8f7;
  --bg-soft: #eef6f3;
  --surface: rgba(255, 255, 255, .92);
  --surface-solid: #ffffff;
  --surface-2: #f7faf9;
  --ink: #132723;
  --ink-2: #4e625e;
  --ink-3: #82928e;
  --line: #dfe9e6;
  --line-soft: #ebf1ef;
  --accent: #168a70;
  --accent-deep: #0e6f5b;
  --accent-soft: #e0f4ee;
  --accent-pale: #f0faf7;
  --accent-rgb: 22, 138, 112;
  --secondary: #6a9e8f;
  --warning: #d98b32;
  --warning-soft: #fff2dd;
  --danger: #c95159;
  --danger-soft: #fdecef;
  --info: #477fba;
  --shadow: 0 18px 50px rgba(33, 70, 62, .09), 0 2px 10px rgba(24, 52, 46, .04);
  --shadow-soft: 0 8px 24px rgba(33, 70, 62, .07);
  --radius-lg: 24px;
  --radius-md: 16px;
  --radius-sm: 11px;
}

html[data-theme="sky"] {
  --bg: #f3f7fb; --bg-soft: #edf4fb; --ink: #15283a; --ink-2: #526779; --ink-3: #8595a4;
  --line: #dce7f0; --line-soft: #eaf0f5; --accent: #2e7eb7; --accent-deep: #216794;
  --accent-soft: #e0eff9; --accent-pale: #f0f7fc; --accent-rgb: 46, 126, 183; --secondary: #6497bc;
}

html[data-theme="sunset"] {
  --bg: #fbf6f3; --bg-soft: #f8eee9; --ink: #37241f; --ink-2: #705c55; --ink-3: #a08e88;
  --line: #ecdfda; --line-soft: #f3eae6; --accent: #bf6857; --accent-deep: #9f4e40;
  --accent-soft: #f9e4de; --accent-pale: #fdf3f0; --accent-rgb: 191, 104, 87; --secondary: #c78979;
}

html[data-mode="dark"] {
  color-scheme: dark;
  --bg: #17191d; --bg-soft: #1d2025; --surface: rgba(30, 32, 37, .95); --surface-solid: #1e2025;
  --surface-2: #23262c; --ink: #f1f2f4; --ink-2: #b7bac1; --ink-3: #7f838d;
  --line: #34373e; --line-soft: #2a2d33; --accent-soft: rgba(var(--accent-rgb), .18);
  --accent-pale: rgba(var(--accent-rgb), .1); --warning-soft: rgba(217, 139, 50, .15);
  --danger-soft: rgba(201, 81, 89, .15); --shadow: 0 20px 55px rgba(0, 0, 0, .28);
  --shadow-soft: 0 8px 24px rgba(0, 0, 0, .2);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; color: var(--ink); background: var(--bg); font-family: var(--font); font-size: 14px; line-height: 1.55; transition: color .28s ease, background .28s ease; }
body.layer-open { overflow: hidden; }
button, input, textarea, select { color: inherit; font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
::selection { color: white; background: var(--accent); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { border: 3px solid transparent; border-radius: 9px; background: color-mix(in srgb, var(--ink-3) 48%, transparent); background-clip: padding-box; }

.ambient { position: fixed; z-index: -1; width: 420px; height: 420px; border-radius: 50%; filter: blur(3px); opacity: .36; pointer-events: none; }
.ambient-one { top: -210px; right: 8%; background: radial-gradient(circle, rgba(var(--accent-rgb), .22), transparent 68%); }
.ambient-two { bottom: -270px; left: 20%; background: radial-gradient(circle, rgba(var(--accent-rgb), .12), transparent 70%); }

.app-shell { display: grid; grid-template-columns: 254px minmax(0, 1fr); min-height: 100vh; }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 28px 20px 22px; border-right: 1px solid var(--line); background: color-mix(in srgb, var(--surface-solid) 90%, transparent); backdrop-filter: blur(18px); z-index: 20; }
.brand { display: flex; align-items: center; gap: 12px; color: var(--ink); text-decoration: none; }
.brand strong { display: block; font-size: 17px; letter-spacing: .02em; }
.brand small { display: block; margin-top: -1px; color: var(--ink-3); font-size: 11px; letter-spacing: .08em; }
.brand-mark { position: relative; width: 40px; height: 40px; flex: 0 0 auto; overflow: hidden; border-radius: 13px; background: linear-gradient(145deg, color-mix(in srgb, var(--accent) 76%, white), var(--accent-deep)); box-shadow: 0 8px 18px rgba(var(--accent-rgb), .26); }
.brand-mark i { position: absolute; display: block; width: 18px; height: 18px; border: 2px solid rgba(255,255,255,.88); border-radius: 50%; }
.brand-mark i:nth-child(1) { top: 8px; left: 6px; }
.brand-mark i:nth-child(2) { top: 14px; left: 16px; opacity: .7; }
.brand-mark i:nth-child(3) { width: 4px; height: 4px; top: 11px; left: 12px; border: 0; background: #fff; box-shadow: 10px 6px 0 rgba(255,255,255,.8); }
.side-nav { display: grid; gap: 5px; margin-top: 44px; }
.nav-item { display: flex; align-items: center; gap: 13px; width: 100%; padding: 12px 14px; border: 0; border-radius: 12px; color: var(--ink-2); background: transparent; text-align: left; transition: .2s ease; }
.nav-item:hover { color: var(--ink); background: var(--surface-2); transform: translateX(2px); }
.nav-item.active { color: var(--accent-deep); background: var(--accent-soft); font-weight: 700; }
.nav-icon { position: relative; width: 18px; height: 18px; flex: 0 0 auto; color: currentColor; }
.grid-icon { border: 1.7px solid currentColor; border-radius: 5px; }
.grid-icon::before, .grid-icon::after { content: ""; position: absolute; background: currentColor; opacity: .75; }
.grid-icon::before { width: 1px; height: 12px; top: 2px; left: 7px; }
.grid-icon::after { width: 12px; height: 1px; top: 7px; left: 2px; }
.mail-icon { border: 1.7px solid currentColor; border-radius: 4px; }
.mail-icon::after { content: ""; position: absolute; width: 9px; height: 9px; left: 3px; top: -1px; border: solid currentColor; border-width: 0 1.5px 1.5px 0; transform: rotate(45deg); }
.import-icon::before { content: ""; position: absolute; width: 12px; height: 6px; left: 2px; bottom: 1px; border: 1.7px solid currentColor; border-top: 0; border-radius: 0 0 4px 4px; }
.import-icon::after { content: "↓"; position: absolute; left: 4px; top: -8px; font-size: 19px; font-weight: 600; }
.pulse-icon::before { content: ""; position: absolute; inset: 1px; border: 1.7px solid currentColor; border-radius: 50%; }
.pulse-icon::after { content: ""; position: absolute; width: 8px; height: 5px; left: 5px; top: 6px; border-left: 1.7px solid currentColor; border-bottom: 1.7px solid currentColor; transform: skew(-24deg); }
.gear-icon { border: 1.7px dotted currentColor; border-radius: 50%; }
.gear-icon::after { content: ""; position: absolute; inset: 5px; border: 1.7px solid currentColor; border-radius: 50%; }
.sidebar-spacer { flex: 1; }
.expiry-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid color-mix(in srgb, var(--accent) 22%, var(--line)); border-radius: 16px; background: linear-gradient(145deg, var(--accent-pale), color-mix(in srgb, var(--surface-solid) 90%, var(--accent-soft))); }
.expiry-ring { display: grid; place-content: center; width: 52px; height: 52px; flex: 0 0 auto; border: 4px solid var(--accent-soft); border-top-color: var(--accent); border-radius: 50%; color: var(--accent-deep); line-height: 1; transform: rotate(-20deg); }
.expiry-ring > * { transform: rotate(20deg); }
.expiry-ring span { font-weight: 800; font-size: 16px; }
.expiry-ring small { margin-top: 2px; text-align: center; font-size: 9px; }
.expiry-card b { font-size: 12px; }
.expiry-card p { margin: 3px 0 0; color: var(--ink-3); font-size: 10px; line-height: 1.4; }
.secure-state { display: flex; align-items: center; gap: 10px; margin: 18px 8px 0; }
.secure-state b { display: block; color: var(--ink-2); font-size: 11px; }
.secure-state small { display: block; color: var(--ink-3); font-size: 9px; }
.logout-button { display: flex; align-items: center; gap: 9px; margin: 13px 4px 0; padding: 9px 8px; border: 0; border-radius: 9px; color: var(--ink-3); background: transparent; font-size: 10px; text-align: left; }
.logout-button:hover { color: var(--danger); background: var(--danger-soft); }
.logout-button span { font-size: 14px; transform: rotate(180deg); }
.status-dot, .pulse-dot { display: inline-block; width: 8px; height: 8px; flex: 0 0 auto; border-radius: 50%; background: #34b387; box-shadow: 0 0 0 5px rgba(52,179,135,.12); }

.main-content { min-width: 0; padding: 25px 34px 42px; }
.topbar { display: flex; align-items: center; min-height: 58px; margin-bottom: 25px; }
.page-heading { margin-right: auto; }
.page-heading p, .kicker { margin: 0 0 3px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.page-heading h1 { margin: 0; font-size: 24px; line-height: 1.2; letter-spacing: -.025em; }
.top-actions { display: flex; align-items: center; gap: 9px; }
.icon-button { display: grid; place-items: center; width: 40px; height: 40px; padding: 0; border: 1px solid var(--line); border-radius: 12px; color: var(--ink-2); background: var(--surface); box-shadow: 0 2px 8px rgba(30,55,49,.03); transition: .2s ease; }
.icon-button:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 30%, var(--line)); transform: translateY(-1px); box-shadow: var(--shadow-soft); }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 7px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 11px; font-weight: 700; font-size: 13px; white-space: nowrap; transition: .2s ease; }
.button:disabled { cursor: not-allowed; opacity: .45; transform: none !important; }
.button-primary { color: #fff; border-color: var(--accent); background: linear-gradient(135deg, color-mix(in srgb, var(--accent) 88%, white), var(--accent-deep)); box-shadow: 0 8px 18px rgba(var(--accent-rgb), .2); }
.button-primary:hover { transform: translateY(-1px); box-shadow: 0 10px 22px rgba(var(--accent-rgb), .3); }
.button-soft { color: var(--accent-deep); border-color: color-mix(in srgb, var(--accent) 20%, var(--line)); background: var(--accent-pale); }
.button-soft:hover { border-color: var(--accent); background: var(--accent-soft); }
.button-quiet { color: var(--ink-2); border-color: var(--line); background: var(--surface-solid); }
.button-quiet:hover { color: var(--ink); background: var(--surface-2); }
.button-wide { width: 100%; }
.danger-text { color: var(--danger); }
.text-button { padding: 5px 0; border: 0; color: var(--accent); background: transparent; font-weight: 700; font-size: 12px; }
.plus { font-size: 18px; font-weight: 400; line-height: 1; }
.theme-wrap { position: relative; }
.theme-popover { position: absolute; top: 48px; right: 0; z-index: 40; width: 178px; padding: 14px; border: 1px solid var(--line); border-radius: 15px; background: var(--surface-solid); box-shadow: var(--shadow); animation: pop .18s ease-out; }
.theme-popover p { margin: 0 0 10px; color: var(--ink-2); font-size: 11px; font-weight: 700; }
.theme-swatches { display: flex; gap: 8px; }
.theme-swatches button { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 9px; background: transparent; }
.theme-swatches button.active { border-color: var(--ink); box-shadow: inset 0 0 0 2px var(--surface-solid); }
.theme-swatches i { width: 18px; height: 18px; border-radius: 6px; background: #168a70; }
.theme-swatches button:nth-child(2) i { background: #2e7eb7; }
.theme-swatches button:nth-child(3) i { background: #bf6857; }
.palette-icon { position: relative; width: 18px; height: 16px; border: 1.7px solid currentColor; border-radius: 50% 50% 45% 45%; transform: rotate(-12deg); }
.palette-icon::before { content: ""; position: absolute; width: 3px; height: 3px; top: 3px; left: 3px; border-radius: 50%; background: currentColor; box-shadow: 5px -1px 0 currentColor, 8px 3px 0 currentColor; }
.mode-toggle { color: #b36d19; background: color-mix(in srgb, #fff8e8 68%, var(--surface)); }
.mode-icon { position: relative; display: block; width: 18px; height: 18px; transition: transform .25s ease, opacity .2s ease; }
.sun-glyph { width: 12px; height: 12px; border: 2px solid currentColor; border-radius: 50%; box-shadow: 0 -8px 0 -5px currentColor, 0 8px 0 -5px currentColor, 8px 0 0 -5px currentColor, -8px 0 0 -5px currentColor, 6px 6px 0 -5px currentColor, -6px -6px 0 -5px currentColor, 6px -6px 0 -5px currentColor, -6px 6px 0 -5px currentColor; }
.moon-glyph { display: none; border: 2px solid #c9d1e5; border-top-color: transparent; border-radius: 50%; transform: rotate(22deg); }
.moon-glyph::after { content: ""; position: absolute; width: 3px; height: 3px; right: -3px; top: 1px; border-radius: 50%; background: #c9d1e5; box-shadow: -2px 13px 0 -1px #c9d1e5; }
html[data-mode="dark"] .mode-toggle { color: #c9d1e5; border-color: #3c4049; background: #24272d; }
html[data-mode="dark"] .sun-glyph { display: none; }
html[data-mode="dark"] .moon-glyph { display: block; }
.mobile-menu { display: none; margin-right: 10px; }

.notice-banner { position: relative; display: flex; align-items: center; gap: 14px; overflow: hidden; padding: 16px 19px; border: 1px solid color-mix(in srgb, var(--accent) 20%, var(--line)); border-radius: 16px; background: linear-gradient(100deg, var(--accent-pale), color-mix(in srgb, var(--surface-solid) 94%, var(--accent-soft))); }
.notice-banner::after { content: ""; position: absolute; width: 220px; height: 220px; right: 6%; border: 24px solid rgba(var(--accent-rgb), .035); border-radius: 50%; pointer-events: none; }
.notice-banner > * { position: relative; z-index: 1; }
.notice-banner > div { margin-right: auto; }
.notice-banner b { font-size: 13px; }
.notice-banner p { margin: 2px 0 0; color: var(--ink-2); font-size: 12px; }
.notice-icon { position: relative; width: 34px; height: 34px; flex: 0 0 auto; border-radius: 11px; background: var(--accent-soft); }
.notice-icon::before { content: ""; position: absolute; width: 11px; height: 12px; top: 9px; left: 11px; border: 1.7px solid var(--accent); border-radius: 6px 6px 3px 3px; }
.notice-icon::after { content: ""; position: absolute; width: 4px; height: 4px; top: 7px; left: 15px; border-radius: 50%; background: var(--accent); box-shadow: 0 16px 0 -1px var(--accent); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; margin-top: 16px; }
.metric-card { position: relative; min-height: 164px; overflow: hidden; padding: 19px; border: 1px solid var(--line); border-radius: var(--radius-md); background: var(--surface); box-shadow: 0 6px 24px rgba(37,74,65,.045); transition: transform .22s ease, box-shadow .22s ease, border-color .22s ease; }
.metric-card:hover { z-index: 2; border-color: color-mix(in srgb, var(--accent) 24%, var(--line)); transform: translateY(-3px); box-shadow: var(--shadow-soft); }
.metric-top { display: flex; align-items: center; justify-content: space-between; min-height: 31px; }
.metric-icon { position: relative; display: inline-block; width: 31px; height: 31px; border-radius: 10px; color: var(--accent); background: var(--accent-soft); }
.metric-caption, .metric-trend { color: var(--ink-3); font-size: 10px; }
.metric-trend { padding: 3px 7px; border-radius: 7px; color: var(--accent-deep); background: var(--accent-soft); font-weight: 700; }
.metric-card > strong { display: block; margin-top: 16px; font-size: clamp(25px, 2.1vw, 34px); line-height: 1; letter-spacing: -.05em; }
.metric-card > p { margin: 7px 0 0; color: var(--ink-2); font-size: 12px; }
.metric-card > small { display: block; margin-top: 7px; color: var(--ink-3); font-size: 10px; }
.warning-metric .metric-icon { color: var(--warning); background: var(--warning-soft); }
.danger-metric .metric-icon { color: var(--danger); background: var(--danger-soft); }
.database-icon::before { content: ""; position: absolute; width: 13px; height: 6px; top: 8px; left: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.database-icon::after { content: ""; position: absolute; width: 13px; height: 10px; top: 11px; left: 8px; border: solid currentColor; border-width: 0 1.5px 1.5px; border-radius: 0 0 50% 50%; box-shadow: 0 3px 0 -1.5px currentColor; }
.check-icon::before { content: ""; position: absolute; width: 14px; height: 14px; top: 8px; left: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.check-icon::after { content: ""; position: absolute; width: 6px; height: 3px; top: 13px; left: 12px; border: solid currentColor; border-width: 0 0 1.7px 1.7px; transform: rotate(-45deg); }
.timer-icon::before { content: ""; position: absolute; inset: 8px; border: 1.5px solid currentColor; border-radius: 50%; }
.timer-icon::after { content: ""; position: absolute; width: 5px; height: 6px; left: 15px; top: 10px; border-left: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; }
.alert-icon::before { content: "!"; position: absolute; inset: 6px; display: grid; place-items: center; border: 1.5px solid currentColor; border-radius: 50%; font-weight: 800; font-size: 11px; }
.meter { display: block; width: 100%; height: 3px; margin-top: 12px; overflow: hidden; border: 0; border-radius: 4px; background: var(--line-soft); appearance: none; }
.meter::-webkit-progress-bar { border-radius: inherit; background: var(--line-soft); }
.meter::-webkit-progress-value { border-radius: inherit; background: var(--accent); transition: width .8s ease; }
.meter::-moz-progress-bar { border-radius: inherit; background: var(--accent); }
.bars { position: absolute; right: 13px; bottom: 14px; display: flex; align-items: flex-end; gap: 3px; height: 34px; opacity: .35; }
.bars i { display: block; width: 4px; border-radius: 3px; background: var(--accent); animation: rise .65s ease-out both; }
.bars i:nth-child(1) { height: 20%; }.bars i:nth-child(2) { height: 42%; }.bars i:nth-child(3) { height: 32%; }.bars i:nth-child(4) { height: 65%; }.bars i:nth-child(5) { height: 48%; }.bars i:nth-child(6) { height: 78%; }.bars i:nth-child(7) { height: 90%; }

.workspace-grid { display: grid; grid-template-columns: minmax(650px, 1fr) 310px; gap: 16px; margin-top: 16px; align-items: start; }
.account-panel, .activity-panel { border: 1px solid var(--line); border-radius: var(--radius-lg); background: var(--surface); box-shadow: 0 8px 30px rgba(33,70,62,.045); }
.account-panel { min-width: 0; overflow: hidden; }
.activity-panel { position: sticky; top: 18px; padding: 20px; }
.panel-heading { display: flex; align-items: center; gap: 16px; padding: 21px 22px 16px; }
.panel-heading > div:first-child { margin-right: auto; }
.panel-heading h2 { margin: 0; font-size: 17px; letter-spacing: -.015em; }
.panel-actions { display: flex; gap: 7px; }
.panel-actions .button { min-height: 34px; padding: 0 11px; font-size: 11px; }
.compact-heading { padding: 0 0 16px; }
.filter-bar { display: flex; align-items: center; gap: 9px; padding: 0 22px 16px; }
.search-box { position: relative; display: flex; flex: 1; min-width: 180px; height: 38px; border: 1px solid var(--line); border-radius: 11px; background: var(--surface-2); transition: .2s; }
.search-box:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .09); }
.search-box span { position: relative; width: 36px; flex: 0 0 auto; }
.search-box span::before { content: ""; position: absolute; width: 9px; height: 9px; top: 11px; left: 13px; border: 1.5px solid var(--ink-3); border-radius: 50%; }
.search-box span::after { content: ""; position: absolute; width: 6px; height: 1.5px; top: 22px; left: 22px; background: var(--ink-3); transform: rotate(45deg); }
.search-box input { width: 100%; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 12px; }
.search-box button { padding: 0 12px; border: 0; color: var(--accent); background: transparent; font-size: 11px; font-weight: 700; }
.select-wrap { position: relative; }
.select-wrap::after { content: "⌄"; position: absolute; right: 10px; top: 7px; color: var(--ink-3); pointer-events: none; }
.select-wrap select, .form-grid select { height: 38px; min-width: 116px; padding: 0 30px 0 12px; appearance: none; border: 1px solid var(--line); border-radius: 11px; outline: 0; background: var(--surface-2); font-size: 11px; }
.select-wrap.compact select { min-width: 67px; }
.bulk-line { display: flex; align-items: center; justify-content: space-between; padding: 8px 22px; color: var(--accent-deep); background: var(--accent-pale); font-size: 11px; }
.bulk-line button { border: 0; color: var(--accent); background: transparent; font-size: 10px; }
.table-wrap { width: 100%; overflow-x: auto; border-top: 1px solid var(--line-soft); }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 11px 12px; color: var(--ink-3); background: color-mix(in srgb, var(--surface-2) 74%, transparent); text-align: left; font-size: 9px; font-weight: 800; letter-spacing: .08em; }
td { padding: 13px 12px; border-top: 1px solid var(--line-soft); color: var(--ink-2); font-size: 11px; }
tbody tr { transition: background .18s; }
tbody tr:hover { background: var(--accent-pale); }
th:first-child, td:first-child { padding-left: 22px; }
th:last-child, td:last-child { padding-right: 22px; }
.check-cell { width: 42px; }
input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--accent); }
.email-cell { display: flex; align-items: center; gap: 9px; color: var(--ink); font-weight: 650; }
.email-avatar { display: grid; place-items: center; width: 29px; height: 29px; border-radius: 9px; color: var(--accent-deep); background: var(--accent-soft); font-size: 10px; font-weight: 800; text-transform: uppercase; }
.email-cell small { display: block; margin-top: -2px; color: var(--ink-3); font-size: 9px; font-weight: 400; }
.status-badge { display: inline-flex; align-items: center; gap: 6px; padding: 4px 8px; border-radius: 8px; color: var(--ink-2); background: var(--surface-2); font-size: 9px; font-weight: 750; }
.status-badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); }
.status-badge.healthy, .status-badge.refreshed { color: var(--accent-deep); background: var(--accent-soft); }
.status-badge.healthy::before, .status-badge.refreshed::before { background: #2fab82; }
.status-badge.token_invalid { color: var(--danger); background: var(--danger-soft); }
.status-badge.token_invalid::before { background: var(--danger); }
.status-badge.fetch_failed, .status-badge.transient_error { color: var(--warning); background: var(--warning-soft); }
.status-badge.fetch_failed::before, .status-badge.transient_error::before { background: var(--warning); }
.date-main { color: var(--ink-2); }
.date-sub { display: block; color: var(--ink-3); font-size: 9px; }
.row-actions { display: flex; justify-content: flex-end; gap: 5px; }
.row-action { height: 28px; padding: 0 8px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: var(--surface-solid); font-size: 9px; font-weight: 700; }
.row-action:hover { color: var(--accent); border-color: color-mix(in srgb, var(--accent) 35%, var(--line)); }
.right { text-align: right; }
.loading-state, .empty-state { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 105px; color: var(--ink-3); font-size: 11px; }
.loading-state span { width: 15px; height: 15px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; }
.empty-state { flex-direction: column; padding: 28px; text-align: center; }
.empty-state b { color: var(--ink-2); font-size: 13px; }
.empty-state p { margin: -5px 0 0; }
.pagination { display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-top: 1px solid var(--line-soft); }
.pagination p { margin: 0; color: var(--ink-3); font-size: 10px; }
.pagination > div { display: flex; gap: 6px; }
.page-button { height: 30px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; color: var(--ink-2); background: var(--surface-solid); font-size: 9px; }
.page-button:hover:not(:disabled) { color: var(--accent); border-color: var(--accent); }
.page-button:disabled { cursor: not-allowed; opacity: .4; }

.job-list { display: grid; gap: 9px; }
.job-card { padding: 11px; border: 1px solid var(--line-soft); border-radius: 12px; background: var(--surface-2); }
.job-card-head { display: flex; align-items: center; gap: 9px; }
.job-kind { display: grid; place-items: center; width: 28px; height: 28px; flex: 0 0 auto; border-radius: 9px; color: var(--accent); background: var(--accent-soft); font-size: 11px; font-weight: 800; }
.job-card-head > div { min-width: 0; margin-right: auto; }
.job-card b { display: block; overflow: hidden; color: var(--ink); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.job-card small { color: var(--ink-3); font-size: 9px; }
.job-state { padding: 3px 6px; border-radius: 6px; color: var(--ink-3); background: var(--surface-solid); font-size: 8px; }
.job-state.running, .job-state.queued { color: var(--accent-deep); background: var(--accent-soft); }
.job-state.failed { color: var(--danger); background: var(--danger-soft); }
.job-progress { display: block; width: 100%; height: 3px; margin-top: 9px; overflow: hidden; border: 0; border-radius: 3px; background: var(--line); appearance: none; }
.job-progress::-webkit-progress-bar { border-radius: inherit; background: var(--line); }
.job-progress::-webkit-progress-value { border-radius: inherit; background: var(--accent); transition: width .5s ease; }
.job-progress::-moz-progress-bar { border-radius: inherit; background: var(--accent); }
.job-stats { display: flex; justify-content: space-between; margin-top: 6px; color: var(--ink-3); font-size: 8px; }
.quick-actions { display: grid; gap: 7px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-soft); }
.quick-actions button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px; border: 0; border-radius: 11px; color: var(--ink); background: transparent; text-align: left; transition: .2s; }
.quick-actions button:hover { background: var(--accent-pale); transform: translateX(2px); }
.quick-actions button > div { flex: 1; }
.quick-actions b, .quick-actions small { display: block; }
.quick-actions b { font-size: 10px; }
.quick-actions small { color: var(--ink-3); font-size: 8px; }
.quick-actions i { color: var(--ink-3); font-style: normal; }
.action-orb { position: relative; width: 29px; height: 29px; flex: 0 0 auto; border-radius: 9px; background: var(--accent-soft); }
.action-orb::before { content: "↻"; position: absolute; inset: 0; display: grid; place-items: center; color: var(--accent); font-size: 17px; }
.health-orb { background: var(--warning-soft); }
.health-orb::before { content: "✓"; color: var(--warning); font-size: 13px; font-weight: 800; }

.modal-backdrop { position: fixed; inset: 0; z-index: 80; background: rgba(11, 23, 20, .42); backdrop-filter: blur(5px); animation: fade .18s ease-out; }
.modal { position: fixed; top: 50%; left: 50%; z-index: 90; width: min(680px, calc(100vw - 28px)); max-height: calc(100vh - 32px); overflow-y: auto; padding: 26px; border: 1px solid var(--line); border-radius: 24px; background: var(--surface-solid); box-shadow: 0 30px 90px rgba(10, 27, 23, .24); transform: translate(-50%, -50%); animation: modal-in .22s ease-out; }
.modal-small { width: min(570px, calc(100vw - 28px)); }
.modal-close { display: grid; place-items: center; width: 33px; height: 33px; padding: 0; border: 1px solid var(--line); border-radius: 10px; color: var(--ink-3); background: var(--surface-2); font-size: 20px; line-height: 1; }
.modal > .modal-close { position: absolute; top: 20px; right: 20px; }
.modal-head { display: flex; align-items: flex-start; gap: 14px; padding-right: 42px; }
.modal-head h2 { margin: 0; font-size: 21px; }
.modal-head p:last-child { max-width: 500px; margin: 4px 0 0; color: var(--ink-2); font-size: 11px; }
.modal-symbol { position: relative; width: 42px; height: 42px; flex: 0 0 auto; border-radius: 13px; background: var(--accent-soft); }
.import-symbol::before { content: "↓"; position: absolute; inset: -3px 0 0; display: grid; place-items: center; color: var(--accent); font-size: 22px; }
.import-symbol::after { content: ""; position: absolute; width: 20px; height: 7px; left: 10px; bottom: 8px; border: solid var(--accent); border-width: 0 2px 2px; border-radius: 0 0 4px 4px; }
.settings-symbol::before { content: ""; position: absolute; inset: 10px; border: 2px dotted var(--accent); border-radius: 50%; }
.settings-symbol::after { content: ""; position: absolute; inset: 16px; border: 2px solid var(--accent); border-radius: 50%; }
.import-tabs { display: flex; gap: 4px; margin: 23px 0 17px; padding: 4px; border-radius: 12px; background: var(--surface-2); }
.import-tabs button { flex: 1; height: 34px; border: 0; border-radius: 9px; color: var(--ink-3); background: transparent; font-size: 11px; font-weight: 700; }
.import-tabs button.active { color: var(--accent-deep); background: var(--surface-solid); box-shadow: 0 3px 10px rgba(30,55,49,.06); }
.tab-pane { display: none; }
.tab-pane.active { display: block; animation: fade .2s; }
form label { display: block; color: var(--ink-2); font-size: 10px; font-weight: 700; }
form input:not([type="checkbox"]):not([type="file"]), form textarea, form select { width: 100%; margin-top: 6px; border: 1px solid var(--line); border-radius: 11px; outline: 0; color: var(--ink); background: var(--surface-2); font-size: 12px; transition: .2s; }
form input:not([type="checkbox"]):not([type="file"]), form select { height: 40px; padding: 0 11px; }
form textarea { padding: 12px; resize: vertical; line-height: 1.7; }
form input:focus, form textarea:focus, form select:focus { border-color: var(--accent) !important; box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .08); }
.field-help { margin: 5px 0 0; color: var(--ink-3); font-size: 9px; }
.drop-zone { display: grid; place-items: center; min-height: 190px; padding: 22px; border: 1.5px dashed color-mix(in srgb, var(--accent) 35%, var(--line)); border-radius: 15px; background: var(--accent-pale); text-align: center; transition: .2s; }
.drop-zone:hover, .drop-zone.dragging { border-color: var(--accent); background: var(--accent-soft); }
.drop-zone input { display: none; }
.drop-zone b { margin-top: 10px; color: var(--ink); font-size: 12px; }
.drop-zone small { color: var(--ink-3); font-size: 9px; }
.upload-art { position: relative; width: 44px; height: 35px; border: 2px solid var(--accent); border-radius: 10px; }
.upload-art::before { content: "↑"; position: absolute; left: 14px; top: -13px; color: var(--accent); font-size: 25px; font-weight: 600; }
.form-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-top: 14px; }
.form-grid.three { grid-template-columns: repeat(3, 1fr); }
#settings-form > label { margin-top: 13px; }
.policy-warning { display: flex; align-items: center; gap: 10px; margin-top: 15px; padding: 10px 12px; border-radius: 11px; color: var(--warning); background: var(--warning-soft); }
.policy-warning span { display: grid; place-items: center; width: 20px; height: 20px; border: 1px solid currentColor; border-radius: 50%; font-weight: 800; }
.policy-warning p { margin: 0; font-size: 9px; }
.modal-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 21px; padding-top: 17px; border-top: 1px solid var(--line-soft); }

.drawer { position: fixed; top: 0; right: 0; bottom: 0; z-index: 90; width: min(430px, 94vw); padding: 25px; overflow-y: auto; border-left: 1px solid var(--line); background: var(--surface-solid); box-shadow: -24px 0 70px rgba(10,27,23,.17); animation: drawer-in .25s ease-out; }
.drawer-head { display: flex; align-items: center; margin-bottom: 22px; }
.drawer-head > div { margin-right: auto; }
.drawer-head h2 { margin: 0; font-size: 21px; }
.job-list.detailed .job-card { padding: 14px; }
.job-list.detailed .job-card b { font-size: 12px; }
.job-list.detailed .job-card small { font-size: 10px; }
.job-error { margin: 8px 0 0; color: var(--danger); font-size: 9px; white-space: normal; }
.cancel-job { margin-top: 8px; padding: 0; border: 0; color: var(--danger); background: transparent; font-size: 9px; }

.confirm { position: fixed; top: 50%; left: 50%; z-index: 110; width: min(390px, calc(100vw - 28px)); padding: 25px; border: 1px solid var(--line); border-radius: 21px; background: var(--surface-solid); box-shadow: 0 30px 90px rgba(10,27,23,.28); text-align: center; transform: translate(-50%, -50%); animation: modal-in .2s ease-out; }
.confirm-icon { display: grid; place-items: center; width: 43px; height: 43px; margin: 0 auto 13px; border-radius: 50%; color: var(--warning); background: var(--warning-soft); font-size: 18px; font-weight: 800; }
.confirm h3 { margin: 0; font-size: 18px; }
.confirm p { margin: 7px 0 20px; color: var(--ink-2); font-size: 11px; }
.confirm > div:last-child { display: flex; justify-content: center; gap: 8px; }
.toast-stack { position: fixed; right: 24px; bottom: 24px; z-index: 140; display: grid; gap: 8px; width: min(350px, calc(100vw - 32px)); }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 13px 14px; border: 1px solid var(--line); border-left: 3px solid var(--accent); border-radius: 12px; background: var(--surface-solid); box-shadow: var(--shadow); animation: toast-in .26s ease-out; }
.toast.error { border-left-color: var(--danger); }
.toast b { display: block; font-size: 11px; }
.toast p { margin: 2px 0 0; color: var(--ink-2); font-size: 9px; }

.login-page { overflow: hidden; background: var(--bg); }
html[data-mode="dark"] .login-page { background: var(--bg); }
.login-theme-dock { position: fixed; top: 22px; right: 24px; z-index: 20; display: flex; align-items: center; gap: 7px; padding: 7px; border: 1px solid var(--line); border-radius: 14px; background: color-mix(in srgb, var(--surface-solid) 88%, transparent); box-shadow: var(--shadow-soft); backdrop-filter: blur(18px); }
.login-theme-dock button { display: grid; place-items: center; width: 31px; height: 31px; padding: 0; border: 1px solid transparent; border-radius: 9px; background: transparent; }
.login-theme-dock button:hover, .login-theme-dock button.active { border-color: var(--line); background: var(--surface-2); }
.login-theme-dock button > i { width: 17px; height: 17px; border-radius: 6px; background: #168a70; }
.login-theme-dock button:nth-child(2) > i { background: #2e7eb7; }
.login-theme-dock button:nth-child(3) > i { background: #bf6857; }
.login-aurora { position: fixed; border-radius: 50%; filter: blur(2px); pointer-events: none; }
.login-aurora-a { width: 700px; height: 700px; left: -220px; bottom: -320px; background: radial-gradient(circle, rgba(var(--accent-rgb), .18), transparent 67%); }
.login-aurora-b { width: 550px; height: 550px; top: -280px; right: -120px; background: radial-gradient(circle, rgba(112,175,155,.14), transparent 68%); }
.login-shell { display: grid; grid-template-columns: 1.05fr .95fr; min-height: 100vh; }
.login-story { position: relative; display: flex; flex-direction: column; overflow: hidden; padding: clamp(32px, 5vw, 72px); background: linear-gradient(145deg, color-mix(in srgb, var(--surface-solid) 64%, transparent), color-mix(in srgb, var(--accent-soft) 58%, transparent)); }
.login-story::before { content: ""; position: absolute; width: 420px; height: 420px; left: 50%; top: 52%; border: 1px solid rgba(var(--accent-rgb), .09); border-radius: 50%; transform: translate(-50%, -50%); box-shadow: 0 0 0 70px rgba(var(--accent-rgb),.025), 0 0 0 140px rgba(var(--accent-rgb),.018); }
.brand-large .brand-mark { width: 46px; height: 46px; border-radius: 15px; }
.brand-large strong { font-size: 20px; }
.story-copy { position: relative; z-index: 1; margin: auto 0; }
.eyebrow { display: flex; align-items: center; gap: 9px; color: var(--accent-deep); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.story-copy h1 { margin: 22px 0 19px; color: var(--ink); font-size: clamp(44px, 5.2vw, 78px); font-weight: 760; line-height: 1.08; letter-spacing: -.055em; }
.story-copy h1 em { color: var(--accent); font-style: normal; }
.story-copy > p { max-width: 530px; margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.9; }
.security-notes { position: relative; z-index: 1; display: flex; gap: clamp(20px, 4vw, 55px); }
.security-notes > div { display: flex; align-items: center; gap: 10px; }
.security-notes p { margin: 0; }
.security-notes b, .security-notes small { display: block; }
.security-notes b { color: var(--ink-2); font-size: 10px; }
.security-notes small { color: var(--ink-3); font-size: 8px; }
.mini-icon { position: relative; width: 31px; height: 31px; border: 1px solid rgba(var(--accent-rgb), .18); border-radius: 10px; }
.shield-icon::before { content: ""; position: absolute; width: 10px; height: 13px; top: 7px; left: 9px; border: 1.5px solid var(--accent); border-radius: 6px 6px 8px 8px; }
.clock-icon::before { content: ""; position: absolute; inset: 8px; border: 1.5px solid var(--accent); border-radius: 50%; }
.clock-icon::after { content: ""; position: absolute; width: 4px; height: 5px; top: 10px; left: 15px; border-left: 1.5px solid var(--accent); border-bottom: 1.5px solid var(--accent); }
.login-panel { display: grid; place-items: center; padding: 35px; background: color-mix(in srgb, var(--surface-solid) 82%, transparent); backdrop-filter: blur(24px); }
.login-card { width: min(390px, 100%); }
.mobile-brand { display: none; }
.lock-orbit { position: relative; width: 62px; height: 62px; margin-bottom: 28px; border: 1px solid rgba(var(--accent-rgb), .24); border-radius: 50%; background: var(--accent-pale); }
.lock-orbit::after { content: ""; position: absolute; width: 7px; height: 7px; top: 2px; right: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 5px rgba(var(--accent-rgb),.09); animation: breathe 2s ease-in-out infinite; }
.lock-core { position: absolute; width: 21px; height: 18px; left: 19px; top: 25px; border-radius: 5px; background: var(--accent); box-shadow: 0 5px 12px rgba(var(--accent-rgb), .2); }
.lock-core::before { content: ""; position: absolute; width: 11px; height: 12px; left: 3px; top: -10px; border: 2px solid var(--accent); border-bottom: 0; border-radius: 8px 8px 0 0; }
.login-card h2 { margin: 0; font-size: 30px; line-height: 1.2; letter-spacing: -.04em; }
.login-card > .muted { margin: 9px 0 26px; color: var(--ink-3); font-size: 12px; }
.login-form label { color: var(--ink-2); font-size: 11px; }
.secret-field { position: relative; margin: 7px 0 12px; }
.secret-field input { height: 48px !important; margin: 0 !important; padding-left: 43px !important; background: #f7faf9 !important; }
.key-glyph { position: absolute; z-index: 2; width: 11px; height: 11px; top: 18px; left: 16px; border: 1.5px solid var(--ink-3); border-radius: 50%; }
.key-glyph::after { content: ""; position: absolute; width: 8px; height: 1.5px; left: 8px; top: 7px; background: var(--ink-3); transform: rotate(45deg); box-shadow: 3px -2px 0 var(--ink-3); }
.login-form .button { height: 48px; margin-top: 8px; }
.field-hint { margin: 0 0 9px; color: var(--ink-3); font-size: 10px; line-height: 1.5; }
.form-error { margin: 9px 0; padding: 10px 12px; border: 1px solid color-mix(in srgb, var(--danger) 22%, transparent); border-radius: 10px; color: var(--danger); background: var(--danger-soft); font-size: 11px; font-weight: 700; line-height: 1.45; }
.form-status { margin: 10px 0 0; color: var(--accent-deep); font-size: 10px; text-align: center; }
.login-spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,.45); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
.login-form.is-submitting .login-arrow { display: none; }
.login-foot { display: flex; align-items: center; justify-content: center; gap: 8px; margin-top: 22px; color: var(--ink-3); font-size: 9px; }
.login-foot .status-dot { width: 6px; height: 6px; box-shadow: none; }

@keyframes spin { to { transform: rotate(360deg); } }
@keyframes pop { from { opacity: 0; transform: translateY(-5px) scale(.98); } }
@keyframes fade { from { opacity: 0; } }
@keyframes modal-in { from { opacity: 0; transform: translate(-50%, -47%) scale(.98); } }
@keyframes drawer-in { from { transform: translateX(100%); } }
@keyframes toast-in { from { opacity: 0; transform: translateX(15px); } }
@keyframes rise { from { height: 0; } }
@keyframes breathe { 50% { transform: scale(.7); opacity: .55; } }

@media (max-width: 1180px) {
  .app-shell { grid-template-columns: 218px minmax(0, 1fr); }
  .sidebar { padding-left: 15px; padding-right: 15px; }
  .main-content { padding-left: 24px; padding-right: 24px; }
  .workspace-grid { grid-template-columns: 1fr; }
  .activity-panel { position: static; }
  .activity-panel .job-list { grid-template-columns: repeat(3, 1fr); }
  .quick-actions { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; width: 254px; transform: translateX(-105%); transition: transform .25s ease; box-shadow: var(--shadow); }
  .sidebar.open { transform: translateX(0); }
  .mobile-menu { display: grid; }
  .main-content { padding: 18px; }
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .login-shell { grid-template-columns: 1fr; }
  .login-story { display: none; }
  .login-panel { min-height: 100vh; }
  .mobile-brand { display: flex; margin-bottom: 54px; }
  .login-page { overflow: auto; }
}

@media (max-width: 680px) {
  .main-content { padding: 13px; }
  .topbar { margin-bottom: 16px; }
  .page-heading p { display: none; }
  .page-heading h1 { font-size: 19px; }
  .top-actions { gap: 6px; }
  .top-actions > .button { width: 40px; padding: 0; font-size: 0; }
  .top-actions > .button .plus { font-size: 20px; }
  .notice-banner { align-items: flex-start; padding: 14px; }
  .notice-banner .text-button { display: none; }
  .notice-banner p { font-size: 10px; }
  .metric-grid { gap: 10px; }
  .metric-card { min-height: 144px; padding: 15px; }
  .workspace-grid { gap: 10px; }
  .panel-heading { align-items: flex-start; padding: 17px 14px 13px; }
  .panel-actions { flex-wrap: wrap; justify-content: flex-end; }
  .panel-actions .button { font-size: 0; width: 33px; padding: 0; }
  #refresh-selected::after { content: "↻"; font-size: 15px; }
  #health-selected::after { content: "✓"; font-size: 13px; }
  #delete-selected::after { content: "×"; font-size: 15px; }
  .filter-bar { flex-wrap: wrap; padding: 0 14px 13px; }
  .search-box { flex-basis: 100%; }
  .filter-bar .select-wrap:first-of-type { flex: 1; }
  .filter-bar .select-wrap:first-of-type select { width: 100%; }
  th:first-child, td:first-child { padding-left: 14px; }
  th:last-child, td:last-child { padding-right: 14px; }
  .pagination { padding: 12px 14px; }
  .activity-panel { padding: 16px; }
  .activity-panel .job-list { grid-template-columns: 1fr; }
  .quick-actions { grid-template-columns: 1fr; }
  .modal { padding: 20px 16px; }
  .modal > .modal-close { top: 14px; right: 14px; }
  .modal-head { padding-right: 34px; }
  .modal-symbol { width: 38px; height: 38px; }
  .form-grid, .form-grid.three { grid-template-columns: 1fr; }
  .toast-stack { right: 16px; bottom: 16px; }
}

@media (max-width: 430px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { min-height: 132px; }
  .metric-card > strong { font-size: 26px; }
  .metric-card > small { display: none; }
  .login-panel { padding: 24px; }
  .mobile-brand { margin-bottom: 42px; }
}

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