/* ── Dark theme (default) — Apple iOS system colors ── */
:root {
  color-scheme: dark;
  --bg:          #000000;      /* OLED black */
  --surface:     #1c1c1e;      /* iOS elevated surface */
  --surface2:    #2c2c2e;      /* iOS secondary fill */
  --border:      #38383a;      /* iOS separator */
  --text:        #ffffff;      /* primary label */
  --text2:       #8e8e93;      /* secondary label */
  --accent:      #0a84ff;      /* iOS system blue */
  --accent-rgb:  10, 132, 255;
  --accent-dim:  #0d2545;
  --accent-text: #5ac8fa;      /* iOS cyan */
  --green:       #30d158;      /* iOS system green */
  --green-dim:   #0d2e18;
  --orange:      #ff9f0a;      /* iOS system orange */
  --orange-dim:  #362000;
  --red:         #ff453a;      /* iOS system red */
  --red-dim:     #350d0b;
  --purple:      #bf5af2;      /* iOS system purple */
  --purple-dim:  #2c1042;
}

/* ── Light theme — Apple iOS light mode ── */
:root[data-theme="light"] {
  color-scheme: light;
  --bg:          #f2f2f7;
  --surface:     #ffffff;
  --surface2:    #e9e9ef;
  --border:      #d1d1d6;
  --text:        #1c1c1e;
  --text2:       #6c6c70;
  --accent:      #2563eb;
  --accent-rgb:  37, 99, 235;
  --accent-dim:  #dbeafe;
  --accent-text: #1e40af;
  --green:       #16a34a;
  --green-dim:   #dcfce7;
  --orange:      #c2410c;
  --orange-dim:  #ffedd5;
  --red:         #dc2626;
  --red-dim:     #fee2e2;
  --purple:      #7c3aed;
  --purple-dim:  #ede9fe;
}

/* Smooth theme transition */
.theme-transitioning,
.theme-transitioning *,
.theme-transitioning *::before,
.theme-transitioning *::after {
  transition:
    background-color .25s ease,
    color .25s ease,
    border-color .25s ease,
    box-shadow .25s ease !important;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
button, a, [role="button"] { -webkit-tap-highlight-color: transparent; outline: none; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg); color: var(--text);
  min-height: 100dvh; padding: 16px 16px 0;
}

@media (max-width: 768px) {
  html, body { height: 100dvh; overflow: hidden; }
  #app {
    height: 100dvh;
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    padding-bottom: max(env(safe-area-inset-bottom, 0px), 16px);
  }
}

/* ── Light theme component overrides ── */
[data-theme="light"] #settings-dropdown {
  box-shadow: 0 4px 24px rgba(0,0,0,.10), 0 1px 4px rgba(0,0,0,.06);
}
[data-theme="light"] .breakdown,
[data-theme="light"] .section,
[data-theme="light"] .tile,
[data-theme="light"] .day-nav,
[data-theme="light"] .next-up {
  box-shadow: 0 1px 3px rgba(0,0,0,.07);
}
[data-theme="light"] .auth-card {
  box-shadow: 0 4px 24px rgba(0,0,0,.10);
}

/* ── auth overlay ── */
#auth-overlay {
  position: fixed; inset: 0; background: var(--bg);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}
.auth-card {
  text-align: center; padding: 36px 28px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 18px; width: 280px;
}
.auth-icon { font-size: 40px; margin-bottom: 14px; }
.auth-title { font-size: 20px; font-weight: 700; margin-bottom: 8px; }
.auth-sub { font-size: 13px; color: var(--text2); margin-bottom: 22px; line-height: 1.5; }
.auth-btn {
  display: block; padding: 12px 20px;
  background: var(--accent); color: #fff; text-decoration: none;
  border-radius: 11px; font-size: 14px; font-weight: 600;
  transition: opacity .12s;
}
.auth-btn:hover { opacity: .85; }
.auth-privacy {
  display: block; margin-top: 14px;
  font-size: 11px; color: var(--text2); text-decoration: none; opacity: .7;
}
.auth-privacy:hover { opacity: 1; text-decoration: underline; }

