:root {
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
  color: #e9f1ee;
  background: #0b1115;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  --ink: #e9f1ee;
  --muted: #8b9d9b;
  --muted-strong: #b2c1bd;
  --line: #29383e;
  --line-soft: #1d2a30;
  --surface: #121c22;
  --surface-raised: #17232a;
  --surface-deep: #0e171c;
  --accent: #36d6ae;
  --accent-dark: #1fa889;
  --amber: #e7b25e;
  --red: #ed7777;
  --blue: #77b7e9;
}
* { box-sizing: border-box; }
html { min-width: 320px; background: #0b1115; }
body { margin: 0; min-width: 320px; background: #0b1115; }
button, input, select { font: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
.lock-screen { position: relative; min-height: 100vh; display: grid; place-items: center; padding: 28px; overflow: hidden; background: #0b1115; }
.lock-screen::before { content: ""; position: absolute; inset: 24px; border: 1px solid #1c2b31; pointer-events: none; }
.lock-screen::after { content: "ABG / OPERATIONS"; position: absolute; right: 42px; bottom: 30px; color: #26363d; font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.lock-form { position: relative; z-index: 1; width: min(100%, 440px); padding: 42px; background: #121c22; border: 1px solid #2c3d44; border-radius: 8px; box-shadow: 0 24px 70px rgba(0, 0, 0, .28); }
.lock-identity { display: flex; align-items: center; gap: 12px; color: #9fb4af; font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .18em; }
.brand-mark { width: 42px; height: 34px; display: inline-grid; place-items: center; color: #09201b; background: var(--accent); border-radius: 5px; font-size: 11px; font-weight: 900; letter-spacing: .04em; }
.lock-kicker { margin-top: 42px; color: var(--accent); font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
.lock-form h1 { margin: 10px 0 8px; color: var(--ink); font-size: 30px; line-height: 1.15; letter-spacing: 0; }
.lock-subtitle { margin: 0 0 30px; color: var(--muted); font-size: 13px; }
.lock-form label, .field-grid label { display: grid; gap: 8px; color: var(--muted-strong); font-size: 12px; font-weight: 600; }
.password-row { display: flex; gap: 9px; margin-top: 8px; }
input, select { width: 100%; height: 42px; padding: 0 12px; border: 1px solid #33464e; border-radius: 5px; color: var(--ink); background: #0e171c; transition: border-color .15s, box-shadow .15s; }
input::placeholder { color: #61736f; }
input:focus, select:focus { outline: 0; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(54, 214, 174, .12); }
.primary, .secondary, .stop-button { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 0 16px; border: 1px solid transparent; border-radius: 5px; font-size: 12px; font-weight: 750; letter-spacing: .01em; white-space: nowrap; transition: background .15s, border-color .15s, color .15s, transform .15s; }
.primary { color: #071b17; background: var(--accent); }
.primary:hover:not(:disabled) { background: #5ae4c1; transform: translateY(-1px); }
.secondary { color: #bfeae0; background: #162a2b; border-color: #2e5553; }
.secondary:hover:not(:disabled) { color: #e7fffa; background: #1d3937; border-color: #3a7770; }
.stop-button { color: #ffc0b8; background: #2b1f22; border-color: #6e3c3c; }
.stop-button:hover:not(:disabled) { background: #3a2528; }
button:disabled { cursor: not-allowed; opacity: .42; transform: none !important; }
.error { min-height: 20px; margin: 11px 0 0; color: var(--red); font-size: 12px; }
.app-shell { min-height: 100vh; background: #0b1115; }
.topbar { min-height: 66px; display: flex; justify-content: space-between; align-items: center; gap: 20px; padding: 0 34px; border-bottom: 1px solid var(--line-soft); background: #0e171c; }
.brand, .topbar-right, .environment, .run-state { display: flex; align-items: center; gap: 11px; }
.brand-copy { display: grid; gap: 2px; }
.brand-copy strong { color: var(--ink); font-size: 13px; letter-spacing: .02em; }
.brand-copy small { color: var(--muted); font-size: 10px; }
.support { color: #728682; font: 600 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .05em; white-space: nowrap; }
.environment { color: #9bd8c8; font-size: 11px; }
.live-dot, .state-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px rgba(54, 214, 174, .12); }
.icon-button { width: 36px; height: 36px; border: 1px solid #33464e; border-radius: 5px; background: transparent; color: #a4b8b3; font-size: 17px; }
.icon-button:hover { color: var(--ink); border-color: var(--accent); }
.content { max-width: 1440px; margin: 0 auto; padding: 36px 42px 24px; }
.section-heading { min-height: 26px; display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.section-heading > div { min-width: 0; }
.section-note { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.eyebrow { color: var(--accent); font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .16em; }
h1 { margin: 7px 0 0; color: var(--ink); font-size: 27px; line-height: 1.2; letter-spacing: 0; }
h2 { margin: 0; color: var(--ink); font-size: 14px; letter-spacing: .01em; }
.small-tag { padding: 5px 9px; border: 1px solid #30434a; border-radius: 4px; color: #9fb4af; background: #152127; font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; }
.message { min-height: 17px; margin: 11px 0 0; color: var(--muted); font-size: 11px; }
.message.error, .room-message.error { color: var(--red); }
.admin-panel { padding: 0; }
.admin-create-form { display: flex; align-items: end; gap: 12px; flex-wrap: wrap; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.admin-create-form label, .admin-edit-form label, .admin-list-tools label, .history-section label { display: grid; gap: 7px; color: var(--muted-strong); font-size: 11px; font-weight: 650; }
.admin-create-form input { min-width: 220px; }
.admin-create-form #card-note { min-width: 180px; }
.expiry-control { display: grid; gap: 8px; }
.quick-days { display: flex; flex-wrap: wrap; gap: 5px; }
.quick-days button { min-height: 28px; padding: 0 9px; border: 1px solid #30434a; border-radius: 4px; color: #9eb3ae; background: #122027; font-size: 10px; }
.quick-days button:hover { color: var(--accent); border-color: #3d7770; background: #18312f; }
.generated-card { margin: 14px 0; padding: 14px 16px; color: #bdeee2; background: #122c2b; border: 1px solid #2f6962; border-radius: 6px; font-size: 12px; }
.generated-card code { user-select: all; color: #e8fff9; font-weight: 800; letter-spacing: .06em; }
.admin-list-tools { display: flex; align-items: end; gap: 12px; margin-top: 24px; }
.admin-search { display: grid; gap: 7px; width: min(100%, 390px); color: var(--muted-strong); font-size: 11px; font-weight: 650; }
.admin-list-tools select { min-width: 130px; }
.admin-list-tools .small-tag { margin-left: auto; }
.table-wrap { overflow: auto; max-height: 360px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.admin-table-wrap { max-height: 470px; margin-top: 14px; }
.admin-table-wrap table { width: max-content; min-width: 100%; }
.admin-table-wrap th, .admin-table-wrap td { max-width: none; }
.card-code { color: #c8eee5; font: 700 11px ui-monospace, SFMono-Regular, Menlo, monospace; white-space: nowrap; user-select: all; }
.card-id { color: #75cbb4; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .01em; white-space: nowrap; user-select: all; }
.card-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.muted-action { color: #6f817d; font-size: 11px; }
.admin-pagination { display: flex; align-items: center; justify-content: center; gap: 14px; padding-top: 14px; color: var(--muted); font-size: 11px; }
.card-detail { min-width: 0; }
.card-detail > .section-heading { align-items: start; }
.card-detail h1 { margin-top: 9px; }
.card-detail-code { margin: 7px 0 0; color: #a5e3d4; font: 12px ui-monospace, SFMono-Regular, Menlo, monospace; overflow-wrap: anywhere; user-select: all; }
.admin-edit-form { display: flex; align-items: end; flex-wrap: wrap; gap: 12px; margin-top: 20px; padding: 18px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); }
.admin-edit-form label { min-width: 150px; }
.admin-edit-form label:first-child { flex: 1 1 220px; }
.admin-edit-form .expiry-control label { min-width: 220px; }
.history-section { margin-top: 28px; padding-top: 22px; border-top: 1px solid var(--line-soft); }
.history-section .section-heading { margin-bottom: 12px; }
.history-section .section-heading > span { color: var(--muted); font-size: 11px; }
.history-section .section-heading select { width: 150px; }
.history-pagination { display: flex; align-items: center; justify-content: end; gap: 12px; margin-top: 12px; color: var(--muted); font-size: 11px; }
.daily-summary { display: flex; align-items: baseline; justify-content: flex-end; gap: 10px; padding: 12px 16px 15px; color: var(--muted); font-size: 11px; }
.daily-summary strong { color: #c8eee5; font-size: 15px; font-variant-numeric: tabular-nums; }
.daily-summary strong.negative { color: var(--red); }
.date-link { padding: 0; border: 0; background: none; color: var(--accent); font-size: inherit; font-variant-numeric: tabular-nums; }
.date-link:hover { text-decoration: underline; }
.run-head { display: flex; align-items: end; justify-content: space-between; margin-bottom: 22px; }
.run-state { color: #b2c1bd; font-size: 12px; }
.run-state time { min-width: 48px; color: var(--muted); font-variant-numeric: tabular-nums; }
.state-dot.idle { background: #667874; box-shadow: none; }
.state-dot.running { background: var(--amber); box-shadow: 0 0 0 3px rgba(231, 178, 94, .12); }
.control-layout { display: grid; grid-template-columns: minmax(350px, .82fr) minmax(510px, 1.5fr); border: 1px solid var(--line); border-radius: 8px; background: var(--surface); box-shadow: 0 16px 50px rgba(0, 0, 0, .12); }
.config-panel, .stats-panel { min-width: 0; padding: 24px; }
.config-panel { border-right: 1px solid var(--line); }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 12px; }
.field-hint { margin: 15px 0 0; color: var(--muted); font-size: 11px; line-height: 1.55; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 20px; }
.actions button { flex: 1 1 120px; }
.stats-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.metric { min-width: 0; min-height: 88px; padding: 13px 14px; border: 1px solid #263940; border-top: 2px solid #327769; border-radius: 5px; background: var(--surface-raised); }
.metric span, .metric small { display: block; color: var(--muted); font-size: 10px; }
.metric strong { display: block; overflow: hidden; margin: 7px 0 4px; color: var(--ink); font-size: 20px; font-variant-numeric: tabular-nums; text-overflow: ellipsis; white-space: nowrap; }
.negative { color: var(--red) !important; }
.metric small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.secondary-stats { display: flex; flex-wrap: wrap; gap: 12px 22px; margin-top: 16px; color: var(--muted); font-size: 11px; }
.secondary-stats b { color: var(--ink); font-weight: 700; }
.daily-section, .room-section, .ledger-section { margin-top: 24px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); }
.daily-section { overflow: hidden; }
.room-section { padding: 19px 22px; }
.daily-section .section-heading, .room-section .section-heading, .ledger-section .section-heading { margin-bottom: 12px; }
.daily-section > .section-heading { padding: 19px 22px 0; }
.room-tools { display: flex; align-items: end; gap: 10px; margin-bottom: 13px; padding-bottom: 13px; border-bottom: 1px solid var(--line-soft); }
.room-tools label { display: grid; flex: 1; gap: 7px; color: var(--muted); font-size: 11px; }
.room-tools input { height: 38px; }
.room-tools button { min-height: 38px; }
.room-message { min-height: 17px; margin: -2px 0 13px; color: var(--muted); font-size: 11px; }
.room-list { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.room-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 13px; border: 1px solid #293b42; border-radius: 6px; background: #142027; }
.room-row.room-closed { background: #11191e; border-color: #3b3030; }
.room-action { min-height: 30px; padding: 0 10px; font-size: 11px; }
.room-name { display: flex; align-items: center; gap: 9px; min-width: 0; }
.room-name strong { overflow: hidden; color: #dce9e5; font-size: 13px; text-overflow: ellipsis; white-space: nowrap; }
.room-state { color: var(--muted); font-size: 11px; }
.room-values { text-align: right; color: #8fa29d; font-size: 11px; white-space: nowrap; }
.room-values b { color: #dce9e5; font-variant-numeric: tabular-nums; }
.ledger-section { overflow: hidden; }
.ledger-section > .section-heading { padding: 19px 22px 0; }
.text-button { border: 0; padding: 4px 0; color: var(--accent); background: transparent; font-size: 11px; font-weight: 750; }
.text-button:hover { color: #8af1d8; text-decoration: underline; }
table { width: 100%; border-collapse: collapse; font-size: 11px; text-align: left; }
th { position: sticky; top: 0; z-index: 1; color: #91a59f; background: #16242a; font: 700 10px ui-monospace, SFMono-Regular, Menlo, monospace; letter-spacing: .03em; }
th, td { max-width: 230px; padding: 11px 14px; border-bottom: 1px solid var(--line-soft); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
td { color: #b9c8c4; font-variant-numeric: tabular-nums; }
.empty-row { padding: 24px; color: #6f817d; text-align: center; }
footer { display: flex; justify-content: space-between; gap: 10px; padding: 15px 2px; color: #61736f; font: 10px ui-monospace, SFMono-Regular, Menlo, monospace; }
@media (max-width: 980px) { .control-layout { grid-template-columns: 1fr; } .config-panel { border-right: 0; border-bottom: 1px solid var(--line); } }
@media (max-width: 620px) {
  .lock-form { padding: 30px 24px; }
  .lock-screen { padding: 16px; }
  .lock-screen::before { inset: 12px; }
  .lock-screen::after { display: none; }
  .topbar { min-height: 70px; flex-wrap: wrap; gap: 8px; padding: 10px 16px; }
  .topbar-right { min-width: 0; flex-wrap: wrap; justify-content: flex-end; gap: 7px; }
  .support { display: none; }
  .content { padding: 24px 14px 16px; }
  h1 { font-size: 24px; }
  .section-heading { align-items: flex-start; }
  .admin-list-tools { align-items: stretch; flex-wrap: wrap; }
  .admin-search { width: 100%; }
  .admin-list-tools label:not(.admin-search) { flex: 1; }
  .admin-list-tools .small-tag { margin: auto 0 0; }
  .admin-pagination { justify-content: space-between; }
  .admin-edit-form label, .admin-edit-form .expiry-control { width: 100%; }
  .card-detail > .section-heading { flex-wrap: wrap; }
  .config-panel, .stats-panel { padding: 18px 16px; }
  .field-grid { gap: 11px 9px; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .metric { min-height: 78px; padding: 10px; }
  .metric strong { font-size: 17px; }
  .room-section { padding: 16px; }
  .room-tools { align-items: stretch; flex-wrap: wrap; }
  .room-tools label { min-width: calc(50% - 5px); }
  .room-tools button { width: 100%; }
  .room-list { grid-template-columns: 1fr; }
  .daily-table, .daily-table tbody { display: block; width: 100%; }
  .daily-table thead { display: none; }
  .daily-table tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); padding: 7px 0; border-bottom: 1px solid var(--line-soft); }
  .daily-table td { display: grid; gap: 2px; max-width: none; padding: 5px 8px; border: 0; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
  .daily-table td::before { color: var(--muted); font-size: 10px; }
  .daily-table td:nth-child(1) { grid-column: 1 / -1; }
  .daily-table td:nth-child(1)::before { content: '日期'; }
  .daily-table td:nth-child(2)::before { content: '总流水'; }
  .daily-table td:nth-child(3)::before { content: '胜 / 负 / 和'; }
  .daily-table td:nth-child(4)::before { content: '胜率'; }
  .daily-table td:nth-child(5)::before { content: '估算净收益'; }
  .daily-table td:nth-child(6)::before { content: '余额'; }
  .daily-table td:nth-child(7)::before { content: '最高 / 最低'; }
  .daily-table td:nth-child(8)::before { content: '未结算'; }
  .daily-table td.empty-row::before { content: none; }
  .daily-section .table-wrap, .history-daily-wrap { max-height: none; }
  .event-table { table-layout: fixed; width: 100%; }
  .event-table th, .event-table td { max-width: none; padding: 8px 3px; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; font-size: 10px; }
  .event-table th:nth-child(1) { width: 17%; }
  .event-table th:nth-child(2) { width: 16%; }
  .event-table th:nth-child(3) { width: 24%; }
  .event-table th:nth-child(4) { width: 8%; }
  .event-table th:nth-child(5) { width: 19%; }
  .event-table th:nth-child(6) { width: 16%; }
  footer { flex-direction: column; }
}
