/* Layout: retro desktop at a "high resolution" scale (small chrome, lots of room).
   Two-tone gradient wallpaper, blocky stone logo top-centre, icon columns left + right.
   Apps open in a full-height centre window; minimise docks a small live window bottom-left.
   Chrome is 90s; the Niko chat inside is a modern messenger. Single-theme by design. */
:root {
  --desk: radial-gradient(circle at 0% 100%, #ff00ff, #00ffff 100%);
  --icon-fg: #ffffff;
  --icon-sh: 1px 1px 0 #000c, 0 0 3px #0007;
  --chrome: #c0c0c0;
  --chrome-hi: #ffffff;
  --chrome-lo: #808080;
  --chrome-dk: #0a0a0a;
  --title: #000080;
  --title-2: #1084d0;
  --title-off: #808080;
  --ink: #0a0a0a;
  --muted: #4a4a4a;
  --paper: #ffffff;
  --ok: #138a36; --warn: #a86f00; --bad: #b3261e;
  /* messenger */
  --tg-accent: #3390ec;
  --tg-in: #ffffff;
  --tg-out: #e1fec6;
  --tg-meta: #8a9aa6;
  --tg-out-meta: #4fae4e;
  --tg-wall: #c6dcb0;
  --f-ui: "IBM Plex Sans", "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  --f-mono: "IBM Plex Mono", "SF Mono", Menlo, Consolas, monospace;
  --col: 84px;
  --dock-w: 390px;
  --top-m: 220px;
  --bar: 34px;
  color-scheme: light;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--desk);
  color: var(--ink);
  font-family: var(--f-ui);
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 1px dotted var(--ink); outline-offset: 2px; }
[hidden] { display: none !important; }

.screen { height: 100%; display: flex; flex-direction: column; }

/* ---------- desktop ---------- */
.desktop {
  position: relative;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--col) 1fr var(--col);
  grid-template-rows: auto 1fr;
  column-gap: 12px;
  padding-block: 10px;
  padding-left: max(12px, env(safe-area-inset-left, 0px));
  padding-right: max(12px, env(safe-area-inset-right, 0px));
}
.logo-wrap { grid-column: 2; grid-row: 1; justify-self: center; padding-top: 4px; }
#logo { display: block; image-rendering: pixelated; max-width: 100%; }