/* ── header ── */
.header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 14px; position: relative;
}
.header-left { flex: 1; }
.header-left h1 { font-size: 20px; font-weight: 700; letter-spacing: -0.3px; }
.header-left .sub { font-size: 12.5px; color: var(--text2); margin-top: 2px; }
.header-right { position: relative; }
#btn-gear {
  background: none; border: none; font-size: 17px; color: var(--text2);
  cursor: pointer; padding: 3px 5px; border-radius: 7px;
  transition: color .12s, background .12s; line-height: 1; margin-top: 1px;
}
#btn-gear:hover { color: var(--text); background: var(--surface); }
#btn-gear.pressed { color: var(--text); background: var(--surface); }

/* ── settings dropdown ── */
#settings-dropdown {
  position: absolute; top: 30px; right: 0;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; overflow: hidden; z-index: 100;
  min-width: 190px; box-shadow: 0 4px 20px rgba(0,0,0,.45);
  animation: fadeUp .14s ease both;
}
.s-menu-item {
  padding: 11px 14px; font-size: 13px; cursor: pointer;
  transition: background .1s; display: flex; align-items: center; gap: 8px;
}
.s-menu-item:hover { background: var(--surface2); }
.s-menu-item.pressed { background: var(--surface2); }
.s-menu-item.danger:hover { background: var(--red-dim); color: var(--red); }
.s-menu-privacy {
  display: flex; align-items: center; gap: 8px;
  padding: 9px 14px; font-size: 12px; color: var(--text2);
  text-decoration: none; border-top: 1px solid var(--border);
  opacity: .65;
}
.s-menu-privacy:hover { opacity: 1; background: var(--surface2); }

/* ── full-screen modals ── */
#color-modal, #busy-modal {
  position: fixed; inset: 0; background: var(--bg);
  z-index: 200; display: flex; flex-direction: column;
}
#color-modal.entering, #busy-modal.entering {
  animation: pushIn .25s cubic-bezier(.22,1,.36,1) both;
}
#color-modal.leaving, #busy-modal.leaving {
  animation: pushOut .2s cubic-bezier(.4,0,1,1) both;
}
@keyframes pushIn  { from{transform:translateX(100%)} to{transform:translateX(0)} }
@keyframes pushOut { from{transform:translateX(0)} to{transform:translateX(100%)} }
.cm-header {
  display: flex; align-items: center; gap: 8px;
  padding: 13px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.cm-header-title { flex: 1; text-align: center; font-size: 14px; font-weight: 600; }
.cm-back {
  background: none; border: none; font-size: 20px; color: var(--text2);
  cursor: pointer; padding: 2px 6px; border-radius: 6px; line-height: 1;
}
.cm-back:hover { background: var(--surface2); color: var(--text); }
.cm-reset {
  background: none; border: none; font-size: 11px; font-weight: 500;
  color: var(--text2); cursor: pointer; padding: 4px 8px; border-radius: 6px;
}
.cm-reset:hover { background: var(--surface2); color: var(--orange); }
#cm-body { flex: 1; overflow-y: auto; padding: 14px 16px; }
.cm-footer {
  padding: 12px 16px; border-top: 1px solid var(--border); flex-shrink: 0;
}
#btn-cm-save {
  width: 100%; padding: 11px; background: var(--accent); color: #fff;
  border: none; border-radius: 10px; font-size: 14px; font-weight: 600;
  cursor: pointer; transition: opacity .12s;
}
#btn-cm-save:hover { opacity: .85; }

