/* TheBue — design system
   Ink blue for structure, a highlighter yellow for "now", module colours for everything that belongs to a module. */

/* Safety net: the native `hidden` attribute must always win over any
   component's own `display:` rule, no matter what order stylesheets load
   in or what else targets that element. Without this, a shared rule like
   ".photo-drop-busy, .photo-drop-result { display: flex }" can silently
   defeat `hidden` and show several states of a component at once — which
   is exactly what happened with the schedule-photo upload box. */
[hidden] { display: none !important; }

:root {
  color-scheme: light dark;
  --bg: #F4F5F9;
  --surface: #FFFFFF;
  --surface-2: #EEF0F6;
  --line: rgba(20, 26, 46, .08);
  --line-strong: rgba(20, 26, 46, .14);
  --ink: #141A2E;
  --ink-2: #5A627A;
  --ink-3: #8C93A8;
  --brand: #2A3FC7;
  --brand-2: #3450E0;
  --brand-hover: #2941C9;
  --btn: #3450E0;
  --btn-hover: #2941C9;
  --brand-soft: rgba(52, 80, 224, .10);
  --hl: #FFD84D;
  --hl-soft: rgba(255, 216, 77, .45);
  --hl-ink: #3D3000;
  --danger: #D6453D;
  --warning: #B8700B;
  --success: #1E9A63;
  --info: #2D7BD5;
  --shadow: 0 1px 2px rgba(20, 26, 46, .04), 0 8px 24px rgba(20, 26, 46, .06);
  --shadow-lg: 0 24px 60px rgba(14, 18, 32, .22);
  --r-lg: 20px;
  --r-md: 14px;
  --r-sm: 10px;
  --ease: cubic-bezier(.2, .8, .2, 1);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --tabbar-h: 64px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0E1220;
    --surface: #161B2C;
    --surface-2: #1D2337;
    --line: rgba(255, 255, 255, .07);
    --line-strong: rgba(255, 255, 255, .13);
    --ink: #EEF0F6;
    --ink-2: #A9B0C2;
    --ink-3: #737A90;
    --brand-2: #6C84FF;
    --brand-hover: #8196FF;
    --btn: #4A63F2;
    --btn-hover: #5A72F7;
    --brand-soft: rgba(108, 132, 255, .15);
    --hl-soft: rgba(255, 216, 77, .22);
    --danger: #FF6B63;
    --warning: #F2B347;
    --success: #43C98B;
    --info: #6AAEFF;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .25);
  }
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 15px; line-height: 1.5; color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
a { color: var(--brand-2); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.2; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand-2) 55%, transparent); outline-offset: 2px; border-radius: 8px; }
.ic { width: 18px; height: 18px; flex: none; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }
.pad { padding: 6px 2px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--surface); padding: 8px 12px; border-radius: 8px; z-index: 50; }
.skip:focus { left: 8px; }

/* ---------- Brand ---------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); font-weight: 700; font-size: 18px; letter-spacing: -.01em; }
.brand:hover { text-decoration: none; }
.brand-mark {
  font-size: 28px; width: 1em; height: 1em; border-radius: .32em; flex: none; display: inline-block;
  background:
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)) .21em .27em / .58em .1em no-repeat,
    linear-gradient(var(--hl), var(--hl)) .21em .45em / .58em .1em no-repeat,
    linear-gradient(rgba(255,255,255,.5), rgba(255,255,255,.5)) .21em .63em / .38em .1em no-repeat,
    var(--brand);
}
.brand-mark.big { font-size: 52px; }

/* ---------- Buttons ---------- */
.btn {
  position: relative; display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 42px; padding: 0 16px; border-radius: 12px; border: 1px solid transparent;
  font-weight: 600; font-size: 15px; white-space: nowrap; text-decoration: none !important;
  transition: background .15s ease, border-color .15s ease, color .15s ease, transform .12s ease, opacity .15s ease;
}
.btn:active { transform: scale(.98); }
.btn[disabled] { opacity: .5; pointer-events: none; }
.btn-primary { background: var(--btn); color: #fff; }
.btn-primary:hover { background: var(--btn-hover); }
.btn-soft { background: var(--brand-soft); color: var(--brand-2); }
.btn-soft:hover { background: color-mix(in srgb, var(--brand-2) 18%, transparent); }
.btn-ghost { background: transparent; color: var(--ink-2); }
.btn-ghost:hover { background: var(--surface-2); color: var(--ink); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-block { width: 100%; height: 50px; font-size: 16px; }
.btn-icon { width: 42px; padding: 0; }
.btn-sm { height: 34px; padding: 0 13px; font-size: 13.5px; border-radius: 10px; }
.btn .spinner { display: none; }
.btn.is-loading { pointer-events: none; }
.btn.is-loading .btn-label, .btn.is-loading > .ic { visibility: hidden; }
.btn.is-loading .spinner { display: block; position: absolute; inset: 0; margin: auto; }
.spinner { width: 18px; height: 18px; border-radius: 50%; border: 2px solid currentColor; border-right-color: transparent; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.icon-btn { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-3); transition: background .15s, color .15s; }
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn .ic { width: 17px; height: 17px; }
.link { font-size: 14px; font-weight: 600; display: inline-flex; align-items: center; gap: 2px; }
.link .ic { width: 16px; height: 16px; }

/* ---------- Tags ---------- */
.tag { display: inline-flex; align-items: center; height: 24px; padding: 0 9px; border-radius: 999px; font-size: 12px; font-weight: 650; white-space: nowrap; }
.tag-danger { background: color-mix(in srgb, var(--danger) 13%, transparent); color: var(--danger); }
.tag-warning { background: color-mix(in srgb, var(--warning) 15%, transparent); color: var(--warning); }
.tag-info { background: color-mix(in srgb, var(--info) 13%, transparent); color: var(--info); }
.tag-success { background: color-mix(in srgb, var(--success) 14%, transparent); color: var(--success); }
.tag-neutral { background: var(--surface-2); color: var(--ink-2); }
.chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 999px; background: var(--surface-2); font-size: 13px; font-weight: 600; color: var(--ink-2); }

/* ---------- Auth ---------- */
body.auth { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; overflow-x: hidden; }
.auth-grid {
  position: fixed; inset: 0; pointer-events: none;
  background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(90deg, var(--line) 1px, transparent 1px);
  background-size: 64px 64px; background-position: center;
  -webkit-mask-image: radial-gradient(ellipse at center, #000 20%, transparent 72%);
  mask-image: radial-gradient(ellipse at center, #000 20%, transparent 72%);
}
.auth-wrap { position: relative; width: 100%; max-width: 420px; }
.auth-wrap.wide { max-width: 640px; }
.auth-brand { display: flex; align-items: center; gap: 14px; margin-bottom: 26px; }
.auth-word { position: relative; z-index: 0; font-size: 40px; font-weight: 800; letter-spacing: -.035em; }
.auth-word .highlight {
  position: absolute; z-index: -1; left: -.08em; bottom: .12em; height: .36em; width: 0;
  background: var(--hl); border-radius: 4px; opacity: .9;
  animation: sweep .9s .35s var(--ease) forwards;
}
@keyframes sweep { to { width: calc(100% + .16em); } }
.auth-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: 24px; padding: 30px 28px 24px;
  box-shadow: var(--shadow); animation: rise .6s .1s var(--ease) both;
}
@keyframes rise { from { opacity: 0; transform: translateY(14px) scale(.985); } }
.auth-card h1 { font-size: 26px; letter-spacing: -.02em; }
.auth-sub { color: var(--ink-2); margin: 6px 0 22px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--ink-2); font-size: 14px; }
.auth-foot { text-align: center; color: var(--ink-3); font-size: 13px; margin-top: 22px; }
.shake { animation: rise .6s .1s var(--ease) both, shake .42s .05s ease; }
@keyframes shake { 20% { transform: translateX(-7px); } 40% { transform: translateX(6px); } 60% { transform: translateX(-4px); } 80% { transform: translateX(2px); } }
.form-error { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border-radius: 12px; padding: 11px 13px; font-size: 14px; font-weight: 550; margin-bottom: 16px; }
.form-error .ic { margin-top: 1px; }

/* Floating-label fields */
.field { position: relative; margin-bottom: 12px; }
.field input {
  width: 100%; height: 56px; padding: 22px 14px 7px; border-radius: 14px; font-size: 16px;
  border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink);
  transition: border-color .18s ease, box-shadow .18s ease, background .18s ease;
}
.field label { position: absolute; left: 15px; top: 17px; font-size: 16px; color: var(--ink-3); pointer-events: none; transform-origin: left top; transition: transform .18s var(--ease), color .18s ease; }
.field input:focus { outline: none; border-color: var(--brand-2); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.field input:focus + label,
.field input:not(:placeholder-shown) + label,
.field input:-webkit-autofill + label { transform: translateY(-10px) scale(.76); color: var(--ink-2); }
.field input:focus + label { color: var(--brand-2); }
.field.has-toggle input { padding-right: 52px; }
.pw-toggle { position: absolute; right: 8px; top: 8px; width: 40px; height: 40px; border-radius: 10px; border: 0; background: transparent; color: var(--ink-3); display: grid; place-items: center; }
.pw-toggle:hover { color: var(--ink); background: var(--surface-2); }
.pw-toggle .ic-hide, .pw-toggle.is-visible .ic-show { display: none; }
.pw-toggle.is-visible .ic-hide { display: block; }
.pw-meter { display: grid; grid-template-columns: repeat(4, 1fr) auto; gap: 5px; align-items: center; margin: -4px 2px 14px; }
.pw-meter span { height: 4px; border-radius: 4px; background: var(--surface-2); transition: background .25s ease; }
.pw-meter em { font-style: normal; font-size: 12px; font-weight: 600; color: var(--ink-3); min-width: 54px; text-align: right; }
.pw-meter[data-level="1"] span:nth-child(-n+1) { background: var(--danger); }
.pw-meter[data-level="2"] span:nth-child(-n+2) { background: var(--warning); }
.pw-meter[data-level="3"] span:nth-child(-n+3) { background: var(--info); }
.pw-meter[data-level="4"] span:nth-child(-n+4) { background: var(--success); }

/* ---------- App shell ---------- */
.sidebar {
  position: fixed; inset: 0 auto 0 0; width: 248px; padding: 22px 14px; display: flex; flex-direction: column;
  background: var(--surface); border-right: 1px solid var(--line); z-index: 20;
}
.sidebar .brand { padding: 4px 10px 22px; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link { display: flex; align-items: center; gap: 12px; height: 42px; padding: 0 12px; border-radius: 12px; color: var(--ink-2); font-weight: 600; transition: background .15s, color .15s; }
.side-link:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.side-link.is-active { background: var(--brand-soft); color: var(--brand-2); }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 10px; }
.me { display: flex; align-items: center; gap: 10px; padding: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.me-text { display: flex; flex-direction: column; min-width: 0; }
.me-text strong { font-size: 14px; }
.me-text small { font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--btn); color: #fff; font-size: 13px; font-weight: 700; flex: none; text-decoration: none !important; }
.topbar, .tabbar { display: none; }
.main { margin-left: 248px; padding: 36px 44px 72px; max-width: 1240px; }

.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: var(--page-head-gap, 24px); }
.page-head h1 { font-size: 32px; font-weight: 750; letter-spacing: -.025em; }
.page-date { color: var(--ink-3); font-size: 14px; font-weight: 550; margin-bottom: 4px; }
.head-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.seg { display: inline-flex; background: var(--surface-2); border-radius: 12px; padding: 3px; }
.seg-btn { display: inline-flex; align-items: center; height: 36px; padding: 0 12px; border-radius: 9px; color: var(--ink-2); font-weight: 600; font-size: 14px; }
.seg-btn:hover { color: var(--ink); text-decoration: none; }
.seg-btn.is-on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 3px rgba(20, 26, 46, .1); }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px 22px; margin-bottom: 18px; }
.panel-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 12px; }
.panel h2 { font-size: 17px; font-weight: 700; letter-spacing: -.01em; }
.count { font-size: 13px; font-weight: 700; color: var(--ink-3); }
.notice { display: flex; gap: 10px; align-items: flex-start; background: color-mix(in srgb, var(--warning) 12%, transparent); color: var(--ink); border-radius: 14px; padding: 12px 14px; margin-bottom: 18px; font-size: 14px; }
.notice .ic { color: var(--warning); margin-top: 1px; }
.hint { color: var(--ink-3); font-size: 13px; margin-top: 14px; }

