/* Tickly styles. Mobile first. Colour tokens are checked for WCAG AA by tests/contrast.test.js */
:root {
  --indigo: #272862; --teal: #459E92; --slate: #35607A; --mint: #88DDB6; --coral: #FF7A6B; --amber: #F5B642;
  --bg: #F6F7FC; --surface: #FFFFFF; --text: #1B1C45; --muted: #4A4F73; --border: #C9CDE6; --link: #35607A;
  --btn-bg: #272862; --btn-text: #FFFFFF; --focus: #272862; --on-coral: #1A1B45; --on-amber: #1A1B45; --on-mint: #12132B;
  --chip-ok-bg: #D5F3E5; --chip-ok-text: #0F3B2A; --field-bg: #FFFFFF; --danger: #A12A1E;
  --radius: 16px; --shadow: 0 1px 2px rgba(39,40,98,.08), 0 6px 18px rgba(39,40,98,.06);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #12132B; --surface: #1C1D40; --text: #EEF0FA; --muted: #B4B9DA; --border: #3A3C70; --link: #88DDB6;
    --btn-bg: #88DDB6; --btn-text: #12132B; --focus: #88DDB6; --chip-ok-bg: #1F4A3C; --chip-ok-text: #D5F3E5; --field-bg: #12132B; --danger: #FF9A8E;
    --shadow: none;
  }
}
:root[data-theme="dark"] {
  --bg: #12132B; --surface: #1C1D40; --text: #EEF0FA; --muted: #B4B9DA; --border: #3A3C70; --link: #88DDB6;
  --btn-bg: #88DDB6; --btn-text: #12132B; --focus: #88DDB6; --chip-ok-bg: #1F4A3C; --chip-ok-text: #D5F3E5; --field-bg: #12132B; --danger: #FF9A8E;
  --shadow: none;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 400 1rem/1.55 Inter, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; min-height: 100vh; }
h1, h2, h3 { line-height: 1.2; margin: 0 0 .5rem; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; } h2 { font-size: 1.2rem; } h3 { font-size: 1.05rem; }
p { margin: 0 0 .75rem; }
a { color: var(--link); text-underline-offset: 3px; }
.muted { color: var(--muted); }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--btn-bg); color: var(--btn-text); padding: .75rem 1rem; border-radius: 10px; z-index: 100; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.topbar { position: sticky; top: 0; z-index: 20; height: 60px; display: flex; align-items: center; gap: .75rem; padding: 0 1rem; background: var(--surface); border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: .6rem; text-decoration: none; color: var(--text); min-height: 44px; }
.brand img { width: 36px; height: 36px; display: block; }
.brand b { font-size: 1.2rem; letter-spacing: -.02em; }
.tagline { font-size: .85rem; display: none; }
.wrap { max-width: 760px; margin: 0 auto; padding: 1rem 1rem 7.5rem; }
main { min-height: 70vh; }
main:focus { outline: none; }

.tabs { position: fixed; bottom: 0; left: 0; right: 0; z-index: 20; display: grid; grid-template-columns: repeat(5, 1fr); background: var(--surface); border-top: 1px solid var(--border); padding-bottom: env(safe-area-inset-bottom); }
.tabs a { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 56px; min-width: 44px; font-size: .78rem; text-decoration: none; color: var(--muted); gap: 2px; }
.tabs a[aria-current="page"] { color: var(--text); font-weight: 700; }
.tabs a[aria-current="page"] .ti { background: var(--btn-bg); color: var(--btn-text); }
.ti { width: 44px; height: 28px; display: grid; place-items: center; border-radius: 14px; font-size: 1.1rem; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: var(--shadow); margin-bottom: 1rem; }
.card h2 { display: flex; justify-content: space-between; align-items: center; }
.list { list-style: none; margin: 0; padding: 0; }
.row { display: flex; align-items: center; justify-content: space-between; gap: .75rem; min-height: 56px; padding: .6rem .25rem; text-decoration: none; color: var(--text); border-bottom: 1px solid var(--border); }
.list li:last-child .row { border-bottom: 0; }
.row-main { display: flex; flex-direction: column; min-width: 0; }
.row-main .muted { font-size: .88rem; }
.row-main strong { overflow-wrap: anywhere; }
.row:hover { background: color-mix(in srgb, var(--border) 30%, transparent); }

