/* ARNE web console — design tokens + components */
:root {
  --bg: #0a0e16; --bg2: #0d121c; --panel: #111827; --panel2: #172033; --panel3: #1d2940;
  --line: #222d40; --line2: #2c3a52; --text: #e6ebf2; --muted: #8a96a8; --faint: #5d6a7e;
  --accent: #4c9dff; --accent2: #7c5cff; --accent-soft: rgba(76, 157, 255, .12);
  --ok: #34d399; --warn: #fbbf24; --bad: #f87171; --crit: #f43f5e;
  --radius: 12px; --radius-sm: 8px;
  --shadow: 0 1px 0 rgba(255,255,255,.03) inset, 0 8px 24px rgba(0,0,0,.25);
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, Consolas, monospace;
  --sans: "Inter", -apple-system, "Segoe UI", "PingFang SC", "Microsoft YaHei", sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; background: var(--bg); color: var(--text); font: 14px/1.55 var(--sans); -webkit-font-smoothing: antialiased; }
body { background: radial-gradient(1200px 600px at 100% -10%, rgba(124,92,255,.08), transparent 60%), radial-gradient(900px 500px at -10% 0%, rgba(76,157,255,.07), transparent 60%), var(--bg); background-attachment: fixed; }
a { color: var(--accent); text-decoration: none; } a:hover { color: #7cb8ff; }
::selection { background: rgba(76,157,255,.35); }
::-webkit-scrollbar { width: 10px; height: 10px; } ::-webkit-scrollbar-thumb { background: #243047; border-radius: 10px; border: 2px solid transparent; background-clip: padding-box; }

/* ---------------------------------------------------------------- top bar */
#topbar { display: flex; align-items: center; gap: 28px; padding: 0 22px; height: 58px; position: sticky; top: 0; z-index: 10;
  background: rgba(10,14,22,.82); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); }
body.auth #topbar { display: none; }
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-weight: 700; letter-spacing: .4px; white-space: nowrap; }
.brand:hover { color: var(--text); }
.brand small { color: var(--muted); font-weight: 500; font-size: 12px; letter-spacing: 0; }
.logo-mark { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; flex: none;
  background: linear-gradient(135deg, var(--accent), var(--accent2)); box-shadow: 0 4px 14px rgba(76,157,255,.35); }
.logo-mark svg { width: 18px; height: 18px; }
#nav { display: flex; gap: 4px; }
#nav a { color: var(--muted); padding: 7px 14px; border-radius: 8px; font-weight: 500; transition: .15s; }
#nav a:hover { color: var(--text); background: var(--panel2); }
#nav a.active { color: var(--text); background: var(--accent-soft); box-shadow: inset 0 0 0 1px rgba(76,157,255,.25); }
#whoami { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.user-chip { display: flex; align-items: center; gap: 10px; padding: 4px 6px 4px 4px; border-radius: 999px; border: 1px solid var(--line); background: var(--panel); }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: 12px; color: #fff;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6); }
.user-chip .who { line-height: 1.2; padding-right: 4px; } .user-chip .who b { display: block; font-size: 13px; } .user-chip .who span { font-size: 11px; color: var(--muted); }

main { padding: 24px 26px 40px; max-width: 1760px; margin: 0 auto; }
body.auth main { padding: 0; max-width: none; }

