/* Notes2 — quiet clinic desk. Ivory, slate, clay spare. */
:root {
  --ivory: #FAF9F5;
  --ivory-2: #F3F1EA;
  --paper: #FFFEFB;
  --slate: #141413;
  --slate-soft: #3D3C38;
  --muted: #6F6E69;
  --line: rgba(20, 20, 19, 0.12);
  --line-strong: rgba(20, 20, 19, 0.22);
  --clay: #D97757;
  --clay-soft: #F3D8CD;
  --clay-ink: #8A3E28;
  --ok: #3D5A45;
  --shadow: 0 1px 0 rgba(20, 20, 19, 0.04), 0 10px 28px rgba(20, 20, 19, 0.05);
  --radius: 12px;
  --display: "Newsreader", "Iowan Old Style", "Palatino Linotype", serif;
  --ui: "IBM Plex Sans", "Helvetica Neue", system-ui, sans-serif;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bot: env(safe-area-inset-bottom, 0px);
}

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
html { font-size: 16px; }
body {
  font-family: var(--ui);
  background: var(--ivory);
  color: var(--slate);
  min-height: 100dvh;
  line-height: 1.5;
  letter-spacing: -0.011em;
}
button, input, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: var(--clay-ink); }
a:hover { color: var(--slate); }
:focus-visible { outline: 2px solid var(--clay); outline-offset: 2px; }

[hidden] { display: none !important; }

.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}

.skip {
  position: absolute; left: 16px; top: -48px; z-index: 80;
  background: var(--paper); color: var(--slate);
  padding: 8px 12px; border-radius: 6px;
  font-weight: 500; font-size: 0.875rem;
  border: 1px solid var(--line-strong);
}
.skip:focus { top: 16px; }

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: calc(0.85rem + var(--safe-top)) 1.5rem 0.85rem;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--ivory) 92%, transparent);
  backdrop-filter: blur(8px);
  position: sticky;
  top: 0;
  z-index: 20;
}
.brand { display: flex; align-items: center; gap: 0.7rem; min-width: 0; }
.mark { flex: none; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--display);
  font-size: 1.35rem;
  font-weight: 500;
  letter-spacing: -0.03em;
}
.brand-text em {
  font-style: normal;
  font-size: 0.7rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.banner {
  margin: 0;
  font-size: 0.82rem;
  color: var(--clay-ink);
  background: var(--clay-soft);
  border: 1px solid color-mix(in srgb, var(--clay) 35%, transparent);
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  white-space: nowrap;
}

.desk {
  display: grid;
  grid-template-columns: minmax(240px, 280px) minmax(0, 1fr) minmax(240px, 300px);
  gap: 1.25rem;
  align-items: start;
  padding: 1.25rem 1.5rem 2.5rem;
  max-width: 1280px;
  margin: 0 auto;
}

.col { display: flex; flex-direction: column; gap: 1rem; min-width: 0; }

.clock-card,
.cal-card,
.notes-card,
.todo-card,
.bm-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.clock-card { padding: 1.15rem 1.2rem 1.05rem; }
.kicker {
  margin: 0 0 0.2rem;
  font-size: 0.68rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 500;
}
.clock-time {
  margin: 0;
  font-variant-numeric: tabular-nums;
  font-size: 2.05rem;
  font-weight: 500;
  letter-spacing: -0.04em;
  line-height: 1.1;
  color: var(--slate);
}
.clock-date {
  margin: 0.35rem 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.cal-card { padding: 1rem 1rem 0.9rem; }
.cal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
  margin-bottom: 0.7rem;
}
.cal-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.1rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.cal-nav {
  width: 32px; height: 32px;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 1.2rem;
  line-height: 1;
  color: var(--slate-soft);
}
.cal-nav:hover { background: var(--ivory-2); }
.cal-weekdays,
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.cal-weekdays span {
  text-align: center;
  font-size: 0.68rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 0.15rem 0 0.4rem;
  font-weight: 500;
}
.cal-grid button {
  aspect-ratio: 1;
  border-radius: 8px;
  font-size: 0.86rem;
  font-variant-numeric: tabular-nums;
  color: var(--slate);
}
.cal-grid button:hover:not(:disabled) { background: var(--ivory-2); }
.cal-grid button:disabled { color: var(--muted); opacity: 0.38; cursor: default; }
.cal-grid button.is-today { box-shadow: inset 0 0 0 1px var(--line-strong); }
.cal-grid button.is-selected {
  background: var(--clay);
  color: #fff;
  font-weight: 600;
}
.cal-grid button.is-selected.is-today { box-shadow: none; }
.cal-grid button.has-ink::after {
  content: "";
  display: block;
  width: 4px; height: 4px;
  margin: 1px auto 0;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
}
.cal-today {
  display: block;
  width: 100%;
  margin-top: 0.55rem;
}

.notes-card { padding: 1.15rem 1.25rem 1rem; }
.notes-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.8rem;
  margin-bottom: 0.7rem;
}
.day-title {
  margin: 0;
  font-family: var(--display);
  font-size: 1.7rem;
  font-weight: 500;
  letter-spacing: -0.03em;
  line-height: 1.15;
}
.notes-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.save-pill {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ok);
  font-weight: 500;
}
.save-pill.is-saving { color: var(--muted); }
.save-pill.is-error { color: var(--clay-ink); }

