/* ctb.338.hk — 明亮主题（对齐 Win 吃貨） */
@import url('https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=IBM+Plex+Sans:wght@400;500;600;700&family=Noto+Sans+SC:wght@400;500;700&display=swap');

:root {
  --bg: #f4f6f8;
  --side: #e8eef5;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --faint: #94a3b8;
  --line: #e2e8f0;
  --accent: #c9a227;
  --accent2: #0d9488;
  --ok: #16a34a;
  --warn: #dc2626;
  --info: #2563eb;
  --hit: #0d9488;
  --eat-bg: #f0fdf4;
  --bet-bg: #fff7ed;
  --ok-bg: #ecfdf5;
  --log-bg: #f8fafc;
  --radius: 12px;
  --sidebar: 200px;
  --font: "IBM Plex Sans", "Noto Sans SC", sans-serif;
  --mono: "IBM Plex Mono", Consolas, monospace;
  --shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
}

*, *::before, *::after { box-sizing: border-box; }
html, body {
  margin: 0; min-height: 100%;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 14.5px; line-height: 1.45;
}
a { color: var(--accent2); text-decoration: none; }
a:hover { text-decoration: underline; }

/* —— Toast 右下角 —— */
#toastHost {
  position: fixed; right: 18px; bottom: 18px; z-index: 9999;
  display: flex; flex-direction: column-reverse; gap: 10px;
  width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  background: var(--card);
  border: 1px solid var(--line);
  border-left: 4px solid var(--info);
  border-radius: 10px;
  box-shadow: var(--shadow);
  padding: 12px 14px;
  font-size: 0.92rem; font-weight: 600;
  color: var(--text);
  animation: toastIn .18s ease;
}
.toast.ok { border-left-color: var(--ok); background: #f0fdf4; color: #166534; }
.toast.err, .toast.fail { border-left-color: var(--warn); background: #fef2f2; color: #991b1b; }
.toast.warn { border-left-color: #d97706; background: #fffbeb; color: #92400e; }
.toast.info { border-left-color: var(--info); background: #eff6ff; color: #1e3a8a; }
@keyframes toastIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: none; }
}

/* —— Auth —— */
body.auth-page {
  background:
    radial-gradient(800px 400px at 10% -10%, rgba(13,148,136,.12), transparent 55%),
    radial-gradient(700px 380px at 100% 0%, rgba(201,162,39,.14), transparent 50%),
    var(--bg);
}
.auth-wrap { min-height: 100vh; display: grid; place-items: center; padding: 28px 16px; }
.auth-card {
  width: min(420px, 100%);
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: var(--shadow);
  padding: 28px;
}
.auth-brand { margin-bottom: 20px; }
.auth-brand .mark {
  display: inline-flex; align-items: center; gap: 8px;
  color: var(--muted); font-size: .78rem; font-weight: 700; letter-spacing: .08em;
  margin-bottom: 8px;
}
.auth-brand .mark-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--accent2);
  box-shadow: 0 0 0 4px rgba(13,148,136,.15);
}
.auth-brand h1 { margin: 0 0 4px; font-size: 1.55rem; }
.auth-brand p { margin: 0; color: var(--muted); font-size: .92rem; }
.auth-tabs {
  display: grid; grid-template-columns: 1fr 1fr; gap: 4px;
  background: var(--bg); border: 1px solid var(--line);
  border-radius: 10px; padding: 4px; margin-bottom: 16px;
}
.auth-tabs button {
  border: 0; background: transparent; color: var(--muted);
  border-radius: 8px; padding: 9px; font-weight: 650; cursor: pointer;
}
.auth-tabs button.active { background: var(--card); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.06); }
.auth-foot { margin-top: 16px; text-align: center; color: var(--faint); font-size: .82rem; }

