/* ── CSS Variables ─────────────────────────────────── */
:root {
  /* Core palette - warm, calm, ADHD-friendly */
  --bg:            #f4eee6;
  --panel:         rgba(255, 251, 246, 0.88);
  --ink:           #23312d;
  --muted:         #697872;
  --border:        rgba(90, 109, 103, 0.16);

  /* Accent — forest green */
  --accent:        #2f7a6a;
  --accent-dark:   #25584d;
  --accent-light:  #deede7;

  /* Block gradients */
  --task-start:    #2f7a6a;
  --task-end:      #66ab96;
  --fixed-start:   #c98a46;
  --fixed-end:     #e1ae72;
  --break-start:   #9ab7c4;
  --break-end:     #afc9d3;

  /* Legacy aliases (kept for JS references) */
  --amber:         #e8940a;
  --amber-light:   #fff8e6;
  --green:         #34b97e;
  --green-light:   #edf9f3;
  --now-line:      #ea7b5d;

  /* Shadows */
  --shadow-xs:     0 1px 4px rgba(35, 49, 45, 0.05);
  --shadow-sm:     0 8px 22px rgba(35, 49, 45, 0.08);
  --shadow:        0 22px 56px rgba(35, 49, 45, 0.10);
  --shadow-accent: 0 4px 18px rgba(47, 122, 106, 0.25);

  /* Shape */
  --radius-sm: 12px;
  --radius:    18px;
  --radius-lg: 28px;

  /* Motion */
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ease-out:    cubic-bezier(0, 0, 0.2, 1);
  --dur-fast:    0.18s;
  --dur:         0.3s;
  --dur-slow:    0.5s;
}

/* ── Reset / Base ──────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(255, 230, 200, 0.55) 0%, transparent 65%),
    radial-gradient(ellipse 55% 45% at 90% 100%, rgba(230, 225, 255, 0.45) 0%, transparent 65%),
    var(--bg);
  color: var(--ink);
  min-height: 100vh;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ────────────────────────────────────────── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

/* Draft mode locks to viewport so columns don't page-scroll */
.app-shell.draft-mode {
  height: 100dvh;
  overflow: hidden;
}

.app-header {
  padding: 14px 28px;
  border-bottom: 1px solid var(--border);
  background: linear-gradient(130deg, var(--panel) 0%, #f7f4ff 100%);
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-xs);
  flex-shrink: 0;
  position: sticky;
  top: 0;
  z-index: 100;
}

.app-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -0.4px;
  margin: 0;
}

.session-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}


.session-date-label {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
}

.session-planned-at {
  font-size: 0.76rem;
  color: var(--muted);
  font-style: italic;
  font-weight: 500;
}

.app-body {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  overflow-y: auto;
  padding: 28px 20px 72px;
}

/* ── Calendar Column ───────────────────────────────── */
.calendar-column {
  position: relative;
  width: 100%;
  max-width: 660px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Body scrollbar styles */
body::-webkit-scrollbar { width: 5px; }
body::-webkit-scrollbar-track { background: transparent; }
body::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}
body::-webkit-scrollbar-thumb:hover { background: var(--muted); }

.calendar-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
  flex-shrink: 0;
  position: relative;
}

.calendar-panel-title {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--muted);
  padding: 14px 18px 10px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.calendar-time-display {
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: none;
  color: var(--accent);
}

/* ── Calendar Inner ────────────────────────────────── */
.calendar-scroll {
  overflow: visible;
  padding-top: 18px;  /* buffer so first hour label doesn't bleed into the Schedule title */
}

.calendar-grid {
  display: flex;
  position: relative;
  min-height: 200px;
}

.calendar-time-axis {
  width: 54px;
  flex-shrink: 0;
  position: relative;
  border-right: 1px solid var(--border);
  background: rgba(253, 248, 240, 0.6);
}

.hour-label {
  position: absolute;
  right: 9px;
  font-size: 0.67rem;
  font-weight: 600;
  color: var(--muted);
  transform: translateY(-50%);
  line-height: 1;
  user-select: none;
  letter-spacing: 0.3px;
}

.calendar-events {
  flex: 1;
  position: relative;
  background: var(--panel);
}

.hour-tick {
  position: absolute;
  left: 0;
  right: 0;
  height: 1px;
  background: var(--border);
  opacity: 0.7;
}

.hour-tick--half {
  background: var(--border);
  opacity: 0.3;
}

