/* bell v0.1 — same look as pen (vox terminal layer: slate + accent, monospace). */

:root {
  --bg:          #0e1513;
  --bg-elev:     #131c19;
  --bg-hover:    #1b2622;
  --ink:         #d3dcd7;
  --ink-soft:    #7d8b85;
  --rule:        #23302b;
  --accent:      #7ad39a;
  --amber:       #d9a75a;
  --red:         #d97a7a;
  --sb-height:   1.9rem;
  --sidebar-w:   15rem;
  --topbar-h:    2.4rem;
  --faint:      #4a5159;
  --mono: ui-monospace, "JetBrains Mono", SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
}

/* Accent options: the same five as pen (from the re-chat palette). */
body[data-accent="green"]   { --accent: oklch(0.78 0.18 145); }
body[data-accent="lime"]    { --accent: oklch(0.83 0.17 110); }
body[data-accent="azure"]   { --accent: oklch(0.76 0.14 250); }
body[data-accent="magenta"] { --accent: oklch(0.74 0.20 350); }
body[data-accent="coral"]   { --accent: oklch(0.75 0.16 35); }
.sw-green   { color: oklch(0.78 0.18 145); }
.sw-lime    { color: oklch(0.83 0.17 110); }
.sw-azure   { color: oklch(0.76 0.14 250); }
.sw-magenta { color: oklch(0.74 0.20 350); }
.sw-coral   { color: oklch(0.75 0.16 35); }

/* Light theme: vox's light palette (vox/app/src/public/style.css [data-theme="light"]). */
[data-theme="light"] {
  --bg:       #f4f5f7;
  --bg-elev:  #ffffff;
  --bg-hover: #eceef2;
  --ink:      #11141a;
  --ink-soft: #5f6770;
  --rule:     #d8dce2;
  --faint:    #9aa1aa;
  --amber:    oklch(0.62 0.15 75);
  --red:      oklch(0.55 0.20 25);
}
[data-theme="light"] body[data-accent="green"]   { --accent: oklch(0.55 0.18 145); }
[data-theme="light"] body[data-accent="lime"]    { --accent: oklch(0.60 0.17 115); }
[data-theme="light"] body[data-accent="azure"]   { --accent: oklch(0.52 0.15 250); }
[data-theme="light"] body[data-accent="magenta"] { --accent: oklch(0.55 0.20 350); }
[data-theme="light"] body[data-accent="coral"]   { --accent: oklch(0.58 0.16 35); }
[data-theme="light"] .popover { box-shadow: 0 6px 16px rgba(0,0,0,0.12); }

.accent-dot    { color: var(--accent); }
.accent-swatch { display: inline-block; margin-right: 0.4em; }

