@import url('./projex/styles/components/date-picker.css');

/* Shared by both shells. Platform packages never maintain a second stylesheet. */
:root {
  color-scheme: dark;
  --bg: #092128; --surface: #143741; --field: #103039; --ink: #f4f7f6;
  --muted: #a2bac1; --line: #355761; --accent: #0876cc; --accent-ink: #ffffff;
  --accent-text: #79c4ff; --accent-soft: color-mix(in srgb, var(--accent) 12%, var(--surface)); --brand-ink: #ffffff;
  --hover: #1b414c; --neutral-surface: #303b40; --danger: #ffb8b8; --success: #a6dcc8;
  --radius: 6px; --control-height: 32px; --sidebar: 176px;
  --form-control-height: var(--control-height); --color-input-border: var(--line);
  --color-text: var(--ink); --color-text-strong: var(--ink); --color-text-muted: var(--muted);
  --color-input-bg: var(--field); --color-border: var(--line); --color-border-strong: var(--line);
  --color-surface: var(--surface); --color-surface-raised: var(--surface);
  --color-primary: var(--accent); --color-accent-text: var(--ink); --color-on-primary: var(--accent-ink);
  --grid-unit: 4px; --grid-2: 8px; --grid-3: 12px; --font-size-body: 12px;
  --font-size-sm: 12px; --font-size-xs: 11px; --font-size-2xs: 11px;
  --line-height-body: 18px; --font-weight-micro: 500; --font-weight-regular: 400;
}
:root[data-mode="light"] {
  color-scheme: light;
  --bg: #f3f3f2; --surface: #ffffff; --field: #f6f6f5; --ink: #182f39;
  --muted: #596267; --line: #dadcdd; --hover: #ededec; --neutral-surface: #e9ebeb; --danger: #a32c35; --success: #217152;
  --accent-text: #0763a8; --brand-ink: #303438;
}
:root[data-color="yellow"] { --accent: #ffa914; --accent-ink: #122229; --accent-text: #ffd36b; }
:root[data-mode="light"][data-color="yellow"] { --accent-text: #805400; }
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 12px/18px 'Segoe UI', Arial, sans-serif; }
button, input, select, textarea { font: inherit; }
button, a, input, textarea, select, summary { -webkit-tap-highlight-color: transparent; }
button, summary { cursor: pointer; }
button { color: inherit; }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 16px; height: 16px; flex: 0 0 16px; vertical-align: middle; }
button:disabled { opacity: .5; cursor: not-allowed; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
h1, h2, h3, p { margin: 0 0 12px; }
h1 { font-size: 15px; line-height: 22px; font-weight: 600; overflow-wrap: anywhere; }
h2 { font-size: 14px; line-height: 20px; font-weight: 600; }
h3 { font-size: 13px; line-height: 18px; font-weight: 600; }
small, .small-text { font-size: 11px; line-height: 16px; }
.muted { color: var(--muted); }
.eyebrow { color: var(--muted); font-size: 11px; line-height: 18px; font-weight: 700; letter-spacing: 1px; text-transform: uppercase; }
.button { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: var(--control-height); padding: 6px 10px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); color: var(--ink); text-decoration: none; font-weight: 600; line-height: 18px; }
.button:hover, a.button:hover { background: var(--hover); text-decoration: none; }
.button.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.button.primary:hover { filter: brightness(1.08); }
.button.small { padding: 4px 8px; min-height: 28px; font-size: 11px; }
.button.full { width: 100%; }
.actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.page-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin: 0 0 18px; }
.page-heading h1 { color: var(--accent-text); }
.page-heading .muted { max-width: 720px; margin: 0; }
.badge { display: inline-flex; align-items: center; width: fit-content; border: 1px solid var(--line); background: var(--field); color: var(--muted); padding: 3px 8px; border-radius: 6px; font-size: 11px; line-height: 18px; font-weight: 600; white-space: nowrap; }
.badge.success { color: var(--success); }
.badge.danger { color: var(--danger); }
.brand { --brand-square-size: 13px; display: flex; gap: 8px; align-items: baseline; }
/* Rounded Segoe UI bold D heights; the square bottom shares the text baseline. */
.brand::before { content: ""; width: var(--brand-square-size); height: var(--brand-square-size); flex: 0 0 var(--brand-square-size); background: var(--accent); }
.brand b { font-size: 18px; line-height: 24px; color: var(--brand-ink); white-space: nowrap; }
.brand b span { color: var(--accent); }
.entry { min-height: 100vh; display: grid; grid-template-columns: repeat(2, minmax(0, 480px)); justify-content: space-between; gap: 80px; max-width: 1240px; margin: auto; padding: 80px 48px; align-items: stretch; align-content: start; }
/* PROJEX login grid and floating labels, scoped to the sign-in view. */
.entry { position: relative; isolation: isolate; }
.entry-story, .entry-card { position: relative; z-index: 1; }
.entry-background { position: fixed; inset: 0; z-index: 0; overflow: hidden; pointer-events: none; background: var(--bg); }
.entry-background::before, .entry-background::after { position: absolute; inset: -96px; content: ""; will-change: transform; }
.entry-background::before {
  background-image: linear-gradient(to right, color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--ink) 8%, transparent) 1px, transparent 1px);
  background-size: 144px 144px;
  animation: entry-large-grid-motion 22s ease-in-out infinite alternate;
}
.entry-background::after {
  background-image: linear-gradient(to right, color-mix(in srgb, var(--accent) 10%, transparent) 1px, transparent 1px), linear-gradient(to bottom, color-mix(in srgb, var(--accent) 10%, transparent) 1px, transparent 1px);
  background-size: 44px 44px;
  animation: entry-small-grid-motion 15s ease-in-out infinite alternate;
}
.entry-floating-labels { position: absolute; inset: 0; z-index: 1; overflow: hidden; }
.entry-floating-labels span {
  position: absolute; top: var(--float-y); left: var(--float-x); color: var(--muted);
  font-family: Consolas, monospace; font-size: var(--float-size); font-weight: 600;
  letter-spacing: 1px; line-height: 16px; opacity: 0; white-space: nowrap;
  animation: entry-floating-label var(--float-duration) ease-in-out var(--float-delay) infinite;
  will-change: opacity, transform;
}
.entry-floating-labels span:nth-child(1) {
  --float-x: 15%;
  --float-y: 14%;
  --float-size: 11px;
  --float-duration: 17s;
  --float-delay: -8s;
  --float-from-x: -26px;
  --float-from-y: 30px;
  --float-to-x: 46px;
  --float-to-y: -38px;
}

