:root {
  --ink: #16213e;
  --ink-soft: #22325c;
  --paper: #f8f6f2;
  --surface: #ffffff;
  --mint: #2fa98c;
  --signal: #e8743b;
  --danger: #c0392b;
  --blue: #4c6fb1;
  --line: #e5e1d8;
  --slate: #5a6478;
  --user-bubble: #eef1f8;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--paper);
  color: var(--ink);
}

.hidden { display: none !important; }

.boot-screen {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: linear-gradient(145deg, var(--ink), var(--ink-soft));
  color: #fff;
  text-align: center;
}
.boot-screen h1 { margin: 0; font-size: 2rem; }
.tagline { color: rgba(255,255,255,0.75); margin: 0.25rem 0 1rem; }
.boot-status { color: rgba(255,255,255,0.6); font-size: 0.95rem; }
.sidebar-hint { font-size: 0.85rem; color: var(--slate); line-height: 1.4; margin: 0.5rem 0; }
.sidebar-future { font-size: 0.8rem; color: var(--slate); opacity: 0.85; margin-top: 1rem; line-height: 1.35; }

/* Three-panel workspace — responsive app layout */
.workspace,
.app-layout-container {
  height: 100vh;
  min-height: 0;
  overflow: hidden;
}

.mobile-toolbar,
.sidebar-backdrop,
.agenda-sheet-backdrop,
.agenda-sheet-handle,
.agenda-sheet-close,
.sidebar-close {
  display: none;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
}
.calendar-header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}
.btn-create-event {
  background: #1a73e8;
  color: #fff;
  font-size: 0.8rem;
  padding: 0.45rem 0.85rem;
  white-space: nowrap;
}

/* Desktop ≥1200px — classic 3-column dashboard */
@media (min-width: 1200px) {
  .workspace {
    display: grid;
    grid-template-columns: 260px 1fr 340px;
    grid-template-rows: 1fr;
  }
  .workspace-main {
    display: contents;
  }
  .chat-panel { grid-column: 2; }
  .calendar-panel { grid-column: 3; }
}

/* Tablet 768–1199px — split chat + calendar, sidebar drawer */
@media (min-width: 768px) and (max-width: 1199px) {
  .workspace {
    display: grid;
    grid-template-rows: auto 1fr;
    grid-template-columns: 1fr;
  }
  .mobile-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    grid-row: 1;
  }
  .toolbar-title {
    margin: 0;
    font-size: 1rem;
    font-weight: 700;
    color: var(--ink);
  }
  .toolbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--ink);
  }
  .toolbar-btn:hover { background: rgba(0, 0, 0, 0.06); }
  .toolbar-agenda { position: relative; }
  .agenda-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--signal);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }
  .agenda-badge:empty,
  .agenda-badge[data-zero="true"] { display: none; }
  .workspace-main {
    display: grid;
    grid-template-columns: 1fr 1fr;
    grid-row: 2;
    min-height: 0;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--paper);
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
  }
  .sidebar-close:hover { background: rgba(255, 255, 255, 0.1); }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
}

/* Mobile <768px — full-width chat, bottom-sheet agenda */
@media (max-width: 767px) {
  .workspace {
    display: flex;
    flex-direction: column;
    height: 100vh;
  }
  .mobile-toolbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.5rem 0.75rem;
    background: var(--surface);
    border-bottom: 1px solid var(--line);
    flex-shrink: 0;
  }
  .toolbar-title {
    margin: 0;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--ink);
  }
  .toolbar-btn {
    width: 40px;
    height: 40px;
    border: none;
    background: transparent;
    border-radius: 50%;
    font-size: 1.15rem;
    cursor: pointer;
    color: var(--ink);
  }
  .toolbar-btn:hover { background: rgba(0, 0, 0, 0.06); }
  .toolbar-agenda { position: relative; }
  .agenda-badge {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 16px;
    height: 16px;
    padding: 0 4px;
    border-radius: 999px;
    background: var(--signal);
    color: #fff;
    font-size: 0.6rem;
    font-weight: 700;
    line-height: 16px;
    text-align: center;
  }
  .agenda-badge[data-zero="true"] { display: none; }
  .workspace-main {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
  }
  .chat-panel {
    flex: 1;
    border-left: none;
  }
  .calendar-panel {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    height: min(88vh, 720px);
    z-index: 60;
    transform: translateY(100%);
    transition: transform 0.32s cubic-bezier(0.4, 0, 0.2, 1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.18);
    border-left: none;
    border-top: 1px solid var(--line);
  }
  .calendar-panel.open { transform: translateY(0); }
  .agenda-sheet-handle {
    display: block;
    width: 40px;
    height: 4px;
    background: #dadce0;
    border-radius: 999px;
    margin: 8px auto 0;
    flex-shrink: 0;
  }
  .agenda-sheet-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    font-size: 1.5rem;
    color: var(--slate);
    cursor: pointer;
    border-radius: 50%;
  }
  .agenda-sheet-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 55;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .agenda-sheet-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 280px;
    z-index: 80;
    transform: translateX(-100%);
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 24px rgba(0, 0, 0, 0.15);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border: none;
    background: transparent;
    color: var(--paper);
    font-size: 1.4rem;
    cursor: pointer;
    border-radius: 50%;
  }
  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 70;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s;
  }
  .sidebar-backdrop.visible {
    opacity: 1;
    pointer-events: auto;
  }
  .grid-hint { display: none; }
  .panel-header h2 { font-size: 1rem; }
  .msg { max-width: 95%; }
  .chat-input-bar { padding: 0.65rem 0.85rem; }
  .chat-input-bar input { font-size: 16px; }
}

