/* ============================================================
   NEXA — shared look: brushed-steel surfaces, blue-metal accents
   ============================================================ */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&family=Space+Grotesk:wght@500;600;700&display=swap');

:root {
  --blue-950: #0a1a38;
  --blue-900: #0e2347;
  --blue-800: #15305f;
  --blue-700: #1d4285;
  --blue-600: #2753a6;
  --blue-500: #3560bb;          /* primary — the same weight TianLu's red has, turned to blue */
  --blue-400: #5b84d6;
  --blue-300: #8fabe4;
  --blue-200: #c4d3ef;
  --blue-100: #e1e8f6;
  --blue-50:  #f0f4fb;

  --steel-0:   #ffffff;
  --steel-50:  #f4f7fb;
  --steel-100: #e9eef6;
  --steel-200: #d7dfeb;
  --steel-300: #bac5d7;
  --steel-400: #96a4bb;
  --steel-500: #7684a0;
  --steel-600: #566480;
  --steel-700: #3e4a63;
  --ink:       #0f1a2e;

  --ok:   #1f8a5b;
  --warn: #c98a1d;
  --bad:  #c0392f;

  /* the metal */
  --metal-blue: linear-gradient(180deg, #7a9fe6 0%, #3d68c4 44%, #2650a2 52%, #4372cf 100%);
  --metal-blue-press: linear-gradient(180deg, #4372cf 0%, #2650a2 48%, #3d68c4 56%, #6f95e0 100%);
  --metal-chrome: linear-gradient(180deg, #ffffff 0%, #e3e9f3 46%, #cbd5e5 54%, #eef2f8 100%);
  --metal-dark: linear-gradient(180deg, #24407a 0%, #14284f 50%, #0d1c3d 52%, #1b3366 100%);
  --brushed: repeating-linear-gradient(90deg, rgba(255,255,255,.07) 0 1px, rgba(255,255,255,0) 1px 3px);
  --page: linear-gradient(135deg, #eef2f9 0%, #dde5f1 100%);

  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(16,36,80,.08), 0 2px 6px rgba(16,36,80,.06);
  --shadow-md: 0 4px 14px rgba(16,36,80,.12);
  --shadow-lg: 0 14px 40px rgba(10,26,56,.24);
  --font: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --font-head: 'Space Grotesk', 'Inter', system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; color: var(--ink);
  background: var(--page) fixed; -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 { font-family: var(--font-head); margin: 0; letter-spacing: -.01em; color: var(--blue-900); }
button, input, select, textarea { font: inherit; color: inherit; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--steel-300); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: var(--steel-400); background-clip: content-box; border: 2px solid transparent; }
.mono { font-variant-numeric: tabular-nums; font-feature-settings: 'tnum'; }
.muted { color: var(--steel-600); }
.right { text-align: right; }
.center { text-align: center; }
.hidden { display: none !important; }
.row { display: flex; align-items: center; gap: 10px; }
.grow { flex: 1; min-width: 0; }
.wrap { flex-wrap: wrap; }
.sp { justify-content: space-between; }

/* ---- logo ---- */
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-head); font-weight: 700; letter-spacing: .14em; font-size: 20px; color: var(--blue-900); }
.logo svg { display: block; }
.logo small { font: 600 10px var(--font); letter-spacing: .22em; color: var(--steel-500); display: block; margin-top: 1px; }

/* ---- buttons ---- */
.btn {
  appearance: none; cursor: pointer; border: 1px solid var(--steel-300); background: var(--metal-chrome);
  border-radius: var(--radius); padding: 9px 16px; font-weight: 600; color: var(--blue-900);
  box-shadow: 0 1px 0 #fff inset, var(--shadow-sm); transition: transform .06s, box-shadow .15s, filter .15s;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; white-space: nowrap; user-select: none;
}
.btn:hover { filter: brightness(1.03); box-shadow: 0 1px 0 #fff inset, var(--shadow-md); }
.btn:active { transform: translateY(1px) scale(.99); }
.btn:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.btn svg { width: 18px; height: 18px; flex: none; }
.btn-primary { background: var(--metal-blue); color: #fff; border-color: #1d4290; text-shadow: 0 -1px 0 rgba(0,0,0,.25); box-shadow: 0 1px 0 rgba(255,255,255,.45) inset, 0 3px 10px rgba(39,83,166,.35); }
.btn-primary:active { background: var(--metal-blue-press); }
.btn-dark { background: var(--metal-dark); color: #fff; border-color: #0b1836; text-shadow: 0 -1px 0 rgba(0,0,0,.3); }
.btn-danger { background: linear-gradient(180deg, #e0685c, #bf392e 50%, #a82d23 52%, #c9473b); color: #fff; border-color: #8f241b; }
.btn-ok { background: linear-gradient(180deg, #4ec58e, #1f8a5b 50%, #187049 52%, #2a9a69); color: #fff; border-color: #14633f; }
.btn-ghost { background: transparent; border-color: transparent; box-shadow: none; color: var(--blue-700); }
.btn-ghost:hover { background: var(--blue-100); box-shadow: none; }
.btn-sm { padding: 5px 11px; font-size: 12.5px; border-radius: 8px; }
.btn-lg { padding: 14px 22px; font-size: 16px; border-radius: 12px; }
.btn-block { width: 100%; }
.icon-btn { width: 38px; height: 38px; padding: 0; border-radius: 50%; }

/* ---- fields ---- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 12px; }
.field > label { font-size: 12px; font-weight: 600; color: var(--steel-600); text-transform: uppercase; letter-spacing: .05em; }
.input, select.input, textarea.input {
  width: 100%; border: 1px solid var(--steel-300); background: #fff; border-radius: var(--radius); padding: 9px 12px;
  box-shadow: 0 1px 2px rgba(16,36,80,.06) inset; outline: none; transition: border-color .15s, box-shadow .15s;
}
.input:focus { border-color: var(--blue-400); box-shadow: 0 0 0 3px rgba(53,96,187,.18); }
textarea.input { resize: vertical; min-height: 70px; }
.input-lg { font-size: 18px; padding: 13px 14px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-weight: 500; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-500); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 14px; }

/* ---- cards / panels ---- */
.card { background: #fff; border: 1px solid var(--steel-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--steel-200); }
.card-head h3 { font-size: 15px; }
.plate {  /* brushed metal plate used for headers */
  background: var(--metal-dark); color: #fff; position: relative;
}
.plate::after { content: ''; position: absolute; inset: 0; background: var(--brushed); pointer-events: none; }
.plate > * { position: relative; z-index: 1; }

/* ---- chips / badges ---- */
.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11.5px; font-weight: 700; background: var(--blue-100); color: var(--blue-700); white-space: nowrap; }
.badge.ok { background: #dff3ea; color: #146b45; }
.badge.warn { background: #fbefd5; color: #8a5a0c; }
.badge.bad { background: #fadfdc; color: #98281f; }
.badge.gray { background: var(--steel-100); color: var(--steel-700); }
.badge.dark { background: var(--blue-900); color: #fff; }
.badge.gold { background: linear-gradient(180deg, #f6e7b0, #e2c15f); color: #6b4e08; }
.badge.plat { background: linear-gradient(180deg, #f1f4f9, #b9c4d8); color: #2d3b57; }
.badge.silver { background: linear-gradient(180deg, #eef0f3, #cfd4dc); color: #49515f; }

/* ---- tables ---- */
.table-wrap { overflow: auto; border-radius: var(--radius-lg); }
table.t { width: 100%; border-collapse: collapse; }
table.t th { position: sticky; top: 0; background: var(--steel-100); text-align: left; font-size: 11.5px; text-transform: uppercase; letter-spacing: .06em; color: var(--steel-600); padding: 10px 12px; border-bottom: 1px solid var(--steel-200); white-space: nowrap; z-index: 1; }
table.t td { padding: 10px 12px; border-bottom: 1px solid var(--steel-100); vertical-align: middle; }
table.t tr:hover td { background: var(--blue-50); }
table.t tr.clickable { cursor: pointer; }
table.t td.num, table.t th.num { text-align: right; font-variant-numeric: tabular-nums; }
.empty { padding: 36px 16px; text-align: center; color: var(--steel-500); }

/* ---- modal ---- */
.overlay { position: fixed; inset: 0; background: rgba(10,26,56,.55); backdrop-filter: blur(3px); z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; animation: fade .15s; }
.modal { background: #fff; border-radius: 18px; width: min(520px, 100%); max-height: 92vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); border: 1px solid var(--steel-200); overflow: hidden; animation: rise .18s; }
.modal.wide { width: min(860px, 100%); }
.modal.xl { width: min(1100px, 100%); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; background: var(--metal-dark); color: #fff; position: relative; }
.modal-head::after { content: ''; position: absolute; inset: 0; background: var(--brushed); pointer-events: none; }
.modal-head h3 { color: #fff; font-size: 16px; position: relative; z-index: 1; }
.modal-head .x { position: relative; z-index: 1; background: rgba(255,255,255,.12); color: #fff; border: 0; width: 32px; height: 32px; border-radius: 50%; cursor: pointer; font-size: 18px; line-height: 1; }
.modal-body { padding: 18px; overflow: auto; }
.modal-foot { padding: 12px 18px; border-top: 1px solid var(--steel-200); display: flex; justify-content: flex-end; gap: 10px; background: var(--steel-50); }
@keyframes fade { from { opacity: 0 } }
@keyframes rise { from { transform: translateY(10px) scale(.98); opacity: 0 } }

/* ---- toast ---- */
#toasts { position: fixed; top: 14px; left: 50%; transform: translateX(-50%); z-index: 3000; display: flex; flex-direction: column; gap: 8px; align-items: center; pointer-events: none; }
.toast { background: var(--blue-900); color: #fff; padding: 10px 18px; border-radius: 12px; box-shadow: var(--shadow-lg); font-weight: 600; border-left: 4px solid var(--blue-400); animation: rise .2s; max-width: 90vw; }
.toast.ok { border-color: #3fcf8e; } .toast.bad { border-color: #ff6b5e; background: #3b1410; } .toast.warn { border-color: #f1b64a; }

kbd { font: 600 11px var(--font); background: var(--steel-100); border: 1px solid var(--steel-300); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--steel-700); }
.spinner { width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--blue-200); border-top-color: var(--blue-500); animation: spin .7s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg) } }
.login-bg { min-height: 100%; display: flex; align-items: center; justify-content: center; padding: 20px; background:
  radial-gradient(1200px 500px at 20% -10%, rgba(91,132,214,.35), transparent 60%),
  radial-gradient(900px 500px at 100% 110%, rgba(53,96,187,.30), transparent 60%), var(--page); }
.login-card { width: min(420px, 100%); background: #fff; border-radius: 22px; box-shadow: var(--shadow-lg); border: 1px solid var(--steel-200); overflow: hidden; }
.login-top { padding: 26px 26px 20px; text-align: center; }
.login-top .logo { font-size: 26px; }
@media print { body { background: #fff; } .no-print { display: none !important; } }
.plate .logo, .plate.logo { color: #fff; }
.plate .logo small { color: #a9c0ee; }
