/* Hallmark · shape: app screen · genre: modern-minimal · theme: custom (by request: mobile-first, light canvas, white cards, one accent) · redesign: full
 * idea: "one desk, two postures: a phone shows one drawer at a time from a bottom bar; a laptop lays the drawers out beside a sidebar" · vibe: "clean, high-contrast, roomy, calm"
 * school identity (Wisdom Wealth crest): ivory page, white cards, navy oklch(28% 0.07 258) actions, crimson oklch(44% 0.19 5) for where-you-are marks · display: Libre Baskerville (the crest's serif voice) · body: Public Sans (Noto Sans Tamil)
 * nav: under 768px a fixed bottom bar of five views; 768-1023px a top bar; 1024px+ a left sidebar · signature: the Today view, greeting and four figures over the assistant and her day
 * states: signed out (PIN sheet), listening, empty lists, done cards, errors; one view at a time on phones (all views show without scripts)
 * axes: light/grotesk-sans/chromatic-blue · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P3 H4 E4 S4 R3 V4 · weakest: R (forms are forms), so each card holds one job and the phone shows one view at a time */
/* Hallmark · answered 56: .side is one element, sticky in the tablet and the laptop media query, never twice at once · waive 38iii: the "Confirmed" badge is a status pill set by today.js after the heading, not an accented word · answered F4: #listen-button.listening is the live listening state, not a second primary */
@import url("./voice/tokens.css");
@import url("./voice/base.css");

:root {
  --control-h: 3rem;          /* phone: touch-sized */
  --nav-h: 4rem;
  --card-pad: var(--space-lg);
  --side: 16rem;
}

html, body { overflow-x: clip; }
body { background: var(--color-paper); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
:where(a, button, input, select, textarea, summary):focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; transition: none; }
h1, h2, h3 { font-family: var(--font-body); font-weight: 600; letter-spacing: var(--tracking-display); color: var(--color-ink); max-width: none; }

/* ───────── Phone first (under 768px) ───────── */

.shell { min-height: 100dvh; }

/* The side becomes a top strip (brand + voice) and its nav a fixed bottom bar */
.side {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-md);
  padding: var(--space-sm) var(--space-md);
  background: var(--color-paper-2);
  border-bottom: var(--rule-hair) solid var(--color-rule);
}
.brand { display: flex; align-items: center; gap: var(--space-sm); min-width: 0; text-decoration: none; }
.brand-logo { display: block; height: 3rem; width: auto; flex: none; }
.brand h1 { font-family: var(--font-display); font-size: var(--text-md); line-height: 1.25; font-weight: 700; color: var(--color-accent); min-width: 0; overflow-wrap: break-word; }
.voice-link {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding: 0 var(--space-md);
  border-radius: var(--radius-pill);
  background: var(--color-accent);
  color: var(--color-accent-ink);
  font-size: var(--text-sm);
  font-weight: 600;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color var(--dur-micro) var(--ease-out);
}
.voice-link:hover { background: var(--color-accent-strong); }
.voice-link:active { transform: translateY(1px); }

.main-nav {
  position: fixed;
  inset: auto 0 0 0;
  z-index: var(--z-sticky-nav);
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--color-paper-2);
  border-top: var(--rule-hair) solid var(--color-rule-2);
}
.main-nav a {
  display: grid;
  place-items: center;
  min-height: var(--nav-h);
  padding: var(--space-2xs);
  color: var(--color-muted);
  font-size: var(--text-xs);
  font-weight: 600;
  text-decoration: none;
  text-align: center;
  border-top: 3px solid transparent;
  transition: color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out);
}
.main-nav a:hover { color: var(--color-ink); }
.main-nav a:active { background: var(--color-paper-3); }
.main-nav a[aria-current="page"] { color: var(--color-crest); border-top-color: var(--color-crest); }
.label-long { display: none; }

/* The desk */
.desk {
  display: grid;
  gap: var(--space-lg);
  padding: var(--space-lg) var(--space-md) calc(var(--nav-h) + var(--space-xl) + env(safe-area-inset-bottom));
  min-width: 0;
}
/* Phone: one view at a time (only when the layout script runs) */
@media (max-width: 767.98px) {
.has-views body[data-view="today"] [data-view]:not([data-view="today"]),
.has-views body[data-view="messages"] [data-view]:not([data-view="messages"]),
.has-views body[data-view="tasks"] [data-view]:not([data-view="tasks"]),
.has-views body[data-view="reminders"] [data-view]:not([data-view="reminders"]),
.has-views body[data-view="more"] [data-view]:not([data-view="more"]) { display: none; }
}

