/* Layout: fixed navy sidebar of clients, light workspace; editor = step panel left, paper preview right. */
:root {
  --navy: #172033;
  --navy-2: #222d44;
  --ink: #1d2433;
  --ink-2: #4b5468;
  --muted: #7a8296;
  --line: #e2e5ec;
  --line-2: #d3d8e2;
  --bg: #f4f5f8;
  --panel: #ffffff;
  --accent: #2f6f62;
  --accent-ink: #ffffff;
  --accent-soft: #e3f0ec;
  --red: #c00000;
  --warn-bg: #fff6e0;
  --warn-ink: #7a5600;
  --danger: #b42318;
  --display: 'Outfit', 'Century Gothic', 'Avenir Next', system-ui, sans-serif;
  --body: 'Figtree', 'Avenir Next', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font: 14px/1.45 var(--body); color: var(--ink); background: var(--bg); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.err { color: var(--danger); }
.sel { user-select: all; }

#app { display: grid; grid-template-columns: 248px minmax(0, 1fr); height: 100%; }
#print-root { display: none; }

/* ---------- sidebar ---------- */
.side { background: var(--navy); color: #d8deea; display: flex; flex-direction: column; padding: 18px 12px 12px; overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; color: #fff; text-decoration: none; font: 600 15px/1.15 var(--display); padding: 0 8px 18px; }
.brand-mark { width: 34px; height: 34px; border-radius: 9px; background: #fff; color: var(--navy); display: grid; place-items: center; font: 700 13px var(--display); letter-spacing: .02em; }
.side-nav { display: grid; gap: 2px; }
.side-nav a { color: #c9d1e1; text-decoration: none; padding: 7px 10px; border-radius: 6px; }
.side-nav a:hover { background: var(--navy-2); color: #fff; }
.side-nav a.on { background: #2c3a57; color: #fff; }
.side-sec { display: flex; align-items: center; justify-content: space-between; margin: 20px 4px 6px 10px; font-size: 11.5px; text-transform: uppercase; letter-spacing: .08em; color: #8f9ab2; }
.side-search { width: 100%; background: var(--navy-2); border: 1px solid #33405e; border-radius: 6px; padding: 6px 9px; color: #fff; margin-bottom: 6px; }
.client-list { display: grid; gap: 1px; }
.client-link { display: flex; align-items: center; gap: 9px; padding: 6px 8px; border-radius: 6px; color: #dfe4ee; text-decoration: none; min-width: 0; }
.client-link:hover { background: var(--navy-2); }
.client-link.on { background: #2c3a57; color: #fff; }
.cl-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cl-count { font-size: 11.5px; color: #8f9ab2; font-variant-numeric: tabular-nums; }
.side-empty { color: #8f9ab2; font-size: 13px; padding: 4px 10px; margin: 0; }
.side-foot { margin-top: auto; padding-top: 18px; display: grid; gap: 10px; }
.icon-btn { width: 26px; height: 26px; border-radius: 6px; border: 1px solid transparent; background: transparent; cursor: pointer; font-size: 17px; line-height: 1; color: inherit; display: grid; place-items: center; }
.side .icon-btn { background: var(--navy-2); color: #fff; }
.icon-btn:hover { background: rgba(127,127,127,.18); }

.thumb { width: 28px; height: 28px; border-radius: 6px; background: #fff; display: grid; place-items: center; overflow: hidden; flex: none; }
.thumb img { max-width: 88%; max-height: 88%; object-fit: contain; }
.thumb-ini { background: #dfe6f2; color: var(--navy); font: 600 11px var(--display); }

.sync { display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: var(--navy-2); color: #c9d1e1; border-radius: 6px; padding: 7px 10px; font-size: 12.5px; cursor: pointer; text-align: left; }
.sync i { width: 8px; height: 8px; border-radius: 50%; background: #8f9ab2; flex: none; }
.sync-ok i { background: #4cc38a; }
.sync-wait i { background: #f0b429; }
.sync-err i { background: #f97066; }
.sync-err { color: #ffd2cc; }

/* ---------- pages ---------- */
.main { overflow-y: auto; min-width: 0; }
.page { padding: 28px 32px 60px; max-width: 1120px; }
.page-narrow { max-width: 760px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; flex-wrap: wrap; margin-bottom: 18px; }
h1 { font: 600 26px/1.15 var(--display); margin: 0; letter-spacing: -.01em; text-wrap: balance; }
h2 { font: 600 18px/1.2 var(--display); margin: 0 0 8px; }
h3 { font: 600 15px/1.25 var(--display); margin: 0; }
.sub { color: var(--muted); margin: 4px 0 0; }
.actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

.btn { display: inline-flex; align-items: center; gap: 6px; height: 34px; padding: 0 13px; border-radius: 7px; border: 1px solid var(--line-2); background: #fff; color: var(--ink); cursor: pointer; text-decoration: none; font-weight: 500; white-space: nowrap; }
.btn:hover { background: #f7f8fb; border-color: #c4cad6; }
.btn:focus-visible, .step:focus-visible, .icon-btn:focus-visible, .ev:focus-visible, .swatch:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .45; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover { background: #275e53; border-color: #275e53; }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(0,0,0,.05); border-color: transparent; }
.btn-danger { color: var(--danger); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }

.pill { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f4; color: var(--ink-2); white-space: nowrap; }
.pill-active { background: var(--accent-soft); color: var(--accent); }
.pill-delivered { background: #e8eefb; color: #2d4f9e; }
.pill-archived { background: #eef0f4; color: var(--muted); }

.plist { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.prow { display: grid; grid-template-columns: 32px minmax(0, 1.3fr) minmax(0, 1.6fr) 140px 90px; align-items: center; gap: 14px; padding: 12px 16px; color: inherit; text-decoration: none; border-top: 1px solid var(--line); }
.prow:first-child { border-top: 0; }
.prow:hover { background: #fafbfc; }
.prow .thumb { width: 32px; height: 32px; border: 1px solid var(--line); }
.prow-main { display: grid; min-width: 0; }
.prow-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-client { color: var(--muted); font-size: 13px; }
.prow-next { font-size: 13px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow-dates { font-size: 13px; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.prow .pill { justify-self: end; }
.more { margin-top: 18px; }
.more summary { cursor: pointer; color: var(--ink-2); font-weight: 500; margin-bottom: 10px; }
.group-h { margin: 24px 0 8px; font-size: 14px; display: flex; gap: 8px; }

.empty { background: var(--panel); border: 1px dashed var(--line-2); border-radius: var(--radius); padding: 28px; text-align: center; color: var(--ink-2); }
.empty h2 { margin-bottom: 6px; }
.welcome { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 18px; }
.welcome ol { margin: 8px 0 12px; padding-left: 20px; display: grid; gap: 10px; }
.welcome li .btn { margin-left: 8px; }

.client-head { display: flex; align-items: center; gap: 18px; margin-bottom: 18px; flex-wrap: wrap; }
.client-logo { width: 84px; height: 64px; border-radius: 10px; background: #fff; border: 1px solid var(--line); display: grid; place-items: center; overflow: hidden; flex: none; }
.client-logo img { max-width: 86%; max-height: 80%; object-fit: contain; }
.client-logo.thumb-ini { font-size: 22px; }
.client-meta { flex: 1; min-width: 220px; }
.links { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 13.5px; }
.ext { text-decoration: none; font-weight: 500; }
.ext:hover { text-decoration: underline; }
.contact { color: var(--ink-2); }
.client-notes { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 16px; color: var(--ink-2); max-width: 70ch; }

.tlist { display: grid; gap: 10px; }
.tcard { display: flex; justify-content: space-between; align-items: center; gap: 16px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.tcard p { margin: 4px 0 0; }

.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; margin-bottom: 16px; }
.card > p { margin: 0 0 14px; }
.meter { display: grid; gap: 6px; margin-top: 16px; }
.meter-bar { height: 6px; background: #eceef3; border-radius: 99px; overflow: hidden; }
.meter-bar i { display: block; height: 100%; background: var(--accent); }
.code { display: block; background: #f6f7f9; border: 1px solid var(--line); border-radius: 6px; padding: 10px 12px; font: 12.5px/1.5 ui-monospace, SFMono-Regular, Menlo, monospace; word-break: break-all; }

/* ---------- forms ---------- */
.form { display: grid; gap: 13px; }
.f { display: grid; gap: 5px; min-width: 0; }
.f > span:first-child { font-size: 12.5px; font-weight: 600; color: var(--ink-2); }
.f-h { font: 600 12px var(--body); text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--line); }
.f-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; align-items: end; }
input:not([type=checkbox]):not([type=radio]):not([type=file]), select, textarea {
  width: 100%; border: 1px solid var(--line-2); border-radius: 6px; background: #fff; padding: 7px 9px; min-height: 34px;
}
textarea { resize: vertical; line-height: 1.45; }
input:focus, select:focus, textarea:focus { outline: 2px solid color-mix(in srgb, var(--accent) 40%, transparent); outline-offset: 0; border-color: var(--accent); }
.check { display: flex; gap: 8px; align-items: flex-start; font-size: 13.5px; cursor: pointer; }
.check input { margin-top: 3px; accent-color: var(--accent); }
.inline { display: flex; align-items: center; gap: 8px; }
.inline input { width: 80px !important; }

.logo-field { display: grid; grid-template-columns: 120px minmax(0, 1fr); gap: 12px; align-items: start; }
.logo-prev { height: 76px; border: 1px dashed var(--line-2); border-radius: 8px; display: grid; place-items: center; background: #fff; overflow: hidden; }
.logo-prev img { max-width: 88%; max-height: 80%; object-fit: contain; }
.logo-ctl { display: grid; gap: 7px; min-width: 0; }

/* ---------- editor ---------- */
.editor { display: flex; flex-direction: column; height: 100%; }
.ed-top { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 20px; background: var(--panel); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.crumbs { display: flex; align-items: center; gap: 8px; min-width: 0; font-size: 15px; }
.crumbs a { text-decoration: none; color: var(--ink-2); }
.crumbs a:hover { color: var(--accent); }
.crumbs > span { color: var(--line-2); }
.crumbs b { font: 600 16px var(--display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.status-sel { width: auto !important; min-height: 26px !important; height: 26px; padding: 0 24px 0 10px !important; border-radius: 99px !important; border: 0 !important; font-size: 12px; font-weight: 600; }
.ed-top .ext { font-size: 13.5px; margin-right: 6px; }
.ed-body { flex: 1; display: grid; grid-template-columns: 390px minmax(0, 1fr); min-height: 0; }
.panel { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.tabs { display: flex; gap: 4px; padding: 10px 16px 0; border-bottom: 1px solid var(--line); }
.tabs button { border: 0; background: none; padding: 8px 10px 10px; cursor: pointer; color: var(--muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--accent); }
.panel-body { overflow-y: auto; padding: 16px; flex: 1; }
.sec { margin-bottom: 22px; }
.sec-h { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; margin-bottom: 10px; }
.sec-h .muted { font-size: 12px; }

.key { display: grid; grid-template-columns: minmax(0, 1fr) 138px auto; gap: 8px; align-items: center; padding: 8px 0; border-top: 1px solid var(--line); }
.key-l { display: grid; min-width: 0; }
.key-name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.key-l .muted { font-size: 12px; }
.key input[type=date] { padding: 5px 6px; min-height: 32px; }
.est-toggle { display: flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.est-toggle input { accent-color: var(--accent); }
.shift { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; font-size: 12.5px; color: var(--ink-2); background: #f6f7f9; border-radius: 7px; padding: 8px 10px; margin-top: 8px; }
.shift input { width: 56px !important; min-height: 28px !important; padding: 3px 6px !important; }

.warn { background: var(--warn-bg); color: var(--warn-ink); border-radius: 6px; padding: 8px 10px; font-size: 13px; margin-bottom: 8px; }
.steps { display: grid; }
.step { display: grid; grid-template-columns: 14px minmax(0, 1fr) auto; gap: 10px; align-items: center; text-align: left; border: 0; border-top: 1px solid var(--line); background: none; padding: 9px 4px; cursor: pointer; border-radius: 0; }
.step:hover { background: #f8f9fb; }
.step-main { display: grid; min-width: 0; }
.step-label { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-rule { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-err .step-rule { color: var(--danger); }
.step-date { font-size: 12.5px; font-variant-numeric: tabular-nums; color: var(--ink-2); white-space: nowrap; }
.chip { width: 12px; height: 12px; border-radius: 3px; display: block; }
.chip-review { background: #fff; border: 1.5px solid var(--red); }
.chip-client { background: #e9e9e9; border: 1.5px solid var(--red); }
.chip-milestone { background: var(--navy); }
.chip-note { background: transparent; border: 1.5px dotted var(--muted); }
.chip-est { outline: 1.5px dashed var(--navy); outline-offset: 1.5px; }

.tracks { display: grid; gap: 8px; }
.track { display: grid; grid-template-columns: auto minmax(0, 1fr) 28px; gap: 8px; align-items: center; }
.swatches { display: flex; gap: 3px; }
.swatch { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0,0,0,.12); cursor: pointer; padding: 0; }
.swatch.on { outline: 2px solid var(--ink); outline-offset: 1px; }
.danger { border-top: 1px solid var(--line); padding-top: 14px; margin-top: 8px; }

.preview { overflow: auto; padding: 20px 24px 48px; min-width: 0; }
.preview-bar { font-size: 12.5px; margin-bottom: 10px; }
.paper { background: #fff; box-shadow: 0 1px 2px rgba(20,30,50,.06), 0 6px 24px rgba(20,30,50,.07); border-radius: 4px; padding: 26px 28px; min-width: 760px; max-width: 1180px; }

/* ---------- modal ---------- */
dialog { border: 0; padding: 0; border-radius: 12px; width: min(520px, calc(100vw - 32px)); max-height: calc(100vh - 40px); box-shadow: 0 24px 60px rgba(15,23,42,.28); color: var(--ink); }
dialog.wide { width: min(640px, calc(100vw - 32px)); }
dialog::backdrop { background: rgba(15,23,42,.42); }
.modal { padding: 22px 24px 18px; }
.modal h2 { margin-bottom: 16px; }
.modal-foot { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }
.types { display: flex; flex-wrap: wrap; gap: 6px; }
.type-opt input { position: absolute; opacity: 0; pointer-events: none; }
.type-chip { display: inline-block; padding: 5px 10px; border-radius: 6px; font-size: 13px; border: 1px solid var(--line-2); cursor: pointer; background: #fff; }
.type-opt input:checked + .type-chip { outline: 2px solid var(--accent); outline-offset: 1px; }
.type-opt input:focus-visible + .type-chip { outline: 2px solid var(--accent); outline-offset: 3px; }
.type-post { background: #DDD7EC; border-color: #DDD7EC; }
.type-review { color: var(--red); border-style: dashed; }
.type-client { background: #ececec; color: var(--red); font-weight: 700; border-color: #ececec; }
.type-milestone { background: #e8ebf1; font-weight: 700; border-color: #e8ebf1; }
.type-note { font-style: italic; color: var(--ink-2); }
.rel-row { display: grid; grid-template-columns: 70px 130px auto minmax(0, 1fr) auto; gap: 8px; align-items: center; }
.step-result { background: #f6f7f9; border-radius: 7px; padding: 10px 12px; font-size: 13.5px; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); background: var(--navy); color: #fff; padding: 10px 16px; border-radius: 8px; font-size: 13.5px; box-shadow: 0 8px 24px rgba(15,23,42,.25); z-index: 50; }

/* ---------- the calendar document (preview + PDF) ---------- */
.doc { --d-navy: #1b2740; --d-head: #33405a; --d-line: #c9ced8; --d-out: #dde2ea; --d-red: #c00000; font-family: var(--display); font-size: 12px; color: #1b2233; }
.doc-head { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; padding-bottom: 14px; border-bottom: 3px solid var(--d-navy); }
.doc-logo { height: 4.4em; display: flex; align-items: center; }
.doc-logo img { max-height: 100%; max-width: 15em; object-fit: contain; }
.doc-logo-r { justify-content: flex-end; }
.doc-logo-r img { max-height: 70%; max-width: 12em; }
.studio-name { font-weight: 600; color: var(--d-head); }
.doc-title { text-align: center; }
.doc-title h1 { font: 700 2.2em/1.1 var(--display); color: var(--d-navy); letter-spacing: -.01em; margin: 0; }
.doc-title p { margin: .35em 0 0; font: 500 1.15em var(--display); color: #3b4458; }
.doc-title .bar { color: #a0a7b5; margin: 0 .3em; }
.doc-legend { display: flex; flex-wrap: wrap; gap: .6em 1.8em; padding: .9em 0 .2em; font-size: 1em; }
.lg { display: inline-flex; align-items: center; gap: .5em; }
.lg-red { color: var(--d-red); }
.sw { width: 2.4em; height: 1.1em; border-radius: 2px; display: inline-block; }
.sw-review { background: #fff; border: 1px dashed #9aa2b1; }
.sw-client { background: #ececec; }
.sw-est { background: #fff; outline: 1.5px dashed var(--d-navy); outline-offset: -3px; border: 1px solid #fff; }

.month { margin-top: 1.4em; }
.month-head { display: flex; justify-content: space-between; align-items: baseline; gap: 1em; margin-bottom: .45em; }
.month h2 { font: 700 2.1em/1 var(--display); color: var(--d-navy); margin: 0; letter-spacing: -.015em; }
.month-ctx { font-size: .95em; color: #7b8396; }
.grid { border: 1px solid var(--d-line); }
.dow { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); background: var(--d-head); color: #fff; font: 700 1.05em var(--display); text-align: center; letter-spacing: .02em; }
.dow div { padding: .35em 0; border-left: 1px solid #4b5875; }
.dow div:first-child { border-left: 0; }
.week { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); min-height: 7.4em; border-top: 1px solid var(--d-line); row-gap: 2px; padding-bottom: 2px; }
.cell { border-left: 1px solid var(--d-line); background: #fff; }
.cell:first-child { border-left: 0; }
.cell.out { background: var(--d-out); }
.doc .cell[data-day] { cursor: copy; }
.doc .cell[data-day]:hover { background: #f4f8f7; }
.dnum { font: 700 1.3em var(--display); padding: .2em .45em 0; pointer-events: none; color: #1b2233; }
.ev { position: relative; margin: 0 1px; padding: .3em .4em; text-align: center; font-size: 1.05em; line-height: 1.25; display: flex; align-items: center; justify-content: center; gap: .35em; min-height: 1.9em; border-radius: 1px; }
.ev[data-ev] { cursor: pointer; }
.ev[data-ev]:hover { filter: brightness(.96); box-shadow: inset 0 0 0 1.5px rgba(27,39,64,.35); }
.ev b { font-weight: 700; }
.ev-review { background: #fff; color: var(--d-red); border-top: 1px dashed #b5bbc7; border-bottom: 1px dashed #b5bbc7; }
.ev-client { background: #ececec; color: var(--d-red); font-weight: 700; }
.ev-milestone { background: #e8ebf1; color: var(--d-navy); font-weight: 600; }
.ev-note { font-style: italic; color: #4b5468; }
.ev-hl { background: #fff200; color: #1b2233; font-weight: 700; }
.ev-est { outline: 1.5px dashed var(--d-navy); outline-offset: -3px; }
.ev .dot { width: .6em; height: .6em; border-radius: 50%; flex: none; box-shadow: 0 0 0 1px rgba(0,0,0,.15); }
.doc-notes { margin-top: 1.1em; background: #f1f2f4; padding: .9em 1.2em 1em; }
.doc-notes h3 { font: 700 1.05em var(--display); letter-spacing: .32em; text-transform: uppercase; margin: 0 0 .4em; color: var(--d-navy); }
.doc-notes p { margin: 0; font-family: var(--body); font-size: 1.1em; line-height: 1.5; }
.doc-foot { margin-top: 1.2em; font-size: .9em; color: #8a91a2; text-align: right; }


/* ---------- drag and drop, days off, history ---------- */
.palette { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-bottom: 12px; font-size: 12.5px; }
.pal { cursor: grab; user-select: none; touch-action: none; font-size: 12.5px; padding: 4px 9px; }
.pal:hover { box-shadow: 0 1px 4px rgba(20,30,50,.15); }
.type-off { background: repeating-linear-gradient(135deg, #f1f2f5 0 6px, #e6e8ee 6px 12px); color: var(--ink-2); border-color: #dcdfe6; }
.doc [data-ev] { touch-action: none; }
.rs { position: absolute; right: -2px; top: 0; bottom: 0; width: 9px; cursor: ew-resize; z-index: 2; }
.rs::after { content: ''; position: absolute; right: 3px; top: 25%; bottom: 25%; width: 2px; border-radius: 2px; background: rgba(27,39,64,.35); opacity: 0; transition: opacity .12s; }
.ev:hover .rs::after { opacity: 1; }
body.dragging, body.dragging * { user-select: none !important; cursor: grabbing !important; }
body.dragging-resize, body.dragging-resize * { cursor: ew-resize !important; }
body.dragging .ev { pointer-events: none; }
.drag-ghost { position: fixed; left: 0; top: 0; z-index: 100; pointer-events: none; background: var(--navy); color: #fff; font-size: 12.5px; font-weight: 600; padding: 6px 10px; border-radius: 6px; box-shadow: 0 6px 20px rgba(15,23,42,.3); white-space: nowrap; }
.doc .cell.drop { background: #d9efe8 !important; box-shadow: inset 0 0 0 2px var(--accent); }
.grip { width: 8px; height: 14px; opacity: .35; background-image: radial-gradient(currentColor 1.1px, transparent 1.2px); background-size: 4px 4px; cursor: grab; }
.step { grid-template-columns: 8px 14px minmax(0, 1fr) auto !important; touch-action: none; }
.tip { margin: -4px 0 8px; }

.doc .cell.off { background: repeating-linear-gradient(135deg, #fafafb 0 7px, #f0f1f4 7px 14px); }
.mk { margin: 0 1px; padding: .25em .4em; text-align: center; font-size: .95em; line-height: 1.2; color: #4b5468; font-style: italic; display: flex; align-items: center; justify-content: center; }
.mk-holiday { color: #2d3a55; }
.mk-ooo { font-style: normal; font-weight: 600; color: #5b6478; }
.mk-priv { color: #a05a00; font-weight: 500; border: 1px dashed #e0b77a; background: #fff8ec; }

.link-btn { border: 0; background: none; color: var(--accent); cursor: pointer; padding: 0 4px; font-size: 12px; font-weight: 600; }
.hol-group { margin-bottom: 12px; }
.hol-gh { display: flex; justify-content: space-between; align-items: center; font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 4px; }
.hol-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 2px 12px; }
.hol { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 7px; align-items: center; font-size: 13px; padding: 3px 0; cursor: pointer; }
.hol input { accent-color: var(--accent); }
.hol-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hol-date { font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.hol-actions { margin-top: 4px; }
.ooo-list { display: grid; gap: 6px; margin-top: 8px; justify-items: start; }
.ooo { display: flex; justify-content: space-between; align-items: center; gap: 10px; width: 100%; text-align: left; border: 1px solid var(--line); background: #fff; border-radius: 7px; padding: 8px 10px; cursor: pointer; }
.ooo:hover { border-color: var(--line-2); background: #fafbfc; }
.ooo-l { display: grid; }

.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.choice-opt, .tpl-opt { display: flex; gap: 10px; align-items: flex-start; border: 1px solid var(--line-2); border-radius: 8px; padding: 10px 12px; cursor: pointer; background: #fff; }
.choice-opt > span, .tpl-opt > span { display: grid; gap: 2px; }
.choice-opt input, .tpl-opt input { margin-top: 3px; accent-color: var(--accent); }
.choice-opt:has(input:checked), .tpl-opt:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); background: #f6fbf9; }
.choice-opt:has(input:disabled) { opacity: .5; cursor: default; }
.tpl-pick { display: grid; gap: 6px; max-height: 240px; overflow-y: auto; }

.notes-tools { display: flex; gap: 8px; align-items: center; margin-top: 6px; flex-wrap: wrap; }
.notes-tools select { width: auto !important; flex: 1; min-width: 180px; }
.vlist { display: grid; }
.ver { display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line); }
.ver-l { display: grid; min-width: 0; flex: 1; }
.ver .actions { flex-wrap: nowrap; flex: none; }
.ver-l b { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pv-banner { position: sticky; top: 0; z-index: 3; display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; background: #fff6e0; color: var(--warn-ink); border: 1px solid #f2dfaa; border-radius: 8px; padding: 8px 12px; margin-bottom: 12px; font-size: 13.5px; }
.paper-pv { outline: 3px solid #f2dfaa; }
.toast { display: flex; align-items: center; gap: 12px; }
.toast-btn { background: transparent; border: 1px solid rgba(255,255,255,.4); color: #fff; border-radius: 5px; padding: 3px 9px; cursor: pointer; font-weight: 600; }
.page-sec { margin: 26px 0 10px; }
.page-sec h2 { margin: 0; }
.tcard-main { min-width: 0; }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; max-width: 70ch; }
.tcard h3 { display: flex; align-items: center; gap: 8px; }
.drop-hover { border-color: var(--accent) !important; background: var(--accent-soft) !important; }
.hol-sum { margin: 6px 0 0; }
@media (max-width: 760px) { .choice { grid-template-columns: 1fr; } }

/* ---------- small screens ---------- */
@media (max-width: 1100px) {
  .ed-body { grid-template-columns: 1fr; }
  .panel { border-right: 0; border-bottom: 1px solid var(--line); max-height: none; }
  .editor { height: auto; }
  .prow { grid-template-columns: 32px minmax(0, 1fr) 90px; }
  .prow-next, .prow-dates { display: none; }
}
@media (max-width: 760px) {
  #app { grid-template-columns: 1fr; height: auto; }
  .side { max-height: none; }
  .page { padding: 20px 16px 48px; }
  .preview { padding: 16px; }
  .f-row, .logo-field { grid-template-columns: 1fr; }
  .rel-row { grid-template-columns: 70px 1fr; }
}

/* ---------- print / PDF ---------- */
@page { size: letter landscape; margin: 0.4in 0.45in; }
@media print {
  html, body { height: auto; background: #fff; }
  .rs { display: none; }
  #app, #modal, .toast { display: none !important; }
  #print-root { display: block; }
  * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .doc { font-size: 8.6pt; }
  .month { break-inside: auto; }
  .month + .month, .doc-notes + .month { break-before: page; margin-top: 0; }
  .week { break-inside: avoid; min-height: 7.6em; }
  .doc-head, .doc-legend, .month-head, .dow { break-after: avoid; }
  .doc-notes { break-inside: avoid; }
}
