:root {
  --bg: #FFF8EF;
  --card-bg: #FFFFFF;
  --ink: #2B2B33;
  --muted: #8A8A99;
  --border: #F0E6D8;
  --radius: 22px;
  --radius-sm: 14px;
  --shadow: 0 12px 28px rgba(43, 43, 51, 0.10);

  --coral: #FF6B6B;
  --teal: #06AED5;
  --gold: #FFC145;
  --violet: #A66CFF;
  --green: #3FB27F;
  --blue: #3E7CB1;
  --pink: #FF8FB1;
  --orange: #FF9F45;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: -apple-system, "SF Pro Rounded", "Segoe UI", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
}

#app {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---------- Header ---------- */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 22px 32px;
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
}

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

.brand-dot {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--coral), var(--gold));
  box-shadow: 0 0 0 6px rgba(255, 107, 107, 0.12);
}

.brand h1 {
  font-size: 26px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.02em;
}

.clock {
  text-align: center;
}

#clock-time {
  font-size: 34px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.02em;
}

#clock-date {
  font-size: 14px;
  color: var(--muted);
  font-weight: 600;
  margin-top: 2px;
}

.conn-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--muted);
}

.conn-status .dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: #E0574C;
}

.conn-status .dot.online {
  background: var(--green);
  box-shadow: 0 0 0 4px rgba(63, 178, 127, 0.18);
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 10px;
  padding: 16px 32px;
  overflow-x: auto;
  background: var(--bg);
}

.tab {
  --tab-color: var(--coral);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 999px;
  border: none;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
  cursor: pointer;
  white-space: nowrap;
  transition: transform 0.12s ease, background 0.12s ease, color 0.12s ease;
}

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

.tab.active {
  background: var(--tab-color);
  color: white;
}

.tab-icon {
  font-size: 17px;
}

.tab-count {
  background: rgba(0, 0, 0, 0.08);
  border-radius: 999px;
  padding: 1px 8px;
  font-size: 12px;
}

.tab.active .tab-count {
  background: rgba(255, 255, 255, 0.28);
}

/* ---------- Main ---------- */
main {
  flex: 1;
  padding: 8px 32px 40px;
}

.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--muted);
  font-weight: 600;
  font-size: 16px;
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ---------- Calendar ---------- */
.calendar-header {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 20px;
  margin: 8px 0 16px;
}

.calendar-header h2 {
  font-size: 22px;
  font-weight: 800;
  min-width: 220px;
  text-align: center;
  margin: 0;
}

.nav-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: var(--card-bg);
  box-shadow: var(--shadow);
  font-size: 20px;
  font-weight: 800;
  cursor: pointer;
  color: var(--ink);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  background: transparent;
}

.calendar-dow {
  text-align: center;
  font-weight: 800;
  color: var(--muted);
  font-size: 13px;
  padding-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.calendar-cell {
  background: var(--card-bg);
  border-radius: var(--radius-sm);
  min-height: 96px;
  padding: 8px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.calendar-cell.empty {
  background: transparent;
  box-shadow: none;
}

.calendar-cell.today {
  outline: 3px solid var(--coral);
  outline-offset: -3px;
}

.day-num {
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
}

.calendar-cell.today .day-num {
  color: var(--coral);
}

.event-chip {
  border-radius: 8px;
  color: white;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 7px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.event-more {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
}

.unscheduled-section {
  margin-top: 22px;
}

.unscheduled-section h3 {
  font-size: 15px;
  font-weight: 800;
  color: var(--muted);
  margin: 0 0 10px;
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.chip-row .event-chip {
  font-size: 13px;
  padding: 6px 12px;
  border-radius: 999px;
}

/* ---------- Card grid (chores / rewards / generic) ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-top: 8px;
}

.sticky-card {
  --accent: var(--teal);
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  border-top: 6px solid var(--accent);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.sticky-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 15px;
}

.sticky-speaker {
  font-weight: 800;
  font-size: 14px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.sticky-request {
  font-weight: 700;
  font-size: 16px;
}

.sticky-result {
  font-size: 14px;
  color: var(--muted);
}

.sticky-time {
  font-size: 12px;
  color: var(--muted);
  margin-top: auto;
}

/* ---------- Rewards ---------- */
.points-hero {
  background: linear-gradient(135deg, var(--gold), var(--coral));
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px;
  text-align: center;
  color: white;
  margin-bottom: 20px;
}

.points-value {
  font-size: 56px;
  font-weight: 900;
  line-height: 1;
}

.points-label {
  font-size: 15px;
  font-weight: 700;
  opacity: 0.9;
  margin-top: 4px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ---------- Recipes ---------- */
.recipe-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  grid-column: span 1;
}

.recipes-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.recipe-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}

.recipe-source-badge {
  background: var(--orange);
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 4px 10px;
  border-radius: 999px;
}

.recipe-url {
  font-size: 12px;
  color: var(--muted);
  text-decoration: none;
  font-weight: 700;
}

.recipe-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

.recipe-cols h4 {
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin: 0 0 6px;
}

.recipe-cols ul, .recipe-cols ol {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
}

.recipe-cols li {
  margin-bottom: 4px;
}

.muted {
  color: var(--muted);
}

.tweak-highlight {
  margin-top: 14px;
  background: #FFF3E0;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
}

.likes-badge {
  background: var(--green);
  color: white;
  font-size: 12px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 6px;
}

/* ---------- Disconnect overlay ---------- */
.disconnect-overlay {
  position: fixed;
  inset: 0;
  background: rgba(43, 43, 51, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s ease;
  z-index: 999;
}

.disconnect-overlay.visible {
  opacity: 1;
  pointer-events: auto;
}

.disconnect-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 40px;
  text-align: center;
  max-width: 360px;
}

.disconnect-spinner {
  width: 36px;
  height: 36px;
  margin: 0 auto 14px;
  border-radius: 50%;
  border: 4px solid var(--border);
  border-top-color: var(--coral);
  animation: disconnect-spin 0.8s linear infinite;
}

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

.disconnect-title {
  font-weight: 800;
  font-size: 18px;
}

.disconnect-sub {
  color: var(--muted);
  font-size: 13px;
  font-weight: 600;
  margin-top: 6px;
}

@media (max-width: 700px) {
  .topbar { flex-wrap: wrap; gap: 10px; padding: 16px 18px; }
  .tabs, main { padding-left: 18px; padding-right: 18px; }
  .recipe-cols { grid-template-columns: 1fr; }
}
