/* Stockton — light palette reskin.
   Mechanics unchanged from the previous build; only visual language shifts.

   Palette: warm cream background, white elevated cards, deep muted teal
   accent, near-black text. Wordmark set in Fraunces serif; body in system
   sans. Softer corners (16px) and quieter borders than the dark build. */

:root {
  /* --------- Palette --------- */
  --bg:            #F3EEE4;   /* warm cream page background */
  --bg-elev:       #FFFFFF;   /* white cards */
  --bg-elev-2:     #FAF6EE;   /* softer off-white (drawer, subtle surfaces) */
  --bg-sunk:       #EDE6D8;   /* recessed input backgrounds */

  --border:        #E6DFD1;   /* subtle warm border */
  --border-strong: #D0C7B5;   /* border on hover / focus outlines */

  --text:          #1D2124;   /* body text, near-black warm */
  --text-dim:      #55605D;   /* muted body / meta */
  --text-faint:    #8A928D;   /* placeholders / captions */

  --accent:        #0E5A68;   /* deep teal — primary */
  --accent-dim:    #094652;
  --accent-soft:   #DFEAEC;   /* pale teal wash */

  --good:          #4E8567;
  --good-soft:     #DBE9DE;
  --warn:          #C89252;
  --bad:           #B8574C;
  --bad-soft:      #F1DAD5;

  /* --------- Shape --------- */
  --radius:        16px;
  --radius-sm:     10px;

  --header-h:      56px;
  --drawer-w:      min(360px, 88vw);

  /* --------- Typography --------- */
  --font-sans:     -apple-system, BlinkMacSystemFont, "SF Pro Text",
                   "Segoe UI", Inter, Roboto, ui-sans-serif, system-ui,
                   Helvetica, Arial, sans-serif;
  --font-mono:     ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-serif:    "Fraunces", ui-serif, "Iowan Old Style",
                   "Apple Garamond", Georgia, serif;
}

* { box-sizing: border-box; }

html {
  height: 100%;
  min-height: calc(100% + env(safe-area-inset-top));
}

body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
  overflow: hidden;
}

/* ====================================================================
   HEADER — slim, cream background, serif wordmark with sparkle mark.
   ==================================================================== */

.header {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--header-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 20;
}

.brand { display: flex; align-items: center; gap: 8px; }

.brand-mark {
  color: var(--accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 24px;
  height: 24px;
}

.brand-name {
  font-family: var(--font-serif);
  font-weight: 500;
  font-size: 22px;
  letter-spacing: -0.005em;
  color: var(--text);
  line-height: 1;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 12px;
}

.status {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-dim);
  font-variant-numeric: tabular-nums;
}

.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-faint); }
.status-dot--live  { background: var(--good); box-shadow: 0 0 0 3px rgba(78, 133, 103, 0.18); }
.status-dot--error { background: var(--bad);  box-shadow: 0 0 0 3px rgba(184, 87, 76, 0.18); }

.hamburger {
  position: relative;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease;
}
.hamburger:hover  { background: var(--bg-elev); border-color: var(--border-strong); }
.hamburger:active { transform: scale(0.96); }

.hamburger-attn {
  position: absolute;
  top: 6px; right: 6px;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--bad);
  box-shadow: 0 0 0 2px var(--bg);
}

/* ====================================================================
   CHAT — primary surface.
   ==================================================================== */

.chat {
  position: fixed;
  top: calc(var(--header-h) + env(safe-area-inset-top));
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  flex-direction: column;
  padding-left: max(16px, env(safe-area-inset-left));
  padding-right: max(16px, env(safe-area-inset-right));
  padding-bottom: env(safe-area-inset-bottom);
  max-width: 760px;
  margin: 0 auto;
  min-height: 0;
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0.24, 1.0),
              opacity   320ms ease;
  transform-origin: right center;
}
body.drawer-open .chat {
  transform: scale(0.98);
  opacity: 0.7;
}

.chat-log {
  flex: 1;
  display: flex; flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 4px 12px;
  min-height: 0;
  overscroll-behavior: contain;
}

/* --- Chat bubbles --- */

.bubble {
  max-width: 88%;
  padding: 12px 15px;
  border-radius: var(--radius);
  font-size: 15px; line-height: 1.5;
  white-space: pre-wrap; word-wrap: break-word;
  animation: bubble-in 200ms ease;
}

