@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --bg:           #f0ebe4;
  --bg-card:      #ffffff;
  --bg-row-hover: #fdf8f6;
  --bg-surface:   #faf8f6;
  --bg-surface-2: #f0ede9;
  --border:       rgba(0,0,0,0.06);
  --border-md:    rgba(0,0,0,0.1);
  --shadow-card:  0 1px 4px rgba(0,0,0,0.05), 0 6px 24px rgba(0,0,0,0.06);
  --shadow-panel: 0 -4px 32px rgba(0,0,0,0.12);
  --text:         #1a130c;
  --text-muted:   #7a6558;
  --text-dim:     #bfb0a0;
  --accent:       #bf3b2c;
  --accent-hover: #a83225;
  --accent-soft:  rgba(191,59,44,0.07);
  --accent-mid:   rgba(191,59,44,0.14);
  --green:        #15803d;
  --yellow:       #b45309;
  --red:          #bf3b2c;
  --today-bg:     rgba(191,59,44,0.05);
  --today-line:   #bf3b2c;
  --conflict-hard-bg:   rgba(191,59,44,0.06);
  --conflict-hard-line: #bf3b2c;
  --conflict-soft-bg:   rgba(180,83,9,0.06);
  --conflict-soft-line: #b45309;
  --weekend-bg:   rgba(0,0,0,0.015);
  --radius:       16px;
  --radius-sm:    10px;
  --radius-xs:    6px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
}

/* ── Dark Mode ─────────────────────────────── */
[data-theme="dark"] {
  --bg:           #1a1a1a;
  --bg-card:      #242424;
  --bg-row-hover: #2c2926;
  --bg-surface:   #2a2825;
  --bg-surface-2: #333028;
  --border:       rgba(255,255,255,0.08);
  --border-md:    rgba(255,255,255,0.12);
  --shadow-card:  0 1px 4px rgba(0,0,0,0.2), 0 6px 24px rgba(0,0,0,0.25);
  --shadow-panel: 0 -4px 32px rgba(0,0,0,0.4);
  --text:         #e8e0d8;
  --text-muted:   #a89888;
  --text-dim:     #6a5e52;
  --accent:       #d4544a;
  --accent-hover: #c44a40;
  --accent-soft:  rgba(212,84,74,0.12);
  --accent-mid:   rgba(212,84,74,0.2);
  --green:        #2ecc71;
  --yellow:       #e0a030;
  --red:          #d4544a;
  --today-bg:     rgba(212,84,74,0.08);
  --today-line:   #d4544a;
  --conflict-hard-bg:   rgba(212,84,74,0.1);
  --conflict-hard-line: #d4544a;
  --conflict-soft-bg:   rgba(224,160,48,0.1);
  --conflict-soft-line: #e0a030;
  --weekend-bg:   rgba(255,255,255,0.02);
}

[data-theme="dark"] .detail-overlay {
  background: rgba(0,0,0,0.55);
}

[data-theme="dark"] .conflict-alert {
  color: #e8a090;
}

[data-theme="dark"] .conflict-alert.soft {
  color: #e0b870;
}

[data-theme="dark"] .conflict-banner {
  color: #e8a090;
}

[data-theme="dark"] .day-row.no-location {
  background: rgba(255,255,255,0.02);
}

[data-theme="dark"] .cal-tooltip {
  background: #383028;
  color: var(--text);
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
}

[data-theme="dark"] .cal-tip-focus {
  color: rgba(232,224,216,0.65);
}

[data-theme="dark"] .meta-load.low {
  background: rgba(46,204,113,0.1);
  border-color: rgba(46,204,113,0.25);
}

[data-theme="dark"] .meta-load.medium {
  background: rgba(224,160,48,0.1);
  border-color: rgba(224,160,48,0.25);
}

[data-theme="dark"] .meta-load.high {
  background: rgba(212,84,74,0.1);
  border-color: rgba(212,84,74,0.25);
}

[data-theme="dark"] .settings-loc-remove:hover {
  background: rgba(212,84,74,0.12);
}

