:root {
  --bg: #0f0d0b;
  --panel: #181411;
  --panel-2: #211a15;
  --panel-3: #2a211a;
  --line: #332a22;
  --gold: #d4af37;
  --gold-soft: #f0d27a;
  --text: #efe7dc;
  --muted: #9b8d7e;
  --green: #3fb950;
  --red: #e5534b;
  --orange: #d29922;
  --blue: #4c8dff;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: radial-gradient(circle at 15% -10%, #2a1f14 0%, #0f0d0b 45%) fixed;
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
}
button, input, select, textarea { font-family: inherit; }
a { color: var(--gold-soft); text-decoration: none; }
.hidden { display: none !important; }

/* 登录 */
.login-wrap {
  min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px;
}
.login-card {
  width: 380px; max-width: 100%; background: linear-gradient(160deg, #1e1813, #14100d);
  border: 1px solid var(--line); border-radius: 18px; padding: 36px 32px;
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.login-logo { text-align: center; margin-bottom: 26px; }
.login-logo .mark {
  width: 56px; height: 56px; margin: 0 auto 12px; border-radius: 16px;
  background: linear-gradient(135deg, var(--gold), #8c6d1f);
  color: #1a1208; font-weight: 800; font-size: 24px; display: flex; align-items: center; justify-content: center;
  letter-spacing: 1px;
}
.login-logo h1 { font-size: 20px; margin: 0 0 6px; letter-spacing: 2px; }
.login-logo p { margin: 0; color: var(--muted); font-size: 12px; letter-spacing: 1px; }
.field { margin-bottom: 16px; }
.field label { display: block; color: var(--muted); font-size: 12px; margin-bottom: 7px; }
.input, .select, .textarea {
  width: 100%; background: #120f0c; border: 1px solid var(--line); color: var(--text);
  border-radius: 10px; padding: 10px 12px; outline: none; font-size: 14px;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--gold); }
.textarea { min-height: 80px; resize: vertical; }
.btn {
  border: 1px solid var(--line); background: var(--panel-2); color: var(--text);
  padding: 9px 16px; border-radius: 10px; cursor: pointer; font-size: 13px; transition: .15s;
  white-space: nowrap;
}
.btn:hover { border-color: var(--gold); color: var(--gold-soft); }
.btn-primary {
  background: linear-gradient(135deg, var(--gold), #a9852a); color: #1a1208;
  border: none; font-weight: 600;
}
.btn-primary:hover { color: #1a1208; filter: brightness(1.06); }
.btn-danger { border-color: #5a2a26; color: #ff9a92; }
.btn-danger:hover { border-color: var(--red); color: #fff; background: #3a1c19; }
.btn-sm { padding: 5px 10px; font-size: 12px; border-radius: 8px; }
.btn-block { width: 100%; padding: 12px; font-size: 15px; }
.login-tip { margin-top: 18px; color: var(--muted); font-size: 12px; line-height: 1.7; text-align: center; }

/* 布局 */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: 220px; flex: 0 0 220px; background: linear-gradient(180deg, #171310, #100d0a);
  border-right: 1px solid var(--line); padding: 22px 14px; position: sticky; top: 0; height: 100vh;
  display: flex; flex-direction: column;
}
.brand { display: flex; align-items: center; gap: 10px; padding: 0 8px 22px; }
.brand .mark {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg, var(--gold), #8c6d1f);
  color: #1a1208; font-weight: 800; display: flex; align-items: center; justify-content: center;
}
.brand b { display: block; font-size: 14px; letter-spacing: 1px; }
.brand span { font-size: 11px; color: var(--muted); letter-spacing: 1px; }
.nav { display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
.nav-item {
  padding: 10px 12px; border-radius: 9px; color: var(--muted); cursor: pointer;
  display: flex; align-items: center; gap: 10px; font-size: 13px; border: 1px solid transparent;
}
.nav-item:hover { background: var(--panel-2); color: var(--text); }
.nav-item.active { background: rgba(212,175,55,.12); color: var(--gold-soft); border-color: rgba(212,175,55,.25); }
.nav-item .ico { width: 18px; text-align: center; }
.sidebar-footer { margin-top: auto; padding-top: 16px; border-top: 1px solid var(--line); font-size: 12px; color: var(--muted); }
.sidebar-footer .who { margin-bottom: 8px; color: var(--text); }

.main { flex: 1; min-width: 0; padding: 22px 26px 40px; }
.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 18px; gap: 12px; }
.topbar h2 { margin: 0; font-size: 20px; letter-spacing: 1px; }
.topbar .sub { color: var(--muted); font-size: 12px; margin-top: 4px; }
.top-actions { display: flex; align-items: center; gap: 10px; }
.bell {
  position: relative; width: 36px; height: 36px; border-radius: 10px; border: 1px solid var(--line);
  background: var(--panel); display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.bell .dot {
  position: absolute; top: -5px; right: -5px; min-width: 17px; height: 17px; border-radius: 9px;
  background: var(--red); color: #fff; font-size: 10px; display: flex; align-items: center; justify-content: center;
  padding: 0 4px;
}
.avatar-mini {
  width: 36px; height: 36px; border-radius: 10px; background: linear-gradient(135deg,#3a2c1b,#211a15);
  border: 1px solid var(--line); display: flex; align-items: center; justify-content: center; color: var(--gold-soft);
  font-weight: 600;
}

/* 卡片 / 表格 */
.card {
  background: linear-gradient(170deg, rgba(33,26,21,.85), rgba(20,16,13,.95));
  border: 1px solid var(--line); border-radius: var(--radius); padding: 18px;
}
.card + .card { margin-top: 16px; }
.card-title { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 10px; }
.card-title h3 { margin: 0; font-size: 15px; letter-spacing: .5px; }
.card-title .hint { color: var(--muted); font-size: 12px; }
.grid { display: grid; gap: 14px; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.stat {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px;
  position: relative; overflow: hidden;
}
.stat .label { color: var(--muted); font-size: 12px; margin-bottom: 10px; }
.stat .num { font-size: 24px; font-weight: 700; letter-spacing: .5px; }
.stat .num small { font-size: 12px; font-weight: 400; color: var(--muted); margin-left: 4px; }
.stat .foot { color: var(--muted); font-size: 11px; margin-top: 8px; }
.stat::after {
  content: ""; position: absolute; right: -20px; bottom: -30px; width: 90px; height: 90px;
  background: radial-gradient(circle, rgba(212,175,55,.16), transparent 70%);
}
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 11px 10px; border-bottom: 1px solid var(--line); font-size: 13px; vertical-align: middle; }
th { color: var(--muted); font-weight: 500; font-size: 12px; white-space: nowrap; }
tr:hover td { background: rgba(255,255,255,.015); }
td .muted, .muted { color: var(--muted); }
.actions-cell { display: flex; gap: 6px; flex-wrap: wrap; }

.badge {
  display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 999px;
  font-size: 11px; border: 1px solid var(--line); color: var(--muted); white-space: nowrap;
}
.badge.green { color: #7ee787; border-color: rgba(63,185,80,.3); background: rgba(63,185,80,.08); }
.badge.gold { color: var(--gold-soft); border-color: rgba(212,175,55,.35); background: rgba(212,175,55,.08); }
.badge.red { color: #ff9a92; border-color: rgba(229,83,75,.3); background: rgba(229,83,75,.08); }
.badge.blue { color: #9cc3ff; border-color: rgba(76,141,255,.3); background: rgba(76,141,255,.08); }
.badge.orange { color: #f3c969; border-color: rgba(210,153,34,.3); background: rgba(210,153,34,.08); }

.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .input, .toolbar .select { width: auto; min-width: 130px; padding: 8px 10px; font-size: 13px; }
.toolbar .spacer { flex: 1; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tab {
  padding: 7px 13px; border-radius: 999px; border: 1px solid var(--line); background: transparent;
  color: var(--muted); cursor: pointer; font-size: 12px;
}
.tab.active { color: var(--gold-soft); border-color: rgba(212,175,55,.45); background: rgba(212,175,55,.1); }
.pager { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; align-items: center; color: var(--muted); font-size: 12px; }

/* 桌台 */
.tables-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 14px; }
.table-card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 14px; padding: 16px;
  position: relative;
}
.table-card.playing { border-color: rgba(212,175,55,.4); box-shadow: 0 0 0 1px rgba(212,175,55,.12) inset; }
.table-card.locked { opacity: .68; }
.table-card .head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 10px; }
.table-card .no { font-size: 22px; font-weight: 700; letter-spacing: 1px; }
.table-card .meta { color: var(--muted); font-size: 12px; margin-top: 4px; }
.table-card .info { font-size: 12px; color: var(--muted); line-height: 1.9; margin: 10px 0; }
.table-card .ops { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; }

/* 趋势图 */
.trend { display: flex; align-items: flex-end; gap: 12px; height: 140px; padding: 8px 4px 0; }
.trend .bar { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px; height: 100%; justify-content: flex-end; }
.trend .bar .fill {
  width: 100%; max-width: 42px; border-radius: 6px 6px 0 0; min-height: 4px;
  background: linear-gradient(180deg, var(--gold), #6f5719);
}
.trend .bar span { font-size: 10px; color: var(--muted); }
.trend .bar b { font-size: 11px; color: var(--gold-soft); font-weight: 500; }

/* 弹窗 */
.modal-mask {
  position: fixed; inset: 0; background: rgba(5,4,3,.72); backdrop-filter: blur(3px);
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; z-index: 60; overflow-y: auto;
}
.modal {
  width: 620px; max-width: 100%; background: #191410; border: 1px solid var(--line); border-radius: 16px;
  box-shadow: 0 30px 90px rgba(0,0,0,.6); animation: pop .16s ease-out;
}
.modal.wide { width: 860px; }
@keyframes pop { from { transform: translateY(8px); opacity: .6; } to { transform: none; opacity: 1; } }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { margin: 0; font-size: 16px; }
.modal-close { background: none; border: none; color: var(--muted); font-size: 20px; cursor: pointer; }
.modal-body { padding: 20px; max-height: 68vh; overflow-y: auto; }
.modal-foot { padding: 14px 20px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 10px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-grid .full { grid-column: 1 / -1; }
.form-grid label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 6px; }

/* 商品规格编辑 */
.spec-row {
  display: grid; grid-template-columns: 1.4fr .8fr .8fr .8fr .5fr .7fr auto; gap: 8px;
  align-items: center; margin-bottom: 8px;
}
.spec-row .input { padding: 8px 10px; font-size: 13px; }
.spec-head { color: var(--muted); font-size: 11px; }
.img-preview {
  width: 100%; height: 120px; border-radius: 10px; border: 1px dashed var(--line);
  display: flex; align-items: center; justify-content: center; color: var(--muted); font-size: 12px;
  background-size: cover; background-position: center; overflow: hidden;
}
.img-preview img { width: 100%; height: 100%; object-fit: cover; }

/* 通知面板 */
.notice-item { padding: 12px 0; border-bottom: 1px solid var(--line); }
.notice-item:last-child { border-bottom: none; }
.notice-item .t { display: flex; justify-content: space-between; gap: 10px; margin-bottom: 5px; }
.notice-item .t b { font-size: 13px; }
.notice-item .t span { color: var(--muted); font-size: 11px; }
.notice-item p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.7; }

/* toast */
#toasts { position: fixed; right: 20px; top: 20px; display: flex; flex-direction: column; gap: 10px; z-index: 100; }
.toast {
  min-width: 220px; max-width: 340px; padding: 12px 16px; border-radius: 10px; font-size: 13px;
  background: #221b14; border: 1px solid var(--line); color: var(--text); box-shadow: 0 12px 30px rgba(0,0,0,.4);
  animation: slidein .2s ease-out;
}
.toast.success { border-color: rgba(63,185,80,.5); }
.toast.error { border-color: rgba(229,83,75,.55); }
@keyframes slidein { from { transform: translateX(20px); opacity: 0; } to { transform: none; opacity: 1; } }

.empty { padding: 36px 10px; text-align: center; color: var(--muted); font-size: 13px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn:disabled:hover { border-color: var(--line); color: var(--text); }
.hint { color: var(--muted); font-size: 12px; }
.mono { font-family: ui-monospace, Consolas, "Courier New", monospace; font-size: 12px; }
.ellipsis { display: inline-block; max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; vertical-align: middle; }
.thumb { width: 36px; height: 36px; border-radius: 8px; object-fit: cover; border: 1px solid var(--line); background: var(--panel-3); flex: 0 0 36px; }
.thumb-ph { display: inline-flex; align-items: center; justify-content: center; color: var(--muted); font-size: 10px; }
.cell-main { display: flex; align-items: center; gap: 8px; }
.upload-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; }
.upload-line input[type="file"] { max-width: 200px; color: var(--muted); font-size: 12px; }
.form-grid.one { grid-template-columns: 1fr; }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
.split { display: grid; grid-template-columns: 1.2fr .8fr; gap: 16px; }
.split > .card + .card { margin-top: 0; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 8px 12px; font-size: 13px; }
.kv .k { color: var(--muted); }
.detail-list { display: flex; flex-direction: column; gap: 6px; }
.detail-row { display: flex; justify-content: space-between; font-size: 13px; padding: 7px 0; border-bottom: 1px dashed var(--line); }
.detail-row span { color: var(--muted); }
.chip { padding: 2px 8px; border-radius: 6px; background: var(--panel-3); font-size: 11px; color: var(--muted); margin-right: 4px; }

@media (max-width: 1100px) {
  .stats { grid-template-columns: repeat(3, minmax(0,1fr)); }
  .split { grid-template-columns: 1fr; }
}
@media (max-width: 800px) {
  .sidebar { position: fixed; left: -240px; z-index: 50; transition: .2s; }
  .sidebar.open { left: 0; }
  .main { padding: 16px; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .form-grid { grid-template-columns: 1fr; }
  .spec-row { grid-template-columns: 1fr 1fr; }
}