/* ── category rows ── */
.cat-row {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 11px; padding: 11px 12px; margin-bottom: 8px;
}
.cat-row.other-row { opacity: .65; }
.cat-row-head { display: flex; align-items: center; gap: 8px; }
.cat-preview { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.cat-name-input {
  flex: 1; background: none; border: none;
  border-bottom: 1px solid var(--border);
  color: var(--text); font-size: 13px; font-weight: 600;
  padding: 2px 0 3px; outline: none;
}
.cat-name-input:focus { border-bottom-color: var(--accent); }
.cat-del {
  background: none; border: none; color: var(--text2); font-size: 13px;
  cursor: pointer; padding: 2px 6px; border-radius: 5px; line-height: 1;
}
.cat-del:hover { color: var(--red); background: var(--red-dim); }
.cat-other-label {
  flex: 1; font-size: 13px; font-weight: 600; color: var(--text2);
}
.cat-other-sub { font-size: 10px; font-weight: 400; margin-left: 4px; }

/* ── color chip grid ── */
.chips-grid {
  display: grid; grid-template-columns: repeat(6, 1fr);
  gap: 3px; margin-top: 10px;
}
.chip {
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  padding: 5px 2px; border-radius: 7px; cursor: pointer;
  border: 2px solid transparent; transition: all .12s; user-select: none;
}
.chip.selected { border-color: #fff; background: var(--surface2); }
.chip.unavail  { opacity: .22; cursor: not-allowed; pointer-events: none; }
.chip:not(.unavail):not(.selected):hover { background: var(--surface2); }
.chip-dot  { width: 18px; height: 18px; border-radius: 50%; }
.chip-name { font-size: 8px; color: var(--text2); text-align: center; line-height: 1.2; }

/* ── add category btn ── */
.add-cat-btn {
  width: 100%; padding: 10px; background: none;
  border: 1px dashed var(--border); border-radius: 10px;
  color: var(--accent); font-size: 13px; cursor: pointer;
  margin-bottom: 8px; transition: background .12s;
}
.add-cat-btn:hover { background: var(--surface); }

/* ── day nav ── */
.day-nav {
  display: grid; grid-template-columns: 1fr auto 1fr;
  align-items: stretch; background: var(--surface);
  border: 1px solid var(--border); border-radius: 12px;
  margin-bottom: 12px; overflow: hidden;
}
.nav-left  { display: flex; justify-content: flex-start; }
.nav-right { display: flex; justify-content: flex-end; }
.nav-btn {
  background: none; border: none; color: var(--text2);
  font-size: 18px; padding: 9px 18px; cursor: pointer;
  transition: background .2s, color .2s; line-height: 1;
  border-radius: 0; display: flex; align-items: center;
  -webkit-tap-highlight-color: transparent;
  outline: none; user-select: none;
}
@media (hover: hover) {
  .nav-btn:hover { background: var(--surface2); color: var(--text); }
}
.nav-btn.pressed { background: var(--surface2); color: var(--text); transition: none; }
.nav-center { text-align: center; padding: 9px 4px; }
.nav-day-label { font-size: 14px; font-weight: 600; color: var(--text); line-height: 1; }
.nav-day-date  { font-size: 11px; color: var(--text2); margin-top: 2px; }
.nav-today-btn {
  background: none; border: none; color: var(--accent);
  font-size: 11px; font-weight: 600; padding: 9px 12px; cursor: pointer; transition: opacity .15s;
  -webkit-tap-highlight-color: transparent; outline: none;
}
@media (hover: hover) {
  .nav-today-btn:hover { opacity: .7; }
}
.nav-today-btn.pressed { opacity: .5; }
.nav-today-btn.hidden { opacity: 0; pointer-events: none; }

/* ── day progress ── */
.day-progress { margin-bottom: 12px; }
.day-progress-label {
  display: flex; justify-content: space-between;
  font-size: 11px; color: var(--text2); margin-bottom: 4px;
}
.day-progress-track { height: 4px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.day-progress-fill {
  height: 100%; background: linear-gradient(90deg, var(--accent), var(--purple));
  border-radius: 3px; transition: width .4s ease;
}

/* ── summary tiles ── */
.summary-tiles { display: grid; grid-template-columns: repeat(3,1fr); gap: 7px; margin-bottom: 12px; }
.tile {
  background: var(--surface); border-radius: 12px;
  padding: 11px 8px 9px; border: 1px solid var(--border); text-align: center;
}
.tile-num { font-size: 22px; font-weight: 700; line-height: 1; }
.tile-num.blue   { color: var(--accent); }
.tile-num.green  { color: #22c55e; }
.tile-num.yellow { color: #eab308; }
.tile-num.red    { color: #ef4444; }
.tile-label { font-size: 10px; color: var(--text2); margin-top: 4px; line-height: 1.3; }

/* ── breakdown ── */
.breakdown {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 14px; padding: 13px 14px; margin-bottom: 12px;
}
.breakdown-title {
  font-size: 12px; font-weight: 600; color: var(--text2);
  text-transform: uppercase; letter-spacing: .5px; margin-bottom: 11px;
}
.breakdown-row { display: flex; flex-direction: column; margin-bottom: 8px; -webkit-tap-highlight-color: transparent; }
.breakdown-row:last-child { margin-bottom: 0; }
.bd-main { display: flex; align-items: center; gap: 8px; cursor: pointer;
  -webkit-tap-highlight-color: transparent; border-radius: 6px; transition: background .1s; }
.bd-main.pressed { background: var(--surface2); }
.breakdown-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.breakdown-label {
  font-size: 12px; color: var(--text2); width: 120px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.breakdown-bar-wrap { flex: 1; height: 6px; background: var(--surface2); border-radius: 3px; overflow: hidden; }
.breakdown-bar { height: 100%; border-radius: 3px; }
.breakdown-time {
  font-size: 11.5px; font-weight: 600; color: var(--text);
  width: 38px; text-align: right; flex-shrink: 0; font-variant-numeric: tabular-nums;
}
.bd-chev { flex-shrink:0; font-size:14px; color:var(--text2); opacity:.35;
  transition: transform .28s cubic-bezier(.4,0,.2,1); line-height:1; }
.breakdown-row.expanded .bd-chev { transform: rotate(90deg); opacity:.6; }
/* Sub-events expand */
.bd-sub { display:grid; grid-template-rows:0fr;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1); overflow:hidden; }
.bd-sub-inner { min-height:0; }
.breakdown-row.expanded .bd-sub { grid-template-rows:1fr; }
/* Gantt (waterfall) chart in breakdown expanded view */
.bd-gantt { padding: 6px 0 4px 16px; }
.bd-gantt-row { display: flex; align-items: center; gap: 7px; margin-bottom: 5px; }
.bd-gantt-axis-row { display: flex; align-items: center; gap: 7px; margin-top: 2px; }
.bd-gantt-name {
  font-size: 11px; color: var(--text2); width: 90px; flex-shrink: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.bd-gantt-axis-space { width: 90px; flex-shrink: 0; }
.bd-gantt-track {
  flex: 1; position: relative; height: 4px;
  background: var(--surface2); border-radius: 2px; overflow: hidden;
}
.bd-gantt-bar {
  position: absolute; top: 0; height: 100%;
  border-radius: 2px; min-width: 2px; width: 0%;
}
.bd-gantt-dur {
  font-size: 11px; color: var(--text2); white-space: nowrap;
  flex-shrink: 0; min-width: 36px; text-align: right;
  font-variant-numeric: tabular-nums;
}
.bd-gantt-dur-space { min-width: 36px; flex-shrink: 0; }
.bd-gantt-axis {
  flex: 1; display: flex; justify-content: space-between;
  font-size: 9.5px; color: var(--text2); opacity: .6; padding: 0 1px;
}
/* Waterfall breakdown mode — columns mirror .bd-main for horizontal alignment */
.bd-wfall { padding: 5px 0 3px; }
/* gap:8px matches .bd-main gap so track left/right edges align with main bar */
.bd-wfall-row { display: flex; align-items: center; gap: 8px; margin-bottom: 5px; }
.bd-wfall-row:last-child { margin-bottom: 0; }
.bd-wfall-icon     { width: 8px; flex-shrink: 0; }           /* = .breakdown-dot */
.bd-wfall-name     { width: 120px; flex-shrink: 0; font-size: 11px; color: var(--text2);
                     white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* = .breakdown-label */
.bd-wfall-track    { flex: 1; position: relative; height: 4px;
                     background: var(--surface2); border-radius: 2px; overflow: hidden; } /* = .breakdown-bar-wrap */
.bd-wfall-bar      { position: absolute; top: 0; height: 100%; border-radius: 2px; min-width: 2px; width: 0%; }
.bd-wfall-dur      { width: 38px; text-align: right; font-size: 11px; color: var(--text2);
                     white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; } /* = .breakdown-time */
.bd-wfall-chev-spc { width: 9px; flex-shrink: 0; }           /* = .bd-chev visual width */

.breakdown-empty { font-size: 12px; color: var(--text2); text-align: center; padding: 4px 0; }
/* Description: preserve line breaks, "show more" */
.detail-desc-text { white-space: pre-line; }
.detail-more-btn {
  display: block; margin-top: 4px; font-size: 11px; color: var(--accent);
  background: none; border: none; padding: 0; cursor: pointer; opacity: .85;
  -webkit-tap-highlight-color: transparent; transition: opacity .1s;
}
.detail-more-btn.pressed { opacity: .45; }

/* ── next-up ── */
.next-up {
  border-radius: 12px; padding: 10px 14px;
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 12px; border: 1px solid var(--accent); background: var(--accent-dim);
}
.next-up-dot {
  width: 8px; height: 8px; background: var(--accent);
  border-radius: 50%; flex-shrink: 0; animation: pulse 2s infinite;
}
@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.25); }
  50%      { box-shadow: 0 0 0 6px rgba(var(--accent-rgb),.10); }
}
.next-up-body { flex: 1; min-width: 0; }
.next-up-title { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up-meta  { font-size: 11px; color: var(--accent-text); margin-top: 2px; }
.next-up-badge {
  flex-shrink: 0; font-size: 11px; font-weight: 700;
  color: var(--accent); background: rgba(var(--accent-rgb),.15);
  border-radius: 8px; padding: 3px 9px; white-space: nowrap;
}

/* ── section ── */
.section {
  background: var(--surface); border-radius: 14px;
  border: 1px solid var(--border); overflow: hidden; margin-bottom: 12px;
}
.section-header { display: flex; align-items: center; gap: 8px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.section-title { font-size: 13px; font-weight: 600; }
.section-count {
  margin-left: auto; font-size: 11px; font-weight: 600;
  color: var(--text); background: var(--accent);
  border-radius: 9px; padding: 1px 8px; min-width: 22px; text-align: center;
}
.section-count.zero { background: var(--surface2); color: var(--text2); }

/* ── event items ── */
.item {
  display: flex; flex-direction: column;
  padding: 9px 14px; border-bottom: 1px solid var(--border); transition: background .1s;
  -webkit-tap-highlight-color: transparent; cursor: pointer;
}
.item:last-child { border-bottom: none; }
@media (hover: hover) {
  .item:hover { background: var(--surface2); }
}
.item.pressed { background: var(--surface2); }
.item-row { display: flex; align-items: flex-start; gap: 9px; }
.item-time-col { width: 42px; flex-shrink: 0; text-align: right; }
.item-time { font-size: 11px; color: var(--text2); font-variant-numeric: tabular-nums; }
.item-time.now { color: var(--green); font-weight: 600; }
.item-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; margin-top: 3px; }
.item-body { flex: 1; min-width: 0; }
.item-title { font-size: 13px; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.item.expanded .item-title { white-space: normal; }
.item-meta  { font-size: 11px; color: var(--text2); margin-top: 2px; }
/* Chevron */
.item-chev { flex-shrink:0; font-size:15px; color:var(--text2); opacity:.45; margin-top:1px;
  transition: transform .28s cubic-bezier(.4,0,.2,1), opacity .2s; line-height:1; }
.item.expanded .item-chev { transform: rotate(90deg); opacity:.7; }
/* Expand panel */
.item-details {
  display: grid; grid-template-rows: 0fr;
  transition: grid-template-rows .3s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
}
.item-details-inner { min-height: 0; }
.item.expanded .item-details { grid-template-rows: 1fr; }
/* Detail rows */
.detail-rows { padding: 7px 0 3px 60px; display: flex; flex-direction: column; gap: 7px; }
.detail-row  { display: flex; align-items: flex-start; gap: 7px; font-size: 12px; color: var(--text2); line-height: 1.45; }
.detail-icon { flex-shrink:0; width:16px; text-align:center; margin-top:1px; }
.detail-link { color: var(--accent); text-decoration: none; word-break: break-all; }
@media (hover: hover) { .detail-link:hover { opacity:.75; } }
.item-link  {
  font-size: 11px; color: var(--accent); text-decoration: none;
  background: var(--accent-dim); border-radius: 5px; padding: 1px 6px;
  transition: opacity .12s;
}
.item-link:hover { opacity: .75; }
.item-badge { flex-shrink: 0; font-size: 10px; font-weight: 600; padding: 2px 7px; border-radius: 6px; margin-top: 2px; white-space: nowrap; }
.b-now    { background: var(--green-dim);  color: var(--green); }
.b-soon   { background: var(--orange-dim); color: var(--orange); }
.b-past   { background: var(--surface2);   color: var(--text2); }
.b-allday { background: var(--purple-dim); color: var(--purple); }
.b-future { background: var(--accent-dim); color: var(--accent-text); }

/* ── week chart ── */
.week-grid { display: grid; grid-template-columns: repeat(7,1fr); gap: 2px; padding: 12px 14px; }
.week-day { text-align: center; cursor: pointer; border-radius: 8px; padding: 2px; transition: background .12s; -webkit-tap-highlight-color: transparent; }
@media (hover: hover) {
  .week-day:hover { background: var(--surface2); }
}
.week-day.pressed { background: var(--surface2); }
.week-day-name { font-size: 10px; color: var(--text2); margin-bottom: 3px; text-transform: uppercase; }
.week-day-bar-wrap { height: 36px; display: flex; align-items: flex-end; justify-content: center; }
.week-day-bar { width: 14px; background: var(--surface2); border-radius: 3px 3px 0 0; transition: height .3s; }
.week-day-bar.active-bar { background: var(--accent); }
.week-day-bar.today-bar  { background: rgba(var(--accent-rgb),.35); }
.week-day-count { font-size: 10px; color: var(--text2); margin-top: 2px; }
.week-day-count.active-label { color: var(--accent); font-weight: 700; }
.week-day-date { font-size: 9.5px; color: var(--text2); margin-top: 1px; opacity: .7; }

/* ── states ── */
.empty-state   { padding: 20px 14px; text-align: center; color: var(--text2); font-size: 13px; }
.loading-state { padding: 16px 14px; text-align: center; color: var(--text2); font-size: 13px; }
.error-state   { padding: 10px 14px; font-size: 12px; color: var(--orange); background: var(--orange-dim); }
.spinner {
  display: inline-block; width: 15px; height: 15px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: spin .7s linear infinite;
  vertical-align: middle; margin-right: 6px;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── slide/fade animations ── */
#day-content { transition: none; }
#day-content.slide-out-left  { animation: slideOutLeft  .16s cubic-bezier(.4,0,1,1) both; }
#day-content.slide-out-right { animation: slideOutRight .16s cubic-bezier(.4,0,1,1) both; }
#day-content.slide-in-right  { animation: slideInRight  .22s cubic-bezier(.22,1,.36,1) both; }
#day-content.slide-in-left   { animation: slideInLeft   .22s cubic-bezier(.22,1,.36,1) both; }
@keyframes fadeUp      { from{opacity:0;transform:translateY(6px)}   to{opacity:1;transform:translateY(0)} }
@keyframes fadeIn      { from{opacity:0} to{opacity:1} }
@keyframes countUp     { from{opacity:0;transform:translateY(4px) scale(.92)} to{opacity:1;transform:translateY(0) scale(1)} }
@keyframes slideOutLeft  { from{opacity:1;transform:translateX(0)}    to{opacity:0;transform:translateX(-22px)} }
@keyframes slideOutRight { from{opacity:1;transform:translateX(0)}    to{opacity:0;transform:translateX(22px)} }
@keyframes slideInRight  { from{opacity:0;transform:translateX(22px)} to{opacity:1;transform:translateX(0)} }
@keyframes slideInLeft   { from{opacity:0;transform:translateX(-22px)}to{opacity:1;transform:translateX(0)} }
.anim-fade-up { animation: fadeUp  .22s cubic-bezier(.22,1,.36,1) both; }
.anim-fade-in { animation: fadeIn  .18s ease both; }

/* ── busy thresholds ── */
.thresh-row { display:flex; align-items:center; gap:12px; padding:13px 0; border-bottom:1px solid var(--border); }
.thresh-row:last-child { border-bottom:none; }
.thresh-dot { width:11px; height:11px; border-radius:50%; flex-shrink:0; }
.thresh-label { font-size:13px; color:var(--text); flex:1; line-height:1.3; }
.thresh-sub { font-size:11px; color:var(--text2); display:block; margin-top:2px; }
.thresh-input {
  width:56px; padding:6px 8px; background:var(--surface2);
  border:1px solid var(--border); border-radius:8px;
  color:var(--text); font-size:15px; font-weight:700;
  text-align:center; outline:none; appearance:textfield;
}
.thresh-input::-webkit-inner-spin-button { display:none; }
.thresh-input:focus { border-color:var(--accent); }
.thresh-unit { font-size:12px; color:var(--text2); }

/* ═══════════════════════════════════════════════════════════════
   ONBOARDING CAROUSEL
   ═══════════════════════════════════════════════════════════════ */

#auth-overlay {
  position: fixed; inset: 0; z-index: 100;
  background: #050508;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

/* Skip button */
.ob-skip {
  position: absolute; top: max(env(safe-area-inset-top, 0px), 16px); right: 20px;
  z-index: 10;
  background: rgba(255,255,255,.1);
  border: none; border-radius: 20px;
  color: rgba(255,255,255,.7);
  font-size: 13px; font-weight: 500;
  padding: 6px 14px; cursor: pointer;
  transition: opacity .3s;
}

/* Track */
.ob-track {
  display: flex;
  width: 100%; height: 100%;
  transition: transform .4s cubic-bezier(.4,0,.2,1);
  will-change: transform;
}

/* Slide base */
.ob-slide {
  flex: 0 0 100%;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0 0 80px;
  box-sizing: border-box;
}

/* ── Slide 1: Hero ── */
.ob-slide-hero {
  justify-content: center;
  background:
    radial-gradient(ellipse 60% 40% at 25% 20%, rgba(10,132,255,.35) 0%, transparent 70%),
    radial-gradient(ellipse 50% 40% at 75% 75%, rgba(191,90,242,.3) 0%, transparent 70%),
    #050508;
}
.ob-hero-inner {
  display: flex; flex-direction: column; align-items: center;
  text-align: center; padding: 0 32px; position: relative;
}
.ob-logo-wrap {
  width: 88px; height: 88px; border-radius: 24px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.1);
  display: flex; align-items: center; justify-content: center;
  font-size: 44px; margin-bottom: 28px;
  box-shadow: 0 8px 32px rgba(10,132,255,.2);
}
.ob-hero-title {
  font-size: 48px; font-weight: 800; letter-spacing: -1.5px;
  color: #fff; margin-bottom: 16px;
  background: linear-gradient(135deg, #fff 0%, rgba(255,255,255,.7) 100%);
  -webkit-background-clip: text; -webkit-text-fill-color: transparent;
}
.ob-hero-tagline {
  font-size: 28px; font-weight: 700; letter-spacing: -.5px;
  color: #fff; line-height: 1.2; margin-bottom: 20px;
}
.ob-hero-desc {
  font-size: 16px; color: rgba(255,255,255,.45);
  line-height: 1.5;
}

/* ── Slides 2-4: Floating cards ── */
@keyframes obFloat1 {
  0%,100% { transform: translateY(0px) rotate(-2deg); }
  50%      { transform: translateY(-8px) rotate(-2deg); }
}
@keyframes obFloat2 {
  0%,100% { transform: translateY(0px) rotate(1.5deg); }
  50%      { transform: translateY(-6px) rotate(1.5deg); }
}
@keyframes obFloat3 {
  0%,100% { transform: translateY(0px) rotate(-1deg); }
  50%      { transform: translateY(-10px) rotate(-1deg); }
}
.ob-float-1 { animation: obFloat1 4s ease-in-out infinite; }
.ob-float-2 { animation: obFloat2 5s ease-in-out infinite .6s; }
.ob-float-3 { animation: obFloat3 4.5s ease-in-out infinite 1.1s; }

.ob-cards-wrap {
  flex: 1; width: 100%;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  padding: 20px 24px 16px; gap: 14px;
  box-sizing: border-box;
}

/* Base card */
.ob-card {
  width: 100%;
  background: rgba(28,28,30,.9);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 16px;
  padding: 14px 16px;
  box-shadow: 0 8px 32px rgba(0,0,0,.5);
  backdrop-filter: blur(12px);
  box-sizing: border-box;
}
.ob-card-section-label {
  font-size: 10px; font-weight: 600; letter-spacing: .6px;
  color: rgba(255,255,255,.3); margin-bottom: 10px;
}

/* Tiles card */
.ob-card-tiles {
  display: flex; justify-content: space-around;
  padding: 12px 16px;
}
.ob-tile { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.ob-tile-num { font-size: 22px; font-weight: 700; }
.ob-tile-lbl { font-size: 11px; color: rgba(255,255,255,.4); }

/* Breakdown card */
.ob-card-bd { display: flex; flex-direction: column; gap: 8px; }
.ob-bd-row {
  display: flex; align-items: center; gap: 8px;
}
.ob-bd-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ob-bd-name { font-size: 12px; color: rgba(255,255,255,.7); width: 110px; flex-shrink: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ob-bd-track { flex: 1; height: 4px; background: rgba(255,255,255,.08); border-radius: 2px; overflow: hidden; }
.ob-bd-bar { height: 100%; border-radius: 2px; }
.ob-bd-dur { font-size: 11px; color: rgba(255,255,255,.4); width: 36px; text-align: right; flex-shrink: 0; }

/* Category cards */
.ob-card-cat { display: flex; flex-direction: column; gap: 8px; }
.ob-cat-head { display: flex; align-items: center; gap: 8px; }
.ob-cat-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.ob-cat-name { font-size: 13px; font-weight: 600; color: #fff; }
.ob-chips-row { display: flex; gap: 6px; flex-wrap: wrap; }
.ob-chip {
  display: flex; align-items: center; gap: 5px;
  padding: 4px 8px; border-radius: 8px;
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.08);
}
.ob-chip-sel {
  background: rgba(var(--c-rgb, 255,255,255), .15);
  border-color: rgba(var(--c-rgb, 255,255,255), .25);
  outline: 1.5px solid var(--c, rgba(255,255,255,.3));
}
.ob-chip-dot { width: 10px; height: 10px; border-radius: 50%; }
.ob-chip span { font-size: 11px; color: rgba(255,255,255,.6); }

/* Next-up card */
.ob-card-nextup {
  display: flex; align-items: center; gap: 10px;
  background: rgba(13,46,24,.9);
  border-color: rgba(48,209,88,.2);
}
.ob-nextup-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: #30d158; flex-shrink: 0;
  box-shadow: 0 0 8px #30d158;
}
.ob-nextup-body { flex: 1; }
.ob-nextup-title { font-size: 13px; font-weight: 600; color: #fff; }
.ob-nextup-meta { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 1px; }
.ob-nextup-badge { font-size: 12px; font-weight: 600; color: #30d158; white-space: nowrap; }

/* Event card */
.ob-card-event { display: flex; flex-direction: column; gap: 8px; }
.ob-ev-row { display: flex; align-items: center; gap: 8px; }
.ob-ev-time-col { width: 36px; flex-shrink: 0; }
.ob-ev-time { font-size: 11px; color: rgba(255,255,255,.4); }
.ob-ev-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.ob-ev-body { flex: 1; }
.ob-ev-title { font-size: 13px; font-weight: 600; color: #fff; }
.ob-ev-meta { font-size: 11px; color: rgba(255,255,255,.4); margin-top: 1px; }
.ob-ev-badge { font-size: 11px; font-weight: 600; padding: 3px 7px; border-radius: 6px; background: rgba(10,132,255,.2); color: #0a84ff; }
.ob-ev-detail { display: flex; align-items: center; gap: 8px; padding-top: 2px; border-top: 1px solid rgba(255,255,255,.06); }
.ob-ev-detail-icon { font-size: 13px; }
.ob-ev-detail span { font-size: 12px; color: rgba(255,255,255,.45); }
.ob-ev-link { font-size: 12px; color: #0a84ff; }

/* Text block */
.ob-text {
  width: 100%; padding: 0 28px;
  display: flex; flex-direction: column; gap: 10px;
}
.ob-badge {
  display: inline-flex; align-items: center;
  font-size: 11px; font-weight: 700; letter-spacing: .5px;
  text-transform: uppercase;
  padding: 4px 10px; border-radius: 20px;
  align-self: flex-start;
}
.ob-title {
  font-size: 22px; font-weight: 700; letter-spacing: -.3px;
  color: #fff; line-height: 1.2;
}
.ob-desc {
  font-size: 14px; color: rgba(255,255,255,.5);
  line-height: 1.55;
}

/* Login button (last slide) */
.ob-login-btn {
  display: block; margin-top: 8px;
  background: #0a84ff;
  color: #fff; text-decoration: none;
  font-size: 16px; font-weight: 600;
  padding: 14px 24px; border-radius: 14px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(10,132,255,.4);
  transition: opacity .15s;
}
.ob-login-btn:active { opacity: .8; }

.ob-legal {
  display: flex; gap: 8px; justify-content: center;
  font-size: 12px;
}
.ob-legal a { color: rgba(255,255,255,.35); text-decoration: none; }
.ob-legal span { color: rgba(255,255,255,.2); }

/* Dots */
.ob-dots {
  position: absolute;
  bottom: max(env(safe-area-inset-bottom, 0px), 20px);
  left: 50%; transform: translateX(-50%);
  display: flex; gap: 6px; z-index: 10;
}
.ob-dot {
  width: 6px; height: 6px; border-radius: 3px;
  background: rgba(255,255,255,.25);
  transition: width .3s cubic-bezier(.4,0,.2,1), background .3s;
  cursor: pointer;
}
.ob-dot.active {
  width: 20px;
  background: #fff;
}