/* ── Calendar Blocks ───────────────────────────────── */
@keyframes blockIn {
  from {
    opacity: 0;
    transform: translateX(-6px) scaleX(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scaleX(1);
  }
}

.calendar-block {
  position: absolute;
  left: 7px;
  right: 7px;
  border-radius: var(--radius-sm);
  padding: 5px 10px;
  overflow: hidden;
  cursor: default;
  display: flex;
  flex-direction: column;
  justify-content: center;
  animation: blockIn 0.45s var(--ease-spring) both;
  transition:
    box-shadow var(--dur-fast) var(--ease-smooth),
    transform   var(--dur-fast) var(--ease-smooth);
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.calendar-block--task {
  background: linear-gradient(140deg, var(--task-start) 0%, var(--task-end) 100%);
  color: #fff;
}

.calendar-block--fixed {
  background: linear-gradient(140deg, var(--fixed-start) 0%, var(--fixed-end) 100%);
  color: #fff;
}

.calendar-block--break {
  background: linear-gradient(140deg, var(--break-start) 0%, var(--break-end) 100%);
  color: #fff;
}

.block-time {
  font-size: 0.62rem;
  font-weight: 600;
  opacity: 0.85;
  line-height: 1.2;
  white-space: nowrap;
  letter-spacing: 0.2px;
}

.block-task {
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.block-lock {
  font-size: 0.6rem;
  margin-right: 3px;
  vertical-align: middle;
  opacity: 0.85;
  line-height: 1;
}

.calendar-block--compact .block-time {
  display: none;
}

.calendar-block--compact .block-task {
  font-size: 0.72rem;
}

/* ── Micro blocks (very short tasks rendered as compact pills) ── */
.calendar-block--micro {
  padding: 0 10px;
  justify-content: center;
  border-radius: 8px;
}

.block-micro-inner {
  display: flex;
  align-items: center;
  gap: 5px;
  overflow: hidden;
  min-width: 0;
}

.block-micro-time {
  font-size: 0.6rem;
  font-weight: 600;
  opacity: 0.78;
  white-space: nowrap;
  flex-shrink: 0;
}

.block-micro-label {
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.calendar-block--micro:hover {
  min-height: 0;
  overflow: hidden;
}

.calendar-block:hover {
  z-index: 50;
  overflow: visible;
  min-height: 50px;
  transform: translateX(-2px);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.16),
    inset 0 1px 0 rgba(255, 255, 255, 0.22);
}

.calendar-block:hover .block-time {
  display: block !important;
}

.calendar-block:hover .block-task {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
}

/* ── Now Line ──────────────────────────────────────── */
.now-line {
  position: absolute;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--now-line);
  z-index: 10;
  pointer-events: none;
  box-shadow: 0 0 8px rgba(255, 123, 107, 0.5);
}

.now-line::before {
  content: '';
  position: absolute;
  left: -5px;
  top: -5px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--now-line);
  box-shadow: 0 0 10px rgba(255, 123, 107, 0.55);
}

/* ── Drag / Drop ─────────────────────────────────── */
.calendar-block.is-draggable { cursor: grab; }
.calendar-block.is-draggable:active { cursor: grabbing; }

.calendar-block.is-dragging {
  opacity: 0.35 !important;
  transform: none !important;
  animation: none !important;
  transition: none !important;
  box-shadow: none;
}

.calendar-block--fixed { cursor: default; }

.drag-drop-indicator {
  position: absolute;
  left: 4px;
  right: 4px;
  height: 3px;
  border-radius: 2px;
  background: var(--accent);
  box-shadow: 0 0 6px rgba(47, 122, 106, 0.6);
  pointer-events: none;
  z-index: 60;
  opacity: 0;
  transform: scaleX(0.95);
  transition: opacity 0.1s ease, transform 0.1s ease;
}
.drag-drop-indicator.visible {
  opacity: 1;
  transform: scaleX(1);
}
.drag-drop-indicator.indicator--error {
  background: #ff7b6b;
  box-shadow: 0 0 6px rgba(255, 123, 107, 0.6);
}

/* Drag handle dot-grid icon on draggable blocks */
.drag-handle {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: rgba(255, 255, 255, 0.6);
  pointer-events: none;
  user-select: none;
  transition: color 0.15s ease;
}
.calendar-block.is-draggable:hover .drag-handle {
  color: rgba(255, 255, 255, 0.95);
}
/* Micro blocks: hide handle (no room) */
.calendar-block--micro .drag-handle { display: none; }

/* Drag-to-reorder hint below Adjust button */
.drag-reorder-hint {
  display: block;
  font-size: 14px;
  color: #666;
  text-align: center;
  letter-spacing: 0.01em;
}

/* Undo button after a drag move */
.drag-undo-btn {
  display: none;
  width: 100%;
  margin-top: 4px;
  padding: 6px 0;
  background: none;
  border: none;
  font-family: inherit;
  font-size: 13px;
  color: var(--accent);
  cursor: pointer;
  text-align: center;
  text-decoration: underline;
  text-underline-offset: 2px;
}
.drag-undo-btn:hover { opacity: 0.75; }

/* Toast for rejected drops */
.drag-toast {
  position: fixed;
  bottom: 80px;
  left: 50%;
  transform: translateX(-50%) translateY(8px);
  background: rgba(30, 30, 30, 0.88);
  color: #fff;
  font-size: 13px;
  padding: 8px 16px;
  border-radius: 20px;
  pointer-events: none;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.drag-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Empty / Loading States ────────────────────────── */
.calendar-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 500;
  gap: 12px;
  padding: 48px 40px;
  text-align: center;
  line-height: 1.6;
}

.calendar-empty svg {
  opacity: 0.22;
  color: var(--accent);
}

.calendar-loading {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 220px;
  gap: 10px;
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 600;
}

.spinner {
  width: 22px;
  height: 22px;
  border: 2.5px solid var(--accent-light);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.75s linear infinite;
  flex-shrink: 0;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.knot-canvas {
  display: block;
  flex-shrink: 0;
}

/* ── Right Now Section ─────────────────────────────── */
@keyframes panelIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

.right-now-section {
  display: none;
}

.right-now-section.visible {
  display: flex;
  flex-direction: column;
  gap: 14px;
  animation: panelIn 0.4s var(--ease-out) both;
}

.right-now-heading {
  font-size: 2.2rem;
  font-weight: 800;
  letter-spacing: -0.8px;
  color: var(--ink);
  line-height: 1.1;
}

.right-now-section ul {
  margin: 0;
  padding: 0 0 0 20px;
  font-size: 0.95rem;
  font-weight: 500;
  line-height: 1.85;
  color: var(--ink);
}

.right-now-section .empty-note {
  font-size: 0.88rem;
  color: var(--muted);
  font-style: italic;
  font-weight: 400;
}

/* ── Sidebar (draft mode only) ─────────────────────── */
.sidebar {
  display: none;
  border-left: 1px solid var(--border);
  background: var(--panel);
  overflow-y: auto;
  padding: 24px 20px;
  flex-direction: column;
  gap: 24px;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.sidebar-section label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  display: block;
}

/* ── Form Elements ─────────────────────────────────── */
textarea,
input[type="text"],
input[type="time"] {
  width: 100%;
  padding: 11px 14px;
  font-size: 0.9rem;
  font-weight: 500;
  font-family: inherit;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg);
  color: var(--ink);
  resize: vertical;
  transition:
    border-color  var(--dur-fast) var(--ease-smooth),
    background    var(--dur-fast) var(--ease-smooth),
    box-shadow    var(--dur-fast) var(--ease-smooth);
  line-height: 1.5;
}

textarea:focus,
input[type="text"]:focus,
input[type="time"]:focus {
  outline: none;
  border-color: var(--accent);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(47, 122, 106, 0.13);
}

textarea {
  min-height: 108px;
}

textarea::placeholder,
input::placeholder {
  color: var(--muted);
  font-weight: 400;
  opacity: 0.75;
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  padding: 11px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.9rem;
  font-family: inherit;
  font-weight: 700;
  cursor: pointer;
  transition:
    background   var(--dur-fast) var(--ease-smooth),
    box-shadow   var(--dur-fast) var(--ease-smooth),
    transform    var(--dur-fast) var(--ease-spring),
    opacity      var(--dur-fast) var(--ease-smooth);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  letter-spacing: 0.1px;
  user-select: none;
  -webkit-user-select: none;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent) 0%, #4d9983 100%);
  color: #fff;
  box-shadow: var(--shadow-accent);
}

