/* ============================================
   FamilyDash — Family Dashboard
   Warm editorial aesthetic · Light + Dark
   ============================================ */

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

:root {
  --font-display: 'Fraunces', 'Times New Roman', serif;
  --font-body: 'Outfit', -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Courier New', monospace;

  --radius-sm: 6px;
  --radius: 12px;
  --radius-lg: 20px;
  --radius-xl: 28px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 180ms var(--ease);
  --med: 320ms var(--ease);
  --slow: 600ms var(--ease);
}

/* ---------- DARK THEME ---------- */
[data-theme="dark"] {
  --bg: #0f0e0c;
  --bg-elev: #1a1815;
  --bg-elev-2: #232019;
  --bg-glass: rgba(26, 24, 21, 0.72);
  --ink: #f5ede0;
  --ink-dim: #a8a092;
  --ink-faint: #6b6458;
  --line: rgba(245, 237, 224, 0.08);
  --line-strong: rgba(245, 237, 224, 0.16);
  --accent: #e8a87c;
  --accent-2: #c38d5f;
  --accent-glow: rgba(232, 168, 124, 0.25);
  --success: #8fb673;
  --warn: #e4b363;
  --danger: #d87060;
  --info: #7fa8c9;
  --tag-bg: rgba(232, 168, 124, 0.12);
  --tag-ink: #e8a87c;
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.25);
  --shadow: 0 12px 40px rgba(0,0,0,0.4);
  --shadow-lg: 0 30px 80px rgba(0,0,0,0.5);
  --noise-opacity: 0.04;
}

/* ---------- LIGHT THEME ---------- */
[data-theme="light"] {
  --bg: #faf7f0;
  --bg-elev: #fffdf7;
  --bg-elev-2: #f3efe4;
  --bg-glass: rgba(255, 253, 247, 0.72);
  --ink: #1a1612;
  --ink-dim: #5c554a;
  --ink-faint: #948b7c;
  --line: rgba(26, 22, 18, 0.08);
  --line-strong: rgba(26, 22, 18, 0.16);
  --accent: #b85c38;
  --accent-2: #8f4626;
  --accent-glow: rgba(184, 92, 56, 0.18);
  --success: #5a7a3e;
  --warn: #a67a2f;
  --danger: #b84732;
  --info: #4c7699;
  --tag-bg: rgba(184, 92, 56, 0.10);
  --tag-ink: #8f4626;
  --shadow-sm: 0 1px 3px rgba(60, 40, 20, 0.08);
  --shadow: 0 8px 30px rgba(60, 40, 20, 0.10);
  --shadow-lg: 0 20px 60px rgba(60, 40, 20, 0.14);
  --noise-opacity: 0.035;
}

html, body {
  min-height: 100%;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background var(--med), color var(--med);
}

body {
  background-image:
    radial-gradient(circle at 15% 10%, var(--accent-glow) 0%, transparent 40%),
    radial-gradient(circle at 85% 90%, var(--accent-glow) 0%, transparent 45%);
  background-attachment: fixed;
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='3'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
  opacity: var(--noise-opacity);
  mix-blend-mode: overlay;
}

.hidden { display: none !important; }

/* ---------- LOADING ---------- */
.loading-overlay {
  position: fixed; inset: 0;
  display: grid; place-items: center;
  background: var(--bg); z-index: 1000;
}
.loader { text-align: center; }
.loader p {
  font-family: var(--font-mono);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-top: 24px;
}
.loader-mark {
  width: 56px; height: 56px;
  margin: 0 auto;
  display: grid;
  place-items: center;
  border-radius: 16px;
  background: var(--accent);
  color: var(--bg);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 700;
  font-size: 36px;
  line-height: 1;
  position: relative;
  animation: pulseMark 1.8s var(--ease) infinite;
}
.loader-mark::before { content: 'D'; display: block; margin-top: -4px; }
.loader-mark::after {
  content: '';
  position: absolute;
  right: -4px; top: -4px;
  width: 10px; height: 10px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 20px var(--accent);
  animation: dotBreathe 1.8s var(--ease) infinite;
}
@keyframes pulseMark {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 var(--accent-glow); }
  50%      { transform: scale(1.04); box-shadow: 0 0 0 16px transparent; }
}
@keyframes dotBreathe {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.4; }
}

