/* ---- R4: Documents (docs-*.js). Quiet Glass tokens only (quiet-glass.css): ink is the one accent,
   status words in soft pills, glass cards, 56–64 px rows with a 17 px title and 14 px meta. Works at
   320–1440 px, light and dark; nothing red (renewals are amber "Renews soon", never "overdue"). */

.docs [hidden], .docs-sheet [hidden], #docs-access-sec [hidden] { display: none !important; }
.main.docs { position: relative; padding-bottom: 48px; }

/* header: the subject first, one main action */
.docs-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin: 4px 0 18px; }
.docs-eyebrow { margin: 0 0 6px; color: var(--muted); font-size: var(--fs-cap); font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; }
.docs-title { margin: 0; font-size: clamp(2.1875rem, 4vw, 2.625rem); line-height: 1.05; font-weight: 500; letter-spacing: -0.03em; }
.docs-sub { margin: 8px 0 0; font-size: var(--fs-body); }
.docs-actions { display: flex; gap: 10px; flex: none; }
.docs-actions .btn { display: inline-flex; align-items: center; gap: 8px; height: var(--btn-h); padding: 0 18px; }
.docs-actions .btn svg { width: 18px; height: 18px; margin-left: -4px; }

/* the three places: Companies · Coming up · Packs */
.docs-tabs { display: inline-flex; gap: 4px; padding: 4px; margin-bottom: 14px; border-radius: 999px; background: var(--glass); box-shadow: var(--elevation); max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.docs-tab { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: 999px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; white-space: nowrap; }
.docs-tab:hover { color: var(--text); }
.docs-tab.active { background: var(--primary); color: var(--on-primary); }
.docs-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.docs-count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: var(--amber-soft); color: var(--amber); font-size: 12px; }
.docs-tab.active .docs-count { background: color-mix(in srgb, var(--on-primary) 18%, transparent); color: var(--on-primary); }

/* find fast: one box, two filters */
.docs-find { display: grid; grid-template-columns: minmax(0, 1fr) 200px 220px; gap: 10px; margin-bottom: 18px; }
.docs-q {
  width: 100%; height: var(--field-h); padding-left: 44px; border-radius: var(--r);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23a7abb4' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='6.5'/%3E%3Cpath d='M16 16l4.5 4.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 15px center; background-size: 18px;
}
.docs-filter { width: 100%; min-width: 0; font-size: 15px; }

.docs-note { margin: 0 0 14px; color: var(--muted); font-size: var(--fs-meta); }
.docs-found { margin: 6px 2px 10px; color: var(--muted); font-size: var(--fs-meta); }
.docs-group { margin: 22px 2px 10px; }

/* companies: glass cards */
.docs-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 14px; }
.docs-co {
  display: flex; flex-direction: column; align-items: flex-start; gap: 8px; min-height: 132px; padding: 18px;
  border: 0; border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--elevation);
  color: var(--text); font: inherit; text-align: left; text-decoration: none; cursor: pointer;
  transition: transform 120ms var(--ease-calm), background-color 150ms;
}
.docs-co:hover { background: var(--raised); }
.docs-co:active { transform: scale(0.98); }
.docs-co:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.docs-co-top { display: flex; align-items: flex-start; gap: 10px; min-width: 0; width: 100%; }
.docs-co-ic { flex: none; width: 22px; height: 22px; margin-top: 1px; color: var(--muted); }
.docs-co-name { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.01em; line-height: 1.2; overflow-wrap: anywhere; }
.docs-co-meta { color: var(--muted); font-size: var(--fs-meta); }
.docs-co-meta:empty { display: none; }
.docs-co .pill-status { margin-top: auto; }
.docs-quiet { background: none; box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); }
.docs-co-add { align-items: center; justify-content: center; flex-direction: row; gap: 8px; border: 1.5px dashed var(--line); background: none; box-shadow: none; color: var(--muted); font-size: 15px; font-weight: 600; }
.docs-co-add svg { width: 20px; height: 20px; }
.docs-co-add:hover { color: var(--text); border-color: var(--muted); background: var(--glass); }

