/* One Talibon: Documents module. Everything is prefixed docs- / dp- so nothing leaks into other modules. */

/* ------------------------------------------------------------ inbox */
.docs-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s4); flex-wrap: wrap; }
.docs-bar .search { flex: 1 1 280px; max-width: 380px; }
.docs-count { font-size: var(--fs-sm); color: var(--muted); }
.docs-cell { min-width: 0; max-width: 560px; }
.docs-title { font-weight: 650; color: var(--head); text-decoration: none; line-height: 1.35; display: inline-block; }
.docs-title:hover { text-decoration: underline; color: var(--link); }
.docs-sub { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.docs-with { font-weight: 600; color: var(--ink); }
.docs-age { font-variant-numeric: tabular-nums; color: var(--ink-2); }
.docs .tbl td { vertical-align: middle; }
.docs .tbl th { white-space: nowrap; }
.docs-quiet { display: inline-flex; align-items: center; gap: 8px; margin: 0; font-size: var(--fs-sm); color: var(--muted); }
.docs-quiet .icon { flex: none; }

/* ------------------------------------------------------------ detail header */
.docs-head .card-body { padding: var(--s6); }
.docs-badges { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.docs-id { font-size: var(--fs-sm); font-weight: 700; color: var(--muted); letter-spacing: .03em; margin-right: 4px; }
.docs-h { font-size: 26px; line-height: 1.25; max-width: 62ch; }
.docs-summary { color: var(--ink-2); max-width: 70ch; margin: 0; }
.docs-h { margin: 6px 0 2px; }
.docs-kvs { border-top: 1px solid var(--line); padding-top: var(--s4); }
.docs-kvs .kv { grid-template-columns: max-content minmax(0, 1fr) max-content minmax(0, 1fr); gap: 12px 24px; }
.docs-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: var(--s4); }
.docs-band { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--sea-50); border: 1px solid var(--sea-200); border-radius: var(--r-md); color: var(--link); }
.docs-band .b-k { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.docs-band .b-v { font-weight: 650; color: var(--head); }

/* ------------------------------------------------------------ time spent */
.docs-glances { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--s3); }
.docs-glance { border: 1px solid var(--line); border-radius: var(--r-md); padding: 14px 16px; background: var(--page); }
.docs-glance .g-label { font-size: var(--fs-xs); font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muted); }
.docs-glance .g-big { font-size: 28px; line-height: 1.2; font-weight: 600; color: var(--head); margin-top: 4px; font-variant-numeric: tabular-nums; }
.docs-glance .g-big b { font-weight: 750; }
.docs-glance .g-small { font-size: var(--fs-sm); color: var(--muted); margin-top: 2px; }
.docs-glance.s-ok { background: var(--ok-bg); border-color: #c9e6d4; } .docs-glance.s-ok .g-small { color: var(--ok-ink); font-weight: 600; }
.docs-glance.s-due { background: var(--due-bg); border-color: #f2d9a6; } .docs-glance.s-due .g-small { color: var(--due-ink); font-weight: 600; }
.docs-glance.s-overdue { background: var(--overdue-bg); border-color: #f1c5bb; } .docs-glance.s-overdue .g-small { color: var(--overdue-ink); font-weight: 600; }
.docs-glance.s-done { background: var(--sea-50); border-color: var(--sea-200); } .docs-glance.s-done .g-small { color: var(--link); font-weight: 600; }
.docs-where-h { font-size: var(--fs-sm); font-weight: 650; color: var(--ink-2); margin-bottom: 8px; }
.docs-journey { display: flex; gap: 3px; height: 24px; border-radius: 8px; overflow: hidden; }
.docs-journey .jseg { min-width: 8px; flex-basis: 0; border-radius: 5px; transform-origin: left; animation: docs-grow .7s ease-out both; }
.docs-journey .jseg.now { box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .7); }
.docs-chips { list-style: none; display: flex; flex-wrap: wrap; gap: 8px 10px; margin: 12px 0 0; padding: 0; }
.docs-chips li { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px 5px 9px; border: 1px solid var(--line); border-radius: 999px; font-size: var(--fs-sm); background: var(--surface); }
.docs-chips li i { width: 10px; height: 10px; border-radius: 50%; flex: none; }
.docs-chips li b { font-weight: 700; color: var(--head); }

/* ------------------------------------------------------------ routing timeline extras */
.docs-remark { margin: 4px 0 0; font-style: italic; color: var(--ink-2); font-size: var(--fs-sm); }
.docs-dur { margin-top: 8px; height: 6px; max-width: 280px; background: var(--sea-100); border-radius: 3px; overflow: hidden; }
.docs-dur span { display: block; height: 100%; background: var(--sea-500); border-radius: 3px; transform-origin: left; animation: docs-grow .8s ease-out both; }

/* ------------------------------------------------------------ the letter, drawn as paper */
.docs-paper { container-type: inline-size; position: relative; border-radius: 4px; background: #f3f0e6; box-shadow: 0 1px 2px rgba(11, 46, 60, .12), 0 14px 30px -14px rgba(11, 46, 60, .4); overflow: hidden; }
.dp-sheet {
  position: relative; font: clamp(9.5px, 2.85cqw, 15px)/1.55 Georgia, "Iowan Old Style", "Palatino Linotype", serif; color: #2b2a27;
  padding: clamp(18px, 7cqw, 44px) clamp(18px, 8cqw, 52px) clamp(22px, 8cqw, 52px);
  background:
    radial-gradient(120% 90% at 50% 40%, rgba(255, 255, 255, 0) 55%, rgba(120, 100, 60, .1) 100%),
    linear-gradient(90deg, rgba(60, 50, 30, .09), rgba(60, 50, 30, 0) 3.5%, rgba(60, 50, 30, 0) 96%, rgba(60, 50, 30, .07)),
    repeating-linear-gradient(0deg, rgba(60, 50, 30, .018) 0 1px, rgba(255, 255, 255, 0) 1px 3px),
    #fbf9f2;
  text-shadow: 0 0 .5px rgba(43, 42, 39, .55);
  filter: contrast(1.03) saturate(.92);
}
.docs-paper.is-scan .dp-sheet { transform: rotate(-.35deg) scale(1.006); transform-origin: 50% 0; }
.dp-sheet p { margin: 0 0 .7em; }
.dp-head { display: flex; align-items: center; gap: 1.1em; justify-content: center; text-align: center; padding-bottom: .9em; margin-bottom: 1.1em; border-bottom: 1.5px solid #4b4a44; }
.dp-head > div { line-height: 1.3; }
.dp-head p { margin: 0; font-size: .82em; letter-spacing: .02em; }
.dp-head .dp-org { font-size: 1.12em; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin: .15em 0; }
.dp-seal { width: 3.6em; height: 3.6em; flex: none; color: #3d4a4d; display: grid; place-items: center; }
span.dp-seal { border: 1.5px solid #3d4a4d; border-radius: 50%; }
.dp-date { text-align: right; margin-bottom: 1em !important; }
.dp-to p { margin: 0; line-height: 1.4; }
.dp-to { margin-bottom: 1em; }
.dp-subject { margin: .4em 0 1.1em !important; }
.dp-subject b { font-weight: 700; }
.dp-p { text-align: justify; hyphens: auto; text-indent: 2.2em; }
.dp-p:first-of-type { text-indent: 0; }
.dp-memo { text-align: center; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; margin: 0 0 1em !important; font-size: 1.1em; }
.dp-grid { display: grid; grid-template-columns: 5.5em 1fr; gap: .1em .6em; margin-bottom: .6em; }
.dp-grid p { margin: 0 0 .25em; }
.dp-rule { border: 0; border-top: 1px solid #4b4a44; margin: .6em 0 1em; }
.dp-close { margin: 1.3em 0 0 !important; }
.dp-sign { margin-top: .2em; width: 55%; margin-left: auto; text-align: center; padding: .2em .3em; border-radius: .3em; }
.dp-sign p { margin: 0; line-height: 1.3; font-size: .95em; }
.dp-sign .dp-title { font-weight: 700; border-top: 1px solid #4b4a44; padding-top: .15em; }
.dp-sig { display: block; width: 7.5em; height: 2.4em; margin: 0 auto -.2em; color: #1c2f4f; text-shadow: none; opacity: .88; }
[data-region] { transition: background-color .25s, box-shadow .25s, opacity .25s; border-radius: .25em; }
.has-hl .dp-sheet [data-region]:not(.is-hl) { opacity: .62; }
.dp-sheet .is-hl { background: rgba(200, 150, 46, .34); box-shadow: 0 0 0 .3em rgba(200, 150, 46, .34), 0 0 0 .34em rgba(168, 122, 28, .5); opacity: 1; }
.dp-scanline { position: absolute; left: 0; right: 0; top: 0; height: 18%; pointer-events: none; opacity: 0; background: linear-gradient(to bottom, rgba(27, 127, 150, 0), rgba(27, 127, 150, .22) 70%, rgba(27, 127, 150, .75) 97%, rgba(27, 127, 150, 0) 100%); }
.is-scanning .dp-scanline { animation: docs-scan .7s linear forwards; }

.docs-stamp {
  position: absolute; left: 7%; bottom: 3%; transform: rotate(-6deg); padding: .55em .95em .6em; text-align: center;
  font: 600 clamp(8px, 2.5cqw, 13px)/1.3 var(--font-sans); color: #0f5266; border: .2em solid #0f5266; border-radius: .45em;
  outline: .1em solid #0f5266; outline-offset: .2em; background: rgba(240, 248, 250, .45); mix-blend-mode: multiply; text-shadow: none; letter-spacing: .02em;
}
.docs-stamp .st-top { display: flex; justify-content: center; align-items: center; gap: .4em; font-size: 1.7em; font-weight: 800; letter-spacing: .22em; text-transform: uppercase; }
.docs-stamp .st-who { font-weight: 700; margin-top: .1em; }
.docs-stamp .st-fp { font-family: ui-monospace, "SF Mono", Menlo, monospace; font-size: .92em; letter-spacing: .06em; opacity: .9; }
.docs-stamp.fresh { animation: docs-stamp .5s cubic-bezier(.2, .9, .3, 1.2) both; }
.docs-caption { display: flex; align-items: flex-start; gap: 8px; margin: 12px 2px 0; font-size: var(--fs-sm); color: var(--muted); }
.docs-caption .icon { flex: none; margin-top: 2px; color: var(--sea-500); }

/* ------------------------------------------------------------ tracking slip */
.docs-slip { container-type: inline-size; background: #fff; border: 1.5px dashed var(--line-strong); border-radius: var(--r-md); padding: 20px; max-width: 460px; margin: 0 auto; color: var(--ink); }
.docs-slip .sl-head { display: flex; align-items: center; gap: 12px; padding-bottom: 12px; border-bottom: 2px solid var(--sea-900); }
.docs-slip .sl-brand { font-family: var(--font-serif); font-size: 19px; font-weight: 700; color: var(--head); line-height: 1.1; }
.docs-slip .sl-kind { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); }
.docs-slip .sl-id { font-size: 26px; font-weight: 800; letter-spacing: .02em; color: var(--head); margin-top: 14px; font-variant-numeric: tabular-nums; }
.docs-slip .sl-title { font-size: 14px; font-weight: 600; line-height: 1.4; margin: 4px 0 14px; }
.docs-slip .sl-grid { display: grid; gap: 14px; grid-template-columns: minmax(0, 1fr); align-items: start; }
@container (min-width: 380px) { .docs-slip .sl-grid { grid-template-columns: minmax(0, 1fr) auto; } }
.docs-slip .row-kv { display: grid; grid-template-columns: 7.6em minmax(0, 1fr); gap: 8px; padding: 5px 0; border-bottom: 1px solid #efece3; font-size: 13px; }
.docs-slip .row-kv .k { color: var(--muted); font-weight: 600; }
.docs-slip .row-kv .v { font-weight: 550; overflow-wrap: anywhere; }
.docs-slip .sl-qr { justify-self: center; text-align: center; }
.docs-slip .sl-qr svg { display: block; border: 1px solid var(--line); border-radius: 6px; }
.docs-slip .sl-scan { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--link); margin-top: 6px; }
.docs-slip .sl-link { margin-top: 12px; font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.docs-slip .sl-link b { color: var(--ink-2); font-weight: 600; }
.docs-slip .sl-foot { margin-top: 14px; padding-top: 10px; border-top: 1px solid var(--line); font-size: 11px; color: var(--muted); text-align: center; }
#ot-print-root .docs-slip { border: 0; max-width: none; width: 100%; padding: 4mm; }
#ot-print-root .docs-slip .sl-brand { font-size: 22pt; }
#ot-print-root .docs-slip .sl-id { font-size: 30pt; margin-top: 8mm; }
#ot-print-root .docs-slip .sl-title { font-size: 13pt; }
#ot-print-root .docs-slip .row-kv { font-size: 11pt; padding: 2.5mm 0; }
#ot-print-root .docs-slip .sl-qr svg { width: 42mm; height: 42mm; }
#ot-print-root .docs-slip .sl-link, #ot-print-root .docs-slip .sl-foot { font-size: 9pt; }

/* ------------------------------------------------------------ intake */
.docs-chooser { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 10px; }
.docs-pickcard { appearance: none; display: grid; grid-template-columns: auto 1fr; grid-template-areas: "ic t" "ic s"; column-gap: 10px; row-gap: 0; align-items: center; text-align: left; min-height: 60px; padding: 8px 12px; background: var(--surface); border: 1.5px solid var(--line); border-radius: var(--r-md); color: var(--ink); cursor: pointer; transition: border-color .15s, box-shadow .15s, background .15s, transform .15s; }
.docs-pickcard:hover { border-color: var(--sea-300); box-shadow: var(--shadow-md); transform: translateY(-1px); }
.docs-pickcard:focus-visible, .docs-pickcard:focus-within { outline: 3px solid var(--focus); outline-offset: 2px; }
.docs-pickcard.is-active { border-color: var(--sea-500); background: var(--sea-50); box-shadow: 0 0 0 3px rgba(27, 127, 150, .15); }
.docs-pickcard .pc-ic { grid-area: ic; width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--sea-100); color: var(--link); }
.docs-pickcard.is-active .pc-ic { background: var(--sea-700); color: #fff; }
.docs-pickcard .pc-t { grid-area: t; font-weight: 650; font-size: 13px; line-height: 1.25; align-self: end; min-width: 0; }
.docs-pickcard .pc-s { grid-area: s; font-size: 11.5px; line-height: 1.3; min-width: 0; color: var(--muted); align-self: start; }
label.docs-pickcard { position: relative; }
.docs-hint { display: flex; gap: 10px; align-items: flex-start; color: var(--muted); font-size: var(--fs-sm); padding: 0 4px; }
.docs-hint .icon { flex: none; margin-top: 2px; color: var(--sea-500); }

.docs-intake-grid { display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr); gap: var(--s5); align-items: start; }
.docs-scanside { position: sticky; top: calc(var(--topbar-h) + 16px); z-index: 4; }
.docs-scanbox { position: relative; max-height: calc(100vh - var(--topbar-h) - 120px); min-height: 280px; overflow: auto; border-radius: 6px; background: var(--sand-200); padding: 14px; scrollbar-width: thin; }
.docs-scanbox.plain { background: var(--sand); }
.docs-photo img { display: block; width: 100%; border-radius: 4px; box-shadow: var(--shadow-md); filter: contrast(1.02); }
.docs-noscan { min-height: 280px; display: grid; place-content: center; justify-items: center; gap: 8px; text-align: center; color: var(--muted); border: 2px dashed var(--line-strong); border-radius: 8px; padding: 24px; }
.docs-noscan p { max-width: 30ch; margin: 0; }

.docs-readstat { display: flex; align-items: center; gap: 12px; padding: 12px 14px; background: var(--sand); border: 1px solid var(--sand-200); border-radius: var(--r-md); }
.docs-readstat .rs-ic { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--sea-700); color: #fff; flex: none; }
.docs-readstat:not(.is-done):not(.manual) .rs-ic { animation: docs-pulse 1.4s ease-in-out infinite; }
.docs-readstat .rs-text { font-weight: 600; font-size: var(--fs-sm); }
.docs-readbar { height: 5px; border-radius: 3px; background: var(--sand-200); margin-top: 7px; overflow: hidden; }
.docs-readbar span { display: block; height: 100%; width: 0; background: var(--sea-500); border-radius: 3px; transition: width .3s ease-out; }
.docs-readstat.is-done { background: var(--ok-bg); border-color: #c9e6d4; }
.docs-readstat.is-done .rs-ic { background: var(--ok); }
.docs-readstat.is-done .rs-text { color: var(--ok-ink); }
.docs-readstat.is-done .docs-readbar span { background: var(--ok); }
.docs-readstat.manual .rs-ic { background: var(--sea-500); }
.docs-intake .field.docs-ok .input, .docs-intake .field.docs-ok .select, .docs-intake .field.docs-ok .textarea { border-color: var(--sea-300); background: #fbfefe; }
.docs-intake .field.docs-fresh .input, .docs-intake .field.docs-fresh .select, .docs-intake .field.docs-fresh .textarea { animation: docs-flash .9s ease-out; }
.docs-tick { display: inline-block; margin-left: 6px; color: var(--ok); opacity: 0; vertical-align: -2px; transition: opacity .3s; }
.docs-ok .docs-tick { opacity: 1; }
.docs-reason { display: none; margin: 0; font-size: 12.5px; line-height: 1.4; color: var(--link); }
.docs-reason.show { display: block; animation: docs-fade .4s ease-out; }
.docs-intake .form-actions { margin-top: var(--s2); }
.docs-done { display: flex; align-items: center; gap: 16px; padding: 18px 22px; background: var(--ok-bg); border: 1px solid #c9e6d4; border-radius: var(--r-lg); color: var(--ok-ink); }
.docs-done .dd-t { font-size: 20px; font-weight: 700; color: var(--ok-ink); }
.docs-done .dd-s { color: var(--ink-2); font-size: var(--fs-sm); }
.docs-slipgrid { align-items: start; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); }

@keyframes docs-grow { from { transform: scaleX(0); } to { transform: scaleX(1); } }
@keyframes docs-scan { 0% { top: -18%; opacity: 1; } 100% { top: 100%; opacity: 1; } }
@keyframes docs-flash { 0% { background: var(--gold-100); box-shadow: 0 0 0 3px rgba(200, 150, 46, .35); } 100% { box-shadow: 0 0 0 0 rgba(200, 150, 46, 0); } }
@keyframes docs-fade { from { opacity: 0; transform: translateY(-3px); } to { opacity: 1; transform: none; } }
@keyframes docs-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(15, 82, 102, .4); } 50% { box-shadow: 0 0 0 8px rgba(15, 82, 102, 0); } }
@keyframes docs-stamp { 0% { opacity: 0; transform: rotate(-6deg) scale(1.9); } 60% { opacity: 1; transform: rotate(-6deg) scale(.96); } 100% { opacity: 1; transform: rotate(-6deg) scale(1); } }
@media (prefers-reduced-motion: reduce) {
  .docs-journey .jseg, .docs-dur span, .docs-stamp.fresh, .docs-reason.show, .is-scanning .dp-scanline, .docs-readstat .rs-ic, .docs-intake .field.docs-fresh .input, .docs-intake .field.docs-fresh .select, .docs-intake .field.docs-fresh .textarea { animation: none !important; }
  .docs-readbar span { transition: none; }
  .docs-pickcard:hover { transform: none; }
}

/* ------------------------------------------------------------ tablet and phone */
@media (max-width: 1100px) {
  .docs-kvs .kv { grid-template-columns: max-content minmax(0, 1fr); }
  .docs-intake-grid, .docs-slipgrid { grid-template-columns: minmax(0, 1fr); }
  .docs-scanside { top: calc(var(--topbar-h) + 4px); background: var(--page); padding-bottom: 8px; margin: 0 -2px; }
  .docs-scanbox { max-height: 36vh; min-height: 200px; padding: 10px; }
}
@media (max-width: 640px) {
  .docs-head .card-body > .stack { display: flex; flex-direction: column; }
  .docs-actions { order: 3; border-top: 0; padding-top: 0; }
  .docs-band { order: 4; }
  .docs-kvs { order: 5; }
  .docs-kvs .kv { gap: 8px 14px; }
  .docs-kvs .kv dd { margin: 0; }
  .docs-tiles .s-foot { display: none; }
  .docs-tiles .stat { padding: 12px 14px; }
  .docs-head .card-body { padding: var(--s4); }
  .docs-h { font-size: 21px; }
  .docs-glances { grid-template-columns: minmax(0, 1fr); gap: 8px; }
  .docs-glance { display: grid; grid-template-columns: 1fr auto; column-gap: 12px; align-items: center; padding: 12px 14px; }
  .docs-glance .g-label { grid-column: 1; } .docs-glance .g-small { grid-column: 1; margin: 0; }
  .docs-glance .g-big { grid-column: 2; grid-row: 1 / span 2; font-size: 24px; margin: 0; text-align: right; }
  .docs-actions .btn { flex: 1 1 100%; }
  .docs-actions .docs-quiet { flex: 1 1 100%; }
  .docs-band { flex-wrap: wrap; }
  .docs-band .grow { flex: 1 1 calc(100% - 40px); min-width: 0; }
  .docs-band .btn { flex: 1 1 100%; }
  .docs-chooser { grid-template-columns: none; grid-auto-flow: column; grid-auto-columns: 58%; overflow-x: auto; scroll-snap-type: x proximity; padding-bottom: 6px; scrollbar-width: none; }
  .docs-pickcard { scroll-snap-align: start; }
  .docs-readstat { flex-wrap: wrap; }
  .docs-readstat .grow { flex: 1 1 200px; }
  .docs-readstat .docs-again { margin-left: 46px; }
  .docs-pickcard { grid-template-columns: 1fr; grid-template-areas: "ic" "t" "s"; padding: 10px 12px; min-height: 84px; row-gap: 2px; }
  .docs-pickcard .pc-ic { width: 30px; height: 30px; }
  .docs-pickcard .pc-t, .docs-pickcard .pc-s { align-self: auto; }
  .docs-done { padding: 14px 16px; }
  .docs-tiles { gap: 10px; }
  .docs-bar .search { max-width: none; flex-basis: 100%; }
  .docs-scanbox { max-height: 30vh; }
}
@media print { .docs-scanside, .docs-intake-grid { position: static; } }

.docs-phone-meta { display: none; }
@media (max-width: 640px) {
  .docs-phone-meta { display: block; font-weight: 600; color: var(--ink-2); margin-top: 4px; }
  .docs .tbl.stack tr { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; padding: 14px 16px; }
  .docs .tbl.stack td { width: auto; padding: 0; }
  .docs .tbl.stack td::before { display: none; }
  .docs .tbl.stack td:first-child { width: 100%; }
}

.docs-slipwrap { max-width: 560px; width: 100%; margin: 0 auto; }