.dash { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr); gap: 18px; align-items: start; }

/* Setup steps */
.setup .muted { margin: 4px 0 12px; }
.steps { list-style: none; padding: 0; margin: 0; display: flex; gap: 10px; flex-wrap: wrap; }
.steps li { display: flex; align-items: center; gap: 10px; padding: 10px 14px 10px 10px; border-radius: 14px; background: var(--surface-2); font-weight: 600; font-size: 14px; }
.steps li.is-done { color: var(--ink-3); text-decoration: line-through; }
.step-dot { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; }
.steps li.is-done .step-dot { background: var(--success); border-color: var(--success); color: #fff; }
.step-dot .ic { width: 14px; height: 14px; stroke-width: 3; }

/* Up next — the highlighter moment */
.next-card { position: relative; padding: 24px 26px 22px 32px; border-radius: 24px; background: var(--surface); border: 1px solid var(--line); margin-bottom: 18px; overflow: hidden; }
.next-card::before { content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 7px; background: var(--mod); }
.next-label { display: inline-block; font-weight: 750; font-size: 14px; padding: 0 5px; margin-left: -5px; background: linear-gradient(transparent 52%, var(--hl-soft) 52%); }
.next-card h2 { font-size: 30px; font-weight: 780; letter-spacing: -.025em; margin: 8px 0 12px; }
.next-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: center; color: var(--ink-2); font-weight: 550; }
.next-meta > span { display: inline-flex; align-items: center; gap: 6px; }
.next-count { margin-top: 16px; font-size: 20px; font-weight: 750; letter-spacing: -.01em; font-variant-numeric: tabular-nums; min-height: 1.5em; }
.next-flag { display: flex; gap: 8px; align-items: center; margin-top: 10px; color: var(--warning); font-weight: 600; font-size: 14px; }

