:root {
  --color-bg: #f4f6f4;
  --color-surface: #ffffff;
  --color-surface-alt: #eef1ef;
  --color-text: #121916;
  --color-text-muted: #5a635f;
  --color-text-faint: #7d8782;
  --color-text-on-dark: #f3f6f4;
  --color-text-on-brand: #ffffff;
  --color-brand: #167a55;
  --color-brand-dark: #0d4d36;
  --color-brand-soft: #e6f3ec;
  --color-info: #2f5fbe;
  --color-info-soft: #eaf0fb;
  --color-warning: #b7791f;
  --color-warning-soft: #fff6e8;
  --color-warning-ink: #8a5a12;
  --color-danger: #b42318;
  --color-danger-dark: #8f1d13;
  --color-danger-soft: #fef3f2;
  --color-danger-ink: #7a2424;
  --border: #d8ded9;
  --border-strong: #c3ccc6;
  --dark: #101614;
  --dark-2: #18201d;
  /* Muted/faint ink for the dark sign-in surface. */
  --dark-muted: #aeb8b3;
  --dark-faint: #829397;
  --dark-line: rgb(255 255 255 / .12);
  --dark-danger-bg: #3a2426;
  --dark-danger-ink: #f0c4c4;

  /* Spacing scale — every gap/padding below picks from this. */
  --s1: .25rem;
  --s2: .5rem;
  --s3: .75rem;
  --s4: 1rem;
  --s5: 1.25rem;
  --s6: 1.75rem;

  /* Type scale */
  --text-xs: .72rem;
  --text-sm: .8rem;
  --text-md: .875rem;
  --text-base: .9375rem;
  --text-lg: 1rem;
  --text-xl: 1.35rem;

  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-pill: 999px;
  --font: "Segoe UI", ui-sans-serif, system-ui, -apple-system, Roboto, Arial, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", Consolas, Menlo, monospace;
  --shadow-sm: 0 1px 2px rgb(16 22 20 / .06);
  --shadow-pop: 0 10px 28px rgb(16 22 20 / .12);
  --shadow: 0 1px 2px rgb(16 22 20 / .06), 0 12px 32px rgb(16 22 20 / .08);
  --ring: 0 0 0 3px color-mix(in srgb, var(--color-brand) 30%, transparent);
  --header: 3.6rem;
  --nav: 16.5rem;
  /* One height for every inline control so toolbars line up. */
  --control-h: 2.5rem;
}

html[data-theme="dark"],
html[data-theme="dark"] body.app {
  --color-bg: #0f1412;
  --color-surface: #171d1a;
  --color-surface-alt: #1f2623;
  --color-text: #e8eeea;
  --color-text-muted: #a7b2ac;
  --color-text-faint: #7f8a84;
  --color-brand-soft: #1a3328;
  --border: #2a332f;
  --border-strong: #3a4540;
  --shadow-sm: 0 1px 2px rgb(0 0 0 / .35);
  --shadow-pop: 0 10px 28px rgb(0 0 0 / .45);
  --shadow: 0 1px 2px rgb(0 0 0 / .35), 0 12px 32px rgb(0 0 0 / .4);
}
@media (prefers-color-scheme: dark) {
  html[data-theme="system"],
  html[data-theme="system"] body.app {
    --color-bg: #0f1412;
    --color-surface: #171d1a;
    --color-surface-alt: #1f2623;
    --color-text: #e8eeea;
    --color-text-muted: #a7b2ac;
    --color-text-faint: #7f8a84;
    --color-brand-soft: #1a3328;
    --border: #2a332f;
    --border-strong: #3a4540;
  }
}

.user-menu { position: relative; }
.user-menu > summary {
  list-style: none; cursor: pointer; display: inline-flex; align-items: center; gap: .45rem;
  min-height: var(--control-h); padding: 0 .55rem; border-radius: var(--radius-sm);
  border: 1px solid transparent; color: var(--color-text-muted); font-weight: 600; font-size: var(--text-sm);
}
.user-menu > summary::-webkit-details-marker { display: none; }
.user-menu > summary:hover { background: var(--color-surface-alt); color: var(--color-text); }
.user-menu[open] > summary { background: var(--color-surface-alt); border-color: var(--border); color: var(--color-text); }
.user-avatar {
  width: 1.55rem; height: 1.55rem; border-radius: 50%; object-fit: cover; background: var(--color-brand-soft);
  display: inline-flex; align-items: center; justify-content: center; font-size: .7rem; font-weight: 700;
  color: var(--color-brand-dark); overflow: hidden; flex: none;
}
.user-avatar img { width: 100%; height: 100%; object-fit: cover; display: block; }
.user-menu-panel {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 40; min-width: 12rem;
  background: var(--color-surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-pop); padding: .35rem; display: flex; flex-direction: column; gap: .15rem;
}
.user-menu-panel button {
  border: 0; background: transparent; text-align: left; padding: .5rem .65rem; border-radius: 6px;
  cursor: pointer; font-weight: 600; color: var(--color-text); font-size: var(--text-sm);
}
.user-menu-panel button:hover { background: var(--color-surface-alt); }

* { box-sizing: border-box; }
/* Component rules such as `.file-pane { display: flex }` outrank the UA rule for
   [hidden], which left panes and toolbars on screen after they were hidden. */
[hidden] { display: none !important; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: var(--font);
  font-size: var(--text-base);
  line-height: 1.5;
  color: var(--color-text);
  background: var(--dark);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font: inherit; }
:focus-visible {
  outline: 2px solid var(--color-brand);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
.gate :focus-visible { outline-color: #7fd0ab; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
  }
}

/* —— Sign-in (dark, focused) —— */
.gate { min-height: 100vh; display: grid; place-items: center; padding: var(--s5); }
.gate-card {
  width: min(100%, 26rem);
  background: var(--dark-2);
  border: 1px solid var(--dark-line);
  border-radius: var(--radius-lg);
  padding: var(--s6) var(--s5) var(--s5);
  color: var(--color-text-on-dark);
  box-shadow: 0 24px 64px rgb(0 0 0 / .35);
}
.gate-card.wide { width: min(100%, 34rem); }
.logo { height: 36px; width: auto; max-width: 14rem; margin-bottom: var(--s5); object-fit: contain; object-position: left center; }
.gate h1 { font-size: var(--text-xl); letter-spacing: -.03em; margin: 0 0 var(--s2); font-weight: 650; }
.lede { margin: 0 0 var(--s4); color: var(--color-text-muted); font-size: .9rem; }
.gate .lede { color: var(--dark-muted); margin-bottom: var(--s5); }
.gate label { display: block; font-size: .78rem; font-weight: 650; margin: 0 0 var(--s1); }
.gate input {
  width: 100%; border: 1px solid rgb(255 255 255 / .16); background: var(--dark);
  color: #fff; border-radius: var(--radius-sm); padding: .75rem .8rem; margin-bottom: var(--s4);
  transition: border-color .12s ease;
}
.gate input::placeholder { color: var(--dark-faint); }
.gate input:hover { border-color: rgb(255 255 255 / .28); }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s1);
  min-height: 2.5rem; padding: 0 var(--s4); border: 1px solid transparent; border-radius: var(--radius-sm);
  background: var(--color-brand); color: var(--color-text-on-brand); font-weight: 650; cursor: pointer;
  text-decoration: none; white-space: nowrap;
  transition: background-color .12s ease, border-color .12s ease, color .12s ease;
}
.btn:hover { background: var(--color-brand-dark); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .5; cursor: not-allowed; transform: none; }
.btn-block { width: 100%; min-height: 2.75rem; }
.btn-ghost {
  background: transparent; color: var(--color-text-muted);
  border-color: var(--border); font-weight: 600;
}
.btn-ghost:hover { background: var(--color-surface-alt); color: var(--color-text); border-color: var(--border-strong); }
.btn-danger { background: var(--color-danger); }
.btn-danger:hover { background: var(--color-danger-dark); }
.btn-quiet {
  background: transparent; color: var(--color-text-muted); border-color: transparent; font-weight: 600;
}
.btn-quiet:hover { background: var(--color-surface-alt); color: var(--color-text); }
.btn-sm { min-height: 2rem; padding: 0 .7rem; font-size: var(--text-sm); }
.err {
  display: none; color: var(--dark-danger-ink); background: var(--dark-danger-bg);
  border-radius: var(--radius-sm); padding: .7rem .8rem; font-size: .84rem; margin-bottom: var(--s4);
}
.err.show { display: block; }
.small { color: var(--color-text-faint); font-size: .75rem; margin-top: var(--s4); }
.gate .small { color: var(--dark-faint); }
.doors { display: grid; gap: var(--s3); margin-top: var(--s2); }
a.door {
  display: block; text-decoration: none; color: var(--color-text-on-dark);
  border: 1px solid var(--dark-line); border-radius: var(--radius); padding: var(--s4) var(--s5);
  transition: border-color .12s ease, background-color .12s ease;
}
a.door:hover { border-color: var(--color-brand); background: rgb(255 255 255 / .04); }
a.door strong { display: block; margin-bottom: var(--s1); }
a.door span { color: var(--dark-muted); font-size: .88rem; line-height: 1.45; }
/* The arrow only nudges on hover so the row does not shift on load. */
a.door strong::after {
  content: "→"; float: right; color: var(--dark-faint); font-weight: 400;
  transition: transform .12s ease, color .12s ease;
}
a.door:hover strong::after { color: var(--color-text-on-dark); transform: translateX(2px); }