.chip { display: inline-flex; align-items: center; gap: .25rem; padding: .2rem .65rem; border-radius: 999px; font-size: .8rem; font-weight: 700; white-space: nowrap; flex: none; }
.chip-overdue, .chip-urgent { background: var(--coral); color: var(--on-coral); }
.chip-overdue { box-shadow: inset 0 0 0 2px var(--on-coral); }
.chip-soon { background: var(--amber); color: var(--on-amber); }
.chip-ok { background: var(--chip-ok-bg); color: var(--chip-ok-text); }
.chip-done, .chip-unknown { background: var(--border); color: var(--text); }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: .5rem; min-height: 48px; min-width: 44px; padding: .6rem 1.2rem; border-radius: 14px; border: 2px solid var(--btn-bg); background: var(--btn-bg); color: var(--btn-text); font: 700 1rem Inter, system-ui, sans-serif; text-decoration: none; cursor: pointer; }
.btn.secondary { background: transparent; color: var(--text); border-color: var(--border); }
.btn.danger { background: transparent; color: var(--danger); border-color: var(--danger); }
.btn.big { width: 100%; min-height: 64px; font-size: 1.15rem; border-radius: 18px; }
.btn[disabled] { opacity: .55; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; margin: .75rem 0; }

.hero { background: linear-gradient(135deg, #272862, #35607A 50%, #459E92); color: #fff; border-radius: 20px; padding: 1.25rem; margin-bottom: 1rem; }
.hero h1 { margin-bottom: .15rem; } .hero p { margin: 0 0 1rem; color: #F1F3FA; }
.hero .btn { background: #fff; color: #272862; border-color: #fff; }
.tiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: .75rem; margin-bottom: 1rem; }
.tile { display: flex; flex-direction: column; justify-content: center; gap: .15rem; min-height: 92px; padding: .9rem; border-radius: var(--radius); background: var(--surface); border: 1px solid var(--border); text-decoration: none; color: var(--text); box-shadow: var(--shadow); }
.tile .ic { font-size: 1.6rem; } .tile small { color: var(--muted); }

.field { margin-bottom: 1rem; }
label, legend { display: block; font-weight: 600; margin-bottom: .3rem; }
input, select, textarea { width: 100%; min-height: 48px; padding: .6rem .8rem; border: 2px solid var(--border); border-radius: 12px; background: var(--field-bg); color: var(--text); font: inherit; }
textarea { min-height: 140px; resize: vertical; }
input[type="checkbox"], input[type="radio"] { width: 24px; height: 24px; min-height: 24px; accent-color: var(--btn-bg); flex: none; }
.check { display: flex; align-items: flex-start; gap: .75rem; min-height: 44px; padding: .4rem 0; font-weight: 400; }
.check label { margin: 0; font-weight: 400; }
.hint { font-size: .88rem; margin: .3rem 0 0; }
fieldset { border: 2px solid var(--border); border-radius: 12px; padding: .75rem 1rem; margin: 0 0 1rem; }
.flag { display: inline-block; margin-left: .4rem; padding: 0 .5rem; border-radius: 8px; font-size: .75rem; font-weight: 700; background: var(--amber); color: var(--on-amber); }
.notice { border-left: 6px solid var(--teal); background: var(--surface); border-radius: 12px; padding: .8rem 1rem; margin-bottom: 1rem; border-top: 1px solid var(--border); border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.notice.warn { border-left-color: var(--amber); } .notice.bad { border-left-color: var(--coral); }
.msg { padding: .75rem 1rem; border-radius: 12px; margin: .75rem 0; border: 2px solid var(--border); background: var(--surface); }
.msg.ok { border-color: var(--teal); } .msg.err { border-color: var(--danger); }

.state { text-align: center; padding: 2rem 1rem; }
.state-art { font-size: 2.5rem; margin-bottom: .5rem; }
.spinner { display: inline-block; width: 24px; height: 24px; border: 3px solid var(--border); border-top-color: var(--teal); border-radius: 50%; animation: spin .9s linear infinite; vertical-align: middle; margin-right: .5rem; }
.skeleton { height: 64px; border-radius: 14px; margin-top: 1rem; background: linear-gradient(90deg, var(--border), var(--surface), var(--border)); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }
.skeleton.short { width: 70%; margin-inline: auto; }
@keyframes spin { to { transform: rotate(360deg); } } @keyframes shimmer { to { background-position: -200% 0; } }

.toast-area { position: fixed; left: 0; right: 0; bottom: 72px; display: flex; justify-content: center; z-index: 40; pointer-events: none; padding: 0 1rem; }
.toast { background: var(--btn-bg); color: var(--btn-text); padding: .8rem 1.1rem; border-radius: 14px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.25); }
.ad { display: none; }
.ad[data-on="1"] { display: block; height: 130px; margin: 1rem 0; border: 1px dashed var(--border); border-radius: var(--radius); padding: .4rem .75rem; overflow: hidden; }
.ad small { color: var(--muted); font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; }
.consent { position: fixed; left: .75rem; right: .75rem; bottom: 76px; z-index: 50; max-width: 640px; margin: 0 auto; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius); padding: 1rem; box-shadow: 0 8px 28px rgba(0,0,0,.3); }
.foot { border-top: 1px solid var(--border); margin-top: 2rem; padding-top: 1rem; font-size: .9rem; }
.foot nav { display: flex; flex-wrap: wrap; gap: .25rem 1rem; }
.foot a { display: inline-flex; align-items: center; min-height: 44px; }
.photo { max-width: 100%; max-height: 360px; border-radius: 14px; border: 1px solid var(--border); display: block; margin-bottom: 1rem; }
dl.kv { display: grid; grid-template-columns: max-content 1fr; gap: .4rem 1rem; margin: 0 0 1rem; }
dl.kv dt { color: var(--muted); } dl.kv dd { margin: 0; overflow-wrap: anywhere; }
.seg { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.seg label { display: inline-flex; align-items: center; min-height: 44px; padding: 0 1rem; border: 2px solid var(--border); border-radius: 999px; font-weight: 600; margin: 0; cursor: pointer; }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg input:checked + span, .seg label:has(input:checked) { background: var(--btn-bg); color: var(--btn-text); border-color: var(--btn-bg); }
.seg label:has(input:focus-visible) { outline: 3px solid var(--focus); outline-offset: 2px; }
.prose h2 { margin-top: 1.5rem; } .prose ul { padding-left: 1.2rem; }
.tmpl { display: grid; gap: .6rem; }
.tmpl .btn { justify-content: flex-start; text-align: left; flex-direction: column; align-items: flex-start; gap: 0; }
.tmpl .btn small { font-weight: 400; opacity: .9; }

@media (min-width: 768px) {
  .tagline { display: inline; }
  .wrap { padding-bottom: 4rem; padding-top: 1.5rem; }
  .tiles { grid-template-columns: repeat(4, 1fr); }
  .tabs { position: sticky; top: 60px; bottom: auto; max-width: 760px; margin: 0 auto; border: 0; background: transparent; grid-template-columns: repeat(5, 1fr); }
  .tabs a { flex-direction: row; min-height: 48px; gap: .4rem; font-size: .95rem; }
  .toast-area { bottom: 24px; } .consent { bottom: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print { .tabs, .topbar, .toast-area, .consent { display: none; } }

/* ---- v2 ---- */
.photo.blurred { filter: blur(16px); }
.photo-box { margin: .5rem 0 1rem; } .photo-wrap { overflow: hidden; border-radius: 12px; max-width: 400px; } .photo-wrap img { display: block; width: 100%; height: auto; }
.notice.privacy { border-left: 4px solid var(--teal); }
progress { width: 100%; height: 14px; accent-color: var(--btn-bg); }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: .6rem; }
.bar-head { display: flex; justify-content: space-between; gap: .5rem; flex-wrap: wrap; }
.bar { height: 12px; background: var(--border); border-radius: 8px; overflow: hidden; } .bar span { display: block; height: 100%; background: var(--teal); border-radius: 8px; }
.btn.small { min-height: 44px; padding: .4rem .9rem; font-size: .95rem; }
.rec-item { padding: .6rem 0; border-bottom: 1px solid var(--border); } .rec-item:last-child { border-bottom: 0; }
.card.neutral { background: var(--surface); } a.plain-link { text-decoration: none; }
li.emi-soon { background: color-mix(in srgb, var(--amber) 28%, transparent); border-left: 4px solid var(--amber); border-radius: 8px; }
.emi-tag { font-weight: 700; font-size: .85rem; color: var(--text); }
.tmpl .btn small { display: block; font-weight: 400; opacity: .85; }