/* Today timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.tl-item { display: grid; grid-template-columns: 78px 1fr; gap: 12px; padding: 4px 0; }
.tl-item time { color: var(--ink-2); font-weight: 650; font-size: 14px; font-variant-numeric: tabular-nums; padding-top: 10px; }
.tl-body { display: flex; flex-direction: column; gap: 2px; padding: 9px 12px 9px 14px; border-left: 3px solid var(--mod); border-radius: 0 12px 12px 0; }
.tl-body strong { font-size: 15px; }
.tl-body .muted { font-size: 13px; }
.tl-body .tag { align-self: flex-start; margin-top: 4px; }
.tl-item.is-past { opacity: .5; }
.tl-item.is-live .tl-body { background: var(--hl-soft); }
.tl-item.is-cancelled strong { text-decoration: line-through; color: var(--ink-3); }
.now-line { position: relative; display: flex; align-items: center; height: 26px; margin: 2px 0; }
.now-line::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 2px; background: var(--hl); border-radius: 2px; }
.now-line span { position: relative; background: var(--hl); color: var(--hl-ink); font-size: 12px; font-weight: 750; padding: 2px 9px; border-radius: 999px; }
.now-line.is-end::before { background: var(--line-strong); }
.now-line.is-end span { background: var(--surface-2); color: var(--ink-3); }

/* Task list */
.task-list { list-style: none; margin: 0; padding: 0; }
.task { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; gap: 12px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.task:first-child { border-top: 0; }
.task-list:not(.roomy) .task { grid-template-columns: auto minmax(0, 1fr) auto; }
.module .task, .dash-side .task:not(:has(form)) { grid-template-columns: minmax(0, 1fr) auto; }
.task-body { display: flex; flex-direction: column; min-width: 0; }
.task-body strong { font-size: 15px; overflow: hidden; text-overflow: ellipsis; }
.task-body .muted { font-size: 13px; }
.task.is-done .task-body strong { text-decoration: line-through; color: var(--ink-3); }
.task-check-form { display: contents; }
.task-check { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--mod); background: transparent; color: transparent; display: grid; place-items: center; padding: 0; transition: background .18s, color .18s, transform .18s var(--ease); }
.task-check .ic { width: 14px; height: 14px; stroke-width: 3; }
.task-check:hover { background: color-mix(in srgb, var(--mod) 15%, transparent); color: var(--mod); }
.task-check.is-checked, .task-check.is-popping { background: var(--mod); color: #fff; }
.task-check.is-popping { transform: scale(1.15); }
.row-actions { display: flex; gap: 2px; align-items: center; }
.row-actions form { display: contents; }

/* Events */
.event-list { list-style: none; padding: 0; margin: 0; }
.event-list li { display: grid; grid-template-columns: 46px 1fr; gap: 12px; align-items: center; padding: 9px 0; border-top: 1px solid var(--line); }
.event-list li:first-child { border-top: 0; }
.event-list li > div { display: flex; flex-direction: column; min-width: 0; }
.event-list .muted { font-size: 13px; }
.ev-date { display: flex; flex-direction: column; align-items: center; line-height: 1.05; font-size: 12px; font-weight: 650; color: var(--mod); background: color-mix(in srgb, var(--mod) 11%, transparent); border-radius: 12px; padding: 6px 0; }
.ev-date strong { font-size: 19px; }

/* Ask box */
.ask h2 { margin-bottom: 12px; }
.ask-form { display: flex; gap: 8px; }
.ask-form input { flex: 1; min-width: 0; height: 42px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 0 13px; }
.ask-form input:focus { outline: none; border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-soft); background: var(--surface); }

/* Empty states */
.empty { text-align: center; padding: 22px 12px 10px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.empty-ic { width: 32px; height: 32px; color: var(--ink-3); margin-bottom: 4px; }
.empty h3 { font-size: 16px; }
.empty p { color: var(--ink-2); max-width: 36ch; font-size: 14px; }
.empty .btn { margin-top: 10px; }

/* ---------- Week ---------- */
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 10px; }
.day { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 10px; min-height: 220px; display: flex; flex-direction: column; gap: 8px; }
.day.is-today { border-color: var(--brand-2); box-shadow: 0 0 0 3px var(--brand-soft); }
.day-head { display: flex; align-items: baseline; justify-content: space-between; padding: 2px 4px 4px; }
.day-name { font-weight: 700; font-size: 13px; color: var(--ink-2); }
.day-num { font-weight: 780; font-size: 20px; letter-spacing: -.02em; }
.day.is-today .day-num { background: var(--hl); color: var(--hl-ink); border-radius: 9px; padding: 0 7px; }
.day-free { color: var(--ink-3); font-size: 13px; padding: 4px; }
.slot { position: relative; border-radius: 12px; padding: 8px 10px; border-left: 3px solid var(--mod); background: var(--surface-2); background: color-mix(in srgb, var(--mod) 11%, var(--surface)); }
.slot.is-event { border-left-style: dashed; }
.slot.is-cancelled { opacity: .6; }
.slot.is-cancelled .slot-title { text-decoration: line-through; }
.slot-time { font-size: 12px; font-weight: 650; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.slot-title { font-weight: 750; font-size: 14px; margin: 1px 0; overflow-wrap: anywhere; }
.slot-meta { font-size: 12px; color: var(--ink-2); overflow-wrap: anywhere; }
.slot .tag { margin-top: 4px; height: 20px; font-size: 11px; }
.slot-del { position: absolute; top: 4px; right: 4px; }
.slot-del .icon-btn { width: 28px; height: 28px; }
@media (hover: hover) {
  .slot-del { opacity: 0; transition: opacity .15s; }
  .slot:hover .slot-del, .slot:focus-within .slot-del { opacity: 1; }
}

/* ---------- Modules ---------- */
.module-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 14px; }
.module-card { position: relative; background: var(--surface); border: 1px solid var(--line); border-radius: 20px; overflow: hidden; transition: border-color .15s, box-shadow .2s; }
.module-card:hover { border-color: color-mix(in srgb, var(--mod) 45%, transparent); box-shadow: var(--shadow); }
.module-link { display: block; padding: 18px 18px 16px; color: var(--ink); text-decoration: none !important; border-top: 6px solid var(--mod); }
.module-code { display: inline-block; font-size: 12px; font-weight: 800; color: var(--mod); background: color-mix(in srgb, var(--mod) 12%, transparent); border-radius: 8px; padding: 3px 8px; margin-bottom: 10px; }
.module-code.big { font-size: 15px; margin: 0 10px 0 0; vertical-align: middle; }
.module-card h2 { font-size: 18px; letter-spacing: -.01em; margin-bottom: 4px; padding-right: 60px; }
.module-card .muted { font-size: 14px; }
.module-stats { display: flex; gap: 14px; margin-top: 14px; font-size: 13px; color: var(--ink-3); font-weight: 600; }
.module-actions { position: absolute; top: 14px; right: 10px; }
.module-head h1 { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; justify-content: space-between; gap: 12px; align-items: center; padding: 11px 0; border-top: 1px solid var(--line); }
.plain-list li:first-child { border-top: 0; }
.plain-list li span:not(.tag) { color: var(--ink-2); font-size: 14px; text-align: right; }

/* ---------- Modals ---------- */
.modal { border: 0; padding: 0; background: transparent; width: min(540px, calc(100% - 24px)); max-height: calc(100dvh - 32px); color: var(--ink); overflow: visible; }
.modal::backdrop { background: rgba(10, 14, 28, .45); -webkit-backdrop-filter: blur(4px); backdrop-filter: blur(4px); animation: fade .2s ease; }
.modal[open] .modal-card { animation: pop .24s var(--ease); }
.modal.is-closing .modal-card { animation: pop-out .16s ease forwards; }
.modal.is-closing::backdrop { opacity: 0; transition: opacity .16s; }
@keyframes fade { from { opacity: 0; } }
@keyframes pop { from { opacity: 0; transform: translateY(10px) scale(.98); } }
@keyframes pop-out { to { opacity: 0; transform: translateY(6px) scale(.985); } }
.modal-card { background: var(--surface); border-radius: 24px; padding: 20px 22px; box-shadow: var(--shadow-lg); max-height: calc(100dvh - 32px); overflow: auto; border: 1px solid var(--line); }
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; }
.modal-head h2 { font-size: 19px; letter-spacing: -.01em; }
.modal-card > .muted { margin-bottom: 14px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 18px; }