/* ---------- LOGIN ---------- */
.login-view {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  overflow: hidden;
}
.login-bg { position: absolute; inset: 0; overflow: hidden; z-index: 0; }
.orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  animation: drift 18s ease-in-out infinite alternate;
}
.orb-1 { width: 500px; height: 500px; background: var(--accent); top: -100px; left: -100px; }
.orb-2 { width: 400px; height: 400px; background: var(--accent-2); bottom: -80px; right: -80px; animation-delay: -6s; }
.orb-3 { width: 300px; height: 300px; background: var(--warn); top: 40%; left: 60%; animation-delay: -12s; opacity: 0.3; }
@keyframes drift {
  0% { transform: translate(0,0) scale(1); }
  100% { transform: translate(40px, -30px) scale(1.1); }
}

.login-card {
  position: relative; z-index: 1;
  max-width: 460px; width: 100%;
  background: var(--bg-glass);
  backdrop-filter: blur(24px) saturate(1.2);
  -webkit-backdrop-filter: blur(24px) saturate(1.2);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius-xl);
  padding: 48px 40px;
  box-shadow: var(--shadow-lg);
  animation: rise 0.8s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: none; } }

.brand { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 32px; }
.brand-mark {
  font-family: var(--font-display);
  font-weight: 800; font-size: 28px;
  font-style: italic;
  color: var(--accent);
  line-height: 1;
}
.brand-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 12px var(--accent);
}
.brand.small { margin-bottom: 0; }
.brand.small .brand-mark { font-size: 22px; }

.login-title { font-family: var(--font-display); font-weight: 400; line-height: 0.95; margin-bottom: 20px; }
.login-title .line-1 {
  display: block; font-size: 72px; font-weight: 300; font-style: italic;
  letter-spacing: -0.04em; color: var(--ink);
}
.login-title .line-2 {
  display: block; font-size: 15px; font-weight: 400; font-style: normal;
  color: var(--ink-dim); margin-top: 12px; font-family: var(--font-body); letter-spacing: 0.01em;
}
.login-sub { font-size: 13px; color: var(--ink-faint); margin-bottom: 32px; padding-bottom: 24px; border-bottom: 1px solid var(--line); }
.btn-google {
  width: 100%;
  display: flex; align-items: center; justify-content: center; gap: 12px;
  padding: 16px 24px;
  background: var(--ink); color: var(--bg);
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-weight: 500; font-size: 15px;
  cursor: pointer;
  transition: transform var(--fast), box-shadow var(--fast);
}
.btn-google:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-google:active { transform: translateY(0); }
.btn-google svg { background: white; border-radius: 4px; padding: 2px; }

.login-foot {
  font-family: var(--font-mono); font-size: 10px;
  text-transform: uppercase; letter-spacing: 0.2em;
  color: var(--ink-faint); text-align: center; margin-top: 24px;
}

/* ---------- APP ---------- */
.app-view { position: relative; z-index: 1; min-height: 100vh; display: flex; flex-direction: column; }

.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 24px;
  padding: 14px 28px;
  background: var(--bg-glass);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.topbar-left { display: flex; align-items: center; gap: 16px; }
.topbar-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.sync-indicator {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 10px;
  border-radius: 99px;
  background: var(--tag-bg);
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: 0.15em;
  color: var(--success);
}
.pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 0 var(--success);
  animation: pulse 2s ease-out infinite;
}
@keyframes pulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 8px transparent; opacity: 0.6; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-elev-2);
  border-radius: 99px;
  padding: 4px;
  border: 1px solid var(--line);
}
.tab {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  background: transparent; border: none; border-radius: 99px;
  font-family: var(--font-body); font-size: 13px; font-weight: 500;
  color: var(--ink-dim); cursor: pointer;
  transition: all var(--fast);
  position: relative;
}
.tab:hover { color: var(--ink); }
.tab.active { background: var(--bg-elev); color: var(--ink); box-shadow: var(--shadow-sm); }
.tab-icon { font-size: 14px; }
.tab-count {
  font-family: var(--font-mono); font-size: 10px;
  background: var(--line-strong); color: var(--ink-dim);
  padding: 2px 6px; border-radius: 99px; min-width: 20px; text-align: center;
}
.tab.active .tab-count { background: var(--accent); color: var(--bg); }