.bubble--user {
  align-self: flex-end;
  background: var(--accent);
  color: #FFFFFF;
  border-bottom-right-radius: 6px;
}

.bubble--assistant {
  align-self: flex-start;
  background: var(--bg-elev);
  color: var(--text);
  border: 1px solid var(--border);
  border-bottom-left-radius: 6px;
}

.bubble--system {
  align-self: stretch;
  background: transparent;
  color: var(--text-dim);
  border: 1px dashed var(--border-strong);
  font-size: 13px; text-align: center;
}
.bubble--system em {
  color: var(--text); font-style: normal;
  background: var(--accent-soft);
  padding: 1px 6px; border-radius: 4px;
  margin: 0 2px;
}
.bubble--system code {
  font-family: var(--font-mono);
  font-size: 12px;
  background: var(--bg-elev);
  padding: 2px 6px; border-radius: 4px;
  border: 1px solid var(--border);
}

.bubble--error {
  align-self: flex-start;
  background: var(--bad-soft);
  border: 1px solid rgba(184, 87, 76, 0.4);
  color: var(--bad);
}

.bubble--thinking {
  align-self: flex-start;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  color: var(--text-faint);
  padding: 14px 16px;
  display: inline-flex;
  align-items: center;
  gap: 3px;
  min-width: 44px;
  min-height: 42px;
  font-size: 0;
}
.bubble--thinking::before,
.bubble--thinking::after,
.bubble--thinking > span {
  content: '';
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  display: inline-block;
  /* !important forces the animation to run even when the browser (or an
     ancestor rule) tries to suppress it via reduced-motion. This dot bounce
     is functional loading feedback, not decoration — killing it makes the
     app look frozen. */
  animation: think-bounce 1.2s ease-in-out infinite !important;
}
.bubble--thinking::before { animation-delay: 0s   !important; }
.bubble--thinking > span  { animation-delay: 0.18s !important; margin: 0 3px; }
.bubble--thinking::after  { animation-delay: 0.36s !important; }

@keyframes bubble-in {
  from { opacity: 0; transform: translateY(3px); }
  to   { opacity: 1; transform: translateY(0); }
}
@keyframes think-bounce {
  0%, 60%, 100% { transform: translateY(0);   opacity: 0.35; }
  30%           { transform: translateY(-5px); opacity: 1; }
}

/* --- Markdown inside assistant bubbles and ping bodies --- */

.bubble--assistant h3,
.bubble--assistant h4,
.bubble--assistant h5,
.bubble--ping .ping-body h3,
.bubble--ping .ping-body h4,
.bubble--ping .ping-body h5 {
  margin: 12px 0 6px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--text);
}
.bubble--assistant h3, .bubble--ping .ping-body h3 { font-size: 16px; }
.bubble--assistant h4, .bubble--ping .ping-body h4 { font-size: 15px; }
.bubble--assistant h5, .bubble--ping .ping-body h5 { font-size: 13px; color: var(--accent); text-transform: uppercase; letter-spacing: 0.08em; }
.bubble--assistant h3:first-child,
.bubble--assistant h4:first-child,
.bubble--assistant h5:first-child,
.bubble--ping .ping-body h3:first-child,
.bubble--ping .ping-body h4:first-child,
.bubble--ping .ping-body h5:first-child { margin-top: 0; }

.bubble--assistant p,
.bubble--ping .ping-body p {
  margin: 0 0 8px;
  line-height: 1.55;
}
.bubble--assistant p:last-child,
.bubble--ping .ping-body p:last-child { margin-bottom: 0; }

.bubble--assistant ul,
.bubble--ping .ping-body ul {
  margin: 4px 0 8px;
  padding-left: 20px;
  list-style: none;
}
.bubble--assistant ul:last-child,
.bubble--ping .ping-body ul:last-child { margin-bottom: 0; }
.bubble--assistant li,
.bubble--ping .ping-body li {
  position: relative;
  padding: 2px 0;
  line-height: 1.45;
}
.bubble--assistant li::before,
.bubble--ping .ping-body li::before {
  content: '•';
  position: absolute;
  left: -14px;
  color: var(--accent);
  font-weight: 700;
}

.bubble--assistant strong,
.bubble--ping .ping-body strong { color: var(--text); font-weight: 600; }
.bubble--assistant em,
.bubble--ping .ping-body em { font-style: italic; color: var(--text); }
.bubble--assistant code,
.bubble--ping .ping-body code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 1px 5px;
  border-radius: 4px;
}