.sidebar {
  background: var(--ink);
  color: var(--paper);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.sidebar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.sidebar-header h1 { margin: 0; font-size: 1.15rem; }
.sidebar-user { font-size: 0.8rem; opacity: 0.75; margin: 0; }
.sidebar-actions { display: flex; flex-direction: column; gap: 0.4rem; }

@media (max-width: 767px) {
  .sidebar-actions { flex-direction: column; }
}

.workspace-main {
  min-height: 0;
}

.chat-panel, .calendar-panel {
  display: flex;
  flex-direction: column;
  min-height: 0;
  background: var(--surface);
  border-left: 1px solid var(--line);
}
.chat-panel { background: var(--paper); border-left: none; }

.panel-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.panel-header h2 { margin: 0; font-size: 1.1rem; }
.panel-sub { margin: 0.2rem 0 0; font-size: 0.8rem; color: var(--slate); }

.messages {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.msg {
  max-width: 90%;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
}
.msg.user {
  align-self: flex-end;
  background: var(--ink);
  color: var(--paper);
  border-bottom-right-radius: 4px;
}
.msg.suzan {
  align-self: flex-start;
  background: var(--surface);
  border: 1px solid var(--line);
  border-bottom-left-radius: 4px;
}
.msg .sender {
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.3rem;
  color: var(--mint);
}

.recommendations { margin-top: 0.65rem; display: flex; flex-direction: column; gap: 0.4rem; }
.rec-card {
  background: var(--user-bubble);
  border-radius: 8px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
}
.rec-card strong { display: block; margin-bottom: 0.1rem; }
.rec-card a { color: var(--mint); font-weight: 600; font-size: 0.8rem; }
.rec-card-mapstore {
  border: 1px solid #c2d7fc;
  background: #f8fbff;
}
.rec-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #1a73e8;
  margin-bottom: 0.25rem;
}
.rec-offers {
  list-style: none;
  margin: 0.5rem 0 0.35rem;
  padding: 0;
  border-top: 1px solid #e8eaed;
}
.rec-offer {
  padding: 0.4rem 0;
  font-size: 0.8rem;
  border-bottom: 1px solid #f1f3f4;
}
.rec-offer:last-child { border-bottom: none; }
.rec-offer strong { display: block; color: var(--ink); font-size: 0.82rem; }
.rec-offer span { color: var(--slate); font-size: 0.75rem; }

.reminder-cards { margin-top: 0.5rem; display: flex; flex-direction: column; gap: 0.35rem; }
.reminder-chip {
  background: var(--user-bubble);
  padding: 0.45rem 0.65rem;
  border-radius: 8px;
  font-size: 0.8rem;
}
.reminder-chip .urgency.urgent { color: var(--signal); }
.reminder-chip .urgency.overdue { color: var(--danger); }

.chat-input-bar {
  display: flex;
  gap: 0.5rem;
  padding: 0.85rem 1.25rem;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.chat-input-bar input {
  flex: 1;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  font-size: 0.95rem;
}
.btn-mic {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: var(--surface);
  font-size: 1.1rem;
  cursor: pointer;
  flex-shrink: 0;
}
.btn-mic.mic-active {
  background: #fce8e6;
  border-color: #ea4335;
  animation: pulse-mic 1.2s infinite;
}
.btn-mic.mic-wake {
  background: #e8f0fe;
  border-color: #1a73e8;
  animation: pulse-mic 2s infinite;
}
.voice-status {
  padding: 0.35rem 1.25rem 0;
  margin: 0;
  font-size: 0.8rem;
  color: #1a73e8;
  font-style: italic;
}
@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(234, 67, 53, 0.35); }
  50% { box-shadow: 0 0 0 8px rgba(234, 67, 53, 0); }
}
.typing { padding: 0 1.25rem 0.5rem; font-size: 0.85rem; color: var(--slate); font-style: italic; }

/* Enriched calendar timeline */
/* Month grid */
.month-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--line);
}
.month-label {
  font-weight: 700;
  text-transform: capitalize;
  font-size: 0.95rem;
}
.btn.icon {
  background: transparent;
  border: 1px solid var(--line);
  width: 32px;
  height: 32px;
  padding: 0;
  border-radius: 8px;
  font-size: 1.2rem;
  line-height: 1;
  color: var(--ink);
}