/* —— Product shell (light) —— */
body.booting .gate,
body.booting .shell { display: none !important; }
/* Booting used to be a blank dark screen; show that the session check is running. */
body.booting::after {
  content: "";
  position: fixed; left: 50%; top: 50%; width: 2rem; height: 2rem; margin: -1rem 0 0 -1rem;
  border: 2px solid rgb(255 255 255 / .16); border-top-color: var(--color-brand);
  border-radius: 50%; animation: cw-spin .7s linear infinite;
}
@keyframes cw-spin { to { transform: rotate(360deg); } }
.spinner {
  display: inline-block; width: 1rem; height: 1rem; vertical-align: -.15rem;
  border: 2px solid var(--border); border-top-color: var(--color-brand);
  border-radius: 50%; animation: cw-spin .7s linear infinite;
}
.loading-row {
  display: flex; align-items: center; gap: var(--s2);
  padding: var(--s5) var(--s2); color: var(--color-text-muted); font-size: var(--text-md);
}
.skeleton {
  display: block; height: .8rem; border-radius: var(--radius-sm);
  background: linear-gradient(90deg, var(--color-surface-alt) 25%, #f7f9f8 37%, var(--color-surface-alt) 63%);
  background-size: 400% 100%; animation: cw-shimmer 1.2s ease infinite;
}
.skeleton + .skeleton { margin-top: var(--s2); }
.skeleton.w-60 { width: 60%; }
.skeleton.w-40 { width: 40%; }
@keyframes cw-shimmer { 0% { background-position: 100% 50%; } 100% { background-position: 0 50%; } }
/* Any container mid-refresh: dim it, block clicks, keep layout stable. */
.is-busy { position: relative; opacity: .55; pointer-events: none; }
body.app { background: var(--color-bg); color: var(--color-text); }
body.app .gate { display: none; }
.shell { display: none; min-height: 100vh; }
body.app .shell {
  display: grid;
  height: 100vh; min-height: 0; overflow: hidden;
  grid-template-rows: var(--header) minmax(0, 1fr);
}
.topbar {
  display: flex; align-items: center; gap: var(--s3);
  padding: 0 var(--s5); background: var(--color-surface);
  border-bottom: 1px solid var(--border); position: sticky; top: 0; z-index: 20;
  box-shadow: 0 1px 0 rgb(16 22 20 / .04);
}
.topbar::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
  background: var(--color-brand);
}
.topbar .brand { display: flex; align-items: center; gap: .75rem; min-width: 0; }
.topbar .logo { height: 26px; margin: 0; max-width: 9rem; object-fit: contain; }
.topbar .org-name {
  font-weight: 650; font-size: .95rem; color: var(--color-text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 16rem;
}
.product {
  font-size: .72rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  color: var(--color-brand-dark); background: var(--color-brand-soft);
  padding: .2rem .5rem; border-radius: 999px; white-space: nowrap;
  /* Which surface you are on must never be the thing that gets clipped. */
  flex: none;
}
.topbar .logo, .topbar .btn { flex: none; }
.topbar .grow { flex: 1; }
.topbar .org-switch, .topbar select {
  min-width: 10rem; max-width: 16rem; height: 2.25rem; border: 1px solid var(--border);
  background: var(--color-surface); border-radius: var(--radius-sm); padding: 0 .6rem;
  color: var(--color-text); font-size: var(--text-md);
}
.topbar .org-switch:hover, .topbar select:hover { border-color: var(--border-strong); }
.who {
  font-size: var(--text-sm); font-weight: 600; color: var(--color-text-muted);
  max-width: 12rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-inline: var(--s1);
}
@media (max-width: 720px) {
  .topbar { padding-inline: var(--s3); gap: var(--s2); }
  .topbar .who, .topbar .org-name { display: none; }
  .topbar .logo { max-width: 5.5rem; }
  .topbar .org-switch, .topbar select { min-width: 0; flex: 0 1 9rem; }
}
.browse {
  display: grid; grid-template-columns: minmax(0, 1fr); gap: 1rem; align-items: stretch;
  flex: 1; min-height: 0;
}
.browse.with-pane { grid-template-columns: minmax(0, 1fr) min(28rem, 40vw); }
.browse.with-pane.office-open { grid-template-columns: minmax(8rem, 28%) minmax(0, 1fr); }
.browse-list { min-width: 0; min-height: 0; overflow: auto; }
.browse-list .card { padding: .5rem .7rem .3rem; }
.browse-list .card h2 { margin: 0 0 .3rem; font-size: .78rem; }
.browse-list table.data { font-size: .85rem; }
/* The listing scrolls in .browse-list, so the wrapper must not scroll too. */
.browse-list .table-wrap { max-height: none; overflow: visible; }
.browse-list table.data th, .browse-list table.data td {
  padding: .32rem .45rem; line-height: 1.3; vertical-align: middle;
}
.browse-list table.data td { white-space: nowrap; }
.browse-list table.data td.name { white-space: normal; }
.browse-list table.data tr.pick { cursor: pointer; }
.browse-list table.data tr.section-row td {
  padding: .55rem .45rem .2rem; font-size: .68rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted);
  border-bottom: 0; cursor: default;
}
.browse-list table.data tr.section-row:hover td { background: transparent; }
.browse-list table.data tr.folder-row { cursor: pointer; }
.browse-list table.data tr.folder-row td.folder-cell {
  padding: .45rem .55rem; background: var(--color-surface-alt);
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
}
.browse-list table.data tr.folder-row:hover td.folder-cell { background: #eef3ef; }
.browse-list table.data tr.folder-row + tr.section-row td,
.browse-list table.data tr.section-row + tr.folder-row td.folder-cell { border-top: 0; }
.folder-entry {
  display: flex; align-items: center; gap: .65rem; min-width: 0;
}
.folder-entry-text { display: flex; flex-direction: column; gap: .08rem; min-width: 0; }
.folder-entry-name { font-weight: 700; font-size: .88rem; }
.folder-entry-meta { font-size: .72rem; color: var(--color-text-muted); font-weight: 600; }
.browse-list table.data tr.folder-row .file-ico.folder {
  width: 2rem; height: 2rem; border-radius: 7px; font-size: .68rem;
  box-shadow: inset 0 0 0 1px rgba(26, 107, 72, .12);
}
.browse-list table.data tr.picked td { background: var(--color-brand-soft); }
.browse-list table.data tr.sign-pending > td:first-child {
  box-shadow: inset 4px 0 0 #d97706;
}
.browse-list table.data tr.sign-pending td.name {
  background: linear-gradient(90deg, rgba(217, 119, 6, .08), transparent 4.5rem);
}
.tile-wrap.sign-pending {
  box-shadow: inset 4px 0 0 #d97706;
  background: linear-gradient(90deg, rgba(217, 119, 6, .1), transparent 3rem);
}
.browse-list table.data tr.sign-signed > td:first-child {
  box-shadow: inset 4px 0 0 #15803d;
}
.browse-list table.data tr.sign-signed td.name {
  background: linear-gradient(90deg, rgba(21, 128, 61, .08), transparent 4.5rem);
}
.tile-wrap.sign-signed {
  box-shadow: inset 4px 0 0 #15803d;
  background: linear-gradient(90deg, rgba(21, 128, 61, .1), transparent 3rem);
}
.pane-subh {
  margin: .75rem 0 .25rem; font-size: .72rem; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted);
}
.pane-signer-list {
  margin: 0 0 .5rem; padding: 0 0 0 1rem; font-size: .86rem; line-height: 1.45;
}
.pane-signer-list li { margin: .15rem 0; }
.pane-signer-list .muted { color: var(--color-text-muted); font-weight: 500; }
.pane-audit-card {
  margin: .4rem 0 .65rem; padding: .55rem .65rem; border: 1px solid var(--border);
  border-radius: 8px; background: var(--color-surface, #fff);
}
.pane-audit-head { display: flex; align-items: center; gap: .45rem; flex-wrap: wrap; margin-bottom: .35rem; }
.pane-dl-tight { margin: 0; }
.pane-dl-tight dt { min-width: 5.5rem; }
.pane-ua { font-size: .72rem; word-break: break-word; color: var(--color-text-muted); }
.file-pane .mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8rem; }
.browse-list table.data tr.envelope-row { cursor: pointer; }
.browse-list table.data th.pick-col,
.browse-list table.data td.pick-col {
  width: 2rem; padding: .32rem .35rem .32rem .45rem; text-align: center;
}
.browse-list table.data td.pick-col input,
.browse-list table.data th.pick-col input { margin: 0; cursor: pointer; }
.browse-section { margin-top: .35rem; }
.browse-section + .browse-section { margin-top: .75rem; padding-top: .15rem; border-top: 1px solid var(--border); }
.browse-section-title {
  margin: 0 0 .35rem; font-size: .68rem; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--color-text-muted);
}
.tile.tile-folder {
  border: 1px solid #c8ddd2; background: linear-gradient(180deg, #f4faf6 0%, #e8f2ec 100%);
  min-height: 2.75rem;
}
.browse-list table.data tr.folder-row-recipient td.folder-cell {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
  border-color: #c5d4ea;
}
.tile.tile-folder-recipient {
  border-color: #c5d4ea;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}
.tile.tile-folder .file-ico.folder {
  width: 2rem; height: 2rem; border-radius: 7px; font-size: .68rem;
}
.tile-kind {
  margin-left: auto; flex: none; font-size: .66rem; font-weight: 700;
  color: #1a6b48; text-transform: uppercase; letter-spacing: .03em;
}
.browse-list.view-icons .tile-kind { margin: 0; }
.tile-wrap {
  position: relative; display: flex; align-items: stretch; border-radius: 8px;
}
.tile-wrap.picked { outline: 2px solid var(--color-brand); outline-offset: 1px; }
.tile-wrap .tile-pick-wrap {
  position: absolute; top: .25rem; left: .25rem; z-index: 2;
  display: flex; align-items: center; justify-content: center;
  width: 1.35rem; height: 1.35rem; border-radius: 4px;
  background: rgba(255, 255, 255, .92); box-shadow: 0 1px 2px rgba(0, 0, 0, .08);
}
.tile-wrap .file-tile { flex: 1; min-width: 0; }
.bulk-bar {
  display: flex; align-items: center; flex-wrap: wrap; gap: .45rem .55rem;
  margin: .35rem 0 .15rem; padding: .45rem .65rem;
  background: var(--color-brand-soft); border: 1px solid #c5dccf; border-radius: 8px;
}
.bulk-count { font-size: .82rem; font-weight: 700; margin-right: .15rem; }
.folder-hint {
  margin: .15rem 0 .35rem; padding: .4rem .65rem; font-size: .82rem; color: var(--color-text-muted);
  background: var(--color-surface-alt); border-left: 3px solid var(--color-brand); border-radius: 0 6px 6px 0;
}
.browse-list .file-row {
  display: flex; align-items: center; gap: .5rem; min-height: 0;
}
.browse-list .file-ico {
  width: 1.55rem; height: 1.55rem; border-radius: 5px; font-size: .58rem;
}
/* Hold / lock / sealing state has to read from the listing, not one click in. */
.browse-list .file-row .badge { flex: none; font-size: .66rem; padding: .05rem .35rem; }
.flag { flex: none; line-height: 1; }
.flag.fav { color: #d99b16; font-size: .8rem; }
.tile-flags { display: flex; align-items: center; gap: .25rem; margin-left: auto; flex: none; }
.tile-flags .badge { font-size: .62rem; padding: .05rem .3rem; }
.browse-list.view-icons .tile-flags { margin: 0; }
.view-switch {
  display: inline-flex; border: 1px solid var(--border); border-radius: 8px;
  overflow: hidden; background: var(--color-surface); flex-shrink: 0;
}
.view-switch button {
  border: 0; background: transparent; color: var(--color-text-muted);
  font-weight: 650; font-size: .78rem; padding: .35rem .7rem; cursor: pointer;
  min-height: var(--control-h);
}
.view-switch button + button { border-left: 1px solid var(--border); }
.view-switch button:hover { background: var(--color-surface-alt); color: var(--color-text); }
.view-switch button.active {
  background: var(--color-brand-soft); color: var(--color-brand-dark);
}
.tile-grid { display: grid; gap: .45rem; padding-bottom: .45rem; }
.browse-list.view-grid .tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(10.5rem, 1fr));
}
.browse-list.view-icons .tile-grid {
  grid-template-columns: repeat(auto-fill, minmax(6.25rem, 1fr));
}
.tile {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  border: 1px solid transparent; background: transparent; border-radius: 8px;
  padding: .4rem .45rem; cursor: pointer; text-align: left; color: inherit;
  min-height: 2.4rem;
}
.tile:hover { background: var(--color-surface-alt); }
.tile.sel { background: var(--color-brand-soft); }
.tile-name {
  min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-size: .82rem; font-weight: 600;
}
.browse-list.view-icons .tile {
  flex-direction: column; text-align: center; padding: .7rem .4rem .55rem;
  gap: .4rem; min-height: 5.4rem; justify-content: flex-start;
}
.browse-list.view-icons .tile-name {
  white-space: normal; display: -webkit-box; -webkit-line-clamp: 2;
  -webkit-box-orient: vertical; line-height: 1.25; font-size: .75rem; font-weight: 600;
}
.browse-list.view-icons .file-ico {
  width: 2.6rem; height: 2.6rem; border-radius: 8px; font-size: .72rem;
}
.browse-list.view-grid .file-ico {
  width: 1.85rem; height: 1.85rem; font-size: .62rem;
}
.file-pane {
  position: relative; top: auto;
  display: flex; flex-direction: column; min-height: 0; height: 100%;
  background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: .9rem .95rem 1.05rem;
  max-height: none; overflow: hidden;
  min-width: 0;
}
.file-pane-head { flex: 0 0 auto; }
.file-pane .pane-preview { flex: 0 0 auto; }
#paneBody {
  flex: 1 1 auto; min-height: 0; overflow: auto;
  padding-bottom: .35rem;
}
.pane-preview {
  margin: 0 0 .7rem; max-height: 12rem;
  background: var(--color-surface-alt); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.pane-preview.office-editor {
  max-height: none; height: calc(100vh - var(--header) - 7rem); min-height: 32rem;
}
.pane-preview iframe, .pane-preview embed, .pane-preview object {
  width: 100%; height: 12rem; border: 0; background: var(--color-surface); display: block;
}
.pane-preview.office-editor iframe, .pane-preview.office-editor object, .pane-preview.office-editor #oo-host {
  height: 100%; min-height: 32rem;
}
.pane-preview img {
  display: block; max-width: 100%; max-height: 12rem; margin: 0 auto; object-fit: contain;
}
.pane-preview pre {
  margin: 0; padding: .6rem .7rem; max-height: 12rem; overflow: auto;
  font: 11px/1.4 ui-monospace, monospace; white-space: pre-wrap;
}
.pane-preview .pane-preview-msg { margin: .75rem; font-size: .8rem; color: var(--color-text-muted); }
.file-pane-head { display: flex; align-items: flex-start; justify-content: space-between; gap: .75rem; margin-bottom: .55rem; }
.file-pane-head h2 { margin: 0; font-size: .98rem; line-height: 1.3; word-break: break-word; }
.file-pane .pane-acc {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 0 0 .55rem;
  background: var(--color-surface);
}
.file-pane .pane-acc > summary {
  list-style: none;
  cursor: pointer;
  font-size: .72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .55rem .7rem;
  color: var(--color-text-muted);
}
.file-pane .pane-acc > summary::-webkit-details-marker { display: none; }
.file-pane .pane-acc[open] > summary {
  border-bottom: 1px solid var(--border);
  color: var(--color-text);
}
.file-pane .pane-acc-body { padding: .65rem .7rem .85rem; }
.c8-modes { display: flex; flex-wrap: wrap; gap: .3rem; margin: 0 0 .55rem; }
.c8-modes .btn[aria-pressed="true"] {
  background: var(--color-text);
  color: var(--color-surface);
  border-color: var(--color-text);
}
.c8-player {
  min-height: 12rem;
  background: #111;
  border-radius: 8px;
  overflow: hidden;
}
.c8-player iframe, .c8-player video {
  width: 100%; height: 14rem; border: 0; display: block; background: #000;
}
.c8-player .lede { margin: .75rem; color: #ddd; }
.c8-url {
  margin: .45rem 0 0;
  font: 11px/1.4 ui-monospace, monospace;
  word-break: break-all;
  color: var(--color-text-muted);
}
.pane-dl { margin: 0 0 .2rem; display: grid; gap: .45rem; }
.pane-dl > div { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: .45rem .65rem; align-items: baseline; }
.pane-dl dt { margin: 0; font-size: .72rem; font-weight: 700; color: var(--color-text-muted); text-transform: uppercase; letter-spacing: .04em; }
.pane-dl dd { margin: 0; font-size: .84rem; word-break: break-word; }
.file-pane .pane-facts {
  display: flex; flex-wrap: wrap; gap: .35rem .7rem; align-items: center;
  margin: 0 0 .7rem; font-size: .78rem; color: var(--color-text-muted);
}
.file-pane .pane-why {
  margin: 0 0 .7rem; padding: .5rem .6rem; font-size: .78rem; line-height: 1.45;
  color: var(--color-warning-ink); background: var(--color-warning-soft);
  border: 1px solid #f2dcb6; border-radius: var(--radius-sm);
}
.file-pane .pane-toolbar {
  display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin: 0 0 .55rem;
}
.file-pane .pane-toolbar .btn { width: auto; min-height: 2rem; padding: 0 .7rem; font-size: .78rem; }
.file-pane .pane-more { position: relative; }
.file-pane .pane-more > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; min-height: 2rem; padding: 0 .7rem;
  border: 1px solid var(--border); border-radius: 9px; font-size: .78rem; font-weight: 600;
  color: var(--color-text-muted); background: transparent;
}
.file-pane .pane-more > summary::-webkit-details-marker { display: none; }
.file-pane .pane-more > summary:hover { background: var(--color-surface-alt); color: var(--color-text); }
.file-pane .pane-more[open] > summary { background: var(--color-surface-alt); color: var(--color-text); }
.file-pane .pane-more-list {
  position: absolute; right: 0; top: calc(100% + .25rem); z-index: 4;
  min-width: 11rem; background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: var(--s1);
}
.file-pane .pane-more-list button {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: .45rem .6rem; border-radius: 7px; font-size: .8rem; font-weight: 600;
  color: var(--color-text); cursor: pointer;
}
.file-pane .pane-more-list button:hover { background: var(--color-surface-alt); }
.file-pane .pane-more-list button.danger { color: var(--color-danger); }
.file-pane .pane-tags {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .35rem; align-items: center;
}
.file-pane .pane-tags input { margin: 0; font-size: .8rem; padding: .4rem .5rem; }
.file-pane table.data th, .file-pane table.data td { padding: .4rem .3rem; font-size: .8rem; }
.file-pane .pane-ver-btns { display: flex; gap: .25rem; justify-content: flex-end; white-space: nowrap; }
@media (max-width: 960px) {
  .browse.with-pane { grid-template-columns: 1fr; }
  .file-pane {
    position: fixed; top: var(--header); right: 0; bottom: 0; width: min(28rem, 100%);
    max-height: none; z-index: 25; border-radius: 0; border-right: 0;
    box-shadow: -12px 0 32px rgb(16 22 20 / .12);
    overflow: hidden;
  }
}
.layout {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr);
  min-height: 0;
  height: 100%;
  align-items: stretch;
  overflow: hidden;
}
body.app .shell.portal-fill .layout {
  min-height: 0; height: 100%; overflow: hidden;
}
.sidenav {
  background: var(--color-surface); border-right: 1px solid var(--border);
  padding: 1rem .75rem 1.5rem; display: flex; flex-direction: column; gap: .12rem;
  min-width: 0; min-height: 0; overflow: auto;
}
.sidenav-foot {
  margin-top: auto;
  padding: .85rem .55rem 0;
  border-top: 1px solid var(--border);
  display: grid; gap: .55rem;
}
.nav-quota { font-size: .72rem; color: var(--color-text-muted); line-height: 1.35; }
.nav-quota-lab { font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-faint); margin-bottom: .15rem; }
.nav-quota-val { color: var(--color-text); font-weight: 600; }
.nav-quota-bar {
  margin-top: .35rem; height: 4px; border-radius: 2px; background: var(--color-surface-alt); overflow: hidden;
}
.nav-quota-bar > i { display: block; height: 100%; border-radius: inherit; background: var(--color-brand); }
.nav-quota.is-warn .nav-quota-bar > i { background: var(--color-warning); }
.nav-quota.is-critical .nav-quota-bar > i { background: var(--color-danger); }
.share-detail {
  display: grid; gap: .35rem; padding: .65rem .75rem; margin: .25rem 0 .65rem;
  background: var(--color-surface-alt); border-radius: var(--radius-sm); font-size: var(--text-sm);
}
.share-detail .k { color: var(--color-text-faint); font-size: var(--text-xs); font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.nav-label {
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-text-faint); padding: .85rem .7rem .25rem;
}
.nav-label:first-child { padding-top: .15rem; }
.nav-acc {
  border: 0; margin: 0; padding: 0; min-width: 0;
}
.nav-acc + .nav-acc { margin-top: .2rem; }
.nav-acc > summary {
  list-style: none; cursor: pointer; user-select: none;
  display: flex; align-items: center; justify-content: space-between; gap: .35rem;
  font-size: .68rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase;
  color: var(--color-text-faint); padding: .7rem .55rem .35rem .7rem;
  border-radius: 6px;
}
.nav-acc > summary::-webkit-details-marker { display: none; }
.nav-acc > summary::after {
  content: ""; width: .45rem; height: .45rem; flex: none;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor;
  transform: rotate(-45deg); opacity: .7; transition: transform .15s ease;
  margin-right: .15rem;
}
.nav-acc[open] > summary::after { transform: rotate(45deg); margin-top: -.15rem; }
.nav-acc > summary:hover { color: var(--color-text-muted); background: var(--color-surface-alt); }
.nav-acc > .nav-acc-body {
  display: flex; flex-direction: column; gap: .12rem; padding: 0 0 .15rem;
  min-width: 0;
}
.nav-acc > .nav-acc-body > .hint { padding-left: .7rem; padding-right: .7rem; }
.sidenav button, .sidenav a.nav {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  color: var(--color-text); padding: .55rem .7rem; border-radius: 8px;
  cursor: pointer; font-weight: 600; font-size: .875rem; text-decoration: none;
}
.sidenav button:hover, .sidenav a.nav:hover { background: var(--color-surface-alt); }
.sidenav button.active, .sidenav a.nav.active { background: var(--color-brand-soft); color: var(--color-brand-dark); }
.sidenav .hint { font-size: .75rem; color: var(--color-text-faint); padding: var(--s2) .7rem 0; }
.nav-group { display: flex; flex-direction: column; gap: .12rem; }
/* Filter that lives inside the sidenav, lined up with the nav buttons. */
.sidenav input.nav-filter { width: 100%; min-width: 0; margin: 0 0 var(--s2); flex: none; }
.main { padding: 1.25rem 1.4rem 2rem; min-width: 0; min-height: 0; overflow: auto; overscroll-behavior: contain; }
body.app .shell.portal-fill .main {
  padding: 1.25rem 1.4rem 1rem; min-height: 0;
  display: flex; flex-direction: column; overflow: hidden;
}
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s4); margin-bottom: var(--s4); flex-wrap: wrap; flex-shrink: 0; }
.page-head h1 { font-size: var(--text-xl); letter-spacing: -.03em; margin: 0; font-weight: 650; }
.page-head p { margin: var(--s1) 0 0; color: var(--color-text-muted); font-size: .9rem; }
.panel { display: none; }
.panel.show { display: block; animation: cw-fade .14s ease-out; }
.card {
  background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s5); margin-bottom: var(--s4);
  box-shadow: var(--shadow-sm);
}
.card h2 { font-size: var(--text-lg); margin: 0 0 var(--s3); letter-spacing: -.02em; }
.card h2 .count {
  display: inline-block; margin-left: var(--s2); padding: .05rem .45rem;
  border-radius: var(--radius-pill); background: var(--color-surface-alt);
  color: var(--color-text-muted); font-size: var(--text-xs); font-weight: 700;
  vertical-align: .1rem; font-variant-numeric: tabular-nums;
}
.card > h2 + .lede { margin-top: calc(var(--s2) * -1); }
/* Card heading with actions on the right. */
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s3); margin-bottom: var(--s3); flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr)); gap: var(--s3); margin-bottom: var(--s4); }
.stat {
  background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: var(--s3) var(--s4);
  box-shadow: var(--shadow-sm);
}
.stat .k { font-size: .75rem; color: var(--color-text-muted); font-weight: 650; }
.stat .v {
  font-size: 1.2rem; font-weight: 650; letter-spacing: -.03em; margin-top: .15rem;
  font-variant-numeric: tabular-nums;
}
.dl { display: grid; grid-template-columns: 9rem 1fr; gap: .35rem .9rem; font-size: .9rem; }
.dl dt { color: var(--color-text-muted); }
.dl dd { margin: 0; }
.form-grid { display: grid; gap: .85rem; max-width: 32rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.share-form {
  display: grid;
  grid-template-columns: minmax(0, 1.5fr) minmax(7.5rem, .7fr);
  gap: .85rem 1rem;
  align-items: start;
}
.share-when-block { grid-column: 1 / -1; }
.sign-pages-block { margin-top: var(--s3); display: flex; flex-direction: column; gap: var(--s2); }
.sign-pages-block > .f { margin: 0; }
.sign-pages-block .seg { align-self: flex-start; flex-wrap: wrap; }
.sign-pages-block .hint { margin: 0; font-size: var(--text-xs); color: var(--color-text-faint); }
.sign-pages-block #signPagesWrap { display: flex; flex-direction: column; gap: var(--s1); }
.sign-pages-block #signPagesWrap[hidden] { display: none; }
.share-schedule {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .65rem .85rem;
  margin-top: .65rem;
  padding: .75rem;
  background: var(--color-surface-alt);
  border-radius: var(--radius-sm);
}
.share-schedule .f { margin-top: 0; }
.seg {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  background: var(--color-surface);
}
.seg-opt {
  position: relative;
  margin: 0;
  cursor: pointer;
  min-height: 2.25rem;
  display: inline-flex;
  align-items: center;
}
.seg-opt + .seg-opt { border-left: 1px solid var(--border); }
.seg-opt input {
  position: absolute;
  opacity: 0;
  inset: 0;
  margin: 0;
  cursor: pointer;
}
.seg-opt span {
  display: block;
  padding: 0 1rem;
  font-size: var(--text-sm);
  font-weight: 650;
  color: var(--color-text-muted);
  line-height: 2.25rem;
  user-select: none;
}
.seg-opt:has(input:checked) span {
  background: var(--color-brand-soft);
  color: var(--color-brand-dark);
}
.seg-opt:has(input:focus-visible) span { box-shadow: inset var(--ring); }
.share-ttl {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: .75rem;
}
.share-ttl > .f { margin: 0; white-space: nowrap; }
.ttl-pair { display: flex; align-items: center; gap: .4rem; min-width: 0; }
.share-form .ttl-pair input,
.share-form .ttl-pair select { width: auto; }
.share-form .ttl-pair input { width: 4.25rem; text-align: center; flex: none; }
.share-form .ttl-pair select { width: 8.5rem; flex: none; }
@media (max-width: 720px) {
  .layout { grid-template-columns: 1fr; }
  /* A wrapped 14-button column is unusable on a phone; scroll it in one row instead. */
  .sidenav {
    flex-direction: row; flex-wrap: nowrap; align-items: center; gap: var(--s1);
    overflow-x: auto; overscroll-behavior-x: contain; scrollbar-width: thin;
    padding: var(--s2) var(--s3); border-right: 0; border-bottom: 1px solid var(--border);
    position: sticky; top: var(--header); z-index: 15; background: var(--color-surface);
  }
  .sidenav > .nav-label, .sidenav .nav-acc > summary, .sidenav .hint, .sidenav-foot { display: none; }
  /* flex-shrink would clip the labels ("Peopl"); every item keeps its own width. */
  .sidenav > * { flex: 0 0 auto; }
  .sidenav .nav-acc { display: contents; }
  .sidenav .nav-acc > .nav-acc-body { display: contents; }
  .sidenav button, .sidenav a.nav { width: auto; white-space: nowrap; }
  .sidenav .ws-list, .sidenav .folder-nav, .sidenav .nav-group { flex-direction: row; gap: var(--s1); display: flex; }
  .sidenav .ws-list button, .sidenav .folder-nav .folder-item { width: auto; white-space: nowrap; flex: 0 0 auto; }
  .sidenav .folder-nav .folder-item { padding-left: .45rem; }
  .sidenav input.filter, .sidenav input.nav-filter { min-width: 9rem; margin: 0; width: auto; }
  .sidenav button.active, .sidenav a.nav.active { box-shadow: inset 0 -2px 0 var(--color-brand); }
  .main { padding: var(--s4) var(--s4) var(--s6); }
  /* Five full-width stat cards is a lot of scrolling; two per row reads faster. */
  .stats { grid-template-columns: repeat(auto-fit, minmax(8rem, 1fr)); gap: var(--s2); }
  .stat { padding: var(--s2) var(--s3); }
  .stat .v { font-size: 1.05rem; }
  .page-head { align-items: flex-start; }
  .form-row { grid-template-columns: 1fr; }
  .share-form { grid-template-columns: 1fr; }
  .share-schedule { grid-template-columns: 1fr; }
  .share-ttl { flex-wrap: wrap; }
  .table-wrap { max-height: none; }
}
label.f { display: block; font-size: .78rem; font-weight: 650; margin: 0 0 .35rem; }
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 2.4rem; }
.pw-toggle {
  position: absolute; right: .2rem; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--color-text-muted);
  width: 2rem; height: 2rem; padding: 0; border-radius: 6px; cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
}
.pw-toggle:hover, .pw-toggle[aria-pressed="true"] { color: var(--color-brand-dark); background: var(--color-brand-soft); }
.app input, .app select, .app textarea {
  width: 100%; border: 1px solid var(--border); background: var(--color-surface); color: var(--color-text);
  border-radius: var(--radius-sm); padding: .55rem .65rem;
  transition: border-color .12s ease, box-shadow .12s ease;
}
.app input:hover, .app select:hover, .app textarea:hover { border-color: var(--border-strong); }
.app input:focus, .app select:focus, .app textarea:focus {
  border-color: var(--color-brand); box-shadow: var(--ring); outline: none;
}
.app input::placeholder, .app textarea::placeholder { color: var(--color-text-faint); }
.app input:disabled, .app select:disabled, .app textarea:disabled {
  background: var(--color-surface-alt); color: var(--color-text-faint); cursor: not-allowed;
}
.app input[aria-invalid="true"] { border-color: var(--color-danger); }
.field-hint { margin: var(--s1) 0 0; font-size: var(--text-xs); color: var(--color-text-faint); }
.actions { display: flex; gap: .5rem; flex-wrap: wrap; margin-top: .85rem; }
.check { display: flex; align-items: center; gap: .5rem; font-size: .88rem; }
.check input { width: auto; }
/* Main is the page scroller on org/operator. Nested max-height here stacked a
   second right-edge scrollbar next to the page one. Sticky thead still works
   against .main. Portal listings opt out via .browse-list .table-wrap. */