/* --- Composer --- */

.composer {
  display: flex; align-items: center; gap: 8px;
  padding: 10px;
  margin-bottom: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  flex-shrink: 0;
  transition: border-color 140ms ease;
}
.composer:focus-within { border-color: var(--accent); }

.composer-input {
  flex: 1;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  border: 0 none transparent !important;
  outline: 0 none transparent !important;
  outline-offset: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  color: var(--text);
  font-family: inherit;
  font-size: 16px;
  padding: 6px 8px;
  min-width: 0;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  -webkit-tap-highlight-color: transparent;
}
.composer-input:focus,
.composer-input:focus-visible,
.composer-input:active {
  outline: 0 none transparent !important;
  box-shadow: none !important;
  border: 0 none transparent !important;
}
.composer-input::placeholder { color: var(--text-faint); }

.composer-send {
  background: var(--accent);
  color: #FFFFFF;
  border: none;
  border-radius: 10px;
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, transform 80ms ease;
  flex-shrink: 0;
}
.composer-send:hover:not(:disabled)  { background: var(--accent-dim); }
.composer-send:active:not(:disabled) { transform: scale(0.95); }
.composer-send:disabled              { background: var(--bg-elev-2); color: var(--text-faint); cursor: not-allowed; }

/* ====================================================================
   DRAWER — slides in from the left.
   ==================================================================== */

.backdrop {
  position: fixed;
  inset: 0;
  background: rgba(29, 33, 36, 0.35);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 30;
  opacity: 0;
  transition: opacity 260ms ease;
}
.backdrop.is-open { opacity: 1; }
.backdrop[hidden] { display: block !important; pointer-events: none; opacity: 0; }
.backdrop.is-open { pointer-events: auto; }

.drawer {
  position: fixed;
  top: 0; left: 0;
  height: 100dvh;
  width: var(--drawer-w);
  background: var(--bg-elev-2);
  border-right: 1px solid var(--border);
  z-index: 40;
  transform: translateX(-100%);
  transition: transform 320ms cubic-bezier(0.32, 0.72, 0.24, 1.0);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-left: env(safe-area-inset-left);
  padding-bottom: env(safe-area-inset-bottom);
  will-change: transform;
  box-shadow: 4px 0 24px rgba(29, 33, 36, 0.10);
}
.drawer.is-open { transform: translateX(0); }

.drawer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.drawer-title {
  font-family: var(--font-serif);
  font-size: 18px;
  font-weight: 500;
  color: var(--text);
  letter-spacing: -0.005em;
}

.drawer-close {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 32px; height: 32px;
  border-radius: 8px;
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.drawer-close:hover { background: var(--bg-elev); color: var(--text); }

.drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* ====================================================================
   Buttons
   ==================================================================== */

.btn {
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  padding: 8px 14px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease, color 140ms ease;
  white-space: nowrap;
  color: var(--text);
}
.btn:active:not(:disabled) { transform: scale(0.97); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn--sm { padding: 5px 10px; font-size: 12px; }
.btn--full { width: 100%; }

.btn--primary        { background: var(--accent); color: #FFFFFF; }
.btn--primary:hover:not(:disabled) { background: var(--accent-dim); }

.btn--ghost          { background: var(--bg-elev); color: var(--text); border-color: var(--border); }
.btn--ghost:hover:not(:disabled)   { background: var(--bg-elev-2); border-color: var(--border-strong); }

.btn--danger-ghost   { background: transparent; color: var(--bad); border-color: transparent; }
.btn--danger-ghost:hover:not(:disabled) { background: var(--bad-soft); }

/* ====================================================================
   Sections shared: labels
   ==================================================================== */

.cals-label,
.notes-label,
.notif-label {
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.12em;
}

/* ====================================================================
   Calendars section (drawer)
   ==================================================================== */

.cals-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 2px 8px;
}

.cals-list { display: flex; flex-direction: column; gap: 10px; }

.cals-empty {
  text-align: center;
  padding: 18px 12px;
  color: var(--text-faint);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
}

.cal-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.cal-card-top {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 6px;
}

.cal-card-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cal-card-badge {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-dim);
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  padding: 2px 8px;
  border-radius: 10px;
  flex-shrink: 0;
}

.cal-card-meta {
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  margin-bottom: 10px;
}
.cal-card-meta--error { color: var(--bad); }

.cal-card-actions { display: flex; gap: 6px; }

.cal-card-error {
  margin-top: 8px;
  padding: 6px 10px;
  background: var(--bad-soft);
  border: 1px solid rgba(184, 87, 76, 0.3);
  border-radius: 6px;
  color: var(--bad);
  font-size: 12px;
}

/* --- Add-calendar form --- */

.add-cal {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}

.add-cal-label {
  display: block;
  font-size: 13px;
  color: var(--text);
  margin-bottom: 10px;
  font-weight: 500;
}

.add-cal-row {
  display: flex;
  gap: 8px;
  margin-bottom: 8px;
}
.add-cal-row:last-of-type { margin-bottom: 10px; }

.add-cal-input {
  flex: 1;
  background: var(--bg-sunk);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: var(--font-mono);
  font-size: 16px;
  padding: 9px 12px;
  outline: none;
  transition: border-color 140ms ease, background 140ms ease;
  min-width: 0;
}
.add-cal-input--name { font-family: inherit; }
.add-cal-input:focus { border-color: var(--accent); background: var(--bg-elev); }
.add-cal-input::placeholder { color: var(--text-faint); }

.add-cal-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ====================================================================
   Notes section (drawer)
   ==================================================================== */

.notes-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 2px 8px;
}
.notes-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notes-empty {
  text-align: center;
  padding: 16px 12px;
  color: var(--text-faint);
  font-size: 13px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
}
.note-card {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  transition: background 140ms ease, border-color 140ms ease;
  width: 100%;
  display: block;
}
.note-card:hover {
  background: var(--bg-elev-2);
  border-color: var(--border-strong);
}
.note-card-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  margin-bottom: 3px;
}
.note-card-preview {
  font-size: 12px;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  line-height: 1.4;
}
.note-card-preview:empty::before {
  content: 'Empty note';
  font-style: italic;
  color: var(--text-faint);
}