.icons { grid-row: 1 / span 2; display: flex; flex-direction: column; gap: 6px; align-items: center; }
.icons.left { grid-column: 1; }
.icons.right { grid-column: 3; }
.icon {
  width: 80px; background: none; border: 0; padding: 4px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  cursor: pointer; color: var(--icon-fg);
}
.icon img { width: 32px; height: 32px; image-rendering: pixelated; }
.icon span { font-size: 12px; line-height: 1.2; text-align: center; padding: 1px 3px; text-shadow: var(--icon-sh); }
.icon:hover span { text-decoration: underline; }
.icon.active span { background: var(--title); color: #fff; text-shadow: none; outline: 1px dotted #fff; }
.icon.active img { filter: sepia(1) hue-rotate(190deg) saturate(3) brightness(.75); }

/* ---------- bevels ---------- */
.raised {
  background: var(--chrome);
  box-shadow: inset -1px -1px var(--chrome-dk), inset 1px 1px var(--chrome-hi),
              inset -2px -2px var(--chrome-lo), inset 2px 2px #dfdfdf;
}
.sunken {
  background: var(--paper);
  box-shadow: inset -1px -1px var(--chrome-hi), inset 1px 1px var(--chrome-lo),
              inset -2px -2px #dfdfdf, inset 2px 2px var(--chrome-dk);
}
.btn { border: 0; padding: 4px 14px; cursor: pointer; min-height: 26px; }
.btn:active:not(:disabled), .btn.pressed {
  box-shadow: inset -1px -1px var(--chrome-hi), inset 1px 1px var(--chrome-dk),
              inset -2px -2px #dfdfdf, inset 2px 2px var(--chrome-lo);
}
.btn:disabled { color: var(--chrome-lo); text-shadow: 1px 1px 0 #fff; cursor: default; }

/* ---------- windows ---------- */
.win {
  position: absolute;
  display: flex; flex-direction: column;
  padding: 3px; z-index: 5;
}
.win.centre {
  top: 10px; bottom: 10px;
  left: 50%; transform: translateX(-50%);
  width: min(1040px, calc(100% - 2 * (var(--col) + 28px)));
}
/* something docked bottom-left: the middle window shifts right so nothing overlaps */
.desktop.has-dock .win.centre {
  left: calc(10px + var(--dock-w) + 14px); right: calc(var(--col) + 24px);
  width: auto; transform: none;
}
.desktop.has-dock:has(.win.centre:not([hidden])) .logo-wrap { visibility: hidden; }
.win.mini {
  left: 10px; bottom: 10px;
  width: var(--dock-w); height: min(520px, calc(100% - 20px));
  z-index: 8;
  box-shadow: inset -1px -1px var(--chrome-dk), inset 1px 1px var(--chrome-hi),
              inset -2px -2px var(--chrome-lo), inset 2px 2px #dfdfdf, 3px 3px 0 #0005;
}
.titlebar {
  display: flex; align-items: center; gap: 5px;
  background: linear-gradient(90deg, var(--title), var(--title-2));
  color: #fff; padding: 2px 2px 2px 5px; user-select: none; min-height: 22px;
}
.titlebar img { width: 16px; height: 16px; image-rendering: pixelated; }
.titlebar h2 { flex: 1; margin: 0; font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; letter-spacing: .01em; }
.tb-btn {
  width: 20px; height: 18px; min-height: 0; padding: 0;
  display: grid; place-items: center;
  font-family: var(--f-mono); font-size: 13px; font-weight: 500; line-height: 1; color: var(--ink);
}
.tb-close { margin-left: 2px; }
.win-body { flex: 1; min-height: 0; margin: 2px 0 0; overflow: auto; padding: 16px 18px; }
.win-body.flat { background: var(--chrome); box-shadow: none; }
.win-body.bare { padding: 0; overflow: hidden; background: var(--paper); }
.statusbar { display: flex; gap: 3px; padding: 3px 0 0; font-size: 12px; }
.statusbar > div { padding: 2px 8px; flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--chrome); }
.statusbar > div:last-child { flex: 0 0 auto; }
.win.mini .statusbar { display: none; }
.win.mini .win-body { padding: 10px; }
.win.mini .win-body.bare { padding: 0; }

.win-body h3 { font-size: 17px; margin: 0 0 6px; font-weight: 600; text-wrap: balance; }
.win-body p { line-height: 1.5; max-width: 65ch; margin: 0 0 10px; }
.muted { color: var(--muted); }

/* section label sits above its etched box */
.group { margin: 0 0 14px; min-width: 0; }
.group > h4 { margin: 0 0 5px 2px; font-size: 12px; font-weight: 600; }
.group > .box {
  padding: 10px 12px;
  box-shadow: inset -1px -1px var(--chrome-hi), inset 1px 1px var(--chrome-lo), inset -2px -2px var(--chrome-lo), inset 2px 2px var(--chrome-hi);
}

/* tables */
table.list { border-collapse: collapse; width: 100%; font-size: 12.5px; }
.list th { text-align: left; font-weight: 600; padding: 3px 8px; white-space: nowrap; }
.list td { padding: 4px 8px; border-bottom: 1px dotted var(--chrome-lo); vertical-align: middle; }
.list td.num { font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; white-space: nowrap; }
.list tbody tr:hover td { background: var(--title); color: #fff; }
.list tbody tr:hover .pill, .list tbody tr:hover .muted { color: #fff; }
.scroll-x { overflow-x: auto; }
.pill { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; white-space: nowrap; }
.pill::before { content: ""; width: 8px; height: 8px; background: currentColor; box-shadow: 1px 1px 0 var(--ink); flex: none; }
.pill.ok { color: var(--ok); } .pill.warn { color: var(--warn); } .pill.bad { color: var(--bad); } .pill.off { color: var(--muted); }

/* server */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.tile { padding: 10px 12px; display: flex; flex-direction: column; }
.tile .lbl { font-size: 11px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; }
.tile .val { font-family: var(--f-mono); font-size: 26px; font-weight: 500; line-height: 1.1; margin: 4px 0 2px; font-variant-numeric: tabular-nums; }
.tile .val.warn { color: var(--warn); } .tile .val.bad { color: var(--bad); }
.tile .sub { font-size: 12px; color: var(--muted); }
.tile svg { display: block; width: 100%; height: 26px; margin-top: 6px; }
.meters { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 2px 22px; }
.meter .row { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; margin-bottom: 3px; }
.meter .row span:last-child { font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.meter .bar { height: 18px; padding: 3px; margin-bottom: 8px; }
.meter .fill { height: 100%; --c: var(--title); background: repeating-linear-gradient(90deg, var(--c) 0 10px, transparent 10px 12px); }
.meter .fill.warn { --c: var(--warn); } .meter .fill.bad { --c: var(--bad); }

/* ---------- Messenger: agent list + modern chat ---------- */
.ms { display: grid; grid-template-columns: 260px 1fr; height: 100%; min-height: 0; }
.ms-list { overflow-y: auto; background: #fff; border-right: 1px solid #e4e8eb; padding: 4px 0; }
.ms-loading { padding: 14px; color: var(--tg-meta); font-size: 12.5px; }
.ms-item {
  display: flex; align-items: center; gap: 10px; width: 100%;
  border: 0; background: none; padding: 8px 10px; text-align: left; cursor: pointer;
}
.ms-item:hover { background: #f2f4f6; }
.ms-item.active { background: var(--tg-accent); color: #fff; }
.ms-txt { display: flex; flex-direction: column; gap: 1px; min-width: 0; flex: 1; }
.ms-top { display: flex; justify-content: space-between; align-items: baseline; gap: 6px; }
.ms-top b { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-top time { font-size: 11px; color: var(--tg-meta); flex: none; }
.ms-prev { font-size: 12.5px; color: var(--tg-meta); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ms-prev.on { color: var(--tg-accent); }
.ms-item.active time, .ms-item.active .ms-prev { color: #ffffffd0; }
.ava {
  width: 42px; height: 42px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  color: #fff; font-weight: 600; font-size: 15px; letter-spacing: .02em;
}
.ava.niko { background: linear-gradient(160deg, #6ec3ff, #3390ec); }
.ava img { width: 62%; height: 62%; image-rendering: pixelated; }
.ava.sm { width: 34px; height: 34px; font-size: 13px; }
.tg { display: flex; flex-direction: column; height: 100%; min-height: 0; min-width: 0; background: var(--tg-in); }
.tg-head { display: flex; align-items: center; gap: 10px; padding: 7px 12px; background: #fff; border-bottom: 1px solid #e4e8eb; }
.tg-who { display: flex; flex-direction: column; min-width: 0; }
.tg-who b { font-size: 14px; font-weight: 600; }
.tg-sub { font-size: 12px; color: var(--tg-meta); }
.tg-sub.on { color: var(--tg-accent); }
.tg-log {
  flex: 1; min-height: 0; overflow-y: auto;
  padding: 10px 12px 12px;
  display: flex; flex-direction: column; gap: 3px;
  background:
    radial-gradient(circle at 25% 25%, #ffffff40 1.2px, transparent 1.6px) 0 0 / 18px 18px,
    radial-gradient(circle at 75% 75%, #ffffff2a 1.2px, transparent 1.6px) 0 0 / 18px 18px,
    linear-gradient(165deg, #d3e6bd, var(--tg-wall) 55%, #b7d4a0);
}
.tg-log > :first-child { margin-top: auto; }
.bub {
  max-width: min(80%, 560px);
  padding: 6px 9px 5px; border-radius: 12px;
  font-size: 13.5px; line-height: 1.38;
  box-shadow: 0 1px 1px #0000001c;
  white-space: pre-wrap; overflow-wrap: anywhere;
}
.bub.in { align-self: flex-start; background: var(--tg-in); border-bottom-left-radius: 4px; }
.bub.out { align-self: flex-end; background: var(--tg-out); border-bottom-right-radius: 4px; }
.bub.err { align-self: center; background: #fdecea; color: #8f1d15; font-size: 12.5px; border-radius: 8px; }
.bub.turn { margin-top: 6px; }
.bub .meta { float: right; margin: 7px 0 -5px 10px; font-size: 11px; color: var(--tg-meta); white-space: nowrap; }
.bub.out .meta { color: var(--tg-out-meta); }
.bub code { font-family: var(--f-mono); font-size: 12.5px; background: #0000000d; padding: 0 3px; border-radius: 3px; }
.bub pre { font-family: var(--f-mono); font-size: 12px; background: #0000000b; padding: 6px 8px; border-radius: 6px; overflow-x: auto; white-space: pre; margin: 3px 0; }
.bub a { color: var(--tg-accent); }
.chip { align-self: center; font-size: 12px; font-weight: 500; color: #fff; background: #0000003d; padding: 2px 10px; border-radius: 10px; margin: 6px 0 4px; }
.typing { display: inline-flex; gap: 4px; padding: 4px 2px; }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--tg-meta); animation: blink 1.2s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-2px); } }
.tg-empty { align-self: center; text-align: center; font-size: 12.5px; color: #fff; background: #0000003d; padding: 8px 14px; border-radius: 12px; }
.note { align-self: center; max-width: 90%; white-space: pre-wrap; font-size: 12.5px; color: #fff; background: #00000048; padding: 5px 12px; border-radius: 12px; margin: 4px 0; }
.cmds { display: flex; flex-direction: column; padding: 4px 0; background: #fff; border-top: 1px solid #e4e8eb; }
.cmds button { display: flex; align-items: baseline; gap: 12px; border: 0; background: none; padding: 6px 14px; text-align: left; cursor: pointer; font-size: 13px; }
.cmds button:hover, .cmds button:focus-visible { background: #f2f4f6; outline: none; }
.cmds b { color: var(--tg-accent); font-weight: 600; min-width: 44px; }
.cmds span { color: var(--tg-meta); }
.tg-compose { display: flex; align-items: flex-end; gap: 8px; padding: 7px 8px 7px 14px; background: #fff; border-top: 1px solid #e4e8eb; }
.tg-compose textarea { flex: 1; min-width: 0; border: 0; resize: none; font-size: 13.5px; line-height: 1.38; padding: 7px 0; max-height: 120px; background: transparent; outline: none; }
.tg-send { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--tg-accent); color: #fff; cursor: pointer; display: grid; place-items: center; flex: none; }
.tg-send:disabled { background: #b5cfe9; cursor: default; }
.tg-send svg { width: 17px; height: 17px; margin-left: 2px; }
/* docked: the agent list shrinks to a column of avatars */
.win.mini .ms { grid-template-columns: 56px 1fr; }
.win.mini .ms-item { justify-content: center; padding: 7px 0; }
.win.mini .ms-txt { display: none; }
.win.mini .ava { width: 36px; height: 36px; font-size: 13px; }
.win.mini .tg-head { padding: 5px 10px; }
.win.mini .ava.sm { width: 28px; height: 28px; font-size: 12px; }
.win.mini .bub { font-size: 13px; max-width: 88%; }

/* unread badges */
.badge {
  display: inline-block; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--tg-accent); color: #fff; font: 600 11px/18px var(--f-ui); text-align: center; flex: none;
}
.ms-bot { display: flex; align-items: center; gap: 6px; min-width: 0; }
.ms-bot .ms-prev { flex: 1; min-width: 0; }
.ms-item.unread .ms-top b { font-weight: 700; }
.ms-item.unread .ms-prev { color: #3b4550; }
.ms-item.active .badge { background: #fff; color: var(--tg-accent); }
.ava-wrap { position: relative; display: inline-grid; flex: none; }
.ava-wrap .badge { position: absolute; top: -4px; right: -5px; display: none; min-width: 14px; height: 14px; line-height: 14px; padding: 0 4px; font-size: 10px; border: 2px solid #fff; box-sizing: content-box; }
.win.mini .ava-wrap .badge { display: block; }
.icon { position: relative; }
.icon > .badge { position: absolute; top: 0; left: calc(50% + 8px); background: #e5484d; box-shadow: 1px 1px 0 #0006; }
.task > .badge { margin-left: auto; background: #e5484d; height: 16px; line-height: 16px; min-width: 16px; font-size: 10px; padding: 0 4px; }
.startmenu .badge { display: none; }

/* classic balloon notification above the clock */
.toast {
  position: absolute; right: max(6px, env(safe-area-inset-right, 0px)); bottom: calc(var(--bar) + 8px); z-index: 40;
  width: min(320px, calc(100% - 12px)); padding: 8px 10px 9px;
  background: #ffffe1; border: 1px solid var(--ink); box-shadow: 2px 2px 0 #0005;
  cursor: pointer; font-size: 12.5px;
}
.toast-head { display: flex; align-items: center; gap: 6px; margin-bottom: 4px; }
.toast-head img { width: 16px; height: 16px; image-rendering: pixelated; }
.toast-head b { flex: 1; }
.toast-x { border: 0; background: none; cursor: pointer; font-size: 15px; line-height: 1; padding: 0 2px; }
.toast p { margin: 0 0 4px; line-height: 1.4; overflow-wrap: anywhere; }
.toast-hint { font-size: 11.5px; color: var(--muted); }

/* ---------- Dashboard: modern panel inside the retro window ---------- */
.db {
  --db-bg: #f5f6f8; --db-card: #ffffff; --db-line: #e5e7eb; --db-ink: #0b0f14; --db-sub: #4f5866; --db-faint: #858d99;
  --db-up: #11a04f; --db-down: #e2474c; --db-slow: #d18800; --db-btn: #0b0f14;
  --f-db: "Geist", "IBM Plex Sans", system-ui, sans-serif; --f-dbm: "Geist Mono", "IBM Plex Mono", ui-monospace, monospace;
  container-type: inline-size;
  height: 100%; overflow-y: auto;
  background: var(--db-bg); color: var(--db-ink); font-family: var(--f-db); font-size: 14px;
  padding: 26px clamp(16px, 3vw, 34px) 34px;
  -webkit-font-smoothing: antialiased;
}
.db-muted { color: var(--db-faint); margin: 0; }
.db-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 18px; margin-bottom: 20px; }
.db h1 { font-size: 26px; font-weight: 600; letter-spacing: -0.025em; margin: 0; line-height: 1.15; }
.db-lede { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 6px 0 0; color: var(--db-sub); font-size: 13.5px; }
.db-lede a { color: inherit; text-decoration: none; border-bottom: 1px solid var(--db-line); }
.db-lede a:hover { color: var(--db-ink); border-color: var(--db-ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--db-faint); flex: none; }
.dot.up { background: var(--db-up); box-shadow: 0 0 0 3px #11a04f22; }
.dot.down { background: var(--db-down); box-shadow: 0 0 0 3px #e2474c22; }
.dot.slow { background: var(--db-slow); }
.db-kpis { display: flex; margin: 0; background: var(--db-card); border: 1px solid var(--db-line); border-radius: 12px; overflow: hidden; }
.db-kpis div { padding: 9px 18px 10px; }
.db-kpis div + div { border-left: 1px solid var(--db-line); }
.db-kpis dt { font-size: 11.5px; color: var(--db-faint); margin-bottom: 2px; white-space: nowrap; }
.db-kpis dd { margin: 0; font-family: var(--f-dbm); font-size: 18px; font-weight: 500; font-variant-numeric: tabular-nums; white-space: nowrap; }
.db small { font-size: 12px; color: var(--db-faint); font-weight: 400; }
.db .bad { color: var(--db-down); }

.db-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.pc, .db-card {
  background: var(--db-card); border: 1px solid var(--db-line); border-radius: 14px;
  box-shadow: 0 1px 2px #0b0f140a, 0 10px 28px -16px #0b0f1426;
}
.pc { padding: 18px 18px 16px; display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.pc-top { display: flex; align-items: center; gap: 12px; }
.pc-fav {
  position: relative; width: 40px; height: 40px; border-radius: 10px; flex: none; overflow: hidden;
  display: grid; place-items: center; background: #f1f3f5; border: 1px solid var(--db-line);
  font-weight: 600; font-size: 16px; color: var(--db-sub);
}
.pc-fav img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; padding: 5px; background: #fff; }
.pc-fav.lg { width: 48px; height: 48px; border-radius: 12px; }
.pc-id { flex: 1; min-width: 0; }
.pc-id h3 { margin: 0; font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pc-id a { font-size: 13px; color: var(--db-sub); text-decoration: none; }
.pc-id a:hover { color: var(--db-ink); text-decoration: underline; }
.st { display: inline-flex; align-items: center; gap: 7px; flex: none; font-size: 12.5px; font-weight: 500; padding: 4px 10px 4px 9px; border-radius: 999px; background: #f1f3f5; color: var(--db-sub); }
.st i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st.up { background: #11a04f14; color: var(--db-up); }
.st.up i { animation: beat 2.4s infinite; }
.st.down { background: #e2474c14; color: var(--db-down); }
.st.slow { background: #d1880014; color: var(--db-slow); }
@keyframes beat { 0% { box-shadow: 0 0 0 0 #11a04f66; } 70% { box-shadow: 0 0 0 6px #11a04f00; } 100% { box-shadow: 0 0 0 0 #11a04f00; } }
.pc-err { margin: -6px 0 0; font-size: 12.5px; color: var(--db-down); }
.pc-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.pc-stats > div > span { display: block; font-size: 11.5px; color: var(--db-faint); margin-bottom: 3px; white-space: nowrap; }
.pc-stats b { font-family: var(--f-dbm); font-size: 18px; font-weight: 500; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.pc-bar { display: grid; grid-template-columns: repeat(48, minmax(0, 1fr)); gap: 2px; height: 24px; }
.pc-bar i { border-radius: 2px; background: #eceef1; }
.pc-bar i.up { background: var(--db-up); }
.pc-bar i.partial { background: var(--db-slow); }
.pc-bar i.down { background: var(--db-down); }
.pc-axis { display: flex; justify-content: space-between; gap: 8px; margin-top: 6px; font-size: 11px; color: var(--db-faint); }
.pc-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding-top: 14px; border-top: 1px solid var(--db-line); }
.pc-tags { display: flex; flex-wrap: wrap; gap: 6px; min-width: 0; }
.pc-tags span { font-size: 11.5px; color: var(--db-sub); background: #f5f6f8; border: 1px solid var(--db-line); padding: 2px 8px; border-radius: 6px; white-space: nowrap; }
.db-btn {
  font: 500 13px var(--f-db); color: #fff; background: var(--db-btn); border: 0; border-radius: 9px;
  padding: 8px 14px; cursor: pointer; white-space: nowrap; box-shadow: 0 1px 2px #0b0f1433, inset 0 1px 0 #ffffff1f;
}
.db-btn:hover { background: #252b33; }
.db-btn:focus-visible { outline: 2px solid #0b0f1466; outline-offset: 2px; }

.db-back { display: inline-block; background: none; border: 0; padding: 0; margin-bottom: 12px; font: 500 13px var(--f-db); color: var(--db-sub); cursor: pointer; }
.db-back:hover { color: var(--db-ink); }
.db-title { display: flex; align-items: center; gap: 14px; }
.db-card { padding: 18px 20px; margin-bottom: 16px; min-width: 0; }
.db-two { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); gap: 16px; }
.db-two .db-card { margin-bottom: 16px; }
.an-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 14px; }
.an-head h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; margin: 0; }
.an-head > span { font-size: 12px; color: var(--db-faint); }
.an-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.live { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--db-up); font-weight: 500; }
.live i { width: 7px; height: 7px; border-radius: 50%; background: currentColor; animation: beat 2.4s infinite; }
.seg { display: inline-flex; background: #f1f3f5; border: 1px solid var(--db-line); border-radius: 9px; padding: 2px; }
.seg button { border: 0; background: none; font: 500 12.5px var(--f-db); color: var(--db-sub); padding: 5px 10px; border-radius: 7px; cursor: pointer; }
.seg button.on { background: var(--db-card); color: var(--db-ink); box-shadow: 0 1px 2px #0b0f1422; }
.an-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--db-line); border: 1px solid var(--db-line); border-radius: 11px; overflow: hidden; margin-bottom: 16px; }
.an-kpis div { background: var(--db-card); padding: 12px 14px; min-width: 0; }
.an-kpis span { display: block; font-size: 12px; color: var(--db-faint); margin-bottom: 4px; }
.an-kpis b { display: block; font-family: var(--f-dbm); font-size: 24px; font-weight: 500; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.an-kpis.off b { color: #c3c8cf; }
.dl { font-size: 12px; font-weight: 500; }
.dl.pos { color: var(--db-up); } .dl.neg { color: var(--db-down); } .dl.flat { color: var(--db-faint); font-weight: 400; }
.an-empty { padding: 16px 18px; border-radius: 11px; background: #f8f9fa; border: 1px dashed #d4d8de; }
.an-empty h3 { margin: 0 0 6px; font-size: 14.5px; font-weight: 600; }
.an-empty p { margin: 0 0 12px; color: var(--db-sub); line-height: 1.55; max-width: 68ch; }
.an-empty p:last-child { margin-bottom: 0; }
.chart { display: block; width: 100%; height: auto; overflow: visible; }
.chart text { font: 10.5px var(--f-dbm); fill: var(--db-faint); }
.chart .grid { stroke: #eceef1; stroke-width: 1; }
.chart .bar { fill: #0b0f14; opacity: .85; }
.chart .bar:hover { opacity: 1; }
.chart .line { fill: none; stroke: #2f7df6; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .area { fill: #2f7df614; }
.chart .downmark { fill: var(--db-down); }
.legend { display: flex; gap: 16px; margin-top: 8px; font-size: 12px; color: var(--db-sub); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.legend .k-bar { background: #0b0f14; } .legend .k-line { background: #2f7df6; height: 3px; vertical-align: 2px; }
.db-foot { margin: 12px 0 0; font-size: 12px; color: var(--db-faint); }
.rank { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rank li { position: relative; display: flex; justify-content: space-between; gap: 12px; padding: 6px 10px; border-radius: 7px; overflow: hidden; font-size: 13px; }
.rk-bar { position: absolute; inset: 0 auto 0 0; background: #2f7df612; border-radius: 7px; }
.rk-k { position: relative; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rk-v { position: relative; font-family: var(--f-dbm); font-variant-numeric: tabular-nums; color: var(--db-sub); }
.inc { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; font-size: 13px; }
.inc li { display: flex; align-items: center; gap: 10px; }
.inc li span:nth-child(2) { flex: 1; min-width: 0; }
.inc time { color: var(--db-faint); font-size: 12px; white-space: nowrap; }
@container (max-width: 700px) {
  .db-grid, .db-two { grid-template-columns: minmax(0, 1fr); }
  .an-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .db-kpis { width: 100%; }
  .db-kpis div { flex: 1; padding-inline: 12px; }
}
@media (prefers-reduced-motion: reduce) { .st.up i, .live i { animation: none; } }

/* settings */
.swatches { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 12px; }
.swatches label { display: flex; flex-direction: column; align-items: center; gap: 5px; cursor: pointer; font-size: 12px; }
.swatches .prev { width: 84px; height: 52px; border: 1px solid var(--ink); box-shadow: 1px 1px 0 #fff; }
.swatches input { margin: 0; }
.swatches .lab { display: flex; align-items: center; gap: 5px; }
.acct { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }

/* ---------- login dialog ---------- */
.modal-back { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; }
.dialog { width: min(440px, 100%); padding: 3px; }
.dlg-body { display: grid; grid-template-columns: auto 1fr auto; gap: 14px; padding: 14px 12px 12px; align-items: start; }
.dlg-icon { width: 40px; height: 40px; image-rendering: pixelated; }
.dlg-main p { margin: 2px 0 10px; line-height: 1.4; }
.fields { display: grid; grid-template-columns: auto 1fr; gap: 7px 10px; align-items: center; }
.fields input { border: 0; padding: 4px 6px; min-width: 0; width: 100%; }
.dlg-err { color: var(--bad); margin: 10px 0 0 !important; font-size: 12.5px; }
.dlg-btns { display: flex; flex-direction: column; gap: 7px; }
.dlg-btns .btn { min-width: 80px; }
.dialog.shake { animation: shake .3s; }
@keyframes shake { 25% { transform: translateX(-6px); } 75% { transform: translateX(6px); } }

/* ---------- taskbar ---------- */
.taskbar {
  height: var(--bar); flex: none;
  padding-block: 4px;
  padding-left: max(3px, env(safe-area-inset-left, 0px));
  padding-right: max(3px, env(safe-area-inset-right, 0px));
  display: flex; align-items: center; gap: 5px;
  position: relative; z-index: 20;
  background: var(--chrome);
  box-shadow: inset 0 1px #dfdfdf, inset 0 2px #fff;
}
.start { display: flex; align-items: center; gap: 5px; font-weight: 700; padding: 2px 8px 2px 5px; height: 26px; }
.start img { width: 18px; height: 18px; image-rendering: pixelated; }
.tasks { flex: 1; display: flex; gap: 3px; min-width: 0; overflow: hidden; }
.task { display: flex; align-items: center; gap: 5px; height: 26px; padding: 0 8px; width: 150px; min-width: 0; font-size: 12px; }
.task img { width: 16px; height: 16px; image-rendering: pixelated; flex: none; }
.task span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.task.pressed { background-image: repeating-conic-gradient(#c0c0c0 0 25%, #fff 0 50%); background-size: 2px 2px; font-weight: 600; }
/* a minimised window wants attention: blink a few times, then stay lit */
.task.flash { background: #ffb547; font-weight: 600; animation: taskflash 1s steps(1, end) 8; }
@keyframes taskflash { 0% { background: var(--title); color: #fff; } 50% { background: #ffb547; color: var(--ink); } }
.tray { display: flex; align-items: center; gap: 8px; height: 26px; padding: 0 10px; font-size: 12px; }
.tray.sunken { background: var(--chrome); }
.tray .dot { width: 8px; height: 8px; background: #8a8a8a; box-shadow: 1px 1px 0 var(--ink); }
.tray .dot.ok { background: var(--ok); } .tray .dot.bad { background: var(--bad); }
.clock { font-family: var(--f-mono); font-size: 12.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.tray { padding: 0 3px; }
.tray-btn {
  display: flex; align-items: center; gap: 10px; height: 100%;
  border: 0; background: none; padding: 0 7px; cursor: pointer; font-size: 12px; white-space: nowrap;
}
.tray-btn:hover, .tray-btn.pressed { background: #d4d4d4; }

/* calendar pop-up above the clock */
.calendar {
  position: absolute; right: max(4px, env(safe-area-inset-right, 0px)); bottom: calc(var(--bar) + 4px);
  z-index: 45; width: min(272px, calc(100% - 8px)); padding: 3px;
}
.cal-body { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cal-nav b { font-size: 13px; font-weight: 600; }
.cal-nav .btn { min-height: 22px; padding: 0 10px; font-size: 15px; line-height: 1; }
.cal-wrap { padding: 4px; }
.cal-grid { width: 100%; border-collapse: collapse; table-layout: fixed; font-size: 12.5px; }
.cal-grid th { font-size: 11.5px; font-weight: 600; color: var(--muted); padding: 3px 0 4px; }
.cal-grid td { text-align: center; padding: 4px 0; font-variant-numeric: tabular-nums; }
.cal-grid td.wkend { color: #8a2b2b; }
.cal-grid td.out { color: #ababab; }
.cal-grid td.today { background: var(--title); color: #fff; font-weight: 700; }
.cal-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.cal-foot p { margin: 0; font-size: 12px; line-height: 1.35; }
.cal-foot .btn { min-height: 24px; padding: 2px 10px; flex: none; }

.startmenu {
  position: absolute; left: max(3px, env(safe-area-inset-left, 0px)); bottom: var(--bar);
  display: flex; padding: 3px; z-index: 30; min-width: 220px;
}
.startmenu .band {
  width: 26px; background: linear-gradient(0deg, var(--title), var(--title-2));
  color: #fff; writing-mode: vertical-rl; transform: rotate(180deg);
  font-weight: 700; font-size: 15px; padding: 8px 3px; letter-spacing: .05em;
}
.startmenu ul { list-style: none; margin: 0; padding: 2px; flex: 1; }
.startmenu li button {
  width: 100%; display: flex; align-items: center; gap: 10px; border: 0; background: none;
  padding: 5px 12px 5px 6px; cursor: pointer; text-align: left; font-size: 13px;
}
.startmenu li button img { width: 24px; height: 24px; image-rendering: pixelated; }
.startmenu li button:hover, .startmenu li button:focus-visible { background: var(--title); color: #fff; outline: none; }
.startmenu hr { border: 0; border-top: 1px solid var(--chrome-lo); border-bottom: 1px solid #fff; margin: 3px 2px; }

.shutdown {
  position: fixed; inset: 0; z-index: 100; background: #000;
  display: grid; place-items: center; text-align: center; cursor: pointer;
  color: #ff9d2e; font-size: clamp(18px, 2.6vw, 28px); font-weight: 600; padding: 24px;
}
.shutdown small { display: block; color: #9a9a9a; font-size: 13px; font-weight: 400; margin-top: 16px; }

/* ---------- phone ---------- */
@media (max-width: 760px) {
  .desktop { grid-template-columns: auto auto; justify-content: center; grid-template-rows: auto auto 1fr; column-gap: 2px; row-gap: 4px; }
  .logo-wrap { grid-column: 1 / -1; grid-row: 1; }
  .icons { grid-row: 2; flex-direction: row; flex-wrap: wrap; justify-content: center; gap: 2px; }
  .icons.left { grid-column: 1; } .icons.right { grid-column: 2; }
  .icon { width: 76px; }
  .win.centre, .desktop.has-dock .win.centre { top: var(--top-m); left: 6px; right: 6px; bottom: 6px; width: auto; transform: none; }
  .win.mini { left: 6px; right: 6px; width: auto; height: 55%; bottom: 6px; }
  .ms { grid-template-columns: 58px 1fr; }
  .ms-item { justify-content: center; padding: 7px 0; }
  .ms-txt { display: none; }
  .ava { width: 38px; height: 38px; font-size: 13px; }
  .ava-wrap .badge { display: block; }
  .task { width: auto; }
  .task span { display: none; }
  .win-body { padding: 12px; }
  .dlg-body { grid-template-columns: auto 1fr; }
  .dlg-btns { grid-column: 1 / -1; flex-direction: row; justify-content: flex-end; }
}
@media (prefers-reduced-motion: reduce) { .dialog.shake, .typing i, .task.flash { animation: none; } }
