:root {
  color-scheme: dark;
  --bg: #07100e;
  --surface: #0d1916;
  --surface-2: #12211d;
  --surface-3: #172923;
  --line: rgba(222, 255, 237, .1);
  --line-strong: rgba(152, 255, 101, .25);
  --text: #edf7f1;
  --muted: #8da59c;
  --accent: #98ff65;
  --mint: #70e8b8;
  --danger: #ff8178;
  --warning: #ffc96e;
  --shadow: 0 26px 80px rgba(0, 0, 0, .35);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--bg); }
body { min-height: 100vh; margin: 0; color: var(--text); background: radial-gradient(circle at 80% 5%, rgba(87,255,170,.09), transparent 33%), #07100e; }
button, input, select, textarea { font: inherit; }
button { color: inherit; }
.hidden { display: none !important; }
.background-grid { position: fixed; inset: 0; pointer-events: none; opacity: .28; background-image: linear-gradient(rgba(197,255,222,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(197,255,222,.035) 1px, transparent 1px); background-size: 42px 42px; mask-image: linear-gradient(to bottom, black, transparent 82%); }

.brand { display: inline-flex; align-items: center; gap: 12px; color: var(--text); text-decoration: none; }
.brand-mark { display: grid; width: 42px; height: 42px; place-items: center; flex: 0 0 auto; color: #06100d; font-weight: 900; letter-spacing: -.07em; border-radius: 12px; background: var(--accent); box-shadow: 0 0 30px rgba(152,255,101,.13); }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 16px; }
.brand small { margin-top: 3px; color: var(--muted); font: 700 9px ui-monospace, SFMono-Regular, monospace; letter-spacing: .13em; }
.eyebrow { display: block; margin-bottom: 12px; color: var(--mint); font: 750 10px ui-monospace, SFMono-Regular, monospace; letter-spacing: .18em; }

.auth-shell { position: relative; width: min(1160px, calc(100% - 48px)); min-height: 100vh; margin: 0 auto; display: grid; grid-template-columns: 1.1fr .7fr; gap: 90px; align-items: center; }
.auth-copy { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; padding: 42px 0 13vh; }
.auth-message h1 { margin: 0; font-size: clamp(45px, 6vw, 76px); line-height: 1; letter-spacing: -.065em; }
.auth-message h1 em { color: var(--accent); font-style: normal; }
.auth-message p { max-width: 610px; margin: 28px 0 0; color: var(--muted); font-size: 16px; line-height: 1.8; }
.auth-card { padding: 38px; border: 1px solid var(--line-strong); border-radius: 25px; background: linear-gradient(145deg, rgba(20,38,32,.96), rgba(8,18,15,.96)); box-shadow: var(--shadow); }
.card-kicker { color: var(--mint); font-size: 11px; font-weight: 800; letter-spacing: .12em; }
.auth-card h2 { margin: 10px 0 7px; font-size: 29px; }
.auth-card > p { margin: 0 0 25px; color: var(--muted); font-size: 12px; }

.field { display: grid; gap: 7px; margin-bottom: 15px; }
.field > span { color: #b8cbc3; font-size: 11px; font-weight: 700; }
.field input, .field select, .field textarea { width: 100%; padding: 0 13px; color: var(--text); outline: none; border: 1px solid var(--line); border-radius: 10px; background: rgba(1,8,6,.43); transition: border-color .18s, box-shadow .18s; }
.field input, .field select { height: 44px; }
.field textarea { padding-top: 12px; resize: vertical; line-height: 1.65; }
.field input::placeholder { color: #587168; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: rgba(152,255,101,.6); box-shadow: 0 0 0 3px rgba(152,255,101,.07); }
.button { display: inline-flex; min-height: 40px; padding: 0 15px; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid transparent; border-radius: 10px; font-size: 12px; font-weight: 760; transition: transform .15s, filter .15s, background .15s; white-space: nowrap; }
.button:hover { transform: translateY(-1px); filter: brightness(1.08); }
.button:focus-visible, .nav-item:focus-visible, .picker-button:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.button:disabled { cursor: wait; opacity: .55; transform: none; }
.button-primary { color: #07110f; background: var(--accent); }
.button-secondary { border-color: var(--line-strong); background: #14251f; }
.button-ghost { color: var(--muted); border-color: var(--line); background: transparent; }
.button-danger { color: #ffb2ac; border-color: rgba(255,129,120,.22); background: rgba(255,129,120,.07); }
.button-small { min-height: 32px; padding: 0 11px; font-size: 11px; border-radius: 8px; }
.button-wide { width: 100%; }

.app-shell { position: relative; min-height: 100vh; }
.sidebar { position: fixed; z-index: 10; inset: 0 auto 0 0; width: 256px; display: flex; flex-direction: column; padding: 26px 18px 20px; border-right: 1px solid var(--line); background: rgba(7,16,14,.94); backdrop-filter: blur(18px); }
.sidebar-brand { padding: 0 9px 28px; border-bottom: 1px solid var(--line); }
.nav { display: grid; gap: 7px; margin-top: 26px; }
.nav-label { padding: 0 11px 7px; color: #526c62; font: 750 9px ui-monospace, monospace; letter-spacing: .16em; }
.nav-item { width: 100%; display: grid; grid-template-columns: 40px 1fr; gap: 11px; align-items: center; padding: 11px; cursor: pointer; color: var(--text); text-align: left; text-decoration: none; border: 1px solid transparent; border-radius: 12px; background: transparent; }
.nav-item:hover { background: rgba(255,255,255,.025); }
.nav-item.active { border-color: var(--line-strong); background: linear-gradient(120deg, rgba(152,255,101,.12), rgba(112,232,184,.04)); }
.nav-icon { display: grid; width: 38px; height: 38px; place-items: center; color: var(--muted); border: 1px solid var(--line); border-radius: 10px; font-size: 9px; font-weight: 800; }
.nav-item.active .nav-icon { color: #07110f; border-color: transparent; background: var(--accent); }
.nav-item strong, .nav-item small { display: block; }
.nav-item strong { font-size: 12px; }
.nav-item small { margin-top: 4px; color: var(--muted); font-size: 9px; }
.sidebar-footer { margin-top: auto; padding-top: 17px; border-top: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.sidebar-footer > div { min-width: 0; display: flex; align-items: center; gap: 9px; }
.sidebar-footer strong, .sidebar-footer small { display: block; max-width: 110px; overflow: hidden; text-overflow: ellipsis; }
.sidebar-footer strong { font-size: 11px; }
.sidebar-footer small { margin-top: 2px; color: var(--muted); font-size: 9px; }
.admin-avatar { display: grid; width: 30px; height: 30px; place-items: center; color: #07110f; border-radius: 9px; background: var(--mint); font-size: 11px; font-weight: 900; }
.logout-button { padding: 5px; cursor: pointer; color: var(--muted); border: 0; background: transparent; font-size: 10px; }

.workspace { min-height: 100vh; margin-left: 256px; padding: 48px clamp(28px, 4vw, 70px) 70px; }
.module-view { max-width: 1460px; margin: 0 auto; }
.mobile-header { display: none; }
.page-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 34px; margin-bottom: 27px; }
.page-heading h1 { margin: 0; font-size: clamp(34px, 4.2vw, 55px); letter-spacing: -.055em; }
.page-heading p { max-width: 700px; margin: 12px 0 0; color: var(--muted); font-size: 12px; line-height: 1.7; }
.heading-actions { display: flex; gap: 8px; }
.summary-strip { display: flex; gap: 1px; margin-bottom: 13px; overflow: hidden; border: 1px solid var(--line); border-radius: 14px; background: var(--line); }
.summary-strip span { min-width: 150px; display: flex; gap: 8px; align-items: baseline; padding: 15px 18px; color: var(--muted); background: rgba(12,25,21,.96); font-size: 10px; }
.summary-strip b { color: var(--text); font-size: 18px; }

.table-panel { overflow: hidden; border: 1px solid var(--line); border-radius: 17px; background: rgba(11,23,19,.9); box-shadow: 0 22px 65px rgba(0,0,0,.12); }
.table-scroll { overflow-x: auto; }
.table-head { min-height: 45px; align-items: center; color: #718a81; border-bottom: 1px solid var(--line); background: rgba(255,255,255,.018); font: 700 9px ui-monospace, monospace; letter-spacing: .1em; }
.account-table { min-width: 0; display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1fr) minmax(0,1fr) minmax(0,.8fr) minmax(0,1.1fr) minmax(0,1.75fr); }
.webhook-table { min-width: 780px; display: grid; grid-template-columns: 1.2fr 2fr 1fr 1.2fr; }
.report-table { min-width: 1120px; display: grid; grid-template-columns: 1.25fr 1.15fr .95fr .9fr 1.8fr; }
.table-head > span { padding: 0 15px; }
.account-row, .webhook-row, .report-row { border-bottom: 1px solid var(--line); }
.account-row:last-child, .webhook-row:last-child, .report-row:last-child { border-bottom: 0; }
.account-main { min-width: 0; display: grid; grid-template-columns: minmax(0,.85fr) minmax(0,1fr) minmax(0,1fr) minmax(0,.8fr) minmax(0,1.1fr) minmax(0,1.75fr); align-items: center; min-height: 82px; }
.webhook-main { min-width: 780px; display: grid; grid-template-columns: 1.2fr 2fr 1fr 1.2fr; align-items: center; min-height: 72px; }
.report-main { min-width: 1120px; display: grid; grid-template-columns: 1.25fr 1.15fr .95fr .9fr 1.8fr; align-items: center; min-height: 96px; }
.cell { min-width: 0; padding: 12px 11px; }
.cell input[type="text"], .cell input[type="password"] { width: 100%; height: 39px; padding: 0 11px; color: var(--text); outline: none; border: 1px solid var(--line); border-radius: 9px; background: rgba(1,8,6,.38); font-size: 12px; }
.cell input:focus { border-color: rgba(152,255,101,.55); }
.status-cell { display: grid; gap: 6px; }
.status-line { display: flex; align-items: center; gap: 7px; font-size: 11px; font-weight: 750; }
.status-dot { width: 7px; height: 7px; border-radius: 50%; background: #53675f; }
.status-dot.online { background: var(--accent); box-shadow: 0 0 13px rgba(152,255,101,.7); }
.status-dot.offline { background: var(--danger); }
.status-cell small, .webhook-info small { color: var(--muted); font-size: 9px; line-height: 1.4; }
.action-cell { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.webhook-picker { position: relative; }
.picker-button { width: 100%; min-height: 39px; padding: 0 11px; display: flex; align-items: center; justify-content: space-between; cursor: pointer; color: #c4d5ce; text-align: left; border: 1px solid var(--line); border-radius: 9px; background: rgba(1,8,6,.38); font-size: 10px; }
.picker-menu { position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; width: max(100%, 190px); max-height: 210px; overflow: auto; padding: 7px; border: 1px solid var(--line-strong); border-radius: 11px; background: #10201b; box-shadow: var(--shadow); }
.picker-menu label { display: flex; gap: 8px; align-items: center; padding: 9px; cursor: pointer; border-radius: 7px; font-size: 10px; }
.picker-menu label:hover { background: rgba(255,255,255,.04); }
.picker-menu input { accent-color: var(--accent); }
.picker-empty { padding: 10px; color: var(--muted); font-size: 10px; line-height: 1.5; }
.captcha-panel { display: grid; grid-template-columns: 170px 1fr auto auto; gap: 11px; align-items: end; margin: 0 14px 14px; padding: 14px; border: 1px solid var(--line-strong); border-radius: 12px; background: rgba(152,255,101,.035); }
.captcha-image-wrap { display: grid; gap: 6px; }
.captcha-image-wrap span { color: var(--muted); font-size: 9px; }
.captcha-panel img { width: 160px; height: 56px; object-fit: contain; border-radius: 7px; background: white; }
.captcha-panel .field { margin: 0; }
.empty-state { min-height: 170px; display: grid; place-items: center; padding: 30px; color: var(--muted); text-align: center; font-size: 11px; line-height: 1.7; }
.new-row { background: rgba(152,255,101,.025); }
.webhook-info strong, .webhook-info small { display: block; }
.webhook-info strong { margin-bottom: 5px; font-size: 12px; }
.webhook-info code { display: block; overflow: hidden; color: #a8bcb4; font: 9px ui-monospace, monospace; text-overflow: ellipsis; white-space: nowrap; }
.page-footnote { margin: 13px 3px; color: #60786f; font-size: 9px; line-height: 1.6; }
.report-info { display: grid; gap: 5px; align-content: center; font-size: 11px; }
.report-info strong { font-size: 13px; }
.report-info small { overflow: hidden; color: var(--muted); font-size: 9px; line-height: 1.45; text-overflow: ellipsis; }
.status-pill { width: max-content; padding: 4px 7px; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; font-size: 8px; font-weight: 800; }
.status-pill.enabled { color: var(--accent); border-color: var(--line-strong); background: rgba(152,255,101,.05); }
.schedule-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.schedule-tags > span { display: grid; gap: 1px; padding: 7px 9px; color: var(--text); border: 1px solid var(--line); border-radius: 8px; background: rgba(255,255,255,.02); font: 700 11px ui-monospace, monospace; }
.schedule-tags small { color: var(--muted); font-size: 7px; }
.report-actions { align-content: center; }
.template-layout { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(270px, .7fr); gap: 14px; align-items: start; }
.template-editor, .variable-panel { padding: 22px; }
.variable-panel h2 { margin: 8px 0 17px; font-size: 19px; }
.variable-panel p, .config-fieldset small { color: var(--muted); font-size: 10px; line-height: 1.6; }
.variable-list { display: flex; gap: 7px; flex-wrap: wrap; }
.variable-list button { padding: 7px 9px; cursor: pointer; color: var(--mint); border: 1px solid var(--line); border-radius: 7px; background: rgba(112,232,184,.035); font: 10px ui-monospace, monospace; }

@media (min-width: 901px) {
  .table-body, .account-row, .account-main, .account-table { width: 100%; max-width: 100%; }
}

.dialog { width: min(480px, calc(100% - 28px)); padding: 0; color: var(--text); border: 1px solid var(--line-strong); border-radius: 18px; background: #0d1b17; box-shadow: var(--shadow); }
.dialog-wide { width: min(820px, calc(100% - 28px)); }
.dialog::backdrop { background: rgba(0,0,0,.67); backdrop-filter: blur(4px); }
.dialog form { padding: 24px; }
.dialog-wide:not(:has(form)) { padding: 24px; }
.dialog-heading { display: flex; justify-content: space-between; margin-bottom: 23px; }
.dialog-heading h2 { margin: 0; font-size: 23px; }
.icon-button { width: 32px; height: 32px; cursor: pointer; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; background: transparent; font-size: 20px; }
.dialog-note { margin: -5px 0 22px; color: var(--muted); font-size: 10px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 7px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 13px; }
.field-span-2 { grid-column: span 2; }
.config-fieldset { margin: 3px 0 16px; padding: 14px; border: 1px solid var(--line); border-radius: 12px; }
.config-fieldset legend { padding: 0 6px; color: #b8cbc3; font-size: 11px; font-weight: 700; }
.schedule-list { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 9px; }
.schedule-input-row { display: flex; gap: 5px; }
.schedule-input-row input { height: 35px; padding: 0 9px; color: var(--text); color-scheme: dark; border: 1px solid var(--line); border-radius: 8px; background: rgba(1,8,6,.43); }
.option-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 7px; }
.option-grid label, .toggle-field { display: flex; gap: 8px; align-items: center; padding: 9px; border: 1px solid var(--line); border-radius: 8px; font-size: 10px; }
.option-grid input, .toggle-field input { accent-color: var(--accent); }
.toggle-field { width: max-content; margin-bottom: 20px; }
.result-content { display: grid; gap: 12px; }
.result-content h3 { margin: 0; font-size: 20px; }
.result-content p { margin: 0; color: var(--muted); }
.result-content section { display: grid; gap: 8px; }
.result-content pre { max-height: 280px; margin: 0; padding: 14px; overflow: auto; color: #dcebe5; border: 1px solid var(--line); border-radius: 10px; background: #07110e; font: 11px/1.7 ui-monospace, monospace; white-space: pre-wrap; }
.result-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 7px; }
.result-metrics span { display: grid; gap: 3px; padding: 12px; color: var(--muted); border: 1px solid var(--line); border-radius: 9px; font-size: 9px; }
.result-metrics b { color: var(--text); font-size: 18px; }
.error-text { color: var(--danger) !important; }
.toast { position: fixed; z-index: 50; right: 23px; bottom: 23px; max-width: min(420px, calc(100vw - 46px)); padding: 13px 16px; opacity: 0; pointer-events: none; transform: translateY(12px); color: #07110f; border-radius: 11px; background: var(--accent); box-shadow: var(--shadow); font-size: 12px; font-weight: 750; transition: opacity .2s, transform .2s; }
.toast.show { opacity: 1; transform: none; }
.toast.error { color: white; background: #bd403a; }

@media (max-width: 900px) {
  .auth-shell { grid-template-columns: 1fr; gap: 35px; padding: 30px 0 70px; }
  .auth-copy { min-height: 390px; padding: 0; }
  .sidebar { transform: translateX(-100%); transition: transform .2s; }
  .app-shell.menu-open .sidebar { transform: none; }
  .workspace { margin-left: 0; padding: 24px 18px 60px; }
  .mobile-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 46px; }
  .mobile-header .brand-mark { width: 35px; height: 35px; border-radius: 10px; }
  .account-table, .account-main { min-width: 900px; }
}

@media (max-width: 620px) {
  .auth-shell { width: min(100% - 26px, 1160px); }
  .auth-message h1 { font-size: 43px; }
  .auth-card { padding: 24px; border-radius: 18px; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .heading-actions { width: 100%; }
  .heading-actions .button { flex: 1; }
  .summary-strip { overflow-x: auto; }
  .summary-strip span { min-width: 135px; }
  .captcha-panel { grid-template-columns: 1fr; }
  .captcha-panel img { width: 100%; height: 66px; }
  .template-layout, .form-grid { grid-template-columns: 1fr; }
  .field-span-2 { grid-column: auto; }
  .option-grid, .result-metrics { grid-template-columns: 1fr 1fr; }
}
