/* ==========================================================================
   HEXA OS — style.css   (HEXA CORP)
   ========================================================================== */

:root {
  color-scheme: dark;
  --bg: #07070d;
  --panel: #101019;
  --panel-2: #171724;
  --line: rgba(255, 255, 255, .09);
  --line-strong: rgba(255, 255, 255, .17);
  --text: #eeecff;
  --muted: #a6a3c2;
  --accent: #9b7bff;
  --accent-2: #22d3ee;
  --accent-rgb: 155, 123, 255;
  --accent-2-rgb: 34, 211, 238;
  --on-accent: #0b0716;
  --danger: #ff6b81;
  --ok: #3ddc97;
  --taskbar-h: 56px;
  --safe-b: 0px;
  --font: "Segoe UI", system-ui, -apple-system, "Roboto", "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}
html[data-theme="emerald"] {
  --accent: #34d399; --accent-2: #2dd4bf;
  --accent-rgb: 52, 211, 153; --accent-2-rgb: 45, 212, 191;
  --on-accent: #03140d;
}
html[data-theme="rose"] {
  --accent: #fb7185; --accent-2: #fbbf24;
  --accent-rgb: 251, 113, 133; --accent-2-rgb: 251, 191, 36;
  --on-accent: #190509;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body {
  height: 100%; margin: 0;
  background: var(--bg); color: var(--text);
  font-family: var(--font); font-size: 16px; line-height: 1.45;
  -webkit-text-size-adjust: 100%;
}
body { overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; -webkit-tap-highlight-color: transparent; }
h1, h2, h3, p { margin: 0; }
ul { list-style: none; margin: 0; padding: 0; }
:focus { outline: 2px solid var(--accent-2); outline-offset: 2px; }
:focus:not(:focus-visible) { outline: none; }
::selection { background: rgba(var(--accent-rgb), .45); }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }
.g1 { stop-color: var(--accent); }
.g2 { stop-color: var(--accent-2); }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; margin: -1px; padding: 0;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.ic {
  width: 1.25em; height: 1.25em; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.7;
  stroke-linecap: round; stroke-linejoin: round;
}
.ic.logo-g { stroke: url(#hx-grad); stroke-width: 1.5; }

/* ---------- Shared controls ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 44px; padding: 0 16px;
  border-radius: 9px; border: 1px solid var(--line-strong);
  background: rgba(255, 255, 255, .05); color: var(--text);
  font-weight: 600; font-size: .92rem; white-space: nowrap;
}
.btn:hover { background: rgba(255, 255, 255, .1); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: rgba(255, 107, 129, .12); border-color: rgba(255, 107, 129, .5); color: #ff9aa9; }
.btn.danger:hover { background: rgba(255, 107, 129, .22); }
.btn:disabled, .icon-btn:disabled { opacity: .4; cursor: not-allowed; }
.icon-btn {
  width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center;
  border-radius: 9px; border: 1px solid transparent; background: transparent; color: var(--muted);
}
.icon-btn:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.icon-btn.danger:hover { color: var(--danger); }
.field {
  width: 100%; min-height: 44px; padding: 10px 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong);
  border-radius: 9px; font-size: 16px;
}
.field::placeholder, .ed-body::placeholder, .ed-title::placeholder { color: #8d8aa9; }
.field:focus { border-color: var(--accent); }
.field-error, .modal-error { color: #ff9aa9; font-size: .85rem; min-height: 1.2em; }

/* ---------- OS shell ---------- */
.os {
  position: fixed; left: 0; top: 0; right: 0; bottom: 0; overflow: hidden;
  --safe-b: env(safe-area-inset-bottom, 0px);
  background: var(--bg);
}
.os.is-mobile { --taskbar-h: 64px; }

html[data-wall="grid"] .os,
.lock[data-wp="grid"] {
  background:
    radial-gradient(60% 55% at 12% 8%, rgba(var(--accent-rgb), .22), transparent 70%),
    radial-gradient(55% 50% at 90% 95%, rgba(var(--accent-2-rgb), .14), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, .035) 1px, transparent 1px) 0 0 / 44px 44px,
    var(--bg);
}
html[data-wall="aurora"] .os,
.lock[data-wp="aurora"] {
  background:
    radial-gradient(70% 60% at 20% 20%, rgba(var(--accent-rgb), .32), transparent 70%),
    radial-gradient(65% 55% at 85% 80%, rgba(var(--accent-2-rgb), .24), transparent 70%),
    var(--bg);
}
html[data-wall="horizon"] .os,
.lock[data-wp="horizon"] {
  background: linear-gradient(180deg, var(--bg) 0%, #0c0c1a 50%, rgba(var(--accent-rgb), .3) 100%), var(--bg);
}
html[data-wall="void"] .os,
.lock[data-wp="void"] {
  background: radial-gradient(90% 80% at 50% 35%, #15151f, #050509);
}

.desktop {
  position: absolute; left: 0; top: 0; right: 0;
  bottom: calc(var(--taskbar-h) + var(--safe-b));
  overflow: hidden;
}
.home-widget { display: none; }

/* Desktop shortcuts */
.shortcuts {
  position: absolute; left: 12px; top: 12px; bottom: 12px;
  display: grid; grid-auto-flow: column;
  grid-template-rows: repeat(auto-fill, 98px); grid-auto-columns: 96px;
  align-content: start; justify-content: start; gap: 4px;
}
.shortcut {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 8px 4px; background: transparent; border: 1px solid transparent;
  border-radius: 12px; color: var(--text);
}
.shortcut:hover { background: rgba(255, 255, 255, .06); border-color: var(--line); }
.sc-ic {
  width: 52px; height: 52px; display: grid; place-items: center; border-radius: 14px;
  background: linear-gradient(145deg, rgba(var(--accent-rgb), .22), rgba(var(--accent-2-rgb), .1));
  border: 1px solid rgba(var(--accent-rgb), .45); color: var(--accent);
  box-shadow: 0 0 22px -8px rgba(var(--accent-rgb), .8);
}
.sc-ic .ic { width: 26px; height: 26px; }
.sc-label { font-size: .8rem; text-align: center; text-shadow: 0 1px 6px #000; }

/* Welcome tip */
.tip {
  position: absolute; top: 14px; right: 14px; z-index: 2;
  width: min(320px, calc(100% - 28px)); padding: 14px;
  background: rgba(14, 14, 22, .94); border: 1px solid rgba(var(--accent-2-rgb), .45);
  border-radius: 14px; box-shadow: 0 16px 40px -12px rgba(0, 0, 0, .8);
}
.tip-title { font-size: 1rem; margin-bottom: 6px; }
.tip-text { color: var(--muted); font-size: .9rem; }
.tip-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

/* ---------- Windows ---------- */
.windows {
  position: absolute; left: 0; top: 0; right: 0;
  bottom: calc(var(--taskbar-h) + var(--safe-b));
  z-index: 10; pointer-events: none;
}
.window {
  position: absolute; display: flex; flex-direction: column; min-width: 0;
  pointer-events: auto; overflow: hidden;
  background: rgba(16, 16, 25, .97); border: 1px solid var(--line-strong); border-radius: 14px;
  box-shadow: 0 18px 50px -12px rgba(0, 0, 0, .8);
  animation: winIn .18s ease-out;
}
.window:focus { outline: none; }
.window.is-active {
  border-color: rgba(var(--accent-rgb), .55);
  box-shadow: 0 22px 60px -12px rgba(0, 0, 0, .85), 0 0 28px -6px rgba(var(--accent-rgb), .45);
}
.window.is-max, .is-mobile .window {
  left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important;
  border-radius: 0; border-left: 0; border-right: 0;
}
.titlebar {
  display: flex; align-items: center; gap: 10px; height: 44px; flex: none;
  padding: 0 6px 0 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, .06), rgba(255, 255, 255, .02));
  border-bottom: 1px solid var(--line);
  user-select: none; -webkit-user-select: none; touch-action: none;
}
.window.is-dragging .titlebar { cursor: grabbing; }
.window.is-max .titlebar, .is-mobile .titlebar { touch-action: auto; }
.is-mobile .titlebar { height: 48px; }
.tb-icon { color: var(--accent); display: grid; }
.tb-title { flex: 1; min-width: 0; font-size: .92rem; font-weight: 600; letter-spacing: .02em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tb-actions { display: flex; }
.tb-btn {
  width: 40px; height: 36px; display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 8px; color: var(--muted);
}
.tb-btn:hover { background: rgba(255, 255, 255, .09); color: var(--text); }
.tb-btn.close:hover { background: var(--danger); color: #16050a; }
.is-mobile .tb-btn[data-act="min"], .is-mobile .tb-btn[data-act="max"] { display: none; }
.is-mobile .tb-btn { width: 48px; height: 44px; }
.win-body { flex: 1; min-height: 0; display: flex; flex-direction: column; overflow: hidden; }
.app { flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; }
.scroll { flex: 1; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch; }

/* ---------- Taskbar / dock ---------- */
.taskbar {
  position: absolute; left: 0; right: 0; bottom: 0; z-index: 50;
  height: calc(var(--taskbar-h) + var(--safe-b)); padding: 0 10px var(--safe-b);
  display: flex; align-items: center; gap: 8px;
  background: rgba(10, 10, 18, .9);
  -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px);
  border-top: 1px solid var(--line);
  box-shadow: 0 -1px 0 rgba(var(--accent-rgb), .25), 0 -12px 30px rgba(0, 0, 0, .4);
}
.dock { display: flex; align-items: center; justify-content: center; gap: 4px; flex: 1; min-width: 0; }
.dock-item {
  position: relative; width: 48px; height: 44px; flex: none;
  display: grid; place-items: center;
  background: transparent; border: 0; border-radius: 10px; color: var(--muted);
}
.dock-item .ic { width: 24px; height: 24px; }
.dock-item:hover { background: rgba(255, 255, 255, .08); color: var(--text); }
.dock-item.is-open::after {
  content: ""; position: absolute; bottom: 3px; left: 50%; width: 6px; height: 3px;
  margin-left: -3px; border-radius: 2px; background: var(--muted);
}
.dock-item.is-active { color: var(--accent); background: rgba(var(--accent-rgb), .13); }
.dock-item.is-active::after { width: 18px; margin-left: -9px; background: var(--accent); box-shadow: 0 0 8px var(--accent); }
.dock-item.launch { background: rgba(var(--accent-rgb), .1); border: 1px solid rgba(var(--accent-rgb), .4); box-shadow: 0 0 18px -6px rgba(var(--accent-rgb), .8); }
.dock-item.home { display: none; }
.dock-label { display: none; }
.status { display: flex; align-items: center; gap: 4px; }
.clock-btn {
  display: flex; flex-direction: column; align-items: flex-end; justify-content: center;
  min-height: 44px; padding: 2px 10px; background: transparent; border: 0; border-radius: 10px; line-height: 1.15;
}
.clock-btn:hover { background: rgba(255, 255, 255, .08); }
.clock-time { font-family: var(--mono); font-size: .95rem; }
.clock-date { font-size: .74rem; color: var(--muted); }

/* ---------- Mobile mode ---------- */
.is-mobile .taskbar { padding: 0 4px var(--safe-b); gap: 0; }
.is-mobile .status { display: none; }
.is-mobile .dock { display: contents; }
.is-mobile .dock-item {
  flex: 1; width: auto; min-width: 0; height: 56px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
}
.is-mobile .dock-item.extra { display: none; }
.is-mobile .dock-item.home { display: flex; order: -1; }
.is-mobile .dock-item.launch { order: 10; margin-left: 4px; }
.is-mobile .dock-label { display: block; font-size: .68rem; line-height: 1; }
.is-mobile .dock-item.is-open::after { bottom: 2px; }
.is-mobile .desktop { overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 18px 16px 16px; }
.is-mobile .home-widget { display: block; text-align: center; padding: 14px 0 6px; }
.home-brand { font-size: .72rem; letter-spacing: .5em; color: var(--accent); font-weight: 700; }
.home-time { font-family: var(--mono); font-size: 3.4rem; line-height: 1.1; margin-top: 6px; text-shadow: 0 0 28px rgba(var(--accent-rgb), .55); }
.home-date { color: var(--muted); margin-top: 2px; }
.home-tag { font-size: .8rem; color: var(--muted); margin-top: 8px; }
.is-mobile .tip { position: static; width: auto; margin: 14px 0 0; }
.is-mobile .shortcuts {
  position: static; display: grid; grid-auto-flow: row; grid-template-rows: none; grid-auto-columns: auto;
  grid-template-columns: repeat(auto-fill, minmax(84px, 1fr)); gap: 10px 6px; margin-top: 18px;
}
.is-mobile .shortcut { min-height: 94px; }

/* ---------- Launcher ---------- */
.launcher {
  position: absolute; z-index: 60; left: 12px;
  bottom: calc(var(--taskbar-h) + var(--safe-b) + 10px);
  width: min(400px, calc(100% - 24px));
  max-height: min(560px, calc(100% - var(--taskbar-h) - 40px));
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(14, 14, 22, .97); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 16px;
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, .85), 0 0 30px -10px rgba(var(--accent-rgb), .5);
  animation: popIn .16s ease-out;
}
.is-mobile .launcher {
  left: 0; right: 0; width: auto; max-height: 78%;
  bottom: calc(var(--taskbar-h) + var(--safe-b));
  border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0;
}
.launch-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 4px; color: var(--muted); }
.launch-status { padding: 6px 16px; font-size: .78rem; color: var(--muted); min-height: 1.8em; }
.launch-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 8px 8px; display: grid; gap: 4px; -webkit-overflow-scrolling: touch; }
.launch-item {
  width: 100%; display: flex; align-items: center; gap: 12px; text-align: left;
  min-height: 56px; padding: 8px 10px; background: transparent; border: 1px solid transparent; border-radius: 12px;
}
.launch-item:hover { background: rgba(var(--accent-rgb), .1); border-color: rgba(var(--accent-rgb), .35); }
.launch-ic {
  width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px;
  color: var(--accent); background: rgba(var(--accent-rgb), .13); border: 1px solid rgba(var(--accent-rgb), .35);
}
.launch-name { display: block; font-weight: 600; }
.launch-desc { display: block; font-size: .8rem; color: var(--muted); }
.launch-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); }
.brand-mini { font-size: .72rem; letter-spacing: .3em; color: var(--muted); }

