/* Týdenní plán – vzhled */
:root {
  --paper: #eef1f5;
  --surface: #ffffff;
  --ink: #16202d;
  --ink-2: #566275;
  --ink-3: #8a94a4;
  --line: #d6dce5;
  --line-soft: #e7ebf0;
  --accent: #2446d4;
  --accent-ink: #1a34a3;
  --accent-soft: #edf1ff;
  --red: #c8262f;
  --purple: #7a3db0;
  --green: #16874a;
  --blue: #1f6bc2;
  --orange: #c3621a;
  --leave: #e9f6ee;
  --leave-ink: #16874a;
  --off: #f1eefb;
  --off-ink: #6a45b3;
  --sick: #fdeeee;
  --sick-ink: #c8262f;
  --remote: #eaf3fc;
  --remote-ink: #1f6bc2;
  --radius: 10px;
  --font: "Onest", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font: 15px/1.45 var(--font);
  color: var(--ink);
  background: var(--paper);
  font-feature-settings: "tnum" 1;
}
a { color: var(--accent); }
h1, h2, h3 { margin: 0; line-height: 1.15; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--ink-2); }
.small { font-size: 13px; }

/* ---------------------------------------------------------------- horní lišta */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: 28px;
  padding: 10px max(20px, env(safe-area-inset-left));
  background: var(--ink); color: #fff;
}
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font-weight: 700; letter-spacing: -.01em; }
.brand svg { color: var(--accent); }
.mainnav { display: flex; gap: 4px; flex: 1; }
.mainnav a { color: #c9d1dd; text-decoration: none; padding: 6px 12px; border-radius: 8px; font-weight: 500; }
.mainnav a:hover { color: #fff; background: rgba(255,255,255,.08); }
.mainnav a.active { color: #fff; background: rgba(255,255,255,.14); }
.account { display: flex; align-items: center; gap: 10px; font-size: 14px; color: #fff; }
.account small { color: #9fb0ff; font-weight: 600; margin-left: 2px; }
.account form { margin: 0; }
.avatar { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--accent); font-size: 12px; font-weight: 700; }
.btn-link { background: none; border: 0; color: #c9d1dd; font: inherit; cursor: pointer; padding: 4px 6px; }
.btn-link:hover { color: #fff; text-decoration: underline; }

.flash { max-width: 1240px; margin: 16px auto 0; padding: 10px 16px; border-radius: var(--radius); background: #e8f6ee; color: #125f35; border: 1px solid #bfe3cd; }
.flash-error { background: #fdeeee; color: #9b1c24; border-color: #f2c3c6; }

.main { max-width: 1240px; margin: 0 auto; padding: 28px 20px 80px; }

/* ---------------------------------------------------------------- tlačítka a formuláře */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 36px; padding: 0 14px;
  font: 500 14px/1 var(--font); color: var(--ink);
  background: var(--surface); border: 1px solid var(--line); border-radius: 8px;
  text-decoration: none; cursor: pointer; white-space: nowrap;
}
.btn:hover { border-color: var(--ink-3); }
.btn[aria-disabled="true"] { opacity: .4; pointer-events: none; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn-danger { color: var(--red); }
.btn-icon { width: 36px; padding: 0; font-size: 20px; }
.btn-wide { width: 100%; min-height: 44px; font-size: 15px; }
.btn-mini { margin-left: 8px; font: 500 11px var(--font); color: var(--ink-2); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 2px 6px; cursor: pointer; opacity: 0; }
tr:hover .btn-mini, .btn-mini:focus { opacity: 1; }

.field { display: grid; gap: 6px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field input, .field select, input[type=text], input[type=email], input[type=search] {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: #fff; color: var(--ink); min-width: 0;
}
.field input:focus, input[type=search]:focus { outline: 2px solid var(--accent); outline-offset: -1px; border-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; font-size: 14px; }
.stack { display: grid; gap: 14px; }
.form-error { color: var(--red); font-weight: 500; }

/* ---------------------------------------------------------------- přihlášení */
.guest { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.auth-card { width: min(420px, 100%); background: var(--surface); border-radius: 16px; padding: 36px 32px; box-shadow: 0 1px 0 var(--line), 0 12px 40px -18px rgba(22,32,45,.35); }
.is-app .auth-card { margin: 40px auto; }
.auth-card h1 { font-size: 26px; font-weight: 800; letter-spacing: -.02em; margin-bottom: 8px; }
.auth-card p { margin: 0 0 20px; }
.auth-mark { color: var(--accent); margin-bottom: 18px; }
.auth-mark.ok { color: var(--green); }

/* ---------------------------------------------------------------- hlavička plánu */
.plan-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 20px; flex-wrap: wrap; margin-bottom: 18px; }
.plan-title { display: flex; align-items: center; gap: 18px; }
.plan-title h1 { font-size: 30px; font-weight: 800; letter-spacing: -.025em; }
.range { margin: 2px 0 0; font-size: 17px; color: var(--green); font-weight: 600; }
.weekno {
  display: grid; justify-items: center; align-content: center;
  width: 64px; height: 64px; border-radius: 14px; background: var(--ink); color: #fff;
}
.weekno span { font-size: 28px; font-weight: 800; line-height: 1; letter-spacing: -.03em; }
.weekno small { font-size: 11px; color: #b6c1d1; margin-top: 2px; }
.plan-status { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.phase { display: inline-flex; align-items: center; gap: 8px; padding: 6px 12px; border-radius: 999px; font-weight: 600; font-size: 14px; background: var(--surface); border: 1px solid var(--line); }
.phase i { width: 8px; height: 8px; border-radius: 50%; background: var(--ink-3); }
.phase-open i { background: var(--green); box-shadow: 0 0 0 4px #d8f0e2; }
.phase-closed i { background: var(--orange); }
.phase-current i { background: var(--accent); }

.toolbar {
  position: sticky; top: 50px; z-index: 10;
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  padding: 10px 0; margin-bottom: 14px;
  background: linear-gradient(var(--paper) 80%, rgba(238,241,245,0));
}
.weeknav { display: flex; gap: 6px; }
.seg { display: inline-flex; background: #dfe4eb; border-radius: 9px; padding: 3px; }
.seg button { font: 500 14px var(--font); color: var(--ink-2); background: none; border: 0; padding: 6px 12px; border-radius: 7px; cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(22,32,45,.15); }
.toolbar-actions { display: flex; gap: 6px; margin-left: auto; flex-wrap: wrap; }
.savestate { font-size: 13px; color: var(--ink-3); min-width: 120px; }
.savestate[data-state="busy"], .savestate[data-state="dirty"] { color: var(--orange); }
.savestate[data-state="ok"] { color: var(--green); }
.savestate[data-state="error"] { color: var(--red); font-weight: 600; }

.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); min-width: 250px; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 6px; box-shadow: 0 12px 32px -12px rgba(22,32,45,.3); z-index: 30; }
.menu-pop form { margin: 0; }
.menu-pop button { width: 100%; text-align: left; font: 500 14px var(--font); padding: 9px 10px; border: 0; background: none; border-radius: 6px; cursor: pointer; color: var(--ink); }
.menu-pop button:hover { background: var(--paper); }

/* ---------------------------------------------------------------- plán po dnech */
.plan { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.days { display: grid; }
.day { display: grid; grid-template-columns: 108px 1fr; border-bottom: 1px solid var(--line); }
.rail {
  position: relative;
  display: flex; flex-direction: column; align-items: flex-start;
  padding: 14px 14px 16px 18px;
  border-right: 1px solid var(--line);
  background: #f7f9fb;
}
.rail-day { font-weight: 700; font-size: 15px; }
.rail-num { font-size: 56px; font-weight: 800; line-height: .95; letter-spacing: -.05em; margin-top: 6px; color: var(--ink); }
.rail-month { font-size: 13px; color: var(--ink-2); }
.rail-hol { margin-top: 10px; font-size: 11.5px; line-height: 1.25; color: var(--red); font-weight: 600; }
.rail-today { margin-top: 10px; font-size: 11px; font-weight: 700; color: #fff; background: var(--accent); padding: 2px 7px; border-radius: 999px; }
.day.is-today .rail { background: var(--accent-soft); }
.day.is-today .rail-num { color: var(--accent); }
.rail.is-holiday .rail-num { color: var(--red); }

.rows { display: grid; }
.row { display: grid; grid-template-columns: 180px 1fr; min-height: 38px; border-bottom: 1px solid var(--line-soft); }
.row:last-child { border-bottom: 0; }
.who { padding: 9px 12px; font-size: 13.5px; color: var(--ink-2); border-right: 1px solid var(--line-soft); display: flex; align-items: flex-start; gap: 6px; }
.row .who, .matrix th .who-n { font-weight: 500; }
.who em, .matrix th em { font-style: normal; font-size: 10.5px; font-weight: 700; color: var(--accent); background: var(--accent-soft); padding: 1px 6px; border-radius: 999px; margin-top: 1px; }
.row.is-mine { background: #fafbff; }
.row.is-mine .who { color: var(--ink); font-weight: 600; }

/* ---------------------------------------------------------------- buňka */
.cell { position: relative; display: flex; flex-direction: column; min-width: 0; padding-right: 64px; }
.cell-input, .cell-text, .remark-input, .note-input, .service-input {
  display: block; width: 100%; margin: 0; resize: none; overflow: hidden;
  font: 400 14.5px/1.4 var(--font); color: var(--ink);
  background: transparent; border: 0; border-radius: 0;
  padding: 9px 12px;
  white-space: pre-wrap; word-break: break-word;
}
.cell-input { min-height: 38px; }
.cell-input::placeholder { color: #b4bcc8; }
.cell-input:hover { background: #f8f9fc; }
.cell-input:focus, .remark-input:focus, .note-input:focus, .service-input:focus { outline: none; background: #fff; box-shadow: inset 0 0 0 2px var(--accent); }
.row.is-mine .cell-input:not(:focus) { background: transparent; }

.cell[data-status="leave"] { background: var(--leave); }
.cell[data-status="leave"] .cell-input, .cell[data-status="leave"] .cell-text { color: var(--leave-ink); font-weight: 600; }
.cell[data-status="off"] { background: var(--off); }
.cell[data-status="off"] .cell-input, .cell[data-status="off"] .cell-text { color: var(--off-ink); font-weight: 600; }
.cell[data-status="sick"] { background: var(--sick); }
.cell[data-status="sick"] .cell-input, .cell[data-status="sick"] .cell-text { color: var(--sick-ink); font-weight: 600; }
.cell[data-status="remote"] { background: var(--remote); }
.cell[data-status="remote"] .cell-input, .cell[data-status="remote"] .cell-text { color: var(--remote-ink); font-weight: 600; }

.remark { display: none; color: var(--red); font-size: 13.5px; }
.cell.show-remark .remark, .cell.has-remark .remark { display: block; }
.remark:not(:empty) { padding: 0 12px 8px; }
.remark:has(.remark-input) { padding: 0; }
.remark-input { color: var(--red); font-size: 13.5px; padding-top: 0; font-style: italic; }
.remark-input::placeholder { color: #e2a0a4; }
.cell > .remark:not(:has(textarea)) { font-style: italic; }
.remark-add {
  position: absolute; right: 40px; top: 8px; width: 22px; height: 22px; border-radius: 6px;
  border: 1px dashed #e2a0a4; color: var(--red); background: #fff; font: 600 14px/1 var(--font); cursor: pointer;
  opacity: 0; transition: opacity .12s;
}
.cell:hover .remark-add, .remark-add:focus { opacity: 1; }
.cell.show-remark .remark-add { display: none; }

.cell-meta { position: absolute; right: 8px; top: 8px; display: flex; align-items: center; gap: 4px; }
.hist-btn {
  display: inline-flex; align-items: center; gap: 3px; height: 22px; padding: 0 5px;
  font: 600 11px var(--font); color: var(--ink-3); background: none; border: 1px solid transparent; border-radius: 6px; cursor: pointer;
}
.hist-btn:hover { color: var(--accent); border-color: var(--line); background: #fff; }
.hist-btn.is-multi { color: var(--orange); }
.tag { display: inline-block; font: 600 10.5px/1 var(--font); padding: 4px 6px; border-radius: 5px; background: var(--line-soft); color: var(--ink-2); white-space: nowrap; }
.tag-late { background: #fff1e4; color: var(--orange); }
.tag-by { background: #fdeeee; color: var(--red); }
.tag-remark { background: #fdeeee; color: var(--red); }
.cell-meta .tag-late { font-size: 0; width: 8px; height: 8px; padding: 0; border-radius: 50%; background: var(--orange); }

@keyframes pulse { from { background-color: #fff6c9; } to { background-color: transparent; } }
.flash-update { animation: pulse 1.6s ease-out; }

/* ---------------------------------------------------------------- přehled týdne */
.matrix-wrap { overflow-x: auto; border-bottom: 1px solid var(--line); }
.matrix { width: 100%; min-width: 980px; border-collapse: collapse; table-layout: fixed; }
.matrix th, .matrix td { border-bottom: 1px solid var(--line-soft); border-right: 1px solid var(--line-soft); vertical-align: top; padding: 0; text-align: left; }
.matrix thead th { background: #f7f9fb; padding: 10px 12px; border-bottom: 1px solid var(--line); }
.matrix thead th.is-today { background: var(--accent-soft); }
.matrix thead th.is-holiday .mx-date { color: var(--red); }
.mx-corner { width: 190px; }
.mx-day { display: block; font-weight: 700; font-size: 14px; }
.mx-date { font-size: 13px; color: var(--ink-2); }
.mx-hol { display: block; color: var(--red); font-size: 11px; font-weight: 600; margin-top: 2px; }
.matrix tbody th { padding: 9px 12px; font-size: 13.5px; color: var(--ink-2); font-weight: 500; }
.matrix tbody tr.is-mine th { color: var(--ink); font-weight: 600; }
.matrix tbody tr.is-mine { background: #fafbff; }
.matrix td.is-today { background: #fbfcff; }
.matrix .cell { padding-right: 0; }
.matrix .cell-meta { top: auto; bottom: 4px; right: 4px; }
.matrix .remark-add { right: 4px; top: 4px; }
.matrix .cell-input, .matrix .cell-text { padding-bottom: 22px; }

/* ---------------------------------------------------------------- Ostatní */
.others { display: grid; grid-template-columns: 108px 1fr; }
.others-rail { padding: 14px 14px 16px 18px; border-right: 1px solid var(--line); background: #f7f9fb; font-weight: 700; }
.others-body { padding: 8px 0 0; min-width: 0; }
.notes { list-style: none; margin: 0; padding: 0; counter-reset: n; }
.note { position: relative; display: flex; align-items: flex-start; border-bottom: 1px solid var(--line-soft); }
.note::before { counter-increment: n; content: counter(n); flex: none; width: 34px; padding: 10px 0 0 14px; font-size: 12px; color: var(--ink-3); }
.notes-empty { padding: 10px 14px; color: var(--ink-3); }
.note-text { padding: 9px 12px; white-space: pre-wrap; flex: 1; }
.note-input { flex: 1; }
.note[data-color="red"] :is(.note-text, .note-input) { color: var(--red); }
.note[data-color="purple"] :is(.note-text, .note-input) { color: var(--purple); }
.note[data-color="green"] :is(.note-text, .note-input) { color: var(--green); }
.note[data-color="blue"] :is(.note-text, .note-input) { color: var(--blue); }
.note[data-color="orange"] :is(.note-text, .note-input) { color: var(--orange); }
.note.is-bold :is(.note-text, .note-input) { font-weight: 700; }
.note > .hist-btn { margin: 8px 8px 0 0; }
.note-tools { display: flex; align-items: center; gap: 2px; padding: 7px 8px 0 0; opacity: 0; transition: opacity .12s; }
.note:hover .note-tools, .note:focus-within .note-tools { opacity: 1; }
.swatches { display: flex; gap: 3px; margin-right: 6px; }
.sw { width: 16px; height: 16px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line); cursor: pointer; padding: 0; }
.sw[aria-checked="true"] { box-shadow: 0 0 0 2px var(--ink); }
.sw[data-c="default"] { background: var(--ink); }
.sw[data-c="red"] { background: var(--red); }
.sw[data-c="purple"] { background: var(--purple); }
.sw[data-c="green"] { background: var(--green); }
.sw[data-c="blue"] { background: var(--blue); }
.sw[data-c="orange"] { background: var(--orange); }
.tool { width: 24px; height: 24px; border: 1px solid transparent; background: none; border-radius: 6px; font: 600 13px var(--font); color: var(--ink-2); cursor: pointer; }
.tool:hover { border-color: var(--line); background: #fff; color: var(--ink); }
.tool-b[aria-pressed="true"] { background: var(--ink); color: #fff; }
.tool-del:hover { color: var(--red); }
.btn-add { margin: 10px 14px; border-style: dashed; color: var(--ink-2); }

.service {
  display: flex; align-items: flex-start; gap: 10px;
  margin: 8px 0 0; padding: 4px 8px 4px 14px;
  background: #eaf6ef; border-top: 1px solid #cde8d8;
  color: var(--green); font-weight: 600;
}
.service-label { padding: 9px 0; font-size: 12.5px; text-transform: none; letter-spacing: .01em; color: #0f6a38; }
.service-input, .service-text { color: var(--green); font-weight: 600; flex: 1; }
.service-text { padding: 9px 0; }
.service .hist-btn { margin-top: 7px; }

/* ---------------------------------------------------------------- dialogy */
.dialog { width: min(640px, calc(100% - 32px)); border: 0; border-radius: 14px; padding: 0; box-shadow: 0 24px 60px -20px rgba(22,32,45,.45); color: var(--ink); }
.dialog::backdrop { background: rgba(22,32,45,.45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px; border-bottom: 1px solid var(--line-soft); margin: 0; }
.dialog-head h2 { font-size: 18px; }
.dialog-body { padding: 16px 18px; max-height: 65vh; overflow: auto; }
.dialog-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 18px 16px; }
.conflict-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.conflict-grid h3 { font-size: 13px; color: var(--ink-2); margin-bottom: 6px; }
.conflict-grid pre { margin: 0; white-space: pre-wrap; font: 14px/1.4 var(--font); background: var(--paper); padding: 10px; border-radius: 8px; min-height: 60px; }

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { position: relative; padding: 0 0 16px 20px; border-left: 2px solid var(--line-soft); margin-left: 6px; }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--accent); }
.timeline li:last-child { border-left-color: transparent; }
.tl-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 13.5px; }
.tl-head time { color: var(--ink-2); }
.tl-diff { margin-top: 4px; font-size: 14.5px; white-space: pre-wrap; word-break: break-word; }
del { background: #fde4e5; color: #9b1c24; text-decoration: line-through; text-decoration-color: rgba(155,28,36,.5); border-radius: 3px; }
ins { background: #dcf3e4; color: #0f6a38; text-decoration: none; border-radius: 3px; }

/* ---------------------------------------------------------------- stránky: archiv, historie, správa */
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { font-size: 28px; font-weight: 800; letter-spacing: -.02em; }
.page-head p { margin: 4px 0 0; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; overflow: hidden; margin-bottom: 20px; }
.panel-pad { padding: 18px 20px; }
.panel h2 { font-size: 17px; margin-bottom: 12px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--ink-2); font-size: 12.5px; padding: 10px 14px; background: #f7f9fb; border-bottom: 1px solid var(--line); }
.table td { padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
.table .actions { text-align: right; white-space: nowrap; }
.table .actions form { display: inline; margin: 0; }
.table tr.is-off td { color: var(--ink-3); }
.table-wrap { overflow-x: auto; }
.year-row td { background: var(--paper); font-weight: 800; font-size: 18px; letter-spacing: -.02em; padding-top: 18px; }
.wk { display: inline-grid; place-items: center; min-width: 34px; height: 26px; padding: 0 6px; border-radius: 7px; background: var(--ink); color: #fff; font-weight: 700; font-size: 13px; }
.wk.is-live { background: var(--accent); }
.pill { display: inline-block; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--line-soft); color: var(--ink-2); }
.pill-open { background: #e3f4ea; color: var(--green); }
.pill-current { background: var(--accent-soft); color: var(--accent); }
.pill-closed { background: #fff1e4; color: var(--orange); }
.pill-off { background: #fdeeee; color: var(--red); }
.searchbar { display: flex; gap: 8px; }
.searchbar input { width: min(360px, 60vw); }
mark { background: #fff0a8; border-radius: 2px; padding: 0 1px; }
.icon-btn { text-decoration: none;  font: 600 13px var(--font); background: none; border: 1px solid var(--line); border-radius: 6px; padding: 4px 8px; cursor: pointer; color: var(--ink-2); }
.icon-btn:hover { color: var(--ink); border-color: var(--ink-3); }
.icon-btn.danger:hover { color: var(--red); border-color: var(--red); }
.form-grid { display: grid; grid-template-columns: 1fr 1fr 1.4fr 110px; gap: 12px; align-items: end; }
.form-row { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; margin-top: 14px; }
.dropzone { display: grid; place-items: center; gap: 8px; padding: 32px; border: 2px dashed var(--line); border-radius: 12px; text-align: center; background: #fafbfc; }
.dropzone.is-over { border-color: var(--accent); background: var(--accent-soft); }
.hist-filter { display: flex; gap: 10px; flex-wrap: wrap; align-items: end; }
.hist-filter select { font: inherit; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.empty { padding: 48px 20px; text-align: center; color: var(--ink-2); }

/* ---------------------------------------------------------------- mobil */
@media (max-width: 760px) {
  .topbar { gap: 12px; flex-wrap: wrap; }
  .mainnav { order: 3; flex: 1 1 100%; overflow-x: auto; }
  .account { margin-left: auto; }
  .account-name { display: none; }
  .main { padding: 18px 12px 60px; }
  .plan-title h1 { font-size: 24px; }
  .plan-status { align-items: flex-start; }
  .toolbar { top: 92px; }
  .toolbar-actions { margin-left: 0; }
  .day, .others { grid-template-columns: 1fr; }
  .rail, .others-rail { flex-direction: row; align-items: baseline; gap: 8px; padding: 10px 14px; border-right: 0; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
  .rail-num { font-size: 22px; margin: 0; }
  .rail-hol, .rail-today { margin: 0; }
  .row { grid-template-columns: 1fr; }
  .who { border-right: 0; padding-bottom: 0; }
  .form-grid { grid-template-columns: 1fr; }
  .note-tools { opacity: 1; flex-wrap: wrap; }
  .note { flex-wrap: wrap; }
  .conflict-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .flash-update { animation: none; }
  * { transition: none !important; }
}

/* ---------------------------------------------------------------- tisk */
@media print {
  @page { size: A4 portrait; margin: 10mm; }
  body { background: #fff; font-size: 11px; }
  .topbar, .toolbar, .flash, .cell-meta, .remark-add, .note-tools, .btn-add, .btn-mini, .hist-btn, dialog { display: none !important; }
  .main { padding: 0; max-width: none; }
  .plan { border: 1px solid #999; border-radius: 0; }
  .day, .others { break-inside: avoid; }
  .rail-num { font-size: 30px; }
  .cell-input, .cell-text, .note-input, .note-text, .service-input { padding: 3px 8px; font-size: 11px; min-height: 0; }
  .row { min-height: 0; }
  .cell { padding-right: 0; }
  .who { padding: 3px 8px; font-size: 10.5px; }
  .weekno { background: #fff; color: #000; border: 2px solid #000; }
}