/* ---------------------------------------------------------------- typography & layout */
h1 { font-size: 22px; margin: 0; font-weight: 700; letter-spacing: -.2px; }
h2 { font-size: 15px; margin: 26px 0 12px; font-weight: 650; color: #cfd8e3; }
h3 { font-size: 13px; margin: 12px 0 8px; font-weight: 650; letter-spacing: .3px; color: #b8c3d1; }
.page-head { display: flex; align-items: flex-end; gap: 14px; flex-wrap: wrap; margin-bottom: 18px; }
.page-head .sub { color: var(--muted); font-size: 13px; margin-top: 4px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.grow { flex: 1; }
.muted { color: var(--muted); } .small { font-size: 12px; } .mono { font-family: var(--mono); }

.card { background: linear-gradient(180deg, rgba(255,255,255,.015), transparent), var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; box-shadow: var(--shadow); }
.card + .card { margin-top: 12px; }
.card > h3:first-child, .card > h2:first-child { margin-top: 0; }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; margin-bottom: 18px; }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; position: relative; overflow: hidden; }
.stat::after { content: ""; position: absolute; inset: auto -30px -30px auto; width: 90px; height: 90px; border-radius: 50%; background: var(--c, var(--accent)); opacity: .16; filter: blur(2px); }
.stat .label { color: var(--muted); font-size: 12px; } .stat .value { font-size: 26px; font-weight: 700; margin-top: 2px; letter-spacing: -.5px; }
.stat .value small { font-size: 12px; color: var(--muted); font-weight: 500; margin-left: 4px; }

/* ---------------------------------------------------------------- controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--panel2); color: var(--text); border: 1px solid var(--line2);
  border-radius: var(--radius-sm); padding: 7px 14px; cursor: pointer; font: 500 13px var(--sans); transition: .15s; white-space: nowrap; }
.btn:hover { border-color: #3d5277; background: var(--panel3); color: var(--text); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn.primary { background: linear-gradient(180deg, #4c9dff, #2f7fe6); border-color: #4c9dff; color: #fff; box-shadow: 0 4px 14px rgba(47,127,230,.3); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ok { background: linear-gradient(180deg, #22c38a, #149a6b); border-color: #2bd395; color: #fff; }
.btn.danger { background: rgba(244,63,94,.12); border-color: rgba(244,63,94,.45); color: #fda4af; }
.btn.danger:hover { background: rgba(244,63,94,.2); }
.btn.sm { padding: 4px 10px; font-size: 12px; border-radius: 7px; }
input, select, textarea { background: var(--bg2); color: var(--text); border: 1px solid var(--line2); border-radius: var(--radius-sm); padding: 8px 11px; font: 13px var(--sans); transition: border-color .15s, box-shadow .15s; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(76,157,255,.18); }
input::placeholder, textarea::placeholder { color: var(--faint); }
textarea { width: 100%; font-family: var(--mono); font-size: 12px; }
label { display: block; font-size: 12px; color: var(--muted); margin: 10px 0 5px; font-weight: 500; }
input[type=checkbox] { accent-color: var(--accent); width: 15px; height: 15px; }

table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 10px 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--faint); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: .6px; }
tr:last-child td { border-bottom: none; }
tr.click { cursor: pointer; transition: background .12s; } tr.click:hover { background: rgba(76,157,255,.05); }
.card > table:first-child th { padding-top: 2px; }
.empty { text-align: center; padding: 34px 10px !important; color: var(--muted); }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600; border: 1px solid var(--line2); letter-spacing: .2px; white-space: nowrap; }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .9; }
.b-ok { color: var(--ok); background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.3); }
.b-warn { color: var(--warn); background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.3); }
.b-bad { color: var(--bad); background: rgba(248,113,113,.08); border-color: rgba(248,113,113,.3); }
.b-crit { color: #fff; background: var(--crit); border-color: var(--crit); }
.b-info { color: var(--accent); background: var(--accent-soft); border-color: rgba(76,157,255,.3); }
.b-mute { color: var(--muted); }
.dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; background: var(--muted); vertical-align: 0; }
.dot.on { background: var(--ok); box-shadow: 0 0 0 3px rgba(52,211,153,.18), 0 0 10px var(--ok); animation: pulse 2s infinite; }
.dot.off { background: var(--warn); } .dot.end { background: var(--bad); }
@keyframes pulse { 50% { box-shadow: 0 0 0 6px rgba(52,211,153,0), 0 0 10px var(--ok); } }
pre { background: #070a10; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 11px 12px; overflow: auto; font: 12px/1.5 var(--mono); margin: 6px 0; max-height: 420px; white-space: pre; color: #cdd6e2; }
.kv { display: grid; grid-template-columns: 110px 1fr; gap: 5px 12px; font-size: 13px; } .kv > div:nth-child(odd) { color: var(--muted); }

/* ---------------------------------------------------------------- session workspace */
.ws { display: grid; grid-template-columns: 310px minmax(420px, 1fr) 430px; gap: 14px; height: calc(100vh - 140px); }
.ws > section { overflow: auto; min-height: 0; }
.col-center { display: flex; flex-direction: column; gap: 10px; }
.term-wrap { background: #000; border: 1px solid var(--line2); border-radius: var(--radius); flex: 1; min-height: 280px; display: flex; flex-direction: column; overflow: hidden; box-shadow: var(--shadow); }
.tabs { display: flex; gap: 2px; background: #080b11; border-bottom: 1px solid var(--line); padding: 6px 6px 0; }
.tab { padding: 6px 14px; border-radius: 7px 7px 0 0; cursor: pointer; color: var(--muted); font-size: 12px; font-family: var(--mono); }
.tab.active { background: #000; color: var(--text); box-shadow: inset 0 2px 0 var(--accent); }
.term { flex: 1; padding: 6px 8px; min-height: 0; overflow: hidden; }
.lineinput { display: flex; gap: 6px; padding: 8px; border-top: 1px solid var(--line); background: #080b11; }
.lineinput input { flex: 1; font-family: var(--mono); background: #000; }
.chat { display: flex; flex-direction: column; height: 55%; min-height: 320px; }
.chat-log { flex: 1; overflow: auto; padding: 4px 2px; }
.msg { margin: 8px 0; padding: 9px 12px; border-radius: 12px; background: var(--panel2); white-space: pre-wrap; word-break: break-word; border: 1px solid var(--line); }
.msg.user { background: linear-gradient(180deg, #1e4f86, #183f6d); border-color: #2a64a3; margin-left: 36px; border-bottom-right-radius: 4px; }
.msg.err { background: rgba(244,63,94,.1); border-color: rgba(244,63,94,.35); color: #fecdd3; }
.msg.tool { background: transparent; border: 1px dashed var(--line2); font: 11px var(--mono); color: var(--muted); padding: 5px 9px; border-radius: 8px; }
.msg.md { white-space: normal; border-bottom-left-radius: 4px; } .msg.md p { margin: 4px 0; } .msg.md pre { max-height: 260px; }
.chat-input { display: flex; gap: 8px; margin-top: 8px; } .chat-input textarea { font-family: var(--sans); font-size: 13px; height: 64px; resize: vertical; }
.panel-title { display: flex; align-items: center; gap: 8px; font-size: 12px; font-weight: 700; letter-spacing: .8px; color: #b8c3d1; margin: 0 0 10px; text-transform: uppercase; }
.panel-title::before { content: ""; width: 3px; height: 13px; border-radius: 2px; background: linear-gradient(var(--accent), var(--accent2)); }
.cr { border-left: 3px solid var(--line2); } .cr.r-low { border-left-color: var(--ok); } .cr.r-medium { border-left-color: var(--warn); }
.cr.r-high { border-left-color: var(--bad); } .cr.r-critical { border-left-color: var(--crit); }
.check-pass { color: var(--ok); font-weight: 600; } .check-warn { color: var(--warn); font-weight: 600; } .check-fail { color: var(--bad); font-weight: 600; } .check-n\/a { color: var(--muted); }
.device-card { border-color: rgba(76,157,255,.35); background: linear-gradient(160deg, rgba(76,157,255,.12), rgba(124,92,255,.05) 60%, transparent), var(--panel); }
.detect-line { font-size: 12px; margin-top: 6px; }

/* ---------------------------------------------------------------- overlays */
#toasts { position: fixed; right: 18px; bottom: 18px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: var(--panel2); border: 1px solid var(--line2); border-left: 4px solid var(--accent); padding: 10px 14px; border-radius: 10px; max-width: 440px; box-shadow: 0 12px 32px rgba(0,0,0,.45); animation: slidein .2s ease-out; }
.toast.error { border-left-color: var(--bad); } .toast.warn { border-left-color: var(--warn); } .toast.ok { border-left-color: var(--ok); }
@keyframes slidein { from { transform: translateY(8px); opacity: 0; } }
.modal-bg { position: fixed; inset: 0; background: rgba(3,6,12,.72); backdrop-filter: blur(4px); display: flex; align-items: center; justify-content: center; z-index: 40; animation: fade .15s; }
.modal { background: var(--panel); border: 1px solid var(--line2); border-radius: 16px; padding: 22px 24px; width: min(760px, 94vw); max-height: 90vh; overflow: auto; box-shadow: 0 30px 80px rgba(0,0,0,.6); }
.modal h2 { margin-top: 0; font-size: 17px; color: var(--text); }
@keyframes fade { from { opacity: 0; } }
.linkq { font-size: 12px; color: var(--muted); font-family: var(--mono); }

/* ---------------------------------------------------------------- login */
.auth-shell { min-height: 100vh; display: grid; grid-template-columns: 1.15fr 1fr; }
.auth-hero { position: relative; overflow: hidden; padding: 56px 64px; display: flex; flex-direction: column;
  background: radial-gradient(700px 500px at 20% 20%, rgba(76,157,255,.22), transparent 60%), radial-gradient(600px 500px at 90% 90%, rgba(124,92,255,.22), transparent 60%), #070b13;
  border-right: 1px solid var(--line); }
.auth-hero .grid-bg { position: absolute; inset: 0; background-image: linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px), linear-gradient(90deg, rgba(255,255,255,.035) 1px, transparent 1px);
  background-size: 44px 44px; mask-image: radial-gradient(ellipse at 40% 40%, #000 30%, transparent 75%); }
.auth-hero > * { position: relative; }
.auth-brand { display: flex; align-items: center; gap: 12px; font-weight: 800; font-size: 18px; letter-spacing: .6px; }
.auth-brand .logo-mark { width: 38px; height: 38px; border-radius: 10px; } .auth-brand .logo-mark svg { width: 22px; height: 22px; }
.auth-hero h1 { font-size: 40px; line-height: 1.18; letter-spacing: -1px; margin: auto 0 18px; max-width: 620px; font-weight: 800; }
.auth-hero h1 .grad { background: linear-gradient(90deg, #7cb8ff, #a78bfa); -webkit-background-clip: text; background-clip: text; color: transparent; }
.auth-hero .lead { color: #aab6c6; font-size: 16px; max-width: 560px; margin: 0 0 34px; }
.flow { display: flex; align-items: center; gap: 8px; margin-bottom: 38px; flex-wrap: nowrap; }
.flow .node { padding: 7px 11px; border-radius: 10px; white-space: nowrap; border: 1px solid var(--line2); background: rgba(17,24,39,.7); font-size: 13px; font-weight: 600; }
.flow .node small { display: block; color: var(--muted); font-weight: 500; font-size: 11px; }
.flow .wire { flex: 0 1 30px; min-width: 14px; height: 2px; background: linear-gradient(90deg, var(--accent), var(--accent2)); position: relative; opacity: .8; }
.flow .wire::after { content: ""; position: absolute; top: -3px; left: 0; width: 8px; height: 8px; border-radius: 50%; background: #fff; box-shadow: 0 0 10px #7cb8ff; animation: packet 1.8s linear infinite; }
@keyframes packet { from { left: 0; } to { left: calc(100% - 8px); } }
.features { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; max-width: 760px; margin-bottom: auto; }
.feature { padding: 14px 16px; border-radius: 12px; border: 1px solid var(--line); background: rgba(17,24,39,.55); }
.feature .ic { width: 30px; height: 30px; border-radius: 8px; display: grid; place-items: center; background: var(--accent-soft); color: var(--accent); margin-bottom: 10px; }
.feature .ic svg { width: 16px; height: 16px; }
.feature b { display: block; font-size: 14px; margin-bottom: 3px; } .feature span { color: var(--muted); font-size: 12.5px; }
.auth-hero .foot { color: var(--faint); font-size: 12px; margin-top: 40px; }
.auth-panel { display: flex; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 26px; margin: 0 0 6px; color: var(--text); letter-spacing: -.4px; }
.auth-card .hint { color: var(--muted); margin: 0 0 28px; }
.field { position: relative; margin-bottom: 16px; }
.field label { margin: 0 0 7px; font-size: 13px; color: #b8c3d1; }
.field .ico { position: absolute; left: 13px; bottom: 12px; width: 17px; height: 17px; color: var(--faint); pointer-events: none; }
.field input { width: 100%; height: 44px; padding-left: 40px; font-size: 14px; border-radius: 10px; background: #0b1120; }
.field input:focus + .ico, .field input:focus ~ .ico { color: var(--accent); }
.pw-toggle { position: absolute; right: 8px; bottom: 7px; background: none; border: 0; color: var(--muted); cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 12px; }
.pw-toggle:hover { color: var(--text); background: var(--panel2); }
.auth-error { display: none; background: rgba(244,63,94,.1); border: 1px solid rgba(244,63,94,.35); color: #fecdd3; padding: 9px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.auth-error.show { display: block; animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-4px); } 75% { transform: translateX(4px); } }
.auth-submit { width: 100%; height: 46px; font-size: 15px; border-radius: 10px; margin-top: 6px; }
.spinner { width: 16px; height: 16px; border: 2px solid rgba(255,255,255,.35); border-top-color: #fff; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.auth-meta { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--line); display: flex; gap: 16px; flex-wrap: wrap; color: var(--faint); font-size: 12px; }
.auth-meta span { display: inline-flex; align-items: center; gap: 6px; }
.auth-meta svg { width: 13px; height: 13px; color: var(--ok); }

/* ---------------------------------------------------------------- document */
.doc { max-width: 980px; margin: 0 auto; background: #fff; color: #1b1f24; padding: 48px 64px; border-radius: 10px; box-shadow: 0 20px 60px rgba(0,0,0,.4); }
.doc table { border: 1px solid #d0d7de; } .doc th, .doc td { border: 1px solid #d0d7de; color: #1b1f24; text-transform: none; letter-spacing: 0; font-size: 13px; } .doc th { background: #f3f5f7; }
.doc pre { background: #f6f8fa; color: #1b1f24; border-color: #d0d7de; max-height: none; white-space: pre-wrap; }
.doc h1 { font-size: 26px; border-bottom: 2px solid #1b1f24; padding-bottom: 8px; margin-bottom: 16px; } .doc h2 { font-size: 20px; color: #1b1f24; border-bottom: 1px solid #d0d7de; padding-bottom: 4px; margin-top: 30px; }
.doc h3 { color: #1b1f24; font-size: 15px; }
@media print { #topbar, .noprint { display: none !important; } main { padding: 0; } body { background: #fff; } .doc { padding: 0; box-shadow: none; } }

/* ---------------------------------------------------------------- responsive */
@media (max-width: 1300px) {
  .ws { grid-template-columns: 270px 1fr; height: auto; }
  .ws > section:last-child { grid-column: 1 / -1; }
  .term-wrap { flex: none; height: 62vh; }
  .chat { height: 60vh; }
}
@media (max-width: 1000px) {
  .auth-shell { grid-template-columns: 1fr; } .auth-hero { padding: 32px 24px; } .auth-hero h1 { font-size: 30px; margin-top: 36px; }
  .features { grid-template-columns: 1fr; } .flow { display: none; }
}
@media (max-width: 760px) { .ws { grid-template-columns: 1fr; } .brand small { display: none; } main { padding: 14px; } #nav a { padding: 6px 9px; } }
.field .ico svg, .auth-meta span > span svg { width: 100%; height: 100%; display: block; }
.auth-meta span > span { width: 13px; height: 13px; color: var(--ok); display: inline-block; }
.lang-switch { display: inline-flex; padding: 3px; border: 1px solid var(--line2); border-radius: 999px; background: var(--panel); gap: 2px; }
.lang-opt { border: 0; background: none; color: var(--muted); font: 600 12px var(--sans); padding: 4px 10px; border-radius: 999px; cursor: pointer; }
.lang-opt:hover { color: var(--text); } .lang-opt.active { background: var(--accent-soft); color: var(--text); box-shadow: inset 0 0 0 1px rgba(76,157,255,.3); }
.auth-panel { position: relative; } .auth-lang { position: absolute; top: 24px; right: 28px; }

/* ================================================================ v5: navigation, home, forms, mobile */
#nav a { position: relative; display: inline-flex; align-items: center; gap: 6px; }
.nav-badge { min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--warn); color: #1a1300; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; }
a.user-chip { color: var(--text); } a.user-chip:hover { border-color: var(--line2); color: var(--text); }
.back { display: inline-block; color: var(--muted); font-size: 13px; margin-bottom: 8px; } .back:hover { color: var(--text); }
.banner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; justify-content: space-between; padding: 11px 14px; border-radius: 10px;
  margin-bottom: 14px; background: var(--accent-soft); border: 1px solid rgba(76,157,255,.3); font-size: 13px; }
.banner.warn { background: rgba(251,191,36,.1); border-color: rgba(251,191,36,.35); color: #fde68a; }
.banner.ok { background: rgba(52,211,153,.08); border-color: rgba(52,211,153,.3); }
a.stat { color: var(--text); display: block; transition: transform .12s, border-color .12s; } a.stat:hover { border-color: var(--line2); transform: translateY(-1px); color: var(--text); }
.home-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; } .home-grid h2 { margin-top: 4px; }
.setup-card { margin-bottom: 16px; border-color: rgba(76,157,255,.35); }
.progress { height: 6px; border-radius: 3px; background: var(--panel3); margin: 12px 0 6px; overflow: hidden; }
.progress > div { height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2)); border-radius: 3px; transition: width .4s; }
.steps { list-style: none; margin: 8px 0 0; padding: 0; }
.steps li { display: flex; align-items: center; gap: 12px; padding: 10px 2px; border-top: 1px solid var(--line); }
.steps .tick { flex: none; width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--line2); display: grid; place-items: center; }
.steps li.done .tick { background: var(--ok); border-color: var(--ok); color: #04130c; } .steps .tick svg { width: 13px; height: 13px; }
.steps li.done b { color: var(--muted); text-decoration: line-through; text-decoration-color: rgba(255,255,255,.2); }
.seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.seg a { padding: 7px 14px; border-radius: 8px; color: var(--muted); font-weight: 500; font-size: 13px; position: relative; }
.seg a:hover { color: var(--text); } .seg a.active { background: var(--panel3); color: var(--text); box-shadow: inset 0 0 0 1px var(--line2); }
.seg a.dot-new::after { content: ""; position: absolute; top: 5px; right: 5px; width: 7px; height: 7px; border-radius: 50%; background: var(--warn); }
.ws-tabs { display: none; }
.ws-head { margin-bottom: 10px; }
.form-field { margin-bottom: 14px; } .form-field label { margin: 0 0 6px; color: #b8c3d1; font-size: 13px; }
.form-field input, .form-field select, .form-field textarea { width: 100%; }
.help { font-size: 12px; color: var(--muted); margin-top: 5px; line-height: 1.45; }
.narrow { max-width: 720px; } .narrow + .narrow { margin-top: 12px; }
.toggle { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-bottom: 1px solid var(--line); margin: 0; cursor: pointer; color: var(--text); }
.toggle input { margin-top: 3px; } .toggle b { font-size: 14px; }
details summary { cursor: pointer; margin: 6px 0 12px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; } .two-col > * { min-width: 0; }
.warn-list { margin: 10px 0; padding: 10px 12px; border-radius: 8px; background: rgba(251,191,36,.07); border: 1px solid rgba(251,191,36,.25); font-size: 12.5px; display: grid; gap: 6px; }
.ack { display: flex; gap: 8px; align-items: flex-start; color: var(--bad); font-size: 13px; margin: 10px 0; }
.btn-ic svg { width: 14px; height: 14px; display: block; }
.approval-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 12px; } .approval-list .card + .card { margin-top: 0; }
.more-list { padding: 4px 0; } .more-item { display: flex; align-items: center; gap: 14px; padding: 14px 18px; color: var(--text); border-bottom: 1px solid var(--line); font-size: 15px; }
.more-item:last-child { border-bottom: 0; } .more-item .tb-ic { width: 22px; height: 22px; color: var(--accent); } .more-item .tb-ic svg { width: 100%; height: 100%; }
.guide { max-width: 900px; line-height: 1.7; padding: 22px 28px; } .guide h2 { font-size: 17px; color: var(--text); margin-top: 26px; padding-top: 16px; border-top: 1px solid var(--line); }
.guide h2:first-child { border-top: 0; padding-top: 0; margin-top: 0; } .guide table { margin: 10px 0; } .guide td, .guide th { font-size: 13px; }
.guide th { text-transform: none; letter-spacing: 0; font-size: 12px; } .guide code { font-family: var(--mono); background: var(--panel3); padding: 1px 6px; border-radius: 5px; font-size: 12.5px; }
.guide pre code { background: none; padding: 0; } .guide ol, .guide ul { padding-left: 22px; } .guide li { margin: 4px 0; }
#tabbar { display: none; }

/* ---------------- phones (and the future iOS / Android app shells) ---------------- */
@media (max-width: 760px) {
  #topbar { height: 52px; gap: 10px; padding: 0 14px; padding-top: env(safe-area-inset-top); }
  #nav { display: none; } .user-chip .who, #whoami .btn.sm { display: none; } #whoami .lang-switch { display: none; }
  main { padding: 14px 14px calc(80px + env(safe-area-inset-bottom)); }
  #tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 30; background: rgba(10,14,22,.94); backdrop-filter: blur(14px);
    border-top: 1px solid var(--line); padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); }
  #tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 3px; color: var(--muted); font-size: 11px; position: relative; padding: 4px 0; }
  #tabbar a.active { color: var(--accent); } #tabbar .tb-ic { width: 22px; height: 22px; } #tabbar .tb-ic svg { width: 100%; height: 100%; }
  #tabbar .nav-badge { position: absolute; top: 0; left: calc(50% + 6px); }
  #toasts { bottom: calc(76px + env(safe-area-inset-bottom)); left: 12px; right: 12px; } .toast { max-width: none; }
  h1 { font-size: 20px; } .page-head { margin-bottom: 14px; }
  .stats { grid-template-columns: 1fr 1fr; gap: 10px; } .stat .value { font-size: 22px; }
  .home-grid, .two-col { grid-template-columns: 1fr; }
  .approval-list { grid-template-columns: 1fr; }
  .modal-bg { align-items: flex-end; } .modal { width: 100vw; max-height: 92vh; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
  .modal .btn { flex: 1; min-height: 44px; } .btn { min-height: 38px; } .btn.sm { min-height: 32px; }
  input, select, textarea { font-size: 16px; }  /* prevents iOS zoom on focus */
  /* responsive tables become cards */
  table.rtable, .rtable tbody, .rtable tr, .rtable td { display: block; width: 100%; }
  .rtable tr:first-child { display: none; }
  .rtable tr { padding: 10px 2px; border-bottom: 1px solid var(--line); } .rtable tr:last-child { border-bottom: 0; }
  .rtable td { border: 0; padding: 2px 0; display: flex; gap: 10px; justify-content: space-between; align-items: center; }
  .rtable td::before { content: attr(data-label); color: var(--faint); font-size: 12px; flex: none; }
  .rtable td[data-label=""]::before { content: none; } .rtable td.empty { display: block; }
  /* session workspace: one panel at a time */
  .ws-tabs { display: flex; width: 100%; } .ws-tabs a { flex: 1; text-align: center; }
  .ws { display: block; height: auto; }
  .ws > section { display: none; } .ws[data-panel=device] > .p-device, .ws[data-panel=term] > .p-term { display: block; }
  .ws[data-panel=ai] > .p-right, .ws[data-panel=changes] > .p-right { display: block; }
  .ws[data-panel=ai] .p-changes, .ws[data-panel=changes] .p-ai { display: none; }
  .ws[data-panel=changes] .p-changes .panel-title { margin-top: 0 !important; }
  .term-wrap { height: calc(100vh - 250px); } .chat { height: calc(100vh - 250px); min-height: 360px; }
  .lineinput { flex-wrap: wrap; } .lineinput input { flex-basis: 100%; }
  .kv { grid-template-columns: 96px 1fr; }
  .doc { padding: 22px 16px; border-radius: 0; margin: 0 -14px; }
  .guide { padding: 16px; }
}

/* ---------------- tablets / iPad (portrait & landscape) ---------------- */
@media (min-width: 761px) and (max-width: 1300px) {
  .ws-tabs { display: flex; margin-bottom: 10px; } .ws-tabs a[data-k=device] { display: none; }
  .ws { display: grid; grid-template-columns: 290px 1fr; height: calc(100vh - 180px); gap: 12px; }
  .ws > section { display: none; overflow: auto; } .ws > .p-device { display: block; grid-row: 1; grid-column: 1; }
  .ws[data-panel=term] > .p-term, .ws[data-panel=ai] > .p-right, .ws[data-panel=changes] > .p-right { display: flex; flex-direction: column; grid-column: 2; grid-row: 1; }
  .ws[data-panel=ai] .p-changes, .ws[data-panel=changes] .p-ai { display: none; }
  .ws[data-panel=changes] .p-changes .panel-title { margin-top: 0 !important; }
  .term-wrap { height: 100%; flex: 1; } .chat { height: 100%; flex: 1; }
  .home-grid { grid-template-columns: 1fr; }
  .brand small { display: none; } #topbar { gap: 16px; } #nav a { padding: 7px 10px; }
}
@media (min-width: 761px) and (max-width: 1080px) { .user-chip .who { display: none; } .ws { grid-template-columns: 250px 1fr; } }
/* touch screens (iPad, phones): larger targets, no hover dependence */
@media (pointer: coarse) {
  .btn { min-height: 40px; } .btn.sm { min-height: 34px; padding: 5px 12px; }
  .seg a, #nav a { padding-top: 9px; padding-bottom: 9px; }
  tr.click td { padding-top: 12px; padding-bottom: 12px; }
  .lineinput .key { min-width: 44px; }
}
/* installed Home Screen app (iPad / iPhone "Add to Home Screen") */
@media (display-mode: standalone) { #topbar { padding-top: env(safe-area-inset-top); height: calc(58px + env(safe-area-inset-top)); } }
.qr { width: 220px; height: 220px; background: #fff; border-radius: 12px; padding: 6px; flex: none; } .qr svg { width: 100%; height: 100%; display: block; }
.qr.expired { opacity: .15; } .pair { display: flex; gap: 20px; align-items: center; flex-wrap: wrap; } .pair ol { padding-left: 18px; line-height: 1.9; flex: 1; min-width: 220px; }
#nav a, .seg a { white-space: nowrap; }
@media (min-width: 761px) and (max-width: 940px) {
  #topbar .brand { font-size: 0; gap: 0; } #topbar .brand .logo-mark { font-size: 14px; }
  #whoami .lang-switch { display: none; } #nav { gap: 0; } #nav a { padding: 7px 8px; font-size: 13px; }
}

/* ================================================================ v6: transitions & progress feedback */
/* top progress bar while requests are in flight */
body::before { content: ""; position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 100; opacity: 0;
  background: linear-gradient(90deg, var(--accent), var(--accent2)); box-shadow: 0 0 8px var(--accent); transition: opacity .3s; }
body.loading::before { opacity: 1; animation: topbar 1.4s ease-in-out infinite; }
@keyframes topbar { 0% { left: 0; width: 0; } 50% { left: 15%; width: 55%; } 100% { left: 100%; width: 0; } }
/* page enter */
main.fade-in > * { animation: rise .28s ease-out both; }
main.fade-in > *:nth-child(2) { animation-delay: .03s; } main.fade-in > *:nth-child(3) { animation-delay: .06s; } main.fade-in > *:nth-child(n+4) { animation-delay: .09s; }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } }
.page-loading { display: flex; align-items: center; justify-content: center; gap: 12px; padding: 90px 0; color: var(--muted); animation: fade .3s .1s both; }
/* spinners */
.spinner.sm { width: 12px; height: 12px; border-width: 2px; border-color: rgba(255,255,255,.25); border-top-color: currentColor; flex: none; }
.spinner.lg { width: 26px; height: 26px; border-width: 3px; border-color: rgba(76,157,255,.2); border-top-color: var(--accent); }
/* busy buttons */
.btn.is-busy { position: relative; color: transparent !important; pointer-events: none; }
.btn.is-busy::after { content: ""; position: absolute; left: 50%; top: 50%; width: 14px; height: 14px; margin: -7px 0 0 -7px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.3); border-top-color: #fff; animation: spin .7s linear infinite; }
.btn.is-busy > * { visibility: hidden; }
.btn.success { background: linear-gradient(180deg, #22c38a, #149a6b) !important; border-color: #2bd395 !important; transition: background .3s; }
/* dialog + toast motion */
.modal { animation: pop .22s cubic-bezier(.2, .9, .3, 1.2) both; }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.97); } }
@media (max-width: 760px) { .modal { animation: sheet .28s ease-out both; } @keyframes sheet { from { transform: translateY(100%); } } }
.toast.out { opacity: 0; transform: translateY(6px); transition: .25s; }
/* status pills */
.pill { display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px; font-size: 12px; font-weight: 600;
  border: 1px solid var(--line2); background: var(--panel); color: var(--muted); transition: all .3s; }
.pill.ok { color: var(--ok); border-color: rgba(52,211,153,.35); background: rgba(52,211,153,.07); }
.pill.warn { color: var(--warn); border-color: rgba(251,191,36,.35); background: rgba(251,191,36,.07); }
.pill.info { color: var(--accent); border-color: rgba(76,157,255,.35); background: var(--accent-soft); }
.pill .dot { margin: 0; }
.pulse { width: 9px; height: 9px; border-radius: 50%; background: currentColor; position: relative; flex: none; }
.pulse::after { content: ""; position: absolute; inset: -4px; border-radius: 50%; border: 2px solid currentColor; opacity: 0; animation: ripple 1.6s ease-out infinite; }
.pulse.lg { width: 16px; height: 16px; color: var(--accent); }
@keyframes ripple { 0% { transform: scale(.6); opacity: .8; } 100% { transform: scale(2.2); opacity: 0; } }
.dots::after { content: "…"; display: inline-block; width: 1.2em; text-align: left; animation: dots 1.4s steps(4) infinite; overflow: hidden; vertical-align: bottom; }
@keyframes dots { 0% { width: 0; } 100% { width: 1.2em; } }
/* AI typing indicator */
.msg.typing { display: inline-flex; align-items: center; gap: 10px; color: var(--muted); background: transparent; border-style: dashed; font-size: 12.5px; }
.tdots { display: inline-flex; gap: 4px; } .tdots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); animation: bounce 1.2s infinite ease-in-out; }
.tdots i:nth-child(2) { animation-delay: .15s; } .tdots i:nth-child(3) { animation-delay: .3s; }
@keyframes bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .4; } 30% { transform: translateY(-5px); opacity: 1; } }
.msg { animation: rise .2s ease-out both; }
/* terminal waiting state */
.term-empty { height: 100%; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; color: var(--text); text-align: center; padding: 20px; }
/* detection stepper */
.stepper { display: flex; gap: 6px; margin: 10px 0 4px; }
.stepper .st { flex: 1; display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--faint); padding-top: 8px; border-top: 3px solid var(--panel3); transition: all .3s; }
.stepper .st.active { color: var(--accent); border-top-color: var(--accent); } .stepper .st.done { color: var(--ok); border-top-color: var(--ok); }
.stepper .st.fail { color: var(--warn); border-top-color: var(--warn); }
.stepper .sd { width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid currentColor; font-size: 10px; flex: none; }
.stepper .sd svg { width: 11px; height: 11px; }
.stepper .st.active .sd { border-color: transparent; }
/* change progress */
.progress-line { display: flex; align-items: center; gap: 8px; margin-top: 8px; padding: 8px 10px; border-radius: 8px; font-size: 12.5px;
  color: var(--accent); background: var(--accent-soft); position: relative; overflow: hidden; }
.progress-line::after { content: ""; position: absolute; left: 0; bottom: 0; height: 2px; width: 30%; background: var(--accent); animation: sweep 1.6s ease-in-out infinite; }
@keyframes sweep { from { left: -30%; } to { left: 100%; } }
.card, .stat, .btn, .badge, .pill { transition: border-color .2s, background .2s, color .2s, transform .15s, box-shadow .2s; }
.btn:active { transform: scale(.98); }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition: none !important; } }
/* option groups (AI alternatives) */
.option-group { border: 1px dashed rgba(124,92,255,.45); border-radius: 14px; padding: 10px; margin-bottom: 12px; background: rgba(124,92,255,.04); }
.option-group > .card + .card { margin-top: 8px; }
.og-head { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; color: #c4b5fd; margin: 2px 4px 10px; }
.og-ic { width: 16px; height: 16px; color: #a78bfa; } .og-ic svg { width: 100%; height: 100%; }
.opt-label { background: rgba(124,92,255,.18); color: #ddd6fe; border: 1px solid rgba(124,92,255,.4); border-radius: 6px; padding: 1px 8px; font-size: 11.5px; font-weight: 600; }
.msg.perm { border-color: rgba(251,191,36,.45); background: rgba(251,191,36,.06); white-space: normal; }
.msg.perm pre { margin: 8px 0; }
.init-steps { display: grid; gap: 6px; margin: 8px 0; }
.init-steps .is { display: grid; grid-template-columns: 22px 150px 1fr; gap: 10px; align-items: center; padding: 7px 10px; border-radius: 8px; background: var(--panel2); animation: rise .25s both; }
.init-steps .is:nth-child(2) { animation-delay: .05s; } .init-steps .is:nth-child(3) { animation-delay: .1s; } .init-steps .is:nth-child(n+4) { animation-delay: .15s; }
.init-steps .sd { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-size: 11px; font-weight: 700; }
.init-steps .ok .sd { background: var(--ok); color: #04130c; } .init-steps .bad .sd { background: var(--warn); color: #1a1300; } .init-steps .sd svg { width: 12px; height: 12px; }
.mode-choices { display: grid; gap: 10px; }
.mode-choice { display: flex; gap: 14px; align-items: center; text-align: left; padding: 16px; border-radius: 12px; border: 1px solid var(--line2); background: var(--panel2); color: var(--text); cursor: pointer; font: inherit; transition: .15s; }
.mode-choice:hover { border-color: var(--accent); background: var(--panel3); transform: translateY(-1px); }
.mc-ic { width: 38px; height: 38px; border-radius: 10px; background: var(--accent-soft); color: var(--accent); display: grid; place-items: center; flex: none; } .mc-ic svg { width: 20px; height: 20px; }
@media (max-width: 760px) { .init-steps .is { grid-template-columns: 22px 1fr; } .init-steps .is .small { grid-column: 2; } }
.batch-group { border-color: rgba(76,157,255,.45); background: rgba(76,157,255,.04); } .batch-group .og-head { color: #93c5fd; }
.batch-group .og-head .btn { margin-left: 6px; }
.fleet-list { display: grid; gap: 6px; } .fl { display: flex; gap: 8px; align-items: flex-start; padding: 8px; border-radius: 8px; background: var(--panel2); }
.fl .dot { margin-top: 5px; } .fl.err { background: rgba(248,113,113,.07); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0; } .chip { padding: 3px 10px; border-radius: 999px; background: var(--panel3); font-size: 12px; }

/* ---------- Linux maintenance: one-line command ---------- */
.linux-cmd .steps-mini { margin: 0 0 10px; padding-left: 20px; font-size: 13px; line-height: 1.7; }
.linux-cmd .cmd-line { display: flex; gap: 8px; align-items: flex-start; }
.linux-cmd .cmd-line code { flex: 1; min-width: 0; word-break: break-all; font: 500 12.5px ui-monospace, Menlo, Consolas, monospace;
  background: var(--panel2); border: 1px solid var(--line); padding: 9px 11px; border-radius: 8px; user-select: all; }
.chip.sm { font-size: 11px; padding: 1px 7px; }
.chip.toggle { cursor: pointer; opacity: .55; border: 1px solid var(--line); background: transparent; }
.chip.toggle.on { opacity: 1; background: var(--accent-soft, rgba(80,130,255,.14)); border-color: var(--accent); }

/* ---------- history timeline ---------- */
.timeline { position: relative; }
.tl-day { font-size: 12px; font-weight: 600; color: var(--muted); margin: 18px 0 6px; text-transform: uppercase; letter-spacing: .04em; }
.tl-item { display: flex; gap: 12px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel);
  margin-bottom: 8px; animation: fadeUp .25s ease both; }
.tl-dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 5px; flex: none; background: var(--muted); }
.tl-item.change .tl-dot { background: var(--warn); }
.tl-item.ai .tl-dot { background: var(--accent); }
.tl-item.term .tl-dot { background: var(--ok); }
.tl-body { flex: 1; min-width: 0; }
.tl-title { font-weight: 600; margin: 4px 0 2px; }
.tl-text { white-space: pre-wrap; margin: 4px 0; word-break: break-word; }
.tl-cmd { display: block; margin-top: 4px; font: 12.5px ui-monospace, Menlo, Consolas, monospace; word-break: break-all; }
.tl-body details { margin: 6px 0; }
.tl-body details summary { cursor: pointer; font-size: 13px; color: var(--accent); }
.tl-body pre.cmds { margin: 4px 0 8px; font-size: 12px; }
@keyframes fadeUp { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 700px) { .linux-cmd .cmd-line { flex-direction: column; } .filters select, .filters input { width: 100%; } }