.lbl { display: flex; flex-direction: column; gap: 6px; font-size: 13px; font-weight: 650; color: var(--ink-2); margin: 0 0 12px; min-width: 0; }
fieldset.lbl { border: 0; padding: 0; }
fieldset.lbl legend { padding: 0; margin-bottom: 6px; }
.opt { font-weight: 500; color: var(--ink-3); }
.lbl input, .lbl select, .stack input {
  width: 100%; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2);
  padding: 0 12px; font-size: 15px; font-weight: 500; color: var(--ink); transition: border-color .15s, box-shadow .15s, background .15s;
  -webkit-appearance: none; appearance: none;
}
.lbl select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C93A8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; padding-right: 34px; }
.lbl input:focus, .lbl select:focus { outline: none; border-color: var(--brand-2); background-color: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row-code { grid-template-columns: 130px 1fr; }
.day-picks { display: flex; flex-wrap: wrap; gap: 6px; }
.pick input { position: absolute; opacity: 0; pointer-events: none; }
.pick span { display: inline-grid; place-items: center; min-width: 50px; height: 38px; padding: 0 10px; border-radius: 11px; background: var(--surface-2); border: 1px solid var(--line-strong); color: var(--ink-2); font-weight: 650; font-size: 14px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.pick input:checked + span { background: var(--btn); border-color: var(--btn); color: #fff; }
.pick input:focus-visible + span { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.swatches { display: flex; gap: 10px; flex-wrap: wrap; }
.swatch input { position: absolute; opacity: 0; pointer-events: none; }
.swatch span { display: block; width: 30px; height: 30px; border-radius: 50%; background: var(--sw); cursor: pointer; transition: box-shadow .15s, transform .15s var(--ease); }
.swatch input:checked + span { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--sw); transform: scale(1.05); }
.swatch input:focus-visible + span { outline: 3px solid var(--brand-soft); outline-offset: 4px; }

/* ---------- Chat ---------- */
.chat { display: flex; flex-direction: column; min-height: calc(100vh - 108px); min-height: calc(100dvh - 108px); max-width: 820px; }
.chat-log { flex: 1; display: flex; flex-direction: column; gap: 14px; padding-bottom: 20px; }
.chat-intro { margin: auto 0; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 30px 10px; }
.chat-intro h2 { font-size: 24px; letter-spacing: -.02em; margin-top: 8px; }
.chat-intro .muted { max-width: 44ch; }
.chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 10px; }
.chip-btn { border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 8px 14px; font-weight: 600; font-size: 14px; transition: background .15s, border-color .15s; }
.chip-btn:hover { border-color: var(--brand-2); background: var(--brand-soft); }
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.bubble { max-width: min(640px, 88%); padding: 11px 15px; border-radius: 20px; font-size: 15px; line-height: 1.55; overflow-wrap: anywhere; }
.msg-user .bubble { background: var(--btn); color: #fff; border-bottom-right-radius: 6px; white-space: pre-wrap; }
.msg-ai .bubble { background: var(--surface); border: 1px solid var(--line); border-bottom-left-radius: 6px; }
.msg-ai .bubble p + p, .msg-ai .bubble p + ul, .msg-ai .bubble ul + p, .msg-ai .bubble ul + ol, .msg-ai .bubble ol + ul, .msg-ai .bubble h4 + ul, .msg-ai .bubble h4 + p, .msg-ai .bubble p + ol, .msg-ai .bubble ol + p { margin-top: 8px; }
.msg-ai .bubble ul, .msg-ai .bubble ol { margin: 0; padding-left: 20px; }
.msg-ai .bubble li + li { margin-top: 3px; }
.msg-ai .bubble h4 { font-size: 15px; margin: 10px 0 4px; }
.msg-ai .bubble code { background: var(--surface-2); border-radius: 6px; padding: 1px 5px; font-size: 13px; }
.msg-error .bubble { background: color-mix(in srgb, var(--danger) 10%, transparent); color: var(--danger); border: 0; font-weight: 550; }
.msg-new .bubble { animation: pop .25s var(--ease); }
.typing { display: inline-flex; gap: 4px; padding: 16px 16px; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-3); animation: blink 1.2s infinite ease-in-out; }
.typing span:nth-child(2) { animation-delay: .15s; }
.typing span:nth-child(3) { animation-delay: .3s; }
@keyframes blink { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }
.composer { position: sticky; bottom: 16px; display: flex; gap: 8px; align-items: flex-end; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow); }
.composer textarea { flex: 1; border: 0; background: transparent; resize: none; font-size: 16px; line-height: 1.45; padding: 9px 0; max-height: 160px; outline: none; }
.chat-head { margin-bottom: 12px; }

/* ---------- Settings / setup ---------- */
.settings { max-width: 760px; }
.stack { display: flex; flex-direction: column; gap: 4px; margin-top: 12px; }
.panel > h2 + .plain-list { margin-top: 8px; }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 14px 0; border-top: 1px solid var(--line); }
.panel > h2 + .danger-row { margin-top: 8px; border-top: 0; }
.signout { display: flex; justify-content: flex-start; }
.checks { list-style: none; margin: 0 0 18px; padding: 0; }
.checks li { display: flex; gap: 12px; align-items: flex-start; padding: 10px 0; border-top: 1px solid var(--line); }
.checks li:first-child { border-top: 0; }
.checks li > div { display: flex; flex-direction: column; min-width: 0; }
.checks small { color: var(--ink-2); overflow-wrap: anywhere; }
.check-dot { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; flex: none; color: #fff; }
.check-dot .ic { width: 14px; height: 14px; stroke-width: 3; }
.checks .ok .check-dot { background: var(--success); }
.checks .bad .check-dot { background: var(--danger); }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 24px; bottom: 24px; display: flex; flex-direction: column; gap: 8px; z-index: 60; max-width: min(380px, calc(100% - 32px)); }
.toast { display: flex; align-items: center; gap: 10px; background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-left: 4px solid var(--info); border-radius: 14px; padding: 12px 8px 12px 14px; box-shadow: var(--shadow-lg); font-weight: 550; font-size: 14px; animation: toast-in .35s var(--ease); }
.toast-success { border-left-color: var(--success); }
.toast-error { border-left-color: var(--danger); }
.toast.is-leaving { animation: toast-out .25s ease forwards; }
.toast-close { margin-left: auto; border: 0; background: transparent; color: var(--ink-3); width: 28px; height: 28px; border-radius: 8px; display: grid; place-items: center; flex: none; }
.toast-close .ic { width: 15px; height: 15px; }
@keyframes toast-in { from { opacity: 0; transform: translateY(12px); } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .week { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
@media (max-width: 900px) {
  .sidebar { display: none; }
  .topbar {
    display: flex; justify-content: space-between; align-items: center; position: sticky; top: 0; z-index: 20;
    padding: calc(10px + env(safe-area-inset-top)) 18px 10px; background: color-mix(in srgb, var(--bg) 85%, transparent);
    -webkit-backdrop-filter: saturate(1.4) blur(14px); backdrop-filter: saturate(1.4) blur(14px); border-bottom: 1px solid var(--line);
  }
  .tabbar {
    display: grid; grid-template-columns: repeat(5, 1fr); position: fixed; left: 0; right: 0; bottom: 0; z-index: 30;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
    background: color-mix(in srgb, var(--surface) 88%, transparent); -webkit-backdrop-filter: saturate(1.4) blur(16px); backdrop-filter: saturate(1.4) blur(16px);
    border-top: 1px solid var(--line);
  }
  .tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; color: var(--ink-3); font-size: 11px; font-weight: 650; text-decoration: none !important; }
  .tab .ic { width: 22px; height: 22px; }
  .tab.is-active { color: var(--brand-2); }
  .main { margin-left: 0; padding: 20px 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 28px); }
  .page-head h1 { font-size: 27px; }
  .dash { grid-template-columns: 1fr; gap: 0; }
  .week { grid-template-columns: 1fr; }
  .day { min-height: 0; flex-direction: row; flex-wrap: wrap; align-items: stretch; }
  .day-head { flex-direction: column; align-items: center; justify-content: flex-start; width: 46px; padding: 2px 0; }
  .day > .slot, .day > .day-free { flex: 1 1 200px; }
  .day-free { align-self: center; }
  .toasts { left: 16px; right: 16px; max-width: none; bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px); }
  .chat { min-height: calc(100dvh - 190px); }
  .composer { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); }
  .next-card h2 { font-size: 25px; }
}
@media (max-width: 560px) {
  .row2, .row-code { grid-template-columns: 1fr; }
  .head-actions { width: 100%; }
  .head-actions .btn { flex: 1; }
  .task, .task-list.roomy .task { grid-template-columns: auto minmax(0, 1fr) auto; }
  .task .tag { grid-column: 2; justify-self: start; }
  .task .row-actions { grid-column: 3; grid-row: 1 / span 2; }
  .modal { width: 100%; max-width: none; margin: auto 0 0; }
  .modal-card { border-radius: 24px 24px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); }
  .auth-word { font-size: 34px; }
  .danger-row { flex-direction: column; align-items: flex-start; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-delay: 0s !important; transition-duration: .001ms !important; }
  .auth-word .highlight { width: calc(100% + .16em); }
}

