:root {
  --navy: #0e1b33; --navy2: #172a4d; --teal: #33d1bd; --ink: #1d2733; --mut: #6b7787;
  --win-bg: #ffffff; --win-head: #eef1f6; --line: #d6dce5; --danger: #d9473a;
  --font: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --mono: "Cascadia Mono", Consolas, ui-monospace, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; overflow: hidden; font: 14px/1.4 var(--font); color: var(--ink); }
body { display: flex; flex-direction: column; background: var(--navy); }
.sim-banner { background: #ffd54a; color: #3a2c00; font-size: 12px; font-weight: 600; text-align: center; padding: 3px 8px; flex: none; z-index: 100000; }
.screen { flex: 1; position: relative; min-height: 0; }
[hidden] { display: none !important; }
button { font: inherit; }

/* ---------- Sign-in / lock ---------- */
.login-screen {
  display: flex; align-items: center; justify-content: center; flex-direction: column; gap: 24px;
  background: radial-gradient(circle at 20% 20%, #234a7a 0, transparent 45%), radial-gradient(circle at 80% 70%, #0f6e6b 0, transparent 40%), var(--navy);
  color: #fff;
}
.login-clock { text-align: center; }
.login-clock div:first-child { font-size: 64px; font-weight: 200; letter-spacing: 2px; }
.login-clock div:last-child { font-size: 18px; opacity: .85; }
.login-card { width: 320px; background: rgba(255,255,255,.08); backdrop-filter: blur(10px); border: 1px solid rgba(255,255,255,.15); padding: 26px; border-radius: 16px; }
.login-logo { font-size: 28px; font-weight: 700; text-align: center; margin-bottom: 18px; letter-spacing: .06em; }
.login-logo span { color: var(--teal); margin-left: 4px; font-weight: 300; }
.login-card label { display: block; font-size: 13px; margin-bottom: 12px; opacity: .95; }
.login-card input, .login-card select { display: block; width: 100%; margin-top: 4px; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.25); color: #fff; font-size: 15px; }
.login-card select option { color: #000; }
.login-card button[type=submit] { width: 100%; padding: 10px; border: 0; border-radius: 8px; background: var(--teal); color: #052a26; font-weight: 700; font-size: 15px; cursor: pointer; margin-top: 4px; }
.login-card button.link { background: none; border: 0; color: #bcd; width: 100%; margin-top: 10px; cursor: pointer; text-decoration: underline; }
.login-error { color: #ffb4ab; min-height: 20px; font-size: 13px; }
.login-hint { font-size: 12px; opacity: .7; text-align: center; margin: 12px 0 0; }
.lock-user { text-align: center; }
.avatar { display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px; border-radius: 50%; background: var(--teal); color: #052a26; font-weight: 700; margin-right: 8px; vertical-align: middle; }
.lock-user .avatar { width: 64px; height: 64px; font-size: 24px; display: flex; margin: 0 auto 8px; }

/* ---------- Desktop ---------- */
.desktop {
  background:
    radial-gradient(ellipse at 75% 30%, rgba(51,209,189,.25), transparent 50%),
    radial-gradient(ellipse at 15% 85%, rgba(94,129,244,.25), transparent 50%),
    repeating-linear-gradient(135deg, rgba(255,255,255,.025) 0 2px, transparent 2px 22px),
    linear-gradient(160deg, #102446, #0b1527 70%);
  overflow: hidden;
}
.desktop::after { content: "NVCCS OS"; position: absolute; right: 30px; bottom: 60px; font-size: 54px; font-weight: 800; color: rgba(255,255,255,.05); letter-spacing: .1em; pointer-events: none; }
#windows { position: absolute; left: 0; top: 0; right: 0; bottom: 46px; pointer-events: none; }
#windows > .win { pointer-events: auto; }
.icons { position: absolute; top: 14px; left: 14px; display: grid; grid-auto-flow: column; grid-template-rows: repeat(auto-fill, 96px); gap: 6px; height: calc(100% - 70px); }
.icon { width: 88px; height: 90px; display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 6px 2px; border-radius: 8px; color: #fff; cursor: default; user-select: none; border: 1px solid transparent; background: none; text-align: center; font-size: 12px; text-shadow: 0 1px 2px #000; }
.icon:hover { background: rgba(255,255,255,.1); }
.icon:focus { outline: none; background: rgba(51,209,189,.25); border-color: rgba(51,209,189,.6); }
.icon svg { width: 44px; height: 44px; filter: drop-shadow(0 2px 3px rgba(0,0,0,.4)); }

/* ---------- Taskbar ---------- */
.taskbar { position: absolute; left: 0; right: 0; bottom: 0; height: 46px; background: rgba(9,16,30,.92); backdrop-filter: blur(8px); display: flex; align-items: center; gap: 6px; padding: 0 8px; z-index: 50000; border-top: 1px solid rgba(255,255,255,.08); }
.start-btn { width: 42px; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--teal); font-size: 22px; cursor: pointer; }
.start-btn:hover, .start-btn.on { background: rgba(255,255,255,.1); }
.task-buttons { flex: 1; display: flex; gap: 4px; overflow: hidden; }
.task-btn { display: flex; align-items: center; gap: 6px; height: 36px; max-width: 200px; padding: 0 12px; border: 0; border-radius: 6px; background: rgba(255,255,255,.06); color: #e3e8ef; cursor: pointer; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-bottom: 2px solid transparent; }
.task-btn svg { width: 18px; height: 18px; flex: none; }
.task-btn.active { background: rgba(255,255,255,.16); border-bottom-color: var(--teal); }
.task-btn.min { opacity: .6; }
.tray { display: flex; align-items: center; gap: 14px; color: #c8d2df; font-size: 12px; padding-right: 6px; }
.tray-clock { text-align: right; line-height: 1.25; }
.tray-mail { color: #ffd54a; cursor: pointer; }

/* ---------- Start menu ---------- */
.start-menu { position: absolute; left: 8px; bottom: 54px; width: 320px; background: rgba(20,32,56,.97); backdrop-filter: blur(12px); border: 1px solid rgba(255,255,255,.1); border-radius: 12px; color: #fff; z-index: 50001; box-shadow: 0 12px 40px rgba(0,0,0,.5); overflow: hidden; }
.start-user { display: flex; align-items: center; padding: 16px; border-bottom: 1px solid rgba(255,255,255,.08); }
.start-user small { opacity: .7; }
.start-apps { padding: 8px; display: grid; grid-template-columns: 1fr 1fr; gap: 4px; }
.start-apps button { display: flex; align-items: center; gap: 10px; padding: 10px; border: 0; border-radius: 8px; background: none; color: #fff; cursor: pointer; text-align: left; }
.start-apps button:hover { background: rgba(255,255,255,.1); }
.start-apps svg { width: 26px; height: 26px; }
.start-foot { display: flex; justify-content: space-between; padding: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.start-foot button { background: none; border: 0; color: #fff; padding: 8px 12px; border-radius: 6px; cursor: pointer; }
.start-foot button:hover { background: rgba(255,255,255,.1); }

/* ---------- Windows ---------- */
.win { position: absolute; display: flex; flex-direction: column; background: var(--win-bg); border-radius: 10px; box-shadow: 0 14px 40px rgba(0,0,0,.45), 0 0 0 1px rgba(0,0,0,.25); overflow: hidden; min-width: 300px; min-height: 180px; }
.win.focused { box-shadow: 0 18px 50px rgba(0,0,0,.55), 0 0 0 1px rgba(51,209,189,.5); }
.win.maximized { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
.win-head { display: flex; align-items: center; height: 36px; background: var(--win-head); border-bottom: 1px solid var(--line); user-select: none; cursor: default; flex: none; }
.win.focused .win-head { background: #e3f6f3; }
.win-title { flex: 1; display: flex; align-items: center; gap: 8px; padding-left: 10px; font-weight: 600; font-size: 13px; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.win-title svg { width: 18px; height: 18px; flex: none; }
.win-ctrl { display: flex; height: 100%; }
.win-ctrl button { width: 44px; height: 100%; border: 0; background: none; cursor: pointer; font-size: 14px; color: #333; }
.win-ctrl button:hover { background: rgba(0,0,0,.08); }
.win-ctrl button.close:hover { background: var(--danger); color: #fff; }
.win-body { flex: 1; min-height: 0; position: relative; display: flex; flex-direction: column; }
.win-resize { position: absolute; right: 0; bottom: 0; width: 16px; height: 16px; cursor: nwse-resize; z-index: 2; }
.win.dragging iframe, .win.resizing iframe, body.dragging iframe { pointer-events: none; }

/* ---------- Toasts ---------- */
.toasts { position: absolute; right: 12px; bottom: 58px; display: flex; flex-direction: column; gap: 8px; z-index: 60000; }
.toast { width: 300px; background: rgba(20,32,56,.97); color: #fff; padding: 12px 14px; border-radius: 10px; box-shadow: 0 8px 24px rgba(0,0,0,.4); border-left: 4px solid var(--teal); cursor: pointer; animation: slidein .25s ease-out; }
.toast b { display: block; margin-bottom: 2px; }
@keyframes slidein { from { transform: translateX(40px); opacity: 0; } }

/* ---------- Browser ---------- */
.br { display: flex; flex-direction: column; height: 100%; background: #dfe4ec; }
.br-tabs { display: flex; align-items: flex-end; gap: 2px; padding: 6px 6px 0; background: #dfe4ec; flex: none; }
.br-tab { display: flex; align-items: center; gap: 6px; max-width: 200px; min-width: 90px; padding: 7px 10px; border-radius: 8px 8px 0 0; background: #cbd2dd; font-size: 12px; cursor: pointer; white-space: nowrap; }
.br-tab.on { background: #fff; }
.br-tab span { overflow: hidden; text-overflow: ellipsis; flex: 1; }
.br-tab button { border: 0; background: none; cursor: pointer; padding: 0 2px; font-size: 13px; color: #555; border-radius: 4px; }
.br-tab button:hover { background: rgba(0,0,0,.1); }
.br-newtab { border: 0; background: none; font-size: 18px; padding: 2px 10px; cursor: pointer; border-radius: 6px; }
.br-newtab:hover { background: rgba(0,0,0,.08); }
.br-bar { display: flex; align-items: center; gap: 4px; padding: 6px; background: #fff; border-bottom: 1px solid var(--line); flex: none; }
.br-bar > button { width: 32px; height: 30px; border: 0; background: none; border-radius: 6px; cursor: pointer; font-size: 16px; color: #333; }
.br-bar > button:hover:not(:disabled) { background: #eef1f6; }
.br-bar > button:disabled { opacity: .35; cursor: default; }
.br-addr { flex: 1; display: flex; align-items: center; gap: 6px; background: #eef1f6; border-radius: 16px; padding: 0 12px; height: 32px; border: 1px solid transparent; }
.br-addr:focus-within { border-color: var(--teal); background: #fff; }
.br-lock { cursor: pointer; font-size: 13px; }
.br-addr input { flex: 1; border: 0; background: none; font-size: 14px; outline: none; min-width: 0; }
.br-view { flex: 1; position: relative; background: #fff; min-height: 0; }
.br-view iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: #fff; }
.br-status { height: 22px; font-size: 11px; color: var(--mut); padding: 3px 10px; background: #f6f8fb; border-top: 1px solid var(--line); flex: none; }
.br-pop { position: absolute; top: 44px; left: 90px; width: 320px; background: #fff; border-radius: 10px; box-shadow: 0 8px 30px rgba(0,0,0,.25); padding: 14px 16px; z-index: 5; font-size: 13px; }
.br-pop h4 { margin: 0 0 6px; }

/* ---------- Command prompt ---------- */
.cmd { flex: 1; background: #0c0c0c; color: #d6d6d6; font: 14px/1.35 var(--mono); padding: 8px 10px; overflow-y: auto; white-space: pre-wrap; word-break: break-all; cursor: text; }
.cmd .line { display: flex; }
.cmd input { flex: 1; background: none; border: 0; color: #fff; font: inherit; outline: none; padding: 0; caret-color: #fff; }
.cmd .prompt { white-space: pre; }

/* ---------- Generic app chrome ---------- */
.toolbar { display: flex; gap: 6px; align-items: center; padding: 6px 8px; border-bottom: 1px solid var(--line); background: #f6f8fb; flex: none; flex-wrap: wrap; }
.toolbar button, .btn { padding: 6px 12px; border: 1px solid #c4ccd8; border-radius: 6px; background: #fff; cursor: pointer; font-size: 13px; }
.toolbar button:hover, .btn:hover { background: #eef1f6; }
.btn.primary { background: #0f6e6b; color: #fff; border-color: #0f6e6b; }
.btn.primary:hover { background: #0b5653; }
.btn.danger { color: var(--danger); }
.notepad { flex: 1; border: 0; resize: none; padding: 10px; font: 14px/1.5 var(--mono); outline: none; }
.statusline { font-size: 12px; color: var(--mut); padding: 3px 10px; border-top: 1px solid var(--line); background: #f6f8fb; flex: none; }
.dialog-back { position: absolute; inset: 0; background: rgba(0,0,0,.25); display: flex; align-items: center; justify-content: center; z-index: 10; }
.dialog { background: #fff; border-radius: 10px; padding: 18px; width: min(420px, 92%); box-shadow: 0 10px 30px rgba(0,0,0,.3); max-height: 90%; overflow: auto; }
.dialog h3 { margin-top: 0; }
.dialog label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.dialog input, .dialog textarea { display: block; width: 100%; padding: 8px 10px; margin-top: 4px; border: 1px solid #c4ccd8; border-radius: 6px; font: inherit; font-weight: 400; }
.dialog .row { display: flex; gap: 8px; justify-content: flex-end; margin-top: 10px; }
.filelist { list-style: none; padding: 0; margin: 0 0 10px; border: 1px solid var(--line); border-radius: 6px; max-height: 200px; overflow: auto; }
.filelist li { padding: 6px 10px; cursor: pointer; }
.filelist li:hover, .filelist li.sel { background: #e3f6f3; }

/* ---------- KeyKeeper vault ---------- */
.kk { display: flex; flex-direction: column; height: 100%; background: #f4f6fa; }
.kk-lock { flex: 1; display: flex; align-items: center; justify-content: center; flex-direction: column; background: linear-gradient(160deg, #1b2b4b, #0e1b33); color: #fff; padding: 20px; text-align: center; }
.kk-lock .kk-logo { font-size: 46px; }
.kk-lock h2 { margin: 6px 0 2px; }
.kk-lock form { width: 280px; margin-top: 14px; }
.kk-lock input { width: 100%; padding: 10px 12px; border-radius: 8px; border: 1px solid rgba(255,255,255,.3); background: rgba(0,0,0,.3); color: #fff; font-size: 15px; }
.kk-lock button { width: 100%; margin-top: 10px; padding: 10px; border: 0; border-radius: 8px; background: #f2c14e; font-weight: 700; cursor: pointer; }
.kk-lock .err { color: #ffb4ab; min-height: 18px; font-size: 13px; margin-top: 8px; }
.kk-lock small { opacity: .7; margin-top: 16px; max-width: 320px; }
.kk-main { flex: 1; display: grid; grid-template-columns: 240px 1fr; min-height: 0; }
.kk-list { border-right: 1px solid var(--line); overflow-y: auto; background: #fff; }
.kk-list input { width: calc(100% - 16px); margin: 8px; padding: 7px 10px; border: 1px solid #c4ccd8; border-radius: 6px; }
.kk-item { padding: 10px 12px; cursor: pointer; border-left: 3px solid transparent; }
.kk-item:hover { background: #f4f6fa; }
.kk-item.on { background: #e3f6f3; border-left-color: #0f6e6b; }
.kk-item b { display: block; font-size: 13px; }
.kk-item small { color: var(--mut); }
.kk-detail { padding: 18px 22px; overflow-y: auto; }
.kk-detail h2 { margin: 0 0 14px; font-size: 20px; }
.kk-field { margin-bottom: 14px; }
.kk-field .lbl { font-size: 11px; text-transform: uppercase; letter-spacing: .06em; color: var(--mut); margin-bottom: 3px; }
.kk-field .val { display: flex; align-items: center; gap: 6px; background: #fff; border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; font-family: var(--mono); font-size: 14px; word-break: break-all; }
.kk-field .val span { flex: 1; }
.kk-field .val button { border: 0; background: #eef1f6; border-radius: 4px; padding: 3px 8px; cursor: pointer; font: 12px var(--font); }
.meter { height: 6px; border-radius: 3px; background: #e2e6ec; overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; }
.warn { background: #fff4d6; color: #7a5300; padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.ok-note { background: #e2f4ea; color: #1d7a46; padding: 8px 10px; border-radius: 6px; font-size: 13px; margin-bottom: 12px; }
.gen { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; font-size: 13px; }
.gen code { flex-basis: 100%; background: #fff; border: 1px solid var(--line); padding: 8px; border-radius: 6px; font-size: 15px; word-break: break-all; }