.btn-primary:hover:not(:disabled) {
  background: linear-gradient(135deg, var(--accent-dark) 0%, #428973 100%);
  box-shadow: 0 6px 24px rgba(47, 122, 106, 0.32);
  transform: translateY(-1px);
}

.btn-primary:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 10px rgba(47, 122, 106, 0.22);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

.btn-secondary {
  background: var(--accent-light);
  color: var(--accent);
}

.btn-secondary:hover:not(:disabled) {
  background: #c8ddd8;
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(47, 122, 106, 0.15);
}

.btn-secondary:active {
  transform: translateY(0) scale(0.97);
}

.btn-fresh {
  background: linear-gradient(135deg, #2eaf76 0%, #5dd4a0 100%);
  color: #fff;
  box-shadow: 0 4px 18px rgba(46, 175, 118, 0.28);
}

.btn-fresh:hover:not(:disabled) {
  background: linear-gradient(135deg, #259966 0%, #4cc492 100%);
  box-shadow: 0 6px 24px rgba(46, 175, 118, 0.38);
  transform: translateY(-1px);
}

.btn-fresh:active {
  transform: translateY(0) scale(0.97);
  box-shadow: 0 2px 10px rgba(46, 175, 118, 0.22);
}

.btn-icon {
  font-size: 1rem;
  display: flex;
  align-items: center;
}

/* ── Advanced Options ──────────────────────────────── */
.advanced-toggle {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-family: inherit;
  text-align: left;
  transition: color var(--dur-fast) var(--ease-smooth);
}

.advanced-toggle:hover {
  color: var(--accent);
}

.advanced-options {
  display: none;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}

@keyframes expandIn {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.advanced-options.open {
  display: flex;
  animation: expandIn 0.25s var(--ease-out) both;
}

.advanced-options label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.7px;
  color: var(--muted);
}

/* ── Follow-up Section ─────────────────────────────── */
.followup-section {
  display: none;
  flex-direction: column;
  gap: 12px;
}

@keyframes slideUp {
  from { opacity: 0; transform: translateY(14px); }
  to   { opacity: 1; transform: translateY(0); }
}

.followup-section.visible {
  display: flex;
  animation: slideUp 0.45s var(--ease-spring) both;
}

.followup-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
}

.followup-hint {
  font-size: 0.84rem;
  font-weight: 500;
  color: var(--muted);
  margin: -6px 0 0;
  font-style: italic;
}

/* ── Confidence Bar ────────────────────────────────── */
.confidence-row {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 10px 13px;
  background: var(--accent-light);
  border-radius: var(--radius-sm);
}

.confidence-value {
  font-weight: 800;
  color: var(--accent);
}

.confidence-bar-wrap {
  flex: 1;
  min-width: 60px;
  height: 7px;
  background: rgba(47, 122, 106, 0.15);
  border-radius: 999px;
  overflow: hidden;
}

.confidence-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent) 0%, #b8adff 100%);
  border-radius: 999px;
  transition: width 0.65s var(--ease-spring);
}

/* ── Error Banner ──────────────────────────────────── */
@keyframes shakeIn {
  0%   { transform: translateX(0); }
  25%  { transform: translateX(-5px); }
  50%  { transform: translateX(5px); }
  75%  { transform: translateX(-3px); }
  100% { transform: translateX(0); }
}

.error-banner {
  background: #fff5f5;
  border: 1.5px solid #fcc;
  color: #c0392b;
  border-radius: var(--radius-sm);
  padding: 11px 14px;
  font-size: 0.85rem;
  font-weight: 600;
  display: none;
}

.error-banner.visible {
  display: block;
  animation: shakeIn 0.35s var(--ease-out) both;
}

/* ── Meta / Tags ───────────────────────────────────── */
.meta-row {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  border-radius: 999px;
  background: var(--accent-light);
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 700;
  margin: 2px 3px 2px 0;
}

/* ── Welcome Overlay ───────────────────────────────── */
.welcome-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 70% 50% at 10% 0%, rgba(255, 230, 200, 0.55) 0%, transparent 65%),
    radial-gradient(ellipse 55% 45% at 90% 100%, rgba(230, 225, 255, 0.45) 0%, transparent 65%),
    var(--bg);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 24px;
}

@keyframes cardIn {
  from { opacity: 0; transform: translateY(16px) scale(0.98); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

.welcome-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 40px 36px 32px;
  width: 100%;
  max-width: 480px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  animation: cardIn 0.4s var(--ease-spring) both;
}

.live-clock {
  font-size: 3rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -1.5px;
  line-height: 1;
  text-align: center;
}

.clock-its { color: var(--ink); font-weight: 700; }
#live-clock-time { color: var(--accent); }

.welcome-heading {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.4;
  text-align: center;
}

.welcome-textarea {
  min-height: 120px;
}

.welcome-btn {
  width: 100%;
}

.loading-card {
  align-items: center;
  text-align: center;
  gap: 22px;
}

.loading-spinner {
  width: 36px;
  height: 36px;
  border-width: 3.5px;
}

.loading-label {
  font-size: 1rem;
  font-weight: 600;
  color: var(--ink);
}

.progress-bar-wrap {
  width: 100%;
  height: 8px;
  background: rgba(47, 122, 106, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f7a6a 0%, #72b59f 100%);
  border-radius: 999px;
  transition: width 1s ease-in-out;
}

.followup-textarea--small { min-height: 58px !important; resize: none; }

/* ── Inline Replan Loading Overlay ─────────────────── */
.replan-loading-overlay {
  position: absolute;
  inset: 0;
  z-index: 30;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding: 40px;
  animation: cardIn 0.25s var(--ease-out) both;
}

.replan-spinner {
  width: 30px;
  height: 30px;
  border-width: 3px;
}

.replan-loading-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--ink);
}

.replan-progress-wrap {
  width: 100%;
  max-width: 300px;
  height: 8px;
  background: rgba(47, 122, 106, 0.14);
  border-radius: 999px;
  overflow: hidden;
}

.replan-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2f7a6a 0%, #72b59f 100%);
  border-radius: 999px;
  transition: width 1s ease-in-out;
}

.followup-skip-link {
  font-size: 0.82rem;
  color: var(--muted);
  text-align: center;
  text-decoration: none;
  font-weight: 500;
  transition: color var(--dur-fast) var(--ease-smooth);
}

.followup-skip-link:hover {
  color: var(--accent);
}

/* ── Kbd hint ──────────────────────────────────────── */
.kbd-hint {
  font-size: 0.72rem;
  color: var(--muted);
  font-weight: 500;
  text-align: center;
  margin-top: -8px;
  opacity: 0.7;
}

@media (hover: none) {
  .kbd-hint { display: none; }
}

/* ── Drum Picker ───────────────────────────────────── */
.drum-picker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 132px;
  overflow: hidden;
  margin: 4px 0;
  border-radius: var(--radius-sm);
  background: var(--bg);
  border: 1.5px solid var(--border);
}

.drum-picker--single .drum-col {
  flex: 1;
  max-width: 200px;
}

