:root {
  --bg: #0f1216; --panel: #171b21; --panel2: #1e232b; --line: #2a303a;
  --text: #e7eaee; --muted: #8b94a3; --accent: #d9a441; --accent-ink: #1a1408;
  --up: #3fb97a; --down: #e5575a; --warn: #e3a33b; --info: #5b9bd5;
  --radius: 12px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text); font: 15px/1.5 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
.hidden { display: none !important; }
.muted { color: var(--muted); }
.err { color: var(--down); min-height: 1.2em; margin: 0; }
.up { color: var(--up); } .down { color: var(--down); }

.brand { font-weight: 800; letter-spacing: .5px; font-size: 18px; }
.brand span { color: var(--accent); margin-left: 2px; font-weight: 600; }
.brand.big { font-size: 28px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 16px; padding: 12px 20px; background: rgba(15,18,22,.92); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
#tabs { display: flex; gap: 4px; overflow-x: auto; flex: 1; scrollbar-width: none; }
#tabs button { background: none; border: 0; color: var(--muted); padding: 8px 12px; border-radius: 8px; cursor: pointer; font: inherit; white-space: nowrap; }
#tabs button.active { background: var(--panel2); color: var(--text); }
#tabs button:hover { color: var(--text); }

main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
#banner { max-width: 1180px; margin: 0 auto; padding: 0 16px; }
.alert { margin-top: 16px; padding: 12px 14px; border-radius: var(--radius); border: 1px solid; font-size: 14px; }
.alert.warn { border-color: #6b5222; background: #2a2214; }
.alert.danger { border-color: #6b2a2b; background: #2a1617; }
.alert.info { border-color: #24415e; background: #141f2a; }

h2 { font-size: 20px; margin: 4px 0 16px; }
h3 { font-size: 15px; margin: 0 0 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: .6px; }
.grid { display: grid; gap: 14px; }
.g4 { grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.g2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; min-width: 0; }
.stat .label { color: var(--muted); font-size: 13px; }
.stat .value { font-size: 24px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.stat .sub { color: var(--muted); font-size: 12px; margin-top: 2px; }
.section { margin-top: 22px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.spread { justify-content: space-between; }

.meter { height: 8px; background: var(--panel2); border-radius: 99px; overflow: hidden; margin-top: 10px; }
.meter > div { height: 100%; background: var(--accent); }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 500; font-size: 12px; text-transform: uppercase; letter-spacing: .5px; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.table-wrap { overflow-x: auto; }

.btn { border: 1px solid var(--line); background: var(--panel2); color: var(--text); padding: 8px 14px; border-radius: 8px; cursor: pointer; font: inherit; }
.btn:hover { border-color: #3a424f; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.danger { background: #3a1719; border-color: #6b2a2b; color: #ffb3b4; font-weight: 600; }
.btn.ghost { background: none; }
.btn.small { padding: 5px 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 99px; font-size: 12px; background: var(--panel2); color: var(--muted); border: 1px solid var(--line); }
.badge.on { color: var(--up); border-color: #24563d; }
.badge.live { color: #ffb3b4; border-color: #6b2a2b; background: #2a1617; }
.badge.paper { color: var(--info); border-color: #24415e; }

.pre { white-space: pre-wrap; word-wrap: break-word; }
.draft .caption { white-space: pre-wrap; background: var(--panel2); padding: 10px; border-radius: 8px; margin: 8px 0; font-size: 14px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 4px 10px; font-size: 14px; }
.kv div:nth-child(odd) { color: var(--muted); }

form.settings label { display: block; font-size: 13px; color: var(--muted); margin: 12px 0 4px; }
input, select, textarea { width: 100%; background: var(--panel2); border: 1px solid var(--line); color: var(--text); border-radius: 8px; padding: 9px 10px; font: inherit; }
textarea { min-height: 90px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #5a4620; border-color: var(--accent); }
.check { display: flex !important; align-items: center; gap: 8px; color: var(--text) !important; }
.check input { width: auto; }
.hint { font-size: 12px; color: var(--muted); margin-top: 4px; }

.log-line { font: 13px/1.5 ui-monospace, Menlo, Consolas, monospace; padding: 4px 0; border-bottom: 1px solid var(--line); }
.log-line .lv-error { color: var(--down); } .log-line .lv-warn { color: var(--warn); }

.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: 100%; max-width: 360px; display: grid; gap: 12px; }

#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel2); border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0; transition: opacity .2s; pointer-events: none; max-width: calc(100% - 32px); }
#toast.show { opacity: 1; }

@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding: 10px 16px; }
  #tabs { order: 3; flex-basis: 100%; }
  .g2 { grid-template-columns: 1fr; }
  .stat .value { font-size: 20px; }
}

/* ---------- virtual office ---------- */
.office { position: relative; border-radius: 18px; padding: 18px; border: 1px solid var(--line);
  background: repeating-linear-gradient(45deg, #1a1f26 0 22px, #1c2129 22px 44px); overflow: hidden; }
.office-top { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.office-floor { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-top: 16px; }
.desk-spot { all: unset; box-sizing: border-box; cursor: pointer; position: relative; display: flex; flex-direction: column; align-items: center;
  background: rgba(23,27,33,.85); border: 1px solid var(--line); border-radius: 14px; padding: 12px 10px 12px; min-width: 0; transition: border-color .2s, transform .2s; }
.desk-spot:hover, .desk-spot:focus-visible { border-color: var(--accent); transform: translateY(-2px); }
.desk-spot.ceo { background: linear-gradient(180deg, rgba(217,164,65,.08), rgba(23,27,33,.9)); border-color: #4a3c22; box-shadow: inset 0 0 0 3px rgba(120,170,220,.06); }
.room-label { align-self: flex-start; font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: .5px; }
.bubble { position: relative; margin: 8px 0 6px; background: #f4f1ea; color: #222; font-size: 12.5px; line-height: 1.35; padding: 7px 10px; border-radius: 12px;
  max-width: 100%; min-height: 34px; text-align: center; overflow-wrap: anywhere; }
.bubble small { display: block; color: #777; font-size: 11px; }
.bubble::after { content: ""; position: absolute; left: 50%; bottom: -6px; margin-left: -6px; border: 6px solid transparent; border-bottom: 0; border-top-color: #f4f1ea; }
.scene { position: relative; width: 150px; height: 128px; }
.person { position: absolute; left: 56px; top: 0; width: 80px; height: 90px; animation: breathe 4s ease-in-out infinite; transform-origin: 50% 100%; }
.desk { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: linear-gradient(#8a6a48, #6e5338); border-radius: 6px; box-shadow: 0 6px 0 #4b3826; }
.monitor { position: absolute; left: 4px; top: -34px; width: 58px; height: 40px; background: #2b2f36; border-radius: 5px; padding: 4px; }
.monitor::after { content: ""; position: absolute; left: 24px; bottom: -8px; width: 10px; height: 8px; background: #2b2f36; }
.screen { width: 100%; height: 100%; border-radius: 2px; background: #11161c; padding: 4px; display: flex; flex-direction: column; gap: 3px; overflow: hidden; }
.screen i { display: block; height: 3px; border-radius: 2px; background: #2d3540; width: 70%; }
.screen i:nth-child(2) { width: 45%; } .screen i:nth-child(3) { width: 60%; }
.mug { position: absolute; right: 12px; top: -10px; width: 11px; height: 12px; background: #e7eaee; border-radius: 0 0 3px 3px; }
.nameplate { display: flex; align-items: center; gap: 6px; margin-top: 10px; font-size: 14px; }
.lamp { width: 9px; height: 9px; border-radius: 50%; background: #555; }
.meta { font-size: 12px; color: var(--muted); text-align: center; margin-top: 2px; }
.st-idle .lamp { background: var(--up); }
.st-busy .lamp { background: var(--accent); box-shadow: 0 0 8px var(--accent); animation: blink 1s infinite; }
.st-queue .lamp { background: var(--info); }
.st-stop .lamp { background: var(--down); }
.st-busy .screen { background: #0e2a1d; }
.st-busy .screen i { background: var(--up); animation: code 1.2s linear infinite; }
.st-busy .screen i:nth-child(2) { animation-delay: .3s; } .st-busy .screen i:nth-child(3) { animation-delay: .6s; }
.st-busy .arm.l { animation: type .25s ease-in-out infinite alternate; }
.st-busy .arm.r { animation: type .25s ease-in-out infinite alternate-reverse; }
.st-busy .bubble { background: #fff4d6; }
.st-off .person { opacity: .55; filter: grayscale(.6); animation: none; transform: rotate(-6deg) translateY(4px); }
.st-off .eyes { transform: scaleY(.15); transform-origin: 40px 27px; }
.zzz { position: absolute; left: 124px; top: -6px; color: var(--muted); font-weight: 700; font-size: 13px; animation: float 2.4s ease-in-out infinite; }
.zzz span { font-size: 16px; } .zzz span + span { font-size: 19px; }
.board { background: #f4f1ea; color: #222; border-radius: 12px; padding: 14px; border: 6px solid #7a5b3d; display: flex; flex-direction: column; gap: 6px; }
.board-title { font-weight: 800; font-size: 13px; text-transform: uppercase; letter-spacing: .6px; color: #7a5b3d; }
.board-row { display: flex; justify-content: space-between; gap: 8px; font-size: 14px; border-bottom: 1px dashed #c9c1b0; padding: 3px 0; }
.inbox { display: flex; flex-direction: column; gap: 6px; margin-top: auto; padding-top: 8px; }
.tray { all: unset; cursor: pointer; background: #fff; border: 1px solid #d6cfbf; border-radius: 8px; padding: 7px 10px; font-size: 13px; }
.tray:hover { border-color: #7a5b3d; }
.plants { display: flex; justify-content: space-between; font-size: 22px; margin-top: 10px; opacity: .85; }
.modal { position: fixed; inset: 0; z-index: 20; background: rgba(0,0,0,.6); display: flex; align-items: center; justify-content: center; padding: 16px; }
.modal-card { width: 100%; max-width: 520px; max-height: 90vh; overflow: auto; }
.modal textarea { width: 100%; background: var(--panel2); color: var(--text); border: 1px solid var(--line); border-radius: 8px; padding: 10px; font: inherit; resize: vertical; }
.mini-avatar { width: 48px; height: 54px; position: relative; }
.mini-avatar .person { position: static; width: 48px; height: 54px; animation: none; }
.mini-log { font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.mini-log .lv-error { color: var(--down); } .mini-log .lv-warn { color: var(--warn); }
@keyframes breathe { 50% { transform: translateY(-1.5px); } }
@keyframes type { to { transform: translateY(-3px); } }
@keyframes blink { 50% { opacity: .35; } }
@keyframes code { 0% { width: 10%; } 100% { width: 90%; } }
@keyframes float { 50% { transform: translateY(-5px); } }
@media (max-width: 760px) {
  .office { padding: 10px; }
  .office-top, .office-floor { grid-template-columns: minmax(0, 1fr); gap: 10px; }
}
@media (prefers-reduced-motion: reduce) { .office * { animation: none !important; } }
[hidden] { display: none !important; }