/* ============================================================
   v3 — richer motion, glass, welcome, auth+, premium, admin
   ============================================================ */

/* Page-load reveal + staggered children (respects reduce-motion below) */
[data-reveal] { animation: rise .55s var(--ease) both; }
[data-reveal-stagger] > * { animation: rise-in .5s var(--ease) both; }
[data-reveal-stagger] > *:nth-child(1){animation-delay:.03s}
[data-reveal-stagger] > *:nth-child(2){animation-delay:.09s}
[data-reveal-stagger] > *:nth-child(3){animation-delay:.15s}
[data-reveal-stagger] > *:nth-child(4){animation-delay:.21s}
[data-reveal-stagger] > *:nth-child(5){animation-delay:.27s}
[data-reveal-stagger] > *:nth-child(6){animation-delay:.33s}
[data-reveal-stagger] > *:nth-child(n+7){animation-delay:.39s}
@keyframes rise-in { from { opacity: 0; transform: translateY(12px); } }

/* Gentle enter for main panels on every page */
.main > .page-head { animation: rise .5s var(--ease) both; }
.main > .panel, .main > .dash, .main > .week, .main > .module-grid, .main > .stat-grid, .main > .settings, .main > .notice, .main > .next-card, .main > .hint, .main > .legal-tabs, .main > article {
  animation: rise .55s var(--ease) both; animation-delay: .05s;
}