.drum-highlight {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: calc(100% - 16px);
  height: 44px;
  background: rgba(47, 122, 106, 0.1);
  border-radius: 8px;
  pointer-events: none;
  border-top: 1px solid rgba(47, 122, 106, 0.25);
  border-bottom: 1px solid rgba(47, 122, 106, 0.25);
  z-index: 1;
}

.drum-col {
  flex: 1;
  height: 132px;
  overflow-y: scroll;
  scroll-snap-type: y mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  text-align: center;
  -webkit-mask-image: linear-gradient(to bottom, transparent 0%, black 33%, black 67%, transparent 100%);
  mask-image: linear-gradient(to bottom, transparent 0%, black 33%, black 67%, transparent 100%);
  position: relative;
  z-index: 2;
}

.drum-col::-webkit-scrollbar { display: none; }

.drum-item {
  height: 44px;
  line-height: 44px;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--ink);
  scroll-snap-align: center;
  user-select: none;
  cursor: pointer;
}

.drum-pad {
  height: 44px;
  scroll-snap-align: none;
}

/* ── Draft Mode ────────────────────────────────────── */

/* Show sidebar in draft mode */
.draft-mode .sidebar {
  display: flex;
  padding: 0;
  gap: 0;
  border-left: none;
  overflow: hidden;
}

/* 50/50 split */
.draft-mode .app-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  overflow: hidden;
  padding: 0;
  flex: 1;
  min-height: 0;
  align-items: stretch;
}

/* Hide right-now and replan controls in draft mode */
.draft-mode .right-now-section,
.draft-mode .followup-section {
  display: none !important;
}

/* Column does NOT scroll — the panel inside does */
.draft-mode .calendar-column {
  overflow-y: hidden;
  padding: 0;
  gap: 0;
  max-width: none;
}

/* Panel fills the full column height */
.draft-mode .calendar-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
  border-radius: 0;
  border: none;
  box-shadow: none;
  border-right: 1px solid var(--border);
}

.draft-mode .calendar-panel-title {
  flex-shrink: 0;
  padding: 12px 18px 8px;
}

/* Scroll happens inside the panel */
.draft-mode .calendar-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  min-height: 0;
  padding-top: 12px;
}

/* Ensure the grid fills the full panel width */
.draft-mode .calendar-grid {
  width: 100%;
  min-width: 0;
}

.draft-mode .calendar-events {
  min-width: 0;
}

/* Allow block text to wrap in the narrow column; reduce sizes slightly */
.draft-mode .block-task {
  font-size: 0.72rem;
  white-space: normal;
  word-break: break-word;
}

.draft-mode .block-time {
  font-size: 0.58rem;
}

/* Muted calendar blocks */
.draft-mode .calendar-block {
  opacity: 0.58;
  border: 1.5px dashed rgba(255, 255, 255, 0.5);
}

.draft-mode .calendar-block:hover {
  opacity: 1;
}


/* Draft sidebar content: fills sidebar, stacks scroll area + action bar */
.draft-section {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
}

/* Dropped/Rationale area — hidden until user scrolls to calendar bottom */
.draft-scroll-area {
  display: none;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  padding: 16px 20px;
  min-height: 0;
  flex: 1;
  animation: panelIn 0.3s var(--ease-out) both;
}

.draft-scroll-area.revealed {
  display: flex;
}

.draft-scroll-area::-webkit-scrollbar { width: 4px; }
.draft-scroll-area::-webkit-scrollbar-track { background: transparent; }
.draft-scroll-area::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

/* Collapsible detail sections */
.draft-details {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.draft-details summary {
  padding: 10px 14px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color var(--dur-fast) var(--ease-smooth);
}

.draft-details summary::-webkit-details-marker { display: none; }

.draft-details summary::after {
  content: '▸';
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-smooth);
}

.draft-details[open] summary::after {
  transform: rotate(90deg);
}

.draft-details summary:hover {
  color: var(--accent);
}

.draft-details > div,
.draft-details > p {
  padding: 10px 14px 12px;
  border-top: 1px solid var(--border);
  font-size: 0.85rem;
  line-height: 1.6;
  color: var(--ink);
}

/* Restore list indent zeroed by CSS reset */
.draft-details ul {
  padding-left: 18px;
  margin: 0;
}

.draft-details li {
  line-height: 1.75;
}

/* More information collapsible in draft action bar */
.draft-more-info {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.draft-more-info summary {
  padding: 8px 12px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  list-style: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  transition: color var(--dur-fast) var(--ease-smooth);
}

.draft-more-info summary::-webkit-details-marker { display: none; }

.draft-more-info summary::after {
  content: '▸';
  font-size: 0.7rem;
  flex-shrink: 0;
  transition: transform var(--dur-fast) var(--ease-smooth);
}

.draft-more-info[open] summary::after {
  transform: rotate(90deg);
}

.draft-more-info summary:hover {
  color: var(--accent);
}

.draft-more-info-content {
  border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-sm) var(--radius-sm);
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 30vh;
  overflow-y: auto;
}

.draft-more-info-section {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.draft-more-info-label {
  font-size: 0.63rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.9px;
  color: var(--muted);
}

.draft-more-info-content ul {
  padding-left: 16px;
  margin: 0;
  font-size: 0.75rem;
  line-height: 1.55;
}

.draft-more-info-content li {
  line-height: 1.65;
}

.draft-more-info-content p,
.draft-more-info-content .empty-note {
  font-size: 0.75rem;
  line-height: 1.55;
  color: var(--ink);
  margin: 0;
}

.draft-more-info-content::-webkit-scrollbar { width: 3px; }
.draft-more-info-content::-webkit-scrollbar-track { background: transparent; }
.draft-more-info-content::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

/* Action bar: fills sidebar, scrollable */
.draft-action-bar {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--panel);
}

.draft-action-bar textarea {
  min-height: 72px;
  resize: none;
}

.draft-header {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.draft-badge {
  font-size: 0.65rem;
  font-weight: 800;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--accent-light);
  border: 1.5px solid rgba(47, 122, 106, 0.25);
  border-radius: 6px;
  padding: 2px 8px;
  flex-shrink: 0;
}

.draft-hint-text {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.4;
}

.draft-or {
  text-align: center;
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 1.5px;
  color: var(--muted);
  position: relative;
  line-height: 1;
  padding: 2px 0;
}

.draft-or::before,
.draft-or::after {
  content: '';
  position: absolute;
  top: 50%;
  width: 42%;
  height: 1px;
  background: var(--border);
}

.draft-or::before { left: 0; }
.draft-or::after  { right: 0; }