/* ── Theme Toggle ──────────────────────────── */
.theme-toggle {
  background: var(--bg-card);
  border: 1px solid var(--border-md);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.15s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  font-size: 16px;
  line-height: 1;
}
.theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent-mid);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  height: 100dvh;
  overflow: hidden;
  -webkit-font-smoothing: antialiased;
}

#app {
  max-width: 900px;
  margin: 0 auto;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.top-section {
  flex-shrink: 0;
  background: var(--bg);
}

.scroll-section {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 12px 0 env(safe-area-inset-bottom, 32px);
}

/* ── Header ────────────────────────────────── */
header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px 12px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.header-left { display: flex; flex-direction: column; gap: 1px; }
header h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.5px; display: flex; align-items: center; gap: 8px; }
header h1::before { content: ''; width: 9px; height: 9px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 3px rgba(191,59,44,0.15); }
.last-updated { font-size: 11px; color: var(--text-dim); padding-left: 17px; }
.header-right { display: flex; align-items: center; gap: 8px; }

.icon-btn {
  background: var(--bg-card); border: 1px solid var(--border-md); color: var(--text-muted);
  border-radius: var(--radius-sm); width: 36px; height: 36px;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; transition: all 0.15s; box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}
.icon-btn:hover { color: var(--accent); border-color: var(--accent-mid); }
.icon-btn.spinning svg { animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

/* ── Login Screen ──────────────────────────── */
.login-screen {
  position: fixed; inset: 0; z-index: 200;
  background: var(--bg);
  display: flex; align-items: center; justify-content: center;
}
.login-box {
  width: 300px; padding: 32px; background: var(--bg-card);
  border-radius: var(--radius); box-shadow: var(--shadow-card);
  border: 1px solid var(--border); text-align: center;
}
.login-box h1 { font-size: 22px; font-weight: 700; margin-bottom: 20px; }
.login-error { color: var(--accent); font-size: 12px; margin-top: 8px; }

/* Role-based visibility */
.admin-only { display: none; }
.assistant-only { display: none; }
body.role-admin .admin-only { display: initial; }
body.role-assistant .assistant-only { display: initial; }

/* Role indicator */
.role-indicator {
  display: inline-block;
  font-size: 11px;
  color: var(--text-dim);
  margin-left: 8px;
  font-weight: 500;
  letter-spacing: 0.02em;
}

/* ── Legend ─────────────────────────────────── */
.legend-popover {
  position: fixed; top: 60px; right: max(16px, calc((100vw - 520px)/2 + 16px));
  width: 220px; background: var(--bg-card); border: 1px solid var(--border-md);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-card);
  padding: 14px 16px; z-index: 50; animation: legend-in 0.15s ease;
}
@keyframes legend-in { from { opacity:0; transform:translateY(-4px); } to { opacity:1; transform:translateY(0); } }
.legend-section { margin-bottom: 12px; }
.legend-section:last-child { margin-bottom: 0; }
.legend-title { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); margin-bottom: 6px; }
.legend-item { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); padding: 2px 0; }
.legend-icon { width: 18px; text-align: center; font-size: 13px; }
.load-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: 5px; }
.load-dot.green { background: var(--green); }
.load-dot.yellow { background: var(--yellow); }
.load-dot.red { background: var(--red); }
.focus-marker-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex-shrink: 0; box-shadow: 0 0 0 2px rgba(191,59,44,0.15); }

/* ── Calendar ──────────────────────────────── */
#mini-cal {
  margin: 12px 16px;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: 0 6px 20px rgba(0,0,0,0.08);
  border: 1px solid var(--border);
}


.mini-cal-header {
  display: flex; align-items: center; padding: 12px 16px; gap: 8px; cursor: pointer;
}
#cal-month-label { font-size: 16px; font-weight: 700; letter-spacing: -0.3px; flex: 1; user-select: none; text-align: center; }
#cal-month-label:hover { color: var(--accent); }