.desk-head { display: grid; gap: var(--space-2xs); }
.desk-date { color: var(--color-muted); font-size: var(--text-sm); }
.greeting { font-family: var(--font-display); font-size: var(--text-2xl); font-weight: 700; color: var(--color-accent); }

/* Today at a glance: three figures and the next event, in one white card */
.overview {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  margin: 0;
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
}
.stat { min-width: 0; padding: var(--space-md); display: flex; flex-direction: column; }
.stat dd.num { margin-top: auto; padding-top: var(--space-2xs); }
.stat + .stat { border-inline-start: var(--rule-hair) solid var(--color-rule); }
.stat.stat-wide { grid-column: 1 / -1; border-inline-start: 0; border-top: var(--rule-hair) solid var(--color-rule); }
.stat dt { font-size: var(--text-xs); color: var(--color-muted); line-height: 1.3; overflow-wrap: break-word; }
.stat dd { margin: var(--space-2xs) 0 0; font-size: var(--text-2xl); font-weight: 700; line-height: 1.1; color: var(--color-ink); font-variant-numeric: tabular-nums; }
.stat.stat-wide dd { font-size: var(--text-md); font-weight: 500; line-height: 1.4; overflow-wrap: break-word; }

.workspace, .workspace-two, .workspace-today, .workspace-wide-left, .today-side { display: grid; gap: var(--space-lg); min-width: 0; }

/* Cards: white, a subtle border, one job each */
.block {
  min-width: 0;
  padding: var(--card-pad);
  background: var(--color-paper-2);
  border: var(--rule-hair) solid var(--color-rule);
  border-radius: var(--radius-card);
}
.block h2 { font-family: var(--font-display); font-size: var(--text-lg); font-weight: 700; color: var(--color-accent); margin-bottom: var(--space-xs); }
.block > h2::after, .panel-head h2::after { content: ""; display: block; width: 2rem; height: 3px; margin-top: var(--space-xs); background: var(--color-crest); border-radius: 2px; }
.block h3 { margin: var(--space-lg) 0 var(--space-xs); font-size: var(--text-sm); color: var(--color-ink-2); letter-spacing: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); margin-bottom: var(--space-sm); }
.panel-head h2 { margin: 0; }
.hint { color: var(--color-muted); font-size: var(--text-sm); margin-bottom: var(--space-md); max-width: 60ch; }
.error { color: var(--color-error); font-size: var(--text-sm); }
.badge {
  display: inline-block;
  margin-inline-start: var(--space-xs);
  padding: var(--space-3xs) var(--space-xs);
  border-radius: var(--radius-pill);
  background: var(--color-accent-soft);
  color: var(--color-accent-strong);
  font-size: var(--text-xs);
  font-weight: 600;
  letter-spacing: 0;
  vertical-align: middle;
}

/* Forms: big, touch-friendly fields */
form { display: grid; gap: var(--space-md); }
form label { display: grid; gap: var(--space-xs); font-size: var(--text-sm); font-weight: 500; color: var(--color-ink-2); }
.field-pair { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-md); }
input, select, textarea, #assistant-text {
  width: 100%;
  min-height: var(--control-h);
  padding: var(--space-sm);
  background: var(--color-paper-2);
  color: var(--color-ink);
  border: var(--rule-hair) solid var(--color-rule-2);
  border-radius: var(--radius-row);
  font: inherit;
  font-size: max(16px, var(--text-md));
  transition: border-color var(--dur-micro) var(--ease-out);
}
textarea, #assistant-text { resize: vertical; line-height: 1.5; }
#assistant-text { min-height: 7rem; padding: var(--space-md); font-size: var(--text-lg); }
input[type="file"] { padding: var(--space-sm); }
input:hover, select:hover, textarea:hover { border-color: var(--color-muted); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 2px solid var(--color-accent); outline-offset: -1px; border-color: var(--color-accent); }
input[readonly] { background: var(--color-paper-3); }
input::placeholder, textarea::placeholder { color: var(--color-muted); }
form > button, .inline-form > button { width: 100%; }

