:root {
  --paper: #f6f1e6;
  --paper-soft: #efe7d6;
  --surface: #fffdf8;
  --surface-2: #fbf6ea;
  --ink: #201d18;
  --ink-soft: #514a3d;
  --muted: #7c7363;
  --line: #e2d6bf;
  --line-strong: #d3c4a6;
  --green: #2f5d42;
  --green-deep: #21432f;
  --green-wash: #e8f0e7;
  --ochre: #b5651d;
  --ochre-soft: #d99a5b;
  --ochre-wash: #f7e8d6;
  --yellow: #8a6b08;
  --yellow-wash: #f6ecc6;
  --red: #a3352a;
  --red-wash: #f6e0dc;
  --blue: #2f5fa8;
  --blue-wash: #e4ebf7;
  --purple: #6e4fb0;
  --purple-wash: #ece6f7;
  --sidebar-bg: #1d211c;
  --sidebar-ink: #ece5d4;
  --sidebar-muted: #a49a86;
  --sidebar-line: #343a31;
  --shadow-sm: 0 1px 2px rgba(32, 29, 24, 0.05), 0 4px 12px rgba(32, 29, 24, 0.04);
  --shadow-md: 0 10px 30px rgba(32, 29, 24, 0.09);
  --shadow-lg: 0 24px 60px rgba(20, 24, 19, 0.22);
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 18px;
  --font-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;
  --font-sans: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-hand: 'Caveat', 'Segoe Script', cursive;
  --sidebar-w: 274px;
  --topbar-h: 60px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1100px 560px at 8% -12%, rgba(181, 101, 29, 0.09), transparent 62%),
    radial-gradient(900px 520px at 102% 0%, rgba(47, 93, 66, 0.08), transparent 58%),
    var(--paper);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

h1, h2, h3, p { margin-top: 0; }
h1, h2, h3 { font-family: var(--font-serif); font-weight: 600; letter-spacing: -0.01em; }

a { color: var(--green); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }

svg { width: 1.25rem; height: 1.25rem; display: block; }

.icon-sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

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

.skip-link {
  position: fixed; top: 10px; left: 10px; z-index: 100;
  transform: translateY(-160%);
  background: var(--ink); color: var(--surface);
  padding: 10px 16px; border-radius: var(--radius-sm);
  text-decoration: none; font-weight: 600;
}
.skip-link:focus { transform: none; }

:focus-visible { outline: 2px solid var(--green); outline-offset: 2px; }

/* ------------------------------------------------------------------ shell */
.app { min-height: 100vh; }

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  z-index: 40;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 22px 18px;
  background:
    radial-gradient(320px 200px at 0% 0%, rgba(181, 101, 29, 0.14), transparent 70%),
    var(--sidebar-bg);
  color: var(--sidebar-ink);
  border-right: 1px solid rgba(255, 255, 255, 0.04);
  overflow-y: auto;
}

.sidebar__head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }

.brand {
  display: flex; align-items: center; gap: 11px;
  text-decoration: none; color: inherit; min-width: 0;
}
.brand img {
  width: 34px; height: 34px; object-fit: contain; flex-shrink: 0;
  padding: 3px; border-radius: 10px; background: rgba(255, 255, 255, 0.9);
}
.brand__text { display: flex; flex-direction: column; min-width: 0; }
.brand__text strong {
  font-family: var(--font-serif); font-size: 1.02rem; font-weight: 600;
  line-height: 1.15; color: var(--surface); white-space: nowrap;
}
.brand__text span {
  font-size: 0.7rem; color: var(--sidebar-muted); letter-spacing: 0.02em;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

.sidebar__close { display: none; color: var(--sidebar-ink); }

.sidebar__new { margin-top: 2px; }
.btn--block { width: 100%; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav__link {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  color: #bbb2a0; text-decoration: none;
  font-size: 0.9rem; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav__link svg { width: 18px; height: 18px; opacity: 0.9; flex-shrink: 0; }
.nav__link:hover { background: rgba(255, 255, 255, 0.06); color: var(--surface); }
.nav__link.is-active { background: var(--green); color: #fdfbf4; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.06); }
.nav__link.is-active svg { opacity: 1; }
.nav__count {
  margin-left: auto; min-width: 22px; padding: 1px 7px;
  border-radius: 999px; background: var(--ochre); color: #fff9ee;
  font-size: 0.7rem; font-weight: 600; text-align: center;
}

.sidebar__section { border-top: 1px solid var(--sidebar-line); padding-top: 16px; }
.sidebar__label {
  margin: 0 12px 8px; font-size: 0.66rem; font-weight: 600;
  letter-spacing: 0.1em; text-transform: uppercase; color: #8d8471;
}

.status-dot {
  margin-left: auto; width: 8px; height: 8px; border-radius: 50%;
  background: #665f51; box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.04);
}
.status-dot[data-state="connected"] { background: #6fbe8b; }
.status-dot[data-state="off"] { background: #7a7263; }

.sidebar__foot { margin-top: auto; display: flex; flex-direction: column; gap: 12px; }
.mode-pill {
  display: inline-flex; align-items: center; gap: 8px; align-self: flex-start;
  padding: 5px 10px; border-radius: 999px;
  background: rgba(255, 255, 255, 0.05); border: 1px solid var(--sidebar-line);
  font-size: 0.7rem; font-weight: 600; color: #cfc6b4; letter-spacing: 0.02em;
}
.mode-pill__dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ochre-soft); }
.mode-pill[data-mode="bedrock"] .mode-pill__dot { background: #6fbe8b; }
.sidebar__note { margin: 0; font-size: 0.7rem; line-height: 1.45; color: #7f7767; }

.scrim {
  position: fixed; inset: 0; z-index: 35; background: rgba(24, 27, 22, 0.5);
  backdrop-filter: blur(2px);
}

.main-wrap { margin-left: var(--sidebar-w); min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  display: none; align-items: center; justify-content: space-between; gap: 10px;
  height: var(--topbar-h); padding: 0 14px;
  border-bottom: 1px solid var(--line);
  background: rgba(246, 241, 230, 0.88);
  backdrop-filter: blur(10px);
  position: sticky; top: 0; z-index: 20;
}
.topbar__brand {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--font-serif); font-weight: 600; font-size: 0.98rem;
  color: var(--ink); text-decoration: none;
}
.topbar__brand img { width: 26px; height: 26px; object-fit: contain; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 36px; height: 36px; padding: 0;
  background: transparent; border: 1px solid transparent; border-radius: 10px;
  color: var(--ink-soft);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.icon-btn:hover { background: rgba(32, 29, 24, 0.05); color: var(--ink); }
.icon-btn svg { width: 20px; height: 20px; }

/* The close control only exists in the mobile drawer. */
.sidebar .sidebar__close { display: none; }

.main {
  width: 100%; max-width: 1020px;
  margin: 0 auto; padding: 42px 46px 72px;
}
.main:focus { outline: none; }

/* ------------------------------------------------------------------- head */
.view__head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 24px; margin-bottom: 26px;
}
.eyebrow {
  margin: 0 0 6px; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--ochre);
}
.view__head h1 { margin: 0 0 8px; font-size: clamp(1.75rem, 3.2vw, 2.3rem); line-height: 1.1; }
.lede { margin: 0; max-width: 56ch; color: var(--ink-soft); font-size: 0.95rem; }

.chat-head__side { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; flex-shrink: 0; }
.date-chip {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 13px; border-radius: 999px;
  background: var(--surface); border: 1px solid var(--line);
  font-family: var(--font-serif); font-style: italic; font-size: 0.82rem;
  color: var(--ink-soft); white-space: nowrap;
}
.date-chip svg { width: 14px; height: 14px; color: var(--ochre); }
.text-btn {
  background: none; border: 0; padding: 0;
  font-size: 0.75rem; color: var(--muted); text-decoration: underline;
  text-decoration-color: var(--line-strong); text-underline-offset: 3px;
}
.text-btn:hover { color: var(--ink); }

/* ------------------------------------------------------------------- chat */
.chat-shell {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  overflow: hidden;
  display: flex; flex-direction: column;
}
.thread {
  display: flex; flex-direction: column;
  flex: 1; min-height: 380px; max-height: calc(100vh - 360px);
  overflow-y: auto; padding: 34px 34px 22px;
  scroll-behavior: smooth;
}
.thread > * { flex-shrink: 0; }
.thread::-webkit-scrollbar { width: 10px; }
.thread::-webkit-scrollbar-thumb { background: var(--line); border-radius: 10px; border: 3px solid var(--surface); }

.starter { max-width: 560px; margin: auto; padding: 20px 0; text-align: center; }
.starter__label {
  margin: 0 0 12px; font-size: 0.68rem; font-weight: 600;
  letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted);
}
.suggestions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; }
.suggestion {
  padding: 8px 13px; border-radius: 999px; background: var(--surface-2);
  border: 1px solid var(--line); color: var(--ink-soft);
  font-size: 0.8rem; transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}
.suggestion:hover { border-color: var(--green); color: var(--green); background: var(--green-wash); }

.message { display: flex; gap: 12px; margin-bottom: 22px; max-width: 100%; }
.message--user { flex-direction: row-reverse; }
.message__avatar {
  width: 32px; height: 32px; flex-shrink: 0; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--ochre-wash); color: var(--ochre);
}
.message__avatar svg { width: 17px; height: 17px; }
.message--user .message__avatar { background: var(--green-wash); color: var(--green); }
.message__body { max-width: min(74ch, 82%); }
.message__bubble {
  padding: 13px 17px; border-radius: 4px 16px 16px 16px;
  background: var(--surface-2); border: 1px solid var(--line);
  font-size: 0.94rem; overflow-wrap: anywhere;
}
.message--user .message__bubble {
  border-radius: 16px 4px 16px 16px;
  background: var(--green); border-color: var(--green); color: #fbf9f2;
}
.message__bubble p { margin: 0 0 0.55em; }
.message__bubble p:last-child { margin-bottom: 0; }
.message__bubble ul, .message__bubble ol { margin: 0.4em 0 0.6em; padding-left: 1.25em; }
.message__bubble li { margin: 0.15em 0; }
.message__bubble code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 0.85em;
  background: rgba(32, 29, 24, 0.07); padding: 0.1em 0.35em; border-radius: 4px;
}
.message--user .message__bubble code { background: rgba(255, 255, 255, 0.16); }
.message__bubble strong { font-weight: 600; }
.message__meta { margin-top: 5px; font-size: 0.68rem; color: var(--muted); letter-spacing: 0.02em; }
.message--user .message__meta { text-align: right; }

