/* Poppins is bundled so the app works offline (SIL Open Font License) */
@font-face { font-family: 'Poppins'; font-weight: 400; font-display: swap; src: url('fonts/poppins-latin-400-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 500; font-display: swap; src: url('fonts/poppins-latin-500-normal.woff2') format('woff2'); }
@font-face { font-family: 'Poppins'; font-weight: 600; font-display: swap; src: url('fonts/poppins-latin-600-normal.woff2') format('woff2'); }

:root {
  --paper: #FFFFFF;
  --ink: #000000;
  --ink-2: #2B2B2B;
  --mute: #767676;
  --faint: #C9C9C9;
  --line: #E7E7E7;
  --wash: #F5F5F5;
  --gold: #A8843A;
  --red: #B2301F;
  --font: 'Poppins', 'Avenir Next', 'Segoe UI', system-ui, sans-serif;
  --ease: cubic-bezier(.2,.7,.1,1);
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--paper); color: var(--ink); font: 400 15px/1.5 var(--font); -webkit-font-smoothing: antialiased; font-variant-numeric: tabular-nums; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
h1, h2 { font-weight: 600; margin: 0; letter-spacing: -.01em; }

/* ---------- top bar: sits in the corner, the page stays white ---------- */
.top {
  position: fixed; top: 0; right: 0; z-index: 40;
  display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 16px 28px 0 0;
}
.top-row { display: flex; align-items: center; gap: 14px; }
.top-row.sub { gap: 16px; }
body:not(.on-timeline) .filters { display: none; }
body:not(.on-timeline):not(.on-gantt) .top-row.sub { display: none; }
.filters, .views { display: flex; gap: 4px; position: relative; }
.nav-ind { position: absolute; left: 0; bottom: 0; height: 3px; background: var(--ink); width: 0; transition: transform .45s cubic-bezier(.3,1.25,.5,1), width .45s cubic-bezier(.3,1.25,.5,1), opacity .2s; pointer-events: none; }
.filters .nav-ind { height: 2px; }
.proj-filter { font-size: 13.5px; color: var(--mute); border-bottom-width: 1.5px; padding: 4px 2px; max-width: 220px; cursor: pointer; }
.proj-filter.on { color: var(--ink); border-bottom-color: var(--ink); font-weight: 500; }
kbd { font: 500 11px var(--font); border: 1px solid currentColor; padding: 0 5px; margin-left: 6px; opacity: .7; }
.filters button, .views button {
  background: none; border: 0; padding: 6px 8px; font-size: 14px; color: var(--mute); position: relative;
}
.filters button:hover, .views button:hover { color: var(--ink); }
.filters button[aria-pressed="true"], .views button[aria-current="page"] { color: var(--ink); }

.count { font-size: 11px; background: var(--ink); color: #fff; border-radius: 9px; padding: 0 6px; margin-left: 2px; vertical-align: 1px; }
.count:empty { display: none; }

/* ---------- controls ---------- */
.btn {
  border: 1.5px solid var(--ink); background: var(--paper) linear-gradient(var(--ink), var(--ink)) no-repeat left / 0% 100%; color: var(--ink);
  height: 38px; padding: 0 18px; border-radius: 0; font-size: 14px; font-weight: 500; white-space: nowrap;
  transition: background-size .32s cubic-bezier(.2,.7,.1,1), color .2s, transform .12s; display: inline-flex; align-items: center; text-decoration: none;
}
.btn:hover { background-size: 100% 100%; color: #fff; }
.btn:active { transform: translateY(1px) scale(.985); }
.btn.primary { background: var(--ink) linear-gradient(#3A3A3A, #3A3A3A) no-repeat left / 0% 100%; color: #fff; }
.btn.primary:hover { background-size: 100% 100%; }
.btn.ghost { border-color: transparent; background: transparent linear-gradient(var(--wash), var(--wash)) no-repeat left / 0% 100%; }
.btn.ghost:hover { background-size: 100% 100%; color: var(--ink); }
.btn.ghost.danger:hover { color: var(--red); }
.btn:disabled { opacity: .5; cursor: progress; }
.btn.danger { color: var(--red); }
.btn.small { height: 32px; padding: 0 13px; font-size: 13px; }
.link { background: none; border: 0; padding: 0; color: var(--ink); text-decoration: underline; text-underline-offset: 3px; font-size: inherit; }
.icon-btn { width: 38px; height: 38px; border: 0; background: transparent; display: grid; place-items: center; color: var(--ink); }
.icon-btn:hover { background: var(--wash); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
#btn-notify.on svg { fill: var(--ink); }
.spacer { flex: 1; }

label { display: flex; flex-direction: column; gap: 5px; font-size: 13px; color: var(--mute); }
label.inline { flex-direction: row; align-items: center; gap: 6px; }
input, select, textarea { border: 0; border-bottom: 1.5px solid var(--faint); border-radius: 0; background: transparent; padding: 7px 0; font-size: 15px; color: var(--ink); min-width: 0; }
select { padding-right: 4px; }
input:focus, select:focus, textarea:focus { outline: none; border-bottom-color: var(--ink); }
textarea { resize: vertical; border: 1.5px solid var(--faint); padding: 8px 10px; }
textarea:focus { border-color: var(--ink); }
input[type="range"] { border: 0; accent-color: var(--ink); padding: 0; }
input[type="number"] { width: 64px; }
output { color: var(--ink); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 22px; }

.menu-wrap { position: relative; }
.menu { position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; background: var(--paper); border: 1.5px solid var(--ink); padding: 6px; z-index: 50; }
.menu button { display: block; width: 100%; text-align: left; background: none; border: 0; padding: 9px 12px; font-size: 14px; }
.menu button:hover { background: var(--wash); }

/* ---------- timeline ---------- */
.timeline { position: fixed; inset: 0; overflow: hidden; }
.tl-rail { position: absolute; inset: 0; right: auto; width: 60vw; overflow: hidden; cursor: grab; touch-action: none; user-select: none; outline: none; }
.tl-rail:active { cursor: grabbing; }
.br-row { position: absolute; left: 0; top: 0; width: 100%; height: var(--rowH); will-change: transform; }
.br-bar { position: absolute; left: 0; top: 50%; height: var(--thick); margin-top: calc(var(--thick) / -2); background: var(--ink); transition: background .35s; }
.br-c1, .br-c2 { position: absolute; top: 50%; translate: 0 -50%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-size: var(--label); line-height: 1.3; }
.br-c1 { left: var(--c1x); max-width: calc(var(--c2x) - var(--c1x) - 16px); color: var(--mute); }
.br-c2 { left: var(--c2x); max-width: var(--c2w); color: var(--ink); }
.br-bar::after { content: ''; position: absolute; right: 12px; top: 50%; height: 34%; width: 24px; translate: 0 -50%; background: #fff; transform: scaleX(0); transform-origin: right; transition: transform .5s cubic-bezier(.3,1.3,.5,1) .06s; }
.br-row.sel .br-bar::after { transform: scaleX(1); }
.br-row.event .br-bar { background: transparent; box-shadow: inset 0 0 0 3px var(--ink); }
.br-row.event.past .br-bar { box-shadow: inset 0 0 0 3px var(--faint); }
.br-row.event.sel .br-bar::after { background: var(--ink); }
.br-row.event.live .br-bar { box-shadow: inset 0 0 0 3px var(--gold); }
.br-row.event.live .br-c1 { color: var(--gold); }
.br-row.past .br-bar { background: var(--faint); }
.br-row.past.sel .br-bar { background: var(--ink); }
.br-row.event.past.sel .br-bar { background: transparent; box-shadow: inset 0 0 0 3px var(--ink); }
.br-row.now .br-bar { background: var(--gold); }
.br-row.overdue .br-c1 { color: var(--red); }
.br-row.past .br-c2 { color: var(--mute); }

.tl-heading { position: absolute; left: var(--hx); top: var(--cy); width: var(--hw); transform: translateY(-50%); pointer-events: none; }
.tl-heading h1 { font-size: var(--hsize); line-height: 1.08; font-weight: 600; letter-spacing: -.015em; overflow-wrap: break-word; cursor: pointer; pointer-events: auto; }
.tl-heading h1.small { font-size: calc(var(--hsize) * .72); }
.tl-heading h1.smaller { font-size: calc(var(--hsize) * .56); }

.tl-panel {
  position: absolute; left: var(--px); right: 3vw; top: 104px; bottom: 44px;
  display: flex; flex-direction: column; align-items: center; justify-content: safe center; text-align: center; gap: 0;
  overflow-y: auto; scrollbar-width: none;
}
.tl-panel::-webkit-scrollbar { display: none; }
.tl-panel.now .p-body { font-size: clamp(15px, 1.15vw, 18px); max-width: 32em; }
.p-body.small { font-size: 15px; font-weight: 400; color: var(--ink-2); }
.p-kind.live { color: var(--gold); }
.rd { display: inline-block; }
.roll { position: relative; overflow: hidden; vertical-align: bottom; }
.rd-new { display: inline-block; }
.rd-old { position: absolute; left: 0; top: 0; }
.p-big sup .rd, .p-big sup .roll { vertical-align: baseline; }

/* needs a decision */
.dec { width: min(560px, 100%); margin-top: 24px; text-align: left; }
.dec-h { display: flex; justify-content: space-between; font-size: 13px; color: var(--mute); border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; }
.dec ol { list-style: none; margin: 0; padding: 0; }
.dec li { display: grid; grid-template-columns: 26px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.dec-bar { height: 5px; background: var(--ink); transition: width .3s; }
.dec li.late .dec-bar { background: var(--red); }
.dec-txt b { display: block; font-weight: 500; font-size: 14px; line-height: 1.3; }
.dec-txt small { display: block; font-size: 12px; color: var(--mute); }
.dec li.late small { color: var(--red); }
.dec-acts { display: flex; gap: 2px; }
.dec-acts button { background: none; border: 0; font-size: 12.5px; padding: 5px 7px; color: var(--ink); position: relative; }
.dec-acts button::after { content: ''; position: absolute; left: 7px; right: 7px; bottom: 2px; height: 1.5px; background: var(--ink); transform: scaleX(0); transform-origin: left; transition: transform .25s var(--ease); }
.dec-acts button:hover::after { transform: scaleX(1); }
.dec-more { font-size: 12px; color: var(--mute); padding-top: 8px; }
.p-kind { font-size: 13.5px; color: var(--mute); margin-bottom: 6px; }
.p-kind.alert { color: var(--red); }
.p-big { font-size: var(--hsize); font-weight: 600; line-height: 1.05; letter-spacing: -.015em; }
.p-big sup { font-size: .32em; font-weight: 500; color: var(--gold); vertical-align: .95em; margin-left: .15em; letter-spacing: 0; }
.p-body { font-size: clamp(16px, 1.45vw, 22px); line-height: 1.45; max-width: 36em; margin: 18px 0 0; font-weight: 500; }
.p-meta { font-size: 14px; color: var(--mute); margin-top: 12px; }
.p-span { width: min(420px, 90%); margin-top: 22px; }
.p-span .track { height: 12px; background: var(--line); position: relative; }
.p-span .fill { position: absolute; inset: 0 auto 0 0; background: var(--ink); }
.p-span .ends { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--mute); margin-top: 6px; }
.p-receipt { margin-top: 26px; max-height: min(34vh, 320px); max-width: 60%; transform: rotate(-5deg); box-shadow: 8px 10px 0 -2px #EFEFEF, 0 12px 30px -16px rgba(0,0,0,.35); background: #fff; cursor: zoom-in; }
.p-file { margin-top: 20px; font-size: 14px; }
.p-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; margin-top: 26px; }
.p-empty { color: var(--mute); }

.tl-now { position: absolute; left: 24px; bottom: 22px; background: var(--paper); border: 1.5px solid var(--ink); height: 34px; padding: 0 14px; font-size: 13px; font-weight: 500; z-index: 5; }
.tl-now:hover { background: var(--ink); color: #fff; }
.sample-note { position: absolute; right: 28px; bottom: 18px; font-size: 13px; color: var(--mute); }
.sample-note .link { color: var(--mute); margin-left: 4px; }

/* ---------- pages (Gantt, Ledger) ---------- */
.page { padding: 110px 40px 48px; min-height: 100vh; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 26px; flex-wrap: wrap; }
.page-head h1 { font-size: 44px; line-height: 1; }
.page-tools { display: flex; gap: 10px; align-items: center; }
.hint { color: var(--mute); font-size: 13px; margin: 12px 0 0; }
.seg { display: inline-flex; border: 1.5px solid var(--ink); }
.seg button { border: 0; background: transparent; height: 34px; padding: 0 14px; font-size: 13.5px; }
.seg button[aria-pressed="true"] { background: var(--ink); color: #fff; }

/* gantt: the same black bars, laid on a calendar */
.gantt { --label-w: 240px; --dpx: 26px; --row-h: 46px; --head-h: 56px; border-top: 1.5px solid var(--ink); overflow: auto; position: relative; max-height: calc(100vh - 220px); }
.g-inner { position: relative; min-width: 100%; }
.g-head { position: sticky; top: 0; z-index: 6; display: flex; background: var(--paper); border-bottom: 1px solid var(--line); height: var(--head-h); }
.g-corner { position: sticky; left: 0; z-index: 7; width: var(--label-w); flex: none; background: var(--paper); padding: 10px 0; display: flex; align-items: flex-end; font-size: 13px; color: var(--mute); }
.g-scale { position: relative; flex: none; }
.g-month { position: absolute; top: 6px; font-size: 13px; font-weight: 600; padding-left: 6px; border-left: 1.5px solid var(--ink); height: 20px; white-space: nowrap; }
.g-dayn { position: absolute; bottom: 6px; width: var(--dpx); text-align: center; font-size: 11.5px; color: var(--mute); }
.g-dayn.wk { color: #B5B5B5; }
.g-dayn.today { color: #fff; font-weight: 500; }
.g-dayn.today::before { content: ''; position: absolute; left: 50%; top: 50%; width: 22px; height: 18px; transform: translate(-50%,-50%); background: var(--gold); z-index: -1; }
.g-body { position: relative; }
.g-bg { position: absolute; top: 0; bottom: 0; left: var(--label-w); pointer-events: none; }
.g-wkend { position: absolute; top: 0; bottom: 0; background: #FAFAFA; }
.g-weekline { position: absolute; top: 0; bottom: 0; width: 1px; background: var(--line); }
.g-todayline { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--gold); z-index: 3; }
.g-row { display: flex; height: var(--row-h); position: relative; }
.g-label { position: sticky; left: 0; z-index: 5; width: var(--label-w); flex: none; background: var(--paper); padding-right: 14px; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.g-label:hover .gl-title { text-decoration: underline; text-underline-offset: 3px; }
.gl-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 14px; flex: 1; }
.gl-pct { font-size: 12px; color: var(--mute); }
.g-row.project { height: 44px; }
.g-row.project .g-label { cursor: default; }
.g-row.project .gl-title { font-weight: 600; font-size: 16px; text-decoration: none; }
.g-track { position: relative; flex: none; }
.g-span { position: absolute; top: 27px; height: 3px; background: var(--ink); }
.g-bar { position: absolute; top: 15px; height: 16px; background: var(--line); cursor: grab; touch-action: none; user-select: none; z-index: 4; }
.g-bar .fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--ink); }
.g-bar.done .fill { background: #8C8C8C; }
.g-bar.blocked { background: #F2D6D1; }
.g-bar.blocked .fill { background: var(--red); }
.g-bar.planned { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); }
.g-bar .txt { position: absolute; left: 100%; top: 50%; translate: 0 -50%; padding-left: 10px; font-size: 12.5px; white-space: nowrap; pointer-events: none; color: var(--ink-2); }
.g-bar.done .txt { color: var(--mute); }
.g-bar .h { position: absolute; top: -4px; bottom: -4px; width: 9px; cursor: ew-resize; }
.g-bar .h.l { left: -4px; } .g-bar .h.r { right: -4px; }
.g-bar.dragging { cursor: grabbing; outline: 2px solid var(--gold); outline-offset: 2px; }
.g-bar.milestone { background: none; box-shadow: none; width: 18px !important; margin-left: -9px; top: 14px; height: 18px; }
.g-bar.milestone::before { content: ''; position: absolute; inset: 3px; background: var(--ink); transform: rotate(45deg); }
.g-bar.flash { animation: flash 1.2s var(--ease); }
@keyframes flash { 30% { outline: 3px solid var(--gold); outline-offset: 4px; } }
.g-rem { position: absolute; top: 3px; width: 3px; height: 12px; margin-left: -1.5px; background: var(--gold); z-index: 5; cursor: pointer; transform-origin: bottom; }
.g-rem::before { content: ''; position: absolute; left: -3.5px; top: -3px; width: 10px; height: 8px; background: inherit; }
.g-rem:hover { outline: 2px solid var(--gold); outline-offset: 3px; }
.g-rem.late { background: var(--red); }
.g-rem.done { background: var(--faint); }
.g-row.project .g-rem { top: 14px; height: 16px; }
.g-upd { position: absolute; top: 36px; width: 5px; height: 5px; margin-left: -2.5px; background: var(--ink); z-index: 4; transform-origin: top; }
.g-over { position: absolute; top: 8px; height: 0; border-top: 1.5px dashed var(--gold); z-index: 3; }
.g-legend { display: flex; gap: 18px; flex-wrap: wrap; }
.g-legend i { display: inline-block; vertical-align: middle; margin-right: 6px; }
.g-legend .lg-rem { width: 3px; height: 14px; background: var(--gold); }
.g-legend .lg-upd { width: 5px; height: 5px; background: var(--ink); }
.g-legend .lg-over { width: 22px; border-top: 1.5px dashed var(--gold); }
.g-tip { position: fixed; z-index: 60; background: var(--ink); color: #fff; font-size: 12.5px; padding: 5px 9px; pointer-events: none; white-space: nowrap; }
.g-empty { padding: 60px 0; color: var(--mute); }

/* ledger */
.ledger-sum { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); margin-bottom: 28px; }
.ledger-sum button { background: none; border: 0; border-right: 1px solid var(--line); padding: 16px 16px 14px 0; text-align: left; display: flex; flex-direction: column; }
.ledger-sum button + button { padding-left: 16px; }
.ledger-sum button:last-child { border-right: 0; }
.ledger-sum button[aria-pressed="true"] { box-shadow: inset 0 3px 0 var(--ink); }
.ls-name { font-size: 13px; color: var(--mute); }
.ls-amt { font-size: 22px; font-weight: 600; line-height: 1.3; }
.ls-n { font-size: 12px; color: var(--mute); }
.table-wrap { overflow-x: auto; }
.ledger { width: 100%; border-collapse: collapse; font-size: 14px; }
.ledger th { text-align: left; font-weight: 400; color: var(--mute); font-size: 13px; padding: 8px 10px 8px 0; border-bottom: 1.5px solid var(--ink); white-space: nowrap; }
.ledger td { padding: 13px 10px 13px 0; border-bottom: 1px solid var(--line); vertical-align: middle; }
.ledger .num { text-align: right; white-space: nowrap; padding-right: 24px; }
.ledger td.desc { cursor: pointer; font-weight: 500; }
.ledger td.desc:hover { text-decoration: underline; text-underline-offset: 3px; }
.ledger tfoot td { border-bottom: 0; font-weight: 600; }
.status { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; white-space: nowrap; }
.status i { width: 14px; height: 5px; background: var(--ink); }
.status.draft i { background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--ink); }
.status.submitted i { background: var(--faint); }
.status.approved i { background: var(--gold); }
.status.paid i { background: var(--ink); }
.status.rejected i { background: var(--red); }
.receipt-current { font-size: 13px; color: var(--mute); }

/* ---------- drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(255,255,255,.6); z-index: 60; animation: fade .2s; }
@keyframes fade { from { opacity: 0; } }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(500px, 100vw); background: var(--paper); z-index: 61; border-left: 1.5px solid var(--ink); transform: translateX(102%); transition: transform .42s var(--ease); overflow-y: auto; padding: 24px 28px 40px; }
.drawer.open { transform: none; }
.drawer form { display: flex; flex-direction: column; gap: 16px; }
.drawer-head { display: flex; gap: 10px; align-items: center; }
.title-input { flex: 1; font-size: 26px; font-weight: 600; border-bottom-width: 3px; border-bottom-color: var(--ink); }
.row-actions { display: flex; gap: 8px; align-items: center; margin-top: 4px; flex-wrap: wrap; }
.drawer-section { margin-top: 30px; }
.drawer-section h2 { font-size: 18px; margin: 0 0 10px; }
.drawer-section h2:not(:first-child) { margin-top: 28px; }
.update-form { display: flex; flex-direction: column; gap: 8px; }
.update-row { display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.updates { list-style: none; margin: 18px 0 0; padding: 0; }
.updates li { display: grid; grid-template-columns: 26px 1fr; gap: 10px; padding-bottom: 14px; }
.updates li::before { content: ''; height: 5px; background: var(--ink); margin-top: 9px; }
.updates li:not(:first-child)::before { background: var(--faint); width: 18px; }
.u-when { font-size: 12px; color: var(--mute); }
.u-text { font-size: 14.5px; white-space: pre-wrap; }
.u-pct { margin-left: 6px; color: var(--ink); font-weight: 500; }
.u-del { font-size: 12px; color: var(--mute); background: none; border: 0; padding: 0; margin-left: 8px; text-decoration: underline; }
.updates:empty::after { content: 'No updates yet.'; color: var(--mute); font-size: 14px; }
.mini-reminders { list-style: none; padding: 0; margin: 0 0 10px; }
.mini-reminders li { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--line); }
.mr-time { font-weight: 600; font-size: 15px; }
.mr-title { font-size: 14px; }
.mr-when { font-size: 12.5px; color: var(--mute); }
.mini-reminders:empty { display: none; }

/* ---------- modals ---------- */
.modal { border: 1.5px solid var(--ink); border-radius: 0; padding: 0; width: min(560px, calc(100vw - 32px)); color: var(--ink); background: var(--paper); }
.modal.wide { width: min(940px, calc(100vw - 32px)); }
.modal::backdrop { background: rgba(255,255,255,.72); }
.modal[open] { animation: pop .32s var(--ease); }
@keyframes pop { from { opacity: 0; transform: translateY(10px); } }
.modal form { padding: 24px 28px; display: flex; flex-direction: column; gap: 16px; }
.modal-head { display: flex; align-items: center; justify-content: space-between; }
.modal-head h2 { font-size: 22px; }

.picker { display: grid; grid-template-columns: 330px 1fr; gap: 34px; }
.picker-col { position: relative; height: 440px; margin-left: -28px; overflow: hidden; }
.picker-rail { position: absolute; inset: 0; cursor: grab; touch-action: none; user-select: none; outline: none; }
.picker-rail:focus-visible { box-shadow: inset 3px 0 0 var(--gold); }
.picker-rail .br-c1 { color: var(--mute); }
.picker-heading { position: absolute; left: 196px; top: 50%; transform: translateY(-50%); pointer-events: none; }
.picker-heading b { display: block; font-size: 40px; line-height: 1; font-weight: 600; letter-spacing: -.02em; }
.picker-heading small { display: block; font-size: 12.5px; color: var(--mute); margin-top: 6px; }
.picker-fields { display: flex; flex-direction: column; gap: 16px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { border: 1.5px solid var(--faint); background: var(--paper); height: 30px; padding: 0 11px; font-size: 12.5px; }
.chip:hover { border-color: var(--ink); }

/* ---------- toasts ---------- */
.toasts { position: fixed; right: 24px; bottom: 60px; display: flex; flex-direction: column; gap: 10px; z-index: 90; }
.toast { background: var(--paper); border: 1.5px solid var(--ink); padding: 12px 16px 12px 0; width: 340px; display: grid; grid-template-columns: 34px 1fr; gap: 12px; animation: toastIn .4s var(--ease); }
.toast::before { content: ''; height: 6px; background: var(--ink); margin-top: 9px; transform-origin: left; animation: barIn .6s cubic-bezier(.3,1.3,.5,1) .08s backwards; }
.toast.alarm::before { background: var(--gold); animation: barIn .6s cubic-bezier(.3,1.3,.5,1) .08s backwards, pulse 1.6s ease-in-out .7s 3; }
@keyframes barIn { from { transform: scaleX(0); } }
@keyframes pulse { 50% { opacity: .35; } }
@keyframes toastIn { from { opacity: 0; transform: translateX(16px); } }
.t-title { font-weight: 600; font-size: 14.5px; }
.t-sub { font-size: 12.5px; color: var(--mute); }
.t-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- small screens ---------- */
@media (max-width: 820px) {
  .top { left: 0; padding: 10px 12px 0; gap: 8px; flex-wrap: wrap; background: var(--paper); }
  .filters { order: 3; width: 100%; overflow-x: auto; }
  .views { padding-left: 0; border-left: 0; margin-right: auto; }
  .filters button, .views button { font-size: 13px; padding: 6px 6px; }
  .timeline { position: relative; inset: auto; min-height: 100vh; overflow: visible; }
  .tl-rail { position: relative; width: 100%; height: 58vh; margin-top: 88px; }
  .br-c1 { display: none; }
  .tl-panel { position: static; padding: 24px 18px 90px; }
  .tl-now { position: fixed; }
  .sample-note { position: static; text-align: center; padding-bottom: 20px; }
  .page { padding: 110px 16px 40px; }
  .gantt { --label-w: 150px; }
  .ledger-sum { grid-template-columns: repeat(2, 1fr); }
  .picker { grid-template-columns: 1fr; }
  .picker-col { height: 300px; }
  .toasts { left: 16px; right: 16px; bottom: 16px; }
  .toast { width: auto; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* ---------- quick add ---------- */
.modal.qa { width: min(760px, calc(100vw - 32px)); margin-top: 16vh; }
.modal.qa::backdrop { background: rgba(255,255,255,.82); }
.modal.qa form { padding: 26px 30px 22px; gap: 14px; }
.qa-input { font-size: 26px; font-weight: 500; border-bottom: 3px solid var(--ink); padding: 6px 0 10px; letter-spacing: -.01em; }
.qa-kinds { display: flex; gap: 2px; flex-wrap: wrap; }
.qa-kinds button { background: none; border: 0; font-size: 12.5px; color: var(--mute); padding: 4px 8px; position: relative; }
.qa-kinds button[aria-pressed="true"] { color: #fff; }
.qa-kinds button[aria-pressed="true"]::before { content: ''; position: absolute; inset: 0; background: var(--ink); z-index: -1; animation: chipIn .28s var(--ease); }
.qa-kinds button { z-index: 0; }
@keyframes chipIn { from { transform: scaleX(.3); opacity: 0; } }
.qa-preview { display: flex; align-items: baseline; gap: 12px; min-height: 30px; flex-wrap: wrap; }
.qa-bar { align-self: center; height: 8px; width: 16px; background: var(--faint); transition: width .45s cubic-bezier(.3,1.3,.5,1), background .2s; flex: none; }
.qa-preview.ok .qa-bar { width: 64px; background: var(--ink); }
.qa-k { font-size: 12.5px; color: var(--mute); }
.qa-t { font-weight: 600; font-size: 17px; }
.qa-d { font-size: 14px; color: var(--ink-2); }
.qa-preview:not(.ok):not(.empty) .qa-d { color: var(--red); }
.qa-preview.empty .qa-d { color: var(--mute); }
.qa-p { font-size: 12px; border: 1px solid var(--ink); padding: 0 7px; }
.qa-hint { font-size: 12.5px; color: var(--mute); line-height: 1.6; }
.qa-hint b { font-weight: 500; color: var(--ink-2); }

/* ---------- close the day, week report, calendars ---------- */
.lede { margin: -4px 0 4px; color: var(--ink-2); font-size: 14.5px; }
#close-tasks h3, #close-rems h3 { font-size: 14px; font-weight: 600; margin: 8px 0 4px; }
.ct { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.6fr) 80px; gap: 16px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.ct-name b { display: block; font-weight: 500; font-size: 14px; }
.ct-name small { display: block; font-size: 12px; color: var(--mute); }
.ct-track { display: block; height: 5px; background: var(--line); margin-top: 6px; }
.ct-track i { display: block; height: 100%; background: var(--ink); }
.ct-pct { justify-content: flex-end; }
.cr { display: flex; flex-direction: row; gap: 12px; align-items: flex-start; padding: 9px 0; border-bottom: 1px solid var(--line); color: var(--ink); cursor: pointer; }
.cr input { margin-top: 4px; accent-color: var(--ink); }
.cr b { display: block; font-weight: 500; font-size: 14px; }
.cr small { display: block; font-size: 12px; color: var(--mute); }
.week-text { width: 100%; height: min(56vh, 520px); font: 13.5px/1.6 ui-monospace, 'SF Mono', Menlo, monospace; border: 1.5px solid var(--ink); padding: 14px 16px; white-space: pre; overflow: auto; color: var(--ink); }
#week-proj { font-size: 13.5px; }
.steps { margin: 0; padding-left: 20px; font-size: 13.5px; color: var(--ink-2); line-height: 1.7; }
.cal-row { display: grid; grid-template-columns: 26px 1fr auto auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.cal-bar { height: 6px; box-shadow: inset 0 0 0 2px var(--ink); }
.cal-bar.err { box-shadow: inset 0 0 0 2px var(--red); }
.cal-row b { display: block; font-weight: 500; font-size: 14px; }
.cal-row small { display: block; font-size: 12px; color: var(--mute); }
.cal-add { margin-top: 6px; }

/* ---------- projects ---------- */
.projects { padding-left: 0; padding-right: 0; }
.pj { display: grid; grid-template-columns: 300px 1fr; min-height: calc(100vh - 110px); }
.pj-list { padding: 8px 0 40px; border-right: 1px solid var(--line); }
.pj-cat { font-size: 12.5px; color: var(--mute); padding: 18px 24px 6px 0; margin-left: 150px; }
.pj-row { display: grid; grid-template-columns: 150px 1fr; align-items: center; width: 100%; background: none; border: 0; text-align: left; padding: 9px 20px 9px 0; position: relative; }
.pj-bar { height: 12px; background: var(--faint); width: calc(36px + var(--p) * 1px); transition: width .5s cubic-bezier(.3,1.25,.5,1), background .3s; }
.pj-row:hover .pj-bar { width: calc(48px + var(--p) * 1px); background: #9A9A9A; }
.pj-row.sel .pj-bar { width: 138px; background: var(--ink); }
.pj-name { grid-column: 2; font-size: 14.5px; line-height: 1.3; padding-left: 0; }
.pj-row.sel .pj-name { font-weight: 600; }
.pj-n { grid-column: 2; font-size: 12px; color: var(--mute); }
.pj-addp { margin: 18px 0 0 150px; font-size: 13.5px; }
.pj-detail { padding: 8px 40px 60px; min-width: 0; }
.pjd-cat { font-size: 13px; color: var(--mute); }
.pjd-title { font-size: clamp(32px, 3.2vw, 52px); line-height: 1.05; margin: 2px 0 6px; }
.pjd-note { margin: 0 0 8px; color: var(--ink-2); max-width: 60ch; }
.pjd-actions { display: flex; gap: 6px; margin-top: 8px; }
.pjd-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-top: 1.5px solid var(--ink); margin: 26px 0 8px; }
.pjd-stats > div { padding: 12px 16px 12px 0; border-right: 1px solid var(--line); }
.pjd-stats > div + div { padding-left: 16px; }
.pjd-stats > div:last-child { border-right: 0; }
.pjd-stats span { display: block; font-size: 12.5px; color: var(--mute); }
.pjd-stats b { font-size: 22px; font-weight: 600; }
.pjd-meter { display: block; height: 4px; background: var(--line); margin-top: 4px; }
.pjd-meter i { display: block; height: 100%; background: var(--ink); }
.pjd-sec { margin-top: 30px; min-width: 0; }
.pjd-sec h2 { font-size: 18px; display: flex; align-items: baseline; gap: 12px; border-bottom: 1.5px solid var(--ink); padding-bottom: 6px; margin-bottom: 10px; }
.pjd-sec h2 small { font-size: 13px; color: var(--mute); font-weight: 400; }
.pjd-sec h2 .link { font-size: 13px; font-weight: 400; margin-left: auto; }
.pjd-boards { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 36px; }
.pt-list { display: flex; flex-direction: column; }
.pt-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) 150px; gap: 16px; align-items: center; background: none; border: 0; border-bottom: 1px solid var(--line); padding: 9px 0; text-align: left; }
.pt-row:hover .pt-name { text-decoration: underline; text-underline-offset: 3px; }
.pt-name { font-size: 14px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pt-track { height: 8px; background: var(--line); }
.pt-track i { display: block; height: 100%; background: var(--ink); transition: width .6s var(--ease); }
.rm-row { grid-template-columns: minmax(0, 1fr) auto; }
.rm-row.late .pt-meta { color: var(--red); }
.pt-row.done .pt-track i { background: #8C8C8C; }
.pt-row.blocked .pt-track i { background: var(--red); }
.pt-meta { font-size: 12.5px; color: var(--mute); text-align: right; }
.pj-add { display: flex; gap: 10px; align-items: flex-end; margin-bottom: 12px; }
.pj-add input { flex: 1; font-size: 14px; }
.pj-add input[name="title"] { flex: .6; }
.pj-add textarea { flex: 1; font-size: 14px; min-height: 44px; }
.pj-search { width: 100%; font-size: 13.5px; margin-bottom: 10px; }
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 10px; }
.card { position: relative; border: 1.5px solid var(--line); padding: 12px 14px 10px; display: flex; flex-direction: column; gap: 8px; transition: border-color .2s, transform .2s var(--ease); overflow: hidden; }
.card:hover { border-color: var(--ink); }
.card.pinned { border-color: var(--ink); box-shadow: inset 4px 0 0 var(--ink); }
.card-main { text-decoration: none; color: var(--ink); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.card-title { font-weight: 500; font-size: 14.5px; line-height: 1.3; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.card-main:hover .card-title { text-decoration: underline; text-underline-offset: 3px; }
.card-sub { font-size: 12px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.card-acts { display: flex; gap: 2px; opacity: .0; transition: opacity .2s; margin-left: -6px; }
.card:hover .card-acts, .card:focus-within .card-acts { opacity: 1; }
.card-acts button { background: none; border: 0; font-size: 12px; color: var(--mute); padding: 2px 6px; }
.card-acts button:hover { color: var(--ink); }
.clip-body { background: none; border: 0; padding: 0; text-align: left; cursor: copy; }
.clip-text { display: -webkit-box; -webkit-line-clamp: 6; -webkit-box-orient: vertical; overflow: hidden; white-space: pre-wrap; font-size: 13.5px; line-height: 1.45; color: var(--ink); }
.copied { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: var(--ink); transform: scaleX(0); transform-origin: left; }
.card.did-copy::after { content: 'Copied'; position: absolute; right: 10px; top: 8px; font-size: 11.5px; font-weight: 500; background: var(--ink); color: #fff; padding: 1px 7px; animation: fade .2s; }
.inline-edit { width: 100%; font-size: 14px; border: 1.5px solid var(--ink); padding: 6px 8px; }

@media (max-width: 1100px) {
  .pjd-boards { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .top { align-items: stretch; }
  .top-row { flex-wrap: wrap; gap: 6px; }
  .top-row.sub { justify-content: space-between; }
  #btn-quick, #btn-notify { display: none; }
  .views button { padding: 6px 5px; }
  .tl-rail { margin-top: 120px; }
  .pj { grid-template-columns: 1fr; }
  .pj-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .pj-detail { padding: 8px 16px 60px; }
  .pjd-stats { grid-template-columns: repeat(2, 1fr); }
  .pt-row { grid-template-columns: 1fr 90px; }
  .pt-meta { display: none; }
  .ct { grid-template-columns: 1fr; gap: 6px; }
  .modal.qa { margin-top: 8vh; }
  .qa-input { font-size: 20px; }
}

/* ---------- licence (paywall.js) ---------- */
.ck-lic { position: fixed; left: 24px; bottom: 18px; z-index: 45; display: flex; align-items: center; gap: 10px; max-width: calc(100vw - 48px); font-size: 13px; color: var(--mute); background: var(--paper); padding: 6px 10px 6px 0; }
.ck-lic i { display: block; width: 22px; height: 6px; background: var(--ink); flex: none; }
.ck-lic.quiet i { background: var(--faint); }
.ck-lic.ro { color: var(--ink); border: 1.5px solid var(--ink); padding: 8px 12px 8px 0; }
.ck-lic.ro i { background: var(--red); }
.ck-lic .link { font-size: 13px; font-weight: 500; white-space: nowrap; }
.ck-lic-modal h3 { font-size: 15px; font-weight: 600; margin: 4px 0 8px; }
.ck-lic-modal section { display: flex; flex-direction: column; gap: 10px; border-top: 1px solid var(--line); padding-top: 14px; }
.ck-lic-modal textarea { font: 500 12.5px/1.5 ui-monospace, Menlo, monospace; word-break: break-all; }
.ck-pay-row { display: flex; flex-wrap: wrap; gap: 10px; }
.ck-wait { font-size: 13.5px; color: var(--ink-2); }
body.ck-readonly #btn-new, body.ck-readonly #btn-quick { opacity: .45; }
@media (max-width: 820px) { .ck-lic { left: 16px; bottom: 12px; } }