/* Buttons: one filled blue, the rest quiet; touch-sized on phones */
button {
  min-height: var(--control-h);
  padding: 0 var(--space-md);
  border-radius: var(--radius-row);
  border: var(--rule-hair) solid var(--color-rule-2);
  background: var(--color-paper-2);
  color: var(--color-ink);
  font: inherit;
  font-size: var(--text-md);
  font-weight: 500;
  cursor: pointer;
  transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out);
}
button:hover { background: var(--color-paper-3); border-color: var(--color-muted); }
button:active { transform: translateY(1px); }
button:disabled { opacity: 0.55; cursor: not-allowed; }
button.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); font-weight: 600; }
button.primary:hover { background: var(--color-accent-strong); border-color: var(--color-accent-strong); }
button.secondary { background: transparent; border-color: transparent; color: var(--color-muted); }
button.secondary:hover { background: var(--color-paper-3); color: var(--color-ink); border-color: transparent; }
.button-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs); margin-top: var(--space-md); }
.button-row > button.primary:first-child { grid-column: 1 / -1; }
.button-row > button.secondary { grid-column: 1 / -1; white-space: nowrap; }
#listen-button.listening { background: var(--color-accent-soft); border-color: var(--color-accent); color: var(--color-accent-strong); animation: listen 1.2s var(--ease-in-out) infinite; }
@keyframes listen { 50% { opacity: 0.7; } }

/* Lists and tables */
ul { margin: 0; padding: 0; list-style: none; }
:where(.rows, #morning-list, #calendar-list, #activity-list, #sent-list, #contacts-list, #attachment-list, #connections-list, #google-accounts) > li {
  padding: var(--space-sm) 0;
  border-top: var(--rule-hair) solid var(--color-rule);
  font-size: var(--text-sm);
  overflow-wrap: break-word;
}
:where(.rows, #morning-list, #calendar-list, #activity-list, #sent-list, #contacts-list, #attachment-list, #connections-list, #google-accounts) > li:first-child { border-top: 0; }
:where(.rows) > li button { min-height: 2.5rem; margin: var(--space-2xs) var(--space-xs) 0 0; }
.calendar-rows { max-height: 28rem; overflow-y: auto; }
#activity-list { max-height: 30rem; overflow-y: auto; }

/* Tables scroll sideways inside their card on narrow screens */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
th { text-align: start; font-weight: 500; color: var(--color-muted); padding: var(--space-sm) var(--space-sm) var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule-2); white-space: nowrap; }
td { padding: var(--space-sm) var(--space-sm) var(--space-sm) 0; border-bottom: var(--rule-hair) solid var(--color-rule); vertical-align: top; }
td button { min-height: 2.5rem; padding: 0 var(--space-sm); margin: 0 var(--space-2xs) var(--space-2xs) 0; font-size: var(--text-sm); }
.status-COMPLETED { color: var(--color-success); font-weight: 600; }
.status-OVERDUE, .status-FAILED { color: var(--color-error); font-weight: 600; }
.status-CANCELLED { color: var(--color-muted); text-decoration: line-through; }
.connection-ready { color: var(--color-success); }
.connection-not-ready { color: var(--color-muted); }

/* Secondary panels tucked away as disclosures */
details { margin-top: var(--space-lg); border-top: var(--rule-hair) solid var(--color-rule); padding-top: var(--space-xs); }
summary { display: flex; align-items: center; min-height: 2.75rem; cursor: pointer; font-weight: 600; font-size: var(--text-sm); color: var(--color-ink-2); }
summary:hover { color: var(--color-ink); }
details[open] > summary { margin-bottom: var(--space-sm); }
.calendar-tools { display: grid; gap: var(--space-md); margin-bottom: var(--space-md); }

/* Conversation and assistant cards */
.conversation { max-height: 26rem; overflow-y: auto; display: grid; gap: var(--space-sm); margin-bottom: var(--space-md); }
.conversation:empty { display: none; }
.bubble { padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); white-space: pre-wrap; max-width: 88%; line-height: 1.55; }
.bubble.user { justify-self: end; background: var(--color-accent); color: var(--color-accent-ink); }
.bubble.assistant { justify-self: start; background: var(--color-paper-3); color: var(--color-ink); }
.card { margin-top: var(--space-md); padding: var(--space-md); border-radius: var(--radius-row); background: var(--color-paper); border: var(--rule-hair) solid var(--color-rule); }
.card h4 { margin: 0 0 var(--space-xs); font-size: var(--text-sm); font-weight: 600; color: var(--color-ink); }
.card .message-body, .preview { white-space: pre-wrap; margin: var(--space-sm) 0; padding-inline-start: var(--space-md); border-inline-start: 2px solid var(--color-accent); color: var(--color-ink-2); }
.card.done { opacity: 0.7; }
.plan-table input { min-height: 2.5rem; }