*, *::before, *::after { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

button, input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
  background: transparent;
  border: 0;
  padding: 0;
  margin: 0;
  outline: none;
}
button { cursor: pointer; }
button:focus-visible, input:focus-visible, select:focus-visible { outline: 1px dashed var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.dim { color: var(--ink-soft); font-style: normal; }

/* ---------- app grid ---------- */

.app {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  grid-template-rows: 1fr var(--sb-height);
  grid-template-areas: "sidebar main" "status status";
  height: 100dvh;
  overflow: hidden;
}
.sidebar   { grid-area: sidebar; }
.main      { grid-area: main; }
.statusbar { grid-area: status; }

/* ---------- sidebar ---------- */

.sidebar {
  background: var(--bg-elev);
  border-right: 1px solid var(--rule);
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
  position: relative;
}

.sidebar-handle {
  position: absolute; top: 0; right: 0;
  width: 10px; height: 100%;
  cursor: col-resize; z-index: 20;
}
.sidebar-handle::before {
  content: ""; position: absolute; top: 50%; right: 2px; transform: translateY(-50%);
  width: 4px; height: 32px; border-radius: 4px; background: var(--rule);
  transition: background 120ms ease, height 120ms ease;
}
.sidebar-handle:hover::before    { background: var(--accent); height: 44px; }
.sidebar-handle.dragging::before { background: var(--accent); height: 60px; }

.sidebar-head { padding: 0.75rem 0.9rem 0.5rem; border-bottom: 1px solid var(--rule); }
.brand { color: var(--accent); font-weight: 600; letter-spacing: 0.02em; }
.brand-name { color: var(--ink); }
.brand-ver { color: var(--ink-soft); font-weight: 400; font-size: 0.82em; }

.sidebar-actions { display: flex; gap: 0.4rem; padding: 0.5rem 0.6rem; border-bottom: 1px solid var(--rule); }

.sb-btn {
  color: var(--ink-soft);
  padding: 0.25rem 0.5rem;
  border-radius: 3px;
  transition: color 120ms, background 120ms;
  white-space: nowrap;
}
.sb-btn:hover  { color: var(--ink); background: var(--bg-hover); }
.sb-btn:active { color: var(--accent); }
.sb-btn:disabled { color: var(--rule); cursor: not-allowed; background: transparent; }

.note-list {
  flex: 1;
  overflow-y: auto;
  padding: 0.4rem 0.3rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.note-item {
  display: block; width: 100%; text-align: left;
  padding: 0.4rem 0.6rem;
  color: var(--ink-soft);
  border-left: 2px solid transparent;
  border-radius: 2px;
  cursor: pointer;
  transition: color 120ms, background 120ms, border-color 120ms;
}
.note-item:hover { color: var(--ink); background: var(--bg-hover); }
.note-item.active { color: var(--ink); background: var(--bg-hover); border-left-color: var(--accent); }
.note-item:disabled { cursor: not-allowed; opacity: 0.5; }
.note-item:disabled:hover { background: transparent; color: var(--ink-soft); }
.note-item-row { display: flex; align-items: center; gap: 0.4rem; min-width: 0; }
.note-item-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.note-item-badge { flex-shrink: 0; font-size: 0.72em; color: var(--ink-soft); padding: 0.05rem 0.3rem; border-radius: 2px; }
.note-item.active .note-item-badge { color: var(--accent); }
.note-item-meta { display: block; font-size: 0.78em; color: var(--ink-soft); margin-top: 1px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item.running .note-item-badge::after { content: " ●"; color: var(--accent); }

.sidebar-stats {
  border-top: 1px solid var(--rule);
  padding: 0.55rem 0.9rem 0.65rem;
  font-size: 0.8rem;
  color: var(--ink-soft);
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 0.1rem 0.8rem;
}
.sidebar-stats b { color: var(--ink); font-weight: 500; text-align: right; }

/* ---------- main ---------- */

.main { display: flex; flex-direction: column; background: var(--bg); min-width: 0; overflow: hidden; }

.topbar {
  height: var(--topbar-h);
  border-bottom: 1px solid var(--rule);
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 0.6rem 0 1rem;
  flex-shrink: 0;
}
.note-title { flex: 1; min-width: 4rem; color: var(--ink); font-weight: 500; }
.note-title::placeholder { color: var(--ink-soft); }
.note-title:disabled { color: var(--ink); }

.modes { display: flex; gap: 0.15rem; flex-shrink: 0; }
.mode-btn {
  color: var(--ink-soft);
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  border: 1px solid transparent;
  transition: color 100ms, background 100ms, border-color 100ms;
}
.mode-btn:hover { color: var(--ink); background: var(--bg-hover); }
.mode-btn.active { color: var(--accent); border-color: var(--rule); background: var(--bg-elev); }
.mode-btn:disabled { cursor: not-allowed; }
.mode-btn:disabled:not(.active) { color: var(--rule); background: transparent; }
.del-btn.armed { color: var(--red); }

.sheet {
  flex: 1;
  overflow-y: auto;
  display: flex;
  justify-content: center;
  padding: 1.75rem 1.5rem 2rem;
  scrollbar-width: thin;
  scrollbar-color: var(--rule) transparent;
}
.stage { width: 100%; max-width: 34rem; display: flex; flex-direction: column; align-items: center; }

/* ---------- dial ---------- */

.dial { position: relative; width: min(19rem, 78vw); aspect-ratio: 1; }
.ring { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-track { fill: none; stroke: var(--rule); stroke-width: 3; }
.ring-arc {
  fill: none; stroke: var(--accent); stroke-width: 3; stroke-linecap: round;
  transition: stroke-dashoffset 300ms linear;
}
.ring-mark { fill: var(--ink-soft); }
.ring-mark.passed { fill: var(--accent); }
.dial[data-phase="break"] .ring-arc,
.dial[data-phase="prep"] .ring-arc { stroke: var(--amber); }

.dial-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; padding: 0 2.5rem;
}
.phase { color: var(--ink-soft); font-size: 0.8rem; letter-spacing: 0.12em; text-transform: uppercase; }
.dial[data-status="running"] .phase { color: var(--accent); }
.dial[data-phase="break"] .phase, .dial[data-phase="prep"] .phase { color: var(--amber); }
.clock {
  font-size: clamp(2.6rem, 11vw, 3.6rem);
  font-weight: 300;
  letter-spacing: 0.02em;
  line-height: 1.15;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
}
.dial[data-status="paused"] .clock { color: var(--ink-soft); }
.phase-sub { color: var(--ink-soft); font-size: 0.8rem; min-height: 1.3em; }

.controls { display: flex; gap: 0.6rem; margin-top: 1.25rem; }
.ctl {
  color: var(--ink-soft);
  padding: 0.4rem 0.9rem;
  border: 1px solid var(--rule);
  border-radius: 3px;
  transition: color 100ms, background 100ms, border-color 100ms;
}
.ctl:hover { color: var(--ink); background: var(--bg-hover); }
.ctl-primary { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 45%, var(--rule)); }
.ctl-primary:hover { color: var(--accent); background: color-mix(in oklab, var(--accent) 10%, transparent); }
.hint { color: var(--faint); font-size: 0.75rem; margin-top: 0.5rem; }

/* ---------- settings ---------- */

.settings { width: 100%; margin-top: 1.75rem; }
.fs { border: 0; margin: 0; padding: 0; min-width: 0; }
.fs-title {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.6rem 0 0.3rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.3rem;
}
.row {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.3rem 0.1rem;
  color: var(--ink-soft);
}
.row > span:last-child { color: var(--ink); text-align: right; white-space: nowrap; }
.row input[type="number"] {
  width: 5ch;
  text-align: right;
  border-bottom: 1px solid var(--rule);
  color: var(--ink);
  -moz-appearance: textfield;
}
.row input[type="number"]::-webkit-inner-spin-button,
.row input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.row input[type="number"]:focus { border-bottom-color: var(--accent); }
.row select {
  color: var(--ink);
  border-bottom: 1px solid var(--rule);
  padding: 0 0.1rem;
  max-width: 13rem;
  cursor: pointer;
}
.row select:focus { border-bottom-color: var(--accent); }
.row option { background: var(--bg-elev); color: var(--ink); }
.row input[type="checkbox"] { accent-color: var(--accent); width: 1rem; height: 1rem; cursor: pointer; }
.row input[type="range"] { accent-color: var(--accent); width: 9rem; vertical-align: middle; cursor: pointer; }
.vol { display: inline-flex; align-items: center; gap: 0.5rem; }
.fs:disabled .row > span:last-child { color: var(--ink-soft); }
.fs:disabled select, .fs:disabled input { cursor: not-allowed; }
.lock-note { font-size: 0.78rem; margin-top: 0.6rem; text-align: center; }
#fsCommon { margin-top: 0.4rem; border-top: 1px solid var(--rule); padding-top: 0.3rem; }

/* ---------- status bar ---------- */

.statusbar {
  background: var(--bg-elev);
  border-top: 1px solid var(--rule);
  display: flex; align-items: center; gap: 1rem;
  padding: 0 0.75rem;
  font-size: 0.82rem;
  overflow: hidden;
  color: var(--ink-soft);
}
.sb-left, .sb-right { display: flex; gap: 0.6rem; align-items: center; flex-shrink: 0; }
.sb-mid { flex: 1; text-align: center; min-width: 0; overflow: hidden; }
.sb-right { margin-left: auto; }
.chip { color: var(--ink-soft); white-space: nowrap; }
.chip-btn { padding: 0.1rem 0.4rem; border-radius: 3px; transition: color 100ms, background 100ms; }
.chip-btn:hover  { color: var(--ink); background: var(--bg-hover); }
.chip-btn:active { color: var(--accent); }
#chipSave[data-state="dirty"] { color: var(--amber); }
#chipSave[data-state="saved"] { color: var(--accent); }
#chipSave[data-state="error"] { color: var(--red); }

/* ---------- popovers ---------- */

.popover {
  position: fixed;
  bottom: calc(var(--sb-height) + 0.35rem);
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.35rem;
  font-size: 0.82rem;
  color: var(--ink);
  z-index: 50;
  min-width: 12rem;
  max-width: calc(100vw - 1rem);
  max-height: calc(100dvh - var(--sb-height) - 1.5rem);
  overflow-y: auto;
  box-shadow: 0 6px 16px rgba(0,0,0,0.35);
}
.pop-wide { width: 22rem; }
.pop-title {
  color: var(--ink-soft);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  padding: 0.15rem 0.5rem 0.35rem;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 0.35rem;
}
.pop-title-gap { margin-top: 0.5rem; }
.pop-item {
  display: block; width: 100%; text-align: left;
  padding: 0.35rem 0.55rem;
  color: var(--ink-soft);
  border-radius: 3px;
  transition: color 100ms, background 100ms;
  white-space: nowrap;
}
.pop-item:hover  { color: var(--ink); background: var(--bg-hover); }
.pop-item:active { color: var(--accent); }
.pop-row { display: flex; align-items: center; gap: 0.6rem; padding: 0.3rem 0.55rem; }
.pop-label { color: var(--ink); flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pop-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.pop-state { color: var(--ink-soft); font-size: 0.78em; white-space: nowrap; }
.pop-state-on    { color: var(--accent); }
.pop-state-error { color: var(--red); }
.pop-action {
  color: var(--ink-soft);
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  transition: color 100ms, background 100ms;
  white-space: nowrap;
}
.pop-action:hover    { color: var(--ink); background: var(--bg-hover); }
.pop-action:disabled { color: var(--rule); cursor: not-allowed; }
.pop-action.armed    { color: var(--red); }
.pop-action.playing  { color: var(--accent); }
.pop-sep { height: 1px; background: var(--rule); margin: 0.3rem 0.2rem; }
.pop-note {
  color: var(--ink-soft);
  font-size: 0.75rem;
  padding: 0.4rem 0.55rem 0.2rem;
  border-top: 1px solid var(--rule);
  margin-top: 0.3rem;
  line-height: 1.45;
  white-space: normal;
  max-width: 22rem;
}
.pop-msg { color: var(--amber); font-size: 0.75rem; padding: 0.2rem 0.55rem; white-space: normal; }
.pop-msg.ok { color: var(--accent); }
.chime-desc { display: block; color: var(--ink-soft); font-size: 0.72rem; }

.log-summary { display: grid; grid-template-columns: repeat(4, 1fr); gap: 0.3rem; text-align: center; }
.log-summary div { color: var(--ink-soft); font-size: 0.72rem; }
.log-summary b { display: block; color: var(--ink); font-size: 0.9rem; font-weight: 500; }
.log-list { max-height: 16rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: var(--rule) transparent; }
.log-item { display: grid; grid-template-columns: 6.6rem 1fr auto; gap: 0.6rem; padding: 0.2rem 0.55rem; color: var(--ink-soft); }
.log-item .log-name { color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item .log-ok { color: var(--accent); }
.log-empty { padding: 0.4rem 0.55rem; color: var(--ink-soft); }

/* ---------- vox touches ---------- */

.nav-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--faint);
  padding: 0.8rem 0.9rem 0.2rem;
  margin: 0;
}
.note-item { position: relative; padding-left: 1.4rem; }
.note-item .note-item-title::before { content: "›"; position: absolute; left: 0.55rem; color: var(--accent); opacity: 0; transition: opacity 100ms; }
.note-item:hover .note-item-title::before,
.note-item.active .note-item-title::before { opacity: 1; }

.crumb { color: var(--ink-soft); margin-right: -0.7rem; flex-shrink: 0; }

/* Card with ASCII corner brackets (vox .card). */
.card {
  position: relative;
  background: var(--bg-elev);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: 0.8rem 1.1rem 1rem;
  transition: border-color 0.15s;
}
.card::before, .card::after {
  content: ""; position: absolute; width: 8px; height: 8px;
  border: 1px solid var(--faint); pointer-events: none;
  transition: border-color 0.15s;
}
.card::before { top: -1px; left: -1px; border-right: 0; border-bottom: 0; }
.card::after  { bottom: -1px; right: -1px; border-left: 0; border-top: 0; }
.card:hover::before, .card:hover::after { border-color: var(--accent); }
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 0.75rem; }
.card-title { font-weight: 600; color: var(--ink); }
.card-meta { color: var(--ink-soft); font-size: 0.78rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Status dot (vox statusbar .seg/.dot). */
.seg { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; }
.seg b, .chip b { color: var(--ink); font-weight: 500; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--faint); }
.dot.on    { background: var(--accent); box-shadow: 0 0 6px var(--accent); }
.dot.amber { background: var(--amber);  box-shadow: 0 0 6px var(--amber); }
.dot.blink { animation: blink 1.6s steps(2, end) infinite; }
@keyframes blink { 50% { opacity: 0.25; } }
.brand { animation: none; }
.brand .blip { animation: blink 1.6s steps(2, end) infinite; }

/* ---------- responsive ---------- */

@media (max-width: 720px) {
  :root { --sidebar-w: 100%; }
  .app {
    grid-template-columns: 1fr;
    grid-template-rows: auto 1fr var(--sb-height);
    grid-template-areas: "sidebar" "main" "status";
  }
  .sidebar { max-height: 30vh; border-right: 0; border-bottom: 1px solid var(--rule); }
  .sidebar-handle { display: none; }
  .sidebar-stats { display: none; }
  .topbar { height: auto; flex-wrap: wrap; padding: 0.4rem 0.6rem 0.4rem 1rem; gap: 0.4rem 0.75rem; }
  .sheet { padding: 1.25rem 1rem 1.5rem; }
  .statusbar { overflow-x: auto; scrollbar-width: none; gap: 0.6rem; }
  .statusbar::-webkit-scrollbar { display: none; }
  .sb-mid { display: none; }
  .popover { left: 0.5rem !important; right: 0.5rem !important; width: auto; min-width: 0; }
  .row select { max-width: 10rem; }
}
