/* NEXUS OS browser demo. Only the eight NEXUS shades are used. */
:root {
  --black: #000000; --near-black: #0A0A0A; --charcoal: #171717; --dark-gray: #242424;
  --mid-gray: #777777; --light-gray: #BDBDBD; --off-white: #EAEAEA; --white: #FFFFFF;
  --font: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;
  /* NEXUS Black (default) */
  --bg: var(--black); --window: var(--near-black); --panel: var(--charcoal); --raised: var(--dark-gray);
  --border: var(--dark-gray); --border-strong: var(--mid-gray);
  --text: var(--white); --muted: var(--light-gray); --faint: var(--mid-gray);
  --inverse-bg: var(--white); --inverse-text: var(--black);
  --taskbar: var(--near-black);
  --wall: url("/assets/demo/wall-dark.png");
  --radius: 12px; --radius-s: 8px;
}
:root[data-theme="light"] {
  --bg: var(--white); --window: var(--white); --panel: var(--off-white); --raised: var(--light-gray);
  --border: var(--light-gray); --border-strong: var(--mid-gray);
  --text: var(--black); --muted: var(--dark-gray); --faint: var(--mid-gray);
  --inverse-bg: var(--black); --inverse-text: var(--white);
  --taskbar: var(--white);
  --wall: url("/assets/demo/wall-light.png");
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; overflow: hidden; }
body { background: var(--bg); color: var(--text); font-family: var(--font); font-size: 14px; -webkit-font-smoothing: antialiased; }
button { font: inherit; color: inherit; }
svg { display: block; flex: none; }

.desktop { position: fixed; inset: 0; background: var(--bg) var(--wall) center / cover no-repeat; user-select: none; }

/* ------------------------------------------------------------ taskbar */
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 48px; display: flex; align-items: center; gap: 6px; padding: 0 8px;
  background: var(--taskbar); border-top: 1px solid var(--border); z-index: 9000; }
.tb-launch { width: 36px; height: 36px; border-radius: var(--radius-s); border: 0; background: var(--inverse-bg); color: var(--inverse-text); font-weight: 800; font-size: 17px; cursor: pointer; }
.tb-launch:hover, .tb-launch[aria-expanded="true"] { outline: 2px solid var(--border-strong); outline-offset: 2px; }
.tb-apps { display: flex; gap: 4px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tb-app { position: relative; width: 40px; height: 40px; border: 0; border-radius: var(--radius-s); background: transparent; display: grid; place-items: center; cursor: pointer; flex: none; }
.tb-app:hover { background: var(--panel); }
.tb-app.open::after { content: ""; position: absolute; bottom: 2px; left: 50%; width: 6px; height: 3px; margin-left: -3px; border-radius: 2px; background: var(--faint); }
.tb-app.active { background: var(--panel); }
.tb-app.active::after { width: 16px; margin-left: -8px; background: var(--text); }
.tb-app { touch-action: none; }
.tb-app.dragging { z-index: 2; background: var(--raised); cursor: grabbing; }
.tb-app.drop-before::before, .tb-app.drop-after::before { content: ""; position: absolute; top: 6px; bottom: 6px; width: 2px; border-radius: 1px; background: var(--text); }
.tb-app.drop-before::before { left: -3px; }
.tb-app.drop-after::before { right: -3px; }
.tb-tray { display: flex; align-items: center; gap: 4px; flex: none; }
.tb-icon { width: 34px; height: 34px; display: grid; place-items: center; border: 0; background: transparent; border-radius: var(--radius-s); color: var(--muted); }
button.tb-icon { cursor: pointer; }
button.tb-icon:hover { background: var(--panel); color: var(--text); }
.tb-clock { padding: 0 8px; font-variant-numeric: tabular-nums; font-size: 13px; line-height: 1.2; text-align: right; color: var(--text); }
.tb-clock small { display: block; color: var(--faint); font-size: 11px; }
.demo-pill { font-size: 10px; font-weight: 700; letter-spacing: .08em; padding: 3px 7px; border: 1px solid var(--border-strong); border-radius: 999px; color: var(--muted); margin-right: 4px; }

/* ------------------------------------------------------------ launcher */
.launcher { position: absolute; left: 8px; bottom: 56px; width: min(560px, calc(100vw - 16px)); max-height: calc(100vh - 72px); display: flex; flex-direction: column;
  background: var(--window); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; z-index: 9500; box-shadow: 0 18px 50px rgba(0,0,0,.45); }
.launcher input { width: 100%; height: 40px; border-radius: var(--radius-s); border: 1px solid var(--border); background: var(--panel); color: var(--text); padding: 0 12px 0 38px; font: inherit; outline: none; }
.launcher input:focus { border-color: var(--border-strong); }
.launcher .search { position: relative; margin-bottom: 14px; }
.launcher .search svg { position: absolute; left: 11px; top: 11px; color: var(--faint); }
.launcher h3 { margin: 4px 4px 8px; font-size: 12px; font-weight: 600; color: var(--faint); text-transform: uppercase; letter-spacing: .06em; }
.lgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px; overflow-y: auto; }
.lapp { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 12px 6px; border: 0; background: transparent; border-radius: var(--radius-s); cursor: pointer; font-size: 12.5px; text-align: center; }
.lapp:hover, .lapp:focus-visible { background: var(--panel); outline: none; }
.lapp.off { color: var(--faint); }
.lfoot { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border); color: var(--faint); font-size: 12px; }
.lfoot a { color: var(--muted); }