.table-wrap { overflow: visible; max-height: none; }
table.data { width: 100%; border-collapse: collapse; font-size: var(--text-md); }
table.data th, table.data td { text-align: left; padding: .65rem .5rem; border-bottom: 1px solid var(--border); vertical-align: middle; }
table.data th {
  font-size: var(--text-xs); text-transform: uppercase; letter-spacing: .04em;
  color: var(--color-text-muted); font-weight: 700;
  position: sticky; top: 0; z-index: 1;
  background: var(--color-surface); border-bottom-color: var(--border-strong);
}
table.data tbody tr:hover td { background: var(--color-surface-alt); }
table.data tbody tr.sel td { background: var(--color-brand-soft); }
table.data tbody tr:last-child td { border-bottom: 0; }
.mono { font-family: var(--mono); font-size: .78rem; color: var(--color-text-muted); }
.badge {
  display: inline-flex; align-items: center; border-radius: 999px;
  padding: .12rem .5rem; font-size: .72rem; font-weight: 700;
  background: var(--color-surface-alt); color: var(--color-text-muted);
}
.badge.ok { background: var(--color-brand-soft); color: var(--color-brand-dark); }
.badge.warn { background: var(--color-warning-soft); color: var(--color-warning-ink); }
.badge.danger { background: var(--color-danger-soft); color: var(--color-danger); }
.badge.info { background: var(--color-info-soft); color: #24437f; }
.empty {
  text-align: center; padding: var(--s6) var(--s4); color: var(--color-text-muted);
  border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--color-surface);
}
.empty h3 { margin: 0 0 var(--s1); color: var(--color-text); font-size: var(--text-lg); }
.empty p { margin: 0; font-size: var(--text-md); max-width: 34rem; margin-inline: auto; }
.empty .actions { justify-content: center; }
.crumb { display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; margin-bottom: .9rem; font-size: .875rem; flex-shrink: 0; }
.crumb a { color: var(--color-brand-dark); text-decoration: none; font-weight: 600; }
.crumb a:hover { text-decoration: underline; }
.crumb span { color: var(--color-text-faint); }
.file-row .meta { font-size: .75rem; color: var(--color-text-muted); margin-top: .1rem; }
#shareExisting { margin: 0 0 1rem; }
#shareExisting .lede { margin: 0 0 .4rem; }
.file-ico {
  width: 2rem; height: 2rem; border-radius: 8px; background: var(--color-brand-soft);
  color: var(--color-brand-dark); display: grid; place-items: center; font-size: .7rem; font-weight: 800;
  flex-shrink: 0;
}
.file-ico.folder { background: #e7f1ea; color: #1a6b48; }
.file-ico.pdf { background: #f4e4e4; color: #9b2c2c; }
.file-ico.img { background: #e4ecf6; color: #2c4f9b; }
.file-ico.zip { background: #efe6f4; color: #6b2c9b; }
.file-ico.doc { background: #e4eaf4; color: #2c4a7a; }
.file-ico.sheet { background: #e5f0e4; color: #2c6b2c; }
.file-ico.file { background: var(--color-surface-alt); color: var(--color-text-muted); }
td.num { font-variant-numeric: tabular-nums; color: var(--color-text-muted); white-space: nowrap; }
.row-actions { display: flex; flex-wrap: wrap; gap: .3rem; justify-content: flex-end; }
input.filter {
  min-width: 10rem; height: var(--control-h); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 0 .7rem; background: var(--color-surface);
}
.ws-list { display: flex; flex-direction: column; gap: .25rem; }
.ws-list button {
  text-align: left; border: 1px solid transparent; background: transparent;
  padding: .55rem .65rem; border-radius: 8px; cursor: pointer; width: 100%;
}
.ws-list button:hover { background: var(--color-surface-alt); }
.ws-list button.active { background: var(--color-brand-soft); border-color: transparent; }
.ws-list .n { font-weight: 650; display: block; }
.ws-list .m { font-size: .75rem; color: var(--color-text-muted); }
.ws-list .m .badge { font-size: .62rem; padding: .05rem .35rem; }
/* A suspended tenant should not read like a healthy one at a glance. */
.ws-list button.muted .n { color: var(--color-text-muted); }
.folder-nav { display: flex; flex-direction: column; gap: .04rem; }
.folder-nav .folder-item {
  width: 100%; text-align: left; font-size: .8rem; font-weight: 600;
  padding: .32rem .45rem .32rem calc(.45rem + (var(--d, 0) * .75rem));
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.modal-bg {
  display: none; position: fixed; inset: 0; background: rgb(16 22 20 / .5);
  z-index: 40; place-items: center; padding: var(--s4);
  overflow: auto;
}
.modal-bg.show { display: grid; animation: cw-fade .12s ease-out; }
.modal {
  width: min(100%, 26rem); background: var(--color-surface); border-radius: var(--radius);
  padding: var(--s5) var(--s5) var(--s4); box-shadow: var(--shadow);
  max-height: min(86vh, 52rem); overflow: auto;
  animation: cw-pop .14s ease-out;
}
/* Versions, share and inbox carry tables — they asked for .wide but nothing defined it. */
.modal.wide { width: min(100%, 38rem); }
.modal.lg { width: min(100%, 52rem); }
.modal h2 { margin: 0 0 var(--s3); font-size: 1.1rem; letter-spacing: -.02em; }
.modal > .actions { position: sticky; bottom: calc(var(--s4) * -1); background: var(--color-surface); padding-top: var(--s3); margin-top: var(--s4); }
@keyframes cw-fade { from { opacity: 0; } }
@keyframes cw-pop { from { opacity: 0; transform: translateY(8px); } }
body.modal-open { overflow: hidden; }
body.modal-open .main,
body.modal-open .browse-list { overflow: hidden; }

/* Inline feedback. `.err` is the red one; notices cover the rest. */
.app .err { color: var(--color-danger-ink); background: var(--color-danger-soft); border: 1px solid #f6d4d0; }
.notice {
  display: none; border-radius: var(--radius-sm); padding: .7rem .8rem;
  font-size: .84rem; margin-bottom: var(--s4); border: 1px solid transparent;
}
.notice.show { display: block; }
.notice.ok { color: var(--color-brand-dark); background: var(--color-brand-soft); border-color: #bfe3ce; }
.notice.info { color: #24437f; background: var(--color-info-soft); border-color: #cddcf5; }
.notice.warn { color: var(--color-warning-ink); background: var(--color-warning-soft); border-color: #f2dcb6; }

/* Transient confirmation, bottom-centre, never blocks the pointer. */
.toast-host {
  position: fixed; left: 50%; bottom: var(--s5); transform: translateX(-50%);
  z-index: 60; display: grid; gap: var(--s2); pointer-events: none;
}
.toast {
  display: flex; align-items: center; gap: var(--s2);
  background: var(--dark-2); color: var(--color-text-on-dark);
  border-radius: var(--radius-sm); padding: .6rem .9rem; font-size: var(--text-md); font-weight: 600;
  box-shadow: var(--shadow-pop); animation: cw-toast .16s ease-out;
  max-width: min(90vw, 28rem);
}
.toast.ok::before { content: "✓"; color: #7fd0ab; font-weight: 800; }
/* A failure has to read as a failure at a glance, not just by its glyph. */
.toast.bad { box-shadow: inset 3px 0 0 #e07b7b, var(--shadow-pop); }
.toast.bad::before { content: "!"; color: #f0a3a3; font-weight: 800; }
@keyframes cw-toast { from { opacity: 0; transform: translateY(6px); } }

.drop-on { outline: 2px dashed var(--color-brand); outline-offset: -8px; background: var(--color-brand-soft); }
.secret {
  font-family: var(--mono); font-size: .85rem; background: var(--color-surface-alt);
  border-radius: 8px; padding: .65rem .75rem; word-break: break-all;
}
label.btn input[type=file] { display: none; }
.hidden { display: none !important; }

.brand-studio { display: grid; gap: 1rem; max-width: 52rem; }
.brand-preview {
  --pv-bg: var(--color-bg);
  --pv-surface: var(--color-surface);
  --pv-text: var(--color-text);
  --pv-muted: var(--color-text-muted);
  --pv-border: var(--border);
  --pv-brand: var(--color-brand);
  --pv-on-brand: var(--color-text-on-brand);
  --pv-accent: var(--color-brand-dark);
  border: 1px solid var(--pv-border); border-radius: var(--radius); overflow: hidden;
  background: var(--pv-bg); color: var(--pv-text);
}
.brand-preview .pv-bar {
  display: flex; align-items: center; gap: .75rem; padding: .7rem 1rem;
  background: var(--pv-surface); border-bottom: 1px solid var(--pv-border);
}
.brand-preview .pv-bar img { height: 28px; width: auto; max-width: 9rem; object-fit: contain; }
.brand-preview .pv-name { font-weight: 650; color: var(--pv-text); }
.brand-preview .pv-body { padding: 1.1rem 1.15rem; }
.brand-preview .pv-body .lede { color: var(--pv-muted); }
.brand-preview .pv-cta {
  display: inline-flex; min-height: 2.4rem; padding: 0 .9rem; border-radius: 8px;
  background: var(--pv-brand); color: var(--pv-on-brand); font-weight: 650; align-items: center;
}
.asset-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
@media (max-width: 720px) { .asset-grid { grid-template-columns: 1fr; } }
.drop {
  display: grid; place-items: center; text-align: center; min-height: 8.5rem;
  border: 1px dashed var(--border); border-radius: var(--radius); background: var(--color-surface-alt);
  cursor: pointer; padding: 1rem; color: var(--color-text-muted); font-size: .85rem;
}
.drop:hover { border-color: var(--color-brand); background: var(--color-brand-soft); color: var(--color-brand-dark); }
.drop input { display: none; }
.drop img { max-height: 3.5rem; max-width: 100%; object-fit: contain; margin-bottom: .4rem; }
.swatch-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem 1rem; }
.color-row { display: flex; align-items: stretch; gap: .45rem; }
.color-hex { font-family: var(--mono); font-size: .85rem; text-transform: uppercase; }
.color-swatch {
  position: relative; width: 2.5rem; min-height: 2.5rem; flex-shrink: 0;
  border: 1px solid var(--border); border-radius: 8px; overflow: hidden; padding: 0; cursor: pointer;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / .4);
}
.color-swatch input[type=color] {
  pointer-events: none; position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; padding: 0; border: 0;
}
.xfer {
  display: none;
  margin: 0 0 .85rem;
  padding: .7rem .9rem .8rem;
  background: var(--color-surface, #fff);
  border: 1px solid var(--border);
  border-radius: 10px;
  box-shadow: 0 1px 2px rgb(15 23 42 / .06);
}
.xfer:not([hidden]) { display: block; }
.xfer-row {
  display: flex; justify-content: space-between; align-items: baseline; gap: 1rem;
  font-size: .88rem; color: var(--color-text);
}
#xferPct { font-variant-numeric: tabular-nums; color: var(--color-brand-dark, var(--color-brand)); font-weight: 600; }
.xfer-track {
  height: 8px; margin-top: .5rem; border-radius: 99px; overflow: hidden;
  background: var(--color-brand-soft, #d7efe4);
}
.xfer-fill {
  display: block; height: 100%; width: 0;
  background: var(--color-brand, #167a55);
  transition: width .12s ease-out;
}
.xfer-fill.indet {
  width: 36%;
  animation: cw-xfer 1.1s ease-in-out infinite;
}
@keyframes cw-xfer {
  0% { transform: translateX(-120%); }
  100% { transform: translateX(320%); }
}
.toolbar { display: flex; gap: var(--s2); flex-wrap: wrap; align-items: center; }
/* Divider between action groups in a dense toolbar. */
.toolbar .sep { width: 1px; align-self: stretch; margin: 0 var(--s1); background: var(--border); }

/* Dropdown built on <details>, so it closes on Escape and needs no JS. */
.menu { position: relative; }
.menu > summary {
  list-style: none; cursor: pointer;
  display: inline-flex; align-items: center; gap: var(--s1);
  min-height: var(--control-h); padding: 0 .8rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: var(--text-md); font-weight: 600; color: var(--color-text-muted);
  background: transparent; white-space: nowrap;
}
.menu > summary::-webkit-details-marker { display: none; }
.menu > summary::after { content: "▾"; font-size: .7em; opacity: .7; }
.menu > summary:hover { background: var(--color-surface-alt); color: var(--color-text); border-color: var(--border-strong); }
.menu[open] > summary { background: var(--color-surface-alt); color: var(--color-text); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + var(--s1)); z-index: 30;
  min-width: 12rem; background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop); padding: var(--s1);
  animation: cw-pop .12s ease-out;
}
.menu-list button, .menu-list a {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  padding: .45rem .6rem; border-radius: 6px; font-size: var(--text-sm); font-weight: 600;
  color: var(--color-text); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.menu-list button:hover, .menu-list a:hover { background: var(--color-surface-alt); }
.menu-list button:disabled { color: var(--color-text-faint); cursor: not-allowed; background: transparent; }
.menu-list button.danger { color: var(--color-danger); }
.menu-list .menu-label {
  padding: .4rem .6rem .2rem; font-size: var(--text-xs); font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-faint);
}
.menu-list hr { border: 0; border-top: 1px solid var(--border); margin: var(--s1) 0; }
.sidenav button.active, .sidenav a.nav.active {
  box-shadow: inset 3px 0 0 var(--color-brand);
}
/* Office launcher only — must not leak overflow:hidden onto every admin html. */
body.oo-page { height: 100%; margin: 0; overflow: hidden; background: #fff; }
html:has(body.oo-page) { height: 100%; overflow: hidden; }
body.oo-page #oo-host { position: fixed; inset: 0; }
body.oo-page .err { position: relative; z-index: 2; margin: 0; }

/* —— Portal calendar (governance agenda) —— */
.cal-root { display: flex; flex-direction: column; gap: var(--s3); min-height: 0; flex: 1; }
.cal-root[hidden] { display: none !important; }
.cal-toolbar {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--s2);
  padding: .15rem 0 .35rem;
}
.cal-toolbar .cal-nav { display: inline-flex; align-items: center; gap: var(--s1); }
.cal-toolbar .cal-title {
  font-size: var(--text-lg); font-weight: 650; letter-spacing: -.02em; min-width: 8rem;
}
.cal-filter-menu { position: relative; }
.cal-filter-menu > summary {
  list-style: none; cursor: pointer;
}
.cal-filter-menu > summary::-webkit-details-marker { display: none; }
.cal-filter-menu[open] > summary { background: var(--color-surface-alt); }
.cal-filters {
  position: absolute; right: 0; top: calc(100% + .35rem); z-index: 20;
  display: flex; flex-direction: column; gap: .25rem; min-width: 9.5rem;
  padding: .45rem; background: var(--color-surface); border: 1px solid var(--border);
  border-radius: var(--radius-sm); box-shadow: var(--shadow-pop);
}
.cal-filters button {
  min-height: 2rem; padding: 0 .65rem; border-radius: var(--radius-sm); border: 0;
  background: transparent; color: var(--color-text-muted); font-size: var(--text-sm);
  font-weight: 650; cursor: pointer; text-align: left;
}
.cal-filters button:hover { background: var(--color-surface-alt); }
.cal-filters button[aria-pressed="true"] { color: var(--color-text); background: var(--color-surface-alt); }
.cal-filters button[data-type="share_expiry"][aria-pressed="true"] { color: var(--color-info); }
.cal-filters button[data-type="share_send"][aria-pressed="true"] { color: #0f766e; }
.cal-filters button[data-type="task"][aria-pressed="true"] { color: var(--color-brand-dark); }
.cal-filters button[data-type="file_request"][aria-pressed="true"] { color: var(--color-warning-ink); }
.cal-filters button[data-type="note"][aria-pressed="true"] { color: #5b4b8a; }
.cal-filters button[data-type="hold"][aria-pressed="true"] { color: var(--color-danger-ink); }
.cal-views { display: inline-flex; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.cal-views button {
  min-height: 2.25rem; padding: 0 .75rem; border: 0; background: transparent;
  font-size: var(--text-sm); font-weight: 650; color: var(--color-text-muted); cursor: pointer;
}
.cal-views button[aria-pressed="true"] { background: var(--color-brand-soft); color: var(--color-brand-dark); }
.cal-body {
  display: grid; grid-template-columns: 1fr; gap: 0; min-height: 0; flex: 1;
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--color-surface); overflow: hidden;
}
.cal-body.with-pane { grid-template-columns: 1fr min(22rem, 40%); }
.cal-main { min-width: 0; min-height: 0; overflow: auto; padding: var(--s3); }
.cal-pane {
  border-left: 1px solid var(--border); background: var(--color-surface);
  padding: var(--s4); overflow: auto; min-height: 0;
}
.cal-pane h2 { margin: 0 0 .35rem; font-size: .98rem; }
.cal-pane .pane-h {
  font-size: .68rem; margin: .85rem 0 .35rem; color: var(--color-text-muted);
  text-transform: uppercase; letter-spacing: .06em; font-weight: 700;
}
.cal-pane .pane-facts { display: grid; gap: .45rem; font-size: var(--text-sm); }
.cal-pane .pane-facts .k {
  display: block; font-size: var(--text-xs); font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; color: var(--color-text-faint); margin-bottom: .1rem;
}
.cal-pane .pane-facts .v { color: var(--color-text); }
.cal-tabs {
  display: flex; gap: .2rem; margin: 0 0 var(--s3);
  border-bottom: 1px solid var(--border); padding-bottom: .15rem;
}
.cal-tabs button {
  border: 0; background: transparent; cursor: pointer; font: inherit;
  font-size: var(--text-sm); font-weight: 650; color: var(--color-text-muted);
  padding: .4rem .55rem; border-radius: var(--radius-sm) var(--radius-sm) 0 0;
}
.cal-tabs button[aria-selected="true"] {
  color: var(--color-brand-dark);
  box-shadow: inset 0 -2px 0 var(--color-brand);
}
.cal-panel { display: grid; gap: .35rem; }
.cal-hint {
  margin: 0 0 .35rem; font-size: var(--text-sm); color: var(--color-text-muted); line-height: 1.4;
}
.cal-field {
  width: 100%; margin-bottom: .35rem;
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: .55rem .65rem; background: var(--color-surface); color: inherit;
}
textarea.cal-field { resize: vertical; min-height: 7rem; line-height: 1.45; }
.cal-field:focus { border-color: var(--color-brand); box-shadow: var(--ring); outline: 0; }
.cal-pane-actions { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .5rem; }
.cal-remind-row {
  margin-top: var(--s4); padding-top: var(--s3); border-top: 1px solid var(--border);
  display: grid; gap: .35rem;
}
.opt { font-weight: 500; color: var(--color-text-faint); }
.cal-dot {
  display: inline-block; width: .45rem; height: .45rem; border-radius: 50%; vertical-align: middle; margin-right: .25rem;
}
.cal-dot.share_expiry { background: var(--color-info); }
.cal-dot.share_send { background: #0f766e; }
.cal-dot.task { background: var(--color-brand); }
.cal-dot.file_request { background: var(--color-warning); }
.cal-dot.hold { background: var(--color-danger); }
.cal-dot.note { background: #7c6bb0; }
.cal-agenda { display: grid; gap: var(--s4); }
.cal-day-head {
  display: block; width: 100%; text-align: left; border: 0; background: transparent;
  margin: 0 0 .45rem; padding: 0; cursor: pointer; font: inherit;
  font-size: .72rem; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase; color: var(--color-text-faint);
}
.cal-day-head:hover { color: var(--color-brand-dark); }
.cal-day-head.is-today { color: var(--color-brand-dark); }
.cal-event {
  display: grid; grid-template-columns: 3.75rem 1fr; gap: .55rem; align-items: start;
  width: 100%; text-align: left; border: 0; border-radius: var(--radius-sm);
  background: transparent; padding: .45rem .5rem; cursor: pointer;
  margin-bottom: .2rem; font: inherit; color: inherit;
}
.cal-event:hover { background: var(--color-surface-alt); }
.cal-event.is-selected { background: var(--color-brand-soft); }
.cal-event.is-overdue { box-shadow: inset 3px 0 0 var(--color-danger); }
.cal-event.is-soon { box-shadow: inset 3px 0 0 var(--color-warning); }
.cal-event .when { font-size: var(--text-xs); color: var(--color-text-muted); font-variant-numeric: tabular-nums; padding-top: .1rem; }
.cal-event .ttl { font-size: var(--text-sm); font-weight: 650; line-height: 1.3; }
.cal-event .meta { font-size: var(--text-xs); color: var(--color-text-faint); margin-top: .15rem; }
.cal-empty-slot {
  margin: .15rem 0 0; font-size: var(--text-xs); color: var(--color-text-faint);
}
.cal-month {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
}
.cal-month .dow {
  background: var(--color-surface-alt); padding: .4rem .35rem; font-size: .65rem; font-weight: 700;
  letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-faint); text-align: center;
}
.cal-month .cell {
  background: var(--color-surface); min-height: 5.5rem; padding: .35rem; vertical-align: top;
  border: 0; text-align: left; cursor: pointer; font: inherit; color: inherit;
  display: flex; flex-direction: column; gap: .15rem;
}
.cal-month .cell:hover { background: var(--color-surface-alt); }
.cal-month .cell.muted { color: var(--color-text-faint); background: #f7f8f7; }
.cal-month .cell.is-focus { background: color-mix(in srgb, var(--color-brand-soft) 55%, white); outline: 2px solid var(--color-brand); outline-offset: -2px; z-index: 1; }
.cal-month .cell.today .dn {
  display: inline-flex; width: 1.4rem; height: 1.4rem; align-items: center; justify-content: center;
  border-radius: 50%; background: var(--color-brand); color: #fff; font-weight: 700;
}
.cal-month .dn { font-size: .75rem; font-weight: 650; }
.cal-month .pill {
  font-size: .62rem; font-weight: 650; padding: .1rem .3rem; border-radius: 4px; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.cal-month .pill.share_expiry { background: var(--color-info-soft); color: var(--color-info); }
.cal-month .pill.share_send { background: #e6f5f3; color: #0f766e; }
.cal-month .pill.task { background: var(--color-brand-soft); color: var(--color-brand-dark); }
.cal-month .pill.file_request { background: var(--color-warning-soft); color: var(--color-warning-ink); }
.cal-month .pill.hold { background: var(--color-danger-soft); color: var(--color-danger-ink); }
.cal-month .pill.note { background: #f0eef7; color: #5b4b8a; }
.cal-month .more { font-size: .62rem; color: var(--color-text-faint); padding-left: .2rem; }
.cal-week {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 1px;
  background: var(--border); border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden;
  min-height: 22rem;
}
.cal-week .col {
  background: var(--color-surface); padding: .45rem; min-height: 0;
  display: flex; flex-direction: column; gap: .3rem; cursor: pointer;
}
.cal-week .col:hover { background: var(--color-surface-alt); }
.cal-week .col.today { background: color-mix(in srgb, var(--color-brand-soft) 45%, white); }
.cal-week .col.is-focus { outline: 2px solid var(--color-brand); outline-offset: -2px; z-index: 1; }
.cal-week .col h4 { margin: 0 0 .2rem; font-size: .7rem; font-weight: 700; color: var(--color-text-muted); }
.cal-week .col .cal-event { grid-template-columns: 1fr; padding: .35rem .4rem; }
@media (max-width: 900px) {
  .cal-body.with-pane { grid-template-columns: 1fr; }
  .cal-pane { border-left: 0; border-top: 1px solid var(--border); }
  .cal-week { grid-template-columns: 1fr; }
  .cal-month .cell { min-height: 3.5rem; }
  .cal-filters { left: 0; right: auto; }
}
