@import url("/styles/design-system.css");
@import url("/styles/primitives.css");

:root {
  /* Brand layer: platform defaults. Company themes may override only these
     validated tokens; components consume the semantic layer below. */
  --brand-accent: #b93521;
  --brand-background: #f8f6f3;
  --brand-surface: #ffffff;
  --brand-text: #2b2926;
  --brand-muted: #6f6962;
  --brand-border: #e6e0d9;
  --brand-font-family:
    system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --brand-field-height: 44px;
  --brand-field-height-compact: 36px;
  --brand-radius-sm: 9px;
  --brand-radius: 12px;
  --brand-radius-lg: 16px;
  /* Semantic color layer. */
  --ui-bg: var(--ds-background);
  --ui-surface: var(--ds-surface);
  --ui-surface-subtle: var(
    --brand-workspace-surface-subtle,
    color-mix(
      in srgb,
      var(--brand-surface) 86%,
      var(--brand-background)
    )
  );
  --ui-surface-raised: var(
    --brand-workspace-surface-raised,
    color-mix(
      in srgb,
      var(--brand-surface) 96%,
      var(--brand-background)
    )
  );
  --ui-text: var(--ds-text);
  --ui-text-muted: var(--ds-muted);
  --ui-text-soft: var(
    --brand-workspace-text-soft,
    color-mix(
      in srgb,
      var(--brand-muted) 72%,
      var(--brand-surface)
    )
  );
  --ui-border: var(--ds-border);
  --ui-border-strong: var(
    --brand-workspace-border-strong,
    color-mix(
      in srgb,
      var(--brand-border) 72%,
      var(--brand-text)
    )
  );
  --ui-accent: var(--ds-accent);
  --ui-accent-soft: color-mix(
    in srgb,
    var(--brand-accent) 9%,
    var(--brand-surface)
  );
  --ui-accent-hover: color-mix(
    in srgb,
    var(--brand-accent) 14%,
    var(--brand-surface)
  );
  --ui-accent-border: color-mix(
    in srgb,
    var(--brand-accent) 31%,
    var(--brand-surface)
  );
  --ui-accent-border-hover: color-mix(
    in srgb,
    var(--brand-accent) 45%,
    var(--brand-surface)
  );
  --ui-accent-text: color-mix(in srgb, var(--brand-accent) 84%, #241c19);
  --ui-focus: var(
    --brand-workspace-focus,
    color-mix(in srgb, var(--brand-accent) 78%, #ffffff)
  );
  --ui-danger: #9b3434;
  --ui-danger-soft: #fff2f1;
  --ui-danger-border: color-mix(in srgb, var(--ui-danger) 30%, var(--ui-surface));
  --ui-success: #2f714d;
  --ui-success-soft: #edf7f1;
  --ui-success-border: color-mix(in srgb, var(--ui-success) 28%, var(--ui-surface));
  --ui-warning: #8a5b16;
  --ui-warning-soft: #fff6e8;
  --ui-warning-border: color-mix(in srgb, var(--ui-warning) 30%, var(--ui-surface));
  --ui-info: #446b8c;
  --ui-info-soft: #f2f7fb;
  --ui-info-border: color-mix(in srgb, var(--ui-info) 28%, var(--ui-surface));
  /* Text/icon color used on top of a solid accent or danger fill. Kept as a
     token so on-accent surfaces stay coherent with the semantic layer instead
     of hard-coding white per component. */
  --ui-on-accent: #ffffff;
  /* Typography layer. */
  --font: var(--ds-font-body);
  --font-mono: ui-monospace, "SFMono-Regular", Consolas, monospace;
  --font-xs: 0.8125rem;
  --font-sm: 0.875rem;
  --font-md: 1rem;
  --font-lg: 1.125rem;
  --font-xl: clamp(1.45rem, 2vw, 1.9rem);
  --weight-normal: 400;
  --weight-medium: 600;
  --weight-semibold: 680;
  --weight-bold: 760;
  /* Spacing / shape / control layer. */
  --space-1: 0.25rem;
  --space-2: 0.5rem;
  --space-3: 0.75rem;
  --space-4: 1rem;
  --space-5: 1.25rem;
  --space-6: 1.5rem;
  --space-7: 2rem;
  --field-height: var(--ds-control-height);
  --field-height-compact: var(--ds-control-height-sm);
  --radius-sm: var(--ds-radius-sm);
  --radius: var(--ds-radius);
  --radius-lg: var(--ds-radius-lg);
  --sidebar-width: 256px;
  --topbar-height: 68px;
  --page-width: 1440px;
  --shadow: 0 1px 2px rgb(56 15 11 / 0.04), 0 8px 24px rgb(56 15 11 / 0.035);
  --shadow-hover:
    0 3px 8px rgb(56 15 11 / 0.07), 0 14px 30px rgb(56 15 11 / 0.045);
  --focus-ring: 0 0 0 2px color-mix(in srgb, var(--ui-accent) 10%, transparent);
  /* Shared scrollbar primitives, retained from the legacy portal -> workspace base system. */
  --scrollbar-size: 14px;
  --scrollbar-pad: 4px;
  --scrollbar-pad-hover: 3px;
  --scrollbar-track: var(--ui-bg);
  --scrollbar-rail: color-mix(in srgb, var(--ui-border) 62%, transparent);
  --scrollbar-thumb: color-mix(in srgb, var(--ui-text-muted) 36%, transparent);
  --scrollbar-thumb-hover: color-mix(in srgb, var(--ui-text-muted) 52%, transparent);
  --scrollbar-thumb-active: color-mix(in srgb, var(--ui-text-muted) 66%, transparent);
  /* Compatibility aliases. Old screens and new primitives consume the same
     semantic values while the codebase is consolidated. */
  --bg: var(--ui-bg);
  --surface: var(--ui-surface);
  --text: var(--ui-text);
  --muted: var(--ui-text-muted);
  --border: var(--ui-border);
  --accent: var(--ui-accent);
  --accent-soft: var(--ui-accent-soft);
  --danger: var(--ui-danger);
  --success: var(--ui-success);
}

* {
  box-sizing: border-box;
}

html {
  scrollbar-gutter: stable;
}

@supports not selector(::-webkit-scrollbar) {
  * {
    scrollbar-width: thin;
    scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
  }
}

::-webkit-scrollbar {
  width: var(--scrollbar-size);
  height: var(--scrollbar-size);
  background-color: var(--ui-bg);
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-rail);
  border: calc(var(--scrollbar-pad) + 1px) solid transparent;
  background-clip: padding-box;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb {
  min-width: 42px;
  min-height: 42px;
  background: var(--scrollbar-thumb);
  background-clip: padding-box;
  border: var(--scrollbar-pad) solid transparent;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--scrollbar-thumb-hover);
  background-clip: padding-box;
  border-width: var(--scrollbar-pad-hover);
}

::-webkit-scrollbar-thumb:active {
  background: var(--scrollbar-thumb-active);
  background-clip: padding-box;
  border-width: var(--scrollbar-pad-hover);
}

::-webkit-scrollbar-corner {
  background-color: var(--ui-bg);
}

::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

[data-scroll="compact"] {
  --scrollbar-size: 10px;
  --scrollbar-pad: 3px;
  --scrollbar-pad-hover: 2px;
}

html,
body {
  margin: 0;
  min-height: 100%;
  font-family: var(--font);
  font-size: var(--font-md);
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

body {
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection {
  background: var(--ui-accent-soft);
  color: var(--ui-text);
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

button,
a,
input,
select,
textarea {
  touch-action: manipulation;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

button {
  cursor: pointer;
}

button:disabled {
  cursor: default;
  opacity: 0.6;
}

button:focus-visible,
a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 1px solid color-mix(in srgb, var(--ui-focus, var(--accent)) 55%, transparent);
  outline-offset: 1px;
}

[hidden] {
  display: none !important;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: var(--font-xl);
  line-height: 1.25;
  font-weight: var(--weight-bold);
  letter-spacing: -0.03em;
}

h2 {
  font-size: var(--font-lg);
  font-weight: var(--weight-bold);
}

h3 {
  font-size: var(--font-md);
  font-weight: var(--weight-bold);
}

.muted {
  color: var(--muted);
  font-size: var(--font-sm);
}

.eyebrow {
  color: var(--accent);
  font-size: var(--font-xs);
  font-weight: var(--weight-bold);
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.icon {
  display: block;
  width: 20px;
  height: 20px;
  flex: none;
  align-self: center;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
  vertical-align: middle;
}

.brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--text);
  font-weight: var(--weight-bold);
  min-width: 0;
}

.brand > span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.brand-logo {
  width: 40px;
  height: 40px;
  object-fit: contain;
  border: 0;
  padding: 0;
  background: transparent;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 22px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  max-width: 50%;
  flex-shrink: 0;
}

.profile-nav-link {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  white-space: nowrap;
}

.profile-nav-avatar {
  flex: none;
  width: 1.875rem;
  height: 1.875rem;
  overflow: hidden;
  border: 1px solid var(--ui-border);
  border-radius: 50%;
  background: var(--ui-surface-subtle);
  object-fit: cover;
}

.icon-button {
  display: grid;
  place-items: center;
  min-width: 44px;
  height: 44px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
}

.mobile-menu {
  display: none;
}

.nav-group {
  font-size: var(--font-xs);
  color: var(--muted);
  margin: var(--space-3) var(--space-3) var(--space-2);
  letter-spacing: 0.04em;
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: var(--space-2);
  font-size: var(--font-xs);
  color: var(--muted);
}

.page-header p {
  margin-top: var(--space-2);
  max-width: 680px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  margin-bottom: var(--space-4);
}

.grid {
  display: grid;
}

.stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}

.amount,
.money {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.money-display {
  display: inline-flex;
  align-items: baseline;
  font-family: var(--font-mono);
  line-height: 1;
}

.money-secondary {
  display: inline-block;
  font-size: 0.8em;
  opacity: 0.8;
}

.money-decimal {
  font-weight: var(--weight-normal);
}

.currency,
.money-currency {
  font-family: var(--font);
  font-size: 0.8em;
  font-weight: var(--weight-medium);
  color: var(--muted);
  margin-inline-start: var(--space-1);
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}

.toolbar .field-group {
  flex: 1;
  min-width: 180px;
  max-width: 320px;
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  min-width: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--space-4);
}

.form-grid .full {
  grid-column: 1/-1;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: var(--space-2);
  margin-top: var(--space-5);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border);
}

.checkbox {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 44px;
  font-size: var(--font-sm);
}

.checkbox input {
  width: 18px;
  height: 18px;
  accent-color: var(--accent);
}

.empty {
  padding: var(--space-6);
  text-align: center;
  color: var(--muted);
  font-size: var(--font-sm);
}

.empty h3 {
  color: var(--text);
  margin-bottom: var(--space-2);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-sm);
}