.typing { display: inline-flex; align-items: center; gap: 4px; padding: 5px 2px; }
.typing span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--ochre);
  animation: bounce 1.1s infinite ease-in-out;
}
.typing span:nth-child(2) { animation-delay: 0.14s; }
.typing span:nth-child(3) { animation-delay: 0.28s; }
@keyframes bounce { 0%, 70%, 100% { transform: translateY(0); opacity: 0.45; } 35% { transform: translateY(-4px); opacity: 1; } }

.composer {
  display: grid; grid-template-columns: minmax(0, 1fr) auto;
  align-items: end; gap: 4px 10px;
  padding: 16px 20px 13px;
  border-top: 1px solid var(--line);
  background: linear-gradient(180deg, var(--surface-2), var(--green-wash));
}
.composer textarea {
  grid-column: 1; resize: none; min-height: 46px; max-height: 170px;
  padding: 12px 16px; border-radius: 14px;
  border: 1px solid var(--line-strong); background: var(--surface);
  font-size: 0.94rem; line-height: 1.5;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.composer textarea::placeholder { color: #9a9180; }
.composer textarea:focus {
  outline: none; border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(47, 93, 66, 0.13);
}
.composer__send {
  grid-column: 2;
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px;
  border: 0; background: var(--green); color: #fbf9f2;
  display: grid; place-items: center;
  transition: background 0.15s ease, transform 0.1s ease, opacity 0.15s ease;
}
.composer__send svg { width: 19px; height: 19px; }
.composer__send:hover { background: var(--green-deep); }
.composer__send:active { transform: scale(0.96); }
.composer__send:disabled { opacity: 0.45; cursor: not-allowed; }
.composer__hint {
  grid-column: 1 / -1;
  margin: 0 0 0 4px; font-size: 0.7rem; color: var(--muted);
}

/* ---------------------------------------------------------------- errands */
.toolbar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 14px; margin-bottom: 20px; flex-wrap: wrap;
}
.segmented {
  display: inline-flex; padding: 3px; gap: 2px;
  background: var(--paper-soft); border: 1px solid var(--line); border-radius: 11px;
}
.segmented button {
  border: 0; background: transparent; color: var(--ink-soft);
  font-size: 0.8rem; font-weight: 500; padding: 6px 13px; border-radius: 8px;
}
.segmented button:hover { color: var(--ink); }
.segmented button[aria-selected="true"] {
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm); font-weight: 600;
}
.search { position: relative; width: min(260px, 100%); }
.search svg {
  position: absolute; left: 11px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--muted); pointer-events: none;
}
.search input {
  width: 100%; padding: 9px 12px 9px 34px;
  border: 1px solid var(--line); border-radius: 10px; background: var(--surface);
  font-size: 0.84rem;
}
.search input:focus { outline: none; border-color: var(--green); box-shadow: 0 0 0 3px rgba(47, 93, 66, 0.1); }

.grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(272px, 1fr));
  gap: 16px;
}

.errand-card {
  position: relative; display: flex; flex-direction: column; gap: 10px;
  padding: 18px 18px 14px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
}
.errand-card:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); border-color: var(--line-strong); }
.errand-card:hover, .errand-card:focus-within { z-index: 2; }
.errand-card--done { background: var(--surface-2); }
.errand-card--done .errand-card__title { text-decoration: line-through; text-decoration-color: var(--line-strong); color: var(--muted); }
.errand-card--cancelled { opacity: 0.78; }
.errand-card.overdue { border-left: 3px solid var(--red); }
.errand-card__top { display: flex; align-items: center; justify-content: flex-end; gap: 10px; }
.errand-card__title { margin: 0; font-size: 1rem; font-weight: 600; line-height: 1.35; }
.errand-card__notes { margin: -2px 0 0; font-size: 0.82rem; color: var(--ink-soft); }
.errand-card__meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-top: auto; padding-top: 4px; font-size: 0.72rem; color: var(--muted); }
.errand-card__actions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 14px;
  padding-top: 10px; border-top: 1px dashed var(--line);
}

.due-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 3px 9px; border-radius: 999px;
  background: var(--ochre-wash); color: var(--ochre);
  font-size: 0.72rem; font-weight: 500; white-space: nowrap;
}
.due-chip svg { width: 12px; height: 12px; }
.due-chip--today { background: var(--yellow-wash); color: var(--yellow); }
.due-chip--overdue { background: var(--red-wash); color: var(--red); }
.due-chip--none { background: var(--paper-soft); color: var(--muted); }

.link-btn {
  border: 0; background: none; padding: 0;
  font-size: 0.76rem; font-weight: 500; color: var(--muted);
  border-bottom: 1px solid transparent;
}
.link-btn:hover { color: var(--green); border-bottom-color: currentColor; }
.link-btn--danger:hover { color: var(--red); }
.link-btn--accent:hover { color: var(--ochre); }

.card-menu { position: relative; margin-left: auto; }
.card-menu__toggle { list-style: none; cursor: pointer; }
.card-menu__toggle::-webkit-details-marker { display: none; }
.card-menu[open] .card-menu__toggle { color: var(--green); border-bottom-color: currentColor; }
.card-menu__panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 5;
  min-width: 148px; padding: 6px;
  display: flex; flex-direction: column; align-items: stretch; gap: 2px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 10px; box-shadow: var(--shadow-md);
}
.card-menu__panel .link-btn {
  padding: 7px 9px; border-radius: 6px;
  text-align: left; border-bottom: 0;
}
.card-menu__panel .link-btn:hover { background: var(--surface-2); }