/* PIN sheet */
#login-overlay { position: fixed; inset: 0; z-index: var(--z-modal); display: grid; place-items: center; padding: var(--space-md); background: color-mix(in oklab, var(--color-ink) 35%, transparent); }
#login-overlay[hidden] { display: none; }
.login-box { width: min(100%, 22rem); padding: var(--space-xl); border-radius: var(--radius-card); background: var(--color-paper-2); border: var(--rule-hair) solid var(--color-rule); }
.login-box h2 { font-size: var(--text-xl); }
.login-box button { width: 100%; }

@media (prefers-reduced-motion: reduce) { #listen-button.listening { animation: none; } }

/* ───────── Tablet (768px to 1023px): top bar, two-column cards ───────── */
@media (min-width: 768px) {
  :root { --control-h: 2.75rem; --card-pad: var(--space-xl); }
  .side {
    position: sticky;
    top: 0;
    z-index: var(--z-sticky-nav);
    padding: 0 var(--gutter);
    min-height: 4rem;
  }
  .main-nav {
    position: static;
    display: flex;
    gap: var(--space-2xs);
    margin-inline-end: auto;
    padding: 0;
    background: transparent;
    border: 0;
  }
  .main-nav a {
    min-height: 2.5rem;
    padding: 0 var(--space-sm);
    border-top: 0;
    border-radius: var(--radius-row);
    font-size: var(--text-sm);
    font-weight: 500;
    white-space: nowrap;
  }
  .main-nav a:hover { background: var(--color-paper-3); }
  .main-nav a[aria-current="page"] { background: var(--color-crest-soft); color: var(--color-crest); box-shadow: inset 3px 0 0 var(--color-crest); }
  .desk { gap: var(--space-xl); padding: var(--space-xl) var(--gutter) var(--space-3xl); width: min(100%, var(--container)); margin-inline: auto; }
  .greeting { font-size: var(--text-3xl); }
  .stat { padding: var(--space-lg); }
  .stat dt { font-size: var(--text-sm); }
  .stat dd { font-size: var(--text-3xl); }
  .stat.stat-wide dd { font-size: var(--text-lg); }
  .workspace, .workspace-two, .workspace-today, .workspace-wide-left, .today-side { gap: var(--space-xl); }
  .workspace-two, .workspace-wide-left { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .workspace-today { align-items: start; }
  .field-pair { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .calendar-tools { grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr); align-items: end; }
  form > button, .inline-form > button { width: auto; justify-self: start; }
  .button-row { display: flex; flex-wrap: wrap; }
  button { font-size: var(--text-sm); }
  .block h2 { font-size: var(--text-xl); }
}
@media (min-width: 768px) and (max-width: 899.98px) {
  .label-long { display: none; }
  .label-short { display: inline; }
  .voice-link { font-size: var(--text-xs); }
}
@media (min-width: 900px) and (max-width: 1023.98px) {
  .label-long { display: inline; }
  .label-short { display: none; }
}

/* ───────── Laptop and desktop (1024px and up): left sidebar, multi-column ───────── */
@media (min-width: 1024px) {
  :root { --control-h: 2.5rem; }
  .shell {
    display: grid;
    grid-template-columns: var(--side) minmax(0, 1fr);
  }
  .side {
    position: sticky;
    top: 0;
    align-self: start;
    height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    gap: var(--space-xl);
    padding: var(--space-xl) var(--space-lg);
    border-bottom: 0;
    border-inline-end: var(--rule-hair) solid var(--color-rule);
  }
  .brand { flex-direction: column; align-items: flex-start; gap: var(--space-sm); }
  .brand-logo { height: 5rem; }
  .brand h1 { font-size: var(--text-xl); white-space: normal; }
  .main-nav { flex-direction: column; margin: 0 0 auto; gap: var(--space-3xs); }
  .main-nav a { justify-content: start; min-height: 2.75rem; padding: 0 var(--space-md); font-size: var(--text-md); }
  .label-long { display: inline; }
  .label-short { display: none; }
  .voice-link { justify-content: center; min-height: 3rem; font-size: var(--text-sm); }
  .desk { width: min(100%, 78rem); padding: var(--space-2xl) var(--space-2xl) var(--space-3xl); gap: var(--space-xl); }
  .overview { grid-template-columns: repeat(3, minmax(0, 1fr)) minmax(0, 2fr); }
  .stat.stat-wide { grid-column: auto; border-top: 0; border-inline-start: var(--rule-hair) solid var(--color-rule); }
  .workspace-today { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
  .workspace-wide-left { grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
  .workspace { scroll-margin-top: var(--space-xl); }
}
@media (min-width: 1440px) {
  .desk { padding-inline: var(--space-3xl); }
}