/* one company */
.docs-back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; color: var(--muted); font-size: 15px; font-weight: 600; text-decoration: none; }
.docs-back:hover { color: var(--text); }
.docs-back-ic { width: 18px; height: 18px; transform: rotate(180deg); }
.docs-co-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin: 2px 0 14px; }
.docs-co-title { margin: 0; font-size: clamp(1.8125rem, 3vw, 2.1875rem); line-height: 1.1; font-weight: 500; letter-spacing: -0.03em; }
.docs-co-titles .muted { margin: 6px 0 0; }
.docs-people { display: flex; flex-wrap: wrap; gap: 14px 28px; margin: 0 0 16px; }
.docs-people-g { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.docs-people-g .type-section { margin-right: 4px; }
.docs-chip { display: inline-flex; align-items: center; min-height: 32px; padding: 0 12px; border: 0; border-radius: 999px; background: var(--raised); color: var(--text); font: inherit; font-size: 14px; font-weight: 500; text-decoration: none; }
.docs-chip-add { color: var(--muted); font-weight: 600; cursor: pointer; box-shadow: inset 0 0 0 1px var(--line); background: none; min-height: 36px; }
.docs-chip-add:hover { color: var(--text); background: var(--glass); }
.docs-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }
.docs-missing { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 16px 2px 0; }
.docs-missing .type-section { width: 100%; margin-bottom: 2px; }
.docs-co-notes { margin: 18px 2px 0; color: var(--muted); white-space: pre-line; }
.docs-jump { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.docs-empty { padding: 36px 16px; border: 1.5px dashed var(--line); border-radius: var(--r-lg); }

/* lists: a glass card of rows */
.docs-list { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--elevation); overflow: hidden; }
.docs-row {
  display: flex; align-items: center; gap: 14px; width: 100%; min-height: 64px; padding: 10px 16px;
  border: 0; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; transition: background-color 150ms;
}
.docs-row + .docs-row, .docs-row + .docs-pick, .docs-link + .docs-link { border-top: 1px solid var(--line); }
.docs-row:hover:not(.docs-row-static):not(:disabled) { background: var(--raised); }
.docs-row:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }
.docs-row:disabled { opacity: 0.55; cursor: default; }
.docs-row-static { cursor: default; }
.docs-row-ic { flex: none; width: 22px; height: 22px; color: var(--muted); }
.docs-row-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; flex: 1; }
.docs-row-text b { font-size: var(--fs-item); font-weight: 500; letter-spacing: -0.01em; overflow-wrap: anywhere; }
.docs-row-text small { color: var(--muted); font-size: var(--fs-meta); overflow-wrap: anywhere; }
.docs-row .pill-status { flex: none; }
.docs-row .icon-btn { flex: none; width: 44px; height: 44px; border-radius: 12px; }
.docs-row .icon-btn svg { width: 18px; height: 18px; }

/* skeletons, not spinners */
.docs-skel > * { pointer-events: none; background: linear-gradient(90deg, var(--glass) 0%, var(--raised) 50%, var(--glass) 100%); background-size: 200% 100%; animation: docs-shimmer 1.4s ease-in-out infinite; }
.docs-skel .docs-row { min-height: 64px; }
@keyframes docs-shimmer { from { background-position: 100% 0; } to { background-position: -100% 0; } }

/* drop a file anywhere on the page */
.docs-dropcover { position: fixed; inset: 12px; z-index: 30; display: none; place-items: center; border: 2px dashed var(--primary); border-radius: var(--r-sheet); background: color-mix(in srgb, var(--bg) 82%, transparent); color: var(--text); font-size: 1.5rem; font-weight: 600; pointer-events: none; }
#docs-page.docs-dropping .docs-dropcover { display: grid; }

/* ---- sheets */
@media (min-width: 761px) {
  dialog.panel.docs-sheet { width: min(640px, calc(100vw - 48px)); }
  dialog.panel.docs-sheet.docs-pack-sheet { width: min(760px, calc(100vw - 48px)); }
}
.docs-sheet .panel-head h2 { overflow-wrap: anywhere; }
.docs-sheet-body { display: flex; flex-direction: column; gap: 14px; }
.docs-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.docs-form .wide { grid-column: 1 / -1; }
.docs-form .field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.docs-form input, .docs-form select, .docs-form textarea, .docs-sheet-body > .field input { width: 100%; }
.docs-sheet-body > .field { display: flex; flex-direction: column; gap: 6px; }
.docs-foot { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 4px; }
.docs-foot .btn.primary { margin-left: auto; min-width: 120px; }
.docs-foot .btn.danger-text { border-color: var(--input); background: transparent; color: var(--danger); }
.btn.small.danger-text { color: var(--danger); }
.docs-progress:empty { display: none; }

.docs-zone {
  display: flex; align-items: center; gap: 14px; min-height: 104px; padding: 18px; border: 1.5px dashed var(--input);
  border-radius: var(--r-lg); background: var(--glass); cursor: pointer; transition: border-color 120ms, background-color 120ms;
}
.docs-zone:hover, .docs-zone.over { border-color: var(--primary); background: var(--raised); }
.docs-zone.has-file { border-style: solid; }
.docs-zone-ic { flex: none; width: 28px; height: 28px; color: var(--muted); transform: rotate(180deg); }
.docs-zone-text { display: flex; flex-direction: column; gap: 2px; }
.docs-zone-text b { font-size: var(--fs-item); font-weight: 600; }
.docs-zone-text small { color: var(--muted); font-size: var(--fs-meta); }
.docs-file-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.docs-file-input:focus-visible + .docs-chosen, .docs-zone:focus-within { outline: 2px solid var(--primary); outline-offset: 2px; }
.docs-chosen { margin: -4px 2px 0; font-weight: 600; overflow-wrap: anywhere; }