.entry-floating-labels span:nth-child(2) {
  --float-x: 53%;
  --float-y: 33%;
  --float-size: 9px;
  --float-duration: 21s;
  --float-delay: -14s;
  --float-from-x: 34px;
  --float-from-y: -22px;
  --float-to-x: -42px;
  --float-to-y: 48px;
}

.entry-floating-labels span:nth-child(3) {
  --float-x: 19%;
  --float-y: 52%;
  --float-size: 12px;
  --float-duration: 15s;
  --float-delay: -3s;
  --float-from-x: -40px;
  --float-from-y: -28px;
  --float-to-x: 55px;
  --float-to-y: 31px;
}

.entry-floating-labels span:nth-child(4) {
  --float-x: 60%;
  --float-y: 70%;
  --float-size: 9px;
  --float-duration: 19s;
  --float-delay: -11s;
  --float-from-x: 28px;
  --float-from-y: 36px;
  --float-to-x: -50px;
  --float-to-y: -26px;
}

.entry-floating-labels span:nth-child(5) {
  --float-x: 12%;
  --float-y: 87%;
  --float-size: 11px;
  --float-duration: 23s;
  --float-delay: -6s;
  --float-from-x: 42px;
  --float-from-y: -35px;
  --float-to-x: -30px;
  --float-to-y: 44px;
}


/* Translation keeps the grid at its original pixel size without scaling. */
@keyframes entry-large-grid-motion {
  0% { transform: translate3d(-32px, -24px, 0); }
  48% { transform: translate3d(44px, -44px, 0); }
  100% { transform: translate3d(-12px, 56px, 0); }
}
@keyframes entry-small-grid-motion {
  0% { transform: translate3d(44px, 32px, 0); }
  52% { transform: translate3d(-56px, 44px, 0); }
  100% { transform: translate3d(32px, -56px, 0); }
}
@keyframes entry-floating-label {
  0%,
  10%,
  100% {
    opacity: 0;
    transform: translate3d(
      var(--float-from-x),
      var(--float-from-y),
      0
    );
  }

  30% {
    opacity: 0.22;
  }

  50% {
    opacity: 0.42;
    transform: translate3d(0, 0, 0);
  }

  70% {
    opacity: 0.24;
  }

  86% {
    opacity: 0;
    transform: translate3d(
      var(--float-to-x),
      var(--float-to-y),
      0
    );
  }
}