/* Glass surfaces (subtle, not overdone) */
.glass {
  background: color-mix(in srgb, var(--surface) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(20px); backdrop-filter: saturate(1.6) blur(20px);
  border: 1px solid color-mix(in srgb, var(--line-strong) 90%, transparent);
}
.glass-soft {
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  -webkit-backdrop-filter: saturate(1.4) blur(12px); backdrop-filter: saturate(1.4) blur(12px);
  border: 1px solid var(--line);
}

.page-sub { display: inline-flex; align-items: center; gap: 6px; color: var(--ink-2); font-size: 14px; font-weight: 550; margin-top: 6px; }
.ic-inline { width: 15px; height: 15px; }

/* Avatar colour token */
.avatar { background: var(--av, var(--brand-2)) !important; }
.me { text-decoration: none !important; border-radius: 12px; transition: background .15s; }
.me:hover { background: var(--surface-2); }

/* Button shimmer on primary (very subtle) */
.btn-primary { background-image: linear-gradient(120deg, transparent 30%, rgba(255,255,255,.14) 50%, transparent 70%); background-size: 220% 100%; background-position: 130% 0; transition: background .15s, border-color .15s, color .15s, transform .12s, background-position .6s var(--ease); }
.btn-primary:hover { background-position: -20% 0; }

/* ---- Wider auth card + agree + otp ---- */
.auth-card-wide { max-width: 480px; }
.auth-minor { text-align: right; margin: -4px 0 14px; font-size: 13px; }
.auth-minor a { color: var(--ink-2); }
.select-field select { width: 100%; height: 56px; padding: 20px 14px 6px; border-radius: 14px; font-size: 16px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); -webkit-appearance: none; appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%238C93A8' stroke-width='2.5' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 14px center; }
.select-field select:focus { outline: none; border-color: var(--brand-2); background-color: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.select-field label { top: 8px; transform: scale(.76); color: var(--ink-2); }

.agree { display: flex; align-items: flex-start; gap: 10px; margin: 4px 0 18px; font-size: 14px; color: var(--ink-2); cursor: pointer; }
.agree input { position: absolute; opacity: 0; width: 0; height: 0; }
.agree-box { flex: none; width: 22px; height: 22px; border-radius: 7px; border: 2px solid var(--line-strong); display: grid; place-items: center; color: transparent; transition: background .18s, border-color .18s, color .18s, transform .18s var(--ease); margin-top: 1px; }
.agree-box .ic { width: 14px; height: 14px; stroke-width: 3; }
.agree input:checked + .agree-box { background: var(--btn); border-color: var(--btn); color: #fff; transform: scale(1.05); }
.agree input:focus-visible + .agree-box { outline: 3px solid var(--brand-soft); outline-offset: 2px; }
.agree-text a { font-weight: 600; }

.form-note { background: var(--brand-soft); color: var(--brand-2); border-radius: 12px; padding: 10px 13px; font-size: 14px; font-weight: 550; margin-bottom: 14px; }
.verify-icon { width: 56px; height: 56px; border-radius: 50%; background: var(--brand-soft); color: var(--brand-2); display: grid; place-items: center; margin: 0 auto 12px; animation: pop .5s var(--ease) both; }
.verify-icon .ic { width: 28px; height: 28px; }
.auth-resend { text-align: center; margin-top: 12px; }
.linkish { background: none; border: 0; color: var(--brand-2); font-weight: 600; font-size: 14px; cursor: pointer; }
.linkish.subtle { color: var(--ink-3); font-weight: 500; }

.otp { display: flex; gap: 8px; justify-content: center; margin: 6px 0 18px; }
.otp-box { width: 46px; height: 56px; text-align: center; font-size: 24px; font-weight: 700; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface-2); color: var(--ink); transition: border-color .15s, box-shadow .15s, transform .15s var(--ease); }
.otp-box:focus { outline: none; border-color: var(--brand-2); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); transform: translateY(-2px); }
.otp-box.filled { border-color: color-mix(in srgb, var(--brand-2) 50%, var(--line-strong)); }
@media (max-width: 420px) { .otp-box { width: 42px; height: 52px; font-size: 21px; } }

/* ---- Welcome screen ---- */
body.welcome { min-height: 100vh; min-height: 100dvh; overflow: hidden; background: var(--bg); position: relative; display: grid; place-items: center; }
.w-orbs { position: fixed; inset: 0; overflow: hidden; pointer-events: none; }
.w-orbs span { position: absolute; border-radius: 50%; filter: blur(60px); opacity: .5; animation: float 14s ease-in-out infinite; }
.w-orbs span:nth-child(1){ width: 420px; height: 420px; background: #3450E0; left: -80px; top: -60px; }
.w-orbs span:nth-child(2){ width: 360px; height: 360px; background: #8E4FD8; right: -60px; top: 30%; animation-delay: -4s; }
.w-orbs span:nth-child(3){ width: 400px; height: 400px; background: #0F9D8A; left: 30%; bottom: -120px; animation-delay: -8s; }
@keyframes float { 0%,100%{ transform: translate(0,0) scale(1);} 33%{ transform: translate(30px,-24px) scale(1.06);} 66%{ transform: translate(-20px,18px) scale(.96);} }
.w-stage { position: relative; z-index: 1; width: 100%; display: grid; place-items: center; padding: 24px; }
.w-hello { font-size: clamp(48px, 12vw, 104px); font-weight: 800; letter-spacing: -.04em; color: var(--ink); text-align: center; }
.w-hello-text { display: inline-block; }
.w-hello-text.swap { animation: hello-swap .5s var(--ease); }
@keyframes hello-swap { 0%{ opacity: 0; transform: translateY(16px) scale(.96); filter: blur(6px);} 100%{ opacity: 1; transform: none; filter: blur(0);} }
.w-card { max-width: 460px; width: 100%; border-radius: 30px; padding: 34px 30px; text-align: center; box-shadow: var(--shadow-lg); }
.w-mark { font-size: 54px; margin-bottom: 8px; animation: pop .6s var(--ease) both; }
.w-card h1 { font-size: 30px; letter-spacing: -.03em; margin-bottom: 8px; }
.w-card h1 .dot { color: var(--brand-2); }
.w-lead { color: var(--ink-2); font-size: 16px; line-height: 1.6; margin-bottom: 20px; }
.w-points { list-style: none; margin: 0 0 20px; padding: 0; text-align: left; display: flex; flex-direction: column; gap: 12px; }
.w-points li { display: flex; gap: 12px; align-items: flex-start; }
.w-points .w-dot { flex: none; width: 12px; height: 12px; border-radius: 50%; background: var(--c); margin-top: 4px; box-shadow: 0 0 0 4px color-mix(in srgb, var(--c) 18%, transparent); }
.w-points strong { display: block; font-size: 15px; }
.w-points span { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.w-made { color: var(--ink-3); font-size: 13px; margin-top: 4px; }
.w-made strong { color: var(--ink-2); }
.w-continue { position: fixed; left: 0; right: 0; bottom: calc(34px + env(safe-area-inset-bottom)); text-align: center; color: var(--ink-2); font-weight: 600; font-size: 15px; display: flex; flex-direction: column; gap: 3px; animation: pulse-fade 2.4s ease-in-out infinite; z-index: 2; }
.w-continue .w-tap { font-size: 12px; color: var(--ink-3); font-weight: 500; }
@keyframes pulse-fade { 0%,100%{ opacity: .55;} 50%{ opacity: 1;} }
.w-stage[hidden] { display: none; }
.w-fade-out { animation: w-out .5s var(--ease) forwards; }
@keyframes w-out { to { opacity: 0; transform: scale(1.04); filter: blur(4px); } }

/* ---- Premium ---- */
.premium { position: relative; min-height: calc(100vh - 120px); min-height: calc(100dvh - 120px); display: grid; place-items: center; padding: 10px 0 30px; }
.premium-blur { position: absolute; inset: 0; display: flex; flex-direction: column; gap: 14px; padding: 20px; filter: blur(9px); opacity: .5; pointer-events: none; -webkit-user-select: none; user-select: none; overflow: hidden; }
.premium-card { position: relative; z-index: 1; width: 100%; max-width: 460px; border-radius: 26px; padding: 30px 28px; box-shadow: var(--shadow-lg); }
.premium-badge { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 13px; color: var(--brand-2); background: var(--brand-soft); border-radius: 999px; padding: 6px 12px; margin-bottom: 14px; }
.premium-badge .ic { width: 15px; height: 15px; }
.premium-card h1 { font-size: 26px; letter-spacing: -.02em; }
.premium-lead { color: var(--ink-2); font-size: 15px; line-height: 1.6; margin: 8px 0 20px; }
.premium-primary { margin-bottom: 8px; }
.premium-note { text-align: center; color: var(--ink-3); font-size: 13px; margin-bottom: 8px; }
.premium-divider { display: flex; align-items: center; gap: 12px; color: var(--ink-3); font-size: 13px; margin: 16px 0; }
.premium-divider::before, .premium-divider::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.premium-redeem { margin-bottom: 16px; }
.redeem-row { display: flex; gap: 8px; }
.redeem-row input { flex: 1; height: 44px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface-2); padding: 0 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.redeem-row input:focus { outline: none; border-color: var(--brand-2); background: var(--surface); box-shadow: 0 0 0 4px var(--brand-soft); }
.premium-buy { display: flex; justify-content: space-between; align-items: center; gap: 12px; border-radius: 16px; padding: 14px 16px; }
.premium-buy strong { font-size: 15px; }
.premium-contact { text-align: center; margin-top: 16px; color: var(--ink-2); font-size: 13px; }

/* ---- Admin ---- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 18px; }
.stat { border-radius: 18px; padding: 18px; display: flex; flex-direction: column; gap: 2px; }
.stat-n { font-size: 30px; font-weight: 800; letter-spacing: -.02em; }
.stat-l { color: var(--ink-2); font-size: 13px; font-weight: 600; }
.table-scroll { overflow-x: auto; margin: 0 -4px; }
.data-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.data-table th { text-align: left; color: var(--ink-3); font-weight: 650; font-size: 12px; text-transform: uppercase; letter-spacing: .04em; padding: 6px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table td { padding: 9px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.data-table tr:last-child td { border-bottom: 0; }
.mono-code { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: 13px; background: var(--surface-2); padding: 2px 7px; border-radius: 7px; }
.code-list li { align-items: center; }
.link-list li { justify-content: space-between; }
.link-list a { font-weight: 550; }
.link-list .ic { color: var(--ink-3); width: 16px; height: 16px; }
@media (max-width: 720px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---- Legal / reading ---- */
.reading { background: var(--bg); padding: 40px 20px; min-height: 100vh; }
.reading-wrap { max-width: 680px; margin: 0 auto; }
.legal-tabs { display: inline-flex; margin-bottom: 16px; }
.legal { line-height: 1.7; color: var(--ink); }
.legal h2 { font-size: 18px; margin: 22px 0 8px; letter-spacing: -.01em; }
.legal p, .legal li { color: var(--ink-2); font-size: 15px; }
.legal ul { padding-left: 20px; }
.legal li { margin: 4px 0; }
.legal-meta { color: var(--ink-3); font-size: 13px; }

/* ---- Chat: image attach ---- */
.composer-attach { flex: none; width: 38px; height: 38px; border-radius: 11px; border: 0; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; margin-bottom: 1px; transition: background .15s, color .15s, transform .12s; }
.composer-attach:hover { background: var(--brand-soft); color: var(--brand-2); }
.composer-attach:active { transform: scale(.94); }
.chat-attach-preview { display: flex; gap: 8px; margin-top: 8px; }
.chat-attach-preview img { height: 60px; border-radius: 10px; border: 1px solid var(--line); }
.chat-attach-preview .att-wrap { position: relative; }
.chat-attach-preview .att-x { position: absolute; top: -6px; right: -6px; width: 22px; height: 22px; border-radius: 50%; background: var(--danger); color: #fff; border: 2px solid var(--surface); display: grid; place-items: center; }
.chat-attach-preview .att-x .ic { width: 12px; height: 12px; stroke-width: 3; }
.msg .bubble img { max-width: 220px; border-radius: 12px; margin-top: 6px; display: block; }

/* List item stagger on task/timeline/module (cheap, load-time only) */
.timeline .tl-item, .task-list .task, .module-grid .module-card, .event-list li, .week .day {
  animation: rise-in .45s var(--ease) both;
}
.timeline .tl-item:nth-child(n+2){animation-delay:.04s}
.module-grid .module-card:nth-child(2){animation-delay:.05s}
.module-grid .module-card:nth-child(3){animation-delay:.1s}
.module-grid .module-card:nth-child(4){animation-delay:.15s}
.module-grid .module-card:nth-child(n+5){animation-delay:.2s}

/* Active-tab bounce on mobile */
.tab.is-active .ic { animation: tab-pop .4s var(--ease); }
@keyframes tab-pop { 50% { transform: translateY(-3px) scale(1.12); } }

@media (prefers-reduced-motion: reduce) {
  [data-reveal], [data-reveal-stagger] > *, .main > *, .timeline .tl-item, .task-list .task, .module-grid .module-card, .event-list li, .week .day, .w-mark, .verify-icon, .w-card {
    animation: none !important;
  }
  .w-orbs span { animation: none !important; }
  .w-continue { animation: none !important; opacity: .8; }
  .btn-primary { background-image: none; }
}

/* ============================================================
   v4 — notifications, support chat, avatars, photo import
   ============================================================ */

/* Avatars with photos */
.avatar { overflow: hidden; }
.avatar.has-img { color: transparent; }
.avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.avatar.sm { width: 34px; height: 34px; font-size: 13px; }
.avatar.xl { width: 76px; height: 76px; font-size: 28px; border-radius: 22px; }
.avatar-row { display: flex; gap: 18px; align-items: center; }
.avatar-actions { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.inline-form { display: inline; }
.file-btn { cursor: pointer; }
.file-btn input { display: none; }

/* Profile picture uploader */
.pfp-photo { display: inline-flex; flex-direction: column; align-items: center; gap: 10px; cursor: pointer; width: fit-content; margin-top: 4px; }
.avatar.xl2 { width: 96px; height: 96px; font-size: 32px; border-radius: 24px; overflow: hidden; }
.pfp-change {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 7px 14px; border-radius: 999px;
  background: var(--surface-2); color: var(--ink-2);
  font-size: 13px; font-weight: 650;
  transition: background .15s ease, color .15s ease;
}
.pfp-change .ic { width: 15px; height: 15px; }
.pfp-photo:hover .pfp-change, .pfp-photo:focus-visible .pfp-change { background: var(--brand-soft); color: var(--brand-2); }
.pfp-photo:focus-visible { outline: 2px solid var(--brand); outline-offset: 5px; border-radius: 26px; }
.pfp-photo.is-dragover { outline: 2px dashed var(--brand); outline-offset: 5px; border-radius: 26px; }
.pfp-label { display: block; margin-top: 20px; font-size: 15px; }
.pfp-label + p { margin-top: 3px; margin-bottom: 14px; }

/* Sidebar + topbar badges */
.side-badge { margin-left: auto; background: var(--brand-2); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.top-bell { position: relative; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; color: var(--ink-2); background: var(--surface-2); }
.top-bell .ic { width: 20px; height: 20px; }
.bell-dot { position: absolute; top: 8px; right: 9px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

/* Notifications */
.notif-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.notif { display: flex; gap: 12px; align-items: flex-start; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 14px 14px; position: relative; transition: border-color .15s, transform .12s var(--ease); }
.notif:hover { border-color: var(--line-strong); }
.notif.is-unread { border-color: color-mix(in srgb, var(--brand-2) 40%, var(--line)); background: color-mix(in srgb, var(--brand-soft) 40%, var(--surface)); }
.notif-ic { flex: none; width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.notif-ic .ic { width: 20px; height: 20px; }
.notif-assignment .notif-ic { background: color-mix(in srgb, #D6453D 15%, var(--surface-2)); color: #D6453D; }
.notif-schedule .notif-ic { background: color-mix(in srgb, #2D8FD5 15%, var(--surface-2)); color: #2D8FD5; }
.notif-support .notif-ic { background: color-mix(in srgb, #0F9D8A 15%, var(--surface-2)); color: #0F9D8A; }
.notif-premium .notif-ic { background: var(--brand-soft); color: var(--brand-2); }
.notif-body { flex: 1; display: flex; flex-direction: column; gap: 2px; text-decoration: none; color: inherit; min-width: 0; }
.notif-body strong { font-size: 15px; }
.notif-body span { font-size: 13.5px; }
.notif-body time { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.notif-x { flex: none; }
.empty-state { text-align: center; padding: 48px 24px; }
.empty-ic { width: 40px; height: 40px; color: var(--ink-3); margin: 0 auto 10px; }
.empty-state h2 { font-size: 18px; }

/* Support chat (shares .chat styles) */
.support-chat .chat-log, .thread-view .chat-log { min-height: 320px; }
.msg-time { display: block; font-size: 11px; opacity: .6; margin-top: 4px; }
.msg .bubble time.msg-time { color: inherit; }

/* Admin support console: two-pane */
.support-console { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; }
.thread-list { padding: 8px; max-height: 70vh; overflow-y: auto; }
.thread-item { display: flex; align-items: center; gap: 10px; padding: 10px; border-radius: 12px; text-decoration: none; color: inherit; transition: background .14s; }
.thread-item:hover { background: var(--surface-2); }
.thread-item.is-active { background: var(--brand-soft); }
.thread-meta { display: flex; flex-direction: column; min-width: 0; }
.thread-meta strong { font-size: 14px; }
.thread-meta small { color: var(--ink-3); font-size: 12px; }
.thread-item .badge { margin-left: auto; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; min-width: 20px; height: 20px; border-radius: 999px; display: grid; place-items: center; padding: 0 6px; }
.thread-view { display: flex; flex-direction: column; padding: 0; overflow: hidden; }
.thread-head { padding: 14px 18px; border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; }
.admin-log { flex: 1; padding: 16px 18px; overflow-y: auto; max-height: 56vh; }
.thread-view .composer { margin: 0; border-top: 1px solid var(--line); border-radius: 0; }
@media (max-width: 820px) { .support-console { grid-template-columns: 1fr; } .thread-list { max-height: 200px; } }

/* From-email / from-photo assignment state */
.task-from-email { border-left: 3px solid var(--danger); }
.src-pill { display: inline-flex; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 999px; background: var(--surface-2); color: var(--ink-2); vertical-align: middle; margin-left: 4px; }
.src-pill .ic { width: 12px; height: 12px; }
.src-pill.src-email { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.from-email-note { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; color: var(--danger); margin-top: 4px; }
.from-email-note .ic { width: 13px; height: 13px; }

/* Schedule photo import */
.photo-drop { margin-top: 4px; }
.photo-drop-inner, .photo-drop-busy, .photo-drop-result { display: flex; flex-direction: column; align-items: center; gap: 8px; text-align: center; padding: 28px 20px; border: 1.5px dashed var(--line-strong); border-radius: 18px; background: var(--surface-2); }
.big-ic { width: 40px; height: 40px; color: var(--brand-2); }
.photo-drop-busy strong, .photo-drop-inner strong { font-size: 16px; }
.spinner.big { width: 28px; height: 28px; border-width: 3px; }
.photo-drop-result.is-ok { border-style: solid; border-color: color-mix(in srgb, var(--success, #0F9D8A) 50%, var(--line)); background: color-mix(in srgb, #0F9D8A 10%, var(--surface-2)); color: #0F7d6e; }
.photo-drop-result.is-err { border-style: solid; border-color: color-mix(in srgb, var(--danger) 50%, var(--line)); background: color-mix(in srgb, var(--danger) 8%, var(--surface-2)); color: var(--danger); }

/* Timetable classes added from photo/email get a subtle red edge */
.week .slot.from-photo, .week .slot.from-email { box-shadow: inset 3px 0 0 var(--danger); }

@media (prefers-reduced-motion: reduce) {
  .notif { animation: none !important; }
}

/* ============================================================
   TheBue — AI chat v2 (distinctive redesign)
   ============================================================ */
.chat2 { display: flex; flex-direction: column; height: calc(100vh - 130px); height: calc(100dvh - 130px); max-width: 860px; margin: 0 auto; }
@media (max-width: 900px) { .chat2 { height: calc(100vh - 180px); height: calc(100dvh - 180px); } }

.chat2-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 4px 0 18px; animation: rise .5s var(--ease) both; }
.chat2-head-id { display: flex; align-items: center; gap: 13px; }
.chat2-orb { flex: none; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7C5CFF, #3450E0); box-shadow: 0 8px 20px -6px rgba(80,70,220,.5); animation: chat2-orb-pulse 3s ease-in-out infinite; }
.chat2-orb .ic { width: 21px; height: 21px; }
@keyframes chat2-orb-pulse { 0%,100% { box-shadow: 0 8px 20px -6px rgba(80,70,220,.5); } 50% { box-shadow: 0 8px 26px -4px rgba(80,70,220,.7); } }
.chat2-head-id h1 { font-size: 21px; letter-spacing: -.02em; margin: 0; }
.chat2-head-id p { font-size: 13px; color: var(--ink-2); margin: 1px 0 0; }
.chat2-clear { display: inline-flex; align-items: center; gap: 6px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); font-size: 13px; font-weight: 600; border-radius: 11px; padding: 8px 13px; cursor: pointer; transition: background .15s, color .15s, border-color .15s; }
.chat2-clear .ic { width: 15px; height: 15px; }
.chat2-clear:hover { background: var(--surface); color: var(--ink); border-color: var(--line-strong); }

.chat2-log { flex: 1; overflow-y: auto; padding: 6px 2px 20px; display: flex; flex-direction: column; gap: 4px; }

.chat2-intro { text-align: center; max-width: 480px; margin: 6vh auto 0; animation: rise .5s var(--ease) .05s both; }
.chat2-intro-mark { display: inline-block; width: 56px; height: 56px; border-radius: 18px; margin-bottom: 18px; background: linear-gradient(135deg, #7C5CFF, #3450E0); position: relative; box-shadow: 0 12px 28px -8px rgba(80,70,220,.5); animation: chat2-mark-float 3.4s ease-in-out infinite; }
.chat2-intro-mark::before { content: ""; position: absolute; inset: 15px 12px; border-radius: 5px; background: linear-gradient(180deg, #fff, rgba(255,255,255,.6)); }
@keyframes chat2-mark-float { 0%,100% { transform: translateY(0) rotate(0deg); } 50% { transform: translateY(-6px) rotate(-3deg); } }
.chat2-intro h2 { font-size: 21px; letter-spacing: -.02em; margin: 0 0 8px; }
.chat2-intro p { color: var(--ink-2); font-size: 14px; line-height: 1.6; margin: 0 0 24px; }
.chat2-chips { display: flex; flex-wrap: wrap; gap: 9px; justify-content: center; }
.chat2-chip { display: inline-flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line-strong); color: var(--ink); font-size: 13.5px; font-weight: 550; border-radius: 999px; padding: 9px 15px 9px 12px; cursor: pointer; transition: transform .14s var(--ease), border-color .15s, background .15s; animation: rise-in .4s var(--ease) both; }
.chat2-chip:nth-child(1) { animation-delay: .08s; } .chat2-chip:nth-child(2) { animation-delay: .14s; } .chat2-chip:nth-child(3) { animation-delay: .2s; } .chat2-chip:nth-child(4) { animation-delay: .26s; }
.chip-dot { width: 6px; height: 6px; border-radius: 50%; background: linear-gradient(135deg, #7C5CFF, #3450E0); flex: none; }
.chat2-chip:hover { transform: translateY(-2px); border-color: var(--brand-2); background: var(--brand-soft); }

.msg2 { display: flex; gap: 10px; align-items: flex-end; max-width: 78%; animation: msg2-in .32s var(--ease) both; }
@keyframes msg2-in { from { opacity: 0; transform: translateY(10px) scale(.98); } }
.msg2-user { align-self: flex-end; flex-direction: row-reverse; margin: 6px 0; }
.msg2-ai { align-self: flex-start; margin: 6px 0; }
.msg2-avatar { flex: none; width: 30px; height: 30px; border-radius: 10px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7C5CFF, #3450E0); margin-bottom: 2px; }
.msg2-avatar .ic { width: 15px; height: 15px; }
.msg2-bubble { border-radius: 18px; padding: 11px 15px; font-size: 14.5px; line-height: 1.55; word-wrap: break-word; }
.msg2-user .msg2-bubble { background: linear-gradient(135deg, #7C5CFF, #3450E0); color: #fff; border-bottom-right-radius: 5px; }
.msg2-ai .msg2-bubble { background: var(--surface); border: 1px solid var(--line); color: var(--ink); border-bottom-left-radius: 5px; }
.msg2-error .msg2-bubble { background: color-mix(in srgb, var(--danger) 10%, var(--surface)); border-color: color-mix(in srgb, var(--danger) 30%, var(--line)); color: var(--danger); }
.msg2-bubble img { max-width: 220px; border-radius: 12px; margin-top: 6px; display: block; }
.msg2-bubble p { margin: 0 0 8px; } .msg2-bubble p:last-child { margin-bottom: 0; }
.msg2-bubble code { background: color-mix(in srgb, var(--ink) 8%, transparent); padding: 1px 5px; border-radius: 5px; font-size: 13px; }

.msg2-typing { display: flex; gap: 4px; align-items: center; padding: 13px 16px; }
.msg2-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--ink-3); animation: msg2-bounce 1.1s ease-in-out infinite; }
.msg2-typing span:nth-child(2) { animation-delay: .15s; } .msg2-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes msg2-bounce { 0%, 60%, 100% { transform: translateY(0); opacity: .5; } 30% { transform: translateY(-4px); opacity: 1; } }

/* Played once on a streamed reply's bubble right as it finishes, so the
   settled answer eases in instead of just stopping mid-stream. */
.msg2-settle { animation: msg2-settle .45s var(--ease) both; }
@keyframes msg2-settle { from { opacity: .45; filter: blur(3px); } to { opacity: 1; filter: blur(0); } }

#chat-input:disabled { opacity: .6; cursor: not-allowed; }

/* The confirm/cancel card a proposed timetable or task change renders as —
   its own bubble under the AI's reply, never auto-applied. */
.ai-action-bubble { max-width: 320px; }
.ai-action-summary { font-weight: 600; margin: 0 0 10px; }
.ai-action-buttons { display: flex; gap: 8px; justify-content: flex-end; }
.ai-action-buttons .btn { flex: 0 0 auto; }
.ai-action-done { margin: 0; font-size: 13.5px; color: var(--ink-2); }
.ai-action-done.is-error { color: var(--danger); }

.chat2-composer { display: flex; align-items: flex-end; gap: 8px; background: var(--surface); border: 1.5px solid var(--line-strong); border-radius: 20px; padding: 8px 8px 8px 8px; box-shadow: 0 2px 14px -6px rgba(20,26,46,.08); transition: border-color .15s, box-shadow .15s; }
.chat2-composer:focus-within { border-color: var(--brand-2); box-shadow: 0 0 0 4px var(--brand-soft); }
.chat2-attach { flex: none; width: 38px; height: 38px; border-radius: 12px; border: 0; background: var(--surface-2); color: var(--ink-2); display: grid; place-items: center; cursor: pointer; transition: background .15s, color .15s, transform .12s; }
.chat2-attach:hover { background: var(--brand-soft); color: var(--brand-2); }
.chat2-attach:active { transform: scale(.94); }
.chat2-composer textarea { flex: 1; border: 0; background: none; resize: none; font-family: var(--font); font-size: 14.5px; color: var(--ink); padding: 9px 4px; max-height: 140px; }
.chat2-composer textarea:focus { outline: none; }
.chat2-send { flex: none; width: 40px; height: 40px; border-radius: 13px; border: 0; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, #7C5CFF, #3450E0); cursor: pointer; transition: transform .14s var(--ease), opacity .15s; box-shadow: 0 6px 16px -6px rgba(80,70,220,.55); }
.chat2-send:hover { transform: scale(1.06); }
.chat2-send:active { transform: scale(.95); }
.chat2-send:disabled { opacity: .55; transform: none; cursor: default; }
.chat2-send .ic { width: 18px; height: 18px; }

@media (prefers-reduced-motion: reduce) {
  .chat2-orb, .chat2-intro-mark, .chat2-chip, .msg2, .msg2-typing span, .msg2-settle { animation: none !important; }
}

/* Admin-only debug line shown under a schedule-photo import failure */
.photo-drop-debug { font-size: 12px; font-family: ui-monospace, "SF Mono", Menlo, monospace; color: var(--ink-3); background: color-mix(in srgb, var(--ink) 5%, transparent); border-radius: 8px; padding: 8px 10px; margin: 8px 0; text-align: left; white-space: pre-wrap; word-break: break-word; }
