/* The records desk (packages/ui/desk.js): the pieces every records app draws the same way — the period pill, the strip
   chips, the segmented control, the source badge, the status pill, the original's frame, the checks, the held write.
   The look is Rēķini's desk (design A · Galds), so the apps read as one product. Colours carry four meanings only:
   plum = the one primary action, sage = done, peach = needs a person, cream = a question or a wait. */
.dk-seg { display: inline-flex; gap: 2px; padding: 3px; border-radius: 12px; background: rgba(31, 16, 38, .06); max-width: 100%; }
.dk-seg button { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 0 12px; border: 0; border-radius: 9px; background: none; font: 600 13.5px/1 var(--bc-text); color: var(--bc-ink-2); cursor: pointer; white-space: nowrap; }
.dk-seg button.on { background: #fff; color: var(--bc-ink); box-shadow: 0 2px 8px -4px rgba(31, 16, 38, .3); }
.dk-seg button b { padding: 1px 7px; border-radius: 999px; background: #FBE7DC; color: #9A4B22; font-size: 12px; }
.dk-seg--sm button { min-height: 28px; padding: 0 10px; font-size: 12.5px; }

/* the period pill */
.dk-per { position: relative; display: inline-flex; align-items: center; gap: 2px; padding: 3px; border-radius: 12px; background: #fff; box-shadow: inset 0 0 0 1px rgba(31, 16, 38, .1); }
.dk-per-s { width: 28px; height: 30px; border: 0; border-radius: 8px; background: rgba(31, 16, 38, .05); font: 600 16px/1 var(--bc-text); color: var(--bc-ink-2); cursor: pointer; }
.dk-per-s:disabled { opacity: .35; cursor: default; }
.dk-per-l { display: inline-flex; align-items: baseline; gap: 8px; padding: 0 8px; min-height: 30px; border: 0; border-radius: 8px; background: none; font: inherit; color: var(--bc-ink); cursor: pointer; white-space: nowrap; }
.dk-per-l b { font: 700 15px/1 var(--bc-display); }
.dk-per-l small { font-size: 12.5px; color: var(--bc-ink-3); }
.dk-per-l i { font-style: normal; font-size: 10px; color: var(--bc-ink-3); }
.dk-menu { position: absolute; top: calc(100% + 6px); left: 0; z-index: 20; display: grid; gap: 2px; min-width: 240px; padding: 8px; border-radius: 16px; background: #fff; box-shadow: var(--bc-float); }
.dk-menu > button, .dk-menu > label { display: flex; align-items: center; gap: 8px; padding: 9px 12px; border: 0; border-radius: 10px; background: none; text-align: left; font: 500 14px/1.2 var(--bc-text); color: var(--bc-ink); cursor: pointer; }
.dk-menu > button:hover, .dk-menu > button.on, .dk-menu > label:hover { background: var(--bc-plum-tint); }
.dk-menu > button small { margin-left: auto; color: var(--bc-ink-3); font-size: 12px; }
.dk-per-c { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; margin-top: 4px; padding: 10px 6px 4px; border-top: 1px solid var(--bc-line); }
.dk-per-c > span { grid-column: 1 / -1; font-size: 12.5px; font-weight: 600; color: var(--bc-ink-2); }
.dk-per-c label { display: grid; gap: 3px; font-size: 11.5px; color: var(--bc-ink-3); }
.dk-per-c input { padding: 6px 8px; border: 1px solid var(--bc-line); border-radius: 8px; font: inherit; font-size: 13px; }
.dk-per-c button { grid-column: 1 / -1; justify-content: center; }

/* the strip: the period's numbers, each a filter */
.dk-strip { display: flex; align-items: center; gap: 6px; flex-wrap: nowrap; }
.dk-chip { display: inline-flex; align-items: center; gap: 6px; min-height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: 999px; background: rgba(255, 255, 255, .85); box-shadow: inset 0 0 0 1px rgba(31, 16, 38, .07); font: 400 13.5px/1 var(--bc-text); color: var(--bc-ink-2); cursor: pointer; white-space: nowrap; }
.dk-chip b { font: 700 14.5px/1 var(--bc-display); color: var(--bc-ink); font-variant-numeric: tabular-nums; }
.dk-chip i { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dk-chip.on { background: var(--bc-plum-tint); border-color: #DCD2EA; box-shadow: none; color: var(--bc-plum); }
.dk-chip.sk { min-width: 120px; color: transparent; background: rgba(255, 255, 255, .6); cursor: default; }
.dk-chip--all { cursor: default; }
.dk-chip--good b { color: var(--bc-sage); }
.dk-chip--todo { margin-left: auto; background: #FBE7DC; color: #9A4B22; box-shadow: none; }
.dk-chip--todo b { color: #9A4B22; }
.dk-chip--quiet { background: none; box-shadow: none; color: var(--bc-ink-3); }
.dk-chip:focus-visible, .dk-seg button:focus-visible, .dk-per button:focus-visible { outline: 2px solid var(--bc-focus); outline-offset: 2px; }
.dk-x { margin: 0 -4px 0 2px; padding: 0 4px; border: 0; background: none; font-size: 16px; line-height: 1; color: inherit; cursor: pointer; }
.dk-link { padding: 4px 6px; border: 0; background: none; font: 500 13px/1.2 var(--bc-text); color: var(--bc-ink-2); cursor: pointer; text-decoration: underline; text-decoration-color: rgba(31, 16, 38, .2); text-underline-offset: 3px; }
.dk-link:hover { color: var(--bc-plum); }
.dk-outside { margin: -4px 0 0; font-size: 12.5px; color: var(--bc-ink-3); }
.dk-outside b { color: var(--bc-ink-2); font-variant-numeric: tabular-nums; }

/* the source badge and the status pill */
.dk-src { display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; background: #ECE6F7; color: var(--bc-plum); font: 700 11px/1 var(--bc-text); flex: none; }
.dk-src--arch { background: #F4EDDD; color: #7A5A16; }
.dk-src--photo { background: #E0F0E6; color: #2f6b45; }
.dk-src--mail { background: #E3EEF7; color: #1d5a86; }
.dk-src--xml { background: #E8F0E4; color: var(--bc-sage); }
.dk-src--app { background: #EAE6F2; color: #4A1D57; }
.dk-src--unknown { background: #EEECF1; color: var(--bc-ink-3); }
.dk-pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 8px; border-radius: 999px; font: 600 11.5px/1.2 var(--bc-text); font-style: normal; white-space: nowrap; }
.dk-pill::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; opacity: .8; }
.dk-pill--wait { background: #F4EDDD; color: #7A5A16; }
.dk-pill--wait::before { background: #C9A227; opacity: 1; }
.dk-pill--done { background: var(--bc-sage-tint); color: var(--bc-sage); }
.dk-pill--ours { background: #EFEAF6; color: var(--bc-plum); }
.dk-pill--person { background: #FBE7DC; color: #9A4B22; }
.dk-pill--off { background: #EEECF1; color: var(--bc-ink-3); }
.dk-pill--draft { background: #F1E9E1; color: #7d5537; }   /* ours, not out yet — Rēķini's Melnraksts */
.dk-pill--ink { background: #EEECF1; color: var(--bc-ink-2); }

/* the original: the stored file at page ratio, or the honest sentence */
.dk-orig { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 6px; min-width: 0; }
.dk-orig figcaption { display: flex; align-items: center; gap: 6px; min-height: 26px; font-size: 12px; color: var(--bc-ink-3); }
.dk-orig figcaption span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.dk-full { display: inline-grid; place-items: center; width: 26px; height: 26px; border-radius: 8px; background: rgba(31, 16, 38, .06); color: var(--bc-ink-2); }
.dk-full .bc-icon { width: 14px; height: 14px; transform: rotate(-45deg); }
.dk-page { position: relative; aspect-ratio: 1 / 1.414; border-radius: 6px; overflow: hidden; background: #DEDAE4 linear-gradient(90deg, #DEDAE4, #E9E6EE, #DEDAE4); background-size: 200% 100%; animation: dk-sk 1.6s linear infinite; }
.dk-page iframe { position: absolute; inset: 0; width: 100%; height: 100%; border: 0; background: transparent; }
.dk-page--pic a { display: block; height: 100%; }
.dk-page--pic img { display: block; width: 100%; height: 100%; object-fit: contain; background: transparent; }
.dk-page--pic.is-loaded { animation: none; background: #fff; }
.dk-page.is-failed { animation: none; display: grid; place-items: center; }
.dk-page.is-failed a { display: none; }
.dk-page-fail { margin: 0; padding: 16px; font-size: 13px; color: var(--bc-ink-2); text-align: center; }
.dk-page--none { display: grid; place-items: center; aspect-ratio: auto; min-height: 160px; animation: none; background: #F1EEF4; }
.dk-page--none p { display: flex; align-items: flex-start; gap: 10px; margin: 0; padding: 18px; font-size: 13px; line-height: 1.45; color: var(--bc-ink-2); }
.dk-page--none p > span { display: grid; gap: 6px; }
.dk-page--none small { font-size: 12px; color: var(--bc-ink-3); }
.dk-page--none .bc-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.dk-own { border-radius: 8px; background: #fff; box-shadow: 0 0 0 1px rgba(31, 16, 38, .08), 0 12px 26px -20px rgba(31, 16, 38, .4); }
@keyframes dk-sk { to { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) { .dk-page { animation: none; } }

/* checks */
.dk-checks { display: flex; flex-wrap: wrap; gap: 6px; }
.dk-ck { padding: 5px 10px; border-radius: 999px; font: 600 12px/1.25 var(--bc-text); }
.dk-ck--ok { background: var(--bc-sage-tint); color: var(--bc-sage); }
.dk-ck--q { background: #F4EDDD; color: #7A5A16; }
.dk-ck--no { background: #FBE7DC; color: #9A4B22; }

/* a write the platform cannot make yet: present, quiet, and on press it says why */
.dk-held, .dk-menu > button.dk-held { position: relative; color: var(--bc-ink-3) !important; background: rgba(31, 16, 38, .045) !important; box-shadow: none !important; cursor: not-allowed; }
.dk-menu > button.dk-held { background: none !important; }
.dk-held:hover { color: var(--bc-ink-2) !important; }
.dk-held--say::after { content: attr(data-say); position: absolute; z-index: 30; left: 0; top: calc(100% + 6px); width: max-content; max-width: 280px; padding: 8px 10px; border-radius: 10px; background: var(--bc-ink); color: #fff; font: 500 12px/1.4 var(--bc-text); text-align: left; white-space: normal; opacity: 1; animation: dk-say 3.2s forwards; pointer-events: none; }
@keyframes dk-say { 0%, 85% { opacity: 1; } 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .dk-held--say::after { animation: none; } }

/* ── the frame every records app shares (lifted from Rēķini's design review, 2026-09-23). The app's column is the container
   named `dk` (Rēķini: `.iv`, Akti: `.ak`), so the same widths break the same way in every app. ── */
/* the top stays while the list scrolls: toolbar + strip; on the phone nothing sticks but the bottom bar */
.dk-top { position: sticky; top: -14px; z-index: 6; display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; margin: -14px -18px 0; padding: 14px 18px 10px; background: #FBFAFC; box-shadow: 0 10px 14px -14px rgba(31, 16, 38, .25); }
/* two toolbar rows below 1180 px: title · segments / period · search · the one plum button, always the same break */
.dk-bar-br { display: none; }
@container dk (max-width: 1180px) { .dk-bar-br { display: block; flex-basis: 100%; height: 0; } .dk-new { margin-left: auto; } }
/* the strip is one row: its chips scroll inside it, and what needs a person stays pinned at the end, never scrolled away */
.dk-strip-s { display: flex; align-items: center; gap: 6px; min-width: 0; flex: 1 1 auto; overflow-x: auto; scrollbar-width: none; padding: 1px 2px 2px; mask-image: linear-gradient(90deg, #000 calc(100% - 28px), transparent); }
.dk-strip-s::-webkit-scrollbar { display: none; }
.dk-strip-s > * { flex: none; }
.dk-strip > .dk-pin { flex: none; margin-left: 6px; }
/* a row never hides its fact: two lines, the number whole */
.dk-row { align-items: start; }
.dk-row-b b, .dk-row-b > small { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; overflow: hidden; }
.dk-row-b b small { white-space: nowrap; }
.dk-row-r { align-self: start; }
@container dk (max-width: 700px) { .dk-top { position: static; box-shadow: none; } .dk-bar-br { display: none; } }