.empty-state {
  grid-column: 1 / -1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 8px; padding: 64px 24px; text-align: center;
  border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: rgba(255, 253, 248, 0.45);
}
.empty-state__icon {
  width: 46px; height: 46px; border-radius: 13px;
  background: var(--green-wash); color: var(--green);
  display: grid; place-items: center; margin-bottom: 4px;
}
.empty-state__icon svg { width: 22px; height: 22px; }
.empty-state h2 { margin: 0; font-size: 1.1rem; }
.empty-state p { margin: 0; max-width: 40ch; color: var(--muted); font-size: 0.86rem; }

/* ------------------------------------------------------------------ trash */
.trash-card { background: var(--surface-2); border-style: dashed; }

/* ------------------------------------------------------------ integrations */
.panel-card {
  display: flex; align-items: center; justify-content: space-between; gap: 24px;
  padding: 24px 26px; margin-bottom: 16px;
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-sm);
}
.panel-card--soft { background: var(--surface-2); }
.panel-card__main { display: flex; align-items: flex-start; gap: 16px; }
.panel-card__icon {
  width: 46px; height: 46px; flex-shrink: 0; border-radius: 13px;
  display: grid; place-items: center;
  background: var(--green-wash); color: var(--green);
}
.panel-card__icon--ochre { background: var(--ochre-wash); color: var(--ochre); }
.panel-card h2 { margin: 0 0 4px; font-size: 1.12rem; }
.panel-card p { margin: 0; font-size: 0.86rem; color: var(--ink-soft); }
.panel-card__meta { margin-top: 7px !important; font-size: 0.76rem !important; color: var(--muted) !important; }
.panel-card__main > div > p#googleStatusText { display: flex; align-items: center; gap: 7px; }
.panel-card__main > div > p#googleStatusText.is-connected { color: var(--green); font-weight: 500; }
.panel-card__main > div > p#googleStatusText.is-connected::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green);
}
.panel-card__action { flex-shrink: 0; }
.checklist { margin: 8px 0 0; padding-left: 18px; color: var(--ink-soft); font-size: 0.84rem; }
.checklist li { margin: 5px 0; }

/* ------------------------------------------------------------------ buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  padding: 9px 16px; border-radius: 10px; border: 1px solid transparent;
  font-size: 0.84rem; font-weight: 600; white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.btn:active { transform: translateY(1px); }
.btn__icon { width: 16px; height: 16px; }
.btn--primary { background: var(--green); color: #fbf9f2; }
.btn--primary:hover { background: var(--green-deep); }
.btn--ghost { background: transparent; border-color: var(--line-strong); color: var(--ink-soft); }
.btn--ghost:hover { border-color: var(--ink-soft); color: var(--ink); background: rgba(255, 255, 255, 0.5); }
.btn--danger { background: var(--red); color: #fff8f6; }
.btn--danger:hover { background: #8b2c23; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* ------------------------------------------------------------------ dialog */
.dialog {
  width: min(528px, calc(100vw - 32px));
  padding: 0; border: 0; border-radius: 20px;
  background: var(--surface); color: var(--ink);
  box-shadow: var(--shadow-lg);
}
.dialog--small { width: min(420px, calc(100vw - 32px)); }
.dialog::backdrop { background: rgba(24, 27, 22, 0.55); backdrop-filter: blur(3px); }
.dialog[open] { animation: dialog-in 0.18s ease-out; }
@keyframes dialog-in { from { opacity: 0; transform: translateY(8px) scale(0.99); } to { opacity: 1; transform: none; } }

.dialog__form { display: flex; flex-direction: column; gap: 18px; padding: 24px; }
.dialog__head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dialog__head h2 { margin: 0; font-size: 1.3rem; }
.dialog__head .icon-btn { color: var(--muted); }
.dialog__foot { display: flex; justify-content: flex-end; gap: 10px; padding-top: 6px; }
.confirm-text { margin: 0; color: var(--ink-soft); font-size: 0.92rem; }