/* app icon tile (monochrome) */
.aicon { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--panel); border: 1px solid var(--border); color: var(--text); }
.aicon.sm { width: 28px; height: 28px; border-radius: 8px; }
.aicon.inv { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); }

/* ------------------------------------------------------------ windows */
.win { position: absolute; display: flex; flex-direction: column; min-width: 300px; min-height: 200px; background: var(--window); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 20px 60px rgba(0,0,0,.5); overflow: hidden; }
.win.focused { border-color: var(--border-strong); }
.win.max { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 48px) !important; border-radius: 0; }
.win.min { display: none; }
.titlebar { height: 40px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 6px 0 12px; border-bottom: 1px solid var(--border); cursor: default; touch-action: none; }
.titlebar .t { flex: 1; font-weight: 600; font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.titlebar button { width: 30px; height: 28px; border: 0; background: transparent; border-radius: 6px; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.titlebar button:hover { background: var(--panel); color: var(--text); }
.titlebar button.x:hover { background: var(--text); color: var(--bg); }
.wbody { flex: 1; min-height: 0; display: flex; overflow: hidden; user-select: text; }
.grip { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; touch-action: none; }

/* shared app layout */
.side { width: 190px; flex: none; padding: 10px; border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; overflow-y: auto; }
.nav { display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 10px; border: 0; background: transparent; border-radius: var(--radius-s); cursor: pointer; color: var(--muted); text-align: left; width: 100%; }
.nav:hover { background: var(--panel); }
.nav.sel { background: var(--raised); color: var(--text); font-weight: 600; }
.nav .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--text); color: var(--bg); font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.main { flex: 1; min-width: 0; padding: 20px 22px; overflow: auto; }
.main h2 { margin: 0 0 4px; font-size: 22px; letter-spacing: -.01em; }
.main h3 { margin: 18px 0 8px; font-size: 14px; }
.muted { color: var(--muted); }
.faint { color: var(--faint); font-size: 12.5px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; margin: 14px 0; }
.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-s); padding: 12px 14px; }
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 22px; font-weight: 700; margin-top: 4px; font-variant-numeric: tabular-nums; }
.btn { height: 32px; padding: 0 14px; border-radius: var(--radius-s); border: 1px solid var(--border-strong); background: var(--window); cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.btn:hover { background: var(--panel); }
.btn.pri { background: var(--inverse-bg); color: var(--inverse-text); border-color: var(--inverse-bg); }
.btn.pri:hover { opacity: .88; }
.btn:disabled { opacity: .45; cursor: default; }
.row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.note { border: 1px solid var(--border); border-left: 4px solid var(--border-strong); border-radius: var(--radius-s); padding: 10px 14px; background: var(--panel); color: var(--muted); font-size: 13px; margin: 12px 0; }
table.list { width: 100%; border-collapse: collapse; font-size: 13px; font-variant-numeric: tabular-nums; }
table.list th { text-align: left; font-weight: 600; color: var(--muted); padding: 8px; border-bottom: 1px solid var(--border); cursor: pointer; white-space: nowrap; position: sticky; top: 0; background: var(--window); }
table.list td { padding: 7px 8px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.list tr.sel td { background: var(--raised); }
table.list tbody tr { cursor: default; }
table.list tbody tr:hover td { background: var(--panel); }
table.list .num { text-align: right; }
.bar { height: 6px; border-radius: 3px; background: var(--raised); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--text); }
canvas.graph { width: 100%; height: 170px; display: block; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--window); }
.perf { display: flex; gap: 16px; margin-top: 14px; align-items: flex-start; }
.devs { width: 210px; flex: none; display: flex; flex-direction: column; gap: 6px; }
.dev { display: flex; align-items: center; gap: 10px; padding: 8px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--window); cursor: pointer; text-align: left; }
.dev:hover { background: var(--panel); }
.dev.sel { background: var(--raised); border-color: var(--border-strong); }
.dev .spark { width: 64px; height: 38px; flex: none; border-radius: 4px; border: 1px solid var(--border); background: var(--window); }
.dev .dn { min-width: 0; font-size: 13px; }
.dev .dn b { display: block; }
.dev .dv { color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.pdetail { flex: 1; min-width: 0; }
canvas.graph.big { height: 220px; margin-top: 10px; }
@media (max-width: 900px) {
  .perf { flex-direction: column; }
  .devs { width: 100%; flex-direction: row; overflow-x: auto; }
  .dev { flex: none; }
}
.item { display: flex; align-items: center; gap: 12px; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); margin-bottom: 8px; }
.item .grow { flex: 1; min-width: 0; }
.item b { display: block; }
.switch { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.tog { width: 40px; height: 22px; border-radius: 11px; border: 1px solid var(--border-strong); background: var(--raised); position: relative; cursor: pointer; flex: none; padding: 0; }
.tog::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--faint); transition: left .15s; }
.tog[aria-checked="true"] { background: var(--text); border-color: var(--text); }
.tog[aria-checked="true"]::after { left: 20px; background: var(--bg); }
.choice { display: flex; gap: 10px; flex-wrap: wrap; }
.choice button { width: 150px; padding: 8px; border: 2px solid var(--border); border-radius: var(--radius-s); background: var(--window); cursor: pointer; text-align: left; }
.choice button[aria-pressed="true"] { border-color: var(--text); }
.choice .sw { height: 70px; border-radius: 6px; margin-bottom: 6px; border: 1px solid var(--border); background-size: cover; background-position: center; }