th,
td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

tr:last-child td {
  border-bottom: 0;
}

.numeric {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.row-primary {
  font-weight: var(--weight-medium);
  color: var(--text);
}

.row-secondary {
  font-size: var(--font-xs);
  color: var(--muted);
  margin-top: 2px;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-top: var(--space-4);
  font-size: var(--font-xs);
  color: var(--muted);
}

.toast {
  position: fixed;
  bottom: var(--space-5);
  right: var(--space-5);
  max-width: min(420px, calc(100vw - 32px));
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  padding: var(--space-4) var(--space-5);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  z-index: 60;
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.toast[data-tone="success"] {
  border-color: var(--ui-success-border);
  background: var(--ui-success-soft);
  color: var(--ui-success);
}

.toast[data-tone="warning"] {
  border-color: var(--ui-warning-border);
  background: var(--ui-warning-soft);
  color: var(--ui-warning);
}

.toast[data-tone="danger"],
.toast[data-tone="error"] {
  border-color: var(--ui-danger-border);
  background: var(--ui-danger-soft);
  color: var(--ui-danger);
}

.toast[data-tone="info"] {
  border-color: var(--ui-info-border);
  background: var(--ui-info-soft);
  color: var(--ui-info);
}

.loading {
  padding: var(--space-6);
  color: var(--muted);
}

.auth-card form {
  display: grid;
  gap: var(--space-4);
  margin-top: var(--space-5);
}

.skip-link {
  position: fixed;
  top: -100px;
  left: var(--space-4);
  z-index: 100;
  background: var(--surface);
  padding: var(--space-3);
}

.skip-link:focus {
  top: var(--space-3);
}

.line-items {
  display: grid;
  gap: var(--space-3);
}

.line-item {
  display: grid;
  grid-template-columns: minmax(160px, 2fr) repeat(3, minmax(80px, 1fr)) 44px;
  gap: var(--space-3);
  align-items: end;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.line-item.custom-line {
  background: var(--bg);
}

.totals {
  margin-left: auto;
  max-width: 380px;
  display: grid;
  gap: var(--space-2);
  margin-top: var(--space-5);
}

.total-row {
  display: flex;
  justify-content: space-between;
  gap: var(--space-4);
  font-size: var(--font-sm);
}

.total-row:last-child {
  border-top: 1px solid var(--border);
  padding-top: var(--space-3);
  font-weight: var(--weight-bold);
}

.combobox {
  anchor-scope: --choice;
}

.combo-anchor {
  anchor-name: --choice;
  text-align: left;
  justify-content: space-between;
  font-weight: var(--weight-normal);
}

.combo-panel .field {
  margin-bottom: var(--space-2);
}

.combo-empty {
  padding: var(--space-3);
  color: var(--muted);
  font-size: var(--font-sm);
}

.document-tools {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-4);
}

.document-scroll {
  overflow: auto;
  padding: var(--space-3);
  background: var(--bg);
}

.document {
  width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  padding: 18mm;
  background: white;
  color: #222;
  font-size: 12px;
  box-shadow: 0 2px 10px #00000010;
}

.document-brand {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  border-bottom: 1px solid #ddd;
  padding-bottom: 20px;
  margin-bottom: 20px;
}

.document-logo {
  max-width: 120px;
  max-height: 70px;
  object-fit: contain;
  padding: 0;
  border: 0;
  background: transparent;
}

.document h1 {
  font-size: 24px;
}

.document h2 {
  font-size: 16px;
}

.document table {
  font-size: 11px;
  margin-top: 20px;
}

.document th,
.document td {
  padding: 8px;
}

.document-summary {
  margin-top: 20px;
  display: grid;
  gap: 6px;
  max-width: 320px;
  margin-left: auto;
}

.signatures {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  margin-top: 45px;
  font-size: 11px;
}

.signature {
  padding-top: 20px;
  border-top: 1px solid #aaa;
}

.document-footer {
  margin-top: 30px;
  color: #555;
  font-size: 10px;
}

.share-text {
  white-space: pre-wrap;
  font-family: var(--font);
  font-size: var(--font-sm);
  padding: var(--space-4);
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
}

.notification {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-bottom: 1px solid var(--border);
}

.notification:last-child {
  border-bottom: 0;
}

.company-card {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}

.company-card .actions {
  margin-top: var(--space-2);
}

.sidebar-200 {
  --sidebar-width: 200px;
}

.sidebar-208 {
  --sidebar-width: 208px;
}

.sidebar-216 {
  --sidebar-width: 216px;
}

.sidebar-224 {
  --sidebar-width: 224px;
}

.sidebar-232 {
  --sidebar-width: 232px;
}

.sidebar-240 {
  --sidebar-width: 240px;
}

.sidebar-248 {
  --sidebar-width: 248px;
}

.sidebar-256 {
  --sidebar-width: 256px;
}

.sidebar-264 {
  --sidebar-width: 264px;
}

.sidebar-272 {
  --sidebar-width: 272px;
}

.sidebar-280 {
  --sidebar-width: 280px;
}

.sidebar-288 {
  --sidebar-width: 288px;
}

.sidebar-296 {
  --sidebar-width: 296px;
}

.sidebar-304 {
  --sidebar-width: 304px;
}

.sidebar-312 {
  --sidebar-width: 312px;
}

.sidebar-320 {
  --sidebar-width: 320px;
}

.sidebar-328 {
  --sidebar-width: 328px;
}

.sidebar-336 {
  --sidebar-width: 336px;
}

.sidebar-344 {
  --sidebar-width: 344px;
}

.sidebar-352 {
  --sidebar-width: 352px;
}

.sidebar-360 {
  --sidebar-width: 360px;
}

.sidebar-368 {
  --sidebar-width: 368px;
}

.sidebar-376 {
  --sidebar-width: 376px;
}

.sidebar-384 {
  --sidebar-width: 384px;
}

.sidebar-392 {
  --sidebar-width: 392px;
}

.sidebar-400 {
  --sidebar-width: 400px;
}
.combo-anchor::after {
  content: "⌄";
  float: right;
  color: var(--muted);
}

.form-grid + section,
.form-grid + .panel,
.form-grid + .line-items {
  margin-top: var(--space-5);
}

.document-summary .total-row {
  display: grid;
  grid-template-columns: minmax(110px, 1fr) minmax(0, 1fr);
  gap: 12px;
}

.document-summary .total-row > span:last-child {
  text-align: right;
}

html {
  background: var(--ui-bg);
  color-scheme: light;
}

body {
  background:
    radial-gradient(
      circle at 92% 0%,
      color-mix(in srgb, var(--ui-accent) 4%, transparent),
      transparent 26rem
    ),
    var(--ui-bg);
}

::selection {
  background: var(--ui-accent-soft);
  color: var(--ui-text);
}

.topbar,
.sidebar,
.panel,
.stat,
.table-wrap,
.combo-panel,
.toast,
.section-card,
.record-card {
  background: var(--ui-surface);
  border-color: var(--ui-border);
}

.topbar {
  height: var(--topbar-height);
  padding: 0 var(--space-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  position: fixed;
  inset: 0 0 auto;
  z-index: 30;
  box-shadow: 0 1px 0 rgb(0 0 0 / 0.015);
}

.sidebar {
  position: fixed;
  top: var(--topbar-height);
  bottom: 0;
  left: 0;
  width: var(--sidebar-width);
  background: var(--surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  z-index: 25;
  display: flex;
  flex-direction: column;
  padding: var(--space-3) var(--space-3);
  gap: var(--space-4);
}

.nav-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  min-height: var(--field-height);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  margin: 1px 0;
  transition:
    background-color 140ms ease,
    border-color 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.nav-link:hover {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.nav-link.active {
  color: var(--ui-accent-text);
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
}

.nav-link:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
}

#main {
  margin: var(--topbar-height) 0 0 var(--sidebar-width);
  max-width: calc(var(--page-width) + var(--sidebar-width));
  min-height: calc(100vh - var(--topbar-height));
  outline: none;
  padding: var(--space-7);
}


body[data-surface="platform"] .sidebar,
body[data-surface="platform"] .mobile-menu {
  display: none;
}

body[data-surface="platform"] #main {
  margin-left: 0;
  max-width: var(--page-width);
}

.page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-5);
  position: relative;
  padding: var(--space-5);
  margin-bottom: var(--space-5);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(
      circle at 90% 8%,
      color-mix(in srgb, var(--ui-accent) 10%, transparent),
      transparent 30%
    ),
    linear-gradient(
      135deg,
      var(--ui-surface) 0%,
      var(--ui-surface-raised) 62%,
      var(--ui-accent-soft) 140%
    );
  box-shadow: var(--shadow);
}

.page-header > div:first-child {
  flex: 1 1 auto;
  min-width: 0;
}

.page-header h1,
.page-header p {
  overflow-wrap: anywhere;
}

.page-header h1 {
  font-size: var(--font-xl);
}

.page-header .eyebrow {
  margin-bottom: var(--space-1);
}

.page-header .actions {
  justify-content: flex-end;
  max-width: 100%;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  border: 1px solid var(--border);
  white-space: normal;
  min-height: var(--field-height);
  padding: 0.65rem var(--space-4);
  border-radius: var(--radius-sm);
  border-color: var(--ui-border-strong);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  line-height: 1.1;
  box-shadow: none;
  transition:
    background-color 150ms ease,
    border-color 150ms ease,
    color 150ms ease,
    box-shadow 150ms ease,
    transform 150ms ease;
}

.button:hover {
  border-color: var(--ui-accent-border);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.button.primary {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
  color: var(--ui-accent-text);
}

.button.primary:hover {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-border-hover);
  color: var(--ui-accent-text);
}

.button.subtle {
  background: transparent;
  border-color: transparent;
  color: var(--ui-text-muted);
}

.button.subtle:hover {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.button.danger {
  background: var(--ui-danger-soft);
  border-color: color-mix(in srgb, var(--ui-danger) 30%, var(--ui-surface));
  color: var(--ui-danger);
}

.button:focus-visible,
.icon-button:focus-visible {
  outline: 2px solid var(--ui-focus);
  outline-offset: 2px;
  box-shadow: var(--focus-ring);
}

.panel,
.stat,
.section-card,
.record-card {
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  height: fit-content;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
  height: fit-content;
  padding: var(--space-5);
}

.panel:hover,
.stat:hover {
  box-shadow: var(--shadow-hover);
}

.stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  min-height: 96px;
  padding: var(--space-4);
  transition: box-shadow 150ms ease;
}