.cal-two-months { display: grid; grid-template-columns: 1fr 1px 1fr; gap: 16px; }
.cal-two-months::before {
  content: ''; grid-column: 2; grid-row: 1;
  background: var(--border-md); align-self: stretch;
}
.cal-month-title { font-size: 13px; font-weight: 700; text-align: center; padding: 0 0 6px; color: var(--text); }
.cal-cells { display: grid; grid-template-columns: repeat(7, 1fr); }

.cal-nav {
  background: none; border: none; color: var(--text-dim); cursor: pointer;
  padding: 6px; border-radius: var(--radius-xs); display: flex; align-items: center; transition: all 0.12s;
}
.cal-nav:hover { color: var(--accent); background: var(--accent-soft); }

#cal-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease, padding 0.3s ease;
  padding: 0 12px 12px;
}

#cal-body.collapsed {
  max-height: 0 !important;
  opacity: 0;
  padding: 0 12px;
}

/* Chevron indicator on header */
.cal-chevron {
  transition: transform 0.3s ease;
  color: var(--text-dim);
  margin-left: 4px;
  font-size: 12px;
}

.cal-chevron.collapsed {
  transform: rotate(-90deg);
}

.cal-weekday-row {
  display: grid; grid-template-columns: repeat(7, 1fr);
  padding: 0 0 6px; font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.4px; color: var(--text-dim); text-align: center;
}
.cal-weekday-row span:nth-child(6),
.cal-weekday-row span:nth-child(7) { color: var(--accent); opacity: 0.6; }


.cal-cell {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  height: 42px; cursor: pointer; position: relative; user-select: none;
}
.cal-cell:hover .cal-num { background: var(--bg-surface-2); }
.cal-cell.empty { cursor: default; pointer-events: none; }

.cal-num {
  width: 34px; height: 34px; display: flex; align-items: center; justify-content: center;
  border-radius: 50%; font-size: 14px; font-weight: 500; color: var(--text); transition: background 0.1s;
}

