/* NEXUS: futuristic look. Colors: electric blue, cyan and violet on deep space black. */
:root {
  --bg: #03050b;
  --glass: rgba(10, 16, 34, 0.72);
  --glass-2: rgba(22, 32, 62, 0.55);
  --line: rgba(110, 160, 255, 0.18);
  --line-strong: rgba(52, 228, 255, 0.45);
  --text: #e8f1ff;
  --muted: #8ea3c8;
  --cyan: #34e4ff;
  --blue: #2b7bff;
  --violet: #8a5cff;
  --nexus-gradient: linear-gradient(90deg, var(--cyan), var(--blue) 45%, var(--violet));
  --high: #ff5d7a;
  --medium: #ffb547;
  --low: #5ee0a8;
  --radius: 18px;
  --display: "Orbitron", "Segoe UI", system-ui, sans-serif;
  --body: "Exo 2", "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; }
body {
  background:
    radial-gradient(900px 600px at 50% 45%, rgba(43, 123, 255, 0.10), transparent 70%),
    radial-gradient(1200px 800px at 85% 110%, rgba(138, 92, 255, 0.10), transparent 60%),
    var(--bg);
  color: var(--text);
  font: 15px/1.5 var(--body);
  -webkit-tap-highlight-color: transparent;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

/* ---------- the sphere ---------- */
#sphere { position: fixed; inset: 0; z-index: 0; cursor: pointer; transition: opacity .6s, filter .6s; }
body.panel-open #sphere { opacity: .35; filter: blur(1.5px); }

/* faint scan lines and corner frame for a HUD feel */
.hud-frame { position: fixed; inset: 14px; pointer-events: none; z-index: 1; }
.hud-frame::before, .hud-frame::after {
  content: ""; position: absolute; width: 46px; height: 46px; border: 1px solid var(--line-strong); opacity: .35;
}
.hud-frame::before { top: 0; left: 0; border-right: 0; border-bottom: 0; }
.hud-frame::after { bottom: 0; right: 0; border-left: 0; border-top: 0; }

/* ---------- glow behind an open screen: shows Nexus is listening (cyan), thinking (violet) or talking (blue) ---------- */
/* a halo placed exactly behind the open screen: its glow spills out around the edges, the middle stays clear */
.aura { position: fixed; z-index: 4; pointer-events: none; opacity: 0; transition: opacity .5s ease; border-radius: var(--radius);
        box-shadow: 0 0 40px 10px var(--aura-color, rgba(52, 228, 255, .5)), 0 0 110px 40px var(--aura-color, rgba(52, 228, 255, .5)); }
body.panel-open[data-nexus="listening"] .aura { --aura-color: rgba(52, 228, 255, .32); animation: aura-pulse 1.5s ease-in-out infinite; }
body.panel-open[data-nexus="thinking"] .aura { --aura-color: rgba(138, 92, 255, .3); animation: aura-pulse 2.6s ease-in-out infinite; }
body.panel-open[data-nexus="speaking"] .aura { --aura-color: rgba(43, 123, 255, .3); animation: aura-pulse 1s ease-in-out infinite; }
@keyframes aura-pulse { 0%, 100% { opacity: .55; } 50% { opacity: 1; } }
.panel { transition: border-color .4s, box-shadow .4s; }
body[data-nexus="listening"] .panel { border-color: rgba(52, 228, 255, .7);
  box-shadow: 0 0 0 1px rgba(52, 228, 255, .25), 0 30px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(52, 228, 255, .35); }
body[data-nexus="thinking"] .panel { border-color: rgba(138, 92, 255, .55); }
@media (prefers-reduced-motion: reduce) { body.panel-open[data-nexus] .aura { animation: none; } body.panel-open[data-nexus="listening"] .aura { opacity: .9; } }

/* ---------- start-up wordmark ---------- */
.boot {
  position: fixed; left: 50%; top: 47%; transform: translate(-50%, -50%); z-index: 2; pointer-events: none;
  font: 700 clamp(34px, 7vw, 78px)/1 var(--display); letter-spacing: .5em; padding-left: .5em;
  background: var(--nexus-gradient); -webkit-background-clip: text; background-clip: text; color: transparent;
  filter: drop-shadow(0 0 18px rgba(52, 228, 255, .45));
  animation: boot 5.5s ease forwards;
}
/* the name sweeps in to land on the music's "boom" at 2.5 seconds, then drifts away */
@keyframes boot {
  0%, 20% { opacity: 0; letter-spacing: 1.2em; filter: blur(12px); }
  45% { opacity: 1; letter-spacing: .5em; filter: blur(0) drop-shadow(0 0 22px rgba(52, 228, 255, .6)); }
  75% { opacity: 1; }
  100% { opacity: 0; letter-spacing: .7em; }
}

/* ---------- captions under the sphere ---------- */
.hud { position: fixed; left: 50%; top: calc(47% + min(17vw, 17vh) + 70px); transform: translateX(-50%);
       width: min(680px, calc(100vw - 32px)); text-align: center; z-index: 2; pointer-events: none; }
body.panel-open .hud { opacity: 0; }
.state-label { font: 600 11px/1 var(--display); letter-spacing: .45em; color: var(--cyan); opacity: 0; transition: opacity .4s; height: 14px; }
.state-label.show { opacity: .8; }
.caption { opacity: 0; transform: translateY(6px); transition: opacity .5s, transform .5s; }
.caption.show { opacity: 1; transform: none; }
.caption.heard { color: var(--muted); font-size: 15px; margin-top: 10px; font-style: italic; min-height: 22px; }
.caption.reply { font-size: clamp(16px, 2.2vw, 20px); line-height: 1.45; margin-top: 6px;
                 text-shadow: 0 0 18px rgba(43, 123, 255, .55); }

/* ---------- auto-hiding corner controls ---------- */
.controls { position: fixed; top: 22px; right: 22px; display: flex; gap: 10px; z-index: 3;
            opacity: 0; transform: translateY(-6px); transition: opacity .5s, transform .5s; pointer-events: none; }
body.show-controls .controls, body.show-controls .kbd-btn { opacity: 1; transform: none; pointer-events: auto; }
body.panel-open .controls { opacity: 0 !important; pointer-events: none !important; }
.hud-btn { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center;
           background: rgba(10, 18, 38, .55); border: 1px solid var(--line); color: var(--muted);
           backdrop-filter: blur(8px); transition: color .2s, border-color .2s, box-shadow .2s; }
.hud-btn:hover { color: var(--cyan); border-color: var(--line-strong); box-shadow: 0 0 16px rgba(52, 228, 255, .35); }
.hud-btn svg { width: 19px; height: 19px; }
.kbd-btn { position: fixed; bottom: 26px; left: 50%; margin-left: -21px; z-index: 3;
           opacity: 0; transition: opacity .5s; pointer-events: none; }

/* ---------- "open in another window" notice ---------- */
.dormant { position: fixed; inset: 0; z-index: 9; display: grid; place-items: center; background: rgba(3, 5, 11, .55); backdrop-filter: blur(4px); }
.dormant-card { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 30px; text-align: center;
                background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius); max-width: calc(100vw - 32px); }
.dormant-card b { font: 600 13px/1.4 var(--display); letter-spacing: .2em; color: var(--cyan); }
.dormant-card span { color: var(--muted); }
.lock-card { min-width: min(320px, calc(100vw - 32px)); }
.lock-card .field { width: 100%; text-align: center; font-size: 22px; letter-spacing: .3em; padding: 10px; }
.lock-card .accent-btn { width: 100%; padding: 11px; }

/* ---------- typing bar ---------- */
.command-bar { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%); z-index: 4;
               width: min(620px, calc(100vw - 32px)); display: flex; gap: 8px; padding: 6px;
               background: var(--glass); border: 1px solid var(--line-strong); border-radius: 999px;
               backdrop-filter: blur(14px); box-shadow: 0 0 30px rgba(43, 123, 255, .25); animation: rise .3s ease; }