.stat .amount {
  font-weight: var(--weight-bold);
  margin: var(--space-2) 0;
  letter-spacing: -0.03em;
  font-size: var(--font-amount);
}

.field,
.combo-anchor {
  width: 100%;
  min-height: var(--field-height);
  height: var(--field-height);
  padding: 0.62rem var(--space-3);
  border: 1px solid var(--ui-border-strong);
  border-radius: var(--radius-sm);
  background: var(--ui-surface);
  color: var(--ui-text);
  font-size: var(--font-sm);
  line-height: 1.25rem;
  outline: none;
  box-shadow: none;
  transition:
    border-color 150ms ease,
    box-shadow 150ms ease,
    background-color 150ms ease;
}

.field:hover,
.combo-anchor:hover {
  border-color: var(--ui-accent-border);
}

.field:focus,
.field:focus-visible,
.combo-anchor:focus-visible {
  border-color: var(--ui-focus);
  box-shadow: var(--focus-ring);
  outline: none;
}

.field:disabled,
.field[readonly] {
  background: var(--ui-surface-subtle);
  color: var(--ui-text-muted);
  -webkit-text-fill-color: var(--ui-text-muted);
  border-color: var(--ui-border);
  opacity: 1;
}

textarea.field {
  resize: vertical;
  height: auto;
  min-height: 112px;
  line-height: 1.5;
}


/* Universal form-control semantics. All ordinary surfaces use the same
   metrics even when a feature needs a semantic date/time/number/currency
   control instead of a plain text field. */
.field:is(
  .field-number,
  .field-currency,
  .field-date,
  .field-time,
  .field-month,
  [type="number"],
  [type="date"],
  [type="time"],
  [type="month"]
) {
  font-variant-numeric: tabular-nums;
}

.field:is([type="date"], [type="time"], [type="month"]) {
  color-scheme: light;
}

.currency-input {
  position: relative;
  min-width: 0;
}

.currency-input .field-currency {
  padding-inline-start: 4.2rem;
  padding-inline-end: 4.1rem;
}

.currency-input-code {
  position: absolute;
  top: 50%;
  right: var(--space-3);
  transform: translateY(-50%);
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
  pointer-events: none;
}

.currency-stepper {
  position: absolute;
  z-index: 1;
  left: 2px;
  top: 50%;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  transform: translateY(-50%);
}

.currency-stepper .button.currency-step {
  display: inline-grid;
  place-items: center;
  min-width: 1.75rem;
  width: 1.75rem;
  min-height: 1.9rem;
  height: 1.9rem;
  padding: 0;
  border-radius: var(--radius-sm);
  border-color: var(--ui-border);
  background: var(--ui-surface);
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
  box-shadow: none;
}

.currency-stepper .button.currency-step:hover:not(:disabled) {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-text);
}

.field-label {
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
}

.field-help {
  font-size: var(--font-xs);
  color: var(--ui-text-muted);
  line-height: 1.45;
}

.combo-panel {
  position: fixed;
  position-anchor: --choice;
  position-area: block-end span-inline-end;
  position-try-fallbacks: flip-block;
  inset: auto;
  margin: 4px 0;
  padding: var(--space-2);
  width: anchor-size(width);
  min-width: 200px;
  max-width: calc(100vw - 24px);
  max-height: min(320px, 45vh);
  border: 1px solid var(--border);
  background: var(--surface);
  overflow-y: auto;
  border-radius: var(--radius);
  box-shadow: var(--shadow-hover);
}

.combo-option {
  display: block;
  text-align: left;
  width: 100%;
  background: transparent;
  border: 0;
  padding: var(--space-2) var(--space-3);
  font-size: var(--font-sm);
  min-height: var(--field-height);
  border-radius: var(--radius-sm);
}

.combo-option:hover,
.combo-option:focus,
.combo-option[aria-selected="true"] {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  width: 100%;
  overflow: auto;
  border-radius: var(--radius);
  box-shadow: none;
}

th {
  font-weight: var(--weight-medium);
  text-align: left;
  font-size: var(--font-xs);
  background: var(--ui-surface-subtle);
  color: var(--ui-text-muted);
}

tbody tr {
  transition: background-color 120ms ease;
}

tbody tr:hover {
  background: color-mix(in srgb, var(--ui-accent) 3%, var(--ui-surface));
}

.notice {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: var(--space-4);
  font-size: var(--font-sm);
  margin-bottom: var(--space-4);
  border-color: var(--ui-border);
  background: var(--ui-surface-subtle);
}

.notice.error,
.notice.danger {
  border-color: var(--ui-danger-border);
  color: var(--ui-danger);
  background: var(--ui-danger-soft);
}

.notice.success {
  border-color: var(--ui-success-border);
  color: var(--ui-success);
  background: var(--ui-success-soft);
}

.notice.warning {
  border-color: var(--ui-warning-border);
  color: var(--ui-warning);
  background: var(--ui-warning-soft);
}

.notice.info {
  border-color: var(--ui-info-border);
  color: var(--ui-info);
  background: var(--ui-info-soft);
}

/* Deployment fault banner: request security cannot be signed, so every
   mutation is blocked and re-authenticating cannot help. Pinned to the
   viewport because page renders replace #main, which would otherwise drop the
   only explanation the operator has. */
.notice.request-security-outage {
  position: fixed;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 200;
  margin: 0;
  border-width: 1px 0 0;
  border-radius: 0;
  padding: var(--space-3) var(--space-4);
  box-shadow: 0 -2px 12px rgb(0 0 0 / 12%);
}

.notice.request-security-outage strong {
  display: block;
  margin-bottom: 2px;
}

.pill {
  display: inline-flex;
  padding: 3px 9px;
  border-radius: 20px;
  font-size: var(--font-xs);
  white-space: nowrap;
  border: 1px solid var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
  font-weight: var(--weight-semibold);
}

/* Shared tab primitive for personal, company and administrative detail pages. */

.page-tabs {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  padding: 0 0 var(--space-2);
  margin: 0 0 var(--space-4);
  scrollbar-width: thin;
}

.page-tab {
  flex: none;
  min-height: var(--field-height);
  display: inline-flex;
  align-items: center;
  padding: 0.5rem var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-semibold);
  white-space: nowrap;
}

.page-tab:hover {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.page-tab.active {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}

/* Reusable record/detail card derived from the strongest legacy portal profile
   composition, rebuilt on the universal token system. */

.record-card {
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.record-card-head {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  padding: var(--space-5);
  background:
    radial-gradient(
      circle at 100% 0%,
      color-mix(in srgb, var(--ui-accent) 8%, transparent),
      transparent 38%
    ),
    var(--ui-surface);
}

.record-card-ident {
  min-width: 0;
  flex: 1;
}

.record-card-kind {
  min-height: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
}

.record-card-title {
  margin: 0;
  font-size: var(--font-record-title);
  line-height: 1.25;
  overflow-wrap: anywhere;
}

.record-card-subtitle {
  margin-top: var(--space-1);
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
  overflow-wrap: anywhere;
}

.record-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  justify-content: flex-end;
}

.record-card-body {
  border-top: 1px solid var(--ui-border);
  padding: var(--space-5);
}

.record-avatar {
  width: 72px;
  height: 72px;
  flex: none;
  display: grid;
  place-items: center;
  border: 1px solid var(--ui-accent-border);
  border-radius: 18px;
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
  font-size: 1.55rem;
  font-weight: var(--weight-bold);
}

.record-avatar.image {
  object-fit: cover;
  padding: 0;
  background: var(--ui-surface-subtle);
}

.company-brand-media {
  min-height: 112px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.company-brand-preview,
.company-brand-placeholder {
  width: min(220px, 100%);
  height: 92px;
  border: 0;
  border-radius: 0;
  background: transparent;
}

.company-brand-preview {
  object-fit: contain;
}

.company-brand-placeholder {
  display: grid;
  place-items: center;
  background: transparent;
  color: var(--ui-text-muted);
  font-size: 2rem;
  font-weight: var(--weight-bold);
}

.company-logo-avatar {
  object-fit: contain;
  background: transparent;
}

.detail-rows {
  margin: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  column-gap: var(--space-6);
}

.detail-row {
  min-width: 0;
  display: grid;
  grid-template-columns: minmax(8rem, 0.8fr) minmax(0, 1.2fr);
  gap: var(--space-3);
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--ui-border);
}

.detail-row dt {
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
}

.detail-row dd {
  margin: 0;
  min-width: 0;
  color: var(--ui-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  overflow-wrap: anywhere;
}

.section-card {
  overflow: hidden;
  margin-bottom: var(--space-5);
}

.section-card-head {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--ui-border);
  background: linear-gradient(
    180deg,
    var(--ui-surface),
    var(--ui-surface-subtle)
  );
}

.section-card-head h2 {
  font-size: var(--font-md);
}

.section-card-head p {
  margin-top: var(--space-1);
}

.section-card-body {
  padding: var(--space-5);
}

.section-card-body > * + * {
  margin-top: var(--space-4);
}

/* Platform landing and authentication surfaces.
   These retain the original portal composition while consuming this
   repository's shared tokens and controls. */

.topbar-home {
  display: none;
  align-items: center;
  min-height: var(--field-height);
  padding-inline: var(--space-3);
  border-radius: var(--radius);
  color: var(--muted);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}

.topbar-home:hover {
  color: var(--text);
  background: var(--ui-accent-soft);
}

/* The platform root is a real landing page. It deliberately has no workspace
   sidebar and does not redirect merely because a visitor is signed out. */
body[data-surface="landing"] #sidebar {
  display: none;
}

body[data-surface="landing"] .mobile-menu {
  display: none;
}

body[data-surface="landing"] .topbar {
  padding-inline: max(var(--space-4), calc((100vw - 72rem) / 2));
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
  backdrop-filter: blur(14px) saturate(1.25);
  -webkit-backdrop-filter: blur(14px) saturate(1.25);
}

body[data-surface="landing"] .topbar-home {
  display: none;
}

body[data-surface="landing"] .topbar-actions {
  max-width: none;
}

body[data-surface="landing"] .topbar-actions .button {
  min-height: 40px;
}


body[data-surface="landing"] .brand {
  min-width: 44px;
  gap: 0;
}

body[data-surface="landing"] .brand-logo {
  width: 36px;
  height: 36px;
}

