:root {
  --bg: #efebe4;
  --paper: #fffdf9;
  --ink: #1d1d1f;
  --muted: #8b867e;
  --faint: #b9b3a9;
  --line: #ddd7cd;
  --line-strong: #3a3835;
  --beige: #f6f1e8;
  --sky: #d7f0fb;
  --sky-mid: #a9dcf2;
  --accent: #2b8fc6;
  --accent-ink: #145e86;
  --today: #fff1c2;
  --danger: #c33a2c;
  --radius: 10px;
  --font: -apple-system, "SF Pro Text", "Helvetica Neue", system-ui, sans-serif;
  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.35 var(--font);
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior: none;
  overflow: hidden;
  position: fixed;
  inset: 0;
  touch-action: manipulation; /* no double-tap zoom */
  /* Long-press must not select the whole page or show the Copy/Translate bubble. */
  -webkit-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
input, textarea { -webkit-user-select: text; user-select: text; -webkit-touch-callout: default; }
::selection { background: rgba(43,143,198,.25); }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }

.app { position: fixed; inset: 0; display: flex; flex-direction: column; padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.work { flex: 1; display: flex; min-height: 0; }
.stage { flex: 1; display: flex; align-items: center; justify-content: center; min-width: 0; overflow: hidden; overflow: clip; }

/* ---------- Toolbar ---------- */
.toolbar { height: 52px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 12px; background: var(--bg); border-bottom: 1px solid #e2ddd4; user-select: none; -webkit-user-select: none; }
.tb-left { display: flex; align-items: center; gap: 2px; flex: 1; min-width: 0; }
.tb-tools { display: flex; align-items: center; gap: 4px; background: #fff; border-radius: 14px; padding: 4px 6px; box-shadow: 0 1px 2px rgba(0,0,0,.06), 0 0 0 1px rgba(0,0,0,.04); }
.tb-right { display: flex; align-items: center; gap: 6px; flex: none; justify-content: flex-end; }
.icon-btn, .tool-btn { width: 40px; height: 40px; border: 0; background: transparent; border-radius: 10px; display: grid; place-items: center; cursor: pointer; color: #3a3835; }
.icon-btn:active, .tool-btn:active { background: rgba(0,0,0,.07); }
.icon-btn:disabled { opacity: .3; }
.tool-btn { width: 38px; height: 36px; }
.tool-btn.on { background: var(--sky); color: var(--accent-ink); }
.sep { width: 1px; height: 22px; background: #e6e1d8; margin: 0 4px; }
.swatches { display: flex; gap: 4px; }
.swatch { width: 24px; height: 24px; border-radius: 50%; border: 0; background: var(--c); cursor: pointer; box-shadow: inset 0 0 0 1px rgba(0,0,0,.12); }
.swatch.on { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
body:not(.drawing) .swatch { opacity: .55; }
.size-btn::after { content: ""; width: var(--dot, 9px); height: var(--dot, 9px); border-radius: 50%; background: #3a3835; }
.crumbs { display: flex; align-items: center; gap: 1px; margin-left: 4px; white-space: nowrap; overflow: hidden; font-size: 14px; color: var(--muted); }
.crumbs a { padding: 6px 3px; border-radius: 6px; }
.crumbs a.cur { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--faint); }
.today-btn { padding: 8px 14px; border-radius: 10px; background: var(--ink); color: #fff; font-weight: 600; font-size: 14px; }

/* ---------- Side tabs ---------- */
.tabs { width: 44px; flex: none; display: flex; flex-direction: column; padding: 8px 0 8px 0; gap: 2px; user-select: none; -webkit-user-select: none; }
.tab { flex: 1; display: grid; place-items: center; writing-mode: vertical-rl; font-size: 12px; letter-spacing: .08em; color: var(--muted); background: var(--beige); border-radius: 0 8px 8px 0; min-height: 0; }
.tab.now { color: var(--accent-ink); font-weight: 600; }
.tab.on { background: var(--sky-mid); color: var(--ink); font-weight: 600; }
.tab-year, .tab-ov { background: #e7e1d6; font-weight: 600; color: #5d5850; flex: 1.2; }

/* ---------- Page frame ---------- */
.holder { position: relative; flex: none; }
.page { position: absolute; left: 0; top: 0; width: 1160px; height: 780px; transform-origin: 0 0; background: var(--paper); border-radius: 6px; box-shadow: 0 1px 3px rgba(0,0,0,.08), 0 8px 28px rgba(60,50,30,.08); overflow: hidden; padding: 22px 26px; }
.ink-base, .ink-live { position: absolute; left: 0; top: 0; width: 1160px; height: 780px; z-index: 5; }
.ink-base { pointer-events: none; }
.ink-live { touch-action: none; }
.ink-live[data-tool="pen"], .ink-live[data-tool="hl"] { cursor: crosshair; }
.ink-live[data-tool="eraser"] { cursor: cell; }

h1, h2, h3, h4 { margin: 0; }
.thin { font-weight: 300; color: var(--muted); }
.page-head { display: flex; align-items: center; justify-content: space-between; height: 48px; margin-bottom: 14px; }
.page-head h1 { font-size: 36px; font-weight: 700; letter-spacing: -.02em; }
.seg { display: flex; background: var(--beige); border-radius: 10px; padding: 3px; }
.seg a { padding: 8px 14px; border-radius: 8px; font-size: 14px; color: var(--muted); }
.seg a.on { background: #fff; color: var(--ink); font-weight: 600; box-shadow: 0 1px 2px rgba(0,0,0,.08); }

/* Text fields */
.fld { font: inherit; color: var(--ink); background: transparent; border: 0; outline: 0; width: 100%; min-width: 0; padding: 0 4px; border-radius: 4px; }
.fld:focus { background: rgba(43,143,198,.07); }
.fld::placeholder { color: var(--faint); }
.area { resize: none; display: block; }
.line { height: 100%; font-size: 15px; }

/* ---------- Year ---------- */
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); grid-template-rows: repeat(3, 1fr); gap: 16px 30px; height: calc(100% - 62px); }
.mini-month { display: flex; flex-direction: column; min-height: 0; }
.mini-title { font-size: 19px; font-weight: 600; text-align: center; padding: 2px 0 6px; border-radius: 6px; }
.mini-title:active { background: var(--beige); }
.mini { display: grid; grid-template-columns: 22px repeat(7, 1fr); grid-auto-rows: 1fr; flex: 1; font-size: 13px; }
.mini-h { font-size: 10px; color: var(--muted); text-align: center; padding: 4px 0; background: var(--beige); letter-spacing: .04em; }
.mini-h.wk { background: transparent; }
.mini-wk { font-size: 9px; color: var(--faint); display: grid; place-items: center; border-radius: 4px; }
.mini-wk:active { background: var(--sky); color: var(--accent-ink); }
.mini-d { display: grid; place-items: center; position: relative; border-bottom: 1px solid var(--line); border-radius: 0; }
.mini-d.mon { background: #f0f9fd; }
.mini-d.we { color: #7d776e; }
.mini-d.today { background: var(--ink); color: #fff; border-radius: 6px; font-weight: 600; }
.mini-d.has::after { content: ""; position: absolute; bottom: 3px; width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }
.mini-d.today.has::after { background: #fff; }
.mini-d:not(.out):active { background: var(--sky); }

/* ---------- Overview ---------- */
.ov-grid { display: grid; grid-template-columns: repeat(6, 1fr); grid-template-rows: 26px repeat(31, 1fr); height: calc(100% - 62px); border-left: 1px solid var(--line); }
.ov-mh { font-size: 12px; font-weight: 700; letter-spacing: .06em; display: grid; place-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line-strong); }
.ov-c { display: flex; align-items: center; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); min-height: 0; }
.ov-c.we { background: var(--beige); }
.ov-c.today { background: var(--today); }
.ov-c.empty { background: repeating-linear-gradient(135deg, transparent 0 6px, #f3efe8 6px 7px); }
.ov-n { flex: none; width: 44px; display: flex; align-items: baseline; gap: 3px; padding-left: 5px; font-size: 12px; color: var(--muted); }
.ov-n b { font-weight: 500; color: #4d4943; min-width: 15px; }
.ov-n i { font-style: normal; font-size: 8px; letter-spacing: .04em; color: var(--faint); }
.ov-f { font-size: 12px; height: 100%; padding: 0 3px; }

/* ---------- Month ---------- */
.page-month { display: flex; gap: 26px; }
.m-side { width: 290px; flex: none; display: flex; flex-direction: column; }
.m-title { font-size: 40px; font-weight: 700; letter-spacing: -.02em; margin-bottom: 18px; padding-left: 4px; }
.m-block { flex: 1; display: flex; flex-direction: column; margin-bottom: 14px; }
.m-block h3 { font-size: 17px; font-weight: 600; padding: 0 4px 6px; }
.m-block .line { flex: 1; border-bottom: 1px solid var(--line-strong); border-radius: 0; height: auto; }
.m-main { flex: 1; min-width: 0; }
.m-grid { height: 100%; display: grid; grid-template-columns: 30px repeat(7, 1fr); grid-template-rows: 38px repeat(var(--weeks), 1fr); }
.m-wkh { font-size: 9px; color: var(--faint); writing-mode: vertical-rl; transform: rotate(180deg); display: grid; place-items: center; letter-spacing: .08em; }
.m-dh { background: var(--beige); font-size: 11px; letter-spacing: .06em; display: grid; place-items: center; border-bottom: 1.5px solid var(--line-strong); }
.m-wk { font-size: 11px; color: var(--faint); display: grid; place-items: center; border-radius: 6px; }
.m-wk:active { background: var(--sky); }
.m-c { border-bottom: 1.5px solid var(--line-strong); border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; position: relative; }
.m-c:nth-child(8n) { border-right: 0; }
.m-c.we { background: #fcfaf6; }
.m-c.out { background: repeating-linear-gradient(135deg, transparent 0 7px, #f4f0e9 7px 8px); }
.m-c.out .m-n { color: var(--faint); font-weight: 400; font-size: 13px; }
.m-n { font-size: 19px; font-weight: 600; padding: 5px 8px 0; align-self: flex-start; border-radius: 6px; }
a.m-n:active { background: var(--sky); }
.m-c.today .m-n { background: var(--ink); color: #fff; margin: 4px 0 0 4px; padding: 1px 7px; }
.m-c.has::after { content: ""; position: absolute; top: 12px; right: 10px; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.m-f { flex: 1; font-size: 13px; line-height: 1.3; padding: 2px 7px 4px; }

/* ---------- Week ---------- */
.page-week { display: flex; flex-direction: column; }
.w-head { display: flex; align-items: center; gap: 22px; height: 58px; margin-bottom: 10px; }
.w-title { width: 230px; flex: none; }
.w-title h1 { font-size: 30px; font-weight: 700; letter-spacing: -.02em; }
.w-title p { margin: 0; color: var(--muted); font-size: 14px; }
.w-strip { flex: 1; display: grid; grid-template-columns: repeat(16, 1fr); border: 1px solid var(--line); border-radius: 8px; overflow: hidden; height: 50px; }
.ws-wk, .ws-d { display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 13px; border-right: 1px solid var(--line); }
.ws-wk { background: var(--sky); font-weight: 600; color: var(--accent-ink); }
.ws-d small, .ws-wk small { font-size: 9px; color: var(--muted); letter-spacing: .05em; }
.ws-d.today { background: var(--today); font-weight: 600; }
.ws-d:active, .ws-wk:active { background: var(--sky-mid); }
.w-grid { display: grid; grid-template-columns: 52px repeat(7, 1fr); }
.w-headrow { height: 44px; flex: none; }
.w-scroll { flex: 1; min-height: 0; }
.w-body { grid-auto-rows: 30px; }
.w-corner { font-size: 10px; color: var(--faint); display: grid; place-items: end start; padding-bottom: 6px; border-bottom: 1.5px solid var(--line-strong); }
.w-dh { background: var(--beige); display: flex; align-items: baseline; gap: 8px; padding: 0 10px; align-self: stretch; border-bottom: 1.5px solid var(--line-strong); padding-top: 12px; }
.w-dh span { font-size: 15px; color: #5d5850; letter-spacing: .04em; }
.w-dh b { font-size: 20px; font-weight: 600; }
.w-dh.today { background: var(--today); }
.w-dh:active { background: var(--sky); }
.w-t { font-size: 11px; color: var(--muted); display: flex; align-items: center; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.w-t.half { color: var(--faint); font-size: 10px; padding-left: 14px; border-bottom-color: var(--line-strong); }
.w-c { position: relative; border-bottom: 1px dashed var(--line); border-left: 1px solid var(--line); min-height: 0; display: flex; }
.w-c.half { border-bottom: 1px solid var(--line-strong); }
.w-c.we { background: #fcfaf6; }
.w-c.cont, .sched-row.cont { background: linear-gradient(90deg, var(--sky) 0 4px, #f1f9fd 4px); }
.w-c.filled { background: linear-gradient(90deg, var(--accent) 0 3px, #eef7fc 3px); }
.cell { height: 100%; font-size: 13px; padding: 0 6px; }

/* Schedules scroll inside their own window */
.sched-pane { overflow-y: auto; overscroll-behavior: contain; -webkit-overflow-scrolling: touch; touch-action: pan-y; scrollbar-width: thin; }
.slot-open { width: 30px; height: 30px; flex: none; border: 0; border-radius: 8px; background: transparent; color: var(--accent); display: grid; place-items: center; cursor: pointer; visibility: hidden; }
.slot-open svg { width: 17px; height: 17px; }
.slot-open.small { position: absolute; right: 1px; top: 1px; width: 26px; height: 26px; background: rgba(255,255,255,.85); }
.slot-open.small svg { width: 14px; height: 14px; }
.filled > .slot-open { visibility: visible; }
.slot-open:active { background: var(--sky); }
.slot-sum { flex: none; max-width: 38%; font-size: 11px; color: var(--accent-ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.slot-sum:empty { display: none; }

/* ---------- Day ---------- */
.page-day { display: flex; flex-direction: column; }
.d-head { display: flex; align-items: center; gap: 16px; height: 50px; margin-bottom: 14px; }
.d-date { background: var(--beige); padding: 8px 18px; border-radius: 8px; display: flex; align-items: center; gap: 10px; flex: none; }
.d-date h1 { font-size: 23px; font-weight: 500; letter-spacing: -.01em; }
.d-date.today { background: var(--today); }
.badge { background: var(--ink); color: #fff; font-size: 11px; font-weight: 700; padding: 3px 8px; border-radius: 20px; letter-spacing: .04em; text-transform: uppercase; }
.d-headline { flex: 1; height: 40px; font-size: 17px; border-bottom: 1px dashed var(--line); border-radius: 0; }
.d-links { display: flex; gap: 6px; }
.chip { display: inline-flex; align-items: center; padding: 7px 12px; border-radius: 20px; background: var(--beige); font-size: 13px; color: #4d4943; white-space: nowrap; }
.chip:active { background: var(--sky); }
.d-body { flex: 1; display: grid; grid-template-columns: 300px 1fr 350px; gap: 22px; min-height: 0; }
.d-body h3 { font-size: 13px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; height: 30px; display: flex; align-items: center; border-bottom: 1px solid var(--sky-mid); padding-left: 4px; flex: none; }
.d-todo, .d-sched, .d-prio, .d-notes { display: flex; flex-direction: column; min-height: 0; }
.todo-row { flex: 1; display: flex; align-items: center; border-bottom: 1px solid var(--line-strong); min-height: 0; }
.chk { appearance: none; -webkit-appearance: none; width: 20px; height: 20px; border: 1.5px solid #8b867e; border-radius: 5px; margin: 0 8px 0 6px; flex: none; display: grid; place-items: center; cursor: pointer; background: #fff; }
.chk:checked { background: var(--accent); border-color: var(--accent); }
.chk:checked::after { content: ""; width: 5px; height: 10px; border: solid #fff; border-width: 0 2px 2px 0; transform: translateY(-1px) rotate(45deg); }
.todo-row.done .fld { text-decoration: line-through; color: var(--muted); }
.move-btn { width: 30px; height: 30px; border: 0; background: transparent; border-radius: 8px; display: grid; place-items: center; color: var(--faint); visibility: hidden; flex: none; cursor: pointer; }
.move-btn svg { width: 18px; height: 18px; }
.todo-row.filled .move-btn { visibility: visible; }
.move-btn:active { background: var(--sky); color: var(--accent-ink); }
.d-mid { display: flex; flex-direction: column; gap: 18px; min-height: 0; }
.d-prio { flex: none; height: 250px; }
.prio-row { flex: 1; display: flex; align-items: center; border-bottom: 1px solid var(--line-strong); }
.prio-n { width: 26px; flex: none; text-align: center; color: var(--accent); font-weight: 700; font-size: 14px; }
.d-notes { flex: 1; }
.notes { flex: 1; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; padding: 10px 12px; font-size: 15px; line-height: 28px;
  background: repeating-linear-gradient(transparent 0 27px, #efeae2 27px 28px) 0 9px / 100% 28px local; }
.d-sched .sched-pane { flex: 1; min-height: 0; }
.d-body h3 small { margin-left: auto; padding-right: 6px; font-size: 10px; font-weight: 500; letter-spacing: .02em; text-transform: none; color: var(--faint); }
.sched-row { height: 34px; flex: none; display: flex; align-items: center; border-bottom: 1px dashed var(--line); }
.sched-row.half { border-bottom: 1px solid var(--line-strong); }
.sched-row.half .sched-t { color: var(--faint); font-size: 11px; }
.sched-row.filled { background: linear-gradient(90deg, var(--accent) 0 3px, #eef7fc 3px); }
.sched-t { width: 50px; flex: none; font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; border-right: 1px solid var(--line); align-self: stretch; display: flex; align-items: center; padding-left: 4px; }
.sched-row.now { background: var(--today); }
.sched-row.now .sched-t { color: var(--ink); font-weight: 700; }

/* While drawing, fields don't steal Pencil strokes. */
body.drawing .page .fld { pointer-events: none; }

/* ---------- Sheets, toast ---------- */
.sheet-wrap { position: fixed; inset: 0; background: rgba(20,18,15,.28); display: grid; place-items: center; z-index: 50; opacity: 0; transition: opacity .18s; padding: 20px; }
.sheet-wrap.open { opacity: 1; }
.sheet { background: #fff; border-radius: 16px; width: min(460px, 100%); max-height: min(720px, 92vh); display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.25); transform: translateY(14px); transition: transform .18s; }
.sheet.wide { width: min(640px, 100%); }
.sheet-wrap.open .sheet { transform: none; }
.sheet-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 14px 6px 22px; }
.sheet-head h2 { font-size: 20px; }
.sheet-body { padding: 6px 22px 22px; overflow: auto; -webkit-overflow-scrolling: touch; }
.menu h4, .help h4 { font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 16px 0 8px; }
.menu-row { display: flex; flex-wrap: wrap; gap: 6px; }
.menu-item { display: flex; flex-direction: column; align-items: flex-start; gap: 2px; width: 100%; text-align: left; border: 0; background: var(--beige); border-radius: 12px; padding: 12px 14px; margin-bottom: 6px; cursor: pointer; }
.menu-item span, .menu-toggle span span { font-size: 13px; color: var(--muted); }
.menu-item:active { background: var(--sky); }
.menu-item.danger b { color: var(--danger); }
.menu-toggle { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: var(--beige); border-radius: 12px; padding: 12px 14px; margin-bottom: 6px; }
.menu-toggle > span { display: flex; flex-direction: column; gap: 2px; }
.switch { appearance: none; -webkit-appearance: none; width: 50px; height: 30px; border-radius: 15px; background: #d8d3ca; position: relative; flex: none; transition: background .15s; cursor: pointer; }
.switch::after { content: ""; position: absolute; top: 2px; left: 2px; width: 26px; height: 26px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0,0,0,.2); transition: transform .15s; }
.switch:checked { background: #34c759; }
.switch:checked::after { transform: translateX(20px); }
.help p { margin: 0 0 6px; color: #4d4943; font-size: 14px; line-height: 1.5; }
.confirm p { margin: 4px 0 18px; color: #4d4943; line-height: 1.5; }
.confirm-btns { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.btn { border: 0; border-radius: 10px; padding: 11px 16px; background: var(--ink); color: #fff; font-weight: 600; cursor: pointer; }
.btn.danger { background: var(--danger); }
.btn.ghost { background: var(--beige); color: var(--ink); }
.search-in { width: 100%; font: inherit; font-size: 17px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; outline: 0; background: var(--beige); margin-bottom: 12px; }
.search-in:focus { border-color: var(--sky-mid); background: #fff; }
.results { display: flex; flex-direction: column; gap: 6px; }
.hit { display: block; padding: 10px 12px; border-radius: 10px; background: var(--beige); }
.hit:active { background: var(--sky); }
.hit-top { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; }
.hit-top span { color: var(--muted); }
.hit-text { font-size: 14px; margin-top: 2px; white-space: pre-wrap; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.muted { color: var(--muted); }
#toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom)); transform: translate(-50%, 20px); background: var(--ink); color: #fff; padding: 11px 18px; border-radius: 12px; font-size: 14px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 80vw; text-align: center; }
#toast.show { opacity: 1; transform: translate(-50%, 0); }
.fatal { position: fixed; inset: auto 20px 20px; background: var(--danger); color: #fff; padding: 14px; border-radius: 12px; z-index: 99; }

/* ---------- Full-text bubble ---------- */
.fulltext { position: fixed; left: 0; top: 0; z-index: 45; max-width: min(480px, 90vw); padding: 10pt; background: #fff; color: var(--ink); border-radius: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.18), 0 0 0 1px rgba(0,0,0,.05); font-size: 16px; line-height: 1.4; white-space: pre-wrap; overflow-wrap: anywhere; pointer-events: none; opacity: 0; visibility: hidden; transition: opacity .12s; }
.fulltext.show { opacity: 1; visibility: visible; }

/* ---------- Floating tool palette ---------- */
.palette { position: fixed; left: 0; top: 0; z-index: 30; display: flex; align-items: center; gap: 2px; padding: 4px 6px 4px 2px; background: rgba(255,255,255,.96); border-radius: 16px; box-shadow: 0 6px 24px rgba(40,30,10,.16), 0 0 0 1px rgba(0,0,0,.05); -webkit-backdrop-filter: blur(10px); backdrop-filter: blur(10px); touch-action: none; }
.palette.dragging { box-shadow: 0 14px 40px rgba(40,30,10,.25), 0 0 0 1px rgba(0,0,0,.06); }
.pal-grip { width: 22px; height: 36px; display: grid; place-items: center; color: var(--faint); cursor: grab; touch-action: none; }
.pal-grip svg { width: 18px; height: 18px; }
.pal-tools, .pal-more { display: flex; align-items: center; gap: 2px; }
.palette.collapsed .pal-more { display: none; }
.palette.collapsed .tool-btn:not(.on) { display: none; }
.palette.collapsed .pal-collapse { transform: rotate(180deg); }
.pal-collapse { width: 32px; }
.zoom-btn { min-width: 52px; height: 32px; border: 0; border-radius: 9px; background: var(--beige); font-size: 12px; font-weight: 600; color: var(--muted); cursor: pointer; font-variant-numeric: tabular-nums; }
.zoom-btn.on { background: var(--sky); color: var(--accent-ink); }
.page { will-change: transform; }

/* ---------- Entry details window ---------- */
.dt { display: flex; flex-direction: column; gap: 14px; }
.dt-date { margin: -2px 0 0; color: var(--muted); font-size: 14px; }
.dt-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.dt-f { display: flex; flex-direction: column; gap: 6px; }
.dt-f > span { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.dt .fld, .dt-select { font-size: 17px; height: 46px; padding: 0 12px; border-radius: 10px; background: var(--beige); border: 1px solid transparent; }
.dt .fld:focus { background: #fff; border-color: var(--sky-mid); }
.dt-select { font: inherit; font-size: 17px; color: var(--ink); appearance: none; -webkit-appearance: none; background: var(--beige) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%238b867e' stroke-width='1.6' fill='none'/%3E%3C/svg%3E") no-repeat right 14px center; }
.dt-title { font-weight: 600; }
.dt-money { position: relative; }
.dt-money b { position: absolute; right: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); font-weight: 500; }
.dt-money .fld { padding-right: 40px; }
.dt .dt-note { height: 130px; padding: 10px 12px; line-height: 1.45; }
.dt-btns { display: flex; justify-content: space-between; gap: 10px; margin-top: 4px; }
.btn.danger-text { color: var(--danger); }

/* ---------- Print / PDF ---------- */
@page { size: landscape; margin: 6mm; }
@media print {
  body { background: #fff; overflow: visible; }
  .toolbar, .tabs, .sheet-wrap, #toast, .palette, .fulltext, .slot-open { display: none !important; }
  .sched-pane { overflow: visible; }
  .app { position: static; padding: 0; }
  .stage { display: block; }
  .holder { width: auto !important; height: auto !important; }
  .page { position: relative; transform: scale(.92) !important; box-shadow: none; border-radius: 0; }
  .fld::placeholder { color: transparent; }
}
.sched-pane { scrollbar-width: none; }
.sched-pane::-webkit-scrollbar { display: none; }
