/* Kabala Ktana. Brand: navy #1E2A4A, blue #2F5BD3, red #E53935, yellow #FFC629. WCAG 2.1 AA, RTL.
   White on yellow fails contrast: yellow always carries navy text. */
:root {
  --navy: #1E2A4A; --blue: #2F5BD3; --red: #E53935; --yellow: #FFC629;
  --page: #F3F6FD; --card: #FFFFFF; --soft: #EEF3FF; --line: #D9E0EE; --muted: #4D5873; --ok: #0E7C66;
  --r: 16px; --font: Rubik, "Segoe UI", Arial, Helvetica, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--page); color: var(--navy); font: 16px/1.5 var(--font); }
main { max-width: 560px; margin: 0 auto; padding: max(16px, env(safe-area-inset-top)) 16px calc(96px + env(safe-area-inset-bottom)); outline: none; }
h1 { font-size: 24px; margin: 8px 0 4px; line-height: 1.3; }
h2 { font-size: 18px; margin: 22px 0 8px; }
p { margin: 6px 0; }
a { color: var(--blue); }
.muted { color: var(--muted); }
.small { font-size: 14px; }
.sr, .skip:not(:focus) { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip:focus { position: fixed; top: 8px; right: 8px; background: var(--card); padding: 8px 12px; z-index: 10; border-radius: 8px; }

:focus-visible { outline: 3px solid var(--blue); outline-offset: 2px; }
button, .btn { font: inherit; min-height: 44px; min-width: 44px; border-radius: 12px; border: 2px solid transparent; cursor: pointer; padding: 10px 16px; }
.btn-primary { background: var(--blue); color: #fff; font-weight: 600; }
.btn-ghost { background: transparent; color: var(--blue); border-color: var(--line); }
.btn-danger { background: transparent; color: #B3261E; border-color: #F2B8B5; }
.btn-block { width: 100%; display: block; }
button:disabled { opacity: .55; cursor: default; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row > * { flex: 1; }
.top { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.top h1 { flex: 1; }
.icon-btn { background: var(--card); border: 1px solid var(--line); color: var(--navy); padding: 8px; }

.card { background: var(--card); border-radius: var(--r); padding: 16px; margin: 10px 0; box-shadow: 0 1px 2px rgba(30,42,74,.06); }
.brand { text-align: center; padding: 24px 0 8px; }
.brand img { width: 88px; height: 88px; border-radius: 22px; }

label { display: block; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea { font: inherit; color: var(--navy); width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 12px; border: 1.5px solid #8C97B3; background: #fff; }
input[type=checkbox], input[type=radio] { flex: 0 0 auto; width: 24px; height: 24px; min-height: 0; vertical-align: middle; margin-inline-end: 8px; }
.check { display: flex; align-items: flex-start; gap: 6px; font-weight: 400; }
.unsure { background: #FFF6D6; border-color: #B88600; }
.unsure-note { font-size: 14px; color: #6B4E00; margin-top: 4px; }
.err { color: #B3261E; font-size: 15px; margin-top: 6px; }

.capture { position: fixed; inset-inline: 0; bottom: 0; padding: 12px 16px calc(12px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, var(--page) 30%); display: flex; justify-content: center; }
.capture button { max-width: 528px; width: 100%; font-size: 18px; min-height: 56px; box-shadow: 0 4px 14px rgba(47,91,211,.35); }

.list { list-style: none; padding: 0; margin: 0; }
.item { display: flex; gap: 12px; align-items: center; width: 100%; text-align: start; background: var(--card); border: 0; border-radius: var(--r); padding: 12px 14px; margin: 8px 0; color: var(--navy); }
.item .main { flex: 1; min-width: 0; }
.item .t, .item .s { display: block; }
.item .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item .s { font-size: 14px; color: var(--muted); }
.pill { display: inline-block; border-radius: 999px; padding: 2px 10px; font-size: 14px; font-weight: 600; white-space: nowrap; }
.pill-soon { background: var(--yellow); color: var(--navy); }
.pill-urgent { background: var(--red); color: #fff; }
.pill-ok { background: var(--soft); color: var(--navy); }
.pill-off { background: #E6E9F0; color: var(--muted); }
.lock::before { content: "🔒 "; }

.thumb { width: 100%; max-height: 320px; object-fit: contain; background: #E6E9F0; border-radius: 12px; }
.thumbs { display: flex; gap: 8px; overflow-x: auto; }
.thumbs img { height: 120px; border-radius: 10px; }
.pair { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 0 12px; }
.pair input, .dates input { min-width: 0; }
input[type=date] { -webkit-appearance: none; appearance: none; display: block; min-width: 0; max-width: 100%; text-align: start; }
[hidden] { display: none !important; }
.dates { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px 12px; }
.dates label { margin-top: 8px; font-size: 15px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.search { margin: 12px 0 4px; }
.empty { text-align: center; padding: 28px 8px; color: var(--muted); }
.banner { background: var(--yellow); color: var(--navy); border-radius: 12px; padding: 12px 14px; margin: 10px 0; }

#toast { position: fixed; bottom: calc(84px + env(safe-area-inset-bottom)); inset-inline: 16px; margin: 0 auto; max-width: 480px; background: var(--navy); color: #fff; border-radius: 12px; padding: 12px 16px; text-align: center; opacity: 0; pointer-events: none; transition: opacity .2s; }
#toast.show { opacity: 1; }
.spinner { width: 28px; height: 28px; border: 3px solid var(--soft); border-top-color: var(--blue); border-radius: 50%; animation: spin 1s linear infinite; margin: 18px auto; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { animation: none !important; transition: none !important; } }
footer { margin-top: 28px; font-size: 14px; text-align: center; color: var(--muted); }
footer a { display: inline-block; padding: 10px 6px; }
