/* 签发台 · License Console
 * Direction: an engineered issuing console — steel rail, ink content, indigo
 * actions, brass "seal" accent for the issued/authorized state. Machine
 * identifiers (InstallId, serial, grants, codes) are set in mono throughout,
 * because identity is what this tool is about.
 */
:root {
  --ink:      #1a2230;   /* text */
  --ink-soft: #5a6675;   /* secondary text */
  --steel:    #232e42;   /* rail / structural dark */
  --steel-2:  #2f3d57;   /* rail hover */
  --paper:    #eceff4;   /* app background */
  --surface:  #ffffff;   /* cards */
  --line:     #dbe1ea;   /* hairlines */
  --line-2:   #eef1f6;   /* faint fills */
  --accent:   #3457d5;   /* primary action / links (indigo) */
  --accent-d: #2843ab;
  --seal:     #b6862c;   /* brass — the "issued / sealed" signal */
  --seal-d:   #8f6a1f;
  --ok-bg:#eef7f0; --ok-fg:#1f7a3d;
  --warn-bg:#fbf3e2; --warn-fg:#996515;
  --bad-bg:#fdecec; --bad-fg:#b3261e;

  --mono: "SF Mono", "JetBrains Mono", ui-monospace, "Cascadia Code", Consolas, monospace;
  --sans: "Inter", system-ui, -apple-system, "PingFang SC", "Microsoft YaHei", sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(26,34,48,.04), 0 6px 20px rgba(26,34,48,.06);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin:0; font-family:var(--sans); color:var(--ink); background:var(--paper);
       font-size:14px; line-height:1.55; }
a { color:var(--accent); text-decoration:none; }
a:hover { color:var(--accent-d); }

/* ---------- shell: rail + main ---------- */
.shell { display:flex; min-height:100vh; }

.rail { width:236px; flex:0 0 236px; background:var(--steel); color:#cdd5e2;
        display:flex; flex-direction:column; position:sticky; top:0; height:100vh; }
.mark { display:flex; align-items:center; gap:12px; padding:22px 20px 18px; }
.mark-badge { display:grid; place-items:center; width:34px; height:34px; border-radius:8px;
        background:linear-gradient(160deg,var(--seal),var(--seal-d)); color:#fff;
        font-weight:800; letter-spacing:.5px; font-size:14px;
        box-shadow: inset 0 1px 0 rgba(255,255,255,.25); }