/* one document */
.docs-doc-pill { align-self: flex-start; }
.docs-facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 8px 18px; margin: 0; }
.docs-facts dt { color: var(--muted); font-size: var(--fs-meta); }
.docs-facts dd { margin: 0; overflow-wrap: anywhere; }
.docs-notes { margin: 0; padding: 12px 14px; border-radius: var(--r-row); background: var(--raised); white-space: pre-line; }
.docs-doc-acts { display: flex; flex-wrap: wrap; gap: 10px; }
.docs-versions:empty { display: none; }
.docs-versions { display: flex; flex-direction: column; gap: 8px; }
.docs-ver { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 6px 4px; border-top: 1px solid var(--line); }
.docs-ver-text { display: flex; flex-direction: column; flex: 1; min-width: 0; }
.docs-ver-text small { color: var(--muted); font-size: var(--fs-meta); overflow-wrap: anywhere; }

/* packs */
.docs-sec-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.docs-picker { display: flex; flex-direction: column; gap: 10px; }
.docs-pick-list { display: flex; flex-direction: column; gap: 12px; max-height: 46dvh; overflow: auto; padding: 2px; }
.docs-pick-g { display: flex; flex-direction: column; border-radius: var(--r-lg); background: var(--glass); box-shadow: var(--elevation); overflow: hidden; }
.docs-pick-g > .type-section { padding: 12px 16px 6px; }
.docs-pick { display: flex; align-items: center; gap: 14px; min-height: 56px; padding: 8px 16px; cursor: pointer; }
.docs-pick + .docs-pick { border-top: 1px solid var(--line); }
.docs-pick input { flex: none; width: 22px; height: 22px; accent-color: var(--primary); }
.docs-send { display: flex; flex-direction: column; gap: 12px; padding: 16px; border-radius: var(--r-lg); background: var(--raised); }
.docs-send > .btn { align-self: flex-start; }
.docs-links { display: flex; flex-direction: column; gap: 8px; }
.docs-link { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; padding: 12px 2px; }
.docs-link.ended .docs-row-text b, .docs-link.ended .docs-row-text small { color: var(--muted); }
.docs-link-acts { display: flex; flex-wrap: wrap; gap: 8px; }
.docs-log { flex-basis: 100%; display: flex; flex-direction: column; gap: 2px; padding: 8px 12px; border-radius: var(--r-row); background: var(--raised); }
.docs-log-row { display: flex; flex-direction: column; padding: 6px 0; }
.docs-log-row + .docs-log-row { border-top: 1px solid var(--line); }
.docs-log-row small { color: var(--muted); font-size: 13px; }

/* Settings › Users › Access, and Settings › Access */
.docs-pma .pma-rows.is-off { opacity: 0.55; }
#docs-access-sec .list-row small { display: block; color: var(--muted); font-size: var(--fs-meta); }

/* ---- phone (390): one column, the main action at the top, sheets from the bottom */
@media (max-width: 760px) {
  .main.docs { padding-bottom: calc(var(--dock-clear, 100px) + 8px); }
  .docs-head { flex-direction: column; align-items: stretch; gap: 14px; margin-bottom: 14px; }
  .docs-title { font-size: 2.1875rem; }
  .docs-sub { font-size: 15px; }
  .docs-actions { flex-direction: row-reverse; }
  .docs-actions .btn { flex: 1; justify-content: center; height: var(--btn-h-lg); }
  .docs-tabs { display: flex; width: 100%; }
  .docs-tab { flex: 1; justify-content: center; padding: 0 10px; height: 44px; }
  .docs-find { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .docs-find .docs-q { grid-column: 1 / -1; }
  .docs-grid { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .docs-co { min-height: 0; padding: 16px; }
  .docs-row { padding: 10px 14px; gap: 12px; }
  .docs-row .pill-status.ok { display: none; } /* a phone row keeps only what needs a look: a renewal coming up */
  .docs-co-head { flex-direction: column; }
  .docs-form { grid-template-columns: minmax(0, 1fr); }
  .docs-dropcover { display: none !important; }
  .docs-doc-acts .btn { flex: 1 1 calc(50% - 5px); }
}
@media (prefers-reduced-motion: reduce) { .docs-skel > * { animation: none; } }
