/* 设计令牌与组件样式对齐 fanout_client（墨绿纸感体系），仅保留本页用到的规则。 */
:root {
  --ink: #132a25;
  --muted: #6c7d78;
  --paper: #f4f6f3;
  --panel: #ffffff;
  --line: #dbe3df;
  --green: #174d40;
  --green-2: #23715d;
  --mint: #dff2e9;
  --amber: #ce6a24;
  --red: #a43b38;
  --shadow: 0 18px 50px rgba(19, 42, 37, .07);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", system-ui, sans-serif;
  color: var(--ink);
  background: var(--paper);
}
* { box-sizing: border-box; }
body { margin: 0; min-width: 320px; background: radial-gradient(circle at 80% 0, #e8f0eb 0, transparent 35%), var(--paper); }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
h1, h2, p { margin-top: 0; }
.hidden { display: none !important; }

/* 登录视图 */
.login-screen { min-height: 100vh; display: grid; place-items: center; padding: 20px; }
.login-card { width: min(400px, 100%); padding: 30px; display: grid; gap: 10px; justify-items: center; text-align: center; animation: reveal .22s ease-out; }
.login-card h1 { margin: 2px 0 0; font: 700 clamp(24px, 3vw, 30px) Georgia, "Songti SC", serif; }
.login-caption { margin: 0 0 8px; color: var(--muted); font-size: 12px; }
.login-card .field { width: 100%; text-align: left; margin-top: 4px; }
.login-error { min-height: 18px; margin: 2px 0 0; color: var(--red); font-size: 12px; }
.brand-mark.big { width: 52px; height: 52px; font-size: 26px; border-radius: 14px; }

/* 侧栏 + 主区 */
.shell { min-height: 100vh; display: grid; grid-template-columns: 176px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; padding: 28px 14px; background: #102e27; color: #fff; display: flex; flex-direction: column; overflow: hidden; }
.brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 34px; }
.brand-mark { width: 40px; height: 40px; display: grid; place-items: center; border: 1px solid #83aa9f; border-radius: 12px; font: 700 20px Georgia, serif; background: #174d40; }
.brand strong, .brand small, .sidebar-foot strong, .sidebar-foot small { display: block; }
.brand small, .sidebar-foot small { color: #99b6ae; margin-top: 3px; font-size: 11px; }
nav { display: grid; gap: 7px; }
.nav-item { width: 100%; border: 0; background: transparent; color: #b8cec8; text-align: left; border-radius: 10px; padding: 12px 14px; cursor: pointer; display: flex; align-items: center; gap: 12px; }
.nav-item span { font: 600 10px ui-monospace, monospace; color: #76968d; }
.nav-item:hover, .nav-item.active { background: #1c4439; color: #fff; }
.sidebar-foot { margin-top: auto; border-top: 1px solid #315047; padding: 22px 8px 2px; display: flex; align-items: center; gap: 10px; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: #e7a66d; box-shadow: 0 0 0 5px rgba(231, 166, 109, .12); flex: none; }
.status-dot.armed { background: #64d3a7; box-shadow: 0 0 0 5px rgba(100, 211, 167, .12); }
main { min-width: 0; padding: 18px; }
@keyframes reveal { from { opacity: 0; transform: translateY(4px); } }

/* 标题区 */
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 20px; margin-bottom: 18px; }
.section-heading h2 { margin-bottom: 0; font: 700 28px Georgia, "Songti SC", serif; }
.section-heading p:last-child { color: var(--muted); margin: 8px 0 0; }
.eyebrow { margin-bottom: 7px; color: var(--green-2); font: 700 10px/1 ui-monospace, monospace; letter-spacing: .18em; }
.button-row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* 概览卡片 */
.resource-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 18px; margin-bottom: 18px; }
.status-card { display: flex; align-items: center; gap: 16px; }
.status-card small { color: var(--muted); }
.status-card h2 { margin: 5px 0; font-size: 22px; }
.status-card p { color: var(--muted); margin: 0; font-size: 12px; }
.icon-tile { flex: 0 0 48px; height: 48px; display: grid; place-items: center; border-radius: 13px; background: #eaf3ef; color: var(--green); font: 700 18px Georgia, serif; }

/* 面板 */
.panel { background: rgba(255,255,255,.94); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); padding: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; margin-bottom: 14px; }
.panel-head h2 { margin-bottom: 0; font-size: 18px; }
.panel-caption { margin: 6px 0 0; color: var(--muted); font-size: 11px; }

/* 按钮 */
.button { border: 1px solid var(--line); border-radius: 9px; padding: 10px 14px; cursor: pointer; text-decoration: none; color: var(--ink); background: #fff; font-weight: 650; font-size: 12px; }
.button:hover { filter: brightness(.98); border-color: #aebdb7; }
.button:disabled { opacity: .6; cursor: not-allowed; }
.button.primary { background: var(--green); color: #fff; border-color: var(--green); }
.button.ghost { background: transparent; }
.button.danger-soft { background: #fff4f3; color: var(--red); border-color: #efd2d0; }
.fire-button { border: 0; border-radius: 9px; color: #fff; background: var(--green); padding: 10px 16px; cursor: pointer; transition: transform .1s, box-shadow .1s; }
.fire-button:hover { box-shadow: 0 16px 32px rgba(23,77,64,.28); }
.fire-button:active { transform: translateY(2px) scale(.995); }
.fire-button.full { width: 100%; }
.mini-button { border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 6px 8px; cursor: pointer; font-size: 10px; }
.mini-button.danger { color: var(--red); }
.mini-button:disabled { opacity: .6; cursor: not-allowed; }

/* 表单 */
.field { display: grid; gap: 7px; color: var(--muted); font-size: 11px; }
input, select, textarea { width: 100%; border: 1px solid #cfd9d4; border-radius: 9px; background: #fff; color: var(--ink); padding: 11px 12px; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--green-2); box-shadow: 0 0 0 3px rgba(35,113,93,.12); }
textarea { resize: vertical; font: 12px/1.6 "Cascadia Mono", Consolas, ui-monospace, monospace; }
.hint { color: var(--muted); font-size: 11px; line-height: 1.6; margin: 13px 0 0; }

/* 表格 */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { color: var(--muted); font-size: 10px; letter-spacing: .05em; text-align: left; padding: 0 10px 11px; }
td { border-top: 1px solid #e9efec; padding: 12px 10px; vertical-align: top; line-height: 1.6; }
tbody tr:hover { background: #f7faf8; }
.muted { color: var(--muted); font-size: 10px; line-height: 1.6; }
td code { font: 600 12px/1.5 "Cascadia Mono", Consolas, ui-monospace, monospace; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.state-badge { display: inline-flex; align-items: center; border-radius: 999px; background: #edf2ef; color: #49625b; padding: 4px 8px; font-size: 10px; font-weight: 700; white-space: nowrap; }
.state-valid { background: #e1f3ea; color: #176a50; }
.state-invalid, .state-captcha_required, .state-login_failed { background: #fde9e7; color: var(--red); }
.state-none, .state-unknown { background: #edf2ef; color: #5f736d; }
.error-cell { color: var(--red); font-size: 11px; max-width: 260px; overflow-wrap: anywhere; }

/* 弹窗 */
dialog { width: min(560px, calc(100vw - 30px)); border: 0; border-radius: 16px; padding: 0; color: var(--ink); box-shadow: 0 30px 90px rgba(0,0,0,.2); }
dialog:not([open]) { display: none; }
dialog::backdrop { background: rgba(8,24,20,.55); backdrop-filter: blur(3px); }
dialog form, dialog .dialog-body { padding: 22px; }
.dialog-head, .dialog-actions { display: flex; justify-content: space-between; align-items: center; }
.dialog-head button { border: 0; background: transparent; font-size: 24px; cursor: pointer; line-height: 1; }
.dialog-actions { justify-content: flex-end; gap: 9px; margin-top: 20px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-top: 18px; }
.form-grid label { color: var(--muted); font-size: 11px; }
.form-grid input { margin-top: 6px; }
.span-2 { grid-column: span 2; }
dialog textarea { margin-top: 12px; }
.confirm-message { margin: 4px 0 0; color: var(--ink); font-size: 13px; line-height: 1.7; }

/* 一键登录结果 */
.pre-flight-verdict { margin: 4px 22px 0; border-radius: 10px; padding: 12px 16px; font-weight: 700; font-size: 14px; background: #e1f3ea; color: #176a50; border: 1px solid #bcdccb; }
.pre-flight-verdict.blocked { background: #fde9e7; color: var(--red); border-color: #e7b6b4; }
.result-list { list-style: none; display: grid; gap: 8px; margin: 14px 22px 0; padding: 0; max-height: 46vh; overflow: auto; }
.result-list li { display: flex; align-items: baseline; gap: 10px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; font-size: 12px; }
.result-list li.ok { background: #f4faf7; }
.result-list li.bad { background: #fdf4f3; border-color: #efd2d0; }
.result-list .mark { flex: none; font-weight: 800; }
.result-list li.ok .mark { color: #176a50; }
.result-list li.bad .mark { color: var(--red); }
.result-list .msg { color: var(--muted); overflow-wrap: anywhere; }

/* Toast */
.toast { position: fixed; right: 24px; bottom: 24px; max-width: 380px; padding: 12px 16px; border-radius: 10px; color: #fff; background: #183b32; box-shadow: var(--shadow); opacity: 0; transform: translateY(10px); pointer-events: none; transition: .2s; }
.toast.show { opacity: 1; transform: translateY(0); }
.toast.error { background: #8b3432; }

@media (max-width: 1050px) { .resource-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 760px) {
  .shell { display: block; }
  .sidebar { position: static; width: 100%; height: auto; padding: 15px; }
  .brand { padding-bottom: 14px; }
  nav { display: flex; overflow-x: auto; }
  .nav-item { white-space: nowrap; width: auto; }
  .sidebar-foot { display: none; }
  main { padding: 18px 14px 44px; }
  .section-heading { align-items: flex-start; flex-direction: column; }
  .resource-grid { grid-template-columns: 1fr; }
  .form-grid { grid-template-columns: 1fr; }
  .span-2 { grid-column: auto; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