.mark-badge.lg { width:46px; height:46px; font-size:18px; border-radius:10px; }
.mark-word { display:flex; flex-direction:column; font-weight:700; font-size:17px;
        color:#fff; letter-spacing:2px; line-height:1.1; }
.mark-word small { font-size:9px; letter-spacing:2.5px; color:#7d8aa2; font-weight:600;
        margin-top:3px; }

.rail-nav { display:flex; flex-direction:column; padding:8px 12px; gap:2px; flex:1; }
.rail-nav a { display:flex; align-items:center; gap:11px; padding:9px 12px; border-radius:8px;
        color:#b7c0d0; font-size:14px; position:relative; }
.rail-nav a .ico { width:18px; text-align:center; opacity:.75; font-size:13px; }
.rail-nav a:hover { background:var(--steel-2); color:#fff; }
.rail-nav a.active { background:var(--steel-2); color:#fff; }
.rail-nav a.active::before { content:""; position:absolute; left:0; top:8px; bottom:8px;
        width:3px; border-radius:3px; background:var(--seal); }

.rail-foot { border-top:1px solid rgba(255,255,255,.08); padding:14px 20px;
        display:flex; align-items:center; justify-content:space-between; gap:8px; }
.who { display:flex; flex-direction:column; line-height:1.25; }
.who-name { color:#fff; font-weight:600; font-size:13px; }
.who-role { color:#7d8aa2; font-size:11px; letter-spacing:1px; }
.linkbtn { background:none; border:1px solid rgba(255,255,255,.18); color:#b7c0d0;
        cursor:pointer; font-size:12px; padding:5px 10px; border-radius:6px; }
.linkbtn:hover { border-color:rgba(255,255,255,.4); color:#fff; }

.main { flex:1; min-width:0; padding:30px 44px; max-width:1400px; }

/* ---------- page header ---------- */
.eyebrow { font-size:11px; letter-spacing:2.5px; text-transform:uppercase;
        color:var(--seal-d); font-weight:700; margin:0 0 6px; }
h1 { font-size:23px; margin:0 0 20px; letter-spacing:-.2px; font-weight:700; }
h2 { font-size:15px; margin:0 0 12px; letter-spacing:.2px; }
.row { display:flex; align-items:center; gap:14px; }
.spacer { flex:1; }

/* ---------- cards ---------- */
.card { background:var(--surface); border:1px solid var(--line); border-radius:var(--radius);
        padding:24px 26px; box-shadow:var(--shadow); }
.card + .card { margin-top:20px; }
.card.narrow { max-width:460px; }
hr { border:none; border-top:1px solid var(--line); margin:22px 0; }

/* ---------- tables ---------- */
table { width:100%; border-collapse:collapse; font-size:13.5px; }
thead th { text-align:left; padding:0 12px 10px; color:var(--ink-soft);
        font-weight:600; font-size:11px; letter-spacing:1.2px; text-transform:uppercase;
        border-bottom:1px solid var(--line); }
tbody td { padding:12px; border-bottom:1px solid var(--line-2); vertical-align:middle; }
tbody tr:hover { background:var(--line-2); }
/* Layout-based fit: let long values wrap instead of forcing the table wider
   than its container, so the page body never scrolls horizontally. */
td .mono, td.mono { overflow-wrap:anywhere; }
td code { overflow-wrap:anywhere; }
table.kv th { width:150px; text-align:left; padding:9px 12px 9px 0; color:var(--ink-soft);
        font-weight:600; vertical-align:top; border:none; text-transform:none;
        letter-spacing:0; font-size:13px; }
table.kv td { border:none; padding:9px 0; }

/* ---------- buttons ---------- */
.btn, button[type=submit]:not(.act):not(.tagx), button:not(.linkbtn):not(.act):not(.tagx) {
        background:var(--accent); color:#fff; border:none; border-radius:8px;
        padding:9px 18px; font-size:14px; font-weight:600; cursor:pointer;
        font-family:var(--sans); display:inline-block; transition:background .12s; }
.btn:hover, button[type=submit]:not(.act):not(.tagx):hover, button:not(.linkbtn):not(.act):not(.tagx):hover {
        background:var(--accent-d); color:#fff; }
button.danger { background:var(--bad-fg); }
button.danger:hover { background:#8f1d17; }

/* in-table action: looks like a plain text link, not a chunky button */
.act { background:none; border:none; color:var(--accent); cursor:pointer;
        font:inherit; padding:0; }
.act:hover { color:var(--accent-d); text-decoration:underline; }
td form { margin:0; }
/* action cell: several text-link actions spaced apart; wrap on narrow widths
   so they never force the table wider than its container. */
.actions { display:flex; align-items:center; flex-wrap:wrap; gap:8px 14px; }

/* ---------- forms ---------- */
label { display:block; margin:14px 0; font-size:13px; font-weight:600; color:var(--ink); }
input:not([type=radio]):not([type=checkbox]), textarea {
        width:100%; padding:10px 12px; border:1px solid var(--line);
        border-radius:8px; font-size:14px; margin-top:6px; font-family:var(--sans);
        color:var(--ink); background:#fff; font-weight:400; }
input:focus, textarea:focus { outline:none; border-color:var(--accent);
        box-shadow:0 0 0 3px rgba(52,87,213,.14); }
/* radio group (角色选择) */
#id_role { margin-top:6px; }
#id_role label { display:flex; align-items:center; gap:8px; font-weight:400;
        margin:8px 0; cursor:pointer; }
#id_role input[type=radio] { width:auto; margin:0; accent-color:var(--accent); }
textarea.mono, .mono textarea { font-family:var(--mono); }
::placeholder { color:#9aa4b2; }
.help, form p .helptext, .helptext { color:var(--ink-soft); font-size:12px; }

/* ---------- identity typography (the signature) ---------- */
.mono { font-family:var(--mono); }
.mono.big { font-size:20px; letter-spacing:1px; }
code { font-family:var(--mono); background:var(--line-2); padding:2px 7px;
        border-radius:5px; font-size:12px; color:#33405a; border:1px solid var(--line); }

/* serial as a brass seal chip */
.seal { display:inline-flex; align-items:center; gap:5px; font-family:var(--mono);
        font-weight:700; color:var(--seal-d); background:#faf4e6;
        border:1px solid #ecdcb4; border-radius:999px; padding:3px 12px; font-size:13px; }
.seal::before { content:"№"; opacity:.7; font-weight:600; }

/* ---------- status badges ---------- */
.badge { display:inline-block; padding:3px 11px; border-radius:999px; font-size:12px;
        font-weight:600; letter-spacing:.3px; }
.badge.pending  { background:var(--warn-bg); color:var(--warn-fg); }
.badge.issued   { background:var(--ok-bg);   color:var(--ok-fg); }
.badge.rejected { background:var(--bad-bg);  color:var(--bad-fg); }

/* tags */
.tagchip { display:inline-flex; align-items:center; gap:4px; background:var(--line-2);
        border:1px solid var(--line); color:#3a4658; border-radius:999px;
        padding:2px 10px; font-size:12px; margin:0 4px 5px 0; }
a.tagchip:hover { border-color:var(--accent); color:var(--accent); text-decoration:none; }
a.tagchip.on { background:var(--accent); color:#fff; border-color:var(--accent); }
.tagx { background:none; border:none; color:var(--ink-soft); cursor:pointer;
        font-size:12px; line-height:1; padding:0; margin-left:3px; }
.tagx:hover { color:var(--bad-fg); }

/* search bar */
.searchbar { display:flex; align-items:center; gap:8px; margin:-4px 0 16px; }
/* !important beats the generic input/button rules (their :not() chains outrank
   .searchbar), so search box and button share an identical 40px box. */
.searchbar input { margin:0 !important; max-width:360px;
        height:40px !important; padding:0 12px !important; }
.searchbar button { height:40px !important; padding:0 18px !important;
        display:inline-flex; align-items:center; justify-content:center; }

.muted { color:var(--ink-soft); }
.small { font-size:12px; }
.error { color:var(--bad-fg); background:var(--bad-bg); padding:9px 12px;
        border-radius:8px; font-size:13px; }
.filter { font-size:13px; color:var(--ink-soft); margin:-6px 0 18px; }
.filter a { margin:0 2px; }

/* ---------- messages ---------- */
.messages { list-style:none; padding:0; margin:0 0 20px; }
.messages li { padding:11px 15px; border-radius:8px; margin-bottom:8px; font-size:13.5px;
        border:1px solid transparent; }
.messages li.success { background:var(--ok-bg); color:var(--ok-fg); border-color:#cfe8d6; }
.messages li.error   { background:var(--bad-bg); color:var(--bad-fg); border-color:#f4cdca; }

/* empty state */
.muted.empty, td.muted { color:#9aa4b2; }

/* ---------- login ---------- */
.auth-bg { position:relative; min-height:100vh; display:grid; place-items:center;
        padding:24px 24px 60px;
        background:
          radial-gradient(1200px 600px at 70% -10%, #2f3d57 0%, transparent 60%),
          var(--steel); }
/* Pinned to the viewport floor so it never disturbs the centered card. */
.beian { position:absolute; left:0; right:0; bottom:20px; padding:0 16px;
        display:flex; flex-wrap:wrap; gap:6px 20px; justify-content:center;
        font-size:12px; }
.beian a { color:#8b97a9; }
.beian a:hover { color:#cdd5e2; }
.auth-card { width:100%; max-width:380px; background:var(--surface);
        border-radius:14px; padding:34px 32px; box-shadow:0 20px 60px rgba(0,0,0,.35); }
.auth-mark { display:flex; align-items:center; gap:14px; margin-bottom:26px; }
.auth-title { font-size:22px; font-weight:700; letter-spacing:2px; line-height:1.1; }
.auth-sub { font-size:10px; letter-spacing:3px; color:var(--ink-soft); font-weight:600;
        margin-top:5px; }
.auth-card button { width:100%; margin-top:6px; padding:11px; }
.auth-foot { text-align:center; color:var(--ink-soft); font-size:12px; margin:22px 0 0; }
.auth-messages { max-width:380px; width:100%; }

/* ---------- dialogs ---------- */
dialog.dlg { border:none; border-radius:12px; padding:0; width:min(420px,92vw);
        box-shadow:0 24px 70px rgba(26,34,48,.4); color:var(--ink); }
dialog.dlg::backdrop { background:rgba(26,34,48,.45); backdrop-filter:blur(2px); }
dialog.dlg form { padding:24px 26px; }
dialog.dlg .dlgpad { padding:24px 26px; }
dialog.dlg .dlgpad form { padding:0; }  /* inner tag forms not re-padded */
dialog.dlg h2 { margin:0 0 14px; font-size:17px; }
.dlg-actions { display:flex; justify-content:flex-end; align-items:center; gap:12px;
        margin-top:22px; }
/* cancel: same size as the primary button, but outlined/secondary */
.dlg-actions .linkbtn { padding:9px 18px; font-size:14px; font-weight:600;
        border-radius:8px; background:#fff; border:1px solid var(--line);
        color:var(--ink-soft); }
.dlg-actions .linkbtn:hover { border-color:var(--ink-soft); color:var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 760px) {
  .shell { flex-direction:column; }
  .rail { width:100%; height:auto; position:static; flex-direction:row;
          flex-wrap:wrap; align-items:center; }
  .mark { padding:14px 16px; }
  .rail-nav { flex-direction:row; flex-wrap:wrap; flex:1 1 100%; padding:0 8px 8px; }
  .rail-nav a.active::before { display:none; }
  .rail-foot { border-top:none; }
  .main { padding:20px 16px; }
}