.command-bar input { flex: 1; background: none; border: 0; outline: none; padding: 10px 16px; font-size: 16px; }
.command-bar button { width: 42px; height: 42px; border-radius: 50%; border: 0; background: var(--nexus-gradient); color: #031020; font-weight: 700; }
@keyframes rise { from { opacity: 0; transform: translate(-50%, 10px); } }

/* ---------- panels (notes, conversation, settings) ---------- */
.panel {
  position: fixed; z-index: 5; left: 50%; top: 50%; transform: translate(-50%, -50%);
  width: min(1560px, calc(100vw - 64px)); height: min(86vh, 960px); height: min(86dvh, 960px);
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--glass); border: 1px solid var(--line); border-radius: var(--radius);
  backdrop-filter: blur(18px) saturate(1.2);
  box-shadow: 0 0 0 1px rgba(52, 228, 255, .06), 0 30px 80px rgba(0, 0, 0, .55), 0 0 60px rgba(43, 123, 255, .12);
  animation: panel-in .35s cubic-bezier(.2, .8, .2, 1);
}
.panel::before { content: ""; position: absolute; left: 0; right: 0; top: 0; height: 1px; background: var(--nexus-gradient); opacity: .8; }
@keyframes panel-in { from { opacity: 0; transform: translate(-50%, -48%) scale(.97); filter: blur(6px); } }
.panel-head { display: flex; align-items: center; flex-wrap: wrap; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.panel-head h2 { margin: 0; font: 600 14px/1 var(--display); letter-spacing: .3em; text-transform: uppercase;
                 background: var(--nexus-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.panel-head .close { margin-left: auto; }
.chip-btn { background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; padding: 7px 12px; font-size: 13px; color: var(--muted); white-space: nowrap; }
.chip-btn:hover { color: var(--cyan); border-color: var(--line-strong); }

/* notes */
.tabs { display: flex; gap: 6px; padding: 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.tab { flex: none; background: none; border: 1px solid transparent; color: var(--muted); border-radius: 999px; padding: 6px 13px; }
.tab.active { color: var(--text); border-color: var(--line-strong); background: rgba(52, 228, 255, .08); box-shadow: 0 0 12px rgba(52, 228, 255, .15); }
.tab .count { color: var(--muted); font-size: 12px; margin-left: 5px; }
.listbar { display: flex; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.field { background: var(--glass-2); border: 1px solid var(--line); border-radius: 10px; padding: 8px 11px; outline: none; min-width: 0; }
.field:focus { border-color: var(--line-strong); }
select.field option, select option { background: #0b1226; color: var(--text); }
.listbar .field { flex: 1; }
.items { flex: 1; overflow-y: auto; padding: 8px 12px 16px; }
.empty { color: var(--muted); text-align: center; padding: 40px 10px; }
.item { display: grid; grid-template-columns: 26px 1fr auto; gap: 10px; align-items: start; padding: 11px 10px; border-radius: 12px; border: 1px solid transparent; }
.item:hover { background: rgba(43, 123, 255, .07); border-color: var(--line); }
.item.done .title { text-decoration: line-through; color: var(--muted); }
.check { width: 22px; height: 22px; margin-top: 1px; border-radius: 7px; border: 2px solid var(--muted); background: none; display: grid; place-items: center; padding: 0; color: #031020; font-size: 14px; }
.check:hover { border-color: var(--cyan); }
.item.done .check { background: var(--low); border-color: var(--low); }
.title { font-weight: 600; }
.details { color: var(--muted); font-size: 13.5px; margin-top: 2px; white-space: pre-wrap; }
.meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.chip { font-size: 11.5px; padding: 2px 8px; border-radius: 999px; background: var(--glass-2); border: 1px solid var(--line); color: var(--muted); }
.chip.business { color: var(--cyan); border-color: rgba(52, 228, 255, .4); }
.chip.overdue { color: var(--high); border-color: rgba(255, 93, 122, .5); }
.side { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.prio { appearance: none; border-radius: 999px; padding: 3px 10px; font-size: 12px; font-weight: 600; border: 1px solid; background: transparent; text-align: center; }
.prio.high { color: var(--high); border-color: var(--high); }
.prio.medium { color: var(--medium); border-color: var(--medium); }
.prio.low { color: var(--low); border-color: var(--low); }
.del { background: none; border: 0; color: var(--muted); font-size: 12px; opacity: 0; padding: 2px 4px; }
.item:hover .del, .item:focus-within .del, .mem:hover .del, .mem:focus-within .del { opacity: 1; }
.del:hover { color: var(--high); }
.add { display: grid; grid-template-columns: 1fr auto auto auto; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.accent-btn { background: rgba(52, 228, 255, .08); border: 1px solid var(--line-strong); color: var(--cyan); border-radius: 10px; padding: 8px 14px; }
.accent-btn:hover { box-shadow: 0 0 14px rgba(52, 228, 255, .3); }

/* who am i: Nexus's brain */
.brain-status { display: inline-flex; align-items: center; gap: 8px; font: 600 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; color: var(--cyan); }
.learning-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 10px var(--cyan); animation: learn 1.6s ease-in-out infinite; }
@keyframes learn { 50% { opacity: .25; transform: scale(.7); } }
.brain-body { flex: 1; display: grid; grid-template-columns: 1fr clamp(340px, 28%, 440px); min-height: 0; }
.brain-stage { position: relative; min-height: 0; overflow: hidden;
               background: radial-gradient(circle at 50% 50%, rgba(43, 123, 255, .08), transparent 60%),
                           repeating-linear-gradient(0deg, rgba(110, 160, 255, .035) 0 1px, transparent 1px 34px),
                           repeating-linear-gradient(90deg, rgba(110, 160, 255, .035) 0 1px, transparent 1px 34px); }
.brain-stage canvas { position: absolute; inset: 0; width: 100%; height: 100%; }
.brain-stats { position: absolute; left: 16px; bottom: 14px; font: 600 10px/1.4 var(--display); letter-spacing: .18em; color: var(--muted); pointer-events: none; }
.brain-tip { position: absolute; max-width: 240px; padding: 10px 12px; border-radius: 12px; pointer-events: none; z-index: 2;
             background: rgba(6, 12, 28, .92); border: 1px solid var(--line-strong); box-shadow: 0 0 20px rgba(52, 228, 255, .2); }
.brain-tip b { display: block; font-weight: 600; }
.brain-tip span { display: block; margin-top: 3px; color: var(--muted); font-size: 12px; }
.brain-side { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.brain-add { padding: 12px 12px 0; margin: 0; grid-template-columns: 1fr auto; }
.brain-add .field:first-child { grid-column: 1 / -1; }
.brain-add select { width: 100%; }
.brain-search { margin: 10px 12px; }
.brain-list { flex: 1; overflow-y: auto; padding: 0 10px 16px; }
.brain-cat { display: flex; align-items: center; gap: 8px; padding: 14px 6px 6px; color: var(--cat); font: 600 11px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.brain-cat .count { color: var(--muted); letter-spacing: 0; font-family: var(--body); }
.brain-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--cat); box-shadow: 0 0 8px var(--cat); }
.brain-mem { display: flex; align-items: center; gap: 6px; padding: 9px 10px; margin: 3px 0; border-radius: 12px;
             border: 1px solid transparent; border-left: 2px solid var(--cat); background: rgba(22, 32, 62, .3); transition: background .3s, box-shadow .3s; }
.brain-mem:hover { background: rgba(43, 123, 255, .1); border-color: var(--line); border-left-color: var(--cat); }
.brain-mem:hover .del, .brain-mem:focus-within .del { opacity: 1; }
.brain-mem.flash { box-shadow: 0 0 0 1px var(--cat), 0 0 18px var(--cat); }
.brain-fact { flex: 1; min-width: 0; }
.brain-fact small { display: block; color: var(--muted); font-size: 11.5px; margin-top: 2px; }
@media (max-width: 860px) {
  .brain-body { grid-template-columns: 1fr; grid-template-rows: 300px 1fr; }
  .brain-side { border-left: 0; border-top: 1px solid var(--line); }
  .brain-status { display: none; }
  .brain-mem .del { opacity: 1; }
}

/* folders */
.folder-bar { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; align-items: center; }
.folder-bar:empty { display: none; }
.folder { flex: none; display: inline-flex; align-items: center; gap: 6px; background: rgba(22, 32, 62, .35); border: 1px solid var(--line);
          color: var(--muted); border-radius: 10px; padding: 5px 11px; font-size: 13px; }
.folder svg { width: 14px; height: 14px; }
.folder .count { font-size: 11.5px; opacity: .8; }
.folder:hover { color: var(--text); border-color: var(--line-strong); }
.folder.active { color: var(--text); border-color: var(--violet); background: rgba(138, 92, 255, .16); box-shadow: 0 0 12px rgba(138, 92, 255, .2); }
.folder.new { border-style: dashed; }
.folder-tool { flex: none; background: none; border: 0; color: var(--muted); font-size: 12px; padding: 4px 6px; }
.folder-tool:hover { color: var(--cyan); }
.folder-tool.danger:hover { color: var(--high); }
.group-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 6px; color: var(--violet); font: 600 11px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.group-head svg { width: 14px; height: 14px; }
.group-head .count { color: var(--muted); letter-spacing: 0; font-family: var(--body); }
.chip.folder-chip { color: #b9a3ff; border-color: rgba(138, 92, 255, .4); }
.folder-sel { appearance: none; background: none; border: 1px solid var(--line); border-radius: 8px; color: var(--muted); font-size: 11.5px; padding: 2px 8px; max-width: 130px; }
.folder-sel option { background: #0b1226; color: var(--text); }

/* calendar */
.cal-nav { display: flex; align-items: center; gap: 6px; margin-left: 12px; }
.cal-month { min-width: 150px; text-align: center; font: 600 13px/1 var(--display); letter-spacing: .15em; color: var(--text); }
.cal-body { flex: 1; display: grid; grid-template-columns: 1fr clamp(320px, 30%, 440px); grid-template-rows: minmax(0, 1fr); min-height: 0; }
.cal-day .items { flex: 1; min-height: 0; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); grid-template-rows: auto repeat(6, 1fr); gap: 4px; padding: 12px; min-height: 0; overflow: auto; }
.cal-wd { font: 600 10px/1 var(--display); letter-spacing: .2em; color: var(--muted); text-align: center; padding: 4px 0 6px; }
.cal-cell { display: flex; flex-direction: column; gap: 3px; min-height: 0; min-width: 0; overflow: hidden; text-align: left;
            padding: 6px; border-radius: 10px; border: 1px solid var(--line); background: rgba(22, 32, 62, .28); }
.cal-cell:hover { border-color: var(--line-strong); }
.cal-cell.other { opacity: .38; }
.cal-cell.today { border-color: var(--cyan); box-shadow: inset 0 0 0 1px var(--cyan), 0 0 14px rgba(52, 228, 255, .25); }
.cal-cell.selected { background: rgba(52, 228, 255, .12); border-color: var(--line-strong); }
.cal-num { font-size: 12px; font-weight: 600; color: var(--muted); }
.cal-cell.today .cal-num { color: var(--cyan); }
.cal-chip { flex: none; font-size: 11px; line-height: 1.3; padding: 2px 6px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
            border-left: 3px solid var(--medium); background: rgba(255, 255, 255, .05); }
.cal-chip.high { border-left-color: var(--high); }
.cal-chip.low { border-left-color: var(--low); }
.cal-chip.done { text-decoration: line-through; opacity: .5; }
.cal-chip.event { border-left-color: var(--cyan); background: rgba(52, 228, 255, .14); color: #d6f7ff; }
.cal-dot.event { background: var(--cyan); }
.chip.event-chip { color: var(--cyan); border-color: rgba(52, 228, 255, .45); }
.cal-chip.overdue { color: var(--high); }
.cal-more { flex: none; font-size: 11px; color: var(--muted); padding-left: 4px; }
.cal-dots { display: none; gap: 3px; flex-wrap: wrap; }
.cal-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--medium); }
.cal-dot.high { background: var(--high); } .cal-dot.low { background: var(--low); } .cal-dot.done { opacity: .35; }
.cal-day { border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.cal-day-title { padding: 14px 16px 6px; font: 600 12px/1.3 var(--display); letter-spacing: .15em; color: var(--cyan); text-transform: uppercase; }

/* the selected day: compact list on top, then a 30-minute timeline */
.day-view { padding: 0 12px 16px; }
.day-untimed { padding: 4px 0 10px; border-bottom: 1px solid var(--line); margin-bottom: 8px; max-height: 32%; overflow-y: auto; }
.day-grid.tight .ev-title { font-size: 11px; line-height: 1.1; }
.day-grid.tight .day-event { padding-top: 0; padding-bottom: 0; border-radius: 5px; }
.day-grid.tight .ev-remove { top: 0; height: 100%; max-height: 18px; }
.day-grid.tight .slot-time { top: -6px; font-size: 10px; }
.day-label { font: 600 10px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; color: var(--muted); padding: 6px 2px 8px; }
.day-none { color: var(--muted); font-size: 12.5px; padding: 0 2px 2px; opacity: .7; }
.day-row { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 8px; font-size: 13px; }
.day-row:hover { background: rgba(43, 123, 255, .08); }
.day-row.done .day-name { text-decoration: line-through; color: var(--muted); }
.day-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-check { width: 16px; height: 16px; flex: none; border-radius: 5px; border: 1.5px solid var(--muted); background: none; padding: 0;
              display: grid; place-items: center; font-size: 11px; color: #031020; }
.day-row.done .mini-check { background: var(--low); border-color: var(--low); }
.day-dot { width: 8px; height: 8px; flex: none; margin: 0 4px; border-radius: 50%; background: var(--cyan); box-shadow: 0 0 6px var(--cyan); }
.day-tag { flex: none; font-size: 10.5px; padding: 1px 7px; border-radius: 999px; border: 1px solid var(--line); color: var(--muted); }
.day-tag.high { color: var(--high); border-color: rgba(255, 93, 122, .5); }
.day-tag.event { color: var(--cyan); border-color: rgba(52, 228, 255, .4); }
.day-grid { position: relative; }
.slot-line { position: absolute; left: 44px; right: 0; border-top: 1px solid rgba(110, 160, 255, .14); }
.slot-line.half { border-top-style: dashed; border-top-color: rgba(110, 160, 255, .07); }
.slot-time { position: absolute; left: -46px; top: -7px; width: 40px; text-align: right; font-size: 10.5px; color: var(--muted); }
.day-event { position: absolute; overflow: hidden; padding: 3px 22px 3px 8px; border-radius: 7px;
             background: linear-gradient(135deg, rgba(52, 228, 255, .22), rgba(43, 123, 255, .16));
             border-left: 3px solid var(--cyan); box-shadow: 0 0 12px rgba(52, 228, 255, .12); cursor: default; }
.day-event.done { opacity: .45; }
.day-event.short { display: flex; align-items: center; padding-top: 0; padding-bottom: 0; }
.ev-inline-time { font-weight: 400; font-size: 11px; color: #a9dcef; }
.ev-title { font-size: 12.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.25; }
.ev-time { font-size: 11px; color: #a9dcef; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ev-remove { position: absolute; top: 2px; right: 3px; width: 18px; height: 18px; padding: 0; border: 0; border-radius: 5px;
             background: rgba(3, 5, 11, .45); color: var(--muted); font-size: 10px; opacity: 0; }
.day-row .ev-remove { position: static; flex: none; }
.day-event:hover .ev-remove, .day-row:hover .ev-remove { opacity: 1; }
.ev-remove:hover { color: var(--high); }
.now-line { position: absolute; left: 40px; right: 0; height: 2px; background: var(--high); box-shadow: 0 0 8px var(--high); z-index: 2; }
.now-line::before { content: ""; position: absolute; left: -4px; top: -3px; width: 8px; height: 8px; border-radius: 50%; background: var(--high); }
@media (max-width: 860px) { .ev-remove { opacity: 1; } }
@media (max-width: 860px) {
  .cal-body { grid-template-columns: 1fr; grid-template-rows: auto 1fr; }
  .cal-day { border-left: 0; border-top: 1px solid var(--line); }
  .cal-grid { grid-template-rows: auto repeat(6, 56px); }
  .cal-chip, .cal-more { display: none; }
  .cal-dots { display: flex; }
  .cal-nav { margin-left: 0; }
  .cal-month { min-width: 110px; font-size: 11px; }
}

/* outline rows: one clean line each */
.item.row { display: flex; align-items: center; gap: 12px; padding: 9px 10px; border-radius: 10px; cursor: pointer; grid-template-columns: none; }
.item.row:focus-visible { outline: 1px solid var(--line-strong); }
.item.row .check { margin: 0; flex: none; }
.item.row .check.repeat, .sheet-head .check.repeat { border: 0; cursor: default; font-size: 13px; }
.row-title { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 500; }
.item.row.done .row-title { text-decoration: line-through; color: var(--muted); }
.row-meta { flex: none; display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 12.5px; }
.row-when.today { color: var(--cyan); }
.row-when.overdue { color: var(--high); font-weight: 600; }
.row-kind { font-size: 11px; color: var(--cyan); opacity: .8; }
.row-note { font-size: 12px; opacity: .7; }
.row-high { width: 7px; height: 7px; border-radius: 50%; background: var(--high); box-shadow: 0 0 8px var(--high); }
button.group-head { width: 100%; background: none; border: 0; border-radius: 8px; cursor: pointer; text-align: left; }
button.group-head:hover { background: rgba(138, 92, 255, .08); }
.group-head .chev { display: inline-block; width: 12px; transition: transform .2s; }
.group-head.shut .chev { transform: rotate(-90deg); }
.group-head .group-name { flex: none; }
.add { grid-template-columns: 1fr auto auto; }

/* item details card */
.sheet-backdrop { position: fixed; inset: 0; z-index: 8; display: grid; place-items: center; padding: 16px;
                  background: rgba(3, 5, 11, .5); backdrop-filter: blur(3px); animation: fade .2s ease; }
@keyframes fade { from { opacity: 0; } }
.sheet { width: min(620px, 100%); max-height: min(88vh, 860px); max-height: min(88dvh, 860px); display: flex; flex-direction: column;
         background: linear-gradient(180deg, rgba(14, 22, 46, .97), rgba(8, 13, 28, .97)); border: 1px solid var(--line-strong);
         border-radius: var(--radius); box-shadow: 0 0 50px rgba(43, 123, 255, .25), 0 30px 80px rgba(0, 0, 0, .6);
         color-scheme: dark; animation: panel-pop .25s cubic-bezier(.2, .8, .2, 1); overflow: hidden; }
@keyframes panel-pop { from { opacity: 0; transform: translateY(8px) scale(.98); } }
.sheet-head { display: flex; align-items: center; gap: 10px; padding: 16px 16px 12px; border-bottom: 1px solid var(--line); }
.sheet-title { flex: 1; min-width: 0; background: none; border: 0; outline: none; font-size: 19px; font-weight: 600; color: var(--text);
               border-bottom: 1px solid transparent; padding: 2px 0; }
.sheet-title:focus { border-bottom-color: var(--line-strong); }
.sheet-saved { font-size: 12px; color: var(--low); opacity: 0; transition: opacity .3s; }
.sheet-saved.show { opacity: 1; }
.sheet-done { padding: 8px 16px 0; color: var(--low); font-size: 12.5px; }
.sheet-form { flex: 1; overflow-y: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 14px 14px; padding: 16px; }
.sheet-field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sheet-field.wide { grid-column: 1 / -1; }
.sheet-label { font: 600 10px/1 var(--display); letter-spacing: .16em; text-transform: uppercase; color: var(--muted); }
.sheet-field .field { width: 100%; }
.sheet-field .segmented { align-self: flex-start; }
.sheet-notes { min-height: 110px; resize: vertical; line-height: 1.5; }
.day-picks { display: flex; gap: 6px; flex-wrap: wrap; }
.day-picks button { width: 38px; height: 34px; border-radius: 9px; border: 1px solid var(--line); background: var(--glass-2); color: var(--muted); }
.day-picks button.on { color: var(--text); border-color: var(--line-strong); background: rgba(52, 228, 255, .14); }
.sheet-foot { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }
.sheet-dates { flex: 1; color: var(--muted); font-size: 12px; }
.chip-btn.danger:hover { color: var(--high); border-color: rgba(255, 93, 122, .5); }
@media (max-width: 700px) {
  .sheet-backdrop { padding: 0; align-items: end; }
  .sheet { width: 100%; max-height: 92vh; max-height: 92dvh; border-radius: 18px 18px 0 0; }
  .sheet-form { grid-template-columns: 1fr; }
  .sheet-foot { flex-wrap: wrap; }
}

/* about me */
.mem-intro { color: var(--muted); font-size: 13px; padding: 6px 4px 10px; }
.mem-add { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; margin-bottom: 8px; }
.mem-cat { color: var(--cyan); font: 600 11px/1 var(--display); letter-spacing: .2em; text-transform: uppercase; padding: 16px 4px 6px; }
.mem { display: flex; align-items: center; gap: 6px; padding: 8px 10px; border-radius: 10px; border: 1px solid transparent; }
.mem:hover { background: rgba(43, 123, 255, .07); border-color: var(--line); }
.mem-fact { flex: 1; }

/* conversation */
.chat { flex: 1; overflow-y: auto; padding: 16px 18px; display: flex; flex-direction: column; gap: 10px; }
.msg { max-width: 82%; padding: 10px 14px; border-radius: 14px; white-space: pre-wrap; word-wrap: break-word; }
.msg.user { align-self: flex-end; background: linear-gradient(135deg, rgba(43, 123, 255, .35), rgba(138, 92, 255, .30)); border-bottom-right-radius: 4px; }
.msg.bot { align-self: flex-start; background: var(--glass-2); border: 1px solid var(--line); border-bottom-left-radius: 4px; }
.msg.bot.error { border-color: var(--high); }
.msg .say { display: inline-block; margin-top: 4px; background: none; border: 0; color: var(--muted); font-size: 12px; padding: 0; }
.composer { display: flex; gap: 8px; padding: 12px; border-top: 1px solid var(--line); }
.composer .field { flex: 1; resize: none; height: 46px; max-height: 140px; }

/* settings */
.settings { flex: 1; overflow-y: auto; padding: 8px 20px 28px; }
.set-section { margin-top: 18px; }
.set-section h3 { margin: 0 0 8px; font: 600 11px/1 var(--display); letter-spacing: .25em; text-transform: uppercase; color: var(--cyan); }
.set-row { display: flex; align-items: center; gap: 14px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; background: rgba(22, 32, 62, .35); margin-bottom: 8px; }
.set-row .label { flex: 1; }
.set-row .label b { display: block; font-weight: 600; }
.set-row .label span { display: block; color: var(--muted); font-size: 13px; margin-top: 2px; }
.switch { width: 50px; height: 28px; border-radius: 999px; border: 1px solid var(--line); background: var(--glass-2); position: relative; flex: none; padding: 0; transition: background .25s, border-color .25s; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--muted); transition: transform .25s, background .25s; }
.switch[aria-checked="true"] { background: rgba(52, 228, 255, .2); border-color: var(--line-strong); }
.switch[aria-checked="true"]::after { transform: translateX(22px); background: var(--cyan); box-shadow: 0 0 10px var(--cyan); }
.segmented { display: flex; gap: 4px; background: var(--glass-2); border: 1px solid var(--line); border-radius: 12px; padding: 3px; flex-wrap: wrap; }
.segmented button { background: none; border: 0; border-radius: 9px; padding: 6px 12px; color: var(--muted); }
.segmented button.on { background: rgba(52, 228, 255, .14); color: var(--text); box-shadow: inset 0 0 0 1px var(--line-strong); }
.info-value { color: var(--muted); font-size: 13px; text-align: right; }

/* ---------- keep clear of the iPhone's notch, status bar and home bar ---------- */
@supports (padding: env(safe-area-inset-top)) {
  .controls { top: calc(22px + env(safe-area-inset-top)); }
  .kbd-btn { bottom: calc(26px + env(safe-area-inset-bottom)); }
  .command-bar { bottom: calc(28px + env(safe-area-inset-bottom)); }
  @media (max-width: 700px) {
    .panel { padding-top: env(safe-area-inset-top); padding-bottom: env(safe-area-inset-bottom); }
  }
}

/* ---------- phones ---------- */
@media (max-width: 700px) {
  .panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border-left: 0; border-right: 0; }
  .add { grid-template-columns: 1fr 1fr 1fr; }
  .add .field:first-child { grid-column: 1 / -1; }
  .mem-add { grid-template-columns: 1fr auto; }
  .mem-add .field:first-child { grid-column: 1 / -1; }
  .del { opacity: 1; }
  .controls { top: 16px; right: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .boot, .panel, .command-bar { animation: none; }
}

/* the task board: To Do, Doing (3 at most), Waiting, Done */
.items.board-mode { display: flex; overflow: hidden; padding-bottom: 12px; }
.board { flex: 1; min-height: 0; display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 12px; overflow-x: auto; }
.board-col { display: flex; flex-direction: column; min-height: 0; background: rgba(10, 16, 34, .45); border: 1px solid var(--line); border-radius: 14px; transition: border-color .15s, background .15s; }
.board-col.drop { border-color: var(--line-strong); background: rgba(52, 228, 255, .06); }
.board-head { display: flex; align-items: center; justify-content: space-between; padding: 13px 14px 9px; color: var(--violet); font: 600 11px/1 var(--display); letter-spacing: .18em; text-transform: uppercase; }
.col-doing .board-head { color: var(--cyan); }
.col-waiting .board-head { color: var(--medium); }
.col-done .board-head { color: var(--low); }
.board-head .count { color: var(--muted); font-family: var(--body); font-size: 12px; letter-spacing: 0; }
.board-head.full .count { color: var(--high); font-weight: 600; }
.board-cards { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; padding: 4px 10px 12px; }
.card { padding: 10px 12px; border-radius: 10px; background: var(--glass-2); border: 1px solid var(--line); border-left: 3px solid var(--blue); cursor: grab; transition: border-color .15s, transform .15s; }
.card:hover { border-color: var(--line-strong); border-left-color: inherit; }
.card:focus-visible { outline: 1px solid var(--line-strong); }
.card.prio-high { border-left-color: var(--high); }
.card.prio-low { border-left-color: rgba(142, 163, 200, .5); }
.card.dragging { opacity: .4; }
.card.done { opacity: .65; border-left-color: var(--low); }
.card.done .card-title { text-decoration: line-through; color: var(--muted); }
.card-title { font-weight: 500; line-height: 1.35; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 6px; color: var(--muted); font-size: 12px; }
.card-folder { color: var(--violet); }
.card-high { color: var(--high); font-weight: 600; }
.card-wait.late { color: var(--medium); font-weight: 600; }
.board-empty { padding: 14px 6px; color: var(--muted); font-size: 13px; text-align: center; opacity: .8; }
.board-more { padding: 8px; border: 1px dashed var(--line); border-radius: 10px; background: none; color: var(--muted); font: inherit; font-size: 13px; cursor: pointer; }
.board-more:hover { color: var(--text); border-color: var(--line-strong); }
.today-head { padding-top: 16px; }
@media (max-width: 760px) {
  .board { grid-template-columns: repeat(4, 80vw); scroll-snap-type: x mandatory; }
  .board-col { scroll-snap-align: start; }
}

/* ---- attachments, made images and sources */
.attach-btn { width: 42px; height: 42px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--glass-2); color: inherit; font-size: 18px; cursor: pointer; }
.command-bar .attach-btn { background: var(--glass-2); color: inherit; font-weight: 400; margin-left: 2px; }
.attach-btn:hover { border-color: var(--accent, #6aa8ff); }
.attach-tray { position: fixed; left: 50%; bottom: 150px; transform: translateX(-50%); z-index: 6; display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; max-width: min(92vw, 640px); }
.attach-chip { display: flex; align-items: center; gap: 8px; padding: 6px 8px 6px 6px; border-radius: 12px; background: var(--glass-2); border: 1px solid var(--line); backdrop-filter: blur(12px); font-size: 13px; max-width: 240px; }
.attach-chip img, .attach-chip .ficon { width: 40px; height: 40px; border-radius: 8px; object-fit: cover; flex: none; display: grid; place-items: center; background: rgba(255,255,255,.06); font-size: 20px; }
.attach-chip span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.attach-chip button { background: none; border: 0; color: var(--muted); font-size: 16px; cursor: pointer; padding: 0 2px; }
.attach-chip.loading { opacity: .6; }
body.dragging::after { content: "Drop to send to Nexus"; position: fixed; inset: 16px; z-index: 20; border: 2px dashed var(--accent, #6aa8ff); border-radius: 24px; display: grid; place-items: center; font-size: 22px; background: rgba(5, 10, 25, .6); pointer-events: none; }
.msg .msg-files { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 6px; }
.msg .msg-files img { width: 96px; height: 96px; object-fit: cover; border-radius: 10px; }
.msg .msg-files .fname { padding: 6px 10px; border-radius: 10px; background: rgba(255,255,255,.08); font-size: 13px; }
.msg .made-img { display: block; margin-top: 8px; }
.msg .made-img img { display: block; max-width: 100%; max-height: 420px; border-radius: 12px; }
.msg .made-img a { font-size: 12px; color: var(--muted); }
.msg .sources { margin-top: 8px; font-size: 12px; color: var(--muted); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.msg .sources a { color: var(--muted); text-decoration: underline; }
.composer { align-items: center; }
@media (max-width: 640px) { .attach-tray { bottom: calc(150px + env(safe-area-inset-bottom)); } }

/* ---- family accounts */
.set-row.custom-row { flex-wrap: wrap; }
.qr-box { display: flex; flex-direction: column; align-items: center; gap: 10px; }
.qr-code { padding: 12px; background: #fff; border-radius: 12px; line-height: 0; min-width: 220px; min-height: 220px; display: grid; place-items: center; color: #03050b; font-size: 13px; }
.qr-code img, .qr-code canvas { display: block; }
.qr-actions, .acct-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.chip-btn.danger { color: var(--high); }

/* ---------- phones: an app-style tab bar along the bottom ---------- */
.phone-only { display: none; }
@media (max-width: 700px) {
  :root { --dock: calc(60px + env(safe-area-inset-bottom)); }
  .controls, body.panel-open .controls {
    top: auto !important; right: 0 !important; left: 0; bottom: 0; transform: none; opacity: 1 !important; pointer-events: auto !important;
    justify-content: space-around; gap: 0; z-index: 7; height: var(--dock);
    padding: 4px 2px env(safe-area-inset-bottom); align-items: stretch;
    background: rgba(4, 8, 19, .92); backdrop-filter: blur(18px) saturate(1.3); border-top: 1px solid var(--line);
  }
  .controls .hud-btn { flex: 1; width: auto; height: 56px; border: 0; border-radius: 12px; background: none; box-shadow: none;
    backdrop-filter: none; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 4px;
    color: var(--muted); -webkit-tap-highlight-color: transparent; }
  .controls .hud-btn::after { content: attr(data-label); font: 500 10.5px/1 var(--body); letter-spacing: .02em; }
  .controls .hud-btn svg { width: 23px; height: 23px; }
  .controls .hud-btn:hover { box-shadow: none; }
  .controls .phone-only { display: flex; }
  body:not([data-panel]) .controls [data-home],
  body[data-panel="calendar"] .controls [data-open="calendar"], body[data-panel="notes"] .controls [data-open="notes"],
  body[data-panel="conversation"] .controls [data-open="conversation"], body[data-panel="whoami"] .controls [data-open="whoami"],
  body[data-panel="settings"] .controls [data-open="settings"] { color: var(--cyan); text-shadow: 0 0 10px rgba(52, 228, 255, .5); }
  body:not([data-panel]) .controls [data-home] svg, body[data-panel] .controls [data-open].hud-btn svg { transition: filter .2s; }
  body[data-panel="calendar"] .controls [data-open="calendar"] svg, body[data-panel="notes"] .controls [data-open="notes"] svg,
  body[data-panel="conversation"] .controls [data-open="conversation"] svg, body[data-panel="whoami"] .controls [data-open="whoami"] svg,
  body[data-panel="settings"] .controls [data-open="settings"] svg, body:not([data-panel]) .controls [data-home] svg { filter: drop-shadow(0 0 6px rgba(52, 228, 255, .7)); }
  .kbd-btn { display: none; }
  .hud-frame { bottom: calc(var(--dock) + 8px); }
  /* screens fill the phone above the tab bar */
  .panel { left: 0; top: 0; transform: none; width: 100vw; height: calc(100dvh - var(--dock)); border-radius: 0; border: 0;
           padding-bottom: 0 !important; animation: panel-fade .25s ease-out; }
  .panel-head .close { display: none; } /* the tab bar's Home button closes screens */
  .command-bar { bottom: calc(var(--dock) + 14px) !important; }
  .attach-tray { bottom: calc(var(--dock) + 80px) !important; }
  .sheet { padding-bottom: env(safe-area-inset-bottom); }
}
@keyframes panel-fade { from { opacity: 0; } to { opacity: 1; } }

/* "Add to Home Screen" tip */
.install-tip { position: fixed; left: 12px; right: 12px; bottom: calc(var(--dock, 0px) + 12px); z-index: 8; display: flex; align-items: center; gap: 12px;
  padding: 12px 12px 12px 14px; border-radius: 16px; background: rgba(9, 15, 32, .96); border: 1px solid var(--line-strong);
  box-shadow: 0 10px 40px rgba(0, 0, 0, .5), 0 0 30px rgba(43, 123, 255, .2); animation: panel-fade .3s ease-out; }
.install-tip img { width: 44px; height: 44px; border-radius: 11px; flex: none; }
.install-text { flex: 1; min-width: 0; font-size: 13px; color: var(--muted); }
.install-text b { display: block; color: var(--text); font-size: 14px; margin-bottom: 2px; }
.install-tip .accent-btn { padding: 8px 14px; flex: none; }
.install-x { background: none; border: 0; color: var(--muted); font-size: 18px; padding: 4px 6px; flex: none; }
@media (max-width: 700px) {
  /* settings rows with several choices (or a QR code): the choices go under the words */
  .set-row:has(.segmented), .set-row.custom-row { flex-wrap: wrap; }
  .set-row:has(.segmented) .label, .set-row.custom-row .label { flex-basis: 100%; }
  .set-row .segmented { width: 100%; justify-content: space-between; }
  .set-row .segmented button { flex: 1; }
  .set-row.custom-row > :last-child { margin: 0 auto; }
  .settings { padding: 4px 14px 24px; }
}
@media (max-width: 700px) {
  /* screens are solid on phones, so nothing shows through behind them */
  .panel { background: #060a17; backdrop-filter: none; }
  body.panel-open .hud-frame { display: none; }
}

/* phones: "Tap to start" screen when the app opens */
.tap-start { position: fixed; inset: 0; z-index: 10; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 18px;
  background: radial-gradient(circle at 50% 45%, rgba(43, 123, 255, .16), transparent 60%), #03050b; cursor: pointer; animation: panel-fade .4s ease-out; }
.tap-start img { width: 132px; height: 132px; filter: drop-shadow(0 0 26px rgba(52, 228, 255, .55)); animation: tap-breathe 3.2s ease-in-out infinite; }
.tap-start b { font: 700 26px/1 var(--display); letter-spacing: .5em; padding-left: .5em;
  background: var(--nexus-gradient); -webkit-background-clip: text; background-clip: text; color: transparent; }
.tap-start span { color: var(--muted); font-size: 15px; letter-spacing: .08em; animation: tap-blink 2.4s ease-in-out infinite; }
@keyframes tap-breathe { 50% { transform: scale(1.06); filter: drop-shadow(0 0 40px rgba(52, 228, 255, .8)); } }
@keyframes tap-blink { 50% { opacity: .45; } }
