/* ============================================================
   DEEP SHIFT Archive V2.1.1 — admin UI.
   Visual system reused from the Research Hub V2.0 design tokens:
   graphite · warm black · low-saturation blue-grey · state colours
   only as small dots/tints. Dark default + light mode.
   ============================================================ */
:root {
  --bg: #121211; --bg1: #161615; --bg2: #1a1a19; --bg3: #20201e; --bg4: #272725;
  --line: rgba(255,255,255,.065); --line2: rgba(255,255,255,.1); --line3: rgba(255,255,255,.16);
  --tx: #e8e6e1; --tx2: #b3b1aa; --tx3: #8d8b84; --tx4: #6f6d67;
  --acc: #8ea3b8; --acc-bg: rgba(142,163,184,.11); --acc-line: rgba(142,163,184,.38);
  --hover: rgba(255,255,255,.035); --press: rgba(255,255,255,.06);
  --g: #84ab8f; --b: #86a3c6; --a: #c9a66b; --r: #c97f75; --n: #8b8983;
  --g-bg: rgba(132,171,143,.12); --b-bg: rgba(134,163,198,.12); --a-bg: rgba(201,166,107,.12); --r-bg: rgba(201,127,117,.12); --n-bg: rgba(255,255,255,.045);
  --solid-bg: #e6e4df; --solid-tx: #141413;
  --shadow: 0 12px 32px rgba(0,0,0,.38), 0 0 0 1px rgba(255,255,255,.06);
  --r1: 4px; --r2: 6px; --r3: 8px;
  --side: 224px;
  --sans: Inter, "SF Pro Text", -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Hiragino Sans GB", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, Consolas, "Noto Sans Mono CJK SC", monospace;
  color-scheme: dark;
}
html.light {
  --bg: #f3f2ee; --bg1: #ecebe6; --bg2: #fbfaf7; --bg3: #ffffff; --bg4: #e6e4de;
  --line: rgba(28,27,22,.08); --line2: rgba(28,27,22,.13); --line3: rgba(28,27,22,.2);
  --tx: #1b1b19; --tx2: #4d4c46; --tx3: #66645d; --tx4: #8a8880;
  --acc: #4f667d; --acc-bg: rgba(79,102,125,.09); --acc-line: rgba(79,102,125,.35);
  --hover: rgba(28,27,22,.035); --press: rgba(28,27,22,.06);
  --g: #4c7a59; --b: #4a6e98; --a: #8a6526; --r: #a5564c; --n: #7b7972;
  --g-bg: rgba(76,122,89,.1); --b-bg: rgba(74,110,152,.1); --a-bg: rgba(148,112,47,.11); --r-bg: rgba(165,86,76,.1); --n-bg: rgba(28,27,22,.05);
  --solid-bg: #1d1d1b; --solid-tx: #f6f5f1;
  --shadow: 0 12px 32px rgba(40,36,28,.14), 0 0 0 1px rgba(28,27,22,.08);
  color-scheme: light;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body { background: var(--bg); color: var(--tx); font: 13px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
button:disabled { cursor: default; opacity: .45; }
ul, ol { list-style: none; }
a { color: var(--acc); text-decoration: none; } a:hover { text-decoration: underline; }
.linklike { cursor: pointer; display: inline-block; margin-top: 10px; }
[hidden] { display: none !important; }
.mono { font-family: var(--mono); letter-spacing: .01em; }
.mute { color: var(--tx3); }
.sm { font-size: 11.5px; }
:focus-visible { outline: 1.5px solid var(--acc-line); outline-offset: 1px; }
*::-webkit-scrollbar { width: 10px; height: 10px; }
*::-webkit-scrollbar-thumb { background: var(--line2); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
* { scrollbar-width: thin; scrollbar-color: var(--line2) transparent; }

/* ---------- layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0,1fr); height: 100vh; height: 100dvh; }
#side { background: var(--bg1); border-right: 1px solid var(--line); display: flex; flex-direction: column; padding: 14px 10px 10px; overflow: hidden auto; min-width: 0; }
#col { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
#main { flex: 1; overflow: auto; min-width: 0; position: relative; }
.brand { display: flex; align-items: center; gap: 10px; padding: 2px 6px 14px; }
.brand-t { display: flex; flex-direction: column; line-height: 1.15; min-width: 0; }
.brand-t b { font: 600 12.5px/1.2 var(--mono); letter-spacing: .16em; }
.brand-t span { font: 9.5px/1.4 var(--mono); letter-spacing: .2em; color: var(--tx3); margin-top: 2px; }
.nav { display: flex; flex-direction: column; gap: 1px; }
.nav-i { display: flex; align-items: center; gap: 10px; height: 30px; padding: 0 9px; border-radius: var(--r2); color: var(--tx2); white-space: nowrap; position: relative; }
.nav-i:hover { background: var(--hover); color: var(--tx); text-decoration: none; }
.nav-i.active { background: var(--press); color: var(--tx); }
.nav-i.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 2px; border-radius: 2px; background: var(--acc); }
.nav-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.side-foot { display: flex; align-items: center; gap: 2px; padding: 10px 2px 0; margin-top: auto; border-top: 1px solid var(--line); }
.who { flex: 1; min-width: 0; padding-left: 6px; }
.who-n { font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.who-r { font-size: 11px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- controls ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 30px; padding: 0 11px; border-radius: var(--r2); color: var(--tx2); border: 1px solid var(--line2); background: var(--bg2); white-space: nowrap; font-size: 12.5px; cursor: pointer; }
.btn:hover:not(:disabled) { color: var(--tx); border-color: var(--line3); background: var(--bg3); text-decoration: none; }
.btn.solid { background: var(--solid-bg); color: var(--solid-tx); border-color: transparent; font-weight: 500; }
.btn.solid:hover:not(:disabled) { opacity: .9; }
.btn.quiet { border-color: transparent; background: transparent; }
.btn.danger { color: var(--r); }
.btn.danger:hover:not(:disabled) { color: var(--r); border-color: var(--r); background: var(--r-bg); }
.btn.sm { height: 26px; padding: 0 9px; font-size: 12px; }
.btn.xs { height: 22px; padding: 0 7px; font-size: 11.5px; }
.btn.wide { width: 100%; }
.inp, .sel { height: 30px; padding: 0 9px; border-radius: var(--r2); border: 1px solid var(--line2); background: var(--bg2); color: var(--tx); outline: none; min-width: 0; width: 100%; }
textarea.inp { height: auto; padding: 7px 9px; resize: vertical; line-height: 1.55; }
.inp:focus, .sel:focus { border-color: var(--acc-line); }
.inp:disabled { opacity: .6; }
.inp::placeholder { color: var(--tx4); }
.inp.sm { height: 26px; font-size: 12px; }
.sel { padding-right: 24px; appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--tx3) 50%), linear-gradient(135deg, var(--tx3) 50%, transparent 50%); background-position: calc(100% - 13px) 50%, calc(100% - 9px) 50%; background-size: 4px 4px; background-repeat: no-repeat; cursor: pointer; }
.tag { display: inline-flex; align-items: center; height: 18px; padding: 0 6px; border-radius: 3px; font-size: 11px; color: var(--tx2); background: var(--n-bg); white-space: nowrap; flex: none; }
.tag.a { color: var(--a); background: var(--a-bg); }
.tag.g { color: var(--g); background: var(--g-bg); }
.tag.r { color: var(--r); background: var(--r-bg); }
.tag.b { color: var(--b); background: var(--b-bg); }
.pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 11px; font-size: 11.5px; color: var(--tx2); background: var(--n-bg); white-space: nowrap; flex: none; }
.pd { width: 6px; height: 6px; border-radius: 50%; background: var(--n); flex: none; display: inline-block; }
.pd.c-g { background: var(--g); } .pd.c-b { background: var(--b); } .pd.c-a { background: var(--a); } .pd.c-r { background: var(--r); }
.field { margin-top: 12px; min-width: 0; }
.field > label { display: block; font-size: 11px; color: var(--tx3); margin-bottom: 5px; }
.hint { font-size: 11.5px; color: var(--tx3); margin-top: 5px; line-height: 1.5; }
.form-err { color: var(--r); font-size: 12px; min-height: 18px; margin-top: 10px; }
.form-a { margin-top: 18px; display: flex; gap: 8px; }

/* ---------- page ---------- */
.page { max-width: 1280px; margin: 0 auto; padding: 24px 32px 100px; }
.ph { display: flex; align-items: flex-end; gap: 16px; margin-bottom: 18px; }
.ph-t { flex: 1; min-width: 0; }
.ph-k { font: 11px var(--mono); letter-spacing: .14em; color: var(--tx3); text-transform: uppercase; margin-bottom: 4px; }
.ph h1 { font-size: 20px; font-weight: 600; letter-spacing: .01em; line-height: 1.3; }
.ph-s { color: var(--tx3); font-size: 12.5px; margin-top: 3px; }
.ph-a { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.toolbar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.toolbar .inp { width: 260px; }
.sec { margin-top: 24px; min-width: 0; }
.sec:first-child { margin-top: 0; }
.sec-h { display: flex; align-items: center; gap: 8px; min-height: 28px; margin-bottom: 10px; border-bottom: 1px solid var(--line); padding-bottom: 6px; flex-wrap: wrap; }
.sec-h h2 { font-size: 12.5px; font-weight: 600; color: var(--tx); }
.sec-c { font: 11px var(--mono); color: var(--tx3); }
.sec-note { font-size: 11.5px; color: var(--tx3); }
.empty { padding: 18px 4px; color: var(--tx3); }
.banner { display: flex; align-items: center; gap: 10px; padding: 9px 14px; margin: 0 0 14px; border-radius: var(--r2); background: var(--n-bg); border: 1px solid var(--line2); font-size: 12.5px; color: var(--tx2); flex-wrap: wrap; }
.banner span { flex: 1; min-width: 200px; }
.banner.bad { background: var(--r-bg); border-color: rgba(201,127,117,.3); color: var(--tx); }
.banner.ok { background: var(--g-bg); border-color: rgba(132,171,143,.3); color: var(--tx); }
.banner.warn { background: var(--a-bg); border-color: rgba(201,166,107,.3); color: var(--tx); }
.loading { display: flex; align-items: center; gap: 10px; color: var(--tx3); padding: 40px 0; }
.spin { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line3); border-top-color: var(--acc); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }
.kv { display: grid; grid-template-columns: 130px minmax(0,1fr); gap: 7px 16px; font-size: 12.5px; }
.kv > span { color: var(--tx3); }
.kv > b { font-weight: 500; word-break: break-word; min-width: 0; }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0,1fr)); border: 1px solid var(--line); border-radius: var(--r3); background: var(--bg2); overflow: hidden; }
.stat { padding: 12px 14px 11px; border-right: 1px solid var(--line); min-width: 0; }
.stat:last-child { border-right: 0; }
.stat-k { font-size: 11.5px; color: var(--tx3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-v { font: 500 19px/1.35 var(--mono); color: var(--tx); margin-top: 3px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stat-s { font-size: 11px; color: var(--tx4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- cards / tables ---------- */
.card { border: 1px solid var(--line); border-radius: var(--r3); background: var(--bg2); padding: 12px 14px; margin-bottom: 10px; min-width: 0; }
.card-h { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; min-width: 0; }
.card-t { font-weight: 600; font-size: 13.5px; flex: 1; min-width: min(160px, 100%); overflow-wrap: anywhere; }
.card-s { font-size: 12px; color: var(--tx3); margin-top: 6px; overflow-wrap: anywhere; }
.card-a { margin-top: 12px; display: flex; gap: 8px; flex-wrap: wrap; }
.ftbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.ftbl th, .ftbl td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.ftbl th { color: var(--tx3); font-weight: 500; font-size: 11.5px; white-space: nowrap; }
.ftbl td { overflow-wrap: anywhere; }
.ftbl tr:last-child td { border-bottom: 0; }
.bar { width: 120px; height: 4px; border-radius: 2px; background: var(--line2); overflow: hidden; display: inline-block; vertical-align: middle; }
.bar i { display: block; height: 100%; background: var(--b); }
.bar i.hot { background: var(--a); }
.prog { height: 6px; border-radius: 3px; background: var(--line2); overflow: hidden; margin-top: 8px; }
.prog i { display: block; height: 100%; background: var(--acc); }
.sha { font-family: var(--mono); font-size: 11px; color: var(--tx2); word-break: break-all; }

/* ---------- login ---------- */
.login-wrap { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: 100%; max-width: 380px; border: 1px solid var(--line); border-radius: var(--r3); background: var(--bg2); padding: 28px 28px 24px; }
.login-card h1 { font-size: 17px; font-weight: 600; }
.login-card .sub { color: var(--tx3); font-size: 12.5px; margin-top: 6px; line-height: 1.6; }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  #side { display: none; }
  .page { padding: 18px 16px 80px; }
  .stats { grid-template-columns: repeat(2, minmax(0,1fr)); }
  .toolbar .inp { width: 100%; }
}