/* ---------- Toasts ---------- */
.toasts {
  position: absolute; z-index: 80; right: 14px;
  bottom: calc(var(--taskbar-h) + var(--safe-b) + 14px);
  width: min(360px, calc(100% - 28px));
  display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.is-mobile .toasts { left: 14px; right: 14px; width: auto; }
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px;
  padding: 6px 4px 6px 14px; background: rgba(18, 18, 30, .98);
  border: 1px solid var(--line-strong); border-left: 3px solid var(--accent); border-radius: 10px;
  box-shadow: 0 12px 30px -8px rgba(0, 0, 0, .8); animation: toastIn .2s ease-out;
  transition: opacity .2s, transform .2s;
}
.toast.toast-success { border-left-color: var(--ok); }
.toast.toast-error { border-left-color: var(--danger); }
.toast.out { opacity: 0; transform: translateY(6px); }
.toast-msg { flex: 1; font-size: .9rem; padding: 6px 0; }
.toast-x { width: 44px; height: 44px; flex: none; display: grid; place-items: center; background: transparent; border: 0; border-radius: 8px; color: var(--muted); }
.toast-x:hover { color: var(--text); background: rgba(255, 255, 255, .08); }

/* ---------- Modal ---------- */
.modal {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 90;
  display: flex; align-items: center; justify-content: center; padding: 16px;
  background: rgba(3, 3, 8, .72);
}
.modal-card {
  width: min(440px, 100%); max-height: 100%; overflow: auto; padding: 20px;
  background: var(--panel); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 16px;
  box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .9), 0 0 36px -12px rgba(var(--accent-rgb), .6);
  animation: popIn .16s ease-out;
}
.modal-card:focus { outline: none; }
.modal-title { font-size: 1.15rem; margin-bottom: 10px; }
.modal-text { color: var(--muted); }
.modal-label { display: block; font-size: .85rem; color: var(--muted); margin-bottom: 6px; }
.modal-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 18px; }
.modal .btn.danger { background: var(--danger); border-color: var(--danger); color: #1c060b; }

/* About */
.about { text-align: center; }
.about-logo { width: 64px; height: 64px; filter: drop-shadow(0 0 14px rgba(var(--accent-rgb), .6)); }
.about-name { font-size: 1.5rem; font-weight: 700; letter-spacing: .3em; margin-top: 6px; }
.about-tag { color: var(--accent-2); margin: 4px 0 14px; }
.about .kv { text-align: left; margin-bottom: 12px; }

/* ---------- Boot ---------- */
.boot {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 100;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; padding: 24px;
  background:
    radial-gradient(50% 45% at 50% 40%, rgba(var(--accent-rgb), .22), transparent 70%),
    linear-gradient(rgba(255, 255, 255, .03) 1px, transparent 1px) 0 0 / 44px 44px,
    linear-gradient(90deg, rgba(255, 255, 255, .03) 1px, transparent 1px) 0 0 / 44px 44px,
    #05050a;
  transition: opacity .35s ease;
}
.boot.is-leaving { opacity: 0; }
.boot-logo { width: 116px; height: 116px; margin-bottom: 10px; filter: drop-shadow(0 0 18px rgba(var(--accent-rgb), .65)); }
.draw {
  fill: none; stroke: url(#hx-grad); stroke-width: 1.2; stroke-linecap: round; stroke-linejoin: round;
  stroke-dasharray: 100; stroke-dashoffset: 100; animation: draw 1.0s ease forwards;
}
.draw.d2 { animation-delay: .35s; }
.boot-corp { font-size: .8rem; letter-spacing: .6em; color: var(--accent-2); font-weight: 700; padding-left: .6em; }
.boot-name { font-size: 2rem; font-weight: 700; letter-spacing: .35em; padding-left: .35em; }
.boot-tag { color: var(--muted); font-size: .9rem; margin-bottom: 18px; }
.boot-bar { width: min(260px, 70vw); height: 3px; background: rgba(255, 255, 255, .12); border-radius: 2px; overflow: hidden; }
.boot-fill { height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition-property: width; transition-timing-function: linear; }
.boot-status { font-size: .8rem; color: var(--muted); min-height: 1.3em; margin-top: 8px; }
.boot-skip { position: absolute; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); }

/* ---------- Notes ---------- */
.app.notes { flex-direction: row; }
.pane { display: flex; flex-direction: column; min-height: 0; min-width: 0; }
.list-pane { width: 250px; flex: none; border-right: 1px solid var(--line); }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 10px 10px 14px; border-bottom: 1px solid var(--line); }
.pane-title { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 600; }
.list { flex: 1; min-height: 0; overflow: auto; padding: 6px; -webkit-overflow-scrolling: touch; }
.list-empty { padding: 16px 10px; color: var(--muted); font-size: .9rem; }
.item {
  width: 100%; display: flex; flex-direction: column; gap: 2px; text-align: left; min-height: 58px;
  padding: 10px 12px; background: transparent; border: 1px solid transparent; border-radius: 10px;
}
.item:hover { background: rgba(255, 255, 255, .05); }
.item.is-selected { background: rgba(var(--accent-rgb), .13); border-color: rgba(var(--accent-rgb), .45); }
.item-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item-sub { font-size: .8rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.edit-pane { flex: 1; }
.editor { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.ed-bar { display: flex; align-items: center; gap: 4px; padding: 6px 6px 6px 8px; border-bottom: 1px solid var(--line); }
.ed-title { flex: 1; min-width: 0; min-height: 44px; background: transparent; border: 0; font-size: 1.1rem; font-weight: 700; padding: 6px 8px; border-radius: 8px; }
.ed-body { flex: 1; min-height: 0; width: 100%; resize: none; background: transparent; border: 0; padding: 14px; line-height: 1.6; font-size: 16px; }
.ed-foot { display: flex; justify-content: space-between; gap: 10px; padding: 8px 14px; border-top: 1px solid var(--line); font-size: .8rem; color: var(--muted); }
.status-text[data-state="saved"] { color: var(--ok); }
.status-text[data-state="error"] { color: #ff9aa9; }
.empty { margin: auto; max-width: 300px; padding: 24px; text-align: center; color: var(--muted); display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty h3 { color: var(--text); font-size: 1.05rem; }
.empty-ic { width: 54px; height: 54px; display: grid; place-items: center; border-radius: 16px; color: var(--accent); background: rgba(var(--accent-rgb), .12); border: 1px solid rgba(var(--accent-rgb), .35); }
.empty-ic .ic { width: 26px; height: 26px; }
.only-compact { display: none; }
.notes.compact .only-compact { display: inline-grid; }
.notes.compact .list-pane { width: 100%; border-right: 0; }
.notes.compact[data-view="list"] .edit-pane { display: none; }
.notes.compact[data-view="editor"] .list-pane { display: none; }

/* ---------- Calculator ---------- */
.app.calc { padding: 14px; gap: 12px; overflow: auto; }
.calc-screen {
  display: flex; flex-direction: column; justify-content: flex-end; text-align: right; flex: none;
  min-height: 100px; padding: 12px 16px; overflow: hidden;
  background: rgba(0, 0, 0, .38); border: 1px solid var(--line); border-radius: 12px;
}
.calc-expr { font-family: var(--mono); font-size: .9rem; color: var(--muted); min-height: 1.3em; }
.calc-out { display: block; font-family: var(--mono); font-size: 2.4rem; line-height: 1.15; word-break: break-all; }
.calc-out[data-len="mid"] { font-size: 1.9rem; }
.calc-out[data-len="long"] { font-size: 1.45rem; }
.calc-msg { font-size: .85rem; color: #ff9aa9; min-height: 1.2em; margin-top: 2px; }
.pad { flex: 1; min-height: 240px; display: grid; grid-template-columns: repeat(4, 1fr); grid-auto-rows: minmax(48px, 1fr); gap: 8px; }
.key { border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .06); font-size: 1.25rem; font-weight: 600; }
.key:hover { background: rgba(255, 255, 255, .12); }
.key:active { transform: scale(.97); }
.key.fn { color: var(--accent-2); }
.key.op { background: rgba(var(--accent-rgb), .15); color: var(--accent); }
.key.eq { background: var(--accent); border-color: var(--accent); color: var(--on-accent); grid-row: span 2; }
.key.zero { grid-column: span 2; }

/* ---------- Tasks ---------- */
.app.tasks { overflow: hidden; }
.task-top { padding: 14px 14px 10px; border-bottom: 1px solid var(--line); flex: none; }
.task-form { display: flex; gap: 8px; }
.task-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 14px; flex: none; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: 10px; overflow: hidden; }
.seg button { min-height: 40px; padding: 0 14px; background: transparent; border: 0; color: var(--muted); font-weight: 600; }
.seg button[aria-pressed="true"] { background: rgba(var(--accent-rgb), .22); color: var(--text); }
.task-count { font-size: .85rem; color: var(--muted); }
.task-list { flex: 1; min-height: 0; overflow: auto; padding: 4px 10px 10px; -webkit-overflow-scrolling: touch; }
.task { display: flex; align-items: center; gap: 4px; border-bottom: 1px solid var(--line); }
.task-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 4px 6px; cursor: pointer; }
.task-cb { width: 22px; height: 22px; flex: none; accent-color: var(--accent); }
.task-title { overflow-wrap: anywhere; }
.task.is-done .task-title { color: var(--muted); text-decoration: line-through; }
.task-foot { padding: 8px 14px; border-top: 1px solid var(--line); flex: none; }

/* ---------- File Cabinet ---------- */
.app.files { overflow: hidden; }
.fview { flex: 1; min-height: 0; display: flex; flex-direction: column; }
.fl-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 8px 10px; border-bottom: 1px solid var(--line); }
.crumbs { flex: 1; min-width: 140px; display: flex; flex-wrap: wrap; align-items: center; gap: 2px; font-size: .9rem; }
.crumb { min-height: 36px; padding: 0 8px; background: transparent; border: 0; border-radius: 8px; color: var(--accent); font-weight: 600; }
.crumb:hover { background: rgba(255, 255, 255, .07); }
.crumb-now { padding: 0 8px; font-weight: 700; }
.sep { color: var(--muted); }
.fl-search { padding: 8px 10px; border-bottom: 1px solid var(--line); }
.row { display: flex; align-items: center; gap: 2px; border-bottom: 1px solid var(--line); }
.row-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 8px; background: transparent; border: 0; border-radius: 10px; text-align: left; }
.row-main:hover { background: rgba(255, 255, 255, .05); }
.row-main > .ic { color: var(--accent); width: 24px; height: 24px; }
.row-text { min-width: 0; display: flex; flex-direction: column; }
.row-name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.row-meta { font-size: .78rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fl-note { padding: 8px 14px; border-top: 1px solid var(--line); font-size: .78rem; color: var(--muted); }
.ed-name { flex: 1; min-width: 0; font-size: 1.05rem; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ---------- Settings and System ---------- */
.set-sec { padding: 16px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 10px; }
.set-h { font-size: .76rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.set-p { color: var(--muted); font-size: .92rem; }
.choices { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.choice {
  display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 8px 12px; text-align: left;
  background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px;
}
.choice:hover { background: rgba(255, 255, 255, .07); }
.choice[aria-pressed="true"] { border-color: var(--accent); background: rgba(var(--accent-rgb), .13); }
.choice[aria-pressed="true"]::after { content: "Selected"; margin-left: auto; font-size: .7rem; color: var(--accent); }
.sw { width: 28px; height: 28px; flex: none; border-radius: 8px; border: 1px solid var(--line-strong); }
.switchrow {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 12px; text-align: left;
  min-height: 60px; padding: 10px 14px; background: rgba(255, 255, 255, .03); border: 1px solid var(--line); border-radius: 12px;
}
.switchrow:hover { background: rgba(255, 255, 255, .06); }
.switchrow:disabled { opacity: .5; cursor: not-allowed; }
.switchrow:disabled:hover { background: rgba(255, 255, 255, .03); }
.set-label { display: block; font-weight: 600; }
.set-desc { display: block; font-size: .82rem; color: var(--muted); }
.track { position: relative; width: 46px; height: 26px; flex: none; border-radius: 13px; background: rgba(255, 255, 255, .14); transition: background .15s; }
.knob { position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #d6d4ea; transition: transform .15s; }
.switchrow[aria-checked="true"] .track { background: var(--accent); }
.switchrow[aria-checked="true"] .knob { transform: translateX(20px); background: var(--on-accent); }
.kv { margin: 0; }
.kv-row { display: flex; justify-content: space-between; gap: 16px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.kv-row dt { color: var(--muted); font-size: .9rem; }
.kv-row dd { margin: 0; text-align: right; font-weight: 600; overflow-wrap: anywhere; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; }


/* ==========================================================================
   HEXA OS 2.0 — Stage B additions: lock screen, shell extras
   ========================================================================== */

/* ---------- Shared additions ---------- */
select.field {
  -webkit-appearance: none; appearance: none; padding-right: 38px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a6a3c2' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; background-size: 18px;
}
select.field option { background: #101019; color: #eeecff; }
kbd {
  display: inline-block; font-family: var(--mono); font-size: .78rem; line-height: 1.2; padding: 2px 7px;
  border: 1px solid var(--line-strong); border-bottom-width: 2px; border-radius: 6px; background: rgba(255, 255, 255, .06);
}
.link-btn {
  min-height: 44px; padding: 0 12px; background: transparent; border: 0; border-radius: 8px;
  color: var(--accent-2); text-decoration: underline; text-underline-offset: 3px; font-size: .92rem;
}
.link-btn:hover { background: rgba(255, 255, 255, .06); }
.modal.over-lock { z-index: 110; }
.modal-field { margin-top: 12px; }
.modal-text + .modal-text { margin-top: 8px; }
.check-row { display: flex; align-items: center; gap: 10px; min-height: 44px; margin-top: 6px; cursor: pointer; }
.modal-actions .btn:disabled { opacity: .55; }

/* ---------- Tray, launcher groups, mobile home actions ---------- */
.launch-group { padding: 8px 10px 2px; font-size: .72rem; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.launch-foot-actions { display: flex; gap: 8px; }
.home-actions { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }

/* ---------- Lock screen ---------- */
.lock {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 95;
  display: flex; flex-direction: column; align-items: center; justify-content: space-between; gap: 18px;
  padding: max(28px, env(safe-area-inset-top)) 20px max(18px, env(safe-area-inset-bottom));
  overflow: auto; background: #05050a; animation: lockIn .22s ease-out;
}
.lock::before {
  content: ""; position: absolute; left: 0; top: 0; right: 0; bottom: 0; pointer-events: none;
  background: linear-gradient(180deg, rgba(5, 5, 10, .1), rgba(5, 5, 10, .72));
}
.lock > * { position: relative; }
.lock-clock { text-align: center; margin-top: clamp(4px, 5vh, 48px); }
.lock-time { font-family: var(--mono); font-size: clamp(3.3rem, 15vw, 6.6rem); line-height: 1; text-shadow: 0 0 36px rgba(var(--accent-rgb), .6); }
.lock-date { margin-top: 10px; font-size: 1.1rem; color: #cfcbea; }
.lock-panel { width: min(340px, 100%); display: flex; flex-direction: column; align-items: center; text-align: center; }
.lock-avatar {
  width: 84px; height: 84px; display: grid; place-items: center; border-radius: 50%;
  color: var(--accent); background: rgba(var(--accent-rgb), .14);
  border: 2px solid rgba(var(--accent-rgb), .6); box-shadow: 0 0 30px -6px rgba(var(--accent-rgb), .8);
}
.lock-avatar .ic { width: 42px; height: 42px; }
.lock-name { margin-top: 12px; font-size: 1.2rem; font-weight: 700; overflow-wrap: anywhere; }
.lock-form { width: 100%; margin-top: 14px; display: flex; flex-direction: column; align-items: stretch; gap: 8px; }
.pin-wrap { position: relative; }
.pin-input { text-align: center; font-size: 1.4rem; letter-spacing: .35em; min-height: 52px; padding: 8px 52px; background: rgba(5, 5, 10, .6); }
.pin-input::placeholder { letter-spacing: .02em; font-size: 1rem; }
.pin-toggle { position: absolute; right: 4px; top: 4px; }
.lock-msg { min-height: 2.7em; color: #ffb3bf; font-size: .9rem; }
.lock-timer { min-height: 1.3em; font-family: var(--mono); color: var(--accent-2); }
.lock-go { min-height: 50px; }
.lock-note { margin-top: 6px; font-size: .85rem; color: #cfcbea; }
.lock-foot { font-size: .75rem; color: #b4b0d0; text-align: center; }
.lock.shake .lock-panel { animation: shake .35s; }
@keyframes lockIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes shake { 0%, 100% { transform: none; } 20% { transform: translateX(-8px); } 40% { transform: translateX(8px); } 60% { transform: translateX(-5px); } 80% { transform: translateX(5px); } }
@media (max-height: 560px) {
  .lock { justify-content: flex-start; }
  .lock-time { font-size: 3rem; }
  .lock-avatar { width: 56px; height: 56px; }
  .lock-avatar .ic { width: 28px; height: 28px; }
}

/* ---------- Desktop context menu ---------- */
.ctx-menu {
  position: absolute; z-index: 70; min-width: 240px; max-width: calc(100% - 16px); padding: 6px;
  background: rgba(14, 14, 22, .98); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 12px;
  box-shadow: 0 20px 50px -10px rgba(0, 0, 0, .85); animation: popIn .12s ease-out;
}
.ctx-item {
  width: 100%; min-height: 44px; display: flex; align-items: center; gap: 10px; padding: 0 12px;
  background: transparent; border: 0; border-radius: 8px; text-align: left; color: var(--text);
}
.ctx-item:hover, .ctx-item:focus-visible { background: rgba(var(--accent-rgb), .18); }
.ctx-item .ic { color: var(--accent); }
.ctx-gap { width: 1.25em; flex: none; }
.ctx-label { flex: 1; }
.ctx-hint { font-family: var(--mono); font-size: .72rem; color: var(--muted); }
.ctx-sep { height: 1px; margin: 4px 6px; background: var(--line); }

/* ---------- Running-apps switcher ---------- */
.switcher {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 75;
  display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(3, 3, 8, .62);
}
.sw-panel {
  width: min(440px, 100%); max-height: 100%; overflow: auto; padding: 16px;
  background: var(--panel); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 16px;
  box-shadow: 0 30px 80px -10px rgba(0, 0, 0, .9); animation: popIn .16s ease-out;
}
.sw-panel:focus { outline: none; }
.sw-title { font-size: 1.05rem; margin-bottom: 10px; }
.sw-list { display: grid; gap: 6px; }
.sw-card { display: flex; align-items: center; gap: 2px; padding-right: 2px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03); }
.sw-card.is-active { border-color: var(--accent); background: rgba(var(--accent-rgb), .12); }
.sw-main { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 10px; background: transparent; border: 0; border-radius: 12px; text-align: left; }
.sw-ic { width: 40px; height: 40px; flex: none; display: grid; place-items: center; border-radius: 11px; color: var(--accent); background: rgba(var(--accent-rgb), .13); border: 1px solid rgba(var(--accent-rgb), .35); }
.sw-text { min-width: 0; }
.sw-name { display: block; font-weight: 600; }
.sw-state { display: block; font-size: .8rem; color: var(--muted); }
.sw-empty { padding: 12px; }
.sw-foot { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 14px; }
.is-mobile .switcher { align-items: flex-end; padding: 0; }
.is-mobile .sw-panel { width: 100%; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0; padding-bottom: max(16px, env(safe-area-inset-bottom)); }

/* ---------- Shortcut list, settings extras ---------- */
.sc-list .kv-row { flex-wrap: wrap; align-items: center; }
.sc-list dd { white-space: normal; }
.set-field { display: flex; flex-direction: column; gap: 6px; }
.set-note {
  padding: 10px 12px; font-size: .85rem; color: #cfcbea;
  background: rgba(var(--accent-2-rgb), .08); border: 1px solid rgba(var(--accent-2-rgb), .35); border-radius: 10px;
}
.sw.av { display: grid; place-items: center; border-radius: 50%; color: var(--accent); background: rgba(var(--accent-rgb), .12); }
.sw.av .ic { width: 18px; height: 18px; }

/* ---------- Animations ---------- */
@keyframes winIn { from { opacity: 0; transform: translateY(8px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes popIn { from { opacity: 0; transform: translateY(6px) scale(.98); } to { opacity: 1; transform: none; } }
@keyframes toastIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes draw { to { stroke-dashoffset: 0; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
html[data-motion="reduced"] *, html[data-motion="reduced"] *::before, html[data-motion="reduced"] *::after {
  animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important;
}
/* ==========================================================================
   2.0.0-b2 additions: lock-screen verify animation, Terminal, SUDO console
   ========================================================================== */

/* ---------- Lock screen: verification animation (after a correct PIN) ---------- */
.lock > .lock-scan {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 3;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 14px;
  background: radial-gradient(circle at 50% 50%, rgba(5, 5, 10, .9), rgba(5, 5, 10, .72) 70%);
  animation: scanFadeIn .22s ease-out both;
}
.lock.is-verifying .lock-panel { opacity: .12; transition: opacity .2s; }
.scan-stage {
  width: clamp(120px, 38vw, 168px); aspect-ratio: 1;
  border-radius: 50%; display: grid; place-items: center;
  background: radial-gradient(circle, rgba(var(--accent-2-rgb), .22), rgba(var(--accent-2-rgb), 0) 68%);
}
.scan-svg { width: 100%; height: 100%; overflow: visible; fill: none; stroke: var(--accent-2); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.scan-track { stroke: rgba(var(--accent-2-rgb), .22); stroke-width: 2; }
.scan-ring { stroke-width: 3; stroke-dasharray: 100; stroke-dashoffset: 100; transform-box: fill-box; transform-origin: center; transform: rotate(-90deg); }
.scan-face, .scan-fp { stroke-width: 2.2; }
.scan-fp { stroke: rgba(var(--accent-rgb), .95); }
.scan-line { stroke-width: 2; stroke: var(--accent-2); opacity: 0; }
.scan-check { stroke-width: 5; stroke-dasharray: 100; stroke-dashoffset: 100; opacity: 0; }
.scan-text { min-height: 1.6em; font-size: 1.05rem; font-weight: 600; letter-spacing: .08em; color: #d7f8ff; text-align: center; }

[data-phase="scan"] .scan-line { animation: scanSweep .7s ease-in-out 1 both; }
:is([data-phase="ring"], [data-phase="check"], [data-phase="leave"]) .scan-ring { animation: ringDraw .55s ease-out forwards; }
:is([data-phase="ring"]) :is(.scan-face, .scan-fp) { opacity: .5; }
:is([data-phase="check"], [data-phase="leave"], [data-phase="done"]) :is(.scan-face, .scan-fp, .scan-line) { opacity: 0; transition: opacity .2s; }
:is([data-phase="check"], [data-phase="leave"]) .scan-check { opacity: 1; animation: checkDraw .45s ease-out forwards; }
:is([data-phase="check"], [data-phase="leave"]) .scan-stage { animation: scanPop .5s ease-out 1 both; }
[data-phase="done"] .scan-ring { stroke-dashoffset: 0; }
[data-phase="done"] .scan-check { opacity: 1; stroke-dashoffset: 0; }

.lock.is-leaving { opacity: 0; transform: scale(1.04); transition: opacity .4s ease-in, transform .4s ease-in; }

@keyframes scanFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes scanSweep { 0% { opacity: 0; transform: translateY(-22px); } 15% { opacity: 1; } 50% { transform: translateY(22px); } 85% { opacity: 1; } 100% { opacity: 0; transform: translateY(-4px); } }
@keyframes ringDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes checkDraw { from { stroke-dashoffset: 100; } to { stroke-dashoffset: 0; } }
@keyframes scanPop { 0% { transform: scale(1); } 45% { transform: scale(1.07); } 100% { transform: scale(1); } }

/* ---------- Terminal app ---------- */
.app.term { background: #05050a; font-family: var(--mono); font-size: 16px; }
.term-out { flex: 1; min-height: 0; overflow: auto; padding: 10px 12px; -webkit-overflow-scrolling: touch; overscroll-behavior: contain; }
.term-out:focus { outline: none; }
.term-line { margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.5; color: #d9d7ee; }
.term-cmd { color: var(--accent-2); }
.term-err { color: #ff9aa9; }
.term-dim { color: var(--muted); }
.term-head { color: var(--accent); font-weight: 700; }
.term-form { display: flex; align-items: center; gap: 8px; padding: 6px 12px max(8px, env(safe-area-inset-bottom)); border-top: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.term-prompt { color: var(--accent); white-space: nowrap; font-size: .85rem; }
.term-in { flex: 1; min-width: 0; min-height: 44px; padding: 0 4px; background: transparent; border: 0; color: var(--text); font-family: var(--mono); font-size: 16px; }
.term-in:focus { outline: none; }
.term-form:focus-within { border-top-color: var(--accent-2); }
.term-in:focus-visible { outline: none; }

/* ---------- SUDO console (hidden; opened only from the Terminal) ---------- */
.sx-layer {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 85; overflow: auto; -webkit-overflow-scrolling: touch;
  background:
    radial-gradient(ellipse at 15% 0%, rgba(var(--accent-2-rgb), .16), transparent 55%),
    radial-gradient(ellipse at 90% 100%, rgba(var(--accent-rgb), .2), transparent 55%),
    #020206;
  animation: scanFadeIn .25s ease-out both;
}
.sx-layer:focus { outline: none; }
.sx-body { min-height: 100%; display: flex; flex-direction: column; }
.sx-brand { display: flex; align-items: center; gap: 12px; }
.sx-logo { width: 38px; height: 38px; filter: drop-shadow(0 0 10px rgba(var(--accent-2-rgb), .6)); }
.sx-corp { font-weight: 700; letter-spacing: .32em; font-size: .95rem; }
.sx-sub { font-family: var(--mono); font-size: .75rem; letter-spacing: .3em; color: var(--accent-2); }
.sx-gate {
  width: min(400px, calc(100% - 32px)); margin: auto; padding: 24px 22px; display: flex; flex-direction: column; gap: 12px;
  background: rgba(16, 16, 26, .72); border: 1px solid rgba(var(--accent-2-rgb), .35); border-radius: 18px;
  box-shadow: 0 30px 80px -20px rgba(0, 0, 0, .9), 0 0 50px -18px rgba(var(--accent-2-rgb), .7);
  margin-top: max(24px, env(safe-area-inset-top)); margin-bottom: 24px;
}
.sx-title { font-size: 1.3rem; }
.sx-text { color: var(--muted); }
.sx-fine { font-size: .78rem; color: #9794b6; }
.sx-msg { min-height: 1.4em; color: #ffb3bf; font-size: .9rem; }
.sx-timer { min-height: 1.2em; font-family: var(--mono); color: var(--accent-2); }
.sx-form { display: flex; flex-direction: column; gap: 6px; }
.sx-pin { text-align: center; font-size: 1.3rem; letter-spacing: .3em; min-height: 50px; background: rgba(5, 5, 10, .6); }
.sx-actions { display: flex; justify-content: flex-end; flex-wrap: wrap; gap: 8px; margin-top: 6px; }
.sx-ok { width: 56px; height: 56px; display: grid; place-items: center; border-radius: 50%; color: var(--accent-2); border: 2px solid var(--accent-2); box-shadow: 0 0 24px -4px rgba(var(--accent-2-rgb), .8); }
.sx-ok .ic { width: 30px; height: 30px; stroke-width: 2.4; }

.sx-dash { min-height: 100%; display: flex; flex-direction: column; }
.sx-head {
  position: sticky; top: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px;
  padding: max(12px, env(safe-area-inset-top)) 16px 12px; background: rgba(2, 2, 6, .86); border-bottom: 1px solid rgba(var(--accent-2-rgb), .25);
}
.sx-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.sx-main { width: min(1100px, 100%); margin: 0 auto; padding: 16px 16px max(24px, env(safe-area-inset-bottom)); display: flex; flex-direction: column; gap: 14px; }
.sx-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 320px), 1fr)); gap: 14px; align-items: start; }
.sx-panel {
  padding: 16px; min-width: 0;
  background: rgba(20, 20, 34, .6); border: 1px solid rgba(var(--accent-rgb), .3); border-radius: 16px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .05), 0 20px 50px -24px rgba(0, 0, 0, .9);
}
.sx-welcome { border-color: rgba(var(--accent-2-rgb), .45); box-shadow: 0 0 60px -26px rgba(var(--accent-2-rgb), .8); }
.sx-kicker { font-family: var(--mono); font-size: .72rem; letter-spacing: .3em; color: var(--accent-2); }
.sx-welcome .sx-title { font-size: clamp(1.4rem, 5vw, 2rem); margin: 6px 0 4px; overflow-wrap: anywhere; }
.sx-time { font-family: var(--mono); font-size: clamp(2rem, 9vw, 3rem); line-height: 1.1; margin-top: 10px; text-shadow: 0 0 28px rgba(var(--accent-2-rgb), .5); }
.sx-date { color: #cfcbea; }
.sx-soundnote { margin-top: 8px; }
.sx-h { font-size: 1rem; margin-bottom: 10px; color: #e6e3ff; }
.sx-notes {
  width: 100%; min-height: 200px; resize: vertical; padding: 10px 12px; font: inherit; line-height: 1.5;
  background: rgba(5, 5, 10, .6); color: var(--text); border: 1px solid var(--line-strong); border-radius: 10px;
}
.sx-notes:focus { border-color: var(--accent-2); }
.sx-foot { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 6px; margin-top: 8px; font-size: .8rem; }
.sx-pform { display: grid; grid-template-columns: 1fr; gap: 8px; }
.sx-projects { display: flex; flex-direction: column; gap: 8px; margin-top: 10px; }
.sx-project { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 12px; background: rgba(255, 255, 255, .03); }
.sx-ptext { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.sx-pname { font-weight: 600; overflow-wrap: anywhere; }
.sx-pnote { font-size: .82rem; color: var(--muted); overflow-wrap: anywhere; }
.sx-pstatus { width: auto; min-width: 92px; }
.sx-disclose { text-align: center; }
.sx-banner { margin: 0; }
.sx-switch {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0 12px;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong); border-radius: 9px; font-weight: 600; font-size: .92rem;
}
.sx-switch-state { color: var(--muted); font-size: .8rem; min-width: 1.8em; }
.sx-switch[aria-checked="true"] .track { background: var(--accent-2); }
.sx-switch[aria-checked="true"] .knob { transform: translateX(20px); background: var(--on-accent); }
@media (min-width: 560px) { .sx-pform { grid-template-columns: 1fr auto; } .sx-pform input:first-child { grid-column: 1 / -1; } }
@media (max-width: 480px) {
  .sx-head-actions .btn { flex: 1 1 auto; }
  .sx-gate { padding: 20px 16px; }
}

/* ==========================================================================
   HEXA OS 2.1 — HEXA NEXUS home screen, notification centre, quick settings
   ========================================================================== */
.nexus {
  position: absolute; left: 0; top: 0; right: 0; bottom: 0; overflow-y: auto; overflow-x: hidden; -webkit-overflow-scrolling: touch;
  padding: 14px 18px 20px; display: grid; gap: 14px 22px; align-content: start;
  grid-template-columns: minmax(0, 1fr);
  grid-template-areas: "top" "hero" "search" "tip" "strip" "apps" "widgets";
}
.is-mobile .desktop { padding: 0; overflow: hidden; }
.nx-top { grid-area: top; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.nx-brand { display: flex; align-items: center; gap: 8px; margin: 0; font-size: .72rem; letter-spacing: .42em; color: var(--accent); font-weight: 700; }
.nx-brand .ic { width: 22px; height: 22px; }
.nx-cluster { display: flex; gap: 4px; }
.nx-ico, .tray-btn { position: relative; }
.nx-ico {
  width: 44px; height: 44px; display: grid; place-items: center; border-radius: 50%;
  background: rgba(255, 255, 255, .05); border: 1px solid var(--line); color: var(--text);
}
.nx-ico:hover { background: rgba(255, 255, 255, .1); }
.nx-ico .ic { width: 20px; height: 20px; }
.nx-badge {
  position: absolute; top: 2px; right: 2px; min-width: 18px; height: 18px; padding: 0 4px; border-radius: 9px;
  display: grid; place-items: center; background: var(--danger); color: #1a0509; font-size: .68rem; font-weight: 800; line-height: 1;
  border: 2px solid var(--panel); box-sizing: content-box;
}
.nx-badge[hidden] { display: none; }

.nx-hero { grid-area: hero; text-align: center; padding: 6px 0 2px; }
.nx-greeting { margin: 0 0 2px; font-size: clamp(1rem, 3.6vw, 1.25rem); color: #d8d5f2; overflow-wrap: anywhere; }
.nx-greeting[hidden] { display: none; }
.nx-time { margin: 0; font-family: var(--mono); font-size: clamp(2.8rem, 11vw, 4.4rem); line-height: 1.08; text-shadow: 0 0 28px rgba(var(--accent-rgb), .55); }
.nx-date { margin: 2px 0 0; color: var(--muted); }
.nx-tag { margin: 8px 0 0; font-size: .8rem; color: var(--muted); }

.nx-search {
  grid-area: search; position: relative; z-index: 6; display: flex; align-items: center; gap: 10px;
  min-height: 52px; padding: 0 14px; border-radius: 16px; color: var(--muted);
  background: rgba(14, 14, 22, .82); border: 1px solid var(--line-strong);
  width: min(640px, 100%); justify-self: center;
}
.nx-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb), .25); }
.nx-search .ic { width: 20px; height: 20px; flex: none; }
.nx-search-in { flex: 1; min-width: 0; min-height: 48px; background: transparent; border: 0; color: var(--text); font-size: 1rem; outline: none; }
.nx-search-in::placeholder { color: #8d8aa9; }
.nx-results {
  position: absolute; left: 0; right: 0; top: calc(100% + 6px); z-index: 7; margin: 0; padding: 6px; list-style: none;
  max-height: min(380px, 55vh); overflow-y: auto; -webkit-overflow-scrolling: touch;
  background: rgba(14, 14, 22, .98); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 14px;
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .9);
}
.nx-results[hidden] { display: none; }
.nx-res { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 6px 10px; border-radius: 10px; color: var(--text); cursor: pointer; }
.nx-res.is-active, .nx-res:hover { background: rgba(var(--accent-rgb), .2); }
.nx-res.nx-none { cursor: default; color: var(--muted); }
.nx-res-ic { width: 36px; height: 36px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(var(--accent-rgb), .18); color: var(--accent); }
.nx-res-ic .ic { width: 20px; height: 20px; }
.nx-res-t { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.nx-res-n { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-res-d { font-size: .78rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-res-k { flex: none; font-size: .68rem; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }

.nexus .tip { grid-area: tip; position: static; width: auto; margin: 0; }
.nexus .shortcuts {
  grid-area: apps; position: static; display: grid; grid-auto-flow: row; grid-template-rows: none; grid-auto-columns: auto;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr)); gap: 8px 6px; align-content: start; justify-content: stretch;
}
.nexus .shortcut { min-height: 94px; }

.nx-strip { grid-area: strip; display: flex; flex-direction: column; gap: 8px; }
.nx-strip[hidden] { display: none; }
.nx-strip-h { margin: 0 0 6px; font-size: .7rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nx-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.nx-chip {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; padding: 0 14px 0 10px; border-radius: 999px;
  background: rgba(255, 255, 255, .06); border: 1px solid var(--line-strong); color: var(--text); font-weight: 600; font-size: .88rem;
}
.nx-chip .ic { width: 18px; height: 18px; color: var(--accent); }
.nx-chip.is-active { border-color: var(--accent-2); background: rgba(var(--accent-2-rgb), .14); }
.nx-chip:hover { background: rgba(255, 255, 255, .1); }
.nx-strip-empty { margin: 0; font-size: .82rem; color: var(--muted); }

.nx-widgets { grid-area: widgets; display: flex; flex-direction: column; gap: 12px; min-width: 0; }
.nx-widgets[hidden] { display: none; }
.nx-widget { padding: 14px; border-radius: 16px; background: rgba(14, 14, 22, .82); border: 1px solid var(--line-strong); min-width: 0; display: flex; flex-direction: column; gap: 10px; }
.nx-w-h { margin: 0; font-size: .74rem; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.nx-w-sub { margin: 0; font-size: .85rem; color: #cfcbea; }
.nx-w-note { margin: 0; font-size: .75rem; color: var(--muted); }
.nx-w-msg { margin: 4px 0 0; font-size: .8rem; color: var(--accent-2); min-height: 1.2em; }
.nx-w-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.nx-widget > .btn { align-self: flex-start; }
.nx-list { list-style: none; margin: 8px 0 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.nx-empty { margin: 0; padding: 8px 0; font-size: .85rem; color: var(--muted); list-style: none; }
.nx-task-l { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; overflow-wrap: anywhere; }
.nx-note { width: 100%; display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 52px; padding: 6px 10px; text-align: left; color: var(--text); background: rgba(255, 255, 255, .04); border: 1px solid var(--line); border-radius: 10px; }
.nx-note:hover { background: rgba(255, 255, 255, .08); }
.nx-note-t { font-weight: 600; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-note-p { font-size: .78rem; color: var(--muted); max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nx-qn { min-height: 76px; resize: vertical; }
.nx-cal-nav { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.nx-cal-t { margin: 0; font-weight: 600; text-align: center; flex: 1; }
.nx-cal { width: 100%; border-collapse: collapse; table-layout: fixed; margin-top: 6px; text-align: center; font-size: .82rem; }
.nx-cal th { padding: 4px 0; font-weight: 600; color: var(--muted); font-size: .7rem; }
.nx-cal td { padding: 6px 0; border-radius: 8px; }
.nx-cal td.is-today { background: var(--accent); color: var(--on-accent); font-weight: 800; }
.nx-kv { margin: 0; }
.nx-cosmo { display: flex; align-items: center; gap: 12px; }
.nx-cosmo-art { width: 84px; height: 84px; flex: none; }
.nx-cosmo-n { margin: 0; font-size: 1.4rem; font-weight: 800; letter-spacing: .22em; }

/* customize dialog */
.nx-cust-list { list-style: none; margin: 6px 0 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.nx-cust-row { display: flex; align-items: center; gap: 8px; padding: 4px 6px; border: 1px solid var(--line); border-radius: 10px; }
.nx-cust-l { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; min-height: 48px; cursor: pointer; }
.nx-cust-l .set-label, .nx-cust-l .set-desc { display: block; }
.nx-cust-mv { display: flex; flex: none; }

/* wide desktop: widgets sit in a column beside the main area */
@media (min-width: 900px) {
  .nexus {
    grid-template-columns: minmax(0, 1fr) minmax(280px, 340px);
    grid-template-areas: "top top" "hero widgets" "search widgets" "tip widgets" "strip widgets" "apps widgets";
    grid-template-rows: auto auto auto auto auto 1fr;
  }
  .nx-widgets { align-self: start; }
  .nx-hero { text-align: left; }
  .nx-search { justify-self: start; }
}
@media (max-width: 380px) {
  .nexus { padding: 10px 12px 16px; gap: 12px; }
  .nx-brand { letter-spacing: .3em; }
  .nexus .shortcuts { grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); }
}

/* ---------- Notification centre and quick settings ---------- */
.panels { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 78; }
.panels[hidden] { display: none; }
.pn-backdrop { position: absolute; left: 0; top: 0; right: 0; bottom: 0; background: rgba(0, 0, 0, .35); }
.pn-sheet {
  position: absolute; right: 12px; bottom: calc(var(--taskbar-h) + var(--safe-b) + 10px);
  width: min(390px, calc(100% - 24px)); max-height: calc(100% - var(--taskbar-h) - var(--safe-b) - 32px);
  display: flex; flex-direction: column; overflow: hidden;
  background: rgba(14, 14, 22, .98); border: 1px solid rgba(var(--accent-rgb), .45); border-radius: 16px;
  box-shadow: 0 24px 60px -10px rgba(0, 0, 0, .85), 0 0 30px -10px rgba(var(--accent-rgb), .5);
  animation: popIn .16s ease-out;
}
.pn-sheet:focus { outline: none; }
.is-mobile .pn-sheet { left: 0; right: 0; width: auto; border-radius: 18px 18px 0 0; border-left: 0; border-right: 0; border-bottom: 0; max-height: 82%; bottom: calc(var(--taskbar-h) + var(--safe-b)); }
.pn-head { flex: none; display: flex; align-items: center; gap: 8px; padding: 10px 10px 8px 16px; border-bottom: 1px solid var(--line); }
.pn-title { flex: 1; margin: 0; font-size: 1.05rem; }
.pn-actions { display: flex; gap: 6px; }
.pn-body { flex: 1; min-height: 0; overflow-y: auto; -webkit-overflow-scrolling: touch; padding: 10px 12px 14px; display: flex; flex-direction: column; gap: 10px; }
.pn-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.pn-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px; border-radius: 12px; border: 1px solid var(--line); background: rgba(255, 255, 255, .03); }
.pn-item.is-new { border-color: rgba(var(--accent-rgb), .55); background: rgba(var(--accent-rgb), .1); }
.pn-ic { width: 34px; height: 34px; flex: none; display: grid; place-items: center; border-radius: 10px; background: rgba(var(--accent-2-rgb), .14); color: var(--accent-2); }
.pn-ic .ic { width: 18px; height: 18px; }
.pn-item.lv-warn .pn-ic { background: rgba(251, 191, 36, .14); color: #fbbf24; }
.pn-item.lv-error .pn-ic { background: rgba(255, 107, 129, .14); color: var(--danger); }
.pn-item.lv-success .pn-ic { background: rgba(61, 220, 151, .14); color: var(--ok); }
.pn-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; align-items: flex-start; }
.pn-t { margin: 0; font-weight: 600; overflow-wrap: anywhere; }
.pn-b { margin: 0; font-size: .85rem; color: #cfcbea; overflow-wrap: anywhere; }
.pn-when { margin: 0; font-size: .72rem; color: var(--muted); }
.pn-fine { margin: 0; font-size: .78rem; color: var(--muted); }
.pn-tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.pn-tile {
  display: flex; flex-direction: column; align-items: flex-start; gap: 2px; min-height: 84px; padding: 10px 12px; text-align: left;
  color: var(--text); background: rgba(255, 255, 255, .05); border: 1px solid var(--line-strong); border-radius: 14px;
}
.pn-tile:disabled { opacity: .5; }
.pn-tile[aria-pressed="true"] { background: rgba(var(--accent-rgb), .26); border-color: var(--accent); }
.pn-tile-ic .ic { width: 22px; height: 22px; }
.pn-tile-l { font-weight: 700; font-size: .9rem; }
.pn-tile-d { font-size: .74rem; color: var(--muted); overflow-wrap: anywhere; }
.pn-sec { display: flex; flex-direction: column; gap: 6px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; }
.pn-sec-h { display: flex; justify-content: space-between; align-items: center; font-weight: 600; }
.pn-sec-t { margin: 0; font-size: .9rem; }
.pn-range { width: 100%; min-height: 44px; accent-color: var(--accent); }
.pn-honest { background: rgba(255, 255, 255, .02); }

/* software dimmer: darkens HEXA OS only */
.dimmer { position: absolute; left: 0; top: 0; right: 0; bottom: 0; z-index: 130; background: #000; opacity: 0; pointer-events: none; }

@media (min-width: 900px) { .nx-hero .home-actions { justify-content: flex-start; } }
