:root { --bg: #f5f6f8; --fg: #14181f; --muted: #5b6573; --card: #ffffff; --line: #6b7685; --accent: #1f5fbf; --accent-fg: #ffffff; --err: #b3261e; --ok: #1b7a3a; }
@media (prefers-color-scheme: dark) { :root { --bg: #11151b; --fg: #eef1f5; --muted: #a3adbb; --card: #1a2029; --line: #7c8797; --accent: #6ea8ff; --accent-fg: #0b1220; --err: #ff8a80; --ok: #6fd28d; } }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--fg); font: 16px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
main { max-width: 480px; margin: 0 auto; padding: 24px 16px 40px; display: flex; flex-direction: column; gap: 12px; }
h1 { font-size: 24px; margin: 8px 0; }
.field { display: flex; flex-direction: column; gap: 4px; }
label { font-weight: 600; }
input, select { font: inherit; min-height: 48px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); width: 100%; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 20px) 50%, calc(100% - 14px) 50%; background-size: 6px 6px; background-repeat: no-repeat; padding-right: 36px; }
input[aria-invalid="true"], select[aria-invalid="true"] { border-color: var(--err); }
input:focus-visible, select:focus-visible, button:focus-visible { outline: 3px solid var(--accent); outline-offset: 2px; }
.err { color: var(--err); font-size: 14px; min-height: 0; }
.hint { color: var(--muted); font-size: 14px; }
.msg { min-height: 0; color: var(--muted); }
.btn { min-height: 48px; padding: 10px 16px; border-radius: 10px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; font-weight: 600; }
.btn.primary { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.btn:disabled { opacity: .5; }
.link { background: none; border: 0; color: var(--accent); font: inherit; min-height: 48px; padding: 8px 4px; text-decoration: underline; text-align: left; }
.links { display: flex; justify-content: space-between; flex-wrap: wrap; }
.check { display: flex; align-items: center; gap: 8px; min-height: 48px; font-weight: 400; }
.check input { width: 24px; min-height: 24px; height: 24px; }
.rules { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.rules li { display: flex; gap: 8px; color: var(--muted); }
.rules li.ok { color: var(--ok); }
.rules li.bad { color: var(--err); }
.mark { width: 1.2em; display: inline-block; }
.suggest { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { min-height: 48px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 24px; background: var(--card); color: var(--fg); font: 15px ui-monospace, Menlo, Consolas, monospace; }
.footer { color: var(--muted); font-size: 13px; margin-top: 16px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
input::placeholder { color: var(--muted); opacity: 1; }
.chip, .btn { border-color: var(--line); }

/* ---- main screen (T10) ---- */
:root { --draft: #dbe8ff; --conf: #b3261e; --lock: #5b6676; }
@media (prefers-color-scheme: dark) { :root { --draft: #243b63; --conf: #ff8a80; --lock: #aab4c2; } }
main.home { max-width: 560px; padding: 12px 12px 24px; gap: 10px; }
.hdr { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; }
.hdr .me { font-weight: 700; font-size: 18px; }
.hdr .day-title { grid-column: 1 / 2; color: var(--muted); }
.hdr .iconbtn { grid-row: 1 / 3; grid-column: 2; min-width: 48px; min-height: 48px; font-size: 22px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); }
.chips { display: flex; gap: 8px; flex-wrap: wrap; }
.chip2 { min-height: 48px; padding: 8px 16px; border-radius: 24px; border: 1px solid var(--line); background: var(--card); color: var(--fg); font: inherit; }
.chip2.sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); }
.daystrip { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; scroll-snap-type: x proximity; }
.day { flex: 0 0 auto; min-width: 52px; min-height: 56px; display: flex; flex-direction: column; align-items: center; justify-content: center; border: 1px solid var(--line); border-radius: 12px; background: var(--card); color: var(--fg); font: inherit; scroll-snap-align: center; }
.day .wd { font-size: 12px; color: var(--muted); } .day .dn { font-weight: 700; font-size: 18px; }
.day.sel { background: var(--accent); color: var(--accent-fg); border-color: var(--accent); } .day.sel .wd { color: var(--accent-fg); }
.day.closed:not(.sel) { color: var(--lock); border-style: dashed; }
.day.today { box-shadow: inset 0 -3px 0 var(--accent); }
.day.has-draft::after { content: ''; width: 6px; height: 6px; border-radius: 3px; background: var(--accent); margin-top: 2px; }
.grid { display: grid; grid-template-columns: minmax(80px, 1fr) minmax(0, 1.2fr) minmax(0, 1.2fr); gap: 6px; touch-action: pan-y; user-select: none; -webkit-user-select: none; }
.gh { font-weight: 700; color: var(--muted); font-size: 14px; padding: 2px 4px; }
.gl { display: flex; align-items: center; padding: 4px; font-weight: 600; overflow-wrap: anywhere; }
.cell { min-height: 56px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; text-align: left; overflow-wrap: anywhere; }
.cell.none { color: var(--muted); }
.cell.draft { background: var(--draft); border-color: var(--accent); }
.cell.conflict { text-decoration: underline wavy var(--conf); text-underline-offset: 4px; border-color: var(--conf); }
.cell.locked { color: var(--lock); border-style: dashed; }
.cell.swapsrc { outline: 3px solid var(--accent); }
.cell.empty { border: 0; background: none; }
.bar { position: sticky; bottom: 0; display: flex; align-items: center; gap: 8px; justify-content: space-between; padding: 8px 0; background: var(--bg); }
.cnt { color: var(--muted); font-size: 14px; }
.toast { min-height: 20px; color: var(--muted); font-size: 14px; }
.sheet { position: fixed; inset: 0; background: rgba(0, 0, 0, .45); display: flex; align-items: flex-end; justify-content: center; z-index: 10; }
.sheet-body { width: 100%; max-width: 560px; max-height: calc(85vh / var(--z, 1)); overflow: auto; background: var(--bg); border-radius: 16px 16px 0 0; padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.sheet-title { font-weight: 700; font-size: 18px; }
.search { min-height: 48px; }
.ppl { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.pitem { width: 100%; min-height: 48px; display: flex; justify-content: space-between; gap: 8px; align-items: center; padding: 8px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; text-align: left; }
.pitem.absent { color: var(--lock); border-style: dashed; }
.pc { color: var(--muted); font-size: 14px; }
.sumrow { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: var(--card); }
.radios { display: flex; gap: 12px; flex-wrap: wrap; }
.cell.rejected { border: 2px dashed var(--conf); }
.closebar { padding: 8px 12px; border-radius: 10px; background: var(--card); border: 1px solid var(--line); font-size: 14px; }
.closebar.warn { border-color: var(--err); color: var(--err); font-weight: 600; }
.conflict-hint { color: var(--err); font-weight: 600; }
/* view settings (T12a): explicit themes override the system one; font size scales everything; at the largest size Main and Reserve stand one under another */
html[data-theme="light"] { --draft: #dbe8ff; --conf: #b3261e; --lock: #5b6676; --bg: #f5f6f8; --fg: #14181f; --muted: #5b6573; --card: #ffffff; --line: #6b7685; --accent: #1f5fbf; --accent-fg: #ffffff; --err: #b3261e; --ok: #1b7a3a; color-scheme: light; }
html[data-theme="dark"] { --draft: #243b63; --conf: #ff8a80; --lock: #aab4c2; --bg: #11151b; --fg: #eef1f5; --muted: #a3adbb; --card: #1a2029; --line: #7c8797; --accent: #6ea8ff; --accent-fg: #0b1220; --err: #ff8a80; --ok: #6fd28d; color-scheme: dark; }
html[data-theme="gray"] { --draft: #b9c8e6; --conf: #9c1c14; --lock: #3d4651; --bg: #cfd3d9; --fg: #101419; --muted: #3d4651; --card: #e6e8ec; --line: #4d5663; --accent: #174a99; --accent-fg: #ffffff; --err: #9c1c14; --ok: #14612d; color-scheme: light; }
html[data-theme="contrast"] { --draft: #00007a; --conf: #ff9c94; --lock: #ffffff; --bg: #000000; --fg: #ffffff; --muted: #ffffff; --card: #000000; --line: #ffffff; --accent: #ffe600; --accent-fg: #000000; --err: #ff9c94; --ok: #8dff9f; color-scheme: dark; }
html[data-font="large"] { --z: 1.15; } html[data-font="xl"] { --z: 1.3; } html[data-font="max"] { --z: 1.5; } html[data-font="large"] body, html[data-font="xl"] body, html[data-font="max"] body { zoom: var(--z); }   /* the sheet height is divided by the zoom, so its top stays on screen */
html[data-font="max"] .grid { grid-template-columns: minmax(0, 1fr); } html[data-font="max"] .grid .gh { display: none; } html[data-font="max"] .grid .gl { font-weight: 700; margin-top: 6px; }
html[data-bold="true"] body { font-weight: 700; }
html[data-big="true"] .btn, html[data-big="true"] .pitem, html[data-big="true"] .cal-day, html[data-big="true"] .iconbtn, html[data-big="true"] .aa, html[data-big="true"] .check, html[data-big="true"] .chip, html[data-big="true"] .chip2, html[data-big="true"] .cell, html[data-big="true"] .link, html[data-big="true"] input, html[data-big="true"] select { min-height: 56px; }
html[data-calm="true"] *, html[data-calm="true"] *::before { transition: none !important; animation: none !important; scroll-behavior: auto !important; }
.aa { position: absolute; top: 8px; right: 8px; min-width: 48px; min-height: 48px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); font: inherit; font-weight: 700; z-index: 5; }
.cal-month { margin: 8px 0; } .cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; } .cal-day { min-height: 48px; padding: 0; border: 1px solid var(--line); border-radius: 8px; background: var(--card); color: var(--fg); font: inherit; } .cal-day.sel { background: var(--accent); color: var(--accent-fg); } .cal-day.closed { opacity: .75; } .cal-day:disabled { opacity: .35; } .cal-wd { text-align: center; font-size: 13px; color: var(--muted); }

main { position: relative; }
textarea { font: inherit; min-height: 120px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--fg); width: 100%; resize: vertical; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* waiting for the server (T14b) */
.wait-dim { position: fixed; inset: 0; background: rgba(0, 0, 0, .5); display: flex; align-items: center; justify-content: center; z-index: 30; }
.wait-dlg { width: min(86vw, 360px); background: var(--card); color: var(--fg); border: 1px solid var(--line); border-radius: 14px; padding: 16px; display: flex; flex-direction: column; gap: 8px; }
.wait-track { height: 10px; border-radius: 99px; background: var(--bg); border: 1px solid var(--line); overflow: hidden; }
.wait-fill { height: 100%; width: 0; background: var(--accent); transition: width .1s linear; }
.wait-text { color: var(--muted); font-size: 14px; }
@media (prefers-reduced-motion: reduce) { .wait-fill { transition: none; } }