/* ── Mobile draft: viewport-height layout, calendar scrolls internally ── */
@media (max-width: 768px) {
  /* Pin to viewport — no page scroll in draft mode */
  .app-shell.draft-mode {
    height: 100dvh;
    overflow: hidden;
  }

  /* Stack calendar above sidebar as flex column */
  .draft-mode .app-body {
    display: flex;
    flex-direction: column;
    overflow: hidden;
    min-height: 0;
  }

  /* Calendar fills remaining space, scrolls internally */
  .draft-mode .calendar-column {
    flex: 1;
    overflow-y: hidden;
    min-height: 0;
    padding: 12px 12px 0;
    height: auto;
    gap: 12px;
  }

  .draft-mode .calendar-panel {
    flex: 1;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
    border-right: none;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
  }

  .draft-mode .calendar-scroll {
    flex: 1;
    overflow-y: auto;
    overflow-x: hidden;
    min-height: 0;
  }

  /* Sidebar sits at bottom, auto height */
  .draft-mode .sidebar {
    flex-shrink: 0;
    border-left: none;
    border-top: 1px solid var(--border);
    overflow: hidden;
    padding: 0;
    max-height: 52vh;
  }

  .draft-mode .draft-section {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  .draft-mode .draft-action-bar {
    position: static;
    overflow-y: auto;
  }
}

/* ── Voice Input ───────────────────────────────────── */

/* Brain dump: mic is hero above; textarea is secondary */
.mic-hero-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 4px 0 6px;
}

.mic-hero-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.or-type-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  margin: 6px 0 8px;
}

.or-type-divider::before,
.or-type-divider::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--border);
}

.brain-dump-wrap {
  width: 100%;
}

.brain-dump-wrap textarea {
  width: 100%;
}

/* Replan textarea: mic is now above, textarea has no embedded mic */
.replan-textarea-wrap {
  position: relative;
}

.replan-textarea-wrap textarea {
  width: 100%;
}

/* Shared mic button base */
.btn-mic {
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: #fff;
  color: var(--muted);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition:
    border-color var(--dur-fast) var(--ease-smooth),
    color       var(--dur-fast) var(--ease-smooth),
    background  var(--dur-fast) var(--ease-smooth),
    box-shadow  var(--dur-fast) var(--ease-smooth),
    transform   var(--dur-fast) var(--ease-spring);
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
}

.btn-mic:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-light);
  box-shadow: 0 0 0 3px rgba(47, 122, 106, 0.13);
}

/* Hero mic — primary CTA, filled + idle pulse */
.btn-mic--hero {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: linear-gradient(145deg, #29695d 0%, #4d9983 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 28px rgba(35, 49, 45, 0.18);
  animation: mic-idle-ring 2.4s ease-out infinite;
}

.btn-mic--hero:hover:not(.recording) {
  background: linear-gradient(145deg, #225a50 0%, #438a74 100%);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 14px 32px rgba(35, 49, 45, 0.24);
  transform: translateY(-2px) scale(1.04);
}

/* Replan mic — inside textarea, bottom-right */
.btn-mic--replan {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  z-index: 1;
}

@keyframes pulse-mic {
  0%, 100% { box-shadow: 0 0 0 0 rgba(229, 62, 62, 0.4); }
  50%       { box-shadow: 0 0 0 7px rgba(229, 62, 62, 0); }
}

@keyframes mic-idle-ring {
  0%   { box-shadow: 0 0 0 0px rgba(41, 105, 93, 0.30), 0 10px 28px rgba(35, 49, 45, 0.18); }
  65%  { box-shadow: 0 0 0 18px rgba(41, 105, 93, 0.00), 0 10px 28px rgba(35, 49, 45, 0.18); }
  100% { box-shadow: 0 0 0 0px rgba(41, 105, 93, 0.00), 0 10px 28px rgba(35, 49, 45, 0.18); }
}

.btn-mic.recording {
  border-color: #e53e3e;
  color: #e53e3e;
  background: #fff5f5;
  animation: pulse-mic 1.2s ease-in-out infinite;
}

.btn-mic:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.voice-status-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: -6px;
}

.voice-status {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--muted);
  font-style: italic;
}

/* ── Export Section ────────────────────────────────── */
.export-section {
  display: none; /* hidden in draft mode; shown in approved mode */
}

/* Show below calendar in approved mode (not draft) */
.app-shell:not(.draft-mode) .export-section {
  display: flex;
  flex-direction: row;
  gap: 8px;
}

.btn-export {
  flex: 1;
  font-size: 0.82rem;
  font-weight: 600;
}

.btn-export--gcal {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1.5px solid var(--accent);
}
.btn-export--gcal:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(47,122,106,0.2);
}

.btn-export--apple {
  background: var(--accent-light);
  color: var(--accent-dark);
  border: 1.5px solid var(--accent);
}
.btn-export--apple:hover:not(:disabled) {
  background: var(--accent);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 3px 12px rgba(47,122,106,0.2);
}


.btn-export:active {
  transform: translateY(0) scale(0.97);
}

.btn-export:disabled {
  opacity: 0.65;
  cursor: not-allowed;
  transform: none;
}

/* ── GCal toast ────────────────────────────────────── */
.gcal-toast {
  position: fixed;
  bottom: 40px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: #1e1e2e;
  color: #fff;
  padding: 16px 28px;
  border-radius: 14px;
  font-size: 1rem;
  font-weight: 600;
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  white-space: nowrap;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}
.gcal-toast--visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}
.gcal-toast--error {
  background: #c0392b;
}

/* ── Keyboard shortcut hint ────────────────────────── */
.kbd-key {
  display: inline-block;
  font-family: inherit;
  font-size: 0.75rem;
  font-weight: 700;
  font-style: normal;
  background: var(--panel);
  border: 1.5px solid var(--border);
  border-bottom-width: 2.5px;
  border-radius: 5px;
  padding: 1px 7px;
  color: var(--muted);
  line-height: 1.7;
  letter-spacing: 0;
  vertical-align: middle;
}

.kbd-sep {
  margin: 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  vertical-align: middle;
}

/* ── Draft textarea wrap (mic inside textarea, bottom-right) ── */
.draft-textarea-wrap {
  position: relative;
}

.draft-textarea-wrap textarea {
  width: 100%;
  padding-right: 62px;
}

.btn-mic--draft {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 44px;
  height: 44px;
  z-index: 1;
}

/* ── Floating Replan Button (FAB) ──────────────────── */
@keyframes fab-nudge {
  0%, 82%, 100% { transform: scale(1); }
  86%            { transform: scale(1.07); }
  92%            { transform: scale(0.96); }
  97%            { transform: scale(1.03); }
}