.landing-profile-link {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding-inline: var(--space-3);
  border-radius: var(--radius);
  color: var(--ui-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
  text-decoration: none;
}

.landing-profile-link:hover,
.landing-profile-link[aria-current="page"] {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}

.platform-account-menu {
  position: relative;
}

.platform-account-menu > summary {
  list-style: none;
}

.platform-account-menu > summary::-webkit-details-marker {
  display: none;
}

.platform-account-trigger {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  background: var(--ui-surface);
  cursor: pointer;
  overflow: hidden;
}

.platform-account-trigger:hover,
.platform-account-menu[open] .platform-account-trigger {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
}

.platform-account-avatar-image,
.platform-account-avatar-fallback {
  width: 100%;
  height: 100%;
  border-radius: inherit;
}

.platform-account-avatar-image {
  display: block;
  object-fit: cover;
}

.platform-account-avatar-fallback {
  display: grid;
  place-items: center;
  color: var(--ui-accent-text);
  background: var(--ui-accent-soft);
  font-weight: var(--weight-semibold);
}

.platform-account-panel {
  position: absolute;
  top: calc(100% + var(--space-2));
  right: 0;
  z-index: 80;
  width: min(18rem, calc(100vw - 2rem));
  padding: var(--space-2);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  background: var(--ui-surface);
  box-shadow: var(--shadow-hover);
}

.platform-account-email {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  overflow: hidden;
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.platform-account-panel a,
.platform-account-panel button {
  display: flex;
  align-items: center;
  width: 100%;
  min-height: 40px;
  padding: var(--space-2) var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ui-text);
  font: inherit;
  font-size: var(--font-sm);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}

.platform-account-panel a:hover,
.platform-account-panel button:hover {
  background: var(--ui-surface-subtle);
}

body[data-surface="landing"] #main {
  width: 100%;
  max-width: none;
  min-height: calc(100vh - var(--topbar-height));
  min-height: calc(100dvh - var(--topbar-height));
  margin-left: 0;
  padding: 2rem 1rem;
  display: grid;
  align-content: center;
  justify-items: center;
}

body[data-surface="landing"] .front {
  width: min(72rem, 100%);
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(18rem, 0.9fr);
  grid-template-areas:
    "title points"
    "lead points"
    "actions points";
  align-items: center;
  column-gap: clamp(2rem, 6vw, 5.5rem);
  row-gap: var(--space-4);
}

body[data-surface="landing"] .front h1 {
  grid-area: title;
  margin: 0;
  max-width: 12ch;
  font-size: clamp(2.25rem, 5vw, 3.75rem);
  line-height: 1.04;
  letter-spacing: -0.045em;
  text-wrap: balance;
}

body[data-surface="landing"] .front > p:not(.front-actions) {
  grid-area: lead;
  max-width: 58ch;
  font-size: clamp(1rem, 1.4vw, 1.125rem);
  line-height: 1.65;
  color: var(--muted);
}

body[data-surface="landing"] .front > ul {
  grid-area: points;
  display: grid;
  gap: var(--space-3);
  margin: 0;
  padding: var(--space-5);
  list-style: none;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background:
    linear-gradient(145deg, var(--ui-surface) 15%, var(--ui-surface-subtle) 100%);
  box-shadow: var(--shadow-hover);
}

body[data-surface="landing"] .front > ul > li {
  display: grid;
  grid-template-columns: 1.5rem minmax(0, 1fr);
  align-items: start;
  gap: var(--space-3);
  padding: var(--space-3) 0;
  color: var(--ui-text-muted);
  line-height: 1.55;
}

body[data-surface="landing"] .front > ul > li + li {
  border-top: 1px solid var(--ui-border);
}

body[data-surface="landing"] .front > ul > li::before {
  content: "";
  width: 0.75rem;
  height: 0.75rem;
  margin: 0.4rem 0.25rem 0;
  border-radius: 50%;
  background: var(--ui-accent);
  box-shadow: 0 0 0 0.25rem var(--ui-accent-soft);
}

body[data-surface="landing"] .front-actions {
  grid-area: actions;
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
}

body[data-surface="landing"] .front-actions .button {
  min-height: 48px;
  padding-inline: 1.25rem;
  border-radius: 999px;
  box-shadow: 0 5px 14px color-mix(in srgb, var(--ui-accent) 16%, transparent);
}

@media (max-width: 52rem) {
  body[data-surface="landing"] .front {
    width: min(44rem, 100%);
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas:
      "title"
      "lead"
      "points"
      "actions";
    gap: var(--space-4);
  }

  body[data-surface="landing"] .front > h1 {
    max-width: 15ch;
  }

  body[data-surface="landing"] .front > ul {
    padding: var(--space-3) var(--space-4);
  }
}

/* Central platform authentication.
   DOM and responsive composition intentionally match the proven portal auth
   layout: .auth-head and .auth-card are direct siblings inside #main. */
body.auth {
  min-height: 100vh;
  min-height: 100dvh;
  padding: 0;
  overflow-x: hidden;
  background: linear-gradient(180deg, #ffe9e5 0%, #ffffff 100%);
}

body.auth #main {
  --auth-width: 35rem;
  --auth-font-xs: clamp(0.875rem, 0.86rem + 0.09vw, 0.9375rem);
  --auth-font-sm: clamp(0.9375rem, 0.92rem + 0.11vw, 1rem);
  position: relative;
  isolation: isolate;
  display: grid;
  place-items: center;
  align-content: center;
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: clamp(1rem, 3vh, 2rem) clamp(0.75rem, 2vw, 1.25rem);
  gap: clamp(0.75rem, 2vw, 1.5rem);
}

body.auth #main::after {
  content: "";
  position: absolute;
  inset: 0;
  margin: auto;
  z-index: -1;
  width: min(34rem, 92vw);
  height: min(34rem, 92vh);
  border-radius: 50%;
  background: radial-gradient(
    circle at 50% 50%,
    color-mix(in srgb, var(--ui-accent) 30%, transparent),
    color-mix(in srgb, var(--ui-accent) 10%, transparent) 46%,
    transparent 70%
  );
  filter: blur(46px);
  opacity: 0.6;
  pointer-events: none;
}

.auth-head {
  width: min(100%, var(--auth-width));
  max-width: var(--auth-width);
  margin-bottom: 0;
  text-align: center;
}

.auth-mark {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}

.auth-mark-image {
  width: 3rem;
  height: 3rem;
  flex: none;
  object-fit: contain;
}

.auth-mark h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
  letter-spacing: -0.025em;
  text-wrap: balance;
}

.auth-lead {
  margin: var(--space-2) auto 0;
  max-width: var(--auth-width);
  color: var(--ui-text-muted);
  font-size: var(--auth-font-sm);
  line-height: 1.45;
  text-wrap: pretty;
}

.auth-steps {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin: 0 0 1.5rem;
  padding: 0;
  list-style: none;
}

.auth-steps > li {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin: 0;
  color: var(--ui-text-soft);
  font-size: var(--auth-font-xs);
  letter-spacing: 0.01em;
}

.auth-steps > li::before {
  content: "";
  width: 0.5rem;
  height: 0.5rem;
  flex: none;
  border-radius: 999px;
  background: var(--ui-border-strong);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, #fff 65%, transparent);
}

.auth-steps > li:not(:last-child)::after {
  content: "";
  width: var(--space-4);
  height: 1px;
  margin-inline-start: var(--space-1);
  background: color-mix(in srgb, var(--ui-border-strong) 55%, transparent);
}

.auth-steps > li[data-state="done"] {
  color: var(--ui-accent-text);
}

.auth-steps > li[data-state="done"]::before,
.auth-steps > li[data-state="current"]::before {
  background: var(--ui-accent);
}

.auth-steps > li[data-state="done"]::after {
  background: color-mix(in srgb, var(--ui-accent) 45%, transparent);
}

.auth-steps > li[data-state="current"] {
  color: var(--ui-text);
  font-weight: var(--weight-semibold);
}

.auth-steps > li[data-state="current"]::before {
  box-shadow: 0 0 0 3px var(--ui-accent-soft);
}

