/* Bloom – tyylijärjestelmä: vaalea ja ilmava (Apple) + pyöreä ja värikäs (Duolingo), pääväri pinkki. */
:root {
  --bg: #FFF5F9;
  --surface: #FFFFFF;
  --surface-2: #FDEEF4;
  --line: #F4DDE7;
  --line-soft: #F9EAF0;
  --text: #2B1520;
  --muted: #8C6F7C;
  --accent: #E83E80;
  --accent-strong: #C92466;
  --accent-soft: #FFE1EC;
  --on-accent: #FFFFFF;
  --ok: #3BB54A;
  --warn: #F08A00;
  --danger: #E5484D;
  --shadow: 0 1px 2px rgba(120, 30, 70, .06), 0 8px 24px rgba(200, 50, 110, .08);
  --shadow-lg: 0 -8px 40px rgba(120, 30, 70, .18);
  --hero: linear-gradient(135deg, #FF6FA5 0%, #E83E80 55%, #C9408F 100%);
  --mix-text: #1B0B12;
  --mix-bg: 82%;

  --r-sm: 10px; --r: 16px; --r-lg: 24px;
  --f-xs: 11px; --f-sm: 13px; --f-md: 16px; --f-lg: 20px; --f-xl: 28px; --f-hero: 44px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, system-ui, sans-serif;
  --font-round: ui-rounded, "SF Pro Rounded", -apple-system, "Segoe UI", Roboto, system-ui, sans-serif;
  --hour: 52px;
  --gutter: 38px;
  --tabbar: 58px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #170E13; --surface: #21141B; --surface-2: #2B1B24; --line: #3A2631; --line-soft: #2D1D26;
    --text: #F9EEF3; --muted: #B897A6; --accent: #FF5C97; --accent-strong: #FF7AAB; --accent-soft: #4A1E32; --on-accent: #fff;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 -8px 40px rgba(0,0,0,.5);
    --hero: linear-gradient(135deg, #FF5C97 0%, #D7357A 55%, #9C3B8C 100%);
    --mix-text: #FFFFFF; --mix-bg: 70%;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #170E13; --surface: #21141B; --surface-2: #2B1B24; --line: #3A2631; --line-soft: #2D1D26;
  --text: #F9EEF3; --muted: #B897A6; --accent: #FF5C97; --accent-strong: #FF7AAB; --accent-soft: #4A1E32; --on-accent: #fff;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.35); --shadow-lg: 0 -8px 40px rgba(0,0,0,.5);
  --hero: linear-gradient(135deg, #FF5C97 0%, #D7357A 55%, #9C3B8C 100%);
  --mix-text: #FFFFFF; --mix-bg: 70%;
  color-scheme: dark;
}

/* Kategoriavärit (Duolingon kirkkaus) */
.c-pink   { --c: #FF4F93; } .c-rose { --c: #FF85B3; } .c-purple { --c: #A65CF2; } .c-blue { --c: #2F95FF; }
.c-teal   { --c: #12BFAE; } .c-green { --c: #4CC20A; } .c-yellow { --c: #F5B800; } .c-orange { --c: #FF8A00; }
.c-red    { --c: #FF4B4B; } .c-gray { --c: #98A0A8; }

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--text); font-family: var(--font); font-size: var(--f-md); line-height: 1.4;
  -webkit-font-smoothing: antialiased; overscroll-behavior: none; -webkit-text-size-adjust: 100%;
}
[hidden] { display: none !important; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; touch-action: manipulation; }
input, select, textarea { font: inherit; color: inherit; }
svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.num { font-variant-numeric: tabular-nums; }

.boot { position: fixed; inset: 0; display: grid; place-items: center; }
.boot img { animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(.92); opacity: .7; } }

/* ---------- Napit ja kentät ---------- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 48px; padding: 0 20px; border-radius: 999px; font-weight: 700; font-family: var(--font-round); letter-spacing: .01em; transition: transform .12s, background .2s; }
.btn:active { transform: scale(.97); }
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 4px 0 var(--accent-strong); }
.btn-primary:active { box-shadow: 0 1px 0 var(--accent-strong); transform: translateY(3px); }
.btn-soft { background: var(--accent-soft); color: var(--accent-strong); }
.btn-ghost { background: var(--surface-2); color: var(--text); }
.btn-danger { background: transparent; color: var(--danger); }
.btn-block { width: 100%; }
.btn-sm { min-height: 40px; padding: 0 16px; font-size: var(--f-sm); }
.btn[disabled] { opacity: .5; pointer-events: none; }

.field { display: block; margin-bottom: 14px; }
.field > span { display: block; font-size: var(--f-sm); font-weight: 600; color: var(--muted); margin: 0 0 6px 4px; }
.input, .field input, .field select, .field textarea {
  width: 100%; min-height: 48px; padding: 12px 14px; border-radius: var(--r-sm); border: 1.5px solid var(--line);
  background: var(--surface); font-size: 16px; outline: none; transition: border-color .15s, box-shadow .15s; -webkit-appearance: none; appearance: none;
}
.field textarea { min-height: 84px; resize: vertical; }
.field select { background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 21px, calc(100% - 15px) 21px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 36px; }
.field input:focus, .field select:focus, .field textarea:focus, .input:focus { border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.form-error { color: var(--danger); font-size: var(--f-sm); min-height: 1.2em; margin: 4px 4px 12px; }
:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }

.seg { display: flex; background: var(--surface-2); border-radius: 999px; padding: 4px; gap: 2px; }
.seg button { flex: 1; min-height: 38px; border-radius: 999px; font-size: var(--f-sm); font-weight: 600; color: var(--muted); white-space: nowrap; padding: 0 10px; }
.seg button.on { background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow); }
.seg-sm button { min-height: 34px; padding: 0 8px; }

.switch { position: relative; width: 52px; height: 32px; flex: none; }
.switch input { position: absolute; opacity: 0; inset: 0; margin: 0; cursor: pointer; }
.switch i { position: absolute; inset: 0; border-radius: 999px; background: var(--line); transition: background .2s; pointer-events: none; }
.switch i::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 2px 4px rgba(0,0,0,.2); transition: transform .2s; }
.switch input:checked + i { background: var(--accent); }
.switch input:checked + i::after { transform: translateX(20px); }

/* ---------- Kirjautuminen ---------- */
.login { min-height: 100%; display: grid; place-items: center; padding: 24px 20px calc(24px + env(safe-area-inset-bottom)); background: radial-gradient(120% 60% at 50% 0%, var(--accent-soft), var(--bg) 70%); }
.login-card { width: 100%; max-width: 380px; text-align: center; }
.login-logo { filter: drop-shadow(0 8px 18px rgba(232, 62, 128, .35)); animation: bloomIn .7s cubic-bezier(.2,1.4,.4,1) both; }
@keyframes bloomIn { from { transform: scale(.4) rotate(-40deg); opacity: 0; } }
.login-title { font-family: var(--font-round); font-size: var(--f-hero); margin: 8px 0 0; letter-spacing: -.02em; color: var(--accent); }
.login-sub { color: var(--muted); margin: 4px 0 28px; }
.login form { text-align: left; }

/* ---------- Rakenne ---------- */
.app { height: 100%; display: flex; flex-direction: column; padding-top: env(safe-area-inset-top); }
.view { flex: 1; min-height: 0; display: flex; flex-direction: column; position: relative; }
.page-head { padding: 14px 20px 6px; }
.page-head h1 { font-family: var(--font-round); font-size: var(--f-xl); margin: 0; letter-spacing: -.01em; }
.page-scroll { flex: 1; overflow-y: auto; padding: 8px 16px calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }

.tabbar { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; justify-content: space-around; height: calc(var(--tabbar) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom);
  background: color-mix(in srgb, var(--surface) 88%, transparent); backdrop-filter: saturate(1.6) blur(18px); -webkit-backdrop-filter: saturate(1.6) blur(18px); border-top: 1px solid var(--line); }
.tabbar button { position: relative; flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; font-size: var(--f-xs); font-weight: 600; color: var(--muted); }
.tabbar button svg { width: 25px; height: 25px; }
.tabbar button.on { color: var(--accent); }
.tabbar button.on svg { stroke-width: 2.3; }
.tab-badge { position: absolute; top: 6px; left: calc(50% + 8px); min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px; background: var(--accent); color: #fff; font-style: normal; font-size: 11px; font-weight: 700; line-height: 18px; text-align: center; }

.share-banner { padding: 10px 16px; background: var(--accent-soft); color: var(--accent-strong); font-size: var(--f-sm); font-weight: 600; text-align: center; }

/* ---------- Viikkonäkymä ---------- */
.week-head { background: var(--bg); padding: 8px 0 0; position: relative; z-index: 3; box-shadow: 0 1px 0 var(--line); }
.week-title-row { display: flex; align-items: center; justify-content: space-between; padding: 0 12px 0 16px; gap: 8px; }
.week-title { display: flex; flex-direction: column; align-items: flex-start; text-align: left; min-height: 44px; }
.wk-num { font-family: var(--font-round); font-size: var(--f-xl); font-weight: 800; letter-spacing: -.02em; line-height: 1.05; }
.wk-month { font-size: var(--f-sm); color: var(--muted); font-weight: 600; text-transform: capitalize; }
.jump-date { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; left: 16px; top: 40px; }
.week-actions { display: flex; align-items: center; gap: 4px; }
.icon-btn { width: 40px; height: 40px; border-radius: 50%; display: grid; place-items: center; color: var(--accent-strong); background: var(--surface); box-shadow: var(--shadow); }
.icon-btn:active { transform: scale(.94); }
.today-btn { height: 40px; padding: 0 14px; border-radius: 999px; font-weight: 700; font-size: var(--f-sm); color: var(--accent-strong); background: var(--accent-soft); }
.streak-chip { height: 32px; padding: 0 10px; border-radius: 999px; font-weight: 800; font-size: var(--f-sm); background: #FFF0D6; color: #C25E00; margin-right: 4px; font-family: var(--font-round); }
:root[data-theme="dark"] .streak-chip { background: #3D2A12; color: #FFB65C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .streak-chip { background: #3D2A12; color: #FFB65C; } }

.days-row, .allday-row { display: grid; grid-template-columns: var(--gutter) repeat(7, 1fr); }
.days-row { padding: 10px 0 6px; }
.day-h { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0; border-radius: 12px; }
.day-h:active { background: var(--surface-2); }
.day-h .dn { font-size: var(--f-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.day-h .dd { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-round); font-size: 17px; font-weight: 700; }
.day-h.today .dn { color: var(--accent); }
.day-h.today .dd { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(232, 62, 128, .35); }
.day-h.weekend .dn { color: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.day-h .dots { height: 6px; display: flex; gap: 3px; }
.day-h .dots i { width: 6px; height: 6px; border-radius: 50%; background: var(--accent); opacity: .55; }
.day-h .dots i.done { background: var(--ok); opacity: 1; }
.allday-row { padding: 0 0 6px; }
.allday-row:empty { display: none; }
.allday-row .lbl { font-size: 10px; line-height: 1.1; color: var(--muted); text-align: right; padding: 3px 4px 0 0; font-weight: 600; }
.allday-row { row-gap: 2px; }
.allday-ev { font-size: 11px; font-weight: 700; padding: 3px 5px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
  background: var(--c); color: #fff; }

.grid-scroll { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; -webkit-overflow-scrolling: touch; padding-bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); }
.grid { position: relative; display: grid; grid-template-columns: var(--gutter) repeat(7, 1fr); height: calc(var(--hour) * 24); transition: transform .25s ease, opacity .25s; }
.grid.slide-l { transform: translateX(-24px); opacity: 0; transition: none; }
.grid.slide-r { transform: translateX(24px); opacity: 0; transition: none; }
.hours { position: relative; }
.hours span { position: absolute; right: 6px; transform: translateY(-50%); font-size: 10.5px; font-weight: 600; color: var(--muted); font-variant-numeric: tabular-nums; }
.hours span:first-child { display: none; }
.col { position: relative; border-left: 1px solid var(--line-soft); }
.col.today { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.col.weekend { background: color-mix(in srgb, var(--surface-2) 50%, transparent); }
.col.today.weekend { background: color-mix(in srgb, var(--accent-soft) 45%, transparent); }
.hour-lines { position: absolute; inset: 0 0 0 var(--gutter); pointer-events: none; background-image: linear-gradient(var(--line) 1px, transparent 1px), linear-gradient(var(--line-soft) 1px, transparent 1px); background-size: 100% var(--hour), 100% calc(var(--hour) / 2); background-position: 0 0, 0 0; opacity: 1; }
.night { position: absolute; left: var(--gutter); right: 0; background: color-mix(in srgb, var(--surface-2) 70%, transparent); pointer-events: none; }
.now-line { position: absolute; left: -4px; right: 0; height: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
.now-line::before { content: ""; position: absolute; left: -1px; top: -4px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); }
.now-line-all { position: absolute; left: var(--gutter); right: 0; height: 1px; background: color-mix(in srgb, var(--accent) 35%, transparent); pointer-events: none; z-index: 1; }

.ev { position: absolute; left: 1.5px; right: 1.5px; border-radius: 8px; padding: 3px 4px 3px 6px; overflow: hidden; text-align: left; z-index: 1;
  background: color-mix(in srgb, var(--c) 22%, var(--surface)); color: color-mix(in srgb, var(--c) 45%, var(--mix-text)); border-left: 3px solid var(--c);
  box-shadow: 0 1px 2px rgba(0,0,0,.05); transition: transform .12s; display: flex; flex-direction: column; }
.ev:active { transform: scale(.97); }
.ev.stacked { box-shadow: 0 0 0 1.5px var(--bg), -2px 2px 6px rgba(0,0,0,.12); }
.ev .t { font-size: 11.5px; font-weight: 700; line-height: 1.2; overflow: hidden; display: -webkit-box; -webkit-box-orient: vertical; word-break: break-word; hyphens: auto; }
.ev .tm { font-size: 10px; font-weight: 600; opacity: .8; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; }
.ev.past { opacity: .72; }
.ev.new { animation: evIn .35s cubic-bezier(.2,1.3,.4,1); }
@keyframes evIn { from { transform: scale(.6); opacity: 0; } }

.fab { position: absolute; right: 18px; bottom: calc(var(--tabbar) + 18px + env(safe-area-inset-bottom)); width: 60px; height: 60px; border-radius: 50%; z-index: 10;
  background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 5px 0 var(--accent-strong), 0 10px 24px rgba(232, 62, 128, .4); transition: transform .12s; }
.fab svg { width: 30px; height: 30px; stroke-width: 2.6; }
.fab:active { transform: translateY(3px); box-shadow: 0 2px 0 var(--accent-strong), 0 6px 14px rgba(232, 62, 128, .35); }

/* ---------- Paneeli (sheet) ---------- */
.sheet-backdrop { position: fixed; inset: 0; z-index: 40; background: rgba(40, 10, 25, .35); animation: fadeIn .2s; }
@keyframes fadeIn { from { opacity: 0; } }
.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 41; max-height: 92%; display: flex; flex-direction: column; background: var(--surface); border-radius: var(--r-lg) var(--r-lg) 0 0; box-shadow: var(--shadow-lg);
  animation: sheetIn .3s cubic-bezier(.2,1,.3,1); max-width: 640px; margin: 0 auto; }
.sheet.closing { animation: sheetOut .2s ease-in forwards; }
@keyframes sheetIn { from { transform: translateY(100%); } }
@keyframes sheetOut { to { transform: translateY(100%); } }
.sheet-grip { width: 40px; height: 5px; border-radius: 3px; background: var(--line); margin: 8px auto 2px; flex: none; }
.sheet-body { overflow-y: auto; padding: 8px 20px calc(20px + env(safe-area-inset-bottom)); -webkit-overflow-scrolling: touch; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 4px 0 16px; }
.sheet-head h2 { font-family: var(--font-round); font-size: var(--f-lg); margin: 0; }
.sheet-head .x { min-height: 40px; padding: 0 4px; color: var(--muted); font-weight: 600; }
.sheet-actions { display: flex; flex-direction: column; gap: 10px; margin-top: 18px; }

.cat-pick { display: flex; flex-wrap: wrap; gap: 8px; }
.cat-pick button { display: inline-flex; align-items: center; gap: 7px; min-height: 40px; padding: 0 14px 0 10px; border-radius: 999px; background: var(--surface-2); font-size: var(--f-sm); font-weight: 600; border: 2px solid transparent; }
.cat-pick button::before { content: ""; width: 14px; height: 14px; border-radius: 50%; background: var(--c); }
.cat-pick button.on { border-color: var(--c); background: color-mix(in srgb, var(--c) 15%, var(--surface)); }
.toggle-row { display: flex; align-items: center; justify-content: space-between; min-height: 48px; margin-bottom: 10px; font-weight: 600; }

.detail-top { display: flex; gap: 14px; align-items: flex-start; margin: 6px 0 14px; }
.detail-top .bar { width: 6px; align-self: stretch; border-radius: 3px; background: var(--c); flex: none; }
.detail-top h2 { font-family: var(--font-round); font-size: 24px; margin: 0 0 4px; line-height: 1.2; word-break: break-word; }
.detail-top .when { color: var(--muted); font-weight: 600; }
.detail-list { list-style: none; padding: 0; margin: 0 0 6px; background: var(--surface-2); border-radius: var(--r); }
.detail-list li { display: flex; gap: 12px; padding: 13px 16px; border-bottom: 1px solid var(--line); align-items: flex-start; }
.detail-list li:last-child { border-bottom: 0; }
.detail-list li b { width: 92px; flex: none; color: var(--muted); font-weight: 600; font-size: var(--f-sm); padding-top: 2px; }
.detail-list li span { white-space: pre-wrap; word-break: break-word; }
.choice-list { display: flex; flex-direction: column; gap: 10px; }

.day-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 18px; }
.day-item { display: flex; gap: 12px; align-items: center; padding: 12px 14px; border-radius: var(--r); background: color-mix(in srgb, var(--c) 14%, var(--surface)); text-align: left; width: 100%; }
.day-item .tm { width: 52px; flex: none; font-weight: 700; font-size: var(--f-sm); color: color-mix(in srgb, var(--c) 50%, var(--mix-text)); font-variant-numeric: tabular-nums; }
.day-item .tt { font-weight: 700; flex: 1; min-width: 0; }
.day-item .tt small { display: block; font-weight: 500; color: var(--muted); }
.empty { color: var(--muted); text-align: center; padding: 18px 8px; }
.sub-h { font-size: var(--f-sm); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 18px 4px 8px; }

/* ---------- Tehtävät ---------- */
.streak-card { position: relative; overflow: hidden; border-radius: var(--r-lg); padding: 20px 20px 18px; color: #fff; background: var(--hero); box-shadow: 0 10px 30px rgba(232, 62, 128, .3); margin-bottom: 16px; }
.streak-card::after { content: ""; position: absolute; right: -40px; top: -50px; width: 180px; height: 180px; border-radius: 50%; background: radial-gradient(circle, rgba(255,255,255,.35), transparent 70%); }
.streak-top { display: flex; align-items: center; gap: 14px; }
.streak-fire { font-size: 46px; line-height: 1; filter: drop-shadow(0 4px 8px rgba(0,0,0,.15)); }
.streak-fire.cold { filter: grayscale(1) opacity(.7); }
.streak-num { font-family: var(--font-round); font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; }
.streak-lbl { font-weight: 600; opacity: .92; font-size: var(--f-sm); }
.progress { height: 12px; border-radius: 6px; background: rgba(255,255,255,.3); margin: 16px 0 6px; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 6px; background: #fff; transition: width .5s cubic-bezier(.2,1.2,.4,1); }
.streak-msg { font-size: var(--f-sm); font-weight: 600; }
.streak-week { display: flex; justify-content: space-between; margin-top: 14px; }
.streak-week span { display: flex; flex-direction: column; align-items: center; gap: 4px; font-size: 11px; font-weight: 700; opacity: .9; }
.streak-week i { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.22); font-style: normal; font-size: 13px; }
.streak-week i.ok { background: #fff; color: var(--accent); }
.streak-week i.now { box-shadow: 0 0 0 2px #fff inset; }

.task-add { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 6px 10px 10px; margin-bottom: 6px; }
.task-add-top { display: flex; align-items: center; gap: 8px; }
.add-round { width: 44px; height: 44px; flex: none; border-radius: 50%; background: var(--accent); color: #fff; display: grid; place-items: center; box-shadow: 0 3px 0 var(--accent-strong); }
.add-round:active { transform: translateY(2px); box-shadow: 0 1px 0 var(--accent-strong); }
.add-round[disabled] { opacity: .5; }
.task-add input#taskInput { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font-size: 17px; padding: 10px 6px; min-height: 46px; }
.task-add-row { display: flex; align-items: center; gap: 8px; }
.task-add-row .seg { flex: 1; overflow-x: auto; justify-content: space-between; scrollbar-width: none; }
.task-add-row .seg::-webkit-scrollbar { display: none; }
.sr-date { position: absolute; opacity: 0; width: 1px; height: 1px; pointer-events: none; }
.task-group { margin-top: 6px; }
.task-group .sub-h.late { color: var(--danger); }
.task { display: flex; align-items: center; gap: 12px; background: var(--surface); border-radius: var(--r); padding: 10px 14px 10px 10px; margin-bottom: 8px; box-shadow: var(--shadow); min-height: 56px; transition: opacity .3s; }
.check { width: 34px; height: 34px; flex: none; border-radius: 50%; border: 2.5px solid var(--line); display: grid; place-items: center; transition: background .2s, border-color .2s, transform .15s; }
.check svg { width: 18px; height: 18px; stroke: #fff; stroke-width: 3.2; opacity: 0; transform: scale(.4); transition: all .25s cubic-bezier(.2,1.6,.4,1); }
.check:active { transform: scale(.88); }
.task.done .check { background: var(--ok); border-color: var(--ok); }
.task.done .check svg { opacity: 1; transform: none; }
.task .tt { flex: 1; min-width: 0; text-align: left; font-weight: 600; word-break: break-word; }
.task .tt small { display: block; font-weight: 500; font-size: var(--f-sm); color: var(--muted); }
.task.done .tt { color: var(--muted); text-decoration: line-through; text-decoration-thickness: 2px; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.task.pop .check { animation: pop .45s cubic-bezier(.2,1.6,.4,1); }
@keyframes pop { 40% { transform: scale(1.3); } }
.more-btn { width: 100%; min-height: 44px; color: var(--muted); font-weight: 600; font-size: var(--f-sm); }

/* ---------- Asetukset ---------- */
.card { background: var(--surface); border-radius: var(--r); box-shadow: var(--shadow); padding: 16px; margin-bottom: 14px; }
.card h3 { font-family: var(--font-round); font-size: 17px; margin: 0 0 4px; }
.card p.hint { color: var(--muted); font-size: var(--f-sm); margin: 0 0 12px; }
.card .row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 48px; }
.card .row + .row { border-top: 1px solid var(--line); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.cat-edit { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.cat-edit .dot { width: 34px; height: 34px; flex: none; border-radius: 50%; background: var(--c); border: 3px solid var(--surface); box-shadow: 0 0 0 1.5px var(--line); }
.cat-edit input { flex: 1; min-width: 0; min-height: 44px; }
.cat-edit .del { width: 40px; height: 40px; color: var(--muted); display: grid; place-items: center; flex: none; }
.swatches { display: flex; flex-wrap: wrap; gap: 10px; padding: 6px 0 12px 42px; }
.swatches button { width: 32px; height: 32px; border-radius: 50%; background: var(--c); }
.swatches button.on { box-shadow: 0 0 0 3px var(--surface), 0 0 0 5px var(--c); }
.user-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 0; border-top: 1px solid var(--line); }
.user-row:first-of-type { border-top: 0; }
.user-row b { display: block; }
.user-row small { color: var(--muted); }
.link-box { font-size: var(--f-sm); word-break: break-all; padding: 10px 12px; background: var(--surface-2); border-radius: var(--r-sm); margin-bottom: 10px; user-select: all; -webkit-user-select: all; }
.steps { margin: 0 0 12px; padding-left: 20px; color: var(--text); font-size: var(--f-sm); }
.steps li { margin-bottom: 4px; }
.version { text-align: center; color: var(--muted); font-size: var(--f-xs); margin: 8px 0; }

/* ---------- Ilmoitus ja konfetti ---------- */
.toast { position: fixed; left: 50%; bottom: calc(var(--tabbar) + 24px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 60; max-width: calc(100% - 32px);
  background: var(--text); color: var(--bg); padding: 12px 18px; border-radius: 999px; font-weight: 600; font-size: var(--f-sm); box-shadow: var(--shadow); animation: toastIn .3s cubic-bezier(.2,1.3,.4,1); text-align: center; }
@keyframes toastIn { from { transform: translate(-50%, 20px); opacity: 0; } }
.confetti { position: fixed; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 70; }

@media (min-width: 700px) {
  :root { --hour: 56px; --gutter: 52px; }
  .ev .t { font-size: 13px; } .ev .tm { font-size: 11.5px; }
  .page-scroll { max-width: 640px; margin: 0 auto; width: 100%; }
}
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; } }

/* ---------- Tiivis viikko: koko päivä ruudulla ---------- */
.grid-scroll.fit { overflow: hidden; padding-bottom: calc(var(--tabbar) + 76px + env(safe-area-inset-bottom)); }
.grid-scroll.fit .hours span { font-size: 10px; }
.grid-scroll.fit .hours span:first-child { display: block; }
.grid-scroll.fit .ev { padding-top: 2px; padding-bottom: 2px; border-radius: 6px; }
.grid-scroll.fit .ev .t { font-size: 11px; line-height: 1.15; }

/* ---------- Kuukausinäkymä ---------- */
.mo-wd, .mo-grid { display: grid; grid-template-columns: 26px repeat(7, 1fr); padding: 0 8px; }
.mo-wd { padding-top: 8px; padding-bottom: 8px; }
.mo-wd span { text-align: center; font-size: var(--f-xs); font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.mo-wd span.we { color: color-mix(in srgb, var(--accent) 60%, var(--muted)); }
.mo-wd span.wk { text-transform: none; font-weight: 600; opacity: .8; }
.month-scroll { padding: 6px 0 calc(var(--tabbar) + 28px + env(safe-area-inset-bottom)); }
.mo-grid { row-gap: 4px; transition: transform .25s ease, opacity .25s; padding-bottom: 6px; }
.mo-grid.slide-l { transform: translateX(-24px); opacity: 0; transition: none; }
.mo-grid.slide-r { transform: translateX(24px); opacity: 0; transition: none; }
.mo-wk { font-size: 10.5px; font-weight: 700; color: var(--muted); align-self: stretch; padding-top: 11px; border-radius: 8px; }
.mo-wk:active { background: var(--surface-2); color: var(--accent-strong); }
.mo-day { position: relative; display: flex; flex-direction: column; align-items: center; gap: 4px; min-height: 52px; padding: 4px 0 5px; border-radius: 14px; }
.mo-day:active { background: var(--surface-2); }
.mo-day .n { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; font-family: var(--font-round); font-size: 16px; font-weight: 700; }
.mo-day.we .n { color: color-mix(in srgb, var(--accent) 55%, var(--text)); }
.mo-day.out { opacity: .38; }
.mo-day.past:not(.today) .n { color: var(--muted); }
.mo-day.today .n { background: var(--accent); color: #fff; box-shadow: 0 3px 10px rgba(232, 62, 128, .35); }
.mo-day.sel { background: var(--surface); box-shadow: var(--shadow), 0 0 0 2px var(--accent) inset; }
.mo-dots { display: flex; gap: 3px; align-items: center; height: 8px; }
.mo-dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--c); }
.mo-dots b { font-size: 9.5px; font-weight: 800; color: var(--muted); line-height: 1; }
.mo-ok { position: absolute; top: 3px; right: 4px; width: 15px; height: 15px; border-radius: 50%; background: var(--ok); color: #fff; font-size: 9px; font-weight: 900; display: grid; place-items: center; }
.mo-agenda { padding: 10px 16px 0; border-top: 1px solid var(--line); margin-top: 6px; }
.mo-ag-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 6px 4px 12px; }
.mo-ag-head h2 { font-family: var(--font-round); font-size: var(--f-lg); margin: 0; }

/* ---------- Pisteet ja tasot ---------- */
.level-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 16px 16px 14px; margin-bottom: 16px; }
.level-top { display: flex; align-items: center; gap: 12px; }
.level-badge { width: 54px; height: 54px; flex: none; border-radius: 18px; display: grid; place-items: center; font-size: 30px; background: var(--accent-soft); box-shadow: 0 4px 0 color-mix(in srgb, var(--accent) 30%, var(--accent-soft)); }
.level-txt { flex: 1; min-width: 0; }
.level-name { font-family: var(--font-round); font-weight: 800; font-size: 17px; }
.level-sub { font-size: var(--f-sm); color: var(--muted); font-weight: 600; }
.level-pts { text-align: right; font-family: var(--font-round); font-size: 26px; font-weight: 800; color: var(--accent-strong); line-height: 1; }
.level-pts small { display: block; font-size: 11px; font-weight: 700; color: var(--muted); margin-top: 3px; }
.level-bar { height: 12px; border-radius: 6px; background: var(--surface-2); margin-top: 14px; overflow: hidden; }
.level-bar i { display: block; height: 100%; border-radius: 6px; background: var(--hero); transition: width .6s cubic-bezier(.2,1.2,.4,1); }
.badges { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; }
.badge { display: flex; flex-direction: column; align-items: center; gap: 1px; padding: 8px 0 7px; border-radius: 14px; background: var(--surface-2); color: var(--muted); }
.badge .ic { font-size: 20px; line-height: 1.2; filter: grayscale(1); opacity: .55; }
.badge b { font-size: 11px; font-weight: 800; }
.badge small { font-size: 10px; font-weight: 700; }
.badge.got { background: #FFF0D6; color: #A85200; }
.badge.got .ic { filter: none; opacity: 1; }
:root[data-theme="dark"] .badge.got { background: #3D2A12; color: #FFB65C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.got { background: #3D2A12; color: #FFB65C; } }
.level-help { font-size: 11.5px; color: var(--muted); margin: 10px 2px 0; line-height: 1.35; }
.pts-float { position: fixed; z-index: 60; transform: translate(-50%, -100%); font-family: var(--font-round); font-weight: 800; font-size: 20px; color: var(--accent); pointer-events: none;
  text-shadow: 0 2px 0 var(--surface); animation: ptsUp 1.1s cubic-bezier(.2,.9,.3,1) forwards; }
@keyframes ptsUp { 0% { opacity: 0; transform: translate(-50%, -60%) scale(.6); } 20% { opacity: 1; transform: translate(-50%, -110%) scale(1.15); } 100% { opacity: 0; transform: translate(-50%, -260%) scale(1); } }

/* ---------- Monipäiväiset ---------- */
.dt-row { display: grid; grid-template-columns: 1fr 118px; gap: 8px; }
.only-date .dt-row { grid-template-columns: 1fr; }
.allday-ev { margin: 0 1.5px; min-width: 0; }
.allday-ev small { font-weight: 600; opacity: .85; }
.allday-ev.cont-l { border-top-left-radius: 0; border-bottom-left-radius: 0; margin-left: 0; }
.allday-ev.cont-r { border-top-right-radius: 0; border-bottom-right-radius: 0; margin-right: 0; }
.dt-row input[hidden] { display: none; }

/* ---------- Juhla- ja syntymäpäivät ---------- */
.day-h.holiday .dn, .day-h.holiday:not(.today) .dd { color: #E5484D; }
.allday-sp { margin: 0 1.5px; min-width: 0; font-size: 10.5px; font-weight: 700; padding: 2px 4px; border-radius: 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-align: left;
  background: var(--surface-2); color: var(--muted); }
.allday-sp.sp-holiday { background: color-mix(in srgb, #E5484D 12%, var(--surface)); color: #C9353B; }
.allday-sp.sp-bday { background: #FFF0D6; color: #A85200; }
:root[data-theme="dark"] .allday-sp.sp-bday { background: #3D2A12; color: #FFB65C; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .allday-sp.sp-bday { background: #3D2A12; color: #FFB65C; } :root:not([data-theme="light"]) .allday-sp.sp-holiday { color: #FF8A8E; } }
:root[data-theme="dark"] .allday-sp.sp-holiday { color: #FF8A8E; }
.mo-day.hol:not(.today) .n { color: #E5484D; }
.mo-sp { position: absolute; top: 2px; left: 3px; font-size: 10px; line-height: 1; }
.sp-list { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.sp-item { display: flex; flex-direction: column; padding: 10px 14px; border-radius: var(--r); background: var(--surface-2); }
.sp-item .sp-t { font-weight: 700; }
.sp-item small { color: var(--muted); font-weight: 600; }
.sp-item.sp-holiday { background: color-mix(in srgb, #E5484D 10%, var(--surface)); }
.sp-item.sp-bday { background: #FFF0D6; }
:root[data-theme="dark"] .sp-item.sp-bday { background: #3D2A12; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .sp-item.sp-bday { background: #3D2A12; } }
.bd-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.bd-ic { font-size: 22px; }
.bd-txt { flex: 1; min-width: 0; }
.bd-txt b { display: block; }
.bd-txt small { color: var(--muted); font-weight: 600; }
.bd-row .del { width: 40px; height: 40px; display: grid; place-items: center; color: var(--muted); }
.bd-row .del svg { width: 20px; height: 20px; }

/* ---------- Putken pelastus ---------- */
.freeze { display: flex; align-items: center; gap: 12px; margin-top: 14px; padding: 12px; border-radius: var(--r); background: color-mix(in srgb, #2F95FF 10%, var(--surface)); }
.freeze-ic { display: flex; gap: 2px; font-size: 20px; }
.freeze-ic span { filter: grayscale(1); opacity: .35; }
.freeze-ic span.on { filter: none; opacity: 1; }
.freeze-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.freeze-txt small { color: var(--muted); font-size: 12px; font-weight: 600; line-height: 1.3; }
.freeze .btn { flex: none; }
.streak-week i.fz { background: rgba(255,255,255,.85); font-size: 13px; }

/* ---------- Haku ---------- */
.search-btn svg { width: 20px; height: 20px; }
.search-field input { font-size: 17px; }
.search-res .day-list { margin-bottom: 6px; }
.day-item.sp-hit { background: var(--surface-2); }
.day-item.task-hit { background: var(--surface-2); }
.day-item.task-hit.done .tt { text-decoration: line-through; opacity: .7; }

/* ---------- v1.4: viikkonäkymän luettavuus (sarakkeet ennallaan) ---------- */
/* Nimet katkeavat tavun kohdalta (pehmeät tavuviivat lisätään app.js:ssä), eivät kesken tavun. */
.ev .t { word-break: normal; overflow-wrap: anywhere; -webkit-hyphens: manual; hyphens: manual; line-height: 1.18; letter-spacing: -.01em; }
.grid-scroll.fit .ev .t { line-height: 1.15; }
/* Koko päivän palkit ja merkkipäivät: enintään kaksi riviä ennen katkaisua. */
.allday-ev, .allday-sp { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; line-height: 1.2;
  overflow-wrap: anywhere; -webkit-hyphens: manual; hyphens: manual; align-self: start; }
/* Seuraavaksi-rivi: lähin meno koko nimellä. Hiljaisempi kuin viikon otsikko. */
.next-up { display: flex; align-items: center; gap: 8px; width: calc(100% - 32px); margin: 4px 16px 6px; padding: 5px 12px; min-height: 32px;
  border-radius: 12px; background: var(--surface); border: 1px solid var(--line); text-align: left; font-size: var(--f-sm); }
.next-up[hidden] { display: none; }
.next-up:active { background: var(--surface-2); }
.next-up .nu-l { font-size: var(--f-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .05em; color: var(--accent); flex-shrink: 0; }
.next-up .nu-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex-shrink: 0; }
.next-up .nu-t { flex: 1; min-width: 0; font-weight: 700; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.next-up .nu-w { flex-shrink: 0; color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.next-up.now .nu-w { color: var(--accent-strong); }

/* ---------- v1.5: Google-kirjautuminen ja tietosuoja ---------- */
/* Googlen ohjeiden mukainen nappi: valkoinen pohja, värillinen G, selkeä teksti */
.btn-google { background: #fff; color: #1F1F1F; border: 1px solid #DADCE0; box-shadow: 0 1px 2px rgba(0,0,0,.06); font-family: var(--font); font-weight: 600; }
.btn-google:active { background: #F1F3F4; }
.btn-google span { display: inline-flex; }
.login .btn-google { min-height: 52px; font-size: var(--f-md); }
.link-btn { display: block; margin: 14px auto 0; color: var(--muted); font-size: var(--f-sm); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; min-height: 44px; padding: 0 12px; }
#googleError:empty { display: none; }
#googleError { margin-top: 10px; text-align: center; }
#loginForm { margin-top: 8px; }
.g-status { display: flex; align-items: center; gap: 8px; font-size: var(--f-sm); font-weight: 600; color: var(--text); background: var(--surface-2); border-radius: 12px; padding: 10px 12px; margin: 4px 0 0; }
.g-status span { display: inline-flex; flex-shrink: 0; }
/* Jakolinkin asetukset */
.share-opts { margin-top: 4px; }
.share-days { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.days-input { width: 84px; min-height: 44px; border-radius: 12px; border: 1px solid var(--line); background: var(--surface); color: var(--text); padding: 0 12px; font-size: var(--f-md); font-variant-numeric: tabular-nums; }
.days-input:disabled { opacity: .45; }
.share-days > span { color: var(--muted); font-weight: 600; }
.forever-check { display: inline-flex; align-items: center; gap: 8px; min-height: 44px; font-weight: 600; flex-basis: 100%; }
.forever-check input { appearance: auto; -webkit-appearance: checkbox; width: 22px; height: 22px; min-height: 0; padding: 0; margin: 0; border: 0; border-radius: 0; box-shadow: none; background: none; accent-color: var(--accent); flex-shrink: 0; }
.share-status { font-size: var(--f-sm); font-weight: 700; color: var(--ok); margin: 0 0 8px; }
.share-status.expired { color: var(--danger); }
.share-edit { margin-top: 12px; }
.share-edit summary { cursor: pointer; font-weight: 600; color: var(--accent-strong); min-height: 44px; display: flex; align-items: center; }
/* Vain katseltava jaettu kalenteri: ei lisäysnappeja */
.view-only .fab, .view-only .add-round { display: none !important; }
:root[data-theme="dark"] .btn-google { background: #131314; color: #E3E3E3; border-color: #8E918F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .btn-google { background: #131314; color: #E3E3E3; border-color: #8E918F; } }

/* ---------- v1.5: Bloomin kukka (putkikortti) ---------- */
.flower-card { display: grid; grid-template-columns: 116px 1fr; column-gap: 12px; align-items: center; color: var(--text);
  background: radial-gradient(120% 120% at 0% 0%, var(--accent-soft) 0%, var(--surface) 62%); box-shadow: var(--shadow); padding: 14px 16px 14px 8px; }
.flower-card::after { display: none; }
.flower-art { width: 116px; height: 145px; }
.flower { width: 116px; height: 145px; overflow: visible; display: block; stroke: none; }
.flower-info { min-width: 0; }
.flower-num { display: flex; align-items: baseline; gap: 6px; }
.flower-num b { font-family: var(--font-round); font-size: 40px; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--accent-strong); }
.flower-num span { font-weight: 700; color: var(--muted); font-size: var(--f-sm); }
.flower-next { font-size: var(--f-sm); font-weight: 600; margin-top: 4px; line-height: 1.3; }
.flower-card .progress { background: var(--surface-2); margin: 10px 0 6px; height: 10px; }
.flower-card .progress i { background: var(--hero); }
.flower-card .streak-msg { color: var(--muted); font-size: 13px; line-height: 1.3; }
.flower-card .streak-week { grid-column: 1 / -1; margin: 10px 4px 0 12px; }
.flower-card .streak-week span { opacity: 1; color: var(--muted); font-size: 12px; }
.flower-card .streak-week i { background: var(--surface-2); color: var(--muted); }
.flower-card .streak-week i.ok { background: var(--accent); color: #fff; }
.flower-card .streak-week i.fz { background: color-mix(in srgb, #2F95FF 15%, var(--surface)); }
.flower-card .streak-week i.now { box-shadow: 0 0 0 2px var(--accent) inset; }
.flower-card .streak-week i.ok.now { box-shadow: none; }
.flower .fl-head { transform-box: view-box; }
.flower-card.happy .fl-head { animation: flSway 3.2s ease-in-out 2; }
@keyframes flSway { 25% { transform: rotate(-5deg); } 75% { transform: rotate(5deg); } }
.flower-card.grew .fl-plant { transform-origin: 60px 110px; transform-box: view-box; animation: flGrow .9s cubic-bezier(.2,1.5,.4,1); }
@keyframes flGrow { from { transform: scale(.55); opacity: .4; } }
.flower .fl-spark { animation: flSpark 2.4s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
.flower .fl-spark:nth-of-type(2n) { animation-delay: -1.2s; }
@keyframes flSpark { 50% { transform: scale(.55); opacity: .5; } }
.flower .fl-glow { animation: fadeIn .6s; }
@media (max-width: 360px) { .flower-card { grid-template-columns: 96px 1fr; } .flower-art, .flower { width: 96px; height: 120px; } }

/* ---------- v1.5: päivävalitsin (pillerit) ---------- */
.day-chips { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 2px 2px 4px; margin: 0 -2px; -webkit-overflow-scrolling: touch; }
.day-chips::-webkit-scrollbar { display: none; }
.chip { position: relative; flex: none; display: inline-flex; align-items: center; min-height: 40px; padding: 0 14px; border-radius: 999px; background: var(--surface-2); color: var(--text);
  font-size: var(--f-sm); font-weight: 600; white-space: nowrap; border: 2px solid transparent; cursor: pointer; }
.chip.on { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--accent); }
.chip-other { overflow: hidden; }
/* oikea päivävalitsin on läpinäkyvänä napin päällä, jotta iPhone avaa sen yhdellä napautuksella */
.chip-date { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; font-size: 16px; border: 0; margin: 0; padding: 0; cursor: pointer; -webkit-appearance: none; appearance: none; }
.task-add .day-chips { margin-top: 2px; }
.task-hint { margin: 0 6px 8px; font-size: var(--f-sm); font-weight: 600; color: var(--accent-strong); }

/* ---------- v1.5: pikalisäys ---------- */
.quick-input { width: 100%; min-height: 56px; padding: 14px 16px; border-radius: var(--r); border: 2px solid var(--accent); background: var(--surface); font-size: 19px; font-weight: 600; outline: none; box-shadow: 0 0 0 4px var(--accent-soft); }
.quick-help { color: var(--muted); font-size: var(--f-sm); margin: 10px 4px 12px; line-height: 1.35; }
.quick-ex { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.quick-ex > span { font-size: var(--f-sm); font-weight: 700; color: var(--muted); margin-right: 2px; }
.quick-ex button { min-height: 36px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); font-size: var(--f-sm); font-weight: 600; color: var(--accent-strong); }
.quick-prev { border-radius: var(--r); padding: 12px 14px; background: color-mix(in srgb, var(--c) 14%, var(--surface)); border-left: 5px solid var(--c); margin-bottom: 12px; animation: fadeIn .2s; }
.qp-title { font-family: var(--font-round); font-weight: 800; font-size: 20px; margin-bottom: 6px; word-break: break-word; }
.qp-miss { color: var(--muted); font-weight: 600; font-size: 16px; }
.qp-line { display: flex; gap: 8px; font-weight: 600; font-size: 15px; line-height: 1.5; }
.qp-ic { width: 22px; flex: none; text-align: center; }
.quick-cats { margin-bottom: 4px; }

/* ---------- v1.5: pitkä painallus ja pikavalikko ---------- */
.ev, .allday-ev, .day-item { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
.pressing { transform: scale(.94) !important; transition: transform .45s ease !important; filter: brightness(.96); }
.menu-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.menu-item { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 16px; border-radius: var(--r); background: var(--surface-2); font-weight: 700; text-align: left; }
.menu-item:active { transform: scale(.98); }
.menu-item.danger { color: var(--danger); background: transparent; }
.mi-ic { width: 24px; text-align: center; font-size: 19px; }
.menu-sub { padding: 2px 4px 6px; }
.menu-sub .hint { margin: 2px 0 8px; color: var(--muted); font-size: var(--f-sm); font-weight: 600; }

/* ---------- v1.5: muistettavat tavarat ---------- */
.bring-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.bring-chips:empty { display: none; }
.bring-chip { display: inline-flex; align-items: center; gap: 2px; min-height: 36px; padding: 0 4px 0 12px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; font-size: 14px; }
.bring-chip button { width: 30px; height: 30px; border-radius: 50%; font-size: 18px; line-height: 1; color: var(--accent-strong); }
.bring-add { display: flex; gap: 8px; align-items: center; }
.bring-add input { flex: 1; min-width: 0; }
.bring-add .btn { flex: none; min-height: 48px; }
.bring-box { margin: 12px 0 4px; padding: 12px 14px 6px; border-radius: var(--r); background: #FFF6E5; }
:root[data-theme="dark"] .bring-box { background: #33240F; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .bring-box { background: #33240F; } }
.bring-head { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 6px; }
.bring-head span { font-size: var(--f-sm); font-weight: 700; color: var(--muted); }
.bring-row { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; text-align: left; font-weight: 600; }
.bring-row .check { width: 30px; height: 30px; }
.bring-row.on .check { background: var(--ok); border-color: var(--ok); }
.bring-row.on .check svg { opacity: 1; transform: none; }
.bring-row.on > span:last-child { color: var(--muted); text-decoration: line-through; }

/* ---------- v1.5: sunnuntain katsaus ---------- */
.week-peek { display: flex; align-items: center; gap: 8px; width: calc(100% - 32px); margin: 0 16px 6px; padding: 6px 12px; min-height: 36px; border-radius: 12px;
  background: linear-gradient(90deg, var(--accent-soft), color-mix(in srgb, #A65CF2 14%, var(--surface))); text-align: left; font-size: var(--f-sm); }
.week-peek span { font-weight: 800; color: var(--accent-strong); }
.week-peek small { flex: 1; color: var(--muted); font-weight: 600; font-size: var(--f-sm); }
.week-peek b { color: var(--accent-strong); font-size: 18px; }
.weekly-sum { color: var(--muted); font-weight: 600; margin: -6px 4px 4px; font-size: var(--f-sm); }
.weekly-day { color: var(--text); text-transform: none; letter-spacing: 0; font-size: 15px; margin-top: 16px; }
.weekly-day + .sp-list, .weekly-day + .day-list { margin-bottom: 6px; }
.weekly-tasks { margin: 0 4px 6px; font-size: var(--f-sm); color: var(--muted); font-weight: 600; }
/* muulla viikolla Tänään-nappi tarvitsee tilan: putkimerkki piiloon, ettei otsikko rivity */
.other-week .streak-chip { display: none; }
.streak-chip, .wk-num { white-space: nowrap; }

/* ---------- v1.6: kuukaudet peräkkäin (vieritys kuten Applen kalenterissa) ---------- */
.month-scroll { padding-top: 0; }
.mo-list { padding-bottom: 8px; }
.mo-month { padding: 6px 0 10px; }
.mo-month + .mo-month { border-top: 1px solid var(--line-soft); }
.mo-title { margin: 6px 0 2px 2px; font-family: var(--font-round); font-size: var(--f-lg); font-weight: 800; letter-spacing: -.01em; white-space: nowrap; }
.mo-month.cur .mo-title { color: var(--accent); }
.mo-day.empty { pointer-events: none; }
.mo-dots i.ok { width: 9px; height: 9px; background: var(--ok); box-shadow: 0 0 0 1.5px var(--surface); }
.mo-month .mo-grid { padding-bottom: 0; }

/* ---------- v1.6: viikkonäkymän zoomaus ---------- */
.grid-scroll { touch-action: pan-y; }
.hours span.half { font-size: 9.5px; font-weight: 500; opacity: 0; transition: opacity .2s; }
/* puolitunnit näkyvät vasta, kun tunnit ovat tarpeeksi isoja (tunnin korkeus yli 90 px) */
.grid-scroll.big .hours span.half { opacity: .65; }
.zoom-reset { position: absolute; left: 16px; bottom: calc(var(--tabbar) + 26px + env(safe-area-inset-bottom)); z-index: 10; height: 40px; padding: 0 16px;
  border-radius: 999px; background: var(--surface); color: var(--accent-strong); font-weight: 700; font-size: var(--f-sm); box-shadow: var(--shadow), 0 0 0 1px var(--line); animation: fadeIn .2s; }
.zoom-reset:active { transform: scale(.96); }
.mo-title.end { text-align: right; }
.mo-wk { display: flex; align-items: flex-start; justify-content: center; padding-top: 12px; }
/* v1.6: koko vuorokausi näkyy kerralla, joten alareunaan jätetään vain vähän tilaa */
.grid-scroll.fit { padding-bottom: calc(var(--tabbar) + 14px + env(safe-area-inset-bottom)); }
.grid-scroll.fit .hours span { font-size: 9.5px; }

/* ---------- v1.7: laskuri tärkeään päivään ---------- */
.cd-row { display: flex; gap: 6px; overflow-x: auto; scrollbar-width: none; padding: 0 16px 6px; }
.cd-row::-webkit-scrollbar { display: none; }
.cd-chip { flex: none; display: inline-flex; align-items: center; gap: 6px; min-height: 32px; max-width: 70%; padding: 0 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--line); font-size: var(--f-sm); }
.cd-chip .cd-t { font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
.cd-chip b { color: var(--accent-strong); font-weight: 800; white-space: nowrap; font-variant-numeric: tabular-nums; }
.cd-chip.now { background: var(--accent-soft); border-color: var(--accent); }
.cd-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: none; }
.cd-ic { font-size: 14px; }
.toggle-row .toggle-sub { display: block; font-size: var(--f-sm); font-weight: 500; color: var(--muted); }

/* ---------- v1.7: toistuvat tehtävät ---------- */
.wd-toggle { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.wd-toggle button { min-height: 44px; border-radius: 12px; background: var(--surface-2); font-weight: 700; font-size: 15px; border: 2px solid transparent; }
.wd-toggle button.on { background: var(--accent); color: #fff; }
.wd-quick { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.wd-quick button { min-height: 34px; padding: 0 12px; border-radius: 999px; background: var(--surface-2); font-size: var(--f-sm); font-weight: 600; color: var(--accent-strong); }
.rule-info { color: var(--muted); font-size: var(--f-sm); margin: -4px 4px 8px; }
.rule-box { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 12px; border-radius: var(--r); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; margin-bottom: 14px; }
.rule-row { display: flex; align-items: center; gap: 12px; width: 100%; text-align: left; background: var(--surface); border-radius: var(--r); padding: 10px 14px; margin-bottom: 8px; box-shadow: var(--shadow); min-height: 56px; }
.rule-row .rule-ic { font-size: 20px; }
.rule-row .tt { flex: 1; font-weight: 600; }
.rule-row .tt small { display: block; color: var(--muted); font-weight: 500; font-size: var(--f-sm); }
.rule-row b { color: var(--muted); font-size: 20px; }

/* ---------- v1.8: koko päivän palkit tuntiruudukon päällä (yön kohdalla) ---------- */
/* Palkit eivät vie tilaa viikon yläosasta: kerros on ruudukon päällä ja pysyy ylhäällä myös zoomattuna vieritettäessä. */
.allday-layer { position: sticky; top: 0; z-index: 4; display: grid; grid-template-columns: var(--gutter) repeat(7, 1fr); grid-auto-rows: 20px; row-gap: 2px; padding-top: 2px; pointer-events: none; }
.allday-layer:empty { display: none; }
.allday-layer > * { pointer-events: auto; }
.allday-layer .allday-ev, .allday-layer .allday-sp { display: block; height: 20px; line-height: 20px; padding: 0 5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  -webkit-line-clamp: unset; font-size: 11px; box-shadow: 0 1px 3px rgba(80, 20, 50, .18); }
.allday-layer .allday-sp:not(.sp-bday):not(.sp-holiday) { background: var(--surface); }
.allday-layer .allday-sp.sp-holiday { background: color-mix(in srgb, #E5484D 12%, var(--surface)); }
.allday-more { margin: 0 1.5px; height: 20px; border-radius: 6px; font-size: 11px; font-weight: 800; color: var(--accent-strong); background: var(--surface); box-shadow: 0 1px 3px rgba(80, 20, 50, .18); }
.grid-scroll.zoomed .allday-layer { padding-bottom: 4px; background: linear-gradient(var(--bg) 70%, transparent); }
.bd-sub { margin: -6px 0 6px !important; }
.bd-toggle { margin: 10px 0 4px; }

/* ---------- v1.10: avoin liittyminen, käyttäjälista, tietosuoja ---------- */
.privacy-link { display: block; text-align: center; margin-top: 6px; color: var(--muted); font-size: var(--f-sm); min-height: 44px; line-height: 44px; }
.users-count { margin: 0 0 4px; color: var(--muted); }
.users-count b { color: var(--text); font-size: var(--f-lg); font-variant-numeric: tabular-nums; }
.user-list { margin-top: 10px; border-top: 1px solid var(--line); }
.user-info { min-width: 0; }
.user-info small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.new-badge { margin-left: 6px; font-size: var(--f-xs); font-weight: 700; color: var(--accent-strong); background: var(--accent-soft); border-radius: 999px; padding: 2px 8px; vertical-align: 2px; }
.you { color: var(--muted); padding: 0 6px; }
.name-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.name-row h3 { margin: 0; }
.welcome-top { text-align: center; margin: 4px 0 6px; }
.welcome-top h2 { margin: 8px 0 0; font-family: var(--font-round); color: var(--accent); }
.sheet a, .card a { color: var(--accent-strong); font-weight: 600; }

/* ===== v1.13: juhlapäivä lippuna, joka toinen kellonaika, asetukset ryhmiksi ===== */
/* Liputuspäivä kapeassa sarakkeessa pelkkänä lippuna */
.allday-layer .allday-sp.flag-only, .allday-layer .allday-sp.flag-only:not(.sp-bday):not(.sp-holiday) {
  background: transparent; box-shadow: none; padding: 0; text-align: center; text-overflow: clip; font-size: 13px; }
/* Koko päivän näkymässä vain tuntiviivat (puolen tunnin viivat näkyvät zoomattuna) */
.grid-scroll.fit .hour-lines { background-image: linear-gradient(var(--line) 1px, transparent 1px); background-size: 100% var(--hour); }

/* Asetukset: pääsivu listana, ryhmät omille sivuilleen */
.set-back { display: inline-flex; align-items: center; gap: 2px; min-height: 44px; margin: -8px 0 -4px -8px; padding: 0 8px; color: var(--accent-strong); font-weight: 600; font-size: var(--f-md); }
.set-back svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.set-list { padding: 0; overflow: hidden; }
.set-row, .set-me { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 60px; padding: 10px 14px 10px 16px; text-align: left; color: var(--text); }
.set-row + .set-row { border-top: 1px solid var(--line); }
.set-row:active, .set-me:active { background: var(--surface-2); }
.set-ico { flex-shrink: 0; display: grid; place-items: center; width: 36px; height: 36px; border-radius: 10px; font-size: 19px; line-height: 1;
  background: color-mix(in srgb, var(--c) 18%, var(--surface)); }
.set-txt { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.set-txt b { font-family: var(--font-round); font-size: var(--f-md); font-weight: 700; }
.set-txt small { font-size: var(--f-sm); color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.set-chev { flex-shrink: 0; color: var(--muted); opacity: .7; }
.set-chev svg { display: block; width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.set-me { min-height: 76px; padding: 14px 14px 14px 16px; }
.set-avatar { flex-shrink: 0; display: grid; place-items: center; width: 48px; height: 48px; border-radius: 50%; background: var(--hero); color: var(--on-accent);
  font-family: var(--font-round); font-size: var(--f-lg); font-weight: 800; }
.set-me .set-txt b { font-size: 17px; }
.set-label { margin: 18px 4px 6px; font-size: var(--f-xs); font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); }
.set-sub { animation: setIn .22s ease-out; }
@keyframes setIn { from { opacity: 0; transform: translateX(14px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .set-sub { animation: none; } }

/* ===== v1.14: profiilikuva ===== */
.set-avatar.has-img, .av-big.has-img { background: var(--surface-2); overflow: hidden; }
.set-avatar img, .av-big img { width: 100%; height: 100%; object-fit: cover; display: block; border-radius: 50%; }
.set-profile { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 6px 0 18px; }
.av-pick { position: relative; display: inline-block; cursor: pointer; -webkit-tap-highlight-color: transparent; }
.av-pick:active .av-wrap, .av-pick:active .btn { transform: scale(.97); }
.av-file { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.av-wrap { position: relative; display: block; transition: transform .12s; }
.av-big { display: grid; place-items: center; width: 96px; height: 96px; border-radius: 50%; background: var(--hero); color: var(--on-accent);
  font-family: var(--font-round); font-size: 40px; font-weight: 800; box-shadow: var(--shadow); }
.av-cam { position: absolute; right: -2px; bottom: -2px; display: grid; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--surface); color: var(--accent-strong); box-shadow: var(--shadow); }
.av-cam svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linejoin: round; }
.av-name { margin-top: 12px; font-family: var(--font-round); font-size: var(--f-lg); }
.av-sub { color: var(--muted); font-size: var(--f-sm); }
.av-actions { display: flex; gap: 8px; margin-top: 12px; }
.crop-hint { text-align: center; margin: 0 0 14px !important; color: var(--muted); }
.crop-stage { position: relative; margin: 0 auto; overflow: hidden; border-radius: var(--r); background: #000; touch-action: none; user-select: none; -webkit-user-select: none; cursor: grab; }
.crop-img { position: absolute; left: 0; top: 0; max-width: none; transform-origin: 0 0; pointer-events: none; -webkit-user-drag: none; }
.crop-ring { position: absolute; inset: 0; border-radius: 50%; box-shadow: 0 0 0 9999px rgba(0, 0, 0, .55); outline: 2px solid rgba(255, 255, 255, .85); outline-offset: -2px; pointer-events: none; }
.crop-zoom-row { display: flex; align-items: center; gap: 12px; max-width: 300px; margin: 14px auto 16px; color: var(--muted); font-weight: 700; font-size: var(--f-lg); }
.crop-zoom { flex: 1; accent-color: var(--accent); min-height: 44px; }