/* --- Full-screen note editor overlay --- */

.note-editor {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  padding-top: env(safe-area-inset-top);
  padding-bottom: env(safe-area-inset-bottom);
  padding-left: env(safe-area-inset-left);
  padding-right: env(safe-area-inset-right);
}
.note-editor[hidden] { display: none; }

.note-editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.note-editor-icon-btn {
  background: transparent;
  border: none;
  color: var(--text-dim);
  width: 40px; height: 40px;
  border-radius: var(--radius-sm);
  display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}
.note-editor-icon-btn:hover  { background: var(--bg-elev); color: var(--text); }
.note-editor-icon-btn:active { transform: scale(0.94); }
.note-editor-icon-btn--danger:hover { color: var(--bad); background: var(--bad-soft); }

.note-editor-status {
  flex: 1;
  text-align: center;
  font-size: 12px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-height: 16px;
  transition: color 120ms ease, opacity 300ms ease;
}
.note-editor-status.is-saving { color: var(--text-faint); opacity: 0.7; }
.note-editor-status.is-saved  { color: var(--good); }
.note-editor-status.is-error  { color: var(--bad); }

.note-editor-title {
  background: transparent;
  border: none;
  outline: none;
  padding: 18px 20px 4px;
  color: var(--text);
  font-family: var(--font-serif);
  font-size: 24px;
  font-weight: 500;
  letter-spacing: -0.01em;
  flex-shrink: 0;
}
.note-editor-title::placeholder { color: var(--text-faint); font-family: var(--font-sans); font-weight: 400; }

.note-editor-body {
  flex: 1;
  background: transparent;
  border: none;
  outline: none;
  padding: 8px 20px 20px;
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  resize: none;
  min-height: 0;
}
.note-editor-body::placeholder { color: var(--text-faint); }

/* ====================================================================
   Notifications section (drawer)
   ==================================================================== */

.notif {
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
}
.notif-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}
.notif-status {
  font-size: 11px;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.notif-status--on  { color: var(--good); }
.notif-status--off { color: var(--text-dim); }
.notif-status--denied { color: var(--bad); }
.notif-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.notif-hint {
  font-size: 12px;
  color: var(--text-dim);
  line-height: 1.45;
}

/* ====================================================================
   Ping bubble — a proactive message with an ack button
   ==================================================================== */

.bubble--ping {
  align-self: stretch;
  background: var(--bg-elev);
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  color: var(--text);
  border-radius: var(--radius);
  position: relative;
  padding: 14px 16px 10px;
}

.bubble--ping .ping-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--accent);
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.bubble--ping .ping-time {
  color: var(--text-faint);
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
  text-transform: none;
}