.auth-card {
  position: relative;
  width: min(100%, var(--auth-width));
  max-width: var(--auth-width);
  padding: clamp(1.1rem, 2.2vw, 1.5rem);
  background: linear-gradient(
    165deg,
    color-mix(in srgb, #fff 88%, transparent) 0%,
    color-mix(in srgb, #fff 62%, transparent) 54%,
    color-mix(in srgb, var(--ui-surface-subtle) 76%, transparent) 100%
  );
  border: 1px solid color-mix(in srgb, #fff 72%, var(--ui-accent-border));
  border-radius: var(--radius-lg);
  box-shadow: color-mix(in srgb, var(--ui-accent) 8%, transparent) 0 7px 29px 0;
  backdrop-filter: blur(22px) saturate(1.7);
  -webkit-backdrop-filter: blur(22px) saturate(1.7);
}

.auth-card::before {
  content: "";
  position: absolute;
  inset-block-start: 0;
  inset-inline: 14%;
  height: 1px;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    transparent,
    color-mix(in srgb, #fff 92%, transparent),
    transparent
  );
}

.auth-card > :first-child {
  margin-top: 0;
}

.auth-card > :last-child {
  margin-bottom: 0;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
  margin: 0;
}

.auth-form > * {
  margin-block: 0;
}

.auth-form .field-group {
  gap: var(--space-1);
}

.auth-form .field {
  height: 48px;
  min-height: 48px;
  line-height: 46px;
  background: color-mix(in srgb, #fff 68%, transparent);
  border-color: color-mix(in srgb, var(--ui-accent) 16%, var(--ui-border-strong));
}

.auth-form .field:hover {
  border-color: var(--ui-accent-border-hover);
}

.auth-form .field:focus,
.auth-form .field:focus-visible {
  background: var(--ui-surface);
}

.field-password,
.company-password {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding-inline-end: var(--space-1);
  background: color-mix(in srgb, #fff 68%, transparent);
  border: 1px solid color-mix(in srgb, var(--ui-accent) 16%, var(--ui-border-strong));
  border-radius: var(--radius-sm);
  box-shadow: inset 0 1px 2px rgb(56 15 11 / 0.035);
}

.field-password:hover:not(:has(input:disabled)),
.company-password:hover:not(:has(input:disabled)) {
  border-color: var(--ui-accent-border-hover);
}

.field-password:focus-within,
.company-password:focus-within {
  border-color: var(--ui-accent);
  background: var(--ui-surface);
  box-shadow: var(--focus-ring);
}

.auth-form .field-password > input,
.auth-form .company-password > input {
  flex: 1 1 auto;
  min-width: 0;
  height: 48px;
  min-height: 48px;
  line-height: 46px;
  background: none;
  border: 0;
  border-radius: var(--radius-sm) 0 0 var(--radius-sm);
  box-shadow: none;
}

.auth-form .field-password > input:focus,
.auth-form .company-password > input:focus {
  background: none;
  border: 0;
  box-shadow: none;
  outline: 0;
}

.reveal {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.85rem;
  height: 1.85rem;
  min-height: 0;
  padding: 0;
  background: none;
  border: 0;
  border-radius: var(--radius-sm);
  box-shadow: none;
  color: var(--ui-text-soft);
  cursor: pointer;
}

.reveal .icon {
  display: block;
  width: 1.1rem;
  height: 1.1rem;
}

.reveal:hover {
  background: var(--ui-accent-soft);
  color: var(--ui-text);
}

.reveal:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: 1px;
}

/* Keep Chrome/Safari credential paint inside the same field treatment. */
.auth-form input.field:-webkit-autofill,
.auth-form input.field:-webkit-autofill:hover,
.auth-form input.field:-webkit-autofill:focus,
.auth-form .field-password > input.field:-webkit-autofill,
.auth-form .company-password > input.field:-webkit-autofill,
.auth-form input.field:autofill,
.auth-form .field-password > input.field:autofill,
.auth-form .company-password > input.field:autofill,
.code-field:-webkit-autofill,
.code-field:autofill {
  -webkit-text-fill-color: var(--ui-text);
  caret-color: var(--ui-text);
  -webkit-box-shadow: 0 0 0 100px color-mix(in srgb, #fff 88%, var(--ui-surface-subtle)) inset;
  box-shadow: 0 0 0 100px color-mix(in srgb, #fff 88%, var(--ui-surface-subtle)) inset;
}

.auth-submit {
  width: 100%;
  min-height: 48px;
}

.auth-submit > .icon {
  display: block;
  width: 1rem;
  height: 1rem;
  align-self: center;
}

.auth-identity {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin: 0 0 var(--space-4);
  padding: var(--space-3);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-sm);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
  font-size: var(--font-sm);
}

.auth-identity > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.auth-identity > a {
  flex: none;
  color: var(--ui-text-muted);
  font-weight: var(--weight-medium);
}

.auth-alt {
  margin: var(--space-4) 0 0;
  color: var(--ui-text-muted);
  font-size: var(--auth-font-sm);
  text-align: center;
}

.auth-alt a,
.auth-alt a:visited {
  color: inherit;
  font-weight: var(--weight-medium);
  text-decoration-color: var(--ui-accent-border);
  text-underline-offset: 0.15em;
}

.auth-alt a:hover,
.auth-alt a:visited:hover {
  color: var(--ui-accent-text);
  text-decoration-color: currentColor;
}

.auth-resend-row {
  display: flex;
  justify-content: center;
}

.auth-resend {
  min-height: auto;
  padding: var(--space-1) var(--space-2);
}

.auth-feedback {
  margin: 0;
}

.code-field {
  width: 100%;
  height: 48px;
  padding-inline: var(--space-3);
  font-family: var(--font-mono);
  font-size: var(--font-xl);
  font-variant-numeric: tabular-nums;
  font-weight: var(--weight-semibold);
  text-align: center;
  letter-spacing: 0.24em;
  text-indent: 0.24em;
}

/* Company operational authentication: directly converged from workspace's proven
   LoginScreen and shared field/control language. */
body.company-auth {
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(
      circle at 50% 0%,
      color-mix(in srgb, var(--ui-accent) 9%, transparent),
      transparent 34rem
    ),
    linear-gradient(180deg, var(--ui-surface) 0%, var(--ui-surface-subtle) 100%);
}

body.company-auth #main {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: var(--space-4);
  display: flex;
  align-items: center;
  justify-content: center;
}

.company-auth-card {
  width: min(24rem, 100%);
  padding: var(--space-6);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  background: color-mix(in srgb, var(--ui-surface) 96%, transparent);
  box-shadow: var(--brand-workspace-shadow, var(--shadow-hover));
}

.company-auth-brand {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-6);
}

.company-auth-mark {
  width: 2.75rem;
  height: 2.75rem;
  flex: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
  border: 1px solid var(--ui-accent-border);
  border-radius: var(--radius-sm);
  padding: 0.35rem;
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
  font-weight: var(--weight-bold);
}

.company-auth-mark-image {
  border: 0;
  border-radius: 0;
  padding: 0;
  background: transparent;
}

.company-auth-mark-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.company-auth-brand > div {
  min-width: 0;
}

.company-auth-brand h1 {
  margin: 0;
  color: var(--ui-text);
  font-size: 1.25rem;
  font-weight: var(--weight-bold);
  line-height: 1.2;
}

.company-auth-brand p {
  margin: var(--space-1) 0 0;
  overflow: hidden;
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.company-auth-brand .company-local-name {
  color: var(--ui-text-soft);
  font-family: "Noto Sans Arabic", Tahoma, "Segoe UI", Arial, sans-serif;
  font-size: 0.875rem;
  font-weight: var(--weight-semibold);
  line-height: 1.6;
  letter-spacing: 0;
  text-align: start;
  unicode-bidi: plaintext;
}

.company-auth-brand .company-brand-tagline {
  margin-top: 0.15rem;
}

.company-auth-form {
  gap: var(--space-4);
}

.company-auth-form .field-group {
  gap: var(--space-1);
}

.company-auth-form .auth-submit {
  min-height: var(--field-height);
}

.company-auth-foot {
  margin: var(--space-5) 0 0;
  color: var(--ui-text-soft);
  font-size: 0.6875rem;
  text-align: center;
}

body[data-surface="company-public"] .company-auth-card {
  width: min(26rem, 100%);
  display: grid;
  gap: var(--space-5);
}

body[data-surface="company-public"] .company-auth-brand {
  margin-bottom: 0;
}

body[data-surface="company-public"] .auth-lead {
  max-width: none;
  margin: 0;
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
  line-height: 1.55;
}

body[data-surface="company-public"] .front-actions {
  margin: 0;
}

body[data-surface="company-public"] .front-actions .button {
  width: 100%;
  min-height: var(--field-height);
  justify-content: center;
}

body[data-surface="company-public"] .button.primary {
  background: var(--brand-workspace-primary-bg, var(--ui-accent-soft));
  color: var(--brand-workspace-primary-text, var(--ui-accent-text));
}

body[data-surface="company-public"] .button.primary:hover {
  background: color-mix(
    in srgb,
    var(--brand-workspace-primary-bg, var(--ui-accent)) 88%,
    var(--ui-surface)
  );
  color: var(--brand-workspace-primary-text, var(--ui-accent-text));
}

@media (max-width: 32rem) {
  .company-auth-card {
    padding: var(--space-5);
  }
}

/* Date inputs and calendar panel: selectively ported from legacy portal/base so
   every date field shares one control instead of page-specific widgets. */
input[type="date"] {
  padding-inline-end: 2.4rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%236f6962' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3.5' y='5' width='17' height='15.5' rx='2'/%3E%3Cpath d='M3.5 9.5h17M8 3v4M16 3v4'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-size: 1.05rem;
  background-position: right 0.65rem center;
  cursor: pointer;
}

input[data-x-picker]::-webkit-calendar-picker-indicator {
  display: none;
}

input[type="date"]:not([data-x-picker])::-webkit-calendar-picker-indicator {
  width: 1.15rem;
  height: 1.15rem;
  margin: 0 -1.45rem 0 0;
  padding: 0;
  opacity: 0;
  cursor: pointer;
}

input[type="date"]:disabled {
  background-image: none;
}

::-webkit-datetime-edit,
::-webkit-datetime-edit-fields-wrapper {
  padding: 0;
}

::-webkit-datetime-edit-text {
  padding: 0 0.1em;
  color: var(--ui-text-soft);
}

::-webkit-datetime-edit-year-field,
::-webkit-datetime-edit-month-field,
::-webkit-datetime-edit-day-field {
  padding: 0 0.12em;
  border-radius: 0.2rem;
  color: var(--ui-text);
  caret-color: var(--ui-accent);
}

.x-pop {
  z-index: 120;
  border: 1px solid var(--ui-border);
  border-radius: var(--radius);
  background: var(--ui-surface);
  box-shadow: var(--shadow-hover);
  color: var(--ui-text);
}

.x-cal {
  --cell: 2.15rem;
  min-width: calc(var(--cell) * 7 + var(--space-3) * 2 + 6px);
  width: max-content;
  max-width: calc(100vw - 16px);
  padding: var(--space-3);
  border-radius: var(--radius-lg);
}

.x-cal-head {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: var(--space-1);
  margin-bottom: var(--space-2);
}

.x-cal-sel {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-1);
}

.x-cal-sel > select:first-child {
  flex: 1 1 auto;
}

.x-cal-sel > select + select {
  flex: 0 0 auto;
}

.x-cal-sel > select {
  appearance: none;
  -webkit-appearance: none;
  height: 1.9rem;
  min-height: 0;
  width: auto;
  min-width: 0;
  max-width: none;
  padding: 0 1.45rem 0 var(--space-2);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background-color: transparent;
  color: var(--ui-text);
  font-size: var(--font-sm);
  line-height: 1.9rem;
  cursor: pointer;
}

.x-cal-sel > select:hover {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
}

.x-cal-sel > select:focus {
  outline: 0;
  background: var(--ui-surface);
  border-color: var(--ui-accent);
}

.x-cal-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ui-accent-text);
  box-shadow: none;
}

.x-cal-nav::before {
  content: "";
  width: 0.5em;
  height: 0.5em;
  border-top: 2px solid currentColor;
  border-right: 2px solid currentColor;
}

.x-cal-nav[data-dir="prev"]::before {
  transform: rotate(-135deg);
  margin-left: 2px;
}

.x-cal-nav[data-dir="next"]::before {
  transform: rotate(45deg);
  margin-right: 2px;
}

.x-cal-nav:hover {
  background: var(--ui-accent-soft);
  border-color: var(--ui-accent-border);
}

.x-cal-grid {
  display: grid;
  grid-template-columns: repeat(7, var(--cell));
  gap: 1px;
}

.x-cal-dow {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 1.6rem;
  color: var(--ui-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.x-cal-day {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--cell);
  height: var(--cell);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: var(--radius-sm);
  background: none;
  box-shadow: none;
  color: var(--ui-text);
  font: inherit;
  font-size: var(--font-sm);
  font-variant-numeric: tabular-nums;
}

.x-cal-day:hover {
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}

.x-cal-day[data-outside] {
  color: var(--ui-text-soft);
}

.x-cal-day[data-weekend] {
  color: var(--ui-accent);
}

.x-cal-day[data-today] {
  font-weight: var(--weight-medium);
}

.x-cal-day[data-today]::after {
  content: "";
  position: absolute;
  bottom: 3px;
  left: 50%;
  width: 3px;
  height: 3px;
  translate: -50% 0;
  border-radius: 50%;
  background: var(--ui-accent);
}

.x-cal-day[data-selected] {
  background: var(--ui-accent);
  color: var(--ui-on-accent);
  font-weight: var(--weight-medium);
  box-shadow: var(--shadow);
}

.x-cal-day[data-selected]::after {
  background: var(--ui-on-accent);
}

.x-cal-day:focus-visible {
  outline: 2px solid var(--ui-accent);
  outline-offset: -2px;
}

.x-cal-day:disabled {
  color: color-mix(in srgb, var(--ui-text-soft) 55%, transparent);
  cursor: not-allowed;
  background: none;
}

.x-cal-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-top: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px solid var(--ui-border);
}

.x-cal-foot button {
  min-height: 1.75rem;
  padding-inline: var(--space-3);
  border: 1px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ui-text-muted);
  box-shadow: none;
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
}