.fab-replan {
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 200;
  background: var(--accent-light);
  color: var(--accent);
  border: none;
  border-radius: 999px;
  padding: 13px 22px;
  font-family: inherit;
  font-size: 0.95rem;
  font-weight: 700;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(45, 181, 123, 0.20);
  display: flex;
  align-items: center;
  gap: 8px;
  transition:
    transform var(--dur-fast) var(--ease-spring),
    box-shadow var(--dur-fast) var(--ease-smooth),
    background var(--dur-fast) var(--ease-smooth);
  letter-spacing: 0.1px;
}

.fab-replan:hover {
  background: rgba(45, 110, 133, 0.14);
  transform: translateY(-2px) scale(1.04);
  box-shadow: 0 6px 22px rgba(45, 110, 133, 0.28);
}

.fab-replan:active {
  transform: scale(0.97);
}

/* ── FAB Backdrop ──────────────────────────────────── */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.fab-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(45, 42, 38, 0.45);
  z-index: 290;
  display: none;
}

.fab-backdrop.open {
  display: block;
  animation: fadeIn 0.2s var(--ease-out) both;
}

/* ── FAB Slide-up Panel ────────────────────────────── */
@keyframes slideUpPanel {
  from { transform: translateX(-50%) translateY(100%); }
  to   { transform: translateX(-50%) translateY(0); }
}

.fab-panel {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%) translateY(100%);
  width: 100%;
  max-width: 660px;
  z-index: 300;
  background: var(--panel);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  padding: 20px 24px 36px;
  box-shadow: 0 -8px 40px rgba(45, 42, 38, 0.18);
  display: flex;
  flex-direction: column;
  gap: 14px;
  transition: transform 0.3s var(--ease-spring);
}

.fab-panel.open {
  transform: translateX(-50%) translateY(0);
}

