/* SLB Workspace — single design layer. Navy sidebar, blue actions, quiet surfaces. */
:root {
  --navy-950: #081736;
  --navy-900: #0b1f47;
  --blue-700: #1349b4;
  --blue-600: #1a5fd8;
  --blue-500: #3a78e6;
  --blue-100: #dde9fd;
  --blue-50: #eef4ff;
  --ink: #0f1b33;
  --text: #25334b;
  --muted: #66748b;
  --faint: #93a0b4;
  --line: #e0e6ef;
  --line-strong: #cdd6e3;
  --surface: #ffffff;
  --bg: #f4f6fa;
  --green-700: #17693f; --green-100: #dff3e7;
  --amber-700: #8f4f00; --amber-100: #fff0d4;
  --red-700: #b42318; --red-100: #fde6e4;
  --violet-700: #5a37c2; --violet-100: #ece7fd;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 27, 51, .05), 0 2px 8px rgba(15, 27, 51, .04);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, "Hiragino Sans", "Hiragino Kaku Gothic ProN", "Yu Gothic UI", "Meiryo", sans-serif;
}
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.55 var(--font); }
a { color: var(--blue-600); text-decoration: none; }
a:hover { color: var(--blue-700); text-decoration: underline; }
h1, h2, h3, h4 { color: var(--ink); margin: 0 0 8px; line-height: 1.25; }
h1 { font-size: 28px; font-weight: 750; letter-spacing: -.4px; }
h2 { font-size: 18px; font-weight: 700; letter-spacing: -.2px; }
h3 { font-size: 15px; font-weight: 700; }
h4 { font-size: 14px; font-weight: 650; }
p { margin: 0 0 12px; }
small { font-size: 12px; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.sr-only { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.skip-link { position: absolute; left: 12px; top: -60px; z-index: 200; background: #fff; border: 2px solid var(--blue-600); padding: 8px 12px; border-radius: 6px; }
.skip-link:focus { top: 8px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.eyebrow { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: var(--muted); margin-bottom: 6px; }
.full { grid-column: 1 / -1; }
[hidden] { display: none !important; }
.block { width: 100%; }
.push-right { margin-left: auto; }
.stacked-form { margin-top: 6px; }
.fieldset-reset { border: 0; padding: 0; margin: 0; }
.legend-label { font-size: 13px; font-weight: 650; color: var(--ink); }
.center-check { justify-content: center; margin: 0; }
/* Inline "Add document rows" */
.row-adder { margin: 10px 0 0; }
.link-button { border: 0; background: none; padding: 4px 0; color: var(--blue-600); font-weight: 600; }
.link-button:hover { color: var(--blue-700); text-decoration: underline; }
.row-adder-form { margin-top: 8px; padding: 12px 14px; border: 1px dashed #9dbbee; border-radius: 10px; background: var(--blue-50); }
.row-adder-fields { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.row-adder-fields label { margin: 0; }
.row-adder-name { flex: 1 1 320px; }
.row-adder-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.row-adder-fields .row-adder-actions .btn-sm { min-height: 40px; }
.row-adder-hint { margin: 8px 0 0; }
.row-adder-form .review-warning, .row-adder-form .error, .row-adder-form .notice { margin: 10px 0 0; }
.row-adder-form .review-warning p { margin-bottom: 8px; }
.catalog-add { margin-bottom: 12px; }
.row-actions.start { justify-content: flex-start; }
.count-badge { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .22); font-size: 12px; font-weight: 800; }
.secondary .count-badge { background: var(--blue-100); }
.icon { width: 20px; height: 20px; flex: 0 0 auto; }

/* ---------- Shell ---------- */
.sidebar { position: fixed; inset: 0 auto 0 0; width: 232px; z-index: 60; display: flex; flex-direction: column;
  background: linear-gradient(180deg, var(--navy-900) 0%, var(--navy-950) 100%); color: #c7d4ea; padding: 22px 14px; }
.brand { display: block; color: #fff; padding: 4px 12px 26px; position: relative; }
.brand:hover { color: #fff; text-decoration: none; }
.brand-word { display: block; font-size: 30px; font-weight: 800; letter-spacing: .5px; line-height: 1; }
.brand-sub { display: block; font-size: 11px; font-weight: 600; letter-spacing: .42em; color: #b7c8e6; margin-top: 6px; }
.brand-wave { display: block; width: 96px; height: 3px; margin-top: 8px; border-radius: 3px; background: linear-gradient(90deg, transparent, #4f8df5 40%, #8fb8ff); }
.sidebar nav { display: flex; flex-direction: column; gap: 4px; }
.sidebar nav a { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-radius: 8px; color: #d6e0f2; font-weight: 600; font-size: 15px; }
.nav-indicator-group { display:none; }
.nav-indicator-group:has(.task-nav-indicator:not([hidden])) { display:inline-flex; align-items:center; gap:5px; }
.task-nav-indicator:not([hidden]) { display:inline-block; width:9px; height:9px; flex:0 0 9px; border-radius:50%; background:#74b9ff; box-shadow:0 0 0 1px #fff; }
.task-nav-indicator-attention:not([hidden]) { background:#d92d20; }
.sidebar nav a:hover { background: rgba(255, 255, 255, .07); color: #fff; text-decoration: none; }
.sidebar nav a.active { background: var(--blue-600); color: #fff; box-shadow: 0 4px 14px rgba(26, 95, 216, .35); }
.sidebar-world-clocks { display: none; }
@media (min-width: 761px) {
  .sidebar { overflow-y: auto; }
  .sidebar-world-clocks { display: block; min-width: 0; margin: 18px 5px 0; padding: 12px 8px 0; border-top: 1px solid rgb(255 255 255 / 18%); }
  .sidebar-clocks-heading { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 6px; }
  .sidebar-world-clocks h2 { margin: 0; color: #c7d4ea; font-size: 16px; font-weight: 700; }
  .sidebar-clocks-heading a { color: #d6e0f2; font-size: 12px; text-decoration: underline; text-underline-offset: 3px; }
  .sidebar-world-clocks dl, .sidebar-world-clocks dd { margin: 0; }
  .sidebar-world-clocks dl > div { display: flex; align-items: baseline; justify-content: space-between; gap: 6px; padding: 3px 0; font-size: 12px; }
  .sidebar-world-clocks dt { font-size: 14px; }
  .sidebar-world-clocks time { color: #fff; font-variant-numeric: tabular-nums; white-space: nowrap; }
  .sidebar-world-clocks .clock-digits { font-size: 14px; }
}
@media (min-width: 761px) and (max-width: 1340px) and (orientation: portrait) {
  .sidebar-world-clocks { display: none; }
}
.shell { margin-left: 232px; min-height: 100vh; display: flex; flex-direction: column; }
.topbar { position: sticky; top: 0; z-index: 40; height: 64px; display: flex; align-items: center; gap: 16px; padding: 0 28px;
  background: rgba(255, 255, 255, .96); backdrop-filter: blur(6px); border-bottom: 1px solid var(--line); }
.nav-toggle, .mobile-brand { display: none; }
.breadcrumb { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 13px; color: var(--muted); }
.breadcrumb label { margin: 0; font-weight: 600; color: var(--muted); }
.breadcrumb select { width: auto; min-width: 240px; max-width: 360px; margin: 0; min-height: 38px; font-weight: 700; color: var(--ink); }
.account { margin-left: auto; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.account form { margin: 0; }
.account .account-action.btn-sm { min-height: 48px; display: inline-flex; align-items: center; justify-content: center; white-space: nowrap; }
.account .account-timezone { flex-direction: column; gap: 2px; line-height: 1.15; }
.account-timezone small { color: var(--muted); font-size: 11px; font-weight: 600; }
.timezone-matches { list-style: none; max-height: 15rem; overflow: auto; margin: 0 0 12px; padding: 3px; border: 1px solid var(--line); border-radius: 8px; }
.timezone-matches li + li { margin-top: 3px; }
.timezone-matches button { width: 100%; text-align: left; }
.local-time-list { list-style: none; margin: 0 0 16px; padding: 0; }
.local-time-list:empty { display: none; }
.local-time-list li { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 6px 0; border-bottom: 1px solid var(--line); }
.local-time-list li.is-pressing, .local-time-list li.is-dragging { background: var(--blue-50); }
.local-time-list li.is-dragging { outline: 2px solid var(--blue-500); }
.local-time-list .local-time-move { display: inline-flex; align-items: center; gap: 9px; flex: 1; justify-content: flex-start; min-width: 0; padding: 6px 4px; border: 0; background: transparent; color: var(--ink); text-align: left; cursor: grab; touch-action: pan-y; user-select: none; }
.local-time-add { display: flex; align-items: end; gap: 8px; margin-bottom: 16px; }
.local-time-add label { flex: 1; min-width: 0; margin-bottom: 0; }
.avatar { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--blue-50); color: var(--blue-700); font-weight: 800; border: 1px solid var(--blue-100); }
.account-name { display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 4px 8px 4px 4px; border-radius: 999px; font-weight: 650; color: var(--ink); white-space: nowrap; text-decoration: none; }
.account-name:hover, .account-name:focus-visible { background: var(--blue-50); color: var(--blue-700); }
.account-name:hover .account-label { text-decoration: underline; text-underline-offset: 3px; }
.account-name small { color: var(--muted); font-weight: 500; margin-left: 4px; font-size: 13px; }
.account-name small::before { content: "· "; }
.account-edit { display: inline-grid; place-items: center; color: var(--muted); }
.account-edit .icon { width: 16px; height: 16px; }
.account-name:hover .account-edit { color: var(--blue-700); }
main { flex: 1; width: 100%; max-width: 1520px; margin: 0 auto; padding: 24px 28px 48px; }
footer { display: flex; justify-content: space-between; gap: 16px; padding: 14px 28px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); background: #fff; }

/* ---------- Page structure ---------- */
.page-heading { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { margin: 0; }
.page-heading.tasks-page-heading { flex-direction:row; flex-wrap:nowrap; justify-content:flex-start; align-items:center; gap:12px; }
.tasks-page-heading > h1 { align-self:flex-start; overflow-wrap:anywhere; }
.tasks-page-heading > .heading-actions { flex:none; }
.page-heading p { margin: 4px 0 0; }
.heading-actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; margin-bottom: 10px; }
.crumbs { display: flex; gap: 8px; align-items: center; font-size: 13px; margin-bottom: 12px; color: var(--muted); flex-wrap: wrap; }
.crumbs a { font-weight: 600; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px 22px; margin-bottom: 18px; min-width: 0; }
.card > h2:first-child, .card > header:first-child h2 { margin-bottom: 14px; }
.card-header { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
.card-header h2 { margin: 0; }
.table-card { padding: 18px 20px; }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 18px; }
.catalog-stack { display: flex; flex-direction: column; gap: 18px; min-width: 0; }
.catalog-stack > .card { margin: 0; }
.template-catalog-grid { margin-block: 0 20px; }
#registration-rules [data-reorder-scroll-panel]:not(:has(> li > details[open])) { max-height: 17rem; overflow-y: auto; }
.overview-columns { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 18px; align-items: start; }
[data-document-progress-details] .overview-progress-phone { display: none; }
[data-document-progress-details] .overview-progress-section { margin-top: 3px; }
[data-document-progress-details] .overview-progress-download { min-width: 38px; min-height: 36px; padding: 4px; justify-content: center; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  [data-document-progress-details] .overview-progress-wide { display: none; }
  [data-document-progress-details] .overview-progress-phone { display: inline-block; }
  [data-document-progress-details] .overview-progress-section { display: block; }
  [data-document-progress-details] .overview-progress-file { text-align: center; }
  [data-document-progress-details] table { min-width: 0; }
}

.settings-content { max-width: 1240px; }

/* ---------- Tabs ---------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin: 0 0 18px; overflow-x: auto; scrollbar-width: none; }
.tabs a { padding: 10px 16px 12px; color: var(--muted); font-weight: 650; border-bottom: 3px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.tabs a:hover { color: var(--ink); text-decoration: none; }
.tabs a.selected, .tabs a[aria-current="page"] { color: var(--blue-600); border-bottom-color: var(--blue-600); }

/* ---------- Buttons ---------- */
.primary, .secondary, .button, .danger { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 38px; padding: 8px 16px;
  border-radius: 8px; border: 1px solid transparent; font-weight: 650; font-size: 14px; line-height: 1.2; white-space: nowrap; text-decoration: none; transition: background .12s, border-color .12s, box-shadow .12s; }
.button:hover, .primary:hover, .secondary:hover { text-decoration: none; }
.primary, .button.primary { background: var(--blue-600); color: #fff; border-color: var(--blue-600); }
.primary:hover, .button.primary:hover { background: var(--blue-700); border-color: var(--blue-700); color: #fff; }
.secondary, .button.secondary, .button { background: #fff; color: var(--blue-600); border-color: #9dbbee; }
.secondary:hover, .button.secondary:hover, .button:hover { background: var(--blue-50); border-color: var(--blue-500); color: var(--blue-700); }
.button.quiet, .secondary.quiet { border-color: var(--line-strong); color: var(--text); }
.danger { background: #fff; color: var(--red-700); border-color: #efb3ad; }
.danger-button { display: inline-flex; align-items: center; justify-content: center; min-height: 38px; padding: 8px 16px; border-radius: 8px; border: 1px solid #c8382b; background: #c8382b; color: #fff; font-weight: 700; }
.danger-button:hover { background: #a92c21; border-color: #a92c21; }
.danger-button.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; }
.danger-zone { border-color: #f1c9c4; }
.danger-zone h2 { color: var(--red-700); }
.danger-form { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px 12px; }
.danger-form label { flex: 1 1 280px; margin: 0; }
.plain-list { list-style: none; margin: 0; padding: 0; }
.plain-list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.plain-list form { margin: 0; }
.section-delete { margin-top: 10px; }
.section-management { display: flex; flex-wrap: nowrap; align-items: flex-start; gap: 8px 18px; margin-top: 10px; }
.section-management > * { min-width: 0; margin: 0; flex: 0 1 auto; }
.section-management > :is(.row-adder:has(> form:not([hidden])), details[open]) { flex: 1 1 240px; }
/* Use the same text line box for buttons and disclosure labels. */
.section-management > .row-adder > [data-row-adder-open],
.section-management > details > summary {
  display: block;
  width: fit-content;
  max-width: 100%;
  min-height: 0;
  margin: 0;
  padding: 6px 0;
  border: 0;
  font: 600 13px/20px system-ui, sans-serif;
  text-align: start;
  overflow-wrap: anywhere;
  list-style: none;
}
.section-management > details > summary::-webkit-details-marker { display: none; }
.section-management > .section-name-editor > summary::before { content: none; }
.section-management .row-adder-fields > label, .section-management input:not([type="hidden"]) { min-width: 0; }
.section-management .row-adder button[data-row-adder-open] { white-space: normal; text-align: start; overflow-wrap: anywhere; }
.section-management .section-name-form label { min-width: 0; }
@media (max-width: 550px) {
  .section-management { gap: 6px 10px; }
  .section-management > * { flex: 1 1 0; }
  .section-management > .row-adder { flex-grow: 1.35; }
  .section-management form { padding-inline: 6px; }
  .section-management button { white-space: normal; overflow-wrap: anywhere; }
  .section-management > :is(.row-adder:has(> form:not([hidden])), details[open]) { flex-basis: 50%; }
  .section-management button[data-row-adder-open] { max-width: 100%; }
}
.section-delete > summary { display: inline-block; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--muted); list-style: none; }
.section-delete > summary::-webkit-details-marker { display: none; }
.section-delete > summary:hover { color: var(--red-700); text-decoration: underline; }
.section-delete-form { margin-top: 8px; padding: 12px 14px; border: 1px solid #f1c9c4; border-radius: 10px; background: #fff7f6; }
.section-delete-form p { margin: 0 0 10px; font-size: 13px; }
.btn-sm, .button.btn-sm, .secondary.btn-sm, .primary.btn-sm { min-height: 32px; padding: 5px 12px; font-size: 13px; border-radius: 7px; }
button:disabled, .button[aria-disabled="true"] { opacity: .5; cursor: not-allowed; box-shadow: none; }
.primary:disabled:hover { background: var(--blue-600); }
.dialog-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.dialog-actions .spacer { margin-right: auto; }

/* ---------- Forms ---------- */
label { display: block; font-size: 13px; font-weight: 650; color: var(--ink); margin-bottom: 14px; }
input, select, textarea { display: block; width: 100%; margin-top: 6px; min-height: 40px; padding: 8px 11px; border: 1px solid var(--line-strong);
  border-radius: 8px; background: #fff; color: var(--ink); font-size: 14px; font-weight: 500; }
select { appearance: none; padding-right: 34px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1.5l5 5 5-5' fill='none' stroke='%2325334b' stroke-width='1.6' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat right 12px center; }
textarea { min-height: 84px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--blue-500); box-shadow: 0 0 0 3px rgba(58, 120, 230, .18); }
input[type="checkbox"], input[type="radio"] { display: inline-block; width: 17px; height: 17px; min-height: 0; margin: 0 8px 0 0; padding: 0; vertical-align: -3px; accent-color: var(--blue-600); }
input[type="file"] { padding: 7px; }
input:disabled, select:disabled { background: #f3f5f9; color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 20px; }
.check-row { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.field-hint { display: block; font-size: 12px; font-weight: 500; color: var(--muted); margin-top: 5px; }

/* ---------- Notices ---------- */
.notice, .error, .info, .review-warning { display: block; padding: 11px 14px 11px 40px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; position: relative; border: 1px solid; }
.notice::before, .error::before, .info::before, .review-warning::before { position: absolute; left: 13px; top: 10px; width: 18px; height: 18px; border-radius: 50%;
  display: grid; place-items: center; font-size: 12px; font-weight: 800; color: #fff; }
.notice { background: #eaf7ef; border-color: #c4e6d1; color: #165c38; }
.notice::before { content: "✓"; background: #2c9a5d; }
.info { background: var(--blue-50); border-color: #cfdffb; color: #1d3f7a; }
.info::before { content: "i"; background: var(--blue-500); font-family: Georgia, serif; }
.error { background: #fdeeec; border-color: #f4c7c1; color: #8c1d13; }
.error::before { content: "!"; background: #d64535; }
.review-warning { background: #fff6e3; border-color: #f2d699; color: #6f4300; }
.review-warning::before { content: "!"; background: #d99400; }
.notice p, .error p, .info p, .review-warning p { margin: 0 0 6px; }
.notice > :last-child, .error > :last-child, .info > :last-child, .review-warning > :last-child { margin-bottom: 0; }
.error ul { margin: 4px 0 0; padding-left: 18px; }
.empty-state { text-align: center; padding: 36px 20px; color: var(--muted); }
.empty-state strong { display: block; color: var(--ink); font-size: 15px; margin-bottom: 4px; }

/* ---------- Tables ---------- */
.table-scroll { overflow-x: auto; max-width: 100%; }
table { width: 100%; border-collapse: collapse; font-size: 14px; text-align: left; }
th { background: #f3f6fb; color: var(--ink); font-size: 13px; font-weight: 700; padding: 10px 12px; white-space: nowrap; border-bottom: 1px solid var(--line); }
th:first-child { border-top-left-radius: 8px; }
th:last-child { border-top-right-radius: 8px; }
td { padding: 11px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: #fafbfe; }
td small { display: block; color: var(--muted); font-size: 12px; }
tr.selected-project td { background: var(--blue-50); }
tr.selected-project td:first-child { box-shadow: inset 3px 0 0 var(--blue-600); }
tr[data-project-row] { cursor: pointer; }
td .row-link { font-weight: 700; }

/* ---------- Pills & badges ---------- */
.pill { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; line-height: 1.5;
  background: #edf0f5; color: #3d4a60; white-space: nowrap; }
.pill + .pill { margin-left: 6px; }
.pill.success { background: var(--green-100); color: var(--green-700); }
.pill.warning { background: var(--amber-100); color: var(--amber-700); }
.pill.danger, .pill.urgent { background: var(--red-100); color: var(--red-700); }
.pill.blue { background: var(--blue-100); color: var(--blue-700); }
.pill[data-status="Active"] { background: var(--blue-100); color: var(--blue-700); }
.pill[data-status="Completed"] { background: var(--green-100); color: var(--green-700); }
.file-progress[data-file-progress="Draft"] { background: #edf0f5; color: #3d4a60; }
.file-progress[data-file-progress="Final"] { background: var(--blue-100); color: var(--blue-700); }
.file-progress[data-file-progress="Seller Signed"] { background: var(--amber-100); color: var(--amber-700); }
.file-progress[data-file-progress="Buyer Signed"] { background: var(--violet-100); color: var(--violet-700); }
.file-progress:is([data-file-progress="Executed"], [data-file-progress="Issued"]) { background: var(--green-100); color: var(--green-700); }
.documents-table .document-row:is(.is-executed, .is-issued), .documents-table .document-row:is(.is-executed, .is-issued) td { background: #edf8f0; }
.file-progress[data-file-progress="No file"] { background: #fff; color: #4e5c70; border: 1px dashed var(--line-strong); }
.file-progress[data-file-progress="Unknown"] { background: var(--red-100); color: var(--red-700); }
.new-label { display: inline-flex; align-items: center; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 800; letter-spacing: .02em; }
.file-new { background: #d9f3fb; color: #0b6a8a; }
.file-updated { background: #e8edf4; color: #334155; }
.file-updated[data-publication-party="Internal"] { background: #e3e8ff; color: #3538cd; }
.file-updated[data-publication-party="Counterparty"] { background: #ffedc2; color: #7c3d00; }
.age-1 { opacity: .85; }
.delivery-result { display: inline-flex; padding: 3px 10px; border-radius: 999px; font-size: 13px; font-weight: 700; background: #edf0f5; color: #3d4a60; }
.delivery-result[data-label="Sent"] { background: var(--green-100); color: var(--green-700); }
.delivery-result[data-label="Failed"] { background: var(--red-100); color: var(--red-700); }

/* ---------- Key/value facts ---------- */
.project-facts { margin: 0; }
.project-facts > div { display: grid; grid-template-columns: 160px minmax(0, 1fr); gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--line); }
.project-facts > div:last-child { border-bottom: 0; }
.project-facts dt { color: var(--muted); }
.project-facts dd { margin: 0; font-weight: 700; color: var(--ink); overflow-wrap: anywhere; }

/* ---------- Overview ---------- */
.progress-stack { display: block; width: 100%; height: 12px; border-radius: 999px; overflow: hidden; background: #e9edf4; margin: 10px 0 12px; }
.progress-stack rect[class^="seg-"] { fill: var(--segment-color); }
.progress-legend i[class^="seg-"] { background: var(--segment-color); }
.progress-legend { display: flex; flex-wrap: wrap; gap: 8px 16px; font-size: 13px; color: var(--text); }
.progress-legend span { display: inline-flex; align-items: center; gap: 6px; }
.progress-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.seg-draft { --segment-color: #64748b; } .seg-final { --segment-color: #1559b5; } .seg-seller { --segment-color: #aa6507; }
.seg-buyer { --segment-color: #8655ba; } .seg-both { --segment-color: #2f9e62; } .seg-issued { --segment-color: #137c83; } .seg-nofile { --segment-color: #dfe4ec; } .seg-unknown { --segment-color: #ae3447; }
.stat-row { display: flex; gap: 22px; flex-wrap: wrap; margin-bottom: 4px; }
.stat-row div { display: flex; flex-direction: column; }
.stat-row strong { font-size: 22px; color: var(--ink); line-height: 1.1; }
.stat-row span { font-size: 12px; color: var(--muted); }

/* ---------- Documents ---------- */
.document-selection-toolbar { position: sticky; top: 64px; z-index: 30; display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 9px 14px; margin-bottom: 14px; box-shadow: var(--shadow); }
.document-selection-toolbar form { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin: 0; }
.document-item-list-actions { display: flex; gap: 8px; max-width: 100%; }
.document-selection-summary { display: contents; }
.document-selection-mutations { display: flex; align-items: center; gap: 8px; min-width: 0; max-width: 100%; }
.document-selection-toolbar label { margin: 0; font-weight: 600; display: inline-flex; align-items: center; gap: 8px; }
.document-selection-toolbar p { margin: 0; }
.document-selection-toolbar select { width: auto; min-width: 180px; margin: 0; min-height: 34px; }
.guest-recipient-pickers { display: grid; width: 100%; gap: 8px; }
.document-selection-toolbar .guest-recipient-pickers select { display: block; width: 100%; min-width: 0; margin-top: 4px; }
.guest-preset-controls { width: 100%; display: flex; flex-wrap: wrap; gap: 8px; align-items: flex-start; margin-bottom: 8px; }
.guest-preset-controls details[open] { flex-basis: 100%; }
.guest-preset-controls details[open] > label { display: block; margin-top: 8px; }
.guest-preset-controls > p { flex-basis: 100%; }
.document-selection-toolbar :is(.primary, .secondary, [data-document-selection-delete]) { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.document-selection-toolbar form[data-document-progress-form] { display: grid; grid-template-columns: auto minmax(0, 180px) auto; min-width: 0; max-width: 100%; }
.document-selection-toolbar [data-document-progress-form] > label,
.document-selection-toolbar [data-document-selection-progress] { white-space: nowrap; }
.document-selection-toolbar [data-document-progress-form] > select { min-width: 0; width: 100%; }
.document-selection-toolbar [data-document-progress-inputs] { display: none; }
.document-selection-toolbar :is([data-document-progress-denied], [data-document-progress-limit]) { grid-column: 1 / -1; }
.selection-count { color: var(--muted); font-size: 13px; padding-right: 10px; border-right: 1px solid var(--line); }
.card.urgent-documents {
  --panel-chevron: #d93825;
  padding: 0; margin-bottom: 12px; border-radius: 12px;
  border-inline-start: 4px solid #e0533f;
  background: linear-gradient(90deg, #fff8f6, var(--surface) 52%);
}
:is(.urgent-documents, .project-comments) > summary {
  display: flex; align-items: center; gap: 10px; min-width: 0;
  list-style: none; cursor: pointer; font-weight: 700;
}
:is(.urgent-documents, .project-comments) > summary::-webkit-details-marker { display: none; }
:is(.urgent-documents, .project-comments) > summary::before {
  content: ""; width: 8px; height: 8px; flex: 0 0 8px;
  margin-inline: 2px 1px; border: solid var(--panel-chevron, var(--blue-600)); border-width: 0 2px 2px 0;
  transform: rotate(-45deg);
}
:is(.urgent-documents, .project-comments)[open] > summary::before { transform: rotate(45deg); }
:is(.urgent-documents, .project-comments) > summary:focus-visible { outline-offset: -4px; border-radius: 12px; }
.urgent-documents > summary { padding: 8px 24px; min-height: 44px; color: #8c1b0d; font-size: 16px; }
.urgent-documents[open] > summary::before { transform: translateY(-2px) rotate(45deg); }
.urgent-documents > .plain-list { margin: 0 24px 16px; }
.urgent-documents .urgent-upload-meta { flex-basis: 100%; min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
.urgent-documents .urgent-upload-comment { flex-basis: 100%; min-width: 0; max-width: 100%; margin: 0; white-space: pre-wrap; overflow-wrap: anywhere; }
.urgent-documents .plain-list > li { justify-content: flex-start; flex-wrap: wrap; gap: 8px 14px; padding: 14px 0; }
.urgent-documents .plain-list > li > :is(span, .file-link) { min-width: 0; max-width: 100%; overflow-wrap: anywhere; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .urgent-documents > summary { padding-inline: 14px; }
  .urgent-documents > .plain-list { margin-inline: 14px; }
  .urgent-documents .plain-list > li { flex-direction: column; align-items: flex-start; }
}
.document-section { padding: 0; overflow: hidden; margin-bottom: 12px; }
.document-section-add > form { max-width: 460px; margin-top: 8px; }
.document-section > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; padding: 13px 18px; background: #fff; }
.document-section > summary::-webkit-details-marker { display: none; }
.document-section > summary::before { content: ""; width: 9px; height: 9px; border-right: 2px solid var(--blue-600); border-bottom: 2px solid var(--blue-600);
  transform: rotate(-45deg); transition: transform .15s; margin: 0 4px 0 2px; flex: 0 0 auto; }
.document-section[open] > summary { background: var(--blue-50); border-bottom: 1px solid var(--line); }
.document-section[open] > summary::before { transform: rotate(45deg); }
.document-section > summary h2 { margin: 0; font-size: 17px; min-width: 0; overflow-wrap: anywhere; }
.section-meta { margin-left: auto; display: flex; gap: 8px; align-items: center; font-size: 13px; color: var(--muted); white-space: nowrap; }
.section-content { padding: 14px 18px 16px; }
.section-actions { display: flex; align-items: stretch; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.section-drop { flex: 1 1 360px; display: flex; align-items: center; justify-content: center; gap: 10px; flex-wrap: wrap; min-height: 52px; padding: 10px 14px;
  border: 1.5px dashed #9fbcec; border-radius: 9px; background: #f8fbff; color: var(--text); font-weight: 600; text-align: center; }
.section-drop .small { flex-basis: 100%; font-weight: 500; color: var(--muted); }
.section-drop.dragover, [data-file-picker-drop].dragover { border-color: #2361b5; background: #dcecff; outline: 2px solid #2361b5; outline-offset: -2px; }
.documents-table .document-row.dragover td { background: #dcecff; box-shadow: inset 0 2px #2361b5, inset 0 -2px #2361b5; }
.delivery-date-field details { margin-top: 5px; }
.delivery-date-field summary { color: #2361b5; cursor: pointer; font-size: 13px; }
.date-calendar { margin-top: 8px; padding: 8px; border: 1px solid var(--line); border-radius: 8px; max-width: 340px; }
.delivery-date-field { margin-bottom: 14px; }
.delivery-date-field > label { margin-bottom: 0; }
.date-input-wrap { position: relative; margin-top: 6px; }
.date-input-wrap input { margin-top: 0; padding-right: 44px; }
.date-input-wrap details { position: static; }
.date-input-wrap .date-icon { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 34px; height: 32px; border-radius: 6px; color: var(--blue-600); cursor: pointer; list-style: none; }
.date-input-wrap .date-icon::-webkit-details-marker { display: none; }
.date-input-wrap .date-icon::marker { content: ""; }
.date-input-wrap .date-icon:hover, .date-input-wrap details[open] .date-icon { background: var(--blue-100); }
.date-input-wrap .date-icon .icon { width: 19px; height: 19px; }
.date-input-wrap .date-calendar { position: absolute; z-index: 40; right: 0; top: calc(100% + 6px); width: min(320px, 92vw); margin: 0; background: #fff; box-shadow: 0 12px 32px rgba(8, 23, 54, .18); }
.date-calendar-header { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.date-calendar-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 3px; margin-top: 8px; text-align: center; }
.date-calendar-grid button { padding: 4px 2px; min-width: 0; }
.date-calendar-grid [aria-pressed="true"] { background: #dcecff; border-color: #2361b5; }
.file-select { display: inline; margin: 0; color: var(--blue-600); cursor: pointer; font-weight: 700; }
.file-select:hover { text-decoration: underline; }
.admin-row-link { font-size: 13px; font-weight: 600; }
.documents-table { table-layout: fixed; }
.documents-table th, .documents-table td { padding: 9px 10px; }
.documents-table .document-select-column { width: 40px; }
.documents-table .document-status-column { width: 150px; }
.documents-table .document-progress-column { width: 160px; }
.documents-table .document-actor-column { width: 140px; }
.documents-table .document-time-column { width: 150px; }
.documents-table .document-actions-column { width: 158px; }
.documents-table .row-actions { flex-wrap: nowrap; }
.document-select-cell label, .document-table-select { margin: 0; display: inline-flex; }
.document-title-line { display: flex; align-items: baseline; gap: 4px 10px; flex-wrap: wrap; min-width: 0; }
.document-latest-file { display: contents; }
.document-version-files { display: flex; flex-wrap: wrap; align-items: baseline; gap: 3px 10px; min-width: 0; }
.candidate-additional-files { margin: 4px 0 0; padding-inline-start: 20px; overflow-wrap: anywhere; }
.document-title-line h4 { margin: 0; font-size: 14px; overflow-wrap: anywhere; }
.file-link { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; overflow-wrap: anywhere; }
.file-link::before { content: ""; width: 12px; height: 14px; flex: 0 0 auto; background: no-repeat center/contain url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 14'%3E%3Cpath d='M1 1h6l4 4v8H1z' fill='none' stroke='%231a5fd8' stroke-width='1.3'/%3E%3C/svg%3E"); }
.no-file { font-size: 13px; color: var(--faint); }
.registry-label, .document-main .small { margin: 3px 0 0; color: var(--muted); }
.file-indicators { display: flex; flex-wrap: nowrap; align-items: center; gap: 5px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.row-actions .button, .row-actions .secondary { min-height: 30px; padding: 4px 10px; font-size: 13px; }
.row-actions label.button { margin: 0; cursor: pointer; }
.row-actions .icon-button { min-width: 40px; justify-content: center; }
.document-comment-open { position: relative; }
.document-comment-unread { position: absolute; top: 4px; right: 4px; width: 8px; height: 8px; border-radius: 50%; background: var(--blue-600); }
.document-comment-thread > li { display: block; padding: 10px 0; overflow-wrap: anywhere; }
.document-comment-thread p { margin: 4px 0 0; white-space: pre-wrap; }
#document-comments-dialog [data-document-comments-form] { margin-top: 14px; }
.project-discussions {
  display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; gap: 12px; margin-bottom: 12px;
}
.card.project-comments { margin: 0; padding: 0; min-inline-size: 0; border-radius: 12px; }
.project-comments > summary { padding: 10px 16px; min-height: 46px; color: var(--ink); }
.project-comments > summary .count-badge { flex: 0 0 auto; color: var(--blue-700); background: var(--blue-50); white-space: nowrap; }
.project-comments[open] > summary { border-bottom: 1px solid var(--line); }
.project-comments-content { padding: 12px; }
.project-comments-actions, .project-comments-sort, .project-comment-order, .project-comment-item-filter {
  display: flex; align-items: center; flex-wrap: wrap; gap: 6px;
}
.project-comments-actions { justify-content: flex-end; margin-bottom: 8px; }
.project-comments-sort { padding: 8px; margin-bottom: 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.project-comment-item-filter { flex: 1 1 130px; min-width: 0; }
.project-comments-sort select { flex: 1 1 100px; min-width: 0; width: 100%; margin: 0; }
.project-comments button[aria-pressed="true"] { color: var(--blue-700); background: var(--blue-100); }
.project-comments .discussion-entries { display: grid; gap: 8px; margin: 0; }
.project-comments .discussion-entry {
  margin: 0; padding: 10px 12px; border: 1px solid var(--line); border-inline-start: 3px solid var(--line);
  border-radius: 8px; background: var(--surface);
}
.project-comments .discussion-entry.is-unread { border-inline-start-color: var(--blue-600); background: var(--blue-50); }
.discussion-entry > strong { color: var(--ink); }
.discussion-entry > p { margin-top: 6px; line-height: 1.6; }
.discussion-entry > [data-project-comment-mark-read] { margin-top: 8px; }
.project-comment-item { margin: 0 0 4px; overflow-wrap: anywhere; }
.project-comment-item button { text-align: start; overflow-wrap: anywhere; }
.project-comments-content section + section { margin-top: 14px; }
.project-comments-content > [data-project-comments-more] { margin-top: 10px; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .project-discussions { gap: 8px; align-items: stretch; }
  .project-discussions > .project-comments[open] { grid-column: 1 / -1; }
  .project-discussions > .project-comments:not([open]) { grid-row: 1; }
  .project-discussions > [data-project-messages]:not([open]) { grid-column: 2; }
  .project-comments > summary { position: relative; display: block; padding: 8px 8px 8px 23px; font-size: 12px; }
  .project-comments > summary::before { position: absolute; inset-inline-start: 9px; inset-block-start: 13px; margin: 0; width: 7px; height: 7px; }
  .project-comments > summary .count-badge { display: grid; width: fit-content; margin-top: 4px; }
  .project-comments > summary .count-badge { font-size: 11px; }
}
.document-comment-actions { display: flex; gap: 8px; }
.overview-file-slot { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 6px 10px; }
.overview-file-upload { position: relative; margin-left: auto; }
.overview-file-upload .icon-button:focus-within, .overview-file-upload.is-file-over .icon-button { outline: 2px solid #3268bd; outline-offset: 2px; }
.overview-file-upload .overview-file-error { flex-basis: 100%; margin: 4px 0 0; }
.document-row td { transition: background .12s; }

/* ---------- Dialogs ---------- */
dialog { width: min(980px, 96vw); max-height: 92vh; border: 0; border-radius: 14px; padding: 0; color: var(--text); box-shadow: 0 30px 80px rgba(8, 23, 54, .35); }
dialog::backdrop { background: rgba(8, 23, 54, .45); }
dialog > * { padding-left: 26px; padding-right: 26px; }
dialog > :last-child { padding-bottom: 22px; }
.dialog-header { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; padding-top: 22px; margin-bottom: 14px; }
.dialog-header h2 { font-size: 24px; margin: 0; }
.dialog-header p { margin: 2px 0 0; }
.dialog-header button { width: 34px; height: 34px; border-radius: 50%; border: 0; background: #f0f3f8; font-size: 22px; line-height: 1; color: var(--muted); flex: 0 0 auto; }
.dialog-header button:hover { background: #e3e8f1; color: var(--ink); }
dialog .info, dialog .error { margin-left: 26px; margin-right: 26px; padding-left: 40px; }
dialog .dialog-actions { border-top: 1px solid var(--line); padding-top: 16px; }
#preparation-candidates { display: flex; flex-direction: column; gap: 10px; max-height: 52vh; overflow: auto; margin-bottom: 14px; }
.candidate { display: grid; grid-template-columns: minmax(200px, 1.2fr) minmax(0, 2fr); gap: 16px; align-items: start; border: 1px solid var(--line); border-radius: 10px; padding: 14px 16px; margin: 0; box-shadow: none; }
.candidate-file { display: flex; gap: 12px; align-items: flex-start; min-width: 0; padding-right: 14px; border-right: 1px solid var(--line); }
.candidate-file .file-badge { width: 38px; height: 44px; border-radius: 8px; background: var(--blue-50); border: 1px solid var(--blue-100); display: grid; place-items: center; color: var(--blue-600); font-size: 10px; font-weight: 800; flex: 0 0 auto; }
.candidate-file h3 { margin: 0 0 2px; font-size: 15px; overflow-wrap: anywhere; }
.candidate-file .eyebrow { margin: 0 0 6px; letter-spacing: .04em; text-transform: none; font-size: 12px; }
.match-state { display: inline-flex; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.match-state.matched { background: var(--green-100); color: var(--green-700); }
.match-state.unmatched { background: var(--red-100); color: var(--red-700); }
.match-state.update { background: var(--blue-100); color: var(--blue-700); }
.candidate-fields { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(140px, 1fr) auto; gap: 0 14px; align-items: start; }
.candidate-fields label { margin-bottom: 10px; }
.candidate-fields .wide-field { grid-column: 1 / -1; }
.candidate-fields .grouped-destination { font-size: 18px; font-weight: 700; line-height: 1.35; color: var(--ink); margin: 0 0 12px; overflow-wrap: anywhere; }
.candidate-fields .comment-field textarea { min-height: 92px; resize: vertical; }
.candidate-fields .urgent-field { display: flex; flex-direction: column; align-items: center; white-space: nowrap; cursor: pointer; }
.candidate-fields .urgent-box { display: grid; place-items: center; height: 40px; min-width: 56px; margin-top: 6px; }
.candidate-fields .urgent-field input { margin: 0; width: 20px; height: 20px; }
.candidate .info, .candidate .error { grid-column: 1 / -1; margin: 0; }

/* ---------- Detail (history) ---------- */
.detail-head { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; flex-wrap: wrap; }
.detail-head .doc-icon { width: 46px; height: 46px; border-radius: 10px; background: var(--blue-50); border: 1px solid var(--blue-100); display: grid; place-items: center; color: var(--blue-600); }
.detail-head h1 { margin: 0; }
.version-comment { margin: 6px 0 0; font-size: 13px; white-space: pre-wrap; overflow-wrap: anywhere; max-width: min(28rem, 65vw); }
.history-comment { margin: 6px 0 0; max-width: min(28rem, 65vw); font-size: 13px; overflow-wrap: anywhere; }
.history-comment > summary { cursor: pointer; list-style: none; }
.history-comment > summary::-webkit-details-marker { display: none; }
.history-comment-excerpt { display: block; }
.history-comment-toggle { display: inline-block; margin-top: 3px; color: var(--blue-700); text-decoration: underline; }
.history-comment-less, .history-comment[open] .history-comment-more, .history-comment[open] .history-comment-excerpt { display: none; }
.history-comment[open] .history-comment-less { display: inline; }
details > summary { cursor: pointer; color: var(--blue-600); font-weight: 650; font-size: 13px; }
details.inline-editor[open] { background: #f8fafd; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; margin-top: 8px; }
details.inline-editor form { margin-top: 10px; }

/* ---------- Saved preparations ---------- */
.preparation-table td:first-child { width: 64px; text-align: center; }

/* ---------- Team / users ---------- */
.team-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 18px; align-items: start; }
.person { display: flex; align-items: center; gap: 10px; }
.person .avatar { width: 30px; height: 30px; font-size: 13px; }
.person strong { display: block; color: var(--ink); }
.person small { color: var(--muted); }
.team-table form, .users-table form { margin: 0; display: inline; }
.person-button { border: 0; background: none; padding: 4px 6px; margin: -4px -6px; border-radius: 8px; text-align: left; color: inherit; font: inherit; }
.person-button:hover { background: var(--blue-50); }
.person-button:hover strong { color: var(--blue-700); }
.person-text { display: block; }
.person-text small { display: block; }
.access-summary { display: block; margin-top: 2px; font-size: 11.5px; font-weight: 700; color: var(--blue-600); }
.access-dialog { width: min(560px, 96vw); }
.access-dialog form { padding-left: 0; padding-right: 0; }
.access-dialog form > * { padding-left: 26px; padding-right: 26px; }
.access-dialog form > .info { margin-left: 26px; margin-right: 26px; padding-left: 40px; }
.access-tools { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; margin: 4px 0 10px; }
.access-filter { flex: 1 1 100%; min-height: 38px; }
.access-count { margin-left: auto; }
.access-role { margin: 0 0 6px; }
.access-role .radio-row { margin: 6px 0 4px; }
.access-list.is-disabled { opacity: .5; }
.access-list { list-style: none; margin: 0 0 16px; max-height: min(52vh, 420px); overflow-y: auto; }
.access-list li + li { border-top: 1px solid var(--line); }
.access-option { display: flex; align-items: center; gap: 10px; margin: 0; padding: 10px 4px; font-weight: 600; cursor: pointer; }
.access-option input { width: 18px; height: 18px; margin: 0; flex: none; }
.access-option .access-name { flex: 1; }
.access-option:hover { background: var(--blue-50); }
.radio-row { display: flex; gap: 16px; margin: 6px 0 14px; }
.radio-row label { margin: 0; display: inline-flex; align-items: center; font-weight: 600; }

/* ---------- Publication results ---------- */
.retry-counts { display: grid; gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: 9px; overflow: hidden; margin: 12px 0; }
.retry-counts div { background: #f7f9fc; padding: 10px 14px; display: flex; justify-content: space-between; }

/* ---------- Auth ---------- */
.auth-page { background: radial-gradient(1200px 500px at 10% -10%, #1b3d84 0%, transparent 60%), linear-gradient(180deg, var(--navy-900), var(--navy-950)); min-height: 100vh; }
.auth-topbar { padding: 22px 32px; }
.auth-topbar a { color: #fff; display: inline-flex; align-items: baseline; gap: 10px; text-decoration: none; }
.auth-topbar strong { font-size: 26px; font-weight: 800; }
.auth-topbar span { font-size: 13px; letter-spacing: .4em; color: #b7c8e6; }
.auth-main { display: flex; justify-content: center; padding: 30px 16px 60px; }
.auth-card { width: min(440px, 100%); background: #fff; border-radius: 16px; padding: 30px 30px 24px; box-shadow: 0 30px 80px rgba(0, 0, 0, .35); }
.auth-card h1 { font-size: 26px; margin-bottom: 4px; }
.auth-card .primary { width: 100%; min-height: 44px; margin-top: 4px; }
.auth-mailbox .auth-card { width: min(980px, 100%); }
.mail { white-space: pre-wrap; overflow-wrap: anywhere; background: #f5f8fb; padding: 14px; border-radius: 8px; }

/* ---------- Misc legacy hooks ---------- */
.review-entries { margin: 0; }
.publication-registry-details { margin: 6px 0 0; font-size: 12px; }
.publication-registry-details > div { display: grid; grid-template-columns: 90px 1fr; gap: 6px; }
.publication-registry-details dt { color: var(--muted); }
.publication-registry-details dd { margin: 0; overflow-wrap: anywhere; }
.preparation-editor { margin: 0; }

/* ---------- Responsive ---------- */
@media (max-width: 1200px) {
  .sidebar { width: 200px; }
  .shell { margin-left: 200px; }
  .overview-columns { grid-template-columns: minmax(0, 1fr); }
  .team-layout { grid-template-columns: minmax(0, 1fr); }
  .documents-table .document-actor-column { width: 110px; }
  .documents-table .document-time-column { width: 130px; }
  .candidate { grid-template-columns: minmax(0, 1fr); }
  .candidate-file { border-right: 0; padding-right: 0; }
}
@media (max-width: 980px) {
  .documents-table .document-actor-column, .documents-table th:nth-child(5), .documents-table td:nth-child(5) { display: none; }
}
@media (max-width: 760px) {
  body { font-size: 14px; }
  .sidebar { display: none; position: fixed; inset: 64px auto auto 10px; width: 230px; padding: 8px; height: auto; border-radius: 12px; box-shadow: 0 20px 50px rgba(8, 23, 54, .35); background: #fff; }
  .nav-open .sidebar { display: block; }
  .sidebar .brand { display: none; }
  .sidebar nav a { color: var(--ink); font-size: 15px; padding: 10px 12px; }
  .sidebar nav a:hover { background: var(--bg); color: var(--ink); }
  .sidebar nav a.active { color: #fff; }
  .shell { margin-left: 0; }
  .topbar { height: auto; min-height: 60px; flex-wrap: wrap; gap: 8px 10px; padding: 8px 12px; background: var(--navy-900); border-bottom: 0; }
  .nav-toggle { display: grid; place-items: center; width: 40px; height: 40px; border: 0; border-radius: 8px; background: rgba(255, 255, 255, .1); color: #fff; }
  .mobile-brand { display: block; color: #fff; font-weight: 800; letter-spacing: .06em; font-size: 15px; }
  .account { gap: 4px; }
  .account .account-label, .account .account-edit { display: none; }
  .account .account-name { padding: 0; min-height: 44px; min-width: 44px; justify-content: center; }
  .account .account-name .avatar { width: 40px; height: 40px; background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .35); }
  .breadcrumb { order: 5; flex-basis: 100%; }
  .breadcrumb label { color: #c7d4ea; }
  .breadcrumb select { min-width: 0; max-width: none; flex: 1; }
  main { padding: 14px 12px 40px; }
  h1 { font-size: 24px; }
  .page-heading { align-items: stretch; flex-direction: column; }
  .heading-actions > * { flex: 1 1 auto; }
  .card { padding: 14px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .project-facts > div { grid-template-columns: 130px minmax(0, 1fr); }
  .document-selection-toolbar { top: 0; position: static; }
  .section-content { padding: 10px; }
  .documents-table, .documents-table tbody, .documents-table tr, .documents-table td { display: block; width: 100%; }
  .documents-table colgroup, .documents-table thead { display: none; }
  .documents-table .document-row { position: relative; border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px 10px 44px; margin-bottom: 10px; background: #fff; }
  .documents-table td { border: 0; padding: 3px 0; }
  .documents-table td.document-select-cell { position: absolute; left: 12px; top: 12px; width: auto; padding: 0; }
  .documents-table td:nth-child(5), .documents-table td:nth-child(6) { display: none; }
  .documents-table .row-actions { justify-content: flex-start; margin-top: 6px; }
  .candidate-fields { grid-template-columns: minmax(0, 1fr) auto; }
  .candidate-fields .destination-field { grid-column: 1 / -1; }
  dialog > * { padding-left: 16px; padding-right: 16px; }
  dialog .info, dialog .error { margin-left: 16px; margin-right: 16px; }
  .access-dialog form > * { padding-left: 16px; padding-right: 16px; }
  .access-dialog form > .info { margin-left: 16px; margin-right: 16px; padding-left: 40px; }
  .dialog-actions > * { flex: 1 1 auto; }
  .table-card { overflow-x: auto; }
  .table-card table { min-width: 560px; }
  footer { flex-direction: column; gap: 2px; padding: 12px; }
  .hide-sm { display: none !important; }
  .table-card table.fit-sm { min-width: 0; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; scroll-behavior: auto !important; } }
/* Press-and-hold reordering */
[data-local-time-list]:has(> li:nth-child(2)) .local-time-move::before,
[data-catalog-order]:has(> li:nth-child(2):not([hidden])):not(:has(> li[hidden])) > li > details > summary::before,
.document-order-handle {
  content: ''; width: 8px; height: 15px; flex: 0 0 8px; cursor: grab;
  background: radial-gradient(circle, var(--muted) 1px, transparent 1.4px) 0 0 / 4px 5px;
}
.document-order-handle { padding: 0; border: 0; border-radius: 2px; }
.document-order-handle:focus-visible { outline: 2px solid var(--blue-500); outline-offset: 2px; }
.reorder-hint { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin: 6px 0 0; color: var(--muted); font-size: 11.5px; }
.reorder-hint .icon { width: 14px; height: 14px; }
.section-rows[data-reorder-url] .document-row { transition: background-color .15s, box-shadow .15s; }
.documents-table .document-row.is-pressing, .documents-table .document-row.is-pressing td { background: #f1f6ff; }
.documents-table .document-row.is-dragging, .documents-table .document-row.is-dragging td { background: #fff; }
.documents-table .document-row.is-dragging { position: relative; z-index: 3; box-shadow: 0 10px 26px rgba(8, 23, 54, .22), 0 0 0 2px var(--blue-500); cursor: grabbing; }
.documents-table .document-row.just-moved, .documents-table .document-row.just-moved td { background: #e9f8ef; }
body.is-reordering, body.is-reordering * { cursor: grabbing !important; -webkit-user-select: none; user-select: none; }
.reorder-status { margin: 6px 0 0; font-size: 12px; font-weight: 600; color: #165c38; }
.reorder-status.is-error { color: #8c1d13; }
@media (pointer: coarse) {
  .section-rows[data-reorder-url] .document-row { -webkit-touch-callout: none; -webkit-user-select: none; user-select: none; }
}

/* ---------- Settings: side navigation shell ---------- */
.page-heading.settings-heading { margin-bottom: 14px; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px 16px; }
.deleted-document-rows > li {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 2px 12px;
  align-items: start;
}
.deleted-document-rows > li > :is(span, small) { grid-column: 1; min-width: 0; overflow-wrap: anywhere; }
.deleted-document-rows > li > .deleted-row-actions { grid-area: 1 / 2 / span 3; align-self: center; }
@media (max-width: 620px) {
  .deleted-document-rows > li { column-gap: 8px; }
  .deleted-document-rows .deleted-row-actions { gap: 4px; }
  .deleted-document-rows .deleted-row-actions > form > button,
  .deleted-document-rows .deleted-row-actions > details > summary { padding-inline: 6px; font-size: 12px; }
}
.deleted-row-actions { display: flex; flex: 0 0 auto; align-items: flex-start; justify-content: flex-end; gap: 6px; margin-inline-start: auto; }
.deleted-row-actions > form > button { white-space: nowrap; }
.deleted-row-actions > details[open] { max-width: clamp(7rem, 32vw, 13rem); }
.deleted-row-actions > details > summary { display: flex; align-items: center; margin-inline-start: auto; width: max-content; padding: 5px 12px; min-height: 32px; }
.deleted-row-actions > details[open] > form { overflow-wrap: anywhere; text-align: start; }
.settings-shell { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 22px; align-items: start; }
.settings-nav { position: sticky; top: 78px; display: flex; flex-direction: column; gap: 18px; background: #fff; border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.settings-nav-title { margin: 0 0 6px; font-size: 11px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.settings-nav-link { display: block; padding: 9px 10px; border-radius: 8px; color: var(--ink); font-weight: 700; font-size: 14px; }
.settings-nav-link small { display: block; margin-top: 2px; font-weight: 500; font-size: 12px; color: var(--muted); }
.settings-nav-link:hover { background: var(--blue-50); text-decoration: none; color: var(--ink); }
.settings-nav-link.active { background: var(--blue-50); box-shadow: inset 3px 0 0 var(--blue-600); color: var(--blue-700); }
.settings-nav-anchors { display: flex; flex-direction: column; margin: 4px 0 0 12px; border-left: 1px solid var(--line); }
.settings-nav-anchors a { padding: 5px 10px; font-size: 13px; color: var(--muted); font-weight: 600; }
.settings-nav-anchors a:hover { color: var(--blue-700); text-decoration: none; }
.settings-main { min-width: 0; }
/* The workspace header remains sticky even when Settings switches to one column. */
.settings-main > .card, .settings-content > .card, .settings-main .template-catalog-grid > .card,
.settings-main #deal-registries { scroll-margin-top: 80px; }
.settings-content { display: flex; flex-direction: column; gap: 18px; }
.settings-content > .card { margin: 0; }
.form-section { border: 0; padding: 0; margin: 0 0 18px; }
.form-section > legend { padding: 0; margin: 0 0 10px; font-size: 13px; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.form-section + .form-section { padding-top: 16px; border-top: 1px solid var(--line); }
.section-lead { margin: -4px 0 12px; }
.sticky-actions { position: sticky; bottom: 0; z-index: 5; display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 10px; margin: 0 -22px -20px; padding: 12px 22px; background: rgba(255, 255, 255, .96); border-top: 1px solid var(--line); border-radius: 0 0 12px 12px; backdrop-filter: blur(4px); }
.sticky-actions > .muted { margin-right: auto; }
.template-preview { margin-top: 6px; padding: 12px 14px; border: 1px solid #cfdffb; border-radius: 10px; background: var(--blue-50); scroll-margin-top: 16px; }
.template-preview.is-loading { opacity: .6; }
.template-preview-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 12px; margin-bottom: 8px; }
.template-preview-head strong { color: var(--ink); font-size: 14px; }
.template-preview .review-warning { margin: 6px 0; }
.template-preview-sections { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 8px; margin-top: 8px; }
.template-preview-section { background: #fff; border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.template-preview-section > summary { display: flex; align-items: center; justify-content: space-between; gap: 8px; cursor: pointer; font-weight: 700; color: var(--ink); font-size: 13px; }
.template-preview-section p { margin: 6px 0 4px; }
.template-preview-items { margin: 0; padding-left: 18px; font-size: 13px; }
.subheading { margin: 16px 0 4px; font-size: 14px; }
@media (max-width: 980px) {
  .settings-shell { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .settings-nav { position: static; flex-direction: row; gap: 6px; padding: 6px; overflow-x: auto; scrollbar-width: none; border-radius: 10px; }
  .settings-nav-group { display: contents; }
  .settings-nav-title, .settings-nav-anchors, .settings-nav-link small { display: none; }
  .settings-nav-link { white-space: nowrap; padding: 8px 12px; font-size: 13px; }
  .settings-nav-link.active { box-shadow: inset 0 -3px 0 var(--blue-600); }
  .sticky-actions { margin: 0 -14px -14px; padding: 10px 14px; }
  .sticky-actions > .muted { flex-basis: 100%; }
}

/* ---------- Settings: document templates ---------- */
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chip { border: 1px solid var(--line-strong); background: #fff; color: var(--text); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 700; }
.chip[aria-pressed="true"], .chip[aria-current="page"] { background: var(--blue-600); border-color: var(--blue-600); color: #fff; }
@media (max-width: 760px) {
  .sticky-actions > .muted { display: none; }
  .sticky-actions > * { flex: 1 1 auto; }
}

/* ---------- Settings: catalogs ---------- */
.catalog-title-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 8px 12px; }
.catalog-card .catalog-add { display: flex; gap: 8px; margin: 0 0 10px; }
.catalog-card .catalog-add input { flex: 1; min-height: 38px; }
.catalog-filter { width: 100%; min-height: 36px; margin: 0 0 8px; }
.catalog-list { list-style: none; margin: 0; padding: 0; }
.catalog-list > li { border-top: 1px solid var(--line); }
.catalog-list summary { display: flex; align-items: center; gap: 8px; padding: 9px 4px; cursor: pointer; list-style: none; }
.catalog-list summary::-webkit-details-marker { display: none; }
.catalog-list summary:hover { background: var(--blue-50); }
[data-catalog-order] > li > details > summary { touch-action: pan-y; }
[data-catalog-order] > .is-pressing > details > summary { background: var(--blue-50); }
[data-catalog-order] > .is-dragging > details > summary { background: var(--blue-50); outline: 2px solid var(--blue-500); }
.catalog-name { flex: 1; font-weight: 600; color: var(--ink); }
.catalog-edit { font-size: 12px; font-weight: 700; color: var(--blue-600); }
.catalog-list details[open] .catalog-edit { color: var(--muted); }
.catalog-edit-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) auto; gap: 8px; align-items: end; padding: 4px 4px 12px; }
.catalog-card .parties-add { display: grid; grid-template-columns: minmax(0, 360px) minmax(100px, 175px) auto; justify-content: start; align-items: center; gap: 4px 8px; }
.catalog-edit-form.parties-edit { grid-template-columns: minmax(0, 2fr) minmax(110px, 1fr) minmax(90px, 1fr) auto; align-items: center; row-gap: 4px; }
.parties-add label, .parties-edit label { display: contents; }
.parties-add label > span, .parties-edit label > span { align-self: end; }
.parties-add input:not([type="hidden"]), .parties-add select, .parties-edit input:not([type="hidden"]), .parties-edit select { width: 100%; margin: 0; }
.parties-add label:first-of-type > span, .parties-edit label:first-of-type > span { grid-area: 1 / 1; }
.parties-add label > input, .parties-edit label:first-of-type > input { grid-area: 2 / 1; }
.parties-add label:nth-of-type(2) > span, .parties-edit label:nth-of-type(2) > span { grid-area: 1 / 2; }
.parties-add label > select, .parties-edit label:nth-of-type(2) > select { grid-area: 2 / 2; }
.parties-edit label:nth-of-type(3) > span { grid-area: 1 / 3; }
.parties-edit label:nth-of-type(3) > select { grid-area: 2 / 3; }
.parties-add button { grid-area: 2 / 3; justify-self: start; align-self: stretch; margin: 0; white-space: nowrap; }
.catalog-edit-actions.parties-actions { grid-area: 2 / 4; justify-content: flex-end; align-self: stretch; }
.parties-actions button { margin: 0; }
@media (max-width: 900px) {
  .catalog-card .parties-add, .catalog-edit-form.parties-edit { grid-template-columns: minmax(0, 1fr) auto; }
  .parties-add label:first-of-type > span, .parties-add label > input, .parties-edit label:first-of-type > span, .parties-edit label:first-of-type > input { grid-column: 1 / -1; }
  .parties-add label:nth-of-type(2) > span, .parties-edit label:nth-of-type(2) > span { grid-area: 3 / 1 / auto / -1; }
  .parties-add label > select, .parties-edit label:nth-of-type(2) > select { grid-area: 4 / 1; }
  .parties-add button { grid-area: 4 / 2; }
  .parties-edit label:nth-of-type(2) > select { grid-column: 1 / -1; }
  .parties-edit label:nth-of-type(3) > span { grid-area: 5 / 1 / auto / -1; }
  .parties-edit label:nth-of-type(3) > select { grid-area: 6 / 1; }
  .catalog-edit-actions.parties-actions { grid-area: 6 / 2; }
}
.catalog-edit-form label { margin: 0; }
@media (max-width: 760px) { .catalog-edit-form { grid-template-columns: minmax(0, 1fr); } }
.dialog-form > .form-grid { margin-bottom: 4px; }
.dialog-form { padding-bottom: 0; }


/* Message to participants (Prepare files and Saved Uploads) */
#prepare-dialog .prepare-help { margin-top: 14px; margin-bottom: 0; line-height: 1.5; }
.prepare-help > summary { color: var(--blue-600); cursor: pointer; font-weight: 700; }
.prepare-help > summary:hover { text-decoration: underline; }
.prepare-help > summary + p { margin-top: 8px; }
.prepare-help:not([open]) .prepare-help-less, .prepare-help[open] .prepare-help-more { display: none; }
#prepare-dialog .prepare-message { margin-top: 14px; }
#prepare-dialog .prepare-message label { margin-bottom: 0; }
#prepare-dialog .prepare-message .small { font-weight: 500; }
#prepare-dialog #prepare-message { min-height: 64px; }
.publish-panel { margin-top: 16px; }
.publish-panel .publish-message .small { font-weight: 500; }
.publish-panel .publish-message { margin-bottom: 12px; }
.publish-actions { display: flex; justify-content: flex-end; align-items: center; gap: 10px; flex-wrap: wrap; }
.preparation-table .select-cell { width: 48px; }
.publication-message { margin: 0 0 14px; padding: 12px 14px; background: #eef4fc; border-left: 4px solid var(--blue-600); border-radius: 6px; font-size: 14px; }
.publication-message p { margin: 4px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; }
@media (max-width: 640px) { .publish-actions { justify-content: stretch; } .publish-actions button { flex: 1 1 auto; } }

/* Rename a row in place (Documents) */
.row-name { display: inline-flex; align-items: center; gap: 4px; }
.rename-toggle { display: inline-grid; place-items: center; width: 26px; height: 26px; padding: 0; margin: -4px 0; border: 0; border-radius: 6px; background: transparent; color: var(--muted, #6b7a90); cursor: pointer; opacity: 0; transition: opacity .12s; }
.rename-toggle .icon { width: 15px; height: 15px; }
tr:hover .rename-toggle, .rename-toggle:focus-visible { opacity: 1; }
.rename-toggle:hover { background: var(--blue-100); color: var(--blue-700); }
@media (hover: none) { .rename-toggle { opacity: .75; } }
.rename-form { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; width: 100%; margin: 0; }
.rename-form input { width: auto; flex: 1 1 200px; min-width: 0; max-width: 360px; min-height: 34px; margin: 0; padding: 5px 9px; font-weight: 650; }
.rename-form button { min-height: 34px; padding: 5px 12px; }
.rename-form .error { flex-basis: 100%; margin: 4px 0 0; }
/* Change progress in place */
.progress-toggle { cursor: pointer; border: 0; font: inherit; font-size: 12px; font-weight: 700; line-height: inherit; }
.progress-toggle::after { content: ""; display: inline-block; width: 6px; height: 6px; margin-left: 6px; border-right: 1.6px solid currentColor; border-bottom: 1.6px solid currentColor; transform: translateY(-2px) rotate(45deg); opacity: .55; }
.progress-toggle:hover, .progress-toggle:focus-visible { box-shadow: 0 0 0 2px var(--blue-100); }
.progress-select { width: auto; min-width: 140px; min-height: 32px; margin: 0; padding: 4px 8px; font-size: 13px; }
.progress-error { margin: 6px 0 0; padding: 6px 10px 6px 30px; font-size: 12px; }
.progress-error::before { left: 8px; top: 6px; width: 15px; height: 15px; font-size: 11px; line-height: 15px; }
/* Team: approve several accounts */
.approve-card .access-tools { display: flex; align-items: center; gap: 6px 12px; flex-wrap: wrap; margin-bottom: 10px; }
.approve-card .access-filter { flex: 1 1 100%; margin: 0 0 4px; }
.approve-card .access-count { margin-left: auto; }
.approve-card .access-name small { font-weight: 500; overflow-wrap: anywhere; }
.approve-card .dialog-actions { margin-top: 8px; }
.approve-card .access-list { padding: 0; }
.party-tag { display: inline-block; margin-left: 8px; padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; vertical-align: 1px; background: #edf0f5; color: #3d4a60; }
.party-tag[data-party="Internal"] { background: var(--blue-100); color: var(--blue-700); }
.approve-card .approve-group { padding: 12px 4px 4px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); border-top: 0; }
.date-calendar-grid button { min-height: 32px; border-color: transparent; background: transparent; font-weight: 600; }
.date-calendar-grid button:hover { background: var(--blue-100); }
.date-calendar-grid span { font-size: 12px; color: var(--muted); }
.catalog-option-settings { padding: 8px 0 4px; }
#add-deal-type-dialog > .catalog-option-settings { padding: 8px 26px 22px; }
.catalog-option-settings > section { min-width: 0; }
.catalog-option-settings h3 { margin: 4px 0 8px; }
.catalog-option-settings > .catalog-edit-actions { grid-column: 1 / -1; justify-content: flex-end; }
.catalog-option-settings input[name="name"], .catalog-option-settings select { width: 100%; }
.catalog-section-form { display: grid; gap: 6px; padding: 10px 0; border-top: 1px solid var(--line); }
.catalog-section-form > label { margin: 0; font-weight: 600; }
.catalog-section-name { display: grid; grid-template-columns: max-content minmax(0, 1fr); align-items: center; gap: 8px; }
.catalog-section-name input { width: 100%; min-width: 0; margin: 0; }
.catalog-section-form textarea { width: 100%; min-width: 0; field-sizing: content; min-height: 84px; max-height: none; overflow-y: hidden; resize: none; }
@media (max-width: 760px) { .catalog-option-settings { grid-template-columns: minmax(0, 1fr); } }
.catalog-edit-actions { display: flex; justify-content: space-between; gap: 8px; }
.catalog-deleted { margin-top: 12px; font-size: 13px; }
footer.users-history-links { flex-flow: row wrap; justify-content: flex-start; align-items: center; gap: 8px; }
.catalog-deleted summary { cursor: pointer; color: var(--muted); font-weight: 600; }
.catalog-deleted .plain-list li { display: flex; justify-content: space-between; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--line); }

.catalog-deleted .plain-list li:has(> .catalog-deleted-actions) > span { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.catalog-deleted-actions { display: flex; align-items: center; justify-content: flex-end; gap: 8px; max-width: 64%; margin-inline-start: auto; }
.catalog-deleted-actions > details { min-width: 0; max-width: 16rem; overflow-wrap: anywhere; }
.catalog-deleted-actions > details > summary { width: max-content; margin-inline-start: auto; }
.catalog-deleted-actions > form { flex: none; }
@media (max-width: 420px) {
  .catalog-deleted .plain-list li:has(> .catalog-deleted-actions) { flex-wrap: wrap; }
  .catalog-deleted-actions { max-width: 100%; }
}

/* Reference Library filters and editor */
.templates-filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; margin-bottom: 12px; }
.templates-filters input[type=search] { flex: 1 1 260px; margin: 0; min-height: 38px; }
.templates-filters select { width: auto; flex: 0 1 190px; margin: 0; min-height: 38px; }
.templates-count { margin-left: auto; }
.template-dialog { width: min(1120px, 96vw); }
.template-dialog form { margin: 0; }
.template-editor-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; padding-top: 20px; }
.template-editor-head h2 { margin: 0 0 2px; }
.template-editor-head p { margin: 0; }
.dialog-close { border: 0; background: #eef1f6; border-radius: 50%; width: 36px; height: 36px; font-size: 20px; line-height: 1; color: var(--ink); flex: none; }
/* Settings › Email delivery */
.email-attention-badge { margin-top: 4px; max-width: 100%; white-space: normal; }
#email-delivery .card-header { align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mail-log td { vertical-align: top; }
.mail-log td strong { display: block; }
.mail-log td small, .mail-log td a.small { display: block; margin-top: 2px; }
.mail-recipients summary { cursor: pointer; font-weight: 600; white-space: nowrap; }
.mail-recipients .plain-list li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; padding: 4px 0; font-size: 13px; }
.mail-recipients .delivery-result { font-size: 11px; padding: 1px 8px; }
.mail-retry { margin-top: 6px; }
.delivery-result[data-label="Unknown"], .delivery-result[data-label="Stalled"], .delivery-result[data-label="Skipped"] { background: #fff3e0; color: #8a4b00; }
.delivery-result[data-label="Sending"] { background: var(--blue-100); color: var(--blue-700); }
/* Reference library */
.reference-list { display: grid; gap: 12px; }
.reference-item { border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px; background: #fff; scroll-margin-top: 90px; }
.reference-item:target { border-color: var(--blue-500); box-shadow: 0 0 0 3px var(--blue-100); }
.reference-item-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }
.reference-item h3 { margin: 0 0 6px; font-size: 16px; color: var(--ink); }
.reference-notes { margin: 10px 0 0; white-space: pre-wrap; font-size: 14px; }
.reference-files { list-style: none; margin: 12px 0 0; padding: 0; display: grid; gap: 6px; }
.reference-files li { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px; background: #fbfcfe; }
.reference-file-name { display: inline-flex; align-items: center; gap: 6px; flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.reference-file-name .icon { width: 16px; height: 16px; flex: none; color: var(--blue-600); }
.reference-files form { margin: 0; }
.reference-meta { margin: 8px 0 0; }
.reference-editor-columns { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 22px; align-items: start; padding-top: 10px; }
.reference-file-manager { border: 1px solid var(--line); border-radius: 12px; padding: 14px; background: #fbfcfe; }
.reference-file-manager h3 { margin: 0; font-size: 15px; }
.reference-add-files { display: flex; align-items: end; gap: 8px; margin-top: 12px; }
.reference-add-files label { flex: 1; margin: 0; }
.reference-dialog form.reference-details-form { padding-top: 10px; }
@media (max-width: 900px) { .reference-editor-columns { grid-template-columns: minmax(0, 1fr); } .reference-item-head { flex-direction: column; } }
/* File preview window */
.preview-dialog { width: min(1100px, 96vw); height: min(92vh, 1000px); display: none; }
.preview-dialog[open] { display: flex; flex-direction: column; }
.preview-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding-top: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--line); }
.preview-head h2 { margin: 0; font-size: 16px; overflow-wrap: anywhere; }
.preview-actions { display: flex; align-items: center; gap: 8px; flex: none; }
.preview-dialog[data-active-preview-kind="powerpoint"] .preview-head { padding-inline:12px; }
.preview-dialog[data-active-preview-kind="powerpoint"] .preview-actions .dialog-close { display:grid; place-items:center; position:relative; z-index:1; padding:0; min-width:44px; width:44px; height:44px; flex:0 0 44px; }
@media (max-width:760px) {
  .preview-dialog[data-active-preview-kind="powerpoint"] { inset:8px auto auto 8px; margin:0; width:calc(100dvw - 16px); max-width:none; height:calc(100dvh - 16px); max-height:none; }
  .preview-dialog[data-active-preview-kind="powerpoint"] .preview-head { flex-wrap:wrap; }
  .preview-dialog[data-active-preview-kind="powerpoint"] .preview-actions { width:100%; display:grid; grid-template-columns:minmax(0,1fr) auto auto; }
  .preview-dialog[data-active-preview-kind="powerpoint"] [data-preview-open] { margin:0; padding-inline:6px; white-space:normal; }
}
.preview-body { flex: 1; min-height: 0; padding-top: 12px; padding-bottom: 16px; display: flex; }
.preview-frame { flex: 1; width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.preview-frame.is-text { background: #fbfcfe; }
.preview-image { max-width: 100%; max-height: 100%; margin: auto; object-fit: contain; border-radius: 6px; }
@media (max-width: 640px) { .preview-head { flex-wrap: wrap; } .preview-actions { width: 100%; justify-content: flex-end; } .preview-actions [data-preview-open] { margin-right: auto; } }

/* English confirmation window (replaces the browser's confirm()). */
.confirm-dialog { width: min(460px, 94vw); }
.confirm-dialog > p { margin: 0; padding-top: 22px; font-size: 15px; line-height: 1.55; color: var(--ink); }
.confirm-dialog .dialog-actions { margin-top: 18px; }

/* English file chooser (the browser's own button and "no file" text follow the browser language). */
.file-picker { display: grid; gap: 6px; margin: 0 0 14px; }
.file-picker-label { font-weight: 700; color: var(--ink); font-size: 14px; }
.file-picker-box { position: relative; display: flex; align-items: center; gap: 12px; min-height: 48px; padding: 6px 12px 6px 6px; border: 1px solid var(--line); border-radius: 10px; background: #fff; min-width: 0; }
.file-picker-input { position: absolute; left: 6px; top: 50%; width: 1px; height: 1px; opacity: 0; overflow: hidden; }
.file-picker-input:focus-visible + .file-picker-button { outline: 3px solid var(--blue-100); outline-offset: 2px; }
.file-picker-button { flex: 0 0 auto; margin: 0; cursor: pointer; }
[data-file-picker-drop] { border-style: dashed; }
.file-picker-names { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.reference-add-files .file-picker { margin: 0; flex: 1 1 240px; }

.history-file-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.danger-text { color: var(--red-700, #b42318); }
.history-deleted { margin: 0 0 16px; }
.history-file-actions form { margin: 0; }
.history-file-actions .danger-text { color: var(--red-700); border-color: #efb3ad; }

.party-company { margin-top: 4px; }
.pill.party-name.is-internal { background: #e3e8ff; color: #3538cd; }
.pill.party-name.is-counterparty { background: var(--amber-100); color: var(--amber-700); }
.pill.party-name.is-guest,
.party-tag[data-party="Guest"],
.file-updated[data-publication-party="Guest"] { background: #dff6f8; color: #0e5d69; }

/* Portrait tablets: give document names space without altering phone cards or landscape layouts. */
@media (min-width: 761px) and (max-width: 1340px) and (orientation: portrait) {
  .sidebar {
    display: none; position: fixed; inset: 64px auto auto 10px; width: 230px; padding: 8px;
    height: auto; max-height: calc(100dvh - 72px); overflow-y: auto; border-radius: 12px;
    box-shadow: 0 20px 50px rgba(8, 23, 54, .35); background: #fff;
  }
  .nav-open .sidebar { display: block; }
  .sidebar .brand { display: none; }
  .sidebar nav a { color: var(--ink); font-size: 15px; padding: 10px 12px; }
  .sidebar nav a:hover { background: var(--bg); color: var(--ink); }
  .sidebar nav a.active { color: #fff; }
  .shell { margin-left: 0; }
  .topbar { height: 64px; gap: 10px; padding: 8px 16px; background: var(--navy-900); border-bottom: 0; }
  .nav-toggle {
    display: grid; place-items: center; flex: 0 0 44px; width: 44px; height: 44px; border: 0;
    border-radius: 8px; background: rgba(255, 255, 255, .1); color: #fff;
  }
  .mobile-brand {
    display: inline-flex; align-items: center; min-height: 44px; color: #fff; white-space: nowrap;
    font-weight: 800; letter-spacing: .06em; font-size: 15px;
  }
  .account { gap: 6px; }
  .account .account-label, .account .account-edit { display: none; }
  .account .account-name { padding: 0; min-height: 44px; min-width: 44px; justify-content: center; }
  .account .account-name .avatar { width: 40px; height: 40px; background: rgba(255, 255, 255, .14); color: #fff; border-color: rgba(255, 255, 255, .35); }
  .breadcrumb { flex: 1 1 0; }
  .breadcrumb > span { display: none; }
  .breadcrumb select { width: 100%; min-width: 0; max-width: 360px; font-size: 16px; }
  main { padding: 20px 16px 44px; }
  .documents-table { min-width: 780px; }
  .documents-table th { white-space: normal; }
  .documents-table .document-select-column { width: 38px; }
  .documents-table .document-status-column { width: 84px; }
  .documents-table .document-progress-column { width: 130px; }
  .documents-table .document-actor-column { width: 110px; }
  .documents-table .document-time-column { width: 110px; }
  .documents-table .document-actions-column { width: 148px; }
  .documents-table .file-indicators { flex-wrap: wrap; }
  .documents-table .party-name { display: inline-block; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
  .documents-table .registry-label { overflow-wrap: anywhere; }
  .documents-table .row-actions .button { min-height: 44px; min-width: 40px; padding: 4px 8px; }
  .documents-table .progress-toggle { min-height: 40px; }
}
@media (min-width: 761px) and (max-width: 980px) and (orientation: portrait) {
  .documents-table { min-width: 670px; }
}

.publication-text-count { display: block; margin-top: 3px; text-align: right; color: var(--muted); font-size: 12px; font-weight: 400; font-variant-numeric: tabular-nums; }

.document-items-group { margin: 0 0 16px; overflow-wrap: anywhere; }
.document-items-group h3 { margin: 0 0 4px; }
.document-items-group ul { margin: 0; padding-inline-start: 22px; }

/* Phone: the workspace navigation scrolls away; the header controls remain pinned. */
@media (max-width: 760px) and (pointer: coarse), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .sidebar-world-clocks { display: none; }
  .topbar { display: none; }
  .topbar:has([data-project-switch], .workspace-search-box) {
    display: flex; position: sticky; top: 0; height: auto; min-height: 0;
    padding: 6px 8px 8px; background: var(--navy-900); border-bottom: 0;
  }
  .topbar .nav-toggle, .topbar .mobile-brand, .topbar .account { display: none; }
  .topbar .breadcrumb { flex: 1; width: 100%; }
  .topbar [data-project-switch] { width: 100%; min-width: 0; max-width: none; }
  .shell { margin-left: 0; }
  .sidebar, .nav-open .sidebar {
    display: block;
    position: relative;
    inset: auto;
    width: 100%;
    height: auto;
    padding: 6px 8px;
    border-radius: 0;
    box-shadow: none;
    background: var(--navy-900);
  }
  .sidebar .brand { display: none; }
  .sidebar nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 4px; }
  .sidebar nav a {
    display: flex; flex-direction: column; justify-content: center; gap: 3px;
    min-height: 48px; padding: 4px 2px; text-align: center;
    color: #d6e0f2; background: rgb(255 255 255 / 7%);
    font-size: clamp(10px, 2.85vw, 13px); white-space: nowrap;
  }
  .sidebar nav a .icon { width: 16px; height: 16px; }
  .sidebar nav a:hover { background: rgb(255 255 255 / 14%); color: #fff; }
  .sidebar nav a.active, .sidebar nav a.active:hover { background: var(--blue-600); color: #fff; }
}

.section-picker-mobile { display: none; }
@media (max-width: 760px) and (pointer: coarse), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .section-drop .section-drop-desktop { display: none; }
  .section-drop .section-picker-mobile { display: inline; }
}

/* Section actions keep their native button/disclosure behavior. */
.section-management > .row-adder button[data-row-adder-open],
.section-management > details > summary {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 5px 10px;
  border: 1px solid #b7c9e7;
  border-radius: 8px;
  background: #edf4ff;
  color: #173a64;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
}
.section-management > .section-delete > summary { background: #fff2f0; border-color: #e7bcb7; color: #8c2522; }
.section-management :is(button[data-row-adder-open], summary):focus-visible { outline: 2px solid currentColor; outline-offset: 2px; }

/* Phone Documents: make section actions easy to distinguish and tap. */
@media (max-width: 760px) and (pointer: coarse), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .section-management { flex-wrap: wrap; gap: 8px; }
  .section-management > *, .section-management > .row-adder { flex: 1 1 0; }
  .section-management > :is(.row-adder:has(> form:not([hidden])), details[open]) { flex: 1 0 100%; }
  .section-management > .row-adder button[data-row-adder-open],
  .section-management > details > summary {
    box-sizing: border-box;
    width: 100%;
    min-height: 48px;
    padding: 5px 6px;
    font-size: 12px;
    line-height: 16px;
  }
}

/* Phone Documents: name and progress on top, file on its own line. */
@media (max-width: 760px) and (pointer: coarse), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .document-selection-table, .document-selection-table tbody { display: block; width: 100%; min-width: 0; }
  .document-selection-table colgroup, .document-selection-table thead { display: none; }
  .document-selection-table .document-row {
    position: relative;
    display: grid;
    grid-template-columns: minmax(0, max-content) max-content max-content minmax(0, 1fr) max-content;
    gap: 4px;
    align-items: center;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 6px 8px 6px 34px;
    margin-bottom: 10px;
  }
  .document-selection-table .document-row > td { display: block; width: auto; min-width: 0; padding: 0; border: 0; }
  .document-selection-table .document-row > .document-select-cell { position: absolute; inset: 17px auto auto 8px; }
  .document-selection-table .document-row > :is(.document-main, .document-actions-cell),
  .document-selection-table .document-title-line { display: contents; }
  .document-selection-table .document-title-line .row-name { grid-area: 1 / 1; min-width: 0; overflow-wrap: anywhere; }
  .document-selection-table .row-name [data-row-name] { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .document-selection-table .row-name .rename-toggle { flex-shrink: 0; }
  .document-selection-table .document-title-line :is(.document-version-files, .no-file) {
    grid-area: 2 / 1 / auto / -1;
    justify-self: start;
    min-width: 0;
    max-width: 100%;
    overflow-wrap: anywhere;
  }
  .document-selection-table .document-latest-file {
    display: flex; align-items: flex-start; gap: 5px; min-width: 0;
  }
  .document-selection-table .document-latest-file .file-updated { flex: 0 0 auto; }
  .document-selection-table .document-row:has(.document-latest-file .file-updated) .registry-label { grid-row: 3; }
  .document-selection-table .document-row > [data-label="Progress"] { grid-area: 1 / 2; margin-inline-start: 2px; }
  .document-selection-table .document-row > [data-label="Progress"] .file-progress { max-width: 100%; font-size: 11px; padding-inline: 5px; white-space: nowrap; }
  .document-selection-table .document-row > :is([data-label="Updated by"], [data-label="Updated at"]) { display: none; }
  .document-selection-table .document-row > .document-indicators,
  .document-selection-table .document-row .file-indicators { display: contents; }
  .document-selection-table .document-row .file-indicators .new-label { grid-area: 3 / 1 / auto / 4; justify-self: start; }
  .document-selection-table .document-row .file-indicators .urgent {
    grid-area: 1 / 3; justify-self: start; margin: 0; padding-inline: 5px; font-size: 11px; white-space: nowrap;
  }
  .document-selection-table .document-row .registry-label { grid-area: 4 / 1 / auto / -1; margin: 0; }
  .document-selection-table .document-actions-cell .row-actions {
    grid-area: 1 / 5; justify-self: end; align-items: center; flex-wrap: nowrap; gap: 4px; margin: 0;
  }
  .document-selection-table .row-actions .button { width: 40px; min-width: 40px; min-height: 40px; padding: 4px; justify-content: center; }
  .document-selection-table [data-row-name][role="button"] { cursor: pointer; }
  .document-selection-table [data-row-name][role="button"]:focus-visible { outline: 2px solid var(--blue-600); outline-offset: 2px; }
  .document-selection-table .document-row.is-name-expanded .row-name { grid-area: 1 / 1 / auto / -1; }
  .document-selection-table .document-row.is-name-expanded .row-name [data-row-name] { white-space: normal; overflow-wrap: anywhere; }
  .document-selection-table .document-row.is-name-expanded > [data-label="Progress"] { grid-row: 2; }
  .document-selection-table .document-row.is-name-expanded :is(.file-indicators .urgent, .document-actions-cell .row-actions) { grid-row: 2; }
  .document-selection-table .document-row.is-name-expanded .document-title-line :is(.document-version-files, .no-file) { grid-row: 3; }
  .document-selection-table .document-row.is-name-expanded:has(.document-latest-file .file-updated) .registry-label { grid-row: 4; }
  .document-selection-table .document-row.is-name-expanded .file-indicators .new-label { grid-row: 4; }
  .document-selection-table .document-row.is-name-expanded .registry-label { grid-row: 5; }
}

@media (max-width: 360px) and (pointer: coarse) {
  .document-selection-table .document-row { padding-inline: 25px 4px; column-gap: 3px; }
  .document-selection-table .document-actions-cell .row-actions { gap: 3px; }
  .document-selection-table .row-actions .button { width: 30px; min-width: 30px; }
  .document-selection-table .row-name .rename-toggle { width: 18px; }
  .document-selection-table .progress-toggle::after { width: 4px; height: 4px; margin-left: 0; }
  .document-selection-table .document-row:has(.file-indicators .urgent) .progress-toggle::after { display: none; }
  .document-selection-table .document-row:has(.file-indicators .urgent) > [data-label="Progress"] .file-progress,
  .document-selection-table .document-row .file-indicators .urgent { font-size: 10px; padding-inline: 3px; }
  .document-selection-table .document-row > .document-select-cell { inset-inline-start: 5px; }
  .document-selection-table .row-name { gap: 2px; }
}

@media (max-width: 440px) and (pointer: coarse) {
  .document-selection-table .document-row:has(.rename-form) .rename-form {
    grid-area: 2 / 1 / auto / -1;
    min-width: 0;
  }
  .document-selection-table .document-row:has(.rename-form) .rename-form input {
    flex: 1 0 100%;
    max-width: none;
    font-size: 16px;
  }
  .document-selection-table .document-row:has(.rename-form) > [data-label="Progress"],
  .document-selection-table .document-row:has(.rename-form) :is(.file-indicators .urgent, .document-actions-cell .row-actions) { grid-row: 1; }
  .document-selection-table .document-row:has(.rename-form) .document-title-line :is(.document-version-files, .no-file) { grid-row: 3; }
  .document-selection-table .document-row:has(.rename-form):has(.document-latest-file .file-updated) .registry-label { grid-row: 4; }
  .document-selection-table .document-row:has(.rename-form) .file-indicators .new-label { grid-row: 4; }
  .document-selection-table .document-row:has(.rename-form) .registry-label { grid-row: 5; }
}

/* Phone document selection: keep the always-available actions separate. */
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .document-selection-toolbar {
    position: static;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 6px 8px;
    padding: 8px 10px;
  }
  .document-selection-toolbar .document-selection-summary { grid-area: 1 / 1 / auto / -1; margin-right: 6rem; display: flex; flex-wrap: wrap; align-items: center; gap: 0 8px; min-width: 0; }
  .document-selection-toolbar .document-global-select { min-height: 40px; white-space: nowrap; }
  .document-selection-toolbar .selection-count {
    min-width: 0;
    white-space: nowrap;
    padding: 0;
    border: 0;
  }
  .guest-preset-controls { --guest-preset-action-width: min(8.75rem, calc((100% - 8px) / 2)); }
  .guest-preset-controls > :is(details, [data-guest-preset-delete]) { width: var(--guest-preset-action-width); }
  #create-guest-link .guest-preset-controls :is(summary, [data-guest-preset-delete]:not([hidden])) {
    display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 5px 8px; font-size: 13px; line-height: 1.2; text-align: center;
  }
  .guest-preset-controls summary { width: 100%; }
  .guest-preset-controls details[open] > summary { width: var(--guest-preset-action-width); }
  .document-selection-toolbar > .document-item-list-actions { grid-area: 2 / 1 / auto / -1; }
  .document-item-list-actions > button { flex: 1; }
  .document-selection-toolbar > [data-document-download-form] { grid-area: 4 / 1; }
  .document-selection-toolbar > [data-document-download-details] { grid-area: 5 / 1 / auto / -1; }
  .document-selection-toolbar > [data-document-selection-share] { grid-area: 4 / 2; }
  .document-selection-toolbar > [data-open="guest-links-dialog"] { grid-area: 1 / 2; justify-self: end; }
  .document-selection-toolbar > :is([data-document-progress-retry], [data-document-progress-reload], [data-document-progress-message]) { grid-column: 1 / -1; }
  .document-selection-mutations {
    display: grid;
    grid-area: 3 / 1 / auto / -1;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 4px 8px;
    padding-top: 7px;
    border-top: 1px solid var(--line);
  }
  .document-selection-toolbar .document-selection-mutations > [data-document-progress-form] { display: contents; }
  .document-selection-mutations > [data-document-progress-recovery],
  .document-selection-mutations [data-document-progress-form] > :is(label, select, [data-document-progress-denied], [data-document-progress-limit]) { grid-column: 1 / -1; }
  .document-selection-mutations [data-document-progress-form] > label { font-size: 13px; }
  .document-selection-mutations :is([data-document-progress-denied], [data-document-progress-limit]) { order: 1; }
  .document-selection-mutations > [data-document-delete-form] { grid-column: 2; }
  .document-selection-mutations > [data-document-delete-limit] { grid-column: 1 / -1; }
  .document-selection-toolbar :is(select, button.secondary, button.danger) { min-height: 40px; }
  .document-selection-toolbar > :is([data-document-selection-share], [data-open="guest-links-dialog"]),
  .document-item-list-actions > button,
  .document-selection-toolbar :is([data-document-download-form], [data-document-delete-form]) > button,
  .document-selection-toolbar [data-document-selection-progress] {
    padding-inline: 8px;
    font-size: 12px;
  }
  .document-selection-toolbar :is([data-document-selection-share], [data-document-selection-progress]),
  .document-selection-toolbar :is([data-document-download-form], [data-document-delete-form]) > button {
    width: 100%; min-width: 0; height: 40px;
  }
  .document-selection-toolbar:not([data-selection-mode="files"]) > :is([data-document-download-form], [data-document-selection-share]),
  .document-selection-toolbar:not([data-selection-mode="files"]) .document-selection-mutations > [data-document-progress-form],
  .document-selection-toolbar[data-selection-mode="none"] .selection-count,
  .document-selection-toolbar[data-selection-mode="none"] > .document-selection-mutations:not(:has([data-document-progress-recovery])),
  .document-selection-toolbar[data-selection-mode="none"] .document-selection-mutations > [data-document-delete-form] { display: none; }
}

.catalog-section-heading { display: flex; align-items: stretch; gap: 8px; }
.catalog-section-heading .catalog-section-name { flex: 1; min-width: 0; margin: 0; }
.catalog-section-heading button { flex: none; margin: 0; white-space: nowrap; }

/* Deals index and workspace-wide search entry. */
.workspace-search-box { display: flex; align-items: center; gap: 4px; margin: 0; min-width: 0; }
.workspace-search-box input { margin: 0; width: clamp(120px, 18vw, 300px); min-width: 0; min-height: 38px; }
.workspace-search-box button { display: inline-flex; align-items: center; justify-content: center; padding: 7px; }
.deal-index-filters { --deal-filter-height: 40px; display: flex; align-items: end; gap: 12px; flex-wrap: wrap; }
.deal-index-filters label { min-width: 140px; margin: 0; }
.deal-index-filter-end { display: flex; align-items: end; gap: 12px; min-width: 0; max-width: 100%; }
.deal-index-filters .deal-index-filter-end label { min-width: 0; }
.deal-index-filters select { min-height: var(--deal-filter-height); margin-bottom: 0; }
.deal-index-filters .deal-index-filter-action { min-height: var(--deal-filter-height); margin: 0; white-space: nowrap; }
.deal-index-count { margin: 8px 0 4px; font-size: 13px; font-weight: 650; line-height: 1.3; color: var(--muted); }
.deal-index-table { min-width: 820px; }
.deal-index-table th a { display: inline-flex; align-items: center; gap: 5px; color: inherit; }
.deal-index-table th[aria-sort=ascending] a, .deal-index-table th[aria-sort=descending] a { color: var(--blue-600); }
.deal-index-table th a span { white-space: nowrap; }
.deal-delete { margin-top: 16px; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .workspace-search-box { flex: 1 1 0; }
  .workspace-search-box input { flex: 1; width: 100%; font-size: 16px; }
  .topbar .breadcrumb:has(.workspace-search-box) > select { flex: 1 1 0; width: 0; }
  .topbar .breadcrumb:has(.workspace-search-box) > span { display: none; }
  .deal-index-filters label { flex: 1 1 140px; }
  .deal-index-filter-end { flex: 1 1 240px; }
}

/* Local task trial */
.task-panel { padding:clamp(12px,2vw,24px); margin-bottom:16px; }
.task-tabs { display:flex; align-items:end; gap:12px; flex-wrap:wrap; margin-bottom:14px; }
.task-filters { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)) auto; gap:8px 12px; align-items:end; }
.task-filters label { min-width:0; margin:0; }
.task-filters :is(select,button) { height:42px; min-height:42px; margin-bottom:0; }
@media (max-width:550px) {
  .task-filters { grid-template-columns:repeat(2,minmax(0,1fr)); }
  .task-filters button { grid-column:1 / -1; justify-content:center; }
}
.task-filter-row { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:12px; align-items:start; }
.task-filter-row label { margin:0 0 6px; }
.task-filter-row :is(input,select) { min-width:0; height:42px; margin:0; }
.task-due-control { display:flex; align-items:center; gap:6px; }
.task-due-control input { flex:1 1 0; }
.task-due-control button { flex:0 0 42px; height:42px; min-height:42px; padding:0; justify-content:center; }
.task-calendar { width:min(378px,94vw); padding:16px; }
.task-calendar h2 { margin:0 0 12px; }
.task-calendar-header { display:grid; grid-template-columns:auto minmax(0,1fr) auto; gap:8px; align-items:center; text-align:center; margin-bottom:10px; }
.task-calendar-grid { display:grid; grid-template-columns:repeat(7,minmax(0,1fr)); gap:3px; text-align:center; }
.task-calendar-grid button { min-width:0; padding:0; min-height:36px; justify-content:center; }
.task-calendar-grid [aria-current=date] { outline:1px solid var(--blue-600); outline-offset:-2px; }
.task-calendar-weekdays { margin-bottom:4px; }
.task-calendar-time { min-width:0; margin:12px 0 0; padding:0; border:0; }
.task-calendar-time legend { padding:0; font-size:13px; font-weight:650; }
.task-calendar-time-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:8px; }
.task-calendar-time-grid label { min-width:0; margin:4px 0 0; }
.task-calendar-time-grid select { min-width:0; height:42px; }
.task-calendar-error:empty { display:none; }
.task-calendar-time [data-calendar-clear-time] { margin-top:8px; }
.task-calendar .dialog-actions { margin-top:12px; padding:10px 0 0; }
@media (max-width:550px) { .task-filter-row { grid-template-columns:minmax(0,1fr); } }
.task-form { display:grid; gap:16px; }
.task-form button { justify-self:start; }
.task-selection-actions:not([hidden]) { display:flex; align-items:center; flex-wrap:wrap; gap:10px; }
.task-select-cell { white-space:nowrap; text-align:center; }
.task-select-cell input[hidden] { display:none; }
.task-select-cell input { margin:0; }
.card.task-group {
  --task-accent: var(--blue-700); --task-tint: var(--blue-50);
  margin-bottom: 14px; padding: 0; border-radius: 12px;
}
.task-group[data-task-bucket=Overdue] { --task-accent: #9f2017; --task-tint: #fff1ef; }
.task-group[data-task-bucket=Today] { --task-accent: #1749a1; --task-tint: #e8f1ff; }
.task-group[data-task-bucket="No due date"] { --task-accent: #485b76; --task-tint: #edf1f6; }
.task-group-header {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px;
  min-height: 48px; padding: 8px 14px; border-inline-start: 4px solid var(--task-accent);
  border-bottom: 1px solid var(--line); border-radius: 11px 11px 0 0; background: var(--task-tint);
}
.task-group-header h2 { display: flex; align-items: center; gap: 7px; margin: 0; font-size: 16px; color: var(--task-accent); }
.task-group-count { font-size: 14px; font-variant-numeric: tabular-nums; }
.task-selection-actions button { white-space: nowrap; }
.task-group-table { table-layout: fixed; }
.task-group-table .task-col-select { width: 44px; }
.task-group-table .task-col-deal { width: 15%; }
.task-group-table .task-col-person { width: 15%; }
.task-group-table .task-col-due { width: 19%; }
.task-group-table .task-col-status { width: 104px; }
.task-group-table th, .task-group-table td { overflow-wrap: anywhere; }
.task-group-table thead th { background: #f8fafd; border-radius: 0; white-space: normal; }
@media (min-width: 761px) {
  .card.task-group { max-width: 900px; margin-inline-end: auto; }
  .card.task-group:not(:has(.task-col-deal)) { max-width: 760px; }
  .task-group-table:not(:has(.task-col-deal)) .task-col-person { width: 19%; }
  .task-group-table .task-col-due { width: 124px; }
}
@media (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .card.task-group { max-width: none; }
}
.task-group-table tbody tr:nth-child(even) { background: #f8fafd; }
.task-group-table tbody tr:focus-within { background: var(--blue-50); }
.task-group-table tbody tr:hover td { background: transparent; }
.task-group-table tbody tr.task-row-completed { background: #eef0f3; }
.task-group-table tbody tr.task-row-completed:focus-within { background: #e5e9ef; }
.task-group-table tbody tr.task-row-unread { background: #eaf2ff; }
.task-group-table tbody tr.task-row-unread:focus-within { background: var(--blue-100); }
.task-group-table tr > :first-child { padding-inline-start: 15px; }
.task-group-table tr > :last-child { padding-inline-end: 15px; }
.task-group-table .task-list-title { overflow-wrap: anywhere; font-weight: 700; }
.task-group-table .task-list-due { color: var(--ink); font-variant-numeric: tabular-nums; }
.task-group[data-task-bucket=Overdue] .task-list-due { color: var(--task-accent); font-weight: 650; }
.task-group-table .task-list-status .pill:not(.success) { color: var(--blue-700); background: var(--blue-50); }
.task-mobile-label { display: none; }
@media (max-width: 760px), (max-width: 1000px) and (max-height: 560px) and (pointer: coarse) {
  .task-group .table-scroll { position: relative; border-radius: 0 0 11px 11px; }
  .task-group.table-card .task-group-table { min-width: 0; }
  .task-group-table, .task-group-table tbody { display: block; width: 100%; }
  .task-group-table colgroup { display: none; }
  .task-group-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .task-group-table tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px 14px; padding: 11px 14px; }
  .task-group-table tbody tr + tr { border-top: 1px solid var(--line); }
  .task-group-table tbody tr > td { padding: 0; border: 0; min-width: 0; overflow-wrap: anywhere; }
  .task-group-table tbody tr > .task-select-cell { grid-column: 1; grid-row: 1; z-index: 1; display: flex; width: auto; min-height: 25px; padding: 0; align-items: center; justify-self: start; }
  .task-group-table .task-select-cell input { width: 18px; height: 18px; }
  .task-group-table tbody tr > .task-select-cell:not(:has(input)) { display: none; }
  .task-group-table .task-list-title { grid-column: 1 / -1; grid-row: 1; min-height: 25px; align-content: center; }
  .task-group-table .task-select-cell:has(input) + .task-list-title { padding-inline-start: 28px; }
  .task-group-table .task-list-detail { font-size: 13px; }
  .task-mobile-label { display: block; margin-bottom: 1px; color: #465974; font-size: 11px; font-weight: 700; }
}
.task-facts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; max-width: 600px; margin: 0 0 18px; }
.task-facts > div { min-width: 0; padding: 8px 10px; border: 1px solid var(--line-strong); border-radius: 8px; background: #f8fafd; }
.task-facts dt { color: var(--muted); font-size: 12px; font-weight: 700; }
.task-facts dd { margin: 3px 0 0; color: var(--ink); font-weight: 700; overflow-wrap: anywhere; }
.task-detail-title { display: flex; align-items: center; gap: 8px; }
.task-detail-title h1 { min-width: 0; overflow-wrap: anywhere; }
.task-detail-title .pill { flex: 0 0 auto; }
.task-note { white-space: pre-wrap; overflow-wrap: anywhere; }
.task-detail-card > ul { overflow-wrap: anywhere; }
.task-detail-action { margin: 14px 0 0; }
.task-detail-activity { margin-top: 16px; padding-top: 14px; border-top: 1px solid var(--line-strong); overflow-wrap: anywhere; }
.task-activity { margin: 0; padding-inline-start: 20px; }
.task-activity li + li { margin-top: 8px; }
@media (max-width: 550px) {
  .task-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-facts > :last-child { grid-column: 1 / -1; }
}
.task-tabs:last-child { margin-bottom:0; }
.task-clock-link, .workspace-deals-mobile-link { display:none; }
@media (max-width:760px), (max-width:1000px) and (max-height:560px) and (pointer:coarse) {
  .task-tabs { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); align-items:stretch; }
  .task-tabs .button { min-width:0; text-align:center; }
  .tasks-enabled .sidebar nav .workspace-deals-nav { display:none; }
  .tasks-enabled .workspace-deals-mobile-link { display:inline-flex; align-self:flex-start; }
}
@media (max-width:760px) and (pointer:coarse), (max-width:1000px) and (max-height:560px) and (pointer:coarse) {
  .tasks-enabled .sidebar nav { grid-template-columns:none; grid-auto-flow:column; grid-auto-columns:minmax(0,1fr); }
}
@media (min-width:761px) and (max-width:1340px) and (orientation:portrait) {
  .tasks-enabled .topbar .task-clock-link { display:inline-flex; white-space:nowrap; font-size:.8rem; }
}

.task-form-parties { display: grid; grid-template-columns: minmax(0, 1fr); align-items: start; gap: 12px; }
.task-documents { min-width:0; margin:0; padding:0; border:0; }
.task-documents legend { padding:0; margin-bottom:6px; font-size:13px; font-weight:650; }
.task-document-rows { display:grid; gap:8px; }
.task-document-row { display:grid; grid-template-columns:minmax(0,1fr) auto; align-items:center; gap:8px; }
.task-document-row :is(select,button) { min-width:0; margin:0; height:42px; }
.task-documents :is([data-add-task-document],[data-add-task-assignee]) { margin-top:8px; }
@media (min-width: 900px) and (min-height: 561px), (min-width: 1001px) {
  .task-form-parties { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .task-form > .task-filter-row { grid-template-columns: repeat(2, minmax(0, 30%)); }
}
