:root {
  --navy: #0f2432;
  --navy-2: #1b3a4b;
  --gold: #b8975a;
  --gold-soft: #efe6d4;
  --cream: #fbf9f5;
  --paper: #ffffff;
  --line: #e6e1d6;
  --text: #17272f;
  --muted: #6d7c85;
  --ok: #2f7d5d;
  --ok-soft: #e8f3ed;
  --warn: #a86a1c;
  --warn-soft: #fbf1e2;
  --danger: #a2412f;
  --danger-soft: #fbeae6;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(15, 36, 50, .06), 0 8px 24px rgba(15, 36, 50, .05);
}

* { box-sizing: border-box; }

.hidden { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--cream);
  color: var(--text);
  font-family: "PingFang SC", "Microsoft YaHei", "Hiragino Sans GB", "Source Han Sans SC", system-ui, -apple-system, sans-serif;
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

a { color: var(--navy-2); }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: .01em; }
p { margin: 0; }

.brand { display: flex; align-items: center; gap: 10px; }
.brand img { width: 34px; height: 34px; object-fit: contain; }
.brand-txt { line-height: 1.15; }
.brand-txt b { display: block; font-size: 15px; letter-spacing: .12em; color: var(--navy); }
.brand-txt span { font-size: 10px; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }

.card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border: 1px solid var(--line);
  background: var(--paper);
  color: var(--text);
  padding: 9px 16px;
  border-radius: 10px;
  font-size: 14px;
  font-family: inherit;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease, transform .05s ease;
  white-space: nowrap;
}
.btn:hover { background: #f6f3ec; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary {
  background: var(--navy);
  border-color: var(--navy);
  color: #fff;
}
.btn-primary:hover { background: var(--navy-2); }
.btn-gold {
  background: linear-gradient(180deg, #c8a869, #b8975a);
  border-color: #ab8c50;
  color: #fff;
}
.btn-gold:hover { background: #b8975a; }
.btn-ghost { background: transparent; }
.btn-sm { padding: 6px 11px; font-size: 13px; border-radius: 8px; }
.btn-lg { padding: 15px 22px; font-size: 17px; border-radius: 12px; width: 100%; }
.btn-danger { color: var(--danger); border-color: #e7cfc9; }
.btn-danger:hover { background: var(--danger-soft); }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  background: #f0ede5;
  color: var(--muted);
  white-space: nowrap;
}
.pill.open { background: var(--ok-soft); color: var(--ok); }
.pill.pending { background: var(--warn-soft); color: var(--warn); }
.pill.closed { background: #eceff1; color: #61707a; }
.pill.gold { background: var(--gold-soft); color: #8a6d31; }
.pill.danger { background: var(--danger-soft); color: var(--danger); }

.field { display: flex; flex-direction: column; gap: 6px; }
.field > label { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.field .hint { font-size: 12px; color: var(--muted); }
input[type=text], input[type=password], input[type=number], input[type=datetime-local],
input[type=search], select, textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  font-family: inherit;
  font-size: 14.5px;
  color: var(--text);
  outline: none;
  transition: border-color .15s ease, box-shadow .15s ease;
}
input:focus, select:focus, textarea:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 3px rgba(184, 151, 90, .14);
}
textarea { resize: vertical; min-height: 90px; line-height: 1.5; }

.table-wrap { overflow: auto; border: 1px solid var(--line); border-radius: 12px; background: #fff; }
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #f0ece3; vertical-align: middle; }
th:last-child, td:last-child { padding-right: 16px; }
th { background: #f7f4ee; font-weight: 600; color: #41525c; font-size: 12.5px; white-space: nowrap; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fcfaf6; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.strong { font-weight: 600; }
.nowrap { white-space: nowrap; }
.truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.modal-mask {
  position: fixed; inset: 0; background: rgba(15, 36, 50, .42);
  display: flex; align-items: center; justify-content: center; padding: 18px;
  z-index: 60;
}
.modal {
  background: #fff; border-radius: 16px; width: min(560px, 100%);
  max-height: 88vh; overflow: auto; box-shadow: 0 24px 60px rgba(15, 36, 50, .22);
}
.modal header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: #fff; z-index: 2;
}
.modal header h3 { font-size: 16px; }
.modal .body { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; }
.modal footer {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid var(--line);
  position: sticky; bottom: 0; background: #fff;
}
.x-btn { border: 0; background: transparent; font-size: 20px; line-height: 1; color: var(--muted); cursor: pointer; }

.toast-wrap { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 90; display: flex; flex-direction: column; gap: 8px; align-items: center; }
.toast {
  background: var(--navy); color: #fff; padding: 10px 18px; border-radius: 999px;
  font-size: 13.5px; box-shadow: 0 10px 26px rgba(15, 36, 50, .28); max-width: 88vw;
}
.toast.err { background: var(--danger); }

.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: 10px; }
.kpi { background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; }
.kpi .k { font-size: 12px; color: var(--muted); }
.kpi .v { font-size: 24px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.kpi .v small { font-size: 12px; font-weight: 500; color: var(--muted); margin-left: 3px; }

.bar-row { display: grid; grid-template-columns: 74px 1fr 74px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 8px; background: #f0ece3; border-radius: 999px; overflow: hidden; }
.bar > i { display: block; height: 100%; background: var(--gold); border-radius: 999px; }

.empty { padding: 30px 16px; text-align: center; color: var(--muted); font-size: 13.5px; }

.note-link {
  border: 0; background: none; padding: 0; margin-top: 2px;
  font-size: 12px; color: var(--navy-2); cursor: pointer;
  border-bottom: 1px dashed rgba(27, 58, 75, .35);
}
.note-link:hover { color: var(--gold); border-bottom-color: var(--gold); }