.fab-panel-header {
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.fab-panel-title {
  font-size: 1rem;
  font-weight: 700;
  color: var(--ink);
  text-align: center;
}

.fab-panel-close {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

.fab-panel-close {
  background: none;
  border: none;
  font-size: 1rem;
  color: var(--muted);
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  line-height: 1;
  transition: color var(--dur-fast) var(--ease-smooth), background var(--dur-fast);
}

.fab-panel-close:hover {
  color: var(--ink);
  background: var(--bg);
}

.fab-panel textarea {
  min-height: 72px;
}

/* Apple Calendar Preview Panel */
.apple-cal-event-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-height: 40vh;
  overflow-y: auto;
}
.apple-cal-event-item {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 10px 12px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  gap: 12px;
}
.apple-cal-event-name {
  font-weight: 600;
  color: var(--ink);
  font-size: 0.9rem;
  flex: 1;
  min-width: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.apple-cal-event-time {
  font-size: 0.82rem;
  color: var(--muted);
  flex-shrink: 0;
}
.apple-cal-safari-nudge {
  font-size: 0.85rem;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.5;
  text-align: center;
}
.apple-cal-nudge-btns {
  display: flex;
  gap: 8px;
}
.apple-cal-nudge-btn {
  flex: 1;
  box-shadow: none;
}
.apple-cal-nudge-btn--primary {
  background: linear-gradient(135deg, #29695d 0%, #4d9983 100%);
  color: #fff;
  border: none;
}
.apple-cal-nudge-btn--primary:hover {
  background: linear-gradient(135deg, #225a50 0%, #428973 100%);
}
.apple-cal-nudge-btn--primary:active {
  background: linear-gradient(135deg, #1e5047 0%, #3a7a66 100%);
}
.apple-cal-nudge-btn--secondary {
  background: transparent;
  color: #29695d;
  border: 1.5px solid rgba(41, 105, 93, 0.4);
}
.apple-cal-nudge-btn--secondary:hover {
  background: rgba(41, 105, 93, 0.08);
  border-color: rgba(41, 105, 93, 0.6);
}
.apple-cal-nudge-btn--secondary:active {
  background: rgba(41, 105, 93, 0.14);
}

/* Hide FAB in draft mode */
.draft-mode .fab-replan,
.draft-mode .fab-backdrop,
.draft-mode .fab-panel {
  display: none !important;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 768px) {
  .app-body {
    padding: 16px 16px 100px; /* extra bottom padding so FAB doesn't cover content */
  }

  .fab-replan {
    bottom: 20px;
    right: 20px;
  }
}

/* ── Calm Coach Theme ──────────────────────────────── */

body,
textarea,
input[type="text"],
input[type="time"],
.btn,
.fab-replan {
  font-family: 'Atkinson Hyperlegible Next', sans-serif;
}

body {
  background:
    radial-gradient(circle at top left, rgba(232, 200, 158, 0.34), transparent 28%),
    radial-gradient(circle at 86% 12%, rgba(102, 171, 150, 0.20), transparent 24%),
    linear-gradient(180deg, #f6f1e9 0%, #ece4d9 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.24) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.16) 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.36), transparent 74%);
  opacity: 0.25;
}

.welcome-overlay {
  padding: 22px;
}

/* Untangle wordmark floats above the welcome card on the landing screen */
.welcome-brand {
  position: absolute;
  top: 28px;
  left: 50%;
  transform: translateX(-50%);
  font-family: 'Fraunces', serif;
  font-size: 1.55rem;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  white-space: nowrap;
  pointer-events: none;
  user-select: none;
}

.welcome-card {
  max-width: 560px;
  padding: 40px 36px 34px;
  border-radius: 34px;
  border: 1px solid rgba(255, 255, 255, 0.68);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(252, 247, 241, 0.88));
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.live-clock,
.app-header h1,
.right-now-heading {
  font-family: 'Fraunces', serif;
}

.live-clock {
  font-size: clamp(3rem, 8vw, 4.7rem);
  letter-spacing: -0.06em;
  line-height: 0.96;
}

.clock-its {
  color: rgba(35, 49, 45, 0.72);
}

#live-clock-time {
  color: var(--accent-dark);
}

.welcome-heading {
  font-size: 1.35rem;
  font-weight: 700;
}

.btn-mic {
  background: rgba(255, 255, 255, 0.78);
  border-color: rgba(90, 109, 103, 0.16);
  box-shadow: 0 4px 10px rgba(35, 49, 45, 0.08);
}

.btn-mic--hero {
  width: 96px;
  height: 96px;
  border-radius: 28px;
  background: linear-gradient(145deg, #29695d 0%, #4d9983 100%);
  color: #fff;
  border: none;
  box-shadow: 0 10px 28px rgba(35, 49, 45, 0.18);
  animation: mic-idle-ring 2.4s ease-out infinite;
}

.mic-hero-label {
  color: rgba(41, 105, 93, 0.75);
}

.mic-hero-wrap--replan {
  margin: 10px 0 6px;
}

.btn-mic--replan,
.btn-mic--draft {
  width: 44px;
  height: 44px;
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(234, 245, 240, 0.92));
  color: var(--accent-dark);
  border-color: rgba(47, 122, 106, 0.20);
}

textarea,
input[type="text"],
input[type="time"] {
  border-width: 1px;
  border-color: rgba(90, 109, 103, 0.18);
  background: rgba(255, 255, 255, 0.76);
  border-radius: 18px;
}

textarea:focus,
input[type="text"]:focus,
input[type="time"]:focus {
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 0 0 4px rgba(47, 122, 106, 0.12);
}

/* Plan submit — solid teal, secondary visual weight to mic but clearly pressable */
#plan-btn {
  background: linear-gradient(135deg, #3d8a79 0%, #5aaa94 100%);
  color: #fff;
  border: none;
  box-shadow: 0 4px 14px rgba(41, 105, 93, 0.22);
  font-weight: 700;
}

#plan-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #347a6b 0%, #4d9985 100%);
  box-shadow: 0 8px 22px rgba(41, 105, 93, 0.32);
  transform: translateY(-2px);
}

.btn-export,
.btn-fresh,
.fab-replan {
  border-radius: 999px;
}

.app-header {
  padding: 18px 28px;
  background: linear-gradient(180deg, rgba(255, 252, 247, 0.96), rgba(248, 243, 236, 0.88));
  backdrop-filter: blur(16px);
}

.app-header h1 {
  font-size: 2rem;
  line-height: 0.95;
  letter-spacing: -0.04em;
}

.app-body {
  padding-top: 22px;
  gap: 18px;
}

.calendar-column {
  max-width: 760px;
  gap: 18px;
}

.right-now-section.visible {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.right-now-section {
  padding: 28px 30px;
  border-radius: 30px;
  border: 1px solid rgba(255, 255, 255, 0.72);
  background: linear-gradient(135deg, #2a685d 0%, #509380 100%);
  box-shadow: 0 24px 48px rgba(37, 82, 72, 0.24);
}

.right-now-heading {
  font-size: clamp(2rem, 4vw, 3.1rem);
  line-height: 0.94;
  letter-spacing: -0.04em;
  color: #f6fffb;
}

.right-now-section ul {
  padding-left: 22px;
  color: rgba(246, 255, 251, 0.97);
  font-size: 1rem;
  line-height: 1.7;
}

.right-now-section .empty-note {
  color: rgba(246, 255, 251, 0.76);
}

/* Stale plan state — muted panel replaces the green gradient */
.right-now-section.right-now-stale {
  background: var(--panel);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.right-now-section.right-now-stale .right-now-heading {
  color: var(--ink);
}

.right-now-section.right-now-stale ul {
  color: var(--ink);
}

.right-now-stale .right-now-all-past-msg {
  color: var(--muted);
  font-size: 0.95rem;
  margin: 0 0 16px;
}


/* Replan CTA inside the stale all-past panel */
.right-now-replan-btn {
  align-self: flex-start;
}

.calendar-panel {
  border-radius: 28px;
  border: 1px solid rgba(255, 255, 255, 0.74);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.86), rgba(250, 245, 238, 0.76));
  box-shadow: var(--shadow-sm);
  backdrop-filter: blur(12px);
}

.calendar-panel-title {
  padding: 18px 20px 12px;
  color: var(--muted);
}

.calendar-time-display {
  padding: 7px 12px;
  border-radius: 999px;
  background: rgba(47, 122, 106, 0.10);
  color: var(--accent);
}

.calendar-scroll {
  padding-top: 14px;
  overflow-y: auto;
  overflow-x: hidden;
  max-height: min(68vh, 780px);
  scrollbar-width: thin;
  scrollbar-color: rgba(90, 109, 103, 0.30) transparent;
}

.calendar-scroll::-webkit-scrollbar {
  width: 8px;
}

.calendar-scroll::-webkit-scrollbar-track {
  background: transparent;
}

.calendar-scroll::-webkit-scrollbar-thumb {
  background: rgba(90, 109, 103, 0.24);
  border-radius: 999px;
}

.calendar-time-axis {
  width: 60px;
  background: linear-gradient(180deg, rgba(244, 238, 230, 0.44), rgba(244, 238, 230, 0.10));
}

.hour-label {
  right: 10px;
  font-size: 0.72rem;
  font-weight: 700;
  max-width: 48px;
  text-align: right;
}

.hour-label--midnight {
  font-size: 0.62rem;
  right: 6px;
  letter-spacing: 0;
}

.calendar-events {
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.24), rgba(255, 255, 255, 0.08));
}

.calendar-block {
  left: 10px;
  right: 12px;
  border-radius: 18px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 255, 255, 0.28);
  box-shadow:
    0 14px 26px rgba(35, 49, 45, 0.10),
    inset 0 1px 0 rgba(255, 255, 255, 0.14);
  transition:
    transform var(--dur-fast) var(--ease-smooth),
    box-shadow var(--dur-fast) var(--ease-smooth),
    opacity var(--dur-fast) var(--ease-smooth),
    filter var(--dur-fast) var(--ease-smooth);
}

.calendar-block--micro {
  border-radius: 10px;
  padding: 0 12px;
  box-shadow: 0 4px 10px rgba(35, 49, 45, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.14);
  opacity: 0.9;
}

.calendar-block--current {
  background: linear-gradient(135deg, #2f7a6a 0%, #77b79e 100%);
  color: #f7fffc;
  box-shadow:
    0 18px 34px rgba(47, 122, 106, 0.20),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.calendar-block--upcoming {
  background: linear-gradient(135deg, #8ca8b5 0%, #a0b8c4 100%);
  color: rgba(255, 255, 255, 0.95);
  box-shadow: 0 8px 18px rgba(83, 104, 112, 0.10);
}

.calendar-block--past {
  opacity: 0.70;
  filter: saturate(0.78);
}

.calendar-block--current .block-task {
  font-size: 1.08rem;
  font-weight: 800;
}

.calendar-block--upcoming .block-task,
.calendar-block--past .block-task {
  font-size: 0.96rem;
  font-weight: 700;
}

.calendar-block--short,
.calendar-block--medium {
  border-radius: 14px;
}

.calendar-block--short {
  padding: 12px 14px 13px;
}

.calendar-block--short .block-time {
  font-size: 0.82rem;
  line-height: 1.2;
}

.calendar-block--short .block-task {
  margin-top: 7px;
  font-size: 1rem;
  line-height: 1.2;
}

.calendar-block--medium {
  padding-top: 12px;
  padding-bottom: 13px;
}

.calendar-block--medium .block-time {
  font-size: 0.8rem;
}

.calendar-block--medium .block-task {
  margin-top: 6px;
  font-size: 0.98rem;
}

.block-time {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.02em;
  opacity: 0.86;
}

.block-task {
  margin-top: 6px;
  white-space: normal;
  overflow: visible;
  text-overflow: clip;
  line-height: 1.25;
}

.block-task-list {
  display: grid;
  gap: 8px;
  margin-top: 8px;
}

.block-task-row {
  display: grid;
  grid-template-columns: 70px 1fr;
  gap: 10px;
  align-items: baseline;
}

.block-task-row-time {
  font-size: 0.72rem;
  font-weight: 800;
  opacity: 0.86;
  white-space: nowrap;
}

.block-task-row-label {
  font-size: 0.98rem;
  font-weight: 800;
  line-height: 1.2;
}

.calendar-block--cluster {
  padding-top: 12px;
  padding-bottom: 14px;
}

.calendar-block--cluster .block-time {
  font-size: 0.8rem;
}

.calendar-block:hover {
  transform: translateY(-1px);
}

.draft-mode .calendar-block {
  opacity: 1;
}

.draft-mode .calendar-block--task,
.draft-mode .calendar-block--upcoming.calendar-block--task,
.draft-mode .calendar-block--past.calendar-block--task {
  background: linear-gradient(135deg, #6d9f8d 0%, #87b4a4 100%);
  color: rgba(248, 255, 251, 0.98);
}

.draft-mode .calendar-block--break,
.draft-mode .calendar-block--upcoming.calendar-block--break,
.draft-mode .calendar-block--past.calendar-block--break {
  background: linear-gradient(135deg, #95acb6 0%, #a9bdc7 100%);
  color: rgba(248, 251, 255, 0.98);
}

.draft-mode .calendar-block--fixed,
.draft-mode .calendar-block--upcoming.calendar-block--fixed,
.draft-mode .calendar-block--past.calendar-block--fixed {
  background: linear-gradient(135deg, #c59a67 0%, #d6ae84 100%);
  color: rgba(255, 251, 245, 0.98);
}

.draft-mode .calendar-block--current {
  background: linear-gradient(135deg, #2f7a6a 0%, #74b59d 100%);
  box-shadow:
    0 18px 34px rgba(47, 122, 106, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.18);
}

.draft-action-bar,
.fab-panel {
  background: #fdf8f0;
}

.fab-replan {
  bottom: 36px;
  right: 34px;
  padding: 17px 28px;
  font-size: 1.08rem;
  font-weight: 800;
  background: linear-gradient(135deg, #c8693a 0%, #d9835a 100%);
  color: #fff;
  border: 2.5px solid #8b4320;
  box-shadow: 0 8px 24px rgba(168, 80, 40, 0.32);
  animation: fab-nudge 10s ease-in-out infinite;
  animation-delay: 5s;
}

.fab-replan:hover {
  background: linear-gradient(135deg, #b55c30 0%, #c97248 100%);
  color: #fff;
  box-shadow: 0 12px 28px rgba(168, 80, 40, 0.42);
  animation-play-state: paused;
}

.btn-primary,
.btn-secondary,
#draft-approve-btn,
#draft-adjust-btn,
#replan-btn {
  box-shadow: none;
}

.btn-primary:hover:not(:disabled),
#draft-approve-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #225a50 0%, #428973 100%);
  box-shadow: 0 14px 28px rgba(47, 122, 106, 0.18);
}

.btn-primary:focus-visible,
.btn-secondary:focus-visible,
#draft-approve-btn:focus-visible,
#draft-adjust-btn:focus-visible,
#replan-btn:focus-visible,
.btn-mic:focus-visible,
.fab-replan:focus-visible,
.draft-more-info summary:focus-visible {
  outline: 2px solid rgba(47, 122, 106, 0.48);
  outline-offset: 2px;
  box-shadow: none;
}

#draft-adjust-btn {
  background: linear-gradient(135deg, #eef2ec 0%, #e0e6dd 100%);
  color: #2c6557;
}

#draft-adjust-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #e4ebe2 0%, #d7e0d5 100%);
  box-shadow: 0 12px 24px rgba(47, 122, 106, 0.12);
}

#draft-approve-btn {
  box-shadow: 0 16px 30px rgba(47, 122, 106, 0.18);
}

.fab-panel {
  max-width: 760px;
  padding: 14px 32px 42px;
  border-top: 2.5px solid rgba(47, 122, 106, 0.55);
  box-shadow: 0 -12px 48px rgba(45, 42, 38, 0.22), 0 -2px 0 rgba(47, 122, 106, 0.10);
}

.fab-handle {
  width: 38px;
  height: 4px;
  background: rgba(47, 122, 106, 0.28);
  border-radius: 999px;
  margin: 0 auto 10px;
  flex-shrink: 0;
}

.fab-panel-title {
  font-family: 'Fraunces', serif;
  font-size: 1.7rem;
  line-height: 0.95;
}

.replan-textarea-wrap textarea {
  min-height: 80px;
}

#replan-btn {
  background: linear-gradient(135deg, #3d8a79 0%, #5aaa94 100%);
  color: #fff;
  border: none;
  font-weight: 700;
  box-shadow: 0 4px 14px rgba(41, 105, 93, 0.22);
}

#replan-btn:hover:not(:disabled) {
  background: linear-gradient(135deg, #347a6b 0%, #4d9985 100%);
  box-shadow: 0 8px 22px rgba(41, 105, 93, 0.32);
  transform: translateY(-2px);
}

#start-fresh-btn {
  background: linear-gradient(135deg, #2db57b 0%, #62d1aa 100%);
  box-shadow: 0 16px 30px rgba(45, 181, 123, 0.22);
}

@media (max-width: 768px) {
  .welcome-overlay {
    padding: 12px;
  }

  .welcome-card {
    padding: 28px 22px;
    border-radius: 28px;
  }

  .app-header {
    padding: 16px 18px;
  }

  .app-header h1 {
    font-size: 1.75rem;
  }

  .right-now-section {
    padding: 24px 22px;
  }

  .calendar-scroll {
    max-height: min(56vh, 640px);
  }

  .fab-replan {
    right: 20px;
    bottom: 24px;
    padding: 15px 22px;
    font-size: 1rem;
  }

  .btn-mic--replan,
  .btn-mic--draft {
    width: 44px;
    height: 44px;
    border-radius: 14px;
  }

  .btn-mic--hero {
    width: 80px;
    height: 80px;
    border-radius: 24px;
  }

  .block-task-row {
    grid-template-columns: 62px 1fr;
    gap: 8px;
  }

  .block-task-row-time {
    font-size: 0.68rem;
  }

  .block-task-row-label {
    font-size: 0.92rem;
  }
}
