:root {
  font-family: "Microsoft YaHei UI", "PingFang SC", sans-serif;
  color: #eaf2ee;
  background: #061916;
  --gold: #d8b562;
  --line: rgba(218, 186, 110, .18);
  --muted: #789087;
  --panel: rgba(8, 37, 32, .88);
}

* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; }
[hidden] { display: none !important; }

.backdrop {
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    radial-gradient(circle at 85% 5%, #175548 0, transparent 34%),
    radial-gradient(circle at 0 80%, #3a2416 0, transparent 30%),
    linear-gradient(145deg, #041512, #082b25);
}

.shell { width: min(1280px, calc(100% - 36px)); margin: auto; }
.topbar { min-height: 84px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); }
.topbar small, .kicker, .panel-head small { font-size: 9px; letter-spacing: .24em; color: #9a7d42; }
.topbar h1 { margin: 5px 0 0; font: 500 22px/1 serif; letter-spacing: .12em; }
.top-actions { display: flex; align-items: center; gap: 14px; color: var(--muted); font-size: 12px; }

button, input, select { font: inherit; }
button { cursor: pointer; }
label { display: grid; gap: 7px; color: #9eaaa5; font-size: 12px; }
input, select {
  width: 100%;
  border: 1px solid rgba(255, 255, 255, .13);
  border-radius: 2px;
  outline: none;
  background: #071d19;
  color: #edf3ef;
  padding: 12px 13px;
}
input:focus, select:focus { border-color: #ad8f4e; }

.primary, .danger, .ghost {
  border: 1px solid transparent;
  padding: 11px 16px;
  color: #10221d;
  background: linear-gradient(135deg, #e3c475, #ad873b);
  font-weight: 700;
}
.danger { background: rgba(156, 60, 48, .17); color: #ef9d92; border-color: rgba(225, 112, 96, .35); }
.ghost { background: transparent; color: #aebbb6; border-color: rgba(255, 255, 255, .14); }

.auth-card {
  width: min(460px, 100%);
  margin: 70px auto;
  padding: 36px;
  border: 1px solid var(--line);
  background: var(--panel);
  box-shadow: 0 24px 80px rgba(0, 0, 0, .35);
}
.auth-card h2 { margin: 12px 0; font: 500 34px serif; }
.auth-card p { color: var(--muted); line-height: 1.8; font-size: 13px; }
.auth-card form { display: grid; gap: 15px; margin-top: 25px; }

#dashboard { padding: 28px 0 50px; }
.identity-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  background: rgba(5, 27, 23, .6);
}
.identity-row div { display: flex; flex-direction: column; gap: 4px; }
.identity-row small { color: var(--muted); font-size: 10px; }

.summary-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.summary-grid article { min-height: 116px; padding: 22px; border: 1px solid var(--line); background: var(--panel); }
.summary-grid small { display: block; color: var(--muted); font-size: 11px; }
.summary-grid strong { display: inline-block; margin-top: 15px; color: #f0d68f; font: 500 28px/1 monospace; }
.summary-grid span { margin-left: 7px; color: #7c9188; font-size: 10px; }

.warning { margin: 14px 0; padding: 13px 16px; border: 1px solid rgba(225, 112, 96, .28); background: rgba(119, 42, 35, .16); color: #e4a098; font-size: 12px; }
.work-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.panel { margin-top: 14px; padding: 22px; border: 1px solid var(--line); background: var(--panel); }
.panel-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 18px; }
.panel-head h2 { margin: 5px 0 0; font: 500 22px serif; letter-spacing: .08em; }
.panel-head p { margin: 0; color: var(--muted); font-size: 11px; }
.compact-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.compact-form .wide { grid-column: 1 / -1; }
.inline-form { display: grid; grid-template-columns: 1fr 1fr 2fr auto; gap: 10px; }
#manual-entry-form { grid-template-columns: 1.2fr .7fr 1fr 1.4fr 2fr auto; }

.orders { display: grid; gap: 9px; }
.order-card { display: grid; grid-template-columns: 1.2fr 1fr 1fr 1.2fr auto; align-items: center; gap: 14px; padding: 14px; border: 1px solid rgba(255, 255, 255, .08); background: #071c18; }
.order-card small { display: block; margin-bottom: 5px; color: var(--muted); font-size: 9px; }
.order-card b, .order-card span { font-size: 12px; }
.order-card .amount { color: #e7cd86; font: 600 16px monospace; }
.order-actions { display: flex; gap: 7px; }
.order-actions button { padding: 8px 10px; }
.account-actions { display: flex; gap: 6px; flex-wrap: wrap; min-width: 210px; }
.account-actions button { padding: 6px 8px; font-size: 11px; }
button:disabled { cursor: not-allowed; opacity: .42; }
.credential-panel { border-color: rgba(213, 178, 99, .25); }
.reset-dialog { color: #e8eee9; background: #0b211d; border: 1px solid rgba(213, 178, 99, .35); }
.reset-dialog::backdrop { background: rgba(0, 0, 0, .72); }
.reset-dialog form { display: grid; gap: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; }
.empty { padding: 30px; text-align: center; color: #657e75; border: 1px dashed rgba(255, 255, 255, .1); }

.table-wrap { overflow: auto; border: 1px solid rgba(255, 255, 255, .07); }
table { width: 100%; min-width: 1120px; border-collapse: collapse; }
.account-table { min-width: 960px; }
.order-table { min-width: 900px; }
th, td { padding: 11px 10px; text-align: left; white-space: nowrap; border-bottom: 1px solid rgba(255, 255, 255, .065); font-size: 10px; }
th { position: sticky; top: 0; background: #09251f; color: #99aba4; font-weight: 500; }
td { color: #cbd6d1; }
td.plus { color: #7ccfa1; }
td.minus { color: #ef8b80; }

.reconcile { margin-bottom: 10px; }
.reconcile.good, .reconcile.bad { padding: 11px 13px; font-size: 11px; }
.reconcile.good { border: 1px solid rgba(83, 184, 125, .3); color: #82d1a3; }
.reconcile.bad { border: 1px solid rgba(225, 112, 96, .3); color: #ee968a; }
.audit-list { display: grid; gap: 6px; }
.audit-item { display: grid; grid-template-columns: 150px 150px 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid rgba(255, 255, 255, .06); font-size: 10px; }
.audit-item time, .audit-item span { color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 26px; z-index: 10; transform: translate(-50%, 30px); opacity: 0; padding: 11px 18px; background: #e3c475; color: #17211d; font-size: 12px; font-weight: 700; transition: .2s; pointer-events: none; }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
footer { padding: 30px 0 45px; text-align: center; color: #526b62; font-size: 9px; letter-spacing: .08em; }

@media (max-width: 900px) {
  .summary-grid { grid-template-columns: 1fr 1fr; }
  .work-grid { grid-template-columns: 1fr; }
  .inline-form { grid-template-columns: 1fr 1fr; }
  #manual-entry-form { grid-template-columns: 1fr 1fr; }
  .inline-form input:nth-of-type(2) { grid-column: 1 / -1; }
  .order-card { grid-template-columns: 1fr 1fr; }
  .order-actions { grid-column: 1 / -1; }
  .panel-head { align-items: start; gap: 10px; }
}

@media (max-width: 560px) {
  .shell { width: min(100% - 22px, 1280px); }
  .topbar { min-height: 70px; }
  .topbar h1 { font-size: 18px; }
  .top-actions span { display: none; }
  .auth-card { margin: 30px auto; padding: 24px; }
  .summary-grid { gap: 8px; }
  .summary-grid article { min-height: 100px; padding: 16px; }
  .summary-grid strong { font-size: 22px; }
  .panel { padding: 15px; }
  .compact-form, .inline-form { grid-template-columns: 1fr; }
  .compact-form .wide, .inline-form input:nth-of-type(2) { grid-column: auto; }
  .order-card { grid-template-columns: 1fr 1fr; padding: 12px; }
  .audit-item { grid-template-columns: 1fr; }
  .panel-head p { display: none; }
}
