/* 万豪娱乐 · 管理后台。深色、清晰为先；金色只用在品牌和重点上。 */
:root {
  --bg: #0f1118;
  --panel: #171a24;
  --panel-2: #1d2130;
  --line: #2a2f41;
  --text: #e8eaf2;
  --muted: #8d93a8;
  --gold: #e8b84a;
  --accent: #5b8def;
  --good: #3fb97a;
  --bad: #ef5a5f;
  --radius: 10px;
  --sat: env(safe-area-inset-top, 0px);
  --sab: env(safe-area-inset-bottom, 0px);
  --sal: env(safe-area-inset-left, 0px);
  --sar: env(safe-area-inset-right, 0px);
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 -apple-system, BlinkMacSystemFont, "PingFang SC", "Microsoft YaHei", "Segoe UI", sans-serif;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}
[hidden] { display: none !important; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, p { margin: 0; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 13px; word-break: break-all; }
.up { color: var(--good); }
.down { color: var(--bad); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.boot, .loading { padding: 48px 16px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 16px; align-items: center; }

/* ---------------------------------------------------------------- 控件 */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid transparent;
  font: inherit; font-weight: 600; color: var(--text); background: var(--panel-2); cursor: pointer; white-space: nowrap;
}
.btn:hover { text-decoration: none; filter: brightness(1.12); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.primary { background: var(--accent); color: #fff; }
.btn.danger { background: transparent; border-color: var(--bad); color: var(--bad); }
.btn.danger:hover { background: rgba(239, 90, 95, .12); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--text); }
.btn.small { min-height: 34px; padding: 0 12px; font-size: 13px; }
.btn.block { display: flex; width: 100%; }

input, select, textarea {
  font: inherit; color: var(--text); background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  min-height: 40px; padding: 8px 12px; width: 100%; max-width: 100%;
}
textarea { resize: vertical; line-height: 1.5; }
input[type="checkbox"] { width: 18px; height: 18px; min-height: 0; padding: 0; accent-color: var(--accent); flex: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); outline: none; }

.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field-label { font-size: 13px; color: var(--muted); }
.field-hint { font-size: 12px; color: var(--muted); }
.check { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; cursor: pointer; }
.form { display: flex; flex-direction: column; gap: 14px; }
.form-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; }
.form-row.checks { display: flex; flex-wrap: wrap; gap: 4px 22px; }
.form-foot { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }
.form-error { color: var(--bad); min-height: 0; font-size: 13px; }
.form-error:empty { display: none; }

.chip { display: inline-flex; align-items: center; padding: 1px 8px; border-radius: 999px; font-size: 12px; line-height: 1.7; background: var(--panel-2); color: var(--muted); border: 1px solid var(--line); white-space: nowrap; }
.chip.good { color: var(--good); border-color: rgba(63, 185, 122, .4); background: rgba(63, 185, 122, .1); }
.chip.bad { color: var(--bad); border-color: rgba(239, 90, 95, .4); background: rgba(239, 90, 95, .1); }
.chip.gold { color: var(--gold); border-color: rgba(232, 184, 74, .4); background: rgba(232, 184, 74, .1); }
.chip.link-chip { color: var(--accent); }
.chips { display: inline-flex; flex-wrap: wrap; gap: 6px; }

/* ---------------------------------------------------------------- 登录 */
.login { min-height: 100vh; min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px; }
.login-card { width: 100%; max-width: 360px; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 28px 24px; display: flex; flex-direction: column; gap: 14px; }
.login-hint { font-size: 12px; color: var(--muted); }
.brand { display: flex; flex-direction: column; line-height: 1.3; }
.brand b { color: var(--gold); font-size: 18px; letter-spacing: 1px; }
.brand span { color: var(--muted); font-size: 12px; }