/* files */
.ftool { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.crumb { flex: 1; height: 32px; border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); display: flex; align-items: center; padding: 0 10px; font-size: 13px; color: var(--muted); }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(104px, 1fr)); gap: 6px; }
.file { display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 12px 6px; border: 0; border-radius: var(--radius-s); background: transparent; cursor: pointer; font-size: 12.5px; text-align: center; word-break: break-word; }
.file:hover, .file.sel { background: var(--panel); }
.file .aicon { width: 48px; height: 48px; }

/* text editor, calculator, browser */
textarea.editor { flex: 1; width: 100%; height: 100%; resize: none; border: 0; outline: none; padding: 16px 18px; background: var(--window); color: var(--text); font: 14px/1.6 var(--mono); }
.calc { flex: 1; display: flex; flex-direction: column; padding: 14px; gap: 10px; }
.calc .scr { height: 64px; display: flex; align-items: flex-end; justify-content: flex-end; font-size: 30px; font-variant-numeric: tabular-nums; padding: 0 8px; overflow: hidden; }
.calc .scr-wrap { display: flex; flex-direction: column; align-items: flex-end; gap: 2px; }
.calc .mode { min-height: 16px; padding: 0 8px; }
.calc .pads { flex: 1; display: flex; gap: 8px; min-height: 0; }
.calc .keys { flex: 1; display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.calc .keys.sci { display: none; flex: .75; grid-template-columns: repeat(3, 1fr); }
.calc.scientific .keys.sci { display: grid; }
.calc .keys.sci button { font-size: 15px; }
.calc .keys button { border: 1px solid var(--border); border-radius: var(--radius-s); background: var(--panel); font-size: 18px; cursor: pointer; min-height: 44px; }
.calc .keys button:hover { background: var(--raised); }
.calc .keys button.op { background: var(--raised); }
.calc .keys button.eq { background: var(--inverse-bg); color: var(--inverse-text); }
.browser { flex: 1; display: flex; flex-direction: column; }
.urlbar { display: flex; gap: 8px; align-items: center; padding: 8px 10px; border-bottom: 1px solid var(--border); }
.urlbar .u { flex: 1; height: 32px; border-radius: 16px; background: var(--panel); border: 1px solid var(--border); display: flex; align-items: center; gap: 8px; padding: 0 12px; color: var(--muted); font-size: 13px; }
.offline { flex: 1; display: grid; place-items: center; text-align: center; padding: 24px; }
.offline .big { width: 72px; height: 72px; border-radius: 50%; border: 2px solid var(--border-strong); display: grid; place-items: center; margin: 0 auto 16px; }

/* dialog */
.dialog { max-width: 420px; }
.dialog .main { padding: 22px; }

/* ------------------------------------------------------------ ring */
.ring { position: absolute; inset: 0; z-index: 9800; display: grid; place-items: center; background: rgba(0,0,0,.55); backdrop-filter: blur(6px); }
.ring-in { position: relative; width: min(520px, 92vw); height: min(520px, 92vw); }
.ring-slot { position: absolute; width: 84px; height: auto; margin: -28px 0 0 -42px; display: flex; flex-direction: column; align-items: center; gap: 6px; border: 0; background: transparent; cursor: pointer; color: var(--white); font-size: 11.5px; }
.ring-slot .aicon { flex: none; width: 56px; height: 56px; border-radius: 50%; background: var(--charcoal); border-color: var(--dark-gray); color: var(--white); transition: transform .12s; }
.ring-slot.hot .aicon { background: var(--white); color: var(--black); border-color: var(--white); transform: scale(1.12); }
.ring-center { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); text-align: center; color: var(--white); }
.ring-center .tm { font-size: 40px; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.ring-center .lbl { color: var(--light-gray); font-size: 13px; margin-top: 2px; min-height: 18px; }
.ring-music { position: absolute; left: 50%; bottom: -84px; transform: translateX(-50%); width: min(420px, 90vw); display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 16px; background: var(--near-black); border: 1px solid var(--dark-gray); color: var(--white); }
.ring-music .art { width: 40px; height: 40px; border-radius: 8px; background: var(--dark-gray); display: grid; place-items: center; flex: none; }
.ring-music .meta { flex: 1; min-width: 0; font-size: 12.5px; }
.ring-music .meta b { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ring-music .meta span { color: var(--light-gray); }
.ring-music button { width: 32px; height: 32px; border: 0; background: transparent; color: var(--white); border-radius: 50%; display: grid; place-items: center; cursor: pointer; }
.ring-music button:hover { background: var(--dark-gray); }
.ring-music .seek { height: 3px; background: var(--dark-gray); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.ring-music .seek i { display: block; height: 100%; background: var(--white); }
.ring-hint { position: absolute; left: 50%; top: -56px; transform: translateX(-50%); color: var(--light-gray); font-size: 12.5px; white-space: nowrap; }

/* ------------------------------------------------------------ toasts */
.toasts { position: absolute; right: 12px; bottom: 60px; display: flex; flex-direction: column; gap: 8px; z-index: 9900; width: min(360px, calc(100vw - 24px)); }
.toast { display: flex; gap: 12px; padding: 12px 14px; background: var(--window); border: 1px solid var(--border-strong); border-radius: var(--radius); box-shadow: 0 12px 40px rgba(0,0,0,.45); animation: tin .18s ease-out; }
.toast b { display: block; margin-bottom: 2px; }
.toast p { margin: 0; color: var(--muted); font-size: 13px; }
@keyframes tin { from { transform: translateY(8px); opacity: 0; } }

/* small screens: every window fills the screen */
@media (max-width: 720px) {
  .win { left: 0 !important; top: 0 !important; width: 100% !important; height: calc(100% - 48px) !important; border-radius: 0; }
  .side { width: 64px; padding: 8px 6px; }
  .nav span.l { display: none; }
  .nav { justify-content: center; padding: 0; }
  .nav .badge { display: none; }
  .main { padding: 16px; }
  .tb-clock small { display: none; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }

/* App icons: the only colored element in NEXUS is the icon's lines (design/tokens.json appColors). */
.aicon.app { color: var(--app-d); }
:root[data-theme="light"] .aicon.app { color: var(--app-l); }
.aicon.app.tb { width: 32px; height: 32px; border-radius: 9px; }
.tb-app .aicon.app { background: transparent; border-color: transparent; }
.tb-app:hover .aicon.app, .tb-app.active .aicon.app { background: transparent; }
.lapp.off .aicon.app { opacity: .55; }
.ring-slot .aicon.app, :root[data-theme="light"] .ring-slot .aicon.app { color: var(--app-d); }
.ring-slot.hot .aicon.app { background: var(--dark-gray); border-color: var(--app-d); color: var(--app-d); }