.field { display: flex; flex-direction: column; gap: 7px; }
.field > label { font-size: 0.8rem; font-weight: 600; color: var(--ink-soft); }
.field .optional { font-weight: 400; color: var(--muted); margin-left: 4px; }
.field input, .field textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px;
  border: 1px solid var(--line-strong); background: var(--surface-2);
  font-size: 0.9rem;
}
.field textarea { resize: vertical; min-height: 76px; }
.field input:focus, .field textarea:focus {
  outline: none; border-color: var(--green); background: var(--surface);
  box-shadow: 0 0 0 3px rgba(47, 93, 66, 0.12);
}
.quick-dates { display: flex; flex-wrap: wrap; gap: 6px; }
.quick-dates button {
  padding: 4px 10px; border-radius: 999px;
  border: 1px solid var(--line); background: transparent; color: var(--muted);
  font-size: 0.72rem;
}
.quick-dates button:hover { border-color: var(--green); color: var(--green); background: var(--green-wash); }
.form-error {
  margin: 0; padding: 9px 12px; border-radius: 9px;
  background: var(--red-wash); color: var(--red); font-size: 0.8rem;
}

/* ------------------------------------------------------------------ toasts */
.toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 80;
  display: flex; flex-direction: column; gap: 10px; align-items: flex-end;
  max-width: min(380px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: center; gap: 14px;
  padding: 12px 16px; border-radius: 12px;
  background: var(--ink); color: #f8f4ea;
  box-shadow: var(--shadow-md); font-size: 0.82rem;
  animation: toast-in 0.2s ease-out;
}
.toast--error { background: var(--red); }
.toast--success { background: var(--green-deep); }
.toast__msg { margin: 0; }
.toast__action {
  margin-left: auto; border: 0; background: transparent; color: var(--ochre-soft);
  font-weight: 600; font-size: 0.8rem; padding: 0; white-space: nowrap;
  text-decoration: underline; text-underline-offset: 3px;
}
.toast--error .toast__action, .toast--success .toast__action { color: #fff; }
.toast__close {
  border: 0; background: transparent; color: inherit; opacity: 0.6; padding: 0 0 0 2px;
  font-size: 1rem; line-height: 1;
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* -------------------------------------------------------------- responsive */
@media (max-width: 1080px) {
  .thread { padding: 28px 24px 18px; }
  .main { padding: 36px 30px 64px; }
}

@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
    visibility: hidden;
    transition: transform 0.22s ease, visibility 0.22s;
    box-shadow: var(--shadow-lg);
  }
  .app.sidebar-open .sidebar { transform: translateX(0); visibility: visible; }
  .sidebar .sidebar__close { display: inline-flex; }
  .main-wrap { margin-left: 0; }
  .topbar { display: flex; }
  .main { padding-top: 28px; }
  .thread { max-height: calc(100vh - 330px); }
}

@media (max-width: 720px) {
  .main { padding: 24px 18px 56px; }
  .view__head { flex-direction: column; align-items: stretch; gap: 16px; }
  .view__head > .btn { align-self: flex-start; }
  .chat-head__side { flex-direction: row; align-items: center; justify-content: space-between; }
  .lede { font-size: 0.9rem; }
  .thread { min-height: 340px; max-height: calc(100vh - 400px); padding: 22px 16px 14px; }
  .composer { padding: 13px 14px 12px; }
  .composer__hint { display: none; }
  .message__body { max-width: 86%; }
  .grid { grid-template-columns: 1fr; }
  .toolbar { align-items: stretch; }
  .segmented { width: 100%; overflow-x: auto; }
  .segmented button { flex: 1; }
  .search { width: 100%; }
  .panel-card { flex-direction: column; align-items: stretch; gap: 18px; padding: 20px; }
  .panel-card__action .btn { width: 100%; }
  .toasts { right: 12px; left: 12px; bottom: 12px; align-items: stretch; max-width: none; }
  .starter { padding: 10px 0; }
}

@media (max-width: 420px) {
  .date-chip { font-size: 0.76rem; padding: 6px 10px; }
  .view__head h1 { font-size: 1.6rem; }
  .suggestions { flex-direction: column; align-items: stretch; }
  .suggestion { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.001ms !important; transition-duration: 0.001ms !important; scroll-behavior: auto !important; }
}