.x-cal-foot button:hover {
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
}

.x-cal-foot button[data-accent] {
  color: var(--ui-accent-text);
  font-weight: var(--weight-semibold);
}

/* Human-facing 404s stay inside the same visual system instead of leaking
   the JSON API error envelope into a browser page. */
.not-found-shell #sidebar,
.not-found-shell .mobile-menu {
  display: none;
}

.not-found-shell #main {
  width: 100%;
  max-width: none;
  min-height: 100vh;
  min-height: 100dvh;
  margin: 0;
  padding: var(--space-6) var(--space-4);
  display: grid;
  place-items: center;
}

.not-found-card {
  width: min(30rem, 100%);
  padding: var(--space-6);
  text-align: center;
  background: var(--ui-surface);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hover);
}

.not-found-card h1 {
  margin: var(--space-2) 0;
  font-size: var(--font-xl);
}

.not-found-card p:not(.eyebrow) {
  margin: 0 0 var(--space-5);
  color: var(--muted);
  line-height: 1.55;
}

.not-found-card .eyebrow {
  margin: 0;
}

/* Surface-level composition only. Color/spacing still come from shared tokens. */

body[data-surface="super-admin"] .page-header,
body[data-surface="company-profile"] .page-header,
body[data-surface="personal-profile"] .page-header {
  background:
    radial-gradient(
      circle at 90% 8%,
      color-mix(in srgb, var(--ui-accent) 9%, transparent),
      transparent 30%
    ),
    linear-gradient(135deg, var(--ui-surface), var(--ui-surface-raised));
}

@media (max-width: 1100px) {
  .stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #main {
    padding: var(--space-5);
  }
  .grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 767px) {
  :root {
    --scrollbar-size: 10px;
    --scrollbar-pad: 2px;
  }
}

@media (max-width: 760px) {
  .mobile-menu {
    display: grid;
  }
  .topbar {
    padding: 0 var(--space-4);
  }
  .topbar .brand {
    font-size: var(--font-sm);
  }
  .brand-logo {
    width: 32px;
    height: 32px;
  }
  .sidebar {
    transform: translateX(-100%);
    width: 260px;
    box-shadow: var(--shadow);
  }
  .nav-open .sidebar {
    transform: none;
  }
  .page-header .actions {
    width: 100%;
  }
  .stats {
    gap: var(--space-3);
  }
  .stat {
    padding: var(--space-4);
  }
  .panel {
    padding: var(--space-4);
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .form-grid .full {
    grid-column: auto;
  }
  .line-item {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .line-item > .field-group:first-child {
    grid-column: 1/-1;
  }
  .toolbar .field-group {
    min-width: 0;
    max-width: none;
    width: 100%;
  }
  .topbar-actions .muted {
    display: none;
  }
  .pagination {
    flex-wrap: wrap;
  }
  .notification {
    gap: var(--space-3);
  }
  .document-scroll {
    padding: 0;
  }
  .document {
    margin: 0;
  }
  .sidebar-footer > label,
  .sidebar-footer > input {
    display: none;
  }
  #main {
    margin-left: 0;
    padding: var(--space-4);
  }
  .page-header {
    flex-direction: column;
    gap: var(--space-4);
    padding: var(--space-4);
    border-radius: var(--radius);
  }
  .page-header .actions,
  .record-card-actions {
    width: 100%;
    justify-content: flex-start;
  }
  .page-header .actions > *,
  .record-card-actions > * {
    flex: 1 1 auto;
    min-width: 0;
  }
  .record-card-head {
    flex-wrap: wrap;
    padding: var(--space-4);
  }
  .record-card-body,
  .section-card-body {
    padding: var(--space-4);
  }
  .section-card-head {
    padding: var(--space-4);
  }
  .record-avatar {
    width: 58px;
    height: 58px;
    border-radius: 14px;
  }
  .detail-rows {
    grid-template-columns: 1fr;
  }
  .detail-row {
    grid-template-columns: minmax(7.5rem, 0.8fr) minmax(0, 1.2fr);
  }
  .auth #main {
    width: 100%;
    padding: var(--space-4);
  }
  body:not(.auth) .auth-card {
    margin: var(--space-3) auto;
    padding: var(--space-4);
  }
}

@media (max-width: 700px) {
  body[data-surface="landing"] .topbar {
    gap: var(--space-2);
    padding-inline: var(--space-3);
  }

  body[data-surface="landing"] .topbar-actions {
    gap: var(--space-1);
  }

  body[data-surface="landing"] .topbar-actions .button {
    padding-inline: var(--space-3);
  }

}

@media (max-width: 32rem) {
  body[data-surface="landing"] .topbar .brand > span:last-child {
    display: none;
  }

  body[data-surface="landing"] .topbar .brand {
    gap: 0;
  }

  body[data-surface="landing"] #main {
    align-content: start;
    padding-top: var(--space-7);
  }

  .front h1 {
    font-size: clamp(1.7rem, 9vw, 2.15rem);
  }

  .front-actions > * {
    flex: 1 1 auto;
  }

  /* Exact narrow-screen auth behavior retained from legacy portal. */
  body.auth #main {
    place-items: stretch;
    align-content: center;
    padding: 1.5rem 1rem;
  }

  body.auth .auth-head,
  body.auth .auth-card {
    max-width: none;
  }

  body.auth .auth-card {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body.auth .auth-card::before {
    display: none;
  }

}

@media (max-width: 440px) {
  .detail-row {
    grid-template-columns: 1fr;
    gap: var(--space-1);
  }
  .stats {
    grid-template-columns: 1fr;
  }
}

@media print {
  @page {
    size: A4;
    margin: 0;
  }
  body,
  .document-scroll {
    background: white !important;
  }
  .topbar,
  .sidebar,
  .page-header,
  .document-tools,
  .toast,
  .skip-link {
    display: none !important;
  }
  #main {
    margin: 0;
    padding: 0;
    max-width: none;
  }
  .document-scroll {
    overflow: visible;
    padding: 0;
  }
  .document {
    box-shadow: none;
    width: 210mm;
    min-height: auto;
    margin: 0;
    break-after: page;
  }
  .document th {
    background: white;
  }
  thead {
    display: table-header-group;
  }
  tr {
    break-inside: avoid;
  }
  .signatures {
    break-inside: avoid;
  }
}