@media (prefers-reduced-motion: reduce) {
  .entry-background::before, .entry-background::after, .entry-floating-labels span { animation: none; transform: none; will-change: auto; }
  .entry-floating-labels span { opacity: .14; }
}

.entry-story { min-width: 0; align-self: stretch; margin-top: 56px; padding: 24px; display: flex; flex-direction: column; justify-content: space-between; gap: 24px; }
.entry-story .brand { --brand-square-size: 50px; gap: 16px; margin: 0; }
.entry-story .brand b { font-size: 72px; line-height: 72px; }
.entry-story h1 { font-size: 33px; line-height: 45px; margin: 0; }
.entry-story > p { color: var(--muted); max-width: 100%; font-size: 18px; line-height: 30px; margin: 0; overflow-wrap: anywhere; }
.entry-story .appearance-inline { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: 100%; gap: 12px; margin: 0; }
.entry-story .segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; padding: 3px; gap: 4px; }
.entry-story .segmented button { min-width: 0; min-height: 32px; padding: 4px 6px; font-size: 14px; line-height: 20px; }
.entry-features { display: grid; gap: 16px; margin: 40px 0; }
.entry-features span { display: flex; gap: 12px; align-items: center; }
.entry-card { align-self: start; margin-top: 56px; padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.entry-card > .badge { margin-bottom: 28px; }
.entry-card h2 { font-size: 16px; line-height: 24px; }
.entry-card form { display: grid; gap: 14px; margin: 20px 0; }
.connection { margin-top: 28px; padding-top: 20px; border-top: 1px solid var(--line); }
.demo-note { font-size: 12px; color: var(--muted); margin-top: 24px; }
.app-shell { min-height: 100vh; padding-left: var(--sidebar); }
.sidebar { position: fixed; inset: 0 auto 0 0; width: var(--sidebar); padding: 18px 12px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; overflow-y: auto; }
.sidebar .brand { padding: 0 0 20px; flex-wrap: wrap; }
.sidebar-context { padding: 12px 8px; margin-bottom: 8px; background: var(--neutral-surface); border: 1px solid var(--line); border-radius: var(--radius); }
.sidebar-context strong, .sidebar-context small { display: block; overflow-wrap: anywhere; }
.sidebar-context small { color: var(--muted); }
.nav { display: grid; gap: 4px; }
.nav a { display: flex; align-items: center; gap: 8px; padding: 8px; border: 1px solid transparent; border-radius: var(--radius); color: var(--muted); }
.nav a svg { color: var(--accent-text); }
.nav a:hover { color: var(--ink); background: var(--accent-soft); text-decoration: none; }
.nav a.active { color: var(--accent-ink); background: var(--accent); text-decoration: none; }
.nav a.active svg { color: inherit; }
.topbar { position: sticky; top: 0; z-index: 100; min-height: 48px; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; padding: 8px 20px; border-bottom: 1px solid var(--line); background: var(--surface); gap: 12px; }
.topbar-path { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; font-size: 12px; color: var(--muted); }
/* PROJEX header tools, avatar and account disclosure, using DARI theme tokens. */
.header-tools { display: flex; align-items: center; justify-content: flex-end; gap: 6px; min-width: 0; margin-left: auto; }
.header-command { display: inline-flex; align-items: center; justify-content: center; height: 30px; min-height: 30px; padding: 0 5px; overflow: hidden; border: 0; border-radius: 4px; color: var(--ink); background: transparent; font-size: 12px; font-weight: 500; white-space: nowrap; }
.header-command:hover, .header-command[aria-expanded="true"] { color: var(--accent-ink); background: var(--accent); text-decoration: none; }
.settings-command { width: 30px; padding: 0; }
.settings-command svg { width: 17px; height: 17px; }
.user-menu { position: relative; flex: 0 0 auto; max-width: 220px; }
.user-command { max-width: 220px; justify-content: flex-start; gap: 6px; padding: 0 7px 0 3px; }
.user-command > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.header-avatar { position: relative; display: grid; place-items: center; width: 25px; height: 25px; flex: 0 0 25px; overflow: hidden; border: 1px solid var(--line); border-radius: 50%; font-size: 11px; }
.header-avatar img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.header-popover { position: absolute; z-index: 210; top: calc(100% + 6px); right: 0; width: 232px; max-width: calc(100vw - 32px); padding: 12px; border: 1px solid var(--line); color: var(--ink); background: var(--surface); box-shadow: 0 8px 24px rgb(0 0 0 / 18%); }
.header-popover[hidden], .header-avatar img[hidden] { display: none; }
.header-popover .user-email { margin: 4px 0 8px; color: var(--muted); font-size: 11px; overflow-wrap: anywhere; }
.header-popover .user-role { margin-bottom: 12px; font-size: 11px; }
.header-popover > strong { display: block; overflow-wrap: anywhere; }
.user-menu-options { display: grid; gap: 4px; }
.user-menu-options button, .user-menu-options a { display: flex; align-items: center; min-height: 28px; padding: 4px 8px; border: 1px solid var(--line); border-radius: 0; color: var(--ink); background: transparent; font-size: 11px; text-align: left; }
.user-menu-options button:hover, .user-menu-options a:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent); text-decoration: none; }
.demo-banner { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin: 0; padding: 8px 32px; background: var(--field); border-bottom: 1px solid var(--line); color: var(--muted); font-size: 12px; }
.main-content { padding: 18px 20px; max-width: 1700px; margin: 0 auto; }
.mobile-nav { display: none; }
.panel, .form-section { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px; margin-bottom: 16px; min-width: 0; }
.section-heading { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.section-heading h2, .section-heading h3 { margin: 0; }
.text-action { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 12px; color: var(--accent-text); }
.card-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 20px; margin-bottom: 24px; }
.company-card, .project-card, .template-card { display: block; padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); min-width: 0; }
.company-card:hover, .project-card:hover { background: var(--hover); text-decoration: none; }
.company-card h2, .project-card h2, .template-card h2 { margin-top: 24px; }
.company-initial, .row-icon { display: grid; place-items: center; width: 40px; height: 40px; flex: 0 0 40px; background: var(--field); border: 1px solid var(--line); border-radius: 10px; }
.company-initial { margin-bottom: 16px; font-size: 22px; }
.project-code { font-size: 12px; color: var(--muted); }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 20px; margin-bottom: 28px; }
.metrics article { padding: 20px 24px; border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); }
.metrics span { display: block; color: var(--muted); font-size: 12px; }
.metrics strong { display: block; margin-top: 8px; font-size: 20px; line-height: 28px; font-weight: 600; }
.metrics strong.word { font-size: 14px; }
.workspace-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 24px; align-items: start; }
.document-row, .list-row { display: flex; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.document-row:last-child, .list-row:last-child { border-bottom: 0; }
.document-row > div, .list-row > div { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.document-row p, .list-row p { margin: 4px 0 0; font-size: 12px; }
.detail-list { display: grid; grid-template-columns: 100px 1fr; gap: 12px; }
dt { color: var(--muted); }
dd { margin: 0; overflow-wrap: anywhere; }
.note { background: var(--field); border: 1px solid var(--line); border-radius: 8px; padding: 16px; margin-bottom: 20px; color: var(--muted); }
.note a { text-decoration: underline; }
.empty { text-align: center; padding: 48px 20px; }
.empty > svg { width: 36px; height: 36px; color: var(--muted); margin-bottom: 16px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.form-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.field, .date-field { display: grid; gap: 8px; min-width: 0; align-content: start; }
.field > span, .date-field > span, .date-field > label { font-size: 12px; color: var(--muted); font-weight: 600; }
input:not([type="checkbox"]):not([type="radio"]), textarea, select { width: 100%; min-width: 0; min-height: var(--control-height); border: 1px solid var(--line); background: var(--field); color: var(--ink); border-radius: var(--radius); padding: 6px 10px; }
textarea { resize: vertical; line-height: 22px; }
input:disabled, textarea:disabled, select:disabled { opacity: 1; color: var(--muted); cursor: default; }
input[type="checkbox"], input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); flex: 0 0 18px; margin: 0; }
.span-all { grid-column: 1 / -1; }
.choice-field { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; margin: 0; min-width: 0; }
.choice-field legend { color: var(--muted); font-size: 12px; padding: 0 4px; }
.choices, .check-grid { display: flex; flex-wrap: wrap; gap: 16px; }
.choices label, .check, .check-label { display: flex; gap: 8px; align-items: center; min-height: 32px; }
.grant { margin: 20px 0; padding: 20px; border: 1px solid var(--line); border-radius: 8px; }
.grant .field { margin-top: 16px; }
.form-section { padding: 0; }
.form-section > summary { list-style: none; padding: 20px 24px; display: flex; align-items: center; gap: 16px; font-size: 13px; font-weight: 600; }
.form-section > summary span { color: var(--muted); font-weight: 400; }
.form-section > .form-grid { padding: 4px 24px 24px; }
.form-actions { position: sticky; bottom: 12px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; display: flex; justify-content: flex-end; align-items: center; gap: 20px; z-index: 10; margin-bottom: 24px; }
.recipient-grid details { padding: 16px 0; border-bottom: 1px solid var(--line); }
.recipient-grid .form-grid { margin-top: 16px; }
.document-meta { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; margin-bottom: 24px; color: var(--muted); font-size: 12px; }
.filter-bar { display: flex; align-items: flex-end; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.filter-bar .field:first-child { flex: 1; min-width: 180px; }
table { width: 100%; border-collapse: collapse; text-align: left; }
th { font-size: 11px; line-height: 16px; color: var(--ink); background: var(--neutral-surface); font-weight: 600; white-space: nowrap; }
th, td { padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.register-table tbody tr:hover { background: var(--accent-soft); }
tr:last-child td { border-bottom: 0; }
td small { display: block; color: var(--muted); margin-top: 4px; }
td strong { overflow-wrap: anywhere; }
.document-link { font-weight: 600; color: var(--accent-text); }
.table-scroll, .table-panel { overflow: auto; }
.row-editor table { min-width: 640px; }
.row-editor td { min-width: 140px; padding: 8px 4px; }
.row-editor td:last-child { min-width: 90px; }
.row-editor td label > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
.files-layout { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: 24px; align-items: start; }
.folder-tree { padding: 12px; max-height: 680px; overflow: auto; }
.folder-item { width: 100%; padding: 10px 12px; border: 1px solid transparent; border-radius: 6px; display: flex; gap: 8px; align-items: center; background: transparent; text-align: left; font-size: 12px; overflow-wrap: anywhere; }
.folder-item:hover { background: var(--accent-soft); }
.folder-item.selected { background: var(--accent); color: var(--accent-ink); }
.breadcrumb { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.paper { border: 1px solid var(--line); background: var(--surface); border-radius: var(--radius); padding: 40px; margin-bottom: 24px; }
.paper-heading { text-align: center; border-bottom: 1px solid var(--line); padding-bottom: 24px; }
.party-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; margin: 24px 0; }
.party-grid small, .party-grid strong { display: block; }
.party-grid small { text-transform: uppercase; color: var(--muted); }
.party-logo { height: 48px; width: 100px; object-fit: contain; margin-bottom: 8px; }
.paper-section { margin-top: 24px; padding-bottom: 12px; border-bottom: 1px solid var(--line); }
.preview-fields { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px 24px; font-size: 13px; }
.preview-fields dt { font-size: 11px; margin-bottom: 6px; }
.preview-fields dd { white-space: pre-wrap; }
.activity-list { padding: 0; list-style: none; }
.activity-list li { padding: 14px 0; border-bottom: 1px solid var(--line); }
.activity-list li:last-child { border: 0; }
.activity-list strong, .activity-list span { display: block; }
.activity-list span { font-size: 12px; }
.appearance-inline { display: flex; flex-wrap: wrap; gap: 10px; }
.appearance-settings { display: grid; width: 100%; max-width: 400px; margin: 12px 0; }
.theme-row { display: grid; grid-template-columns: minmax(0, 1fr) 136px; align-items: center; gap: 12px; padding: 14px 0; border-bottom: 1px solid var(--line); }
.theme-row-label { font-size: 11px; }
.theme-options { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 3px; }
.theme-options button { min-height: 36px; padding: 0 8px; border: 1px solid var(--line); border-radius: 0; background: var(--field); color: var(--ink); font-size: 11px; }
.theme-options button[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-ink); }
.segmented { display: flex; padding: 3px; gap: 3px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--field); }
.segmented button { border: 1px solid transparent; background: transparent; color: var(--muted); padding: 4px 8px; border-radius: 4px; font-size: 11px; }
.segmented button[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
dialog { position: fixed; inset: 48px 16px auto; margin: 0 auto; padding: 0; width: 720px; max-width: calc(100% - 32px); max-height: calc(100dvh - 96px); border: 1px solid var(--line); border-radius: 16px; color: var(--ink); background: var(--surface); overflow: auto; }
dialog::backdrop { background: rgb(0 0 0 / 65%); }
.dialog-head { position: sticky; top: 0; background: var(--surface); z-index: 3; padding: 20px 24px; border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 24px; flex-wrap: wrap; }
.form-error { border: 1px solid var(--line); color: var(--danger); padding: 12px; margin-bottom: 16px; border-radius: 6px; }
.file-preview { width: 100%; height: 440px; border: 1px solid var(--line); object-fit: contain; }
#notifications { position: fixed; bottom: 24px; right: 24px; z-index: 5000; display: grid; gap: 8px; width: min(440px, calc(100% - 32px)); pointer-events: none; }
.toast { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px; padding: 16px; box-shadow: 0 8px 24px rgb(0 0 0 / 20%); }
.toast.error { color: var(--danger); }
.loading { padding: 48px; text-align: center; color: var(--muted); }
.pending-change { padding: 12px 16px; border: 1px solid var(--line); border-radius: 8px; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; gap: 12px; }
@media (max-width: 1100px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .workspace-grid > aside { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
  .entry { gap: 32px; padding: 48px 32px; grid-template-columns: repeat(2, minmax(0, 480px)); }
  .files-layout { grid-template-columns: 220px minmax(0, 1fr); }
}
@media (min-width: 761px) and (max-width: 980px) {
  .entry { grid-template-columns: minmax(0, 1fr); max-width: 620px; }
  .entry-story, .entry-card { margin-top: 0; }
}
@media (max-width: 760px) {
  .entry { display: block; max-width: 520px; padding: 24px 20px; }
  .entry-story { margin-top: 0; padding: 24px 0; }
  .entry-story h1 { font-size: 30px; line-height: 42px; }
  .entry-features { display: none; }
  .entry-story > .eyebrow { display: none; }
  .entry-card { padding: 24px; margin: 28px 0 0; }
  .appearance-inline { margin-top: 20px; }
  .app-shell { padding: 0 0 88px; }
  .sidebar { display: none; }
  .topbar { padding: 8px 16px; min-height: 48px; }
  .user-menu, .user-command { max-width: 180px; }
  .demo-banner { padding: 8px 16px; font-size: 11px; }
  .main-content { padding: 16px; }
  .page-heading { display: block; margin-bottom: 20px; }
  .page-heading .actions { margin-top: 16px; }
  h1 { font-size: 15px; line-height: 22px; }
  .mobile-nav { display: flex; position: fixed; inset: auto 0 0; justify-content: space-around; z-index: 20; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); background: var(--surface); border-top: 1px solid var(--line); }
  .mobile-nav a { display: grid; justify-items: center; gap: 4px; padding: 4px 8px; color: var(--muted); font-size: 10px; min-width: 56px; border-radius: 6px; }
  .mobile-nav a.active { background: var(--accent); color: var(--accent-ink); }
  .panel { padding: 16px; }
  .metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .metrics article { padding: 16px; }
  .metrics strong { font-size: 20px; line-height: 28px; }
  .card-grid { grid-template-columns: 1fr; gap: 12px; }
  .form-grid, .form-grid.three, .workspace-grid > aside, .files-layout { grid-template-columns: 1fr; }
  .form-section > summary { padding: 16px; font-size: 12px; }
  .form-section > .form-grid { padding: 4px 16px 20px; }
  .form-actions { bottom: 80px; flex-wrap: wrap; gap: 12px; }
  .form-actions .muted { font-size: 12px; }
  .filter-bar { gap: 12px; }
  .filter-bar .field { flex: 1; min-width: 130px; }
  .register-table { min-width: 700px; }
  .folder-tree { max-height: 240px; }
  .paper { padding: 20px 16px; }
  .party-grid { grid-template-columns: 1fr; gap: 12px; }
  .preview-fields { grid-template-columns: 1fr; }
  .document-row { align-items: flex-start; gap: 12px; }
  .document-row .badge { white-space: normal; }
  dialog { top: 16px; max-height: calc(100dvh - 32px); }
  .dialog-head, .dialog-body { padding: 16px; }
  #notifications { bottom: 88px; right: 16px; }
}
@media (max-width: 480px) {
  .entry-story .brand { --brand-square-size: 34px; gap: 12px; }
  .entry-story .brand b { font-size: 48px; line-height: 64px; }
}
/* Compact desktop controls retain comfortable touch targets on mobile devices. */
@media (pointer: coarse) {
  :root { --control-height: 44px; }
  .button, .button.small, .segmented button, .entry-story .segmented button, .mobile-nav a, .folder-item { min-height: 44px; }
  .header-command, .user-menu-options button, .user-menu-options a, .theme-options button { min-height: 44px; }
  .settings-command { width: 44px; }
  input:not([type="checkbox"]):not([type="radio"]), textarea, select { font-size: 16px; }
}