.field { margin-bottom: 12px; }
.field label {
  display: block; font-size: .75rem; font-weight: 700;
  color: var(--muted); margin-bottom: 5px; letter-spacing: .03em;
}
.inp, .sel, textarea.inp {
  width: 100%; background: #fff; border: 1px solid var(--line);
  color: var(--text); border-radius: 8px; padding: 10px 12px;
  font: inherit; outline: none;
}
.inp:focus, .sel:focus { border-color: var(--accent2); box-shadow: 0 0 0 3px rgba(13,148,136,.15); }
.inp::placeholder { color: var(--faint); }
.sel { appearance: none; background-image: linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%); background-position: calc(100% - 16px) calc(50% - 3px), calc(100% - 11px) calc(50% - 3px); background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 28px; }
.check { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: .9rem; margin: 4px 0 14px; }
.check input { accent-color: var(--accent2); width: 15px; height: 15px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid transparent; border-radius: 8px;
  padding: 9px 14px; font: inherit; font-weight: 650; cursor: pointer;
  background: #e2e8f0; color: var(--text);
}
.btn:hover { filter: brightness(.98); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-lg { padding: 12px 16px; font-size: 1rem; }
.btn-sm { padding: 5px 10px; font-size: .8rem; }
.btn-primary { background: var(--accent2); color: #fff; }
.btn-gold { background: var(--accent); color: #1f1603; }
.btn-danger { background: var(--warn); color: #fff; }
.btn-ghost { background: #fff; border-color: var(--line); }
.btn-soft { background: rgba(13,148,136,.12); color: var(--accent2); }

/* —— Shell —— */
body.app-shell { background: var(--bg); }
.shell { display: grid; grid-template-columns: var(--sidebar) 1fr; min-height: 100vh; }
.side {
  position: sticky; top: 0; height: 100vh;
  background: var(--side); border-right: 1px solid var(--line);
  padding: 16px 12px; display: flex; flex-direction: column; gap: 14px; z-index: 20;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.side-brand .logo {
  width: 34px; height: 34px; border-radius: 9px;
  background: linear-gradient(145deg, #14b8a6, #0f766e);
  color: #fff; display: grid; place-items: center; font-weight: 800; font-size: .85rem;
}
.side-brand .name { font-weight: 750; }
.side-brand .sub { font-size: .72rem; color: var(--faint); }
.side-nav { display: flex; flex-direction: column; gap: 3px; flex: 1; }
.side-nav button, .side-nav a.nav-item {
  display: flex; align-items: center; gap: 8px; width: 100%;
  border: 0; background: transparent; color: #475569;
  border-radius: 8px; padding: 9px 11px; font: inherit; font-weight: 600;
  cursor: pointer; text-decoration: none; text-align: left;
}
.side-nav button:hover, .side-nav a.nav-item:hover { background: rgba(255,255,255,.7); color: var(--text); }
.side-nav button.active, .side-nav a.nav-item.active {
  background: #fff; color: var(--accent2);
  box-shadow: 0 1px 3px rgba(15,23,42,.06);
}
.side-nav .sec {
  margin: 10px 8px 4px; font-size: .68rem; font-weight: 750;
  color: var(--faint); letter-spacing: .06em; text-transform: uppercase;
}
.side-meta {
  border-top: 1px solid var(--line); padding-top: 12px;
  font-size: .8rem; color: var(--muted);
}
.side-meta .who { color: var(--text); font-weight: 700; }
.side-meta .expire { color: #b45309; margin: 2px 0 10px; }

.main { min-width: 0; display: flex; flex-direction: column; min-height: 100vh; }
.topbar {
  position: sticky; top: 0; z-index: 15;
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 18px; background: rgba(244,246,248,.92);
  border-bottom: 1px solid var(--line); backdrop-filter: blur(8px);
}
.topbar h1 { margin: 0; font-size: 1.1rem; }
.topbar .desc { margin: 2px 0 0; color: var(--muted); font-size: .84rem; }
.topbar-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.content { padding: 16px 18px 28px; flex: 1; }

.panel { display: none; }
.panel.active { display: block; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
@media (max-width: 1100px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }
@media (max-width: 860px) {
  .shell { grid-template-columns: 1fr; }
  .side { position: sticky; height: auto; }
  .side-nav { flex-direction: row; flex-wrap: wrap; }
  .side-nav button, .side-nav a.nav-item { width: auto; }
}

.cardx {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); overflow: hidden; box-shadow: 0 1px 2px rgba(15,23,42,.03);
}
.cardx + .cardx { margin-top: 12px; }
.cardx-h {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 14px; border-bottom: 1px solid var(--line); background: #fafbfc;
}
.cardx-h h2 { margin: 0; font-size: .92rem; }
.cardx-h .meta { color: var(--muted); font-size: .8rem; }
.cardx-b { padding: 14px; }

.form-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px;
}
.form-grid .span-2 { grid-column: span 2; }
.form-grid .span-3 { grid-column: span 3; }
@media (max-width: 700px) { .form-grid .span-2, .form-grid .span-3 { grid-column: span 1; } }

.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 10px; }

.tablex { width: 100%; border-collapse: collapse; font-size: .9rem; }
.tablex th, .tablex td { padding: 9px 11px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
.tablex th { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #f8fafc; }
.tablex tr:hover td { background: #f8fafc; }
.tablex code { font-family: var(--mono); font-size: .85em; color: #0f766e; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 8px;
  border-radius: 999px; font-size: .72rem; font-weight: 700;
}
.badge-ok { background: #dcfce7; color: #166534; }
.badge-off { background: #e2e8f0; color: #475569; }
.badge-warn { background: #fef3c7; color: #92400e; }
.badge-run { background: #ccfbf1; color: #0f766e; }
.badge-err { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

.stat-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-bottom: 12px; }
@media (max-width: 900px) { .stat-row { grid-template-columns: 1fr 1fr; } }
.stat {
  background: var(--card); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 12px 14px;
}
.stat .k { color: var(--muted); font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.stat .v { margin-top: 4px; font-size: 1.15rem; font-weight: 750; font-variant-numeric: tabular-nums; }
.stat .v.gold { color: #b45309; }
.stat .v.ok { color: var(--ok); }
.stat .v.teal { color: var(--accent2); }

/* 账号状态卡 */
.acct-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; margin-bottom: 12px; }
.acct-card {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 12px 14px; border-top: 3px solid var(--line);
}
.acct-card.eat { border-top-color: var(--accent2); background: linear-gradient(180deg, #f0fdfa, #fff); }
.acct-card.bet { border-top-color: var(--accent); background: linear-gradient(180deg, #fffbeb, #fff); }
.acct-card .role { font-size: .72rem; font-weight: 750; color: var(--muted); letter-spacing: .04em; }
.acct-card .user { font-weight: 750; margin: 4px 0 8px; font-size: 1rem; }
.acct-card .row { display: flex; justify-content: space-between; gap: 8px; font-size: .85rem; margin-top: 4px; }
.acct-card .row .lab { color: var(--muted); }
.acct-card .row .val { font-weight: 700; font-variant-numeric: tabular-nums; }
.acct-card .st-ok { color: var(--ok); }
.acct-card .st-off { color: var(--muted); }
.acct-card .st-err { color: var(--warn); }

/* 日志窗 */
.log-panes {
  display: grid; grid-template-columns: 1fr 1fr; gap: 10px; min-height: 320px;
}
@media (max-width: 900px) { .log-panes { grid-template-columns: 1fr; } }
.log-box {
  border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  display: flex; flex-direction: column; min-height: 280px; background: var(--card);
}
.log-box.eat { background: var(--eat-bg); }
.log-box.bet { background: var(--bet-bg); }
.log-box.ok { background: var(--ok-bg); }
.log-box .log-h {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; border-bottom: 1px solid var(--line);
  font-weight: 750; font-size: .88rem; background: rgba(255,255,255,.65);
}
.log-view {
  flex: 1; margin: 0; padding: 10px 12px;
  font-family: var(--mono); font-size: 12.5px; line-height: 1.55;
  overflow: auto; max-height: min(48vh, 480px);
  white-space: pre-wrap; word-break: break-word; color: var(--text);
  background: transparent;
}
.log-line { display: block; padding: 1px 0; border-bottom: 1px solid transparent; }
.log-line .ts { color: var(--faint); margin-right: 6px; }
.log-line.ok { color: var(--ok); font-weight: 600; }
.log-line.fail { color: var(--warn); font-weight: 600; }
.log-line.hit { color: var(--hit); font-weight: 600; }
.log-line.warn { color: #b45309; }
.log-line.error { color: var(--warn); font-weight: 700; }
.log-line.info { color: var(--muted); }
.log-line.sys { color: var(--info); }

/* 对冲对照表 */
.pair-table { width: 100%; border-collapse: collapse; font-size: .86rem; }
.pair-table th, .pair-table td { padding: 8px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.pair-table th { background: #f8fafc; color: var(--muted); font-size: .72rem; text-transform: uppercase; }
.pair-table .eat-cell { background: rgba(240,253,244,.7); }
.pair-table .bet-cell { background: rgba(255,247,237,.7); }
.pair-table .st-ok { color: var(--ok); font-weight: 750; }
.pair-table .st-fail { color: var(--warn); font-weight: 750; }
.pair-table .st-wait { color: #b45309; font-weight: 650; }
.pair-table .st-none { color: var(--faint); }

.banner {
  padding: 10px 12px; border-radius: 8px; margin-bottom: 12px;
  font-size: .9rem; display: none; border: 1px solid transparent;
}
.banner.show { display: block; }
.banner.warn { background: #fffbeb; color: #92400e; border-color: #fcd34d; }
.banner.err { background: #fef2f2; color: #991b1b; border-color: #fca5a5; }
.banner.ok { background: #ecfdf5; color: #166534; border-color: #86efac; }

.modal-backdrop-x {
  position: fixed; inset: 0; background: rgba(15,23,42,.35);
  display: none; align-items: center; justify-content: center; z-index: 50; padding: 16px;
}
.modal-backdrop-x.show { display: flex; }
.modal-x {
  width: min(480px, 100%); background: var(--card);
  border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow);
}
.modal-x-h { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.modal-x-h h3 { margin: 0; font-size: 1rem; }
.modal-x-b { padding: 14px; }
.modal-x-f { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 14px; border-top: 1px solid var(--line); }
.icon-btn { border: 0; background: transparent; color: var(--muted); cursor: pointer; font-size: 1.2rem; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); display: inline-block; }
.pulse.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(22,163,74,.2); }
.empty { padding: 20px; text-align: center; color: var(--faint); font-size: .9rem; }
.run-info { color: var(--accent2); font-weight: 650; font-size: .9rem; }
