/* The workspace palette is separate from the paper and PDF styles. */
@font-face {
  font-family: Peyda Preview;
  src: url('/api/local-preview-font/peyda-regular.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: Peyda Preview;
  src: url('/api/local-preview-font/peyda-semibold.woff2') format('woff2');
  font-weight: 600;
  font-display: swap;
}
:root[data-local-font="peyda"] { font-family: "Peyda Preview", Vazirmatn, Tahoma, sans-serif; }

:root:not([data-theme="dark"]) {
  color-scheme: light;
  --bg: #f6f6f8;
  --sidebar: #e8e9ee;
  --panel: #fff;
  --panel-up: #eeeff2;
  --line: #dcdde3;
  --text: #202126;
  --muted: #575a65;
  --dim: #656875;
  --green: #cce5d6;
  --green-text: #246249;
  --focus: #287558;
  --offline: #757884;
  --radius: 13px;
}

:root {
  --nav-top: #252628;
  --nav-middle: #1c1d20;
  --nav-bottom: #17181a;
  --nav-rim: #414348;
  --nav-ink: #e6e7ec;
  --nav-active: #f0f1f5;
  --nav-active-ink: #202126;
  --nav-hover: #ffffff12;
  --nav-child: #fff2;
  --nav-dot: #92d7a9;
  --folder-back: #65656b;
  --folder-paper: #dedee3;
  --folder-face: #878890;
  --folder-line: #b6b7bf;
}

:root:not([data-theme="dark"]) {
  --nav-top: #f0f1f6;
  --nav-middle: #e8e9ee;
  --nav-bottom: #dadbe0;
  --nav-rim: #feffff;
  --nav-ink: #24252b;
  --nav-active: #171719;
  --nav-active-ink: #fafafc;
  --nav-hover: #fff6;
  --nav-child: #fafafc;
  --nav-dot: #267654;
  --folder-back: #cbcdd5;
  --folder-paper: #fafafd;
  --folder-face: #e2e3ea;
  --folder-line: #aeb1bc;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  min-height: 53px;
  padding-inline: 6px;
  border-block-end: 1px solid var(--line);
}
.sidebar .logo { padding: 0; }
.sidebar .logo img { width: 77px; }
.sidebar .logo small { display: none; }
.side-nav { gap: 4px; margin-block-start: 14px; }
.sidebar :is(.nav-item, .account) { color: var(--nav-ink); }
.sidebar .nav-item {
  width: 100%;
  min-height: 40px;
  padding: 7px 10px;
  border-radius: 13px;
  font-size: .88rem;
}
.sidebar .nav-item .icon { width: 17px; height: 17px; stroke-width: 1.45; }
.sidebar :is(.nav-item, .account):hover { background: var(--nav-hover); }
.sidebar .nav-item[aria-current="page"],
.sidebar .contract-nav[data-current="true"] > .contract-nav-link {
  background: var(--nav-active);
  color: var(--nav-active-ink);
  font-weight: 500;
}
.sidebar .nav-item[aria-current="page"]::before { display: none; }
.sidebar .contract-nav-link { border-radius: 999px; }
.contract-nav-links {
  display: grid;
  gap: 2px;
  margin: 5px 14px 3px 0;
  padding-inline-start: 7px;
  border-inline-start: 1px solid var(--line);
}
.sidebar .contract-nav-links .nav-item { min-height: 36px; padding-inline: 8px 12px; font-size: .82rem; border-radius: 999px; }
.sidebar .contract-nav-links .nav-item[aria-current="page"] { color: var(--nav-ink); background: var(--nav-child); }
.sidebar .contract-nav-links .nav-item[aria-current="page"]::after {
  content: "";
  position: absolute;
  inset-inline-end: 7px;
  inset-block-start: 50%;
  transform: translateY(-50%);
  inline-size: 5px;
  block-size: 5px;
  border-radius: 50%;
  background: var(--nav-dot);
}
.sidebar-toggle, .sidebar-theme {
  border: 0;
  background: transparent;
  font: inherit;
  text-align: start;
}
.sidebar-footer { gap: 8px; }
.sidebar-footer .connection { padding-inline: 6px; }
.sidebar .account { background: var(--nav-hover); border-color: var(--line); }
.sidebar-toggle { border-block-start: 1px solid var(--line); }

@media (min-width: 641px) {
  .topbar .theme-button { display: none; }
  .shell {
    grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
    gap: 4px;
  }
  .sidebar {
    top: 12px;
    height: calc(100dvh - 24px);
    margin-inline-start: 12px;
    padding: 10px;
    border: 1px solid var(--nav-rim);
    border-radius: 23px;
    background: linear-gradient(175deg, var(--nav-top), var(--nav-middle) 44%, var(--nav-bottom));
    scrollbar-width: thin;
  }
  .shell[data-sidebar-collapsed="true"] { --sidebar-w: 73px; }
  [data-sidebar-collapsed="true"] .sidebar { padding-inline: 6px; }
  [data-sidebar-collapsed="true"] .sidebar-brand { justify-content: center; padding-inline: 1px; }
  [data-sidebar-collapsed="true"] .sidebar .logo img { width: 38px; }
  [data-sidebar-collapsed="true"] .sidebar :is(.nav-item > span:not(.selection-surface), .nav-title, .contract-nav-expansion, .account > :not(.avatar), .connection > span:last-child) { display: none; }
  [data-sidebar-collapsed="true"] .sidebar :is(.nav-item, .account, .connection) { justify-content: center; padding-inline: 0; }
}

.theme-button svg:last-of-type,
[data-theme="dark"] .theme-button svg:first-of-type { display: none; }
[data-theme="dark"] .theme-button svg:last-of-type { display: block; }
.login-wrap > .theme-button { position: absolute; inset-block-start: 18px; inset-inline-end: 18px; }

.dashboard-intro {
  padding-block: 4px 14px;
  border-block-end: 1px solid var(--line);
}
.dashboard-intro h1 { margin-block-end: 13px; font-size: clamp(1.4rem, 2.5vw, 1.9rem); font-weight: 550; }
.dashboard-folders { display: grid; grid-template-columns: repeat(2, minmax(0, 260px)); gap: 10px; }
.folder-action {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 58px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 11px;
  background: var(--panel);
  color: var(--text);
  text-align: start;
  font-size: .93rem;
  font-weight: 550;
}
.folder-action:hover { background: var(--panel-up); }
.folder-action > .icon { inline-size: 15px; block-size: 15px; color: var(--muted); margin-inline-start: auto; }
.folder-symbol {
  position: relative;
  flex: none;
  isolation: isolate;
  inline-size: 39px;
  block-size: 30px;
}
.folder-symbol::before, .folder-symbol::after, .folder-symbol i {
  content: "";
  position: absolute;
  border: 1px solid var(--folder-line);
}
.folder-symbol::before {
  inset: 8px 1px 1px;
  border-radius: 3px 5px 4px 4px;
  background: var(--folder-back);
}
.folder-symbol i {
  inset: 3px 7px 7px;
  border-radius: 3px;
  background: var(--folder-paper);
  transform: rotate(-9deg);
  transition: transform 140ms ease-out;
}
.folder-symbol i + i { transform: rotate(8deg) translateX(4px); }
.folder-symbol::after {
  inset: 13px 0 0;
  border-radius: 3px 4px 5px 5px;
  background: linear-gradient(155deg, var(--folder-paper), var(--folder-face) 70%);
  box-shadow: inset 0 1px #fff8, 0 1px 2px #17171916;
}
@media (hover: hover) {
  .folder-action:is(:hover, :focus-visible) .folder-symbol i { transform: rotate(-12deg) translateY(-3px); }
  .folder-action:is(:hover, :focus-visible) .folder-symbol i + i { transform: rotate(12deg) translate(4px,-2px); }
}

:root:not([data-theme="dark"]) .logo img { filter: brightness(0) saturate(100%); }
:root:not([data-theme="dark"]) .topbar { border-color: var(--line); }
:root:not([data-theme="dark"]) :is(.demo-label, .icon-btn, .dialog, .row-open) { border-color: var(--line); }
:root:not([data-theme="dark"]) :is(.topbar-path .icon, .demo-label, .record-document-number) { color: var(--muted); }
:root:not([data-theme="dark"]) :is(.icon-btn:hover, .metric:not([aria-pressed="true"]):hover) { background: var(--panel-up); }
:root:not([data-theme="dark"]) :is(.btn, .select select, .edit-mode-choice, .searchbox, .field input, .field textarea, .field select),
:root:not([data-theme="dark"]) #full-contract-text {
  border-color: var(--line);
  background: var(--panel);
  color: var(--text);
}
:root:not([data-theme="dark"]) :is(.field input, .field textarea, .searchbox input)::placeholder { color: var(--dim); }
:root:not([data-theme="dark"]) .btn.ghost { background: transparent; }
:root:not([data-theme="dark"]) :is(.btn:hover, .edit-mode-choice:hover) { background: var(--panel-up); }
:root:not([data-theme="dark"]) .btn.primary { background: #24262b; border-color: #24262b; color: #fff; box-shadow: none; }
:root:not([data-theme="dark"]) .btn.primary:hover { background: #373a40; }
:root:not([data-theme="dark"]) :is(.searchbox:focus-within, .edit-mode-choice:focus-visible) { border-color: var(--focus); }
:root:not([data-theme="dark"]) .btn.danger { color: #8e3833; }
:root:not([data-theme="dark"]) :is(.badge-icon, .avatar) { background: #e9eaf0; color: #555966; }
:root:not([data-theme="dark"]) :is(.records, .metric, .editor-panel) { border-radius: var(--radius); }
:root:not([data-theme="dark"]) :is(.page-head h1, .section-head h2, .panel-heading h2, .records-header h2) { font-weight: 600; }
:root:not([data-theme="dark"]) .records th { background: #f2f3f5; color: var(--muted); }
:root:not([data-theme="dark"]) .records td { color: var(--text); border-block-start-color: var(--line); }
:root:not([data-theme="dark"]) .status:not([data-status]) { background: var(--panel-up); color: var(--muted); }
:root:not([data-theme="dark"]) :is(.field, .field .internal-code) { color: var(--muted); }
:root:not([data-theme="dark"]) .form-error,
:root:not([data-theme="dark"]) .login-card .form-error { color: #8e3833; }
:root:not([data-theme="dark"]) .login-wrap { background: linear-gradient(170deg, #f0f1f6, #e3e4e9); }
:root:not([data-theme="dark"]) .login-card { background: var(--panel); border-color: var(--line); box-shadow: 0 18px 55px #1a203214; }
:root:not([data-theme="dark"]) .notice { background: var(--panel); color: var(--text); border-color: var(--line); box-shadow: 0 8px 26px #20212a20; }
:root:not([data-theme="dark"]) .notice.error { color: #8e3833; }
:root:not([data-theme="dark"]) :is(.reminder-group-count, .reminder-status[data-due-status="done"]) { background: #e8f0ea; }
:root:not([data-theme="dark"]) .reminder-status[data-due-status="near"] { background: #f0ede4; color: #67531f; }
:root:not([data-theme="dark"]) .reminder-status[data-due-status="late"] { background: #f4e7e7; color: #863935; }
:root:not([data-theme="dark"]) .backup-reminder { background: #eef3ef; border-color: #cedbd1; }
:root:not([data-theme="dark"]) .payment-row { border-color: var(--line); }
:root:not([data-theme="dark"]) .contract-step-button[data-complete="true"] { background: #e8f0ea; border-color: #c4d7c9; }

@media (max-width: 640px) {
  .dashboard-folders { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 6px; }
  .folder-action { min-height: 48px; gap: 6px; padding-inline: 6px; font-size: .79rem; }
  .folder-action > .icon { display: none; }
  .folder-symbol { inline-size: 31px; block-size: 26px; }
  .folder-symbol::after { inset-block-start: 11px; }
  .topbar-actions .icon-btn { width: 34px; height: 38px; }
  .topbar:has(.workspace-clock) .mobile-brand img { width: 54px; }
  .topbar { padding-inline: 12px; gap: 6px; }
}

:root {
  --canvas-top: #121212;
  --canvas-bottom: #242529;
}
:root:not([data-theme="dark"]) {
  --canvas-top: #f6f6fa;
  --canvas-bottom: #dedfe5;
}
body {
  background: linear-gradient(175deg, var(--canvas-top), var(--canvas-bottom)) top / 100% max(100dvh, 780px) no-repeat,
    var(--canvas-bottom);
}
.contract-folders {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(200px, 100%), 1fr));
  gap: 10px;
  margin-block-end: 16px;
}
.contract-folder-card {
  display: flex;
  align-items: center;
  min-width: 0;
  padding-inline-end: 6px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
}
.contract-folder-card:hover { background: var(--panel-up); }
.contract-folder-link {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  gap: 9px;
  min-width: 0;
  min-height: 54px;
  padding: 7px 10px;
}
.contract-folder-link > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.contract-folder-link strong, .contract-folder-link small { display: block; }
.contract-folder-link strong { font-size: .9rem; font-weight: 600; }
.contract-folder-link small { color: var(--muted); font-size: .75rem; }
.folder-card-action { flex: none; border-color: transparent; background: transparent; }
@media (max-width: 640px) {
  .contract-folder-card .folder-card-action { min-width: 44px; min-height: 44px; }
  .with-folders .record-actions { gap: 3px; }
}

:root {
  --interaction-ease: cubic-bezier(.2,.7,.25,1);
  --selected-fill: linear-gradient(160deg, #fcfcfe, #d8dae2);
  --selected-ink: #202126;
  --selected-badge: #14151a12;
  --interaction-hover: #303136;
  --interaction-edge: #656770;
  --note-shadow: 0 1px 2px #0003, 0 5px 14px #0004;
  --modal-shadow: 0 2px 6px #0004, 0 16px 42px #0005;
  --overlay: #11121880;
}
:root:not([data-theme="dark"]) {
  --selected-fill: linear-gradient(160deg, #292a2f, #171719);
  --selected-ink: #fcfcfd;
  --selected-badge: #ffffff1c;
  --interaction-hover: #ebedf2;
  --interaction-edge: #9a9da8;
  --note-shadow: 0 1px 2px #272b3910, 0 5px 15px #272b391b;
  --modal-shadow: 0 3px 8px #22263512, 0 18px 46px #22263525;
  --overlay: #292c404d;
}

@media (min-width: 641px) {
  .shell { transition: grid-template-columns 230ms var(--interaction-ease); }
  .sidebar .logo img { transition: width 210ms var(--interaction-ease); }
}
.contract-nav-expansion { overflow: hidden; }
.contract-nav-expansion[aria-hidden="true"] { height: 0; opacity: 0; }
[data-sidebar-collapsed="true"] .sidebar .contract-nav-expansion { display: none; }
.contract-nav-links { margin-block: 5px 3px; }

:is(.nav-item, .metric, .form-tabs button) { position: relative; isolation: isolate; }
.selection-surface {
  position: absolute;
  inset: 0;
  z-index: -1;
  border-radius: inherit;
  transform-origin: 0 0;
  pointer-events: none;
}
.sidebar .nav-item[aria-current="page"],
.sidebar .contract-nav[data-current="true"] > .contract-nav-link,
.mobile-nav .nav-item[aria-current="page"],
.metric[data-status][aria-pressed="true"],
.form-tabs button[aria-pressed="true"] {
  z-index: 1;
  color: var(--selected-ink);
  background: transparent;
  border-color: transparent;
}
.sidebar .nav-item[aria-current="page"] .selection-surface,
.sidebar .contract-nav[data-current="true"] > .contract-nav-link .selection-surface,
.mobile-nav .nav-item[aria-current="page"] .selection-surface,
.metric[aria-pressed="true"] .selection-surface,
.form-tabs button[aria-pressed="true"] .selection-surface {
  background: var(--selected-fill);
}
.sidebar .contract-nav-links .nav-item[aria-current="page"] {
  color: var(--nav-ink);
  background: var(--nav-child);
}
.sidebar .contract-nav-links .nav-item[aria-current="page"] .selection-surface { background: transparent; }

.mobile-nav-toggle { display: none; }
@media (max-width: 640px) {
  :is(.mobile-nav, .mobile-nav-toggle) {
    --nav-top: #252628;
    --nav-middle: #1c1d20;
    --nav-bottom: #17181a;
    --nav-rim: #414348;
    --nav-ink: #e6e7ec;
    --nav-hover: #ffffff12;
    --selected-fill: linear-gradient(160deg, #fcfcfe, #d8dae2);
    --selected-ink: #202126;
    --mobile-nav-surface: linear-gradient(165deg, var(--nav-top), var(--nav-middle) 60%, var(--nav-bottom));
  }
  .mobile-nav {
    grid-auto-columns: minmax(0, 1fr);
    gap: 2px;
    inset-inline: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom));
    max-inline-size: 520px;
    margin-inline: auto;
    padding: 5px;
    border: 1px solid var(--nav-rim);
    border-radius: 18px;
    background: var(--mobile-nav-surface);
    box-shadow: 0 3px 6px #17191f12, 0 8px 24px #17191f23;
    backdrop-filter: none;
  }
  [data-theme="dark"] :is(.mobile-nav, .mobile-nav-toggle) {
    --nav-top: #f0f1f6;
    --nav-middle: #e8e9ee;
    --nav-bottom: #dadbe0;
    --nav-rim: #feffff;
    --nav-ink: #24252b;
    --nav-hover: #fff6;
    --selected-fill: linear-gradient(160deg, #292a2f, #171719);
    --selected-ink: #fcfcfd;
  }
  .mobile-nav .nav-item {
    min-height: 54px;
    padding: 5px 1px;
    gap: 4px;
    align-content: center;
    border-radius: 12px;
    background: transparent;
    color: var(--nav-ink);
    font-size: .78rem;
    font-weight: 600;
    line-height: 1.35;
    white-space: nowrap;
  }
  .mobile-nav .nav-item .icon { width: 23px; height: 23px; stroke-width: 1.9; }
  .mobile-nav .nav-item[aria-current="page"] .icon { stroke-width: 2.1; }
  .mobile-nav .selection-surface { transform-origin: center; }
  .mobile-nav .nav-item:focus-visible { outline-color: currentColor; outline-offset: -2px; }
  .content { padding-block-end: calc(96px + env(safe-area-inset-bottom)); }
  .notice { bottom: calc(82px + env(safe-area-inset-bottom)); }

  .mobile-nav[data-compact][data-expanded="false"] {
    transform: translateY(calc(100% + 10px + env(safe-area-inset-bottom)));
    opacity: 0;
    pointer-events: none;
  }
  .mobile-nav-toggle {
    position: fixed;
    z-index: 5;
    inset-inline: 0;
    bottom: env(safe-area-inset-bottom);
    display: grid;
    place-items: center;
    inline-size: 76px;
    block-size: 44px;
    margin-inline: auto;
    padding: 0;
    border: 0;
    border-radius: 10px;
    background: transparent;
    color: var(--nav-ink);
  }
  .mobile-nav-toggle > span {
    display: grid;
    place-items: center;
    inline-size: 56px;
    block-size: 21px;
    border: 1px solid var(--nav-rim);
    border-radius: 7px;
    background: var(--mobile-nav-surface);
    box-shadow: 0 2px 5px #17191f26;
  }
  .mobile-nav-toggle > span::before {
    content: "";
    inline-size: 7px;
    block-size: 7px;
    border-right: 1.5px solid currentColor;
    border-bottom: 1.5px solid currentColor;
    transform: translateY(2px) rotate(225deg);
  }
  .mobile-nav-toggle[aria-expanded="true"] { transform: translateY(-66px); }
  .mobile-nav-toggle[aria-expanded="true"] > span::before { transform: translateY(-2px) rotate(45deg); }
  body:has(.mobile-nav[data-compact]) .content { padding-block-end: calc(54px + env(safe-area-inset-bottom)); }
  body:has(.mobile-nav[data-compact][data-expanded="false"]) .notice { bottom: calc(48px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) and (prefers-reduced-motion: no-preference) {
  .mobile-nav[data-compact] { transition: transform 240ms var(--interaction-ease), opacity 200ms var(--interaction-ease); }
  .mobile-nav-toggle, .mobile-nav-toggle > span::before { transition: transform 240ms var(--interaction-ease); }
}
@media (max-width: 640px) and (hover: hover) {
  .mobile-nav .nav-item:not([aria-current]):hover { background: var(--nav-hover); }
}

.metric .metric-label { color: var(--muted); }
.metric strong { color: var(--text); }
.metric[data-status] .badge-icon { background: var(--panel-up); color: var(--muted); }
.metric[data-status][aria-pressed="true"] :is(.metric-label, strong, .badge-icon) { color: var(--selected-ink); }
.metric[data-status][aria-pressed="true"] .badge-icon { background: var(--selected-badge); }

:is([data-status="draft"], [data-status="pending"], [data-status="registered"]) {
  --record-marker: var(--record-accent);
  --record-tone: var(--record-pill);
  --record-label: var(--record-ink);
}
:root:not([data-theme="dark"]) [data-status="draft"] {
  --record-marker: #8da6cd;
  --record-tone: #dae5f6;
  --record-label: #2c446e;
}
:root:not([data-theme="dark"]) [data-status="pending"] {
  --record-marker: #ba9157;
  --record-tone: #eee0c7;
  --record-label: #5a4120;
}
:root:not([data-theme="dark"]) [data-status="registered"] {
  --record-marker: #87ad98;
  --record-tone: #d9e9df;
  --record-label: #285a46;
}

.record-row { background: var(--panel); }
.record-pagination, #record-pages { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.record-pagination { justify-content: space-between; padding: 10px 12px; border-block-start: 1px solid var(--line); }
#record-pages { color: var(--muted); font-size: .82rem; }
#record-pages:empty { display: none; }
.record-row:is(:hover,:focus-within) { background: var(--panel-up); }
.status[data-status] {
  background: var(--record-tone);
  color: var(--record-label);
  box-sizing: border-box;
  inline-size: 6.5rem;
  min-block-size: 29px;
  justify-content: center;
  white-space: nowrap;
  font-weight: 600;
  gap: 5px;
}
.status[data-status]::before { display: none; }
.status .icon { inline-size: 13px; block-size: 13px; color: currentColor; }
.metric[data-status]:not([aria-pressed="true"]) .badge-icon {
  background: var(--record-tone, var(--panel-up));
  color: var(--record-label, var(--muted));
}
.record-row[data-status] > td:first-child { border-inline-start: 4px solid var(--record-marker); }
.records .record-row .contract-record-icon {
  inline-size: 33px;
  block-size: 33px;
  border: 1px solid var(--record-tone, var(--line));
  border-radius: 8px;
  background: var(--record-tone, var(--panel-up));
  color: var(--record-label, var(--muted));
}
.records .contract-record-icon .icon { width: 21px; height: 21px; stroke-width: 1.8; }
.records .record-actions .icon { width: 16px; height: 16px; }
.records .record-actions .row-folder-action {
  display: inline-flex;
  justify-content: center;
  gap: 4px;
  inline-size: 84px;
  padding-inline: 5px;
  min-width: 0;
  font-size: .72rem;
}
.heading-record-code {
  margin-inline-start: .45em;
  padding-inline-start: .45em;
  border-inline-start: 1px solid var(--line);
  white-space: nowrap;
}
@media (min-width: 641px) {
  .with-folders .action-column { width: 178px; }
  .with-folders td.action-column { padding-inline-end: 12px; }
}
@media (min-width: 851px) {
  .records th.status-column { width: 128px; }
}
@media (min-width: 641px) and (max-width: 850px) {
  .status[data-status] { inline-size: 5.25rem; font-size: .71rem; }
  .with-folders .action-column { width: 156px; }
  .records .record-actions .row-folder-action { inline-size: 64px; }
}
@media (max-width: 640px) {
  :is(.contract-list-head, .contract-editor-head) {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    gap: 11px;
    margin-block-end: 16px;
  }
  :is(.contract-list-head, .contract-editor-head) h1 {
    font-size: clamp(1.32rem, 5.6vw, 1.66rem);
    line-height: 1.4;
    overflow-wrap: anywhere;
  }
  :is(.contract-list-head, .contract-editor-head) .heading-copy p { margin-block-start: 3px; }
  :is(.contract-list-head, .contract-editor-head) .page-head-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
  }
  :is(.contract-list-head, .contract-editor-head) .page-head-actions .btn {
    min-inline-size: 0;
    min-block-size: 42px;
    justify-content: center;
  }
  .contract-editor-head .page-head-actions > .status { justify-self: end; }
  .contract-editor-head [data-editor-folder-back] { justify-content: start; }
  .contract-folders { grid-template-columns: minmax(0, 1fr); }
  .records .record-row[data-status] {
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px;
    padding: 10px 11px;
    border-inline-start: 4px solid var(--record-marker);
  }
  .records .record-row[data-status] > td:first-child {
    grid-column: 1 / -1;
    border-inline-start: 0;
  }
  .records .record-row > td { padding: 0 !important; }
  .records .record-row .contract-cell { align-items: start; gap: 8px; }
  .records .record-row .contract-cell strong { font-size: .91rem; }
  .records .record-row .contract-record-icon { display: grid; inline-size: 32px; block-size: 32px; }
  .records .contract-record-icon .icon { width: 20px; height: 20px; }
  .records .record-references > span { max-inline-size: 100%; }
  .records .record-next-step { max-inline-size: none; }
  .status[data-status] { inline-size: 5.5rem; min-block-size: 24px; font-size: .7rem; gap: 4px; }
  .records .record-actions .row-open { inline-size: 38px; block-size: 40px; }
  .records .record-actions .row-folder-action { inline-size: clamp(64px, 20vw, 100px); }
}
.folder-scrolling-name {
  display: block;
  min-inline-size: 0;
  overflow: hidden;
  white-space: nowrap;
}
.folder-scrolling-name > span { display: inline-block; }
[data-editor-folder-back] .folder-scrolling-name { max-inline-size: min(24ch, 48vw); }
.row-folder-action .folder-scrolling-name { flex: 1 1 auto; text-align: start; }

.template-active {
  display: grid;
  gap: 10px;
  padding-block-start: 14px;
  border-block-start: 1px solid var(--line);
}
.template-active span, .template-history small { display: block; color: var(--muted); font-size: .78rem; }
.template-active strong, .template-history strong { overflow-wrap: anywhere; }
.template-history { margin-block-start: 14px; }
.template-history ul { list-style: none; margin: 8px 0 0; padding: 0; }
.template-history li {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border-block-start: 1px solid var(--line);
  padding-block: 8px;
}
.template-history li > div { min-inline-size: 0; }
.template-editor-toolbar { display: grid; gap: 8px; margin-block-end: 14px; }
.template-version-name { max-inline-size: 30rem; }
.template-readonly { max-inline-size: 880px; margin-inline: auto; }

:is(.btn, .icon-btn, .row-open, .nav-item, .metric, .form-tabs button, .contract-step-button, .document-tool) {
  transition: background-color 135ms var(--interaction-ease), border-color 135ms var(--interaction-ease),
    color 135ms var(--interaction-ease), box-shadow 135ms var(--interaction-ease);
}
@media (hover: hover) {
  :root button:is(.btn, .icon-btn, .row-open, .contract-step-button, .form-tabs button):where(:not(.primary)):not(:disabled):not([aria-pressed="true"]):hover,
  :root a:is(.btn, .row-open):where(:not(.primary)):hover {
    background-color: var(--interaction-hover);
    border-color: var(--interaction-edge);
    color: var(--text);
  }
  :root .btn.primary:not(:disabled):hover { background: #373a43; border-color: #515663; color: #fff; }
  [data-theme="dark"] .btn.primary:not(:disabled):hover { background: #f5f5fa; border-color: #f5f5fa; color: #202126; }
  :root .btn.danger:not(:disabled):hover { color: #8e3833; }
  [data-theme="dark"] .btn.danger:not(:disabled):hover { color: #f1d7d5; }
  .document-tool:not(:disabled):hover { background: #dfdfe3; border-color: #90939c; }
}
.contract-step-controls .icon { width: 15px; height: 15px; }

.pending-note-action[data-has-note="true"] { color: var(--text); }
.contract-note-preview {
  padding: 8px 11px;
  background: var(--panel);
  border-color: var(--line);
  border-radius: 8px;
  box-shadow: var(--note-shadow);
}
.contract-note-preview:not([hidden]) { animation: note-enter 150ms var(--interaction-ease) both; }
@keyframes note-enter {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: none; }
}

:root .dialog {
  box-shadow: var(--modal-shadow);
  border-radius: 15px;
}
:root .dialog::backdrop { background: var(--overlay); backdrop-filter: none; }
.dialog[open] { animation: dialog-in 190ms var(--interaction-ease) both; }
.dialog[open]::backdrop { animation: overlay-in 190ms var(--interaction-ease) both; }
@keyframes dialog-in {
  from { opacity: 0; transform: translateY(7px) scale(.989); }
  to { opacity: 1; transform: none; }
}
@keyframes overlay-in { from { opacity: 0; } to { opacity: 1; } }

@supports (transition-behavior: allow-discrete) {
  .dialog {
    opacity: 0;
    transform: translateY(7px) scale(.989);
    transition: opacity 170ms var(--interaction-ease), transform 170ms var(--interaction-ease),
      display 170ms allow-discrete, overlay 170ms allow-discrete;
  }
  .dialog[open] { opacity: 1; transform: none; animation: none; }
  :root .dialog::backdrop {
    opacity: 0;
    transition: opacity 170ms ease, display 170ms allow-discrete, overlay 170ms allow-discrete;
  }
  :root .dialog[open]::backdrop { opacity: 1; animation: none; }
  @starting-style {
    .dialog[open] { opacity: 0; transform: translateY(7px) scale(.989); }
    :root .dialog[open]::backdrop { opacity: 0; }
  }
}

.status-guide-steps { gap: 0; }
.status-guide-steps li {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 11px;
  padding-block: 12px;
  border-block-end: 1px solid var(--line);
}
.status-guide-steps .badge-icon { inline-size: 34px; block-size: 34px; border-radius: 8px; }
.status-guide-steps .badge-icon .icon { width: 16px; height: 16px; }
.status-guide-steps h3 { font-size: .91rem; font-weight: 600; }
.status-guide-steps p { margin-block-start: 3px; }
.status-guide-note { margin-block-start: 13px; font-size: .81rem; color: var(--muted); }

@supports selector(details::details-content) {
  :is(.reminder-group, .contract-due-panel details, .backup-reminder details)::details-content {
    interpolate-size: allow-keywords;
    block-size: 0;
    opacity: 0;
    overflow: clip;
    transition: block-size 210ms var(--interaction-ease), opacity 160ms ease, content-visibility 210ms allow-discrete;
  }
  :is(.reminder-group, .contract-due-panel details, .backup-reminder details)[open]::details-content {
    block-size: auto;
    opacity: 1;
  }
}
[data-theme="dark"] .btn.primary {
  background: var(--selected-fill);
  border-color: #d8dae2;
  color: var(--selected-ink);
  box-shadow: none;
}

@media (min-width: 641px) {
  html { scrollbar-gutter: stable; }
  @supports not (scrollbar-gutter: stable) {
    html { overflow-y: scroll; }
  }
}

html[data-route-transition] { view-transition-name: none; }
html[data-route-transition] #main { view-transition-name: workspace-content; }
::view-transition-group(workspace-content) {
  animation-duration: 220ms;
  animation-timing-function: var(--interaction-ease);
}
::view-transition-old(workspace-content), ::view-transition-new(workspace-content) {
  animation-duration: 205ms;
}
::view-transition-old(root), ::view-transition-new(root) {
  animation-duration: 200ms;
  animation-timing-function: var(--interaction-ease);
}
@media (prefers-reduced-motion: reduce) {
  .dialog::backdrop, ::view-transition-old(root), ::view-transition-new(root),
  ::view-transition-group(workspace-content), ::view-transition-old(workspace-content), ::view-transition-new(workspace-content) {
    animation: none !important;
    transition: none !important;
  }
}