.bubble--ping .ping-body {
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  white-space: pre-wrap;
  word-wrap: break-word;
  margin-bottom: 12px;
}

.bubble--ping .ping-ack {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elev-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-family: inherit;
  font-size: 13px;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, transform 80ms ease;
}
.bubble--ping .ping-ack:hover:not(:disabled) {
  background: var(--accent-soft);
  border-color: var(--accent);
}
.bubble--ping .ping-ack:active:not(:disabled) { transform: scale(0.97); }
.bubble--ping .ping-ack .check {
  width: 14px; height: 14px;
  border: 1.5px solid var(--text-faint);
  border-radius: 3px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all 140ms ease;
}
.bubble--ping .ping-ack:hover .check { border-color: var(--accent); }

/* Acked state — fades to a plain assistant bubble */
.bubble--ping.is-acked {
  border-left-color: var(--border);
  border-left-width: 1px;
  animation: none;
  background: var(--bg-elev-2);
}
.bubble--ping.is-acked .ping-header { color: var(--text-faint); }
.bubble--ping.is-acked .ping-time { color: var(--text-faint); }
.bubble--ping.is-acked .ping-ack {
  color: var(--text-faint);
  border-color: var(--border);
  pointer-events: none;
  background: transparent;
}
.bubble--ping.is-acked .ping-ack .check {
  border-color: var(--good);
  background: var(--good);
}
.bubble--ping.is-acked .ping-ack .check::after {
  content: '';
  width: 4px; height: 8px;
  border-right: 2px solid #FFFFFF;
  border-bottom: 2px solid #FFFFFF;
  transform: rotate(45deg) translate(-1px, -1px);
}

/* Ack-all button */
.ack-all-row {
  align-self: stretch;
  display: flex;
  justify-content: flex-end;
  margin: -4px 0 2px;
}
.ack-all-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  font-family: inherit;
  font-size: 12px;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 4px;
  transition: color 140ms ease, background 140ms ease;
  font-weight: 500;
}
.ack-all-btn:hover {
  color: var(--accent-dim);
  background: var(--accent-soft);
}

/* ====================================================================
   Drop zone (drawer, one-off ics)
   ==================================================================== */

.dropzone {
  position: relative;
  border: 1.5px dashed var(--border-strong);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 14px 16px;
  text-align: center;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }

.dropzone-inner { position: relative; z-index: 1; }
.dropzone-title { font-size: 13px; color: var(--text-dim); }
.dropzone-sub   { color: var(--text-dim); font-size: 12px; margin-top: 2px; }

.dropzone-link {
  background: none; border: none;
  color: var(--accent);
  font-family: inherit; font-size: 12px;
  cursor: pointer; padding: 0;
  text-decoration: underline;
  text-underline-offset: 3px;
}
.dropzone-link:hover { color: var(--accent-dim); }

.dropzone-overlay {
  position: absolute; inset: 0;
  border-radius: var(--radius);
  background: rgba(14, 90, 104, 0.08);
  border: 2px dashed var(--accent);
  display: flex; align-items: center; justify-content: center;
  opacity: 0; pointer-events: none;
  transition: opacity 140ms ease;
}
.dropzone-overlay-text { font-size: 14px; font-weight: 500; color: var(--accent); }
.dropzone.is-dragging { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragging .dropzone-overlay { opacity: 1; }
.dropzone.is-flash { border-color: var(--good); background: var(--good-soft); }

/* ====================================================================
   Focus / motion / small screens
   ==================================================================== */

button:focus-visible,
input:focus-visible,
textarea:focus-visible,
.dropzone:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
/* Composer input specifically — the card border handles focus feedback via
   :focus-within, so we don't want a second box around the input itself. */
.composer-input:focus-visible { outline: none; }

@media (prefers-reduced-motion: reduce) {
  /* Decorative motion — bubble entry fades, dropzone hover states.
     Killed under Reduce Motion. The drawer slide, backdrop fade, and
     thinking dots are intentionally exempted: those are functional
     (wayfinding, loading feedback), not decoration. */
  .bubble, .dropzone, .dropzone-overlay, .chat {
    animation: none; transition: none;
  }
}

@media (max-width: 380px) {
  .add-cal-row     { flex-direction: column; }
  .add-cal-row .btn { width: 100%; }
  .cal-card-top    { flex-wrap: wrap; }
}