.month-grid {
  padding: 0.75rem 1rem 0.25rem;
  border-bottom: 1px solid var(--line);
}
.grid-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  margin-bottom: 4px;
}
.grid-weekdays span {
  text-align: center;
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--slate);
  text-transform: uppercase;
}
.grid-days {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
}
.grid-day {
  aspect-ratio: 1;
  border: 1px solid transparent;
  border-radius: 8px;
  background: var(--paper);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 2px;
  font: inherit;
  color: var(--ink);
}
.grid-day.empty { visibility: hidden; pointer-events: none; }
.grid-day.today { border-color: var(--ink); font-weight: 700; }
.grid-day.selected { background: var(--ink); color: var(--paper); }
.grid-day.in-range {
  background: #e8f0fe;
  color: var(--ink);
  border-radius: 0;
}
.grid-day.range-start {
  background: #1a73e8;
  color: #fff;
  border-radius: 8px 0 0 8px;
}
.grid-day.range-end {
  background: #1a73e8;
  color: #fff;
  border-radius: 0 8px 8px 0;
}
.grid-day.range-start.range-end { border-radius: 8px; }
.grid-day.in-range:not(.range-start):not(.range-end) { border-radius: 0; }
.grid-day.dragging { cursor: grabbing; }
.grid-day.selected .dot { opacity: 1; }
.grid-day-num { font-size: 0.8rem; line-height: 1; }
.grid-dots {
  display: flex;
  gap: 2px;
  margin-top: 2px;
  min-height: 5px;
}
.dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  display: inline-block;
}
.dot-deadline { background: var(--signal); }
.dot-trigger { background: var(--blue); }
.dot-event { background: var(--mint); }
.grid-day.selected .dot-deadline { background: #ffb366; }
.grid-day.selected .dot-trigger { background: #8eb4ff; }
.grid-day.selected .dot-event { background: #6ee7c0; }
.grid-hint {
  font-size: 0.72rem;
  color: var(--slate);
  padding: 0.35rem 1rem;
  margin: 0;
  border-bottom: 1px solid var(--line);
}
.range-hint {
  font-size: 0.78rem;
  color: #1a73e8;
  background: #e8f0fe;
  padding: 0.45rem 1rem;
  margin: 0;
  font-weight: 500;
  border-bottom: 1px solid #d2e3fc;
}

.day-action-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(32, 33, 36, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 900;
}
.day-action-sheet {
  background: var(--surface);
  border-radius: 12px;
  padding: 1.25rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.18);
}
.day-action-title {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  font-weight: 600;
  text-transform: capitalize;
}
.day-action-sub {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--slate);
}
.day-action-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.day-action-btn {
  width: 100%;
  text-align: left;
  padding: 0.75rem 1rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--paper);
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
  color: var(--ink);
}
.day-action-btn:hover { background: #f8f9fa; }
.day-action-btn.primary {
  background: #1a73e8;
  color: #fff;
  border-color: #1a73e8;
  text-align: center;
  font-weight: 500;
}
.day-action-btn.primary:hover { background: #1765cc; }
.day-action-btn.text {
  border: none;
  background: transparent;
  color: var(--slate);
  text-align: center;
  margin-top: 0.25rem;
}

.timeline {
  flex: 1;
  overflow-y: auto;
  padding: 0.75rem 1rem 1.5rem;
}
.empty-timeline { color: var(--slate); font-size: 0.9rem; padding: 1rem; }

.timeline-day { margin-bottom: 1.25rem; }
.timeline-date {
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: capitalize;
  color: var(--ink);
  margin: 0 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 2px solid var(--ink);
}
.timeline-items { list-style: none; padding: 0; margin: 0; }

.timeline-item {
  padding: 0.55rem 0.65rem;
  margin-bottom: 0.35rem;
  border-radius: 8px;
  border-left: 3px solid var(--line);
  background: var(--paper);
  font-size: 0.85rem;
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}
.timeline-item.kind-deadline { border-left-color: var(--signal); }
.timeline-item.kind-trigger { border-left-color: var(--blue); }
.timeline-item.kind-event { border-left-color: var(--mint); }
.timeline-item.urgent { background: #fff8f0; }
.timeline-item.overdue { background: #fff0f0; }

.ti-kind { font-size: 0.65rem; font-weight: 700; text-transform: uppercase; color: var(--slate); }
.ti-time { font-size: 0.75rem; color: var(--blue); }
.ti-source { font-size: 0.7rem; color: var(--slate); }
.ti-sub { font-size: 0.75rem; color: var(--slate); }

.btn {
  border: none;
  cursor: pointer;
  font-weight: 600;
  border-radius: 999px;
  padding: 0.65rem 1.1rem;
}
.btn.primary, .btn.send { background: var(--ink); color: var(--paper); }
.btn.small {
  padding: 0.4rem 0.65rem;
  font-size: 0.75rem;
  background: rgba(255,255,255,0.1);
  color: var(--paper);
  border: 1px solid rgba(255,255,255,0.2);
}
.btn.small.primary { background: var(--mint); border-color: var(--mint); }
.icon-btn { background: none; border: none; color: var(--paper); cursor: pointer; opacity: 0.8; }
.error { color: var(--danger); }

body.sidebar-open,
body.agenda-open {
  overflow: hidden;
}