.icon-btn {
  display: grid; place-items: center;
  width: 36px; height: 36px;
  background: transparent; border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink-dim);
  cursor: pointer;
  transition: all var(--fast);
}
.icon-btn:hover { color: var(--ink); background: var(--bg-elev); border-color: var(--line-strong); }
.icon-btn svg { width: 16px; height: 16px; }

#theme-toggle .sun { display: none; }
#theme-toggle .moon { display: block; }
[data-theme="light"] #theme-toggle .sun { display: block; }
[data-theme="light"] #theme-toggle .moon { display: none; }

.user-chip {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 12px 4px 4px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 99px;
}
.user-chip img { width: 28px; height: 28px; border-radius: 50%; }
.user-chip span {
  font-size: 13px; font-weight: 500; color: var(--ink);
  max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

/* ---------- AMBIENT STRIP (clock + weather) ---------- */
.ambient-strip {
  max-width: 960px;
  margin: 24px auto 0;
  padding: 0 28px;
  display: flex;
  align-items: stretch;
  gap: 0;
}
.clock, .weather {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 20px 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  position: relative;
  overflow: hidden;
}
.clock { border-top-right-radius: 0; border-bottom-right-radius: 0; border-right: none; justify-content: flex-start; flex-direction: column; align-items: flex-start; gap: 4px; }
.weather { border-top-left-radius: 0; border-bottom-left-radius: 0; justify-content: flex-start; }
.ambient-divider { width: 1px; background: var(--line); z-index: 1; }

.clock-time {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
  display: flex; align-items: baseline; gap: 2px;
}
.clock-s {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 400;
  font-style: normal;
  color: var(--accent);
  letter-spacing: 0;
  margin-left: 6px;
}
.clock-date {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
}

/* Weather */
.weather-icon {
  width: 54px; height: 54px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.weather-icon svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 4px 12px var(--accent-glow));
}
.weather-body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
  flex: 1;
}
.weather-temp {
  font-family: var(--font-display);
  font-size: 36px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.04em;
  line-height: 1;
  color: var(--ink);
}
.weather-temp sup {
  font-size: 0.5em;
  color: var(--ink-dim);
  font-style: normal;
  margin-left: 2px;
  vertical-align: super;
}
.weather-desc {
  font-size: 13px;
  color: var(--ink-dim);
  text-transform: capitalize;
}
.weather-meta {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-faint);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-top: 2px;
}
.weather-loading {
  display: flex; align-items: center; gap: 6px;
  color: var(--ink-faint);
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
}
.dot-pulse {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  animation: dotPulse 1.4s ease-in-out infinite;
}
.dot-pulse:nth-child(2) { animation-delay: 0.2s; }
.dot-pulse:nth-child(3) { animation-delay: 0.4s; }
.weather-loading-text { margin-left: 8px; }
@keyframes dotPulse {
  0%, 80%, 100% { opacity: 0.3; transform: scale(0.8); }
  40% { opacity: 1; transform: scale(1.2); }
}
.weather-error {
  font-size: 12px;
  color: var(--ink-dim);
}

/* ---------- CONTENT ---------- */
.content {
  flex: 1;
  max-width: 960px;
  width: 100%;
  margin: 0 auto;
  padding: 32px 28px 80px;
}

.section { display: none; animation: fadeSlide 0.4s var(--ease); }
.section.active { display: block; }
@keyframes fadeSlide { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.section-head {
  margin-bottom: 32px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
}
.section-title {
  font-family: var(--font-display);
  font-size: 56px;
  font-weight: 300;
  font-style: italic;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--ink);
  display: flex; align-items: baseline; gap: 16px;
}
.section-title .num {
  font-family: var(--font-mono); font-size: 12px;
  font-style: normal; font-weight: 400;
  color: var(--accent); letter-spacing: 0.1em;
  padding-top: 8px;
}
.section-sub { font-size: 14px; color: var(--ink-dim); margin-top: 8px; margin-left: 42px; }