/* legacy portal profile composition: retained in the single shared stylesheet. */
.profile-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 28rem), 1fr));
  gap: var(--space-5);
  align-items: start;
}
.profile-card {
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: var(--space-2);
  background: color-mix(in srgb, var(--ui-surface) 94%, transparent);
  border: 1px solid var(--ui-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  color: var(--ui-text);
}
.profile-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(
    90deg,
    var(--ui-accent),
    color-mix(in srgb, var(--ui-accent) 34%, var(--ui-surface)) 72%,
    transparent
  );
}
.profile-card.is-empty {
  box-shadow: none;
  border-color: var(--ui-border-strong);
}
.profile-kind {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
  padding: var(--space-3) var(--space-4) 0;
}
.card-kind {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 3px var(--space-2);
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-text-muted);
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.card-kind > .icon {
  width: 0.9rem;
  height: 0.9rem;
}
.profile-badge {
  font-size: var(--font-xs);
}
.profile-open {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
  min-height: 34px;
  padding: var(--space-1) var(--space-3);
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent-border);
  border-radius: 999px;
  color: var(--ui-accent-text);
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
  text-decoration: none;
}
.profile-open:hover {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-border-hover);
}
.profile-open::after {
  content: "›";
  font-size: 1rem;
  line-height: 1;
}
.profile-main {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
}
.profile-avatar,
.company-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.5rem;
  height: 2.5rem;
  overflow: hidden;
  background: transparent;
  border: 0;
  border-radius: 0;
  color: var(--ui-accent-text);
  font-size: var(--font-lg);
  font-weight: var(--weight-semibold);
}
.company-mark {
  border-radius: 0;
}
.profile-avatar.avatar-xl,
.company-mark.company-mark-xl {
  width: 5.75rem;
  height: 5.75rem;
  font-size: 1.8rem;
  box-shadow: none;
}
.profile-avatar img,
.company-mark img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 0;
}
.profile-ident {
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: var(--space-1);
}
.profile-ident > p,
.profile-ident > span {
  margin: 0;
}
.profile-name {
  color: var(--ui-text);
  font-size: var(--font-xl);
  font-weight: var(--weight-semibold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  overflow-wrap: anywhere;
}
.profile-detail .profile-name {
  font-size: clamp(1.6rem, 3vw, 2rem);
}
.profile-name[data-empty="true"] {
  color: var(--ui-text-soft);
  font-weight: var(--weight-normal);
}
.profile-email,
.profile-meta,
.profile-bio {
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.profile-bio {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.profile-facts {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-start;
  gap: var(--space-2) var(--space-4);
  margin: 0 var(--space-4) var(--space-3);
  padding-top: var(--space-3);
  border-top: 1px solid var(--ui-border);
}
.profile-fact {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  color: var(--ui-text-muted);
  font-size: var(--font-sm);
}
.profile-fact > .icon {
  flex: none;
  width: 1rem;
  height: 1rem;
  color: var(--ui-accent);
}
.profile-fact-value {
  min-width: 0;
  overflow-wrap: anywhere;
}
.profile-tags {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2) var(--space-3);
  margin-top: auto;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--ui-border);
}
.profile-hobbies {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.profile-hobbies-label {
  color: var(--ui-text-soft);
  font-size: 0.72rem;
  font-weight: var(--weight-medium);
  letter-spacing: 0.055em;
  text-transform: uppercase;
}
.profile-status {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-inline-start: auto;
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
.profile-detail {
  max-width: 72rem;
  margin-inline: auto;
}
.profile-body {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: start;
  gap: var(--space-5);
  padding: var(--space-5);
}
.profile-section {
  min-width: 0;
}
.profile-section > h2 {
  margin: 0 0 var(--space-4);
  color: var(--ui-text);
  font-size: var(--font-lg);
  font-weight: var(--weight-semibold);
  line-height: 1.2;
}
.profile-list {
  display: flex;
  flex-direction: column;
  gap: var(--space-4);
}
.profile-field {
  min-width: 0;
}
.profile-value {
  display: flex;
  flex-direction: column;
  gap: var(--space-1);
}
.profile-value-label {
  color: var(--ui-text-soft);
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.profile-value-text {
  color: var(--ui-text);
  font-size: var(--font-md);
  line-height: 1.4;
  overflow-wrap: anywhere;
}
.profile-control {
  margin: 0;
}
.profile-editor[data-card-ready]:not([data-editing]) .profile-control,
.profile-editor[data-card-ready]:not([data-editing]) .profile-picture,
.profile-editor[data-card-ready]:not([data-editing]) .profile-buttons {
  display: none;
}
.profile-editor[data-editing] .profile-value {
  display: none;
}
.profile-editor[data-editing] .profile-edit {
  display: none;
}
.profile-picture {
  padding: 0 var(--space-5) var(--space-4);
}
.profile-picture .field-group {
  max-width: 34rem;
}
.profile-edit {
  flex: none;
  display: grid;
  place-items: center;
  margin-inline-start: auto;
  width: 2.75rem;
  height: 2.75rem;
  min-height: 0;
  padding: 0;
  background: var(--ui-accent-soft);
  border: 1px solid var(--ui-accent-border);
  border-radius: 999px;
  box-shadow: none;
  color: var(--ui-accent-text);
  cursor: pointer;
}
.profile-edit::before {
  content: "✎";
  font-size: 1rem;
  line-height: 1;
}
.profile-edit:hover {
  background: var(--ui-accent-hover);
  border-color: var(--ui-accent-border-hover);
}
.profile-foot {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: auto;
  padding: var(--space-4) var(--space-5);
  border-top: 1px solid var(--ui-border);
}
.profile-buttons {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  margin-inline-start: auto;
}
.meter {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.meter-ring {
  display: grid;
  place-items: center;
  min-width: 3.25rem;
  min-height: 3.25rem;
  padding: var(--space-1);
  background: conic-gradient(
    var(--ui-accent) var(--profile-progress, 0%),
    var(--ui-border) 0
  );
  border-radius: 50%;
}
.meter-ring.progress-0 { --profile-progress: 0%; }
.meter-ring.progress-10 { --profile-progress: 10%; }
.meter-ring.progress-20 { --profile-progress: 20%; }
.meter-ring.progress-30 { --profile-progress: 30%; }
.meter-ring.progress-40 { --profile-progress: 40%; }
.meter-ring.progress-50 { --profile-progress: 50%; }
.meter-ring.progress-60 { --profile-progress: 60%; }
.meter-ring.progress-70 { --profile-progress: 70%; }
.meter-ring.progress-80 { --profile-progress: 80%; }
.meter-ring.progress-90 { --profile-progress: 90%; }
.meter-ring.progress-100 { --profile-progress: 100%; }
.meter-percent {
  display: grid;
  place-items: center;
  width: 2.55rem;
  height: 2.55rem;
  background: var(--ui-surface);
  border-radius: 50%;
  color: var(--ui-text);
  font-size: var(--font-xs);
  font-weight: var(--weight-semibold);
}
.meter-note {
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
.place-code {
  display: inline-flex;
  max-width: 100%;
  padding: 2px var(--space-2);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-text-muted);
  font-family: var(--font-mono);
  font-size: 0.72rem;
  overflow-wrap: anywhere;
}
.chip {
  display: inline-flex;
  padding: 2px var(--space-2);
  background: var(--ui-surface-subtle);
  border: 1px solid var(--ui-border);
  border-radius: 999px;
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
@media (max-width: 720px) {
  .profile-body {
    grid-template-columns: 1fr;
    padding: var(--space-4);
  }
  .profile-main {
    align-items: flex-start;
  }
  .profile-avatar.avatar-xl,
  .company-mark.company-mark-xl {
    width: 4.5rem;
    height: 4.5rem;
  }
  .profile-kind,
  .profile-main,
  .profile-tags,
  .profile-foot {
    padding-inline: var(--space-3);
  }
  .profile-picture {
    padding-inline: var(--space-3);
  }
  .profile-open {
    margin-inline-start: 0;
  }
}


/* workspace company workspace shell: grouped, branch-aware, resizable, mobile-safe. */
body[data-scope="company"]:not(.company-auth) .sidebar {
  top: 0;
  overflow: visible;
  padding: 0;
  gap: 0;
  background: var(--ui-surface);
}
body[data-scope="company"]:not(.company-auth) #navigation {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: var(--space-2);
}
body[data-scope="company"]:not(.company-auth) #main {
  margin-top: 0;
  min-height: 100vh;
}
body[data-scope="company"]:not(.company-auth) .topbar {
  display: none;
}
.sidebar-brand-block {
  flex: none;
  padding: var(--space-4);
  border-bottom: 1px solid var(--ui-border);
}
.sidebar-brand-link {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  color: var(--ui-text);
  text-decoration: none;
}
.sidebar-brand-mark {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  overflow: hidden;
  padding: 0.35rem;
  border: 1px solid var(--ui-accent-border);
  border-radius: var(--radius-sm);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}
.sidebar-brand-image {
  padding: 0;
  border: 0;
  background: transparent;
  object-fit: contain;
}
.sidebar-brand-copy,
.sidebar-user-copy {
  display: grid;
  min-width: 0;
}
.sidebar-brand-copy strong,
.sidebar-user-copy strong {
  overflow: hidden;
  color: var(--ui-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-brand-copy small,
.sidebar-user-copy small {
  overflow: hidden;
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-branch {
  flex: none;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--ui-border);
  background: var(--ui-surface);
}
.sidebar-branch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-1);
  color: var(--ui-text-soft);
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.sidebar-branch-head .button {
  min-height: 0;
  padding: 0;
  font-size: var(--font-xs);
  text-transform: none;
  letter-spacing: normal;
}
.sidebar-branch-select {
  width: 100%;
  height: 38px;
  min-height: 38px;
  padding-inline: var(--space-2);
  font-size: var(--font-xs);
}
.nav-group {
  margin: var(--space-3) var(--space-2) var(--space-1);
  color: var(--ui-text-soft);
  font-size: 0.72rem;
  font-weight: var(--weight-bold);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.nav-group:first-child {
  margin-top: var(--space-1);
}
body[data-scope="company"] .nav-link {
  min-height: 40px;
  gap: var(--space-2);
  padding: var(--space-1) var(--space-2);
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
}
.nav-icon {
  flex: none;
  display: grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 8px;
  background: var(--ui-surface-subtle);
  color: var(--ui-text-muted);
}
.nav-link.active .nav-icon {
  background: color-mix(in srgb, var(--ui-surface) 82%, transparent);
  color: var(--ui-accent-text);
}
.nav-label {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.sidebar-user {
  flex: none;
  padding: var(--space-2) var(--space-3) 0;
  border-top: 1px solid var(--ui-border);
}
.sidebar-user-card {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  min-width: 0;
  padding: var(--space-2);
  border-radius: var(--radius-sm);
}
.sidebar-user-avatar {
  flex: none;
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  overflow: hidden;
  border-radius: var(--radius-sm);
  background: var(--ui-surface-subtle);
  color: var(--ui-text);
  font-size: var(--font-sm);
  font-weight: var(--weight-bold);
}
.sidebar-user-avatar-image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
body[data-scope="company"] .sidebar-footer {
  flex: none;
  padding: var(--space-1) var(--space-3) var(--space-3);
  border: 0;
}
body[data-scope="company"] .sidebar-footer .button {
  width: 100%;
  justify-content: flex-start;
  min-height: 38px;
}
.sidebar-resize {
  position: absolute;
  top: 0;
  right: -4px;
  bottom: 0;
  z-index: 40;
  width: 8px;
  cursor: col-resize;
  touch-action: none;
}
.sidebar-resize::after {
  content: "";
  position: absolute;
  top: 0;
  right: 3px;
  bottom: 0;
  width: 2px;
  border-radius: 2px;
  background: transparent;
  transition: background-color 120ms ease;
}
.sidebar-resize:hover::after,
.sidebar-resize:focus-visible::after,
.sidebar-resize.is-dragging::after,
body.workspace-resizing .sidebar-resize::after {
  background: var(--ui-accent-border);
}
.sidebar-resize:focus-visible {
  outline: none;
}
body.workspace-resizing {
  cursor: col-resize;
  user-select: none;
}
@media (max-width: 760px) {
  body[data-scope="company"]:not(.company-auth) .topbar {
    display: flex;
  }
  body[data-scope="company"]:not(.company-auth) .sidebar {
    top: var(--topbar-height);
    width: min(86vw, 18rem);
    box-shadow: var(--shadow-hover);
  }
  body[data-scope="company"]:not(.company-auth) #main {
    margin-top: var(--topbar-height);
    min-height: calc(100vh - var(--topbar-height));
  }
  .sidebar-resize {
    display: none;
  }
  .sidebar-brand-block {
    padding-top: var(--space-5);
  }
}


/* workspace shared record, pagination and document primitives. */
.record-form-page {
  width: min(100%, 48rem);
  margin-inline: auto;
}
.record-form-page > .page-header {
  margin-bottom: var(--space-5);
}
.record-form-page > .panel {
  padding: 0;
  overflow: visible;
}
.record-form {
  padding: var(--space-5);
}
.record-form .form-actions {
  position: sticky;
  bottom: 0;
  z-index: 12;
  margin-inline: calc(var(--space-5) * -1);
  margin-bottom: calc(var(--space-5) * -1);
  padding: var(--space-4) var(--space-5);
  background: color-mix(in srgb, var(--ui-surface) 96%, transparent);
  backdrop-filter: blur(10px);
}
.pagination-bar {
  margin-top: 0;
  padding: var(--space-3) var(--space-4);
  border-top: 1px solid var(--ui-border);
}
.pagination-summary,
.pagination-pages {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: var(--space-2);
}
.pagination-size {
  display: grid;
  grid-template-columns: auto 5rem;
  align-items: center;
  gap: var(--space-2);
}
.pagination-size .field-label {
  margin: 0;
  font-size: var(--font-xs);
  white-space: nowrap;
}
.pagination-size .combo-anchor {
  min-height: 34px;
  height: 34px;
  padding: 0 var(--space-2);
  font-size: var(--font-xs);
}
.pagination-page {
  display: grid;
  place-items: center;
  min-width: 2rem;
  height: 2rem;
  padding: 0 var(--space-2);
  border: 1px solid var(--ui-border);
  border-radius: 7px;
  background: var(--ui-surface);
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  font-weight: var(--weight-medium);
}
.pagination-page:hover:not(:disabled),
.pagination-page.active {
  border-color: var(--ui-accent-border);
  background: var(--ui-accent-soft);
  color: var(--ui-accent-text);
}
.pagination-page:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pagination-ellipsis {
  padding-inline: var(--space-1);
  color: var(--ui-text-soft);
}
@media (max-height: 900px) and (min-width: 641px) {
  .record-form .form-actions {
    position: static;
  }
}
@media (max-width: 640px) {
  .record-form {
    padding: var(--space-4);
  }
  .record-form .form-actions {
    position: static;
    margin-inline: 0;
    margin-bottom: 0;
    padding-inline: 0;
    padding-bottom: 0;
    background: transparent;
    backdrop-filter: none;
  }
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }
  .pagination-summary {
    justify-content: space-between;
  }
}


/* workspace native business document. */
.native-document-workspace {
  min-width: 0;
  max-width: 100%;
  overflow-x: auto;
  padding: 0;
  background: transparent;
}
.native-document {
  box-sizing: border-box;
  width: 210mm;
  min-width: 210mm;
  min-height: 297mm;
  margin: 0 auto;
  background: #fff;
  color: var(--ui-text);
  border: 1px solid var(--ui-border);
  box-shadow: none;
  font-size: var(--font-xs);
  overflow-wrap: anywhere;
}
.native-document[data-orientation="landscape"] {
  width: 297mm;
  min-width: 297mm;
  min-height: 210mm;
}
.native-document-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: var(--space-6);
  padding: var(--space-5) var(--space-6);
  background: #fff;
  border-bottom: 1px solid var(--ui-border);
}
.native-document-identity {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  min-width: 0;
}
.native-document-logo {
  width: 18mm;
  height: 18mm;
  object-fit: contain;
  flex: none;
}
.native-document-header p {
  margin-top: var(--space-1);
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
.native-document-company {
  font-size: 1.3rem;
}
.native-document-title {
  margin-left: auto;
  text-align: right;
}
.native-document-title h2 {
  font-size: 1.1rem;
  font-weight: var(--weight-bold);
}
.native-document-content {
  padding: var(--space-6);
}
.native-document-by {
  margin-bottom: var(--space-4);
  color: var(--ui-text-muted);
}
.native-document-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
}
.native-document-summary > div {
  min-width: 0;
  padding: var(--space-3) 0;
  border-bottom: 1px solid var(--ui-border);
}
.native-document-summary dt {
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
  text-transform: uppercase;
}
.native-document-summary dd {
  margin: var(--space-1) 0 0;
  font-weight: var(--weight-bold);
}
.native-document-table-wrap {
  max-width: 100%;
  overflow-x: auto;
}
.native-document-table {
  width: 100%;
  border-collapse: collapse;
}
.native-document-table th {
  padding: var(--space-3) var(--space-2);
  background: #fff;
  border-bottom: 1px solid var(--ui-border-strong);
  font-weight: var(--weight-bold);
}
.native-document-table td {
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--ui-border);
  vertical-align: top;
}
.native-document-table tbody tr:nth-child(even) {
  background: #fff;
}
.native-document-notes {
  margin-top: var(--space-6);
}
.native-document-notes h3 {
  margin-bottom: var(--space-2);
}
.native-document-notes p {
  margin: var(--space-1) 0;
  white-space: pre-wrap;
}
.native-document-signatures {
  display: flex;
  justify-content: space-between;
  gap: var(--space-7);
  margin-top: 3rem;
}
.native-document-signatures span {
  width: min(40%, 15rem);
  display: grid;
  gap: var(--space-1);
  padding-top: var(--space-2);
  border-top: 1px solid var(--ui-border-strong);
}
.native-document-signatures strong {
  font-size: var(--font-sm);
  font-weight: var(--weight-medium);
}
.native-document-signatures small {
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
.native-document-footer {
  margin: 2.5rem var(--space-6) var(--space-4);
  padding-top: var(--space-2);
  border-top: 1px solid var(--ui-border);
  color: var(--ui-text-muted);
  font-size: var(--font-xs);
}
.native-document-empty {
  border: 0;
}
@media (max-width: 640px) {
  .native-document-header,
  .native-document-content {
    padding: var(--space-4);
  }
  .native-document-title {
    margin-left: 0;
    text-align: left;
  }
  .native-document-footer {
    margin: var(--space-7) var(--space-4) var(--space-4);
  }
}
@media print {
  body * {
    visibility: hidden !important;
  }
  .native-document,
  .native-document * {
    visibility: visible !important;
  }
  .native-document {
    position: absolute !important;
    inset: 0 auto auto 0 !important;
    width: 100% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    margin: 0 !important;
    border: 0 !important;
    box-shadow: none !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .native-document-header,
  .native-document-table thead,
  .native-document-table tr {
    break-inside: avoid;
  }
  @page {
    margin: 12mm;
  }
}


/* PLATFORM CONTROL-PLANE VISUAL REFINEMENT 2026-10-08 */
/* Explicitly scoped to public/PA/BA platform surfaces. Super Admin and the
   company operational workspace are intentionally outside this treatment. */
body[data-surface="landing"],
body[data-surface="platform-auth"],
body[data-surface="platform"] {
  background:
    radial-gradient(circle at 12% -8%, color-mix(in srgb, var(--ui-accent) 7%, transparent), transparent 30rem),
    radial-gradient(circle at 96% 18%, color-mix(in srgb, var(--ui-accent) 4%, transparent), transparent 24rem),
    var(--ui-bg);
}

body[data-surface="landing"] #main {
  padding: clamp(2.5rem, 7vw, 5.5rem) clamp(1rem, 4vw, 2rem);
}

body[data-surface="landing"] .front {
  row-gap: clamp(var(--space-4), 2.5vw, var(--space-6));
}

body[data-surface="landing"] .front > ul {
  padding: clamp(var(--space-4), 2.6vw, var(--space-6));
  border-color: color-mix(in srgb, var(--ui-border) 82%, transparent);
  background:
    radial-gradient(circle at 100% 0%, color-mix(in srgb, var(--ui-accent) 7%, transparent), transparent 55%),
    color-mix(in srgb, var(--ui-surface) 96%, transparent);
  box-shadow:
    0 1px 2px rgb(38 28 24 / 0.035),
    0 18px 50px rgb(38 28 24 / 0.06);
}

body[data-surface="landing"] .front > ul > li {
  color: var(--ui-text);
}

body[data-surface="landing"] .front > ul > li::before {
  width: 0.625rem;
  height: 0.625rem;
  margin-top: 0.45rem;
  background: var(--ui-accent);
  box-shadow: 0 0 0 0.28rem color-mix(in srgb, var(--ui-accent) 10%, transparent);
}

body[data-surface="landing"] .front-actions .button {
  box-shadow:
    0 1px 2px color-mix(in srgb, var(--ui-accent) 10%, transparent),
    0 8px 22px color-mix(in srgb, var(--ui-accent) 12%, transparent);
}

body[data-surface="platform-auth"] {
  background:
    radial-gradient(circle at 50% -12%, color-mix(in srgb, var(--ui-accent) 12%, transparent), transparent 34rem),
    linear-gradient(180deg, var(--ui-surface) 0%, var(--ui-surface-subtle) 100%);
}

body[data-surface="platform-auth"] #main::after {
  width: min(38rem, 94vw);
  height: min(38rem, 90vh);
  opacity: 0.34;
  filter: blur(58px);
}

body[data-surface="platform-auth"] .auth-head {
  margin-bottom: var(--space-5);
}

body[data-surface="platform-auth"] .auth-mark h1 {
  font-size: clamp(var(--font-xl), 3vw, 2rem);
}

body[data-surface="platform-auth"] .auth-card {
  border-color: color-mix(in srgb, var(--ui-border) 88%, transparent);
  background:
    linear-gradient(
      165deg,
      color-mix(in srgb, var(--ui-surface) 96%, transparent),
      color-mix(in srgb, var(--ui-surface-subtle) 82%, transparent)
    );
  box-shadow:
    0 1px 2px rgb(38 28 24 / 0.04),
    0 20px 60px rgb(38 28 24 / 0.08);
}

body[data-surface="platform-auth"] .auth-identity {
  border-color: color-mix(in srgb, var(--ui-border) 86%, transparent);
  background: color-mix(in srgb, var(--ui-surface-subtle) 72%, var(--ui-surface));
}

body[data-surface="platform"] #main {
  width: min(76rem, 100%);
  margin-inline: auto;
  padding: clamp(var(--space-5), 4vw, var(--space-7));
}

body[data-surface="platform"] .page-header {
  padding: 0 0 var(--space-5);
  background: transparent;
  border: 0;
  border-bottom: 1px solid var(--ui-border);
  border-radius: 0;
  box-shadow: none;
}

body[data-surface="platform"] :is(.section-card, .record-card) {
  border-color: color-mix(in srgb, var(--ui-border) 88%, transparent);
  border-radius: var(--radius-lg);
  box-shadow:
    0 1px 2px rgb(38 28 24 / 0.03),
    0 10px 30px rgb(38 28 24 / 0.04);
}

body[data-surface="platform"] :is(.section-card-head, .record-card-head) {
  background: color-mix(in srgb, var(--ui-surface-subtle) 58%, var(--ui-surface));
}

@media (max-width: 52rem) {
  body[data-surface="landing"] #main {
    align-content: start;
    padding-top: clamp(var(--space-7), 10vw, 4.5rem);
  }

  body[data-surface="landing"] .front > ul {
    padding: var(--space-4);
  }

  body[data-surface="platform"] #main {
    padding: var(--space-4);
  }
}

@media (max-width: 32rem) {
  body[data-surface="platform-auth"] {
    background:
      radial-gradient(circle at 50% 0%, color-mix(in srgb, var(--ui-accent) 8%, transparent), transparent 24rem),
      var(--ui-surface);
  }

  body[data-surface="platform-auth"] .auth-card {
    margin: 0;
    padding: 0;
    background: none;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
  }

  body[data-surface="platform-auth"] .auth-card::before {
    display: none;
  }

  body[data-surface="platform"] .page-header {
    padding-bottom: var(--space-4);
  }
}