.note-body {
  width: 100%;
  min-height: 22rem;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--ivory);
  padding: 0.95rem 1.05rem;
  font-family: var(--display);
  font-size: 1.12rem;
  line-height: 1.55;
  letter-spacing: -0.01em;
}
.note-body:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--clay) 55%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 18%, transparent);
}
.interim {
  margin: 0.4rem 0 0;
  font-family: var(--display);
  font-style: italic;
  color: var(--muted);
  font-size: 0.98rem;
}
.dictate-fallback {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  color: var(--muted);
}
.meta-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin: 0.5rem 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.dot { opacity: 0.5; }

.todo-card { padding: 1.1rem 1.2rem 1rem; }
.todo-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.65rem;
}
.todo-head h2, .bm-head h2, .bm-form h3 {
  margin: 0;
  font-family: var(--display);
  font-size: 1.2rem;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.muted { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.8rem; }
.rolled {
  font-size: 0.72rem;
  color: var(--clay-ink);
  background: var(--clay-soft);
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  white-space: nowrap;
}
.todo-list, .bm-list { list-style: none; margin: 0; padding: 0; }
.todo-item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 0.55rem;
  align-items: flex-start;
  padding: 0.45rem 0;
  border-bottom: 1px solid var(--line);
}
.todo-item:last-child { border-bottom: 0; }
.todo-item input[type="checkbox"] {
  margin-top: 0.28rem;
  width: 1.05rem; height: 1.05rem;
  accent-color: var(--clay);
}
.todo-item.is-done span { color: var(--muted); text-decoration: line-through; }
.todo-empty { margin: 0.2rem 0 0.6rem; color: var(--muted); font-size: 0.88rem; }
.todo-add, .bm-form { display: flex; flex-direction: column; gap: 0.45rem; margin-top: 0.55rem; }
.todo-add { flex-direction: row; }
.todo-add input, .bm-form input, .cal-today {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--ivory);
  padding: 0.5rem 0.7rem;
}
.todo-add input { flex: 1; min-width: 0; }
.todo-add input:focus, .bm-form input:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--clay) 55%, var(--line-strong));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 18%, transparent);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  font-size: 0.86rem;
  font-weight: 500;
  border: 1px solid transparent;
  white-space: nowrap;
}
.btn-slate { background: var(--slate); color: var(--ivory); }
.btn-slate:hover { background: #2a2926; }
.btn-clay { background: var(--clay); color: #fff; }
.btn-clay:hover { filter: brightness(0.96); }
.btn-clay.is-live {
  background: var(--slate);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--clay) 35%, transparent);
}
.btn-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--slate-soft);
}
.btn-ghost:hover { background: var(--ivory-2); }
.btn-icon {
  width: 28px; height: 28px;
  padding: 0;
  border-radius: 6px;
  color: var(--muted);
  font-size: 1rem;
  line-height: 1;
}
.btn-icon:hover { background: var(--ivory-2); color: var(--slate); }

.mic {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: currentColor;
  display: inline-block;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 22%, transparent);
}
.btn-clay.is-live .mic { animation: pulse 1.1s ease-in-out infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

.bm-card { padding: 1.1rem 1.15rem 1.05rem; }
.bm-head { margin-bottom: 0.7rem; }
.bm-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 0.35rem 0.4rem;
  padding: 0.55rem 0;
  border-bottom: 1px solid var(--line);
}
.bm-item:last-child { border-bottom: 0; }
.bm-link {
  color: var(--slate);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.92rem;
  min-width: 0;
}
.bm-link:hover { color: var(--clay-ink); text-decoration: underline; }
.bm-host {
  grid-column: 1;
  font-size: 0.72rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.bm-actions { grid-column: 2; grid-row: 1 / span 2; display: flex; gap: 0.1rem; align-items: start; }
.bm-form h3 { font-size: 0.95rem; margin-top: 0.4rem; }
.row { display: flex; gap: 0.4rem; }

.foot {
  text-align: center;
  padding: 0.4rem 1.5rem calc(1.4rem + var(--safe-bot));
  color: var(--muted);
  font-size: 0.75rem;
}

@media (max-width: 980px) {
  .desk {
    grid-template-columns: 1fr;
    padding: 1rem 1rem 2rem;
  }
  .col-right { order: 3; }
  .col-centre { order: 2; }
  .col-left { order: 1; display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
  .note-body { min-height: 16rem; }
}
@media (max-width: 640px) {
  .top { flex-wrap: wrap; padding-inline: 1rem; }
  .banner { white-space: normal; }
  .col-left { grid-template-columns: 1fr; }
  .clock-time { font-size: 1.7rem; }
  .day-title { font-size: 1.4rem; }
  .todo-add { flex-direction: column; }
}