/* ---------- ADD FORM ---------- */
.add-form {
  display: flex;
  gap: 8px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 8px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-sm);
  transition: border-color var(--fast), box-shadow var(--fast);
}
.add-form:focus-within { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-glow); }
.add-form input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 12px 16px;
  font-family: var(--font-body);
  font-size: 14px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.add-form input[name="title"] { flex: 3; font-weight: 500; }
.add-form input[name="tags"] { flex: 1.5; border-left: 1px solid var(--line); }
.add-form input[name="dueDate"] { flex: 1; border-left: 1px solid var(--line); color: var(--ink-dim); color-scheme: light dark; }
.add-form input::placeholder { color: var(--ink-faint); }

.btn-add {
  display: flex; align-items: center; gap: 6px;
  padding: 10px 16px;
  background: var(--accent); color: var(--bg);
  border: none; border-radius: var(--radius);
  font-family: var(--font-body); font-weight: 600; font-size: 13px;
  cursor: pointer;
  transition: transform var(--fast), background var(--fast);
}
.btn-add:hover { background: var(--accent-2); transform: scale(1.02); }
.btn-add:active { transform: scale(0.98); }
.btn-add svg { width: 14px; height: 14px; }

.btn-ghost {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line);
  border-radius: 99px;
  font-family: var(--font-body); font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: all var(--fast);
}
.btn-ghost:hover { color: var(--ink); border-color: var(--line-strong); background: var(--bg-elev); }
.btn-ghost svg { width: 12px; height: 12px; }
.btn-ghost.spinning svg { animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- LIST ---------- */
.list { display: flex; flex-direction: column; gap: 4px; }

.item {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all var(--fast);
  animation: itemIn 0.3s var(--ease);
}
@keyframes itemIn { from { opacity: 0; transform: translateY(-4px); } to { opacity: 1; transform: none; } }
.item:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.item.done { opacity: 0.55; }
.item.done .item-title { text-decoration: line-through; color: var(--ink-dim); }
.item.overdue .item-due { color: var(--danger); font-weight: 600; }

.check {
  appearance: none; -webkit-appearance: none;
  width: 22px; height: 22px;
  border: 2px solid var(--line-strong);
  border-radius: 6px;
  cursor: pointer;
  display: grid; place-items: center;
  transition: all var(--fast);
  position: relative;
  background: transparent;
  flex-shrink: 0;
}
.check:hover { border-color: var(--accent); }
.check:checked { background: var(--accent); border-color: var(--accent); }
.check:checked::after {
  content: '';
  width: 10px; height: 6px;
  border: 2px solid var(--bg);
  border-top: 0; border-right: 0;
  transform: rotate(-45deg) translate(1px, -1px);
}

.item-body { min-width: 0; }
.item-title { font-weight: 500; font-size: 15px; color: var(--ink); margin-bottom: 4px; word-wrap: break-word; }
.item-meta {
  display: flex; flex-wrap: wrap; gap: 6px 10px;
  font-size: 11px; color: var(--ink-faint); align-items: center;
}
.item-meta .by { display: inline-flex; align-items: center; gap: 5px; }
.item-meta .by img { width: 16px; height: 16px; border-radius: 50%; }
.item-due {
  font-family: var(--font-mono);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 10px;
  color: var(--warn);
}
.item-tag {
  padding: 2px 8px;
  background: var(--tag-bg); color: var(--tag-ink);
  border-radius: 99px;
  font-size: 10px; font-weight: 600;
  letter-spacing: 0.02em; text-transform: lowercase;
}

.item-delete {
  background: transparent; border: none;
  color: var(--ink-faint); cursor: pointer;
  padding: 6px; border-radius: 6px;
  display: grid; place-items: center;
  opacity: 0;
  transition: all var(--fast);
}
.item:hover .item-delete { opacity: 1; }
.item-delete:hover { color: var(--danger); background: var(--bg-elev-2); }
.item-delete svg { width: 14px; height: 14px; }

.list-empty {
  text-align: center;
  padding: 48px 20px;
  color: var(--ink-faint);
  font-family: var(--font-display);
  font-size: 18px;
  font-style: italic;
}
.list-empty::before { content: '— '; color: var(--accent); }
.list-empty::after { content: ' —'; color: var(--accent); }

/* ---------- CALENDAR ---------- */
.cal-connect {
  padding: 48px 24px;
  background: var(--bg-elev);
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius-lg);
  text-align: center;
}
.cal-connect-inner {
  max-width: 400px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.cal-icon {
  font-size: 44px;
  filter: grayscale(0.2);
}
.cal-connect h3 {
  font-family: var(--font-display);
  font-weight: 400;
  font-style: italic;
  font-size: 26px;
  color: var(--ink);
}
.cal-connect p {
  color: var(--ink-dim);
  font-size: 13px;
  margin-bottom: 8px;
}

.cal-events { display: flex; flex-direction: column; gap: 20px; }

.cal-day {
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 20px;
  padding-bottom: 20px;
  border-bottom: 1px solid var(--line);
}
.cal-day:last-child { border-bottom: none; }
.cal-day-head {
  position: sticky;
  top: 80px;
  align-self: start;
}
.cal-day-num {
  font-family: var(--font-display);
  font-size: 48px;
  font-weight: 300;
  font-style: italic;
  line-height: 1;
  color: var(--ink);
  letter-spacing: -0.04em;
}
.cal-day-label {
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--ink-dim);
  margin-top: 4px;
}
.cal-day-today .cal-day-num { color: var(--accent); }
.cal-day-today .cal-day-label { color: var(--accent); }