.cal-cell.cal-today .cal-num { background: var(--accent); color: #fff !important; font-weight: 700; }
.cal-cell.cal-selected:not(.cal-today) .cal-num { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.cal-cell.cal-weekend .cal-num { color: var(--text-muted); }

/* Location change — circle only, no background */
.cal-cell.cal-location-change .cal-num { color: #2980b9; font-weight: 700; border: 2px dashed rgba(52,152,219,0.35); border-radius: 50%; }

/* Calendar tooltip */
.cal-tooltip {
  display: none;
  position: fixed;
  z-index: 999;
  background: var(--text);
  color: #fff;
  padding: 6px 12px;
  border-radius: var(--radius-xs);
  font-size: 11px;
  white-space: nowrap;
  pointer-events: none;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  animation: tip-in 0.12s ease;
}


@keyframes tip-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

.cal-cell:hover .cal-tooltip { display: block; }

.cal-tip-city { font-weight: 600; }
.cal-tip-focus { color: rgba(255,255,255,0.75); margin-top: 1px; }
.cal-tip-weather { color: rgba(255,255,255,0.85); margin-top: 2px; }

/* Weather in detail panel */
.weather-summary { align-items: center !important; }
.weather-main { display: flex; align-items: center; gap: 6px; flex-shrink: 0; margin-right: 8px; }
.weather-icon-big { font-size: 22px; }
.weather-temp { font-size: 16px; font-weight: 700; white-space: nowrap; }

.cal-cell.cal-no-location .cal-num { color: var(--text-dim); opacity: 0.6; border: 2px dashed rgba(150,150,150,0.3); border-radius: 50%; }
.cal-cell.cal-no-location { border-radius: var(--radius-xs); }

.cal-dots { display: flex; gap: 2px; position: absolute; bottom: 2px; }
.cal-dots span { width: 4px; height: 4px; border-radius: 50%; }
.cal-dots span:nth-child(1) { background: #e67e22; }
.cal-dots span:nth-child(2) { background: #27ae60; }
.cal-dots span:nth-child(3) { background: #3498db; }
.cal-cell.cal-today .cal-dots span { background: rgba(255,255,255,0.7); }
.cal-cell.cal-has-conflict .cal-dots span { background: var(--red); }

/* ── Loading ───────────────────────────────── */
#loading { margin: 8px 16px 0; background: var(--bg-card); border-radius: var(--radius); border: 1px solid var(--border); overflow: hidden; }
@keyframes shimmer { 0% { background-position: -200px 0; } 100% { background-position: 200px 0; } }
.skel-pulse { background: linear-gradient(90deg, var(--bg-surface-2) 25%, var(--bg-surface) 50%, var(--bg-surface-2) 75%); background-size: 400px 100%; animation: shimmer 1.4s ease-in-out infinite; border-radius: var(--radius-xs); }
.skeleton-row { display: flex; align-items: center; gap: 14px; padding: 16px 20px; border-bottom: 1px solid var(--border); animation: row-in 0.3s ease both; }
.skeleton-date { width: 40px; height: 40px; border-radius: var(--radius-xs); flex-shrink: 0; }
.skeleton-body { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 13px; border-radius: 4px; }
.skeleton-line.short { height: 10px; }

.state-message { display: flex; flex-direction: column; align-items: center; gap: 16px; padding: 60px 24px; color: var(--text-muted); font-size: 14px; }
.retry-btn { background: var(--accent); color: #fff; border: none; border-radius: var(--radius-sm); padding: 8px 20px; font-size: 13px; font-weight: 600; font-family: var(--font); cursor: pointer; }

/* ── Day List ──────────────────────────────── */
#radar-table {
  margin: 12px 16px; background: var(--bg-card); border-radius: var(--radius);
  box-shadow: var(--shadow-card); border: 1px solid var(--border); overflow: hidden;
}

.month-sep {
  padding: 16px 20px 6px; font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1px; color: var(--text-dim); display: flex; align-items: center; gap: 10px;
  background: var(--bg-surface); cursor: pointer; user-select: none;
}
.month-sep:hover { color: var(--accent); }
.month-sep::after { content: ''; flex: 1; height: 1px; background: var(--border-md); }

.day-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); cursor: pointer;
  transition: background 0.1s, transform 0.1s; position: relative;
  scroll-margin-top: 12px;
}
.day-row:last-child { border-bottom: none; }
.day-row::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px; border-radius: 0 3px 3px 0; opacity: 0; transition: opacity 0.12s; }
.day-row:hover { background: var(--bg-row-hover); transform: translateY(-1px); box-shadow: 0 2px 8px rgba(0,0,0,0.04); z-index: 1; }
.day-row:active { transform: scale(0.995); box-shadow: none; }
.day-row.conflict-hard { background: var(--conflict-hard-bg); }
.day-row.conflict-hard::before { background: var(--conflict-hard-line); opacity: 1; }
.day-row.conflict-soft { background: var(--conflict-soft-bg); }
.day-row.conflict-soft::before { background: var(--conflict-soft-line); opacity: 1; }
.day-row.weekend { background: var(--weekend-bg); }
.day-row.no-location { background: rgba(0,0,0,0.02); }
.day-row.no-location .day-num { color: var(--text-dim); }

.meta-city.no-loc { color: var(--text-dim); border-style: dashed; font-style: italic; }

.day-row.today { background: var(--today-bg); box-shadow: inset 0 0 0 1px rgba(191,59,44,0.06); }
.day-row.today::before { background: var(--today-line); opacity: 1; }

.day-row-left { width: 40px; text-align: center; flex-shrink: 0; }
.day-num { font-size: 22px; font-weight: 700; line-height: 1; }
.day-dow { font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-dim); margin-top: 2px; }
.day-row.today .day-num { color: var(--accent); }
.day-row.today .day-dow { color: var(--accent); opacity: 0.7; }
.day-row.weekend .day-num { color: var(--text-muted); }

.day-row-body { flex: 1; min-width: 0; }
.day-row-focus { font-size: 14px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; line-height: 1.3; }
.day-row-focus.inferred { font-style: italic; color: var(--text-muted); font-weight: 400; }
.day-row-focus.none { color: var(--text-dim); font-weight: 400; }
.day-row-meta { display: flex; align-items: center; gap: 8px; margin-top: 3px; }
.meta-city { font-size: 11px; font-weight: 500; color: var(--text-muted); background: var(--bg-surface-2); border: 1px solid var(--border); border-radius: 100px; padding: 1px 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 160px; }
.meta-load { font-size: 11px; font-weight: 700; padding: 1px 6px; border-radius: 100px; border: 1px solid transparent; }
.meta-load.empty { color: var(--text-dim); }
.meta-load.low { color: var(--green); border-color: rgba(21,128,61,0.2); background: rgba(21,128,61,0.06); }
.meta-load.medium { color: var(--yellow); border-color: rgba(180,83,9,0.2); background: rgba(180,83,9,0.06); }
.meta-load.high { color: var(--red); border-color: rgba(191,59,44,0.2); background: rgba(191,59,44,0.06); }
.meta-type { font-size: 14px; line-height: 1; }
.meta-weather { font-size: 11px; color: var(--text-muted); white-space: nowrap; }
.meta-note-link { font-size: 13px; text-decoration: none; opacity: 0.7; transition: opacity 0.12s; }
.meta-note-link:hover { opacity: 1; }
.meta-location-change { font-size: 12px; }
.day-row .focus-marker-dot { margin-left: 0; }
.conflict-badge { display: inline-block; width: 6px; height: 6px; border-radius: 50%; flex-shrink: 0; }
.conflict-badge.hard { background: var(--accent); }
.conflict-badge.soft { background: var(--yellow); }

@keyframes row-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }
.row-enter { animation: row-in 0.3s cubic-bezier(0.22,1,0.36,1) both; }
@keyframes highlight-pulse { 0% { box-shadow: inset 0 0 0 2px rgba(191,59,44,0.3); } 100% { box-shadow: inset 0 0 0 2px transparent; } }
.day-row.scroll-highlight { animation: highlight-pulse 0.8s ease-out; }

/* ── Detail Panel ──────────────────────────── */
.detail-panel { position: fixed; inset: 0; z-index: 100; }
.detail-overlay { position: absolute; inset: 0; background: rgba(26,19,12,0.4); backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px); }
.detail-content { position: absolute; bottom: 0; left: 0; right: 0; background: var(--bg-card); border-radius: 20px 20px 0 0; max-height: 90dvh; overflow-y: auto; padding-bottom: env(safe-area-inset-bottom, 24px); box-shadow: var(--shadow-panel); }
.detail-header { display: flex; align-items: flex-start; justify-content: space-between; padding: 20px 22px 14px; border-bottom: 1px solid var(--border); position: sticky; top: 0; background: var(--bg-card); z-index: 1; }
.detail-title { font-size: 17px; font-weight: 700; letter-spacing: -0.3px; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.detail-day-meta { font-size: 13px; font-weight: 400; color: var(--text-muted); white-space: nowrap; }
.detail-subtitle { font-size: 13px; color: var(--text-muted); margin-top: 3px; }
#detail-body { padding: 16px 22px 20px; }
.detail-section { margin-bottom: 18px; }
.detail-section-title { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.8px; color: var(--text-dim); margin-bottom: 8px; }
.detail-item { display: flex; align-items: flex-start; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.detail-item:last-child { border-bottom: none; }
.detail-item-icon { font-size: 14px; flex-shrink: 0; margin-top: 1px; }
.detail-item-text { flex: 1; min-width: 0; }
.detail-item-time { font-size: 11px; color: var(--text-dim); margin-top: 2px; }
.conflict-alert { background: rgba(191,59,44,0.06); border: 1px solid rgba(191,59,44,0.18); border-left: 3px solid var(--accent); border-radius: var(--radius-sm); padding: 10px 12px; margin-bottom: 12px; font-size: 13px; color: #8b2010; }
.conflict-alert.soft { background: rgba(180,83,9,0.06); border-color: rgba(180,83,9,0.18); border-left-color: var(--yellow); color: #7a4208; }
.conflict-alert strong { display: block; margin-bottom: 2px; font-size: 13px; }
.conflict-resolution { font-size: 12px; font-style: italic; color: var(--text-dim); margin-top: 4px; }
.p1-badge { font-size: 10px; font-weight: 700; background: rgba(191,59,44,0.1); color: var(--accent); border: 1px solid rgba(191,59,44,0.18); border-radius: var(--radius-xs); padding: 1px 6px; flex-shrink: 0; }

.detail-panel:not(.hidden) .detail-content { animation: panel-up 0.4s cubic-bezier(0.175,0.885,0.32,1.1); }
.detail-panel:not(.hidden) .detail-overlay { animation: overlay-in 0.25s ease; }
@keyframes panel-up { from { transform: translateY(100%); } to { transform: translateY(0); } }
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

@media (min-width: 700px) {
  .detail-content { max-width: 780px; width: 90vw; left: 50%; right: auto; bottom: auto; top: 50%; transform: translate(-50%,-50%); border-radius: var(--radius); max-height: 90dvh; }
  .detail-panel:not(.hidden) .detail-content { animation: modal-in 0.25s cubic-bezier(0.22,1,0.36,1); }
  @keyframes modal-in { from { opacity:0; transform:translate(-50%,-47%); } to { opacity:1; transform:translate(-50%,-50%); } }
}

/* ── Tasks ──────────────────────────────────── */
.task-item { gap: 8px !important; }
.task-check-wrap { position: relative; width: 20px; height: 20px; flex-shrink: 0; margin-top: 1px; }
.task-check { position: absolute; opacity: 0; width: 20px; height: 20px; cursor: pointer; z-index: 1; }
.task-checkmark { display: block; width: 18px; height: 18px; border: 2px solid var(--border-md); border-radius: 50%; transition: all 0.15s; }
.task-check:hover + .task-checkmark { border-color: var(--accent); }
.task-check:checked + .task-checkmark { background: var(--accent); border-color: var(--accent); }
.task-check:checked + .task-checkmark::after { content: '✓'; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 11px; font-weight: 700; width: 100%; height: 100%; }
.task-text { flex: 1; min-width: 0; }
.task-item.task-completing .task-text { opacity: 0.5; }
.task-item.task-done .task-text { text-decoration: line-through; opacity: 0.4; }
.task-item.task-done { opacity: 0.5; }

/* ── Events ─────────────────────────────────── */
.event-item { gap: 10px !important; }
.event-time { font-size: 11px; font-weight: 600; color: var(--accent); white-space: nowrap; min-width: 70px; flex-shrink: 0; }
.location-link { color: var(--accent); text-decoration: none; font-weight: 500; }
.location-link:hover { text-decoration: underline; }
.ext-link { display: flex; align-items: center; justify-content: center; width: 26px; height: 26px; border-radius: var(--radius-xs); background: var(--bg-surface-2); color: var(--text-muted); text-decoration: none; font-size: 13px; flex-shrink: 0; transition: all 0.12s; }
.ext-link:hover { background: var(--accent-soft); color: var(--accent); }

/* ── Location Edit Button ───────────────────── */
.loc-edit-btn {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: var(--radius-xs);
  margin-left: 4px;
  transition: all 0.12s;
}
.loc-edit-btn:hover { color: var(--accent); background: var(--accent-soft); }

/* ── Conflict Banner ────────────────────────── */
.conflict-banner {
  margin: 0 16px 8px;
  padding: 10px 14px;
  background: rgba(191,59,44,0.08);
  border: 1px solid rgba(191,59,44,0.2);
  border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: #8b2010;
  cursor: pointer;
  animation: row-in 0.3s ease;
}
.conflict-banner:hover { background: rgba(191,59,44,0.12); }

/* ── Location Editor (in detail panel) ─────── */
.location-editor {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
  padding: 8px 0;
}
.loc-pill {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  font-family: var(--font);
  border: 1px solid var(--border-md);
  border-radius: 100px;
  background: var(--bg-surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.12s;
}
.loc-pill:hover { border-color: var(--accent); color: var(--accent); background: var(--accent-soft); }
.loc-pill.active { background: var(--accent); color: #fff; border-color: var(--accent); }
.loc-clear {
  padding: 4px 10px;
  font-size: 12px;
  font-family: var(--font);
  border: 1px dashed var(--border-md);
  border-radius: 100px;
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  transition: all 0.12s;
}
.loc-clear:hover { border-color: var(--red); color: var(--red); }

/* Location autocomplete */
.loc-autocomplete-wrap { position: relative; width: 100%; margin-top: 4px; }
.loc-autocomplete-input {
  width: 100%; padding: 6px 10px; font-size: 13px; font-family: var(--font);
  border: 1px solid var(--border-md); border-radius: 8px; background: var(--bg-surface);
  color: var(--text-main); outline: none; box-sizing: border-box;
}
.loc-autocomplete-input:focus { border-color: var(--accent); }
.loc-autocomplete-dropdown {
  position: absolute; top: 100%; left: 0; right: 0; z-index: 100;
  background: var(--bg-surface); border: 1px solid var(--border-md); border-radius: 8px;
  margin-top: 4px; box-shadow: 0 4px 12px rgba(0,0,0,0.1); overflow: hidden;
}
.loc-autocomplete-option {
  padding: 8px 12px; cursor: pointer; font-size: 13px; display: flex; align-items: center; gap: 8px;
}
.loc-autocomplete-option:hover { background: var(--accent-soft); }
.loc-meta { font-size: 11px; color: var(--text-dim); }
.loc-range-btn { border-style: dashed; }

/* ── Bulk Location Editor ────────────────── */
.bulk-editor {
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  border: 1px solid var(--border-md);
  border-radius: 10px;
  background: var(--bg-surface);
}
.bulk-date-row {
  display: flex;
  align-items: center;
  gap: 6px;
}
.bulk-date-sep {
  font-size: 12px;
  color: var(--text-dim);
}
.bulk-date-input {
  flex: 1;
  padding: 5px 8px;
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border-md);
  border-radius: 8px;
  background: var(--bg-card);
  color: var(--text);
  outline: none;
  box-sizing: border-box;
}
.bulk-date-input:focus { border-color: var(--accent); }
.bulk-pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.bulk-apply-btn {
  background: var(--accent) !important;
  color: #fff !important;
  border-color: var(--accent) !important;
  align-self: flex-start;
}
.bulk-apply-btn:hover { background: var(--accent-hover) !important; }
.bulk-apply-btn:disabled { opacity: 0.6; cursor: wait; }

/* ── Settings Panel ────────────────────────── */
.settings-loc-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
}
.settings-loc-item:last-child { border-bottom: none; }
.settings-loc-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 16px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: var(--radius-xs);
  transition: all 0.12s;
}
.settings-loc-remove:hover { color: var(--red); background: rgba(191,59,44,0.08); }

.settings-add-row {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.settings-input {
  flex: 1;
  padding: 8px 12px;
  font-size: 13px;
  font-family: var(--font);
  border: 1px solid var(--border-md);
  border-radius: var(--radius-sm);
  background: var(--bg-surface);
  color: var(--text);
  outline: none;
  transition: border-color 0.12s;
}
.settings-input:focus { border-color: var(--accent); }
.settings-add-btn {
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  font-family: var(--font);
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 0.12s;
}
.settings-add-btn:hover { background: var(--accent-hover); }

/* ── Timeline ───────────────────────────────── */
.timeline-section { position: relative; }

.timeline-header {
  display: flex; align-items: center; justify-content: space-between;
}

.tl-expand-btn {
  background: none; border: none; color: var(--text-dim); font-size: 16px;
  cursor: pointer; padding: 2px 6px; border-radius: var(--radius-xs); transition: all 0.12s;
}
.tl-expand-btn:hover { color: var(--accent); background: var(--accent-soft); }

.timeline {
  position: relative;
  height: 600px;
  border-radius: var(--radius-sm);
  overflow-y: auto;
  border: 1px solid var(--border);
  background: var(--bg-surface);
}

.tl-hour-grid {
  position: absolute; inset: 0; pointer-events: none;
}

.tl-hour-line {
  position: absolute; left: 0; right: 0; height: 1px;
  background: var(--border); display: flex; align-items: flex-start;
}

.tl-hour-label {
  font-size: 10px; font-weight: 600; color: var(--text-dim);
  width: 36px; text-align: right; padding-right: 8px;
  transform: translateY(-7px); flex-shrink: 0;
}

.tl-blocks {
  position: absolute; left: 40px; right: 8px; top: 0; bottom: 0;
}

.tl-block {
  position: absolute; left: 0; right: 35%;
  border-radius: 6px; padding: 4px 8px;
  font-size: 11px; font-weight: 600; color: #fff;
  overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  opacity: 0.35; transition: opacity 0.12s;
}

.tl-block:hover { opacity: 0.6; }

.tl-event {
  position: absolute; left: 60%; right: 0;
  border-radius: 6px; padding: 4px 8px;
  font-size: 11px; font-weight: 500;
  background: var(--bg-card); border: 1px solid var(--border-md);
  color: var(--text); overflow: hidden; white-space: nowrap; text-overflow: ellipsis;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  cursor: pointer; transition: box-shadow 0.12s;
  z-index: 2;
}

.tl-event:hover { box-shadow: 0 2px 8px rgba(0,0,0,0.12); }
.tl-event-time { font-size: 9px; color: var(--text-muted); margin-right: 4px; }

.tl-now-line {
  position: absolute; left: 32px; right: 0; height: 2px;
  background: var(--accent); z-index: 5;
}
.tl-now-line::before {
  content: ''; position: absolute; left: -4px; top: -3px;
  width: 8px; height: 8px; border-radius: 50%; background: var(--accent);
}

/* Day theme badge */
.meta-theme {
  font-size: 10px; font-weight: 600; color: var(--accent);
  background: var(--accent-soft); padding: 1px 8px;
  border-radius: 100px; white-space: nowrap;
}

/* Fullscreen timeline */
.tl-fullscreen {
  position: fixed; inset: 0; z-index: 100;
  background: var(--bg); display: flex; flex-direction: column;
}
.tl-fullscreen .tl-fs-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid var(--border);
}
.tl-fullscreen .tl-fs-title { font-size: 17px; font-weight: 700; }
.tl-fullscreen .timeline {
  flex: 1; height: auto; border: none; border-radius: 0; margin: 0;
}

/* ── Mobile ─────────────────────────────────── */
@media (max-width: 480px) {
  header { padding: 12px 14px 10px; }
  header h1 { font-size: 18px; }
  #mini-cal { margin: 8px 10px; }
  #cal-month-label { font-size: 14px; }
  .cal-two-months { grid-template-columns: 1fr; gap: 12px; }
  .cal-cell { height: 36px; }
  .cal-num { width: 28px; height: 28px; font-size: 12px; }
  #radar-table { margin: 0 10px; }
  .day-row { padding: 10px 14px; gap: 10px; }
  .day-num { font-size: 20px; }
  .day-row-focus { font-size: 13px; }
  .month-sep { padding: 14px 14px 5px; }
  .legend-popover { right: 10px; left: 10px; width: auto; }
}

/* ── Suggestions ──────────────────────────────── */
.suggestions-section { margin-bottom: 18px; }
.suggestion-item {
  font-size: 13px;
  color: var(--text);
  background: var(--bg-surface-2);
  border-radius: var(--radius-xs);
  padding: 8px 12px;
  margin-bottom: 6px;
  line-height: 1.4;
}
.suggestion-item:last-child { margin-bottom: 0; }