/* ---------------------------------------------------------------- 外壳 */
.shell { display: grid; grid-template-columns: 212px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { background: var(--panel); border-right: 1px solid var(--line); padding: calc(18px + var(--sat)) 12px 16px calc(12px + var(--sal)); display: flex; flex-direction: column; gap: 16px; position: sticky; top: 0; height: 100vh; height: 100dvh; }
.side .brand { padding: 0 8px; }
.nav { display: flex; flex-direction: column; gap: 2px; flex: 1; overflow-y: auto; }
.nav-link { display: flex; align-items: center; min-height: 40px; padding: 0 12px; border-radius: 8px; color: var(--muted); font-weight: 500; }
.nav-link:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.nav-link.on { background: rgba(91, 141, 239, .16); color: #fff; }
.side-foot { padding: 0 4px; }
.main { min-width: 0; padding: calc(24px + var(--sat)) calc(28px + var(--sar)) calc(48px + var(--sab)) 28px; }
.page { display: flex; flex-direction: column; gap: 18px; max-width: 1280px; }
.stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.page-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page-head h1 { font-size: 22px; line-height: 1.3; }
.sub { color: var(--muted); font-size: 13px; }
.page-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.back { font-size: 13px; align-self: flex-start; margin-top: -8px; }
.page-error { display: flex; flex-direction: column; gap: 12px; align-items: flex-start; padding: 24px 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.card-title { font-size: 15px; font-weight: 600; }
.cols { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.cols.wide-first { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }

.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.tile { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tile-label { color: var(--muted); font-size: 13px; }
.tile-value { font-size: 28px; font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.3; }
.tile-hint { color: var(--muted); font-size: 12px; }

.notice { border: 1px solid var(--line); border-left: 3px solid var(--accent); background: var(--panel-2); border-radius: 8px; padding: 10px 14px; font-size: 13px; }
.notice.warn { border-left-color: var(--gold); }
.notice.bad { border-left-color: var(--bad); }
.notice.god { border-left-color: var(--bad); background: rgba(239, 90, 95, .08); }
.notice b { color: var(--text); }

.kv { margin: 0; display: grid; grid-template-columns: 1fr; gap: 0; }
.kv-row { display: grid; grid-template-columns: 132px minmax(0, 1fr); gap: 12px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.kv-row:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.filters input[type="search"], .filters select { width: auto; flex: 1 1 180px; max-width: 280px; }
.filters input[type="date"] { width: auto; }
.inline { display: inline-flex; align-items: center; gap: 6px; color: var(--muted); }
.pager { display: flex; gap: 12px; align-items: center; justify-content: flex-end; }

.table-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); -webkit-overflow-scrolling: touch; }
.card .table-wrap { border-radius: 8px; background: transparent; }
.table { width: 100%; border-collapse: collapse; font-variant-numeric: tabular-nums; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
.table th { color: var(--muted); font-weight: 500; font-size: 13px; background: var(--panel-2); position: sticky; top: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table td.wrap { white-space: normal; min-width: 220px; overflow-wrap: anywhere; }
.table tr.clickable { cursor: pointer; }
.table tr.clickable:hover td { background: rgba(255, 255, 255, .03); }
.empty { padding: 28px 16px; text-align: center; color: var(--muted); }
.detail { display: flex; flex-direction: column; gap: 2px; font-size: 13px; }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); }
.tab { font: inherit; color: var(--muted); background: none; border: 0; border-bottom: 2px solid transparent; min-height: 40px; padding: 0 16px; cursor: pointer; font-weight: 600; margin-bottom: -1px; }
.tab.on { color: var(--text); border-bottom-color: var(--accent); }

/* 牌 */
.cards { display: inline-flex; gap: 4px; flex-wrap: wrap; vertical-align: middle; }
.pc { display: inline-flex; align-items: center; justify-content: center; gap: 1px; min-width: 34px; height: 26px; padding: 0 5px; border-radius: 5px; background: #f4f5f8; color: #14161d; font-weight: 700; font-size: 13px; line-height: 1; border: 1px solid #c9ccd6; }
.pc i { font-style: normal; font-size: 12px; }
.pc.red { color: #cf2232; }
.pc.back { background: var(--panel-2); color: var(--muted); border-color: var(--line); }
.pc.hl { box-shadow: 0 0 0 2px var(--gold); }

.hand-log { display: flex; flex-direction: column; gap: 4px; font-size: 13px; }
.street { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); }
.street:first-child { margin-top: 0; }
.act { display: flex; gap: 10px; flex-wrap: wrap; padding: 3px 0; }
.act .pos { width: 48px; color: var(--muted); }
.act .who { min-width: 96px; font-weight: 600; }
.act .what { flex: 1; min-width: 120px; }
.recent { display: flex; flex-direction: column; gap: 4px; }
.recent-row { font-size: 13px; color: var(--muted); padding: 4px 0; border-bottom: 1px dashed var(--line); }

/* ---------------------------------------------------------------- 弹窗与提示 */
.overlay { position: fixed; inset: 0; background: rgba(5, 6, 10, .66); display: flex; align-items: center; justify-content: center; padding: 16px; z-index: 50; }
.dialog { width: 100%; max-width: 460px; max-height: calc(100dvh - 32px); overflow-y: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 22px; display: flex; flex-direction: column; gap: 14px; }
.dialog-title { font-size: 17px; }
.dialog-body { display: flex; flex-direction: column; gap: 12px; }
.dialog-text { color: var(--muted); font-size: 13px; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 10px; }
.toast { position: fixed; left: 50%; bottom: calc(24px + var(--sab)); transform: translate(-50%, 20px); background: #262b3d; color: var(--text); border: 1px solid var(--line); border-radius: 10px; padding: 10px 16px; max-width: calc(100vw - 32px); opacity: 0; pointer-events: none; transition: opacity .2s, transform .2s; z-index: 60; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.good { border-color: rgba(63, 185, 122, .5); }
.toast.bad { border-color: rgba(239, 90, 95, .6); }

/* ---------------------------------------------------------------- 手机 */
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; align-items: center; gap: 8px; padding: calc(8px + var(--sat)) calc(8px + var(--sar)) 8px calc(12px + var(--sal)); border-right: 0; border-bottom: 1px solid var(--line); }
  .side .brand { padding: 0; flex: none; }
  .side .brand span { display: none; }
  .side .brand b { font-size: 15px; }
  .nav { flex-direction: row; overflow-x: auto; overflow-y: hidden; gap: 2px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav-link { min-height: 44px; flex: none; }
  .side-foot { flex: none; padding: 0; }
  .main { padding: 16px calc(14px + var(--sar)) calc(40px + var(--sab)) calc(14px + var(--sal)); }
  .cols, .cols.wide-first { grid-template-columns: minmax(0, 1fr); }
  .btn, input, select, .tab { min-height: 44px; }
  .btn.small { min-height: 40px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px 14px; }
  .tile-value { font-size: 22px; }
  .kv-row { grid-template-columns: 104px minmax(0, 1fr); }
  .filters input[type="search"], .filters select { max-width: none; }
  .page-head h1 { font-size: 20px; }
  input, select, textarea { font-size: 16px; }
}

/* 机器人页面 */
.stack { display: flex; flex-direction: column; gap: 14px; margin-top: 14px; }
.grow { flex: 1 1 auto; }
.range-value { color: var(--gold); font-size: 16px; margin-left: 6px; }
input[type="range"] { width: 100%; min-height: 32px; padding: 0; accent-color: var(--accent); background: none; border: 0; }
.range2 { display: flex; align-items: center; gap: 6px; }
.range2 input { min-width: 0; width: 100%; }
.row-actions { display: inline-flex; flex-wrap: nowrap; gap: 6px; white-space: nowrap; }
.btn.danger-text { color: var(--bad); }
.small-note { padding: 10px 2px 0; font-size: 12px; }
.stack.tight { gap: 12px; margin-top: 0; }
.gold-text { color: var(--gold); font-weight: 600; }
.live-line { display: flex; flex-wrap: wrap; gap: 4px 16px; align-items: baseline; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--panel-2); font-size: 13px; }
/* 一键预设 */
.preset-now { font-size: 14px; }
.preset-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; }
.preset { display: flex; flex-direction: column; gap: 6px; text-align: left; font: inherit; color: var(--text); background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; cursor: pointer; min-height: 150px; }
.preset:hover { border-color: var(--accent); }
.preset.on { border-color: var(--good); background: rgba(63, 185, 122, .07); }
.preset-name { font-weight: 700; font-size: 15px; display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.preset-summary { font-size: 13px; line-height: 1.5; }
.preset-when { font-size: 12px; color: var(--muted); line-height: 1.5; }
.preset-when b { color: var(--muted); font-weight: 600; }
.preset-go { margin-top: auto; padding-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent); }
.preset.on .preset-go { color: var(--good); }
/* 自动 / 手动 */
.seg { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.seg-btn { display: flex; flex-direction: column; gap: 2px; align-items: flex-start; font: inherit; font-weight: 700; color: var(--muted); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; cursor: pointer; min-height: 56px; text-align: left; }
.seg-btn small { font-weight: 400; font-size: 12px; color: var(--muted); }
.seg-btn.on { color: var(--text); border-color: var(--accent); background: rgba(91, 141, 239, .1); }
/* 人设 */
.persona-list { display: flex; flex-direction: column; }
.persona-level { display: flex; align-items: center; gap: 8px; padding: 12px 0 6px; font-size: 12px; }
.persona-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.persona-info { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; line-height: 1.4; }
.persona-info b { font-size: 14px; }
.persona-info small { font-size: 12px; }
.persona-weight { flex: 0 0 auto; display: flex; align-items: center; gap: 8px; font-size: 12px; }
.persona-weight input { width: 84px; }
.persona-pct { width: 38px; text-align: right; font-variant-numeric: tabular-nums; }
.habit-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; }
.save-bar { position: sticky; bottom: calc(8px + var(--sab)); z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 8px 14px; padding: 10px 14px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 6px 24px rgba(0, 0, 0, .35); font-size: 13px; }
.save-bar .form-error { flex: 1 1 100%; }
.share-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); gap: 10px 12px; }
.share-cell { display: flex; flex-direction: column; gap: 4px; }
@media (max-width: 760px) {
  .preset-grid { grid-template-columns: 1fr; }
  .preset { min-height: 0; }
  .persona-row { flex-wrap: wrap; gap: 6px 12px; }
  .persona-info { flex-basis: 100%; }
  .persona-weight { width: 100%; }
  .persona-weight input { flex: 1 1 auto; width: auto; }
  .save-bar { justify-content: stretch; padding: 8px 10px; }
  .save-bar .muted { display: none; }
  .save-bar .btn { flex: 1 1 auto; }
  .share-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* 「大奖」页面 */
.card-sub { color: var(--muted); font-size: 13px; font-weight: 600; margin: 14px 0 6px; }
ul.plain { margin: 0; padding-left: 18px; color: var(--text); font-size: 13px; line-height: 1.9; }