.cal-day-events { display: flex; flex-direction: column; gap: 6px; }
.cal-event {
  display: grid;
  grid-template-columns: 68px 3px 1fr;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  align-items: start;
  transition: all var(--fast);
  animation: itemIn 0.3s var(--ease);
}
.cal-event:hover { border-color: var(--line-strong); box-shadow: var(--shadow-sm); }
.cal-event-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  line-height: 1.4;
  white-space: nowrap;
}
.cal-event-time .start { color: var(--ink); font-weight: 500; }
.cal-event-time .allday {
  color: var(--accent);
  font-size: 10px;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}
.cal-event-bar {
  width: 3px;
  height: 100%;
  min-height: 24px;
  background: var(--accent);
  border-radius: 2px;
}
.cal-event-body { min-width: 0; }
.cal-event-title {
  font-size: 14px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 2px;
  word-wrap: break-word;
}
.cal-event-meta {
  display: flex;
  gap: 10px;
  font-size: 11px;
  color: var(--ink-faint);
  flex-wrap: wrap;
}
.cal-event-meta .location::before { content: '📍 '; opacity: 0.6; }

.cal-error {
  padding: 24px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  text-align: center;
  color: var(--ink-dim);
  font-size: 13px;
}

/* ---------- TOAST ---------- */
.toast {
  position: fixed;
  bottom: 24px; left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  z-index: 100;
  transition: transform var(--med);
  max-width: 90vw;
  text-align: center;
}
.toast.show { transform: translateX(-50%) translateY(0); }
.toast.error { background: var(--danger); }

/* ---------- FOOTER ---------- */
.foot {
  padding: 24px 28px;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--ink-faint);
  border-top: 1px solid var(--line);
}

/* ---------- RESPONSIVE ---------- */
@media (max-width: 720px) {
  .topbar { padding: 12px 16px; gap: 12px; flex-wrap: wrap; }
  .topbar-left, .topbar-right { flex: 0 0 auto; }
  .tabs { order: 3; flex: 1 0 100%; justify-content: center; overflow-x: auto; }
  .tab-label { display: none; }
  .tab { padding: 8px 12px; }
  .user-chip span { display: none; }
  .user-chip { padding: 4px; }
  .ambient-strip { padding: 0 16px; margin-top: 16px; }
  .clock, .weather { padding: 16px; }
  .clock-time { font-size: 36px; }
  .weather-temp { font-size: 28px; }
  .weather-icon { width: 44px; height: 44px; }
  .content { padding: 24px 16px 60px; }
  .section-title { font-size: 40px; }
  .section-sub { margin-left: 0; }
  .add-form { flex-wrap: wrap; }
  .add-form input[name="title"] { flex: 1 0 100%; }
  .add-form input[name="tags"], .add-form input[name="dueDate"] { border-left: none; border-top: 1px solid var(--line); }
  .cal-day { grid-template-columns: 72px 1fr; gap: 12px; }
  .cal-day-num { font-size: 36px; }
  .cal-event { grid-template-columns: 56px 3px 1fr; padding: 10px 12px; }
}

/* ============================================
   INVITE-ONLY: Settings drawer + denied view
   ============================================ */

.btn-ghost-lg {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  width: 100%;
  padding: 14px 20px;
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  font-family: var(--font-body); font-size: 14px; font-weight: 500;
  cursor: pointer;
  transition: all var(--fast);
}
.btn-ghost-lg:hover { color: var(--ink); border-color: var(--ink); background: var(--bg-elev); }

/* Overlay + drawer */
.overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex; justify-content: flex-end;
  animation: fadeIn 0.2s var(--ease);
}
[data-theme="light"] .overlay { background: rgba(60, 40, 20, 0.4); }
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }

.drawer {
  width: 100%;
  max-width: 460px;
  height: 100%;
  background: var(--bg);
  border-left: 1px solid var(--line);
  box-shadow: var(--shadow-lg);
  overflow-y: auto;
  animation: slideIn 0.32s var(--ease);
  display: flex;
  flex-direction: column;
}
@keyframes slideIn { from { transform: translateX(100%); } to { transform: translateX(0); } }

.drawer-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 20px 28px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--bg-glass);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  z-index: 1;
}
.drawer-head h3 {
  font-family: var(--font-display);
  font-weight: 400; font-style: italic; font-size: 24px;
  letter-spacing: -0.02em;
  color: var(--ink);
}

.drawer-section {
  padding: 24px 28px;
  border-bottom: 1px solid var(--line);
}
.drawer-section:last-child { border-bottom: none; }
.drawer-section h4 {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.2em;
  color: var(--accent);
  margin-bottom: 4px;
}
.drawer-hint {
  font-size: 12px;
  color: var(--ink-dim);
  margin-bottom: 16px;
  line-height: 1.5;
}

.members-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}
.member {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: all var(--fast);
  animation: itemIn 0.3s var(--ease);
}
.member-avatar {
  width: 32px; height: 32px;
  border-radius: 50%;
  background: var(--tag-bg);
  color: var(--tag-ink);
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
  font-size: 14px;
}
.member-avatar img { width: 100%; height: 100%; border-radius: 50%; }
.member-body { min-width: 0; }
.member-email {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.member-tag {
  font-family: var(--font-mono);
  font-size: 9px;
  text-transform: uppercase;
  letter-spacing: 0.15em;
  color: var(--accent);
  margin-top: 2px;
}
.member-remove {
  background: transparent;
  border: none;
  color: var(--ink-faint);
  cursor: pointer;
  padding: 6px;
  border-radius: 6px;
  display: grid; place-items: center;
  transition: all var(--fast);
}
.member-remove:hover { color: var(--danger); background: var(--bg-elev-2); }
.member-remove svg { width: 14px; height: 14px; }
.member.is-owner .member-remove,
.member.is-self .member-remove { display: none; }

.invite-form {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 6px;
  transition: border-color var(--fast), box-shadow var(--fast);
}
.invite-form:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}
.invite-form input {
  flex: 1;
  background: transparent;
  border: none;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
  outline: none;
  min-width: 0;
}
.invite-form input::placeholder { color: var(--ink-faint); }

@media (max-width: 520px) {
  .drawer { max-width: 100%; }
  .drawer-head, .drawer-section { padding: 20px 18px; }
}
