:root {
    --ink: #283b30;
    --muted: #6b766d;
    --paper: #f4f3ec;
    --line: #e7e9dd;
    --accent: #345b42;
    --primary: var(--accent);
    --surface: #fffefa;
    --input: #f1f3eb;
    --input-surface: var(--input);
    --surface-muted: var(--input);
    --selected: #e8eee2;
    --font: "Inter", "Segoe UI", Arial, sans-serif;
    color-scheme: light;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--paper); color: var(--ink); font-family: var(--font); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-underline-offset: 3px; }
button, input, select, textarea { font: inherit; }
button, a, input, select, textarea, summary { touch-action: manipulation; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: 3px;
}
h1, h2, h3 { font-family: var(--font); color: var(--ink); font-weight: 600; overflow-wrap: anywhere; }
h1 { font-size: clamp(1.75rem, 3vw, 2.15rem); letter-spacing: -.8px; line-height: 1.2; margin: 0 0 10px; }
h2 { font-size: 1.15rem; letter-spacing: -.25px; margin: 0 0 16px; }
h3 { font-size: 1rem; margin: 0 0 10px; }
p { line-height: 1.65; margin: 0 0 16px; }
.mud-typography { font-family: var(--font); }
.mud-button-root { text-transform: none; letter-spacing: normal; }
.mud-button-filled { box-shadow: none; }
.mud-button-filled:hover { box-shadow: none; }
.app-shell { min-height: 100vh; min-height: 100dvh; }
.workspace { min-width: 0; width: 100%; min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.page-content {
    min-width: 0;
    overflow-wrap: anywhere;
    padding: 36px 32px 48px;
    max-width: 1280px;
    width: 100%;
    margin: 0 auto;
    flex: 1;
    animation: page-in .18s ease-out;
}
.workspace-footer { padding: 20px max(24px, calc((100vw - 1280px) / 2)); border-top: 1px solid var(--line); font-size: 12px; display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); }
.nav-links { padding: 16px; display: flex; flex-direction: column; gap: 4px; }
.nav-links a { display: flex; gap: 12px; align-items: center; min-height: 44px; padding: 10px 14px; border-radius: 10px; color: var(--ink); text-decoration: none; font-size: 14px; transition: background 140ms, color 140ms; }
.nav-links a:hover { background: var(--input); }
.nav-links a.active { background: var(--selected); color: var(--primary); font-weight: 600; }
.nav-links .mud-icon-root { width: 20px; height: 20px; flex-shrink: 0; color: var(--muted); }
.nav-links a.active .mud-icon-root { color: var(--primary); }
.nav-label { font-size: 12px; font-weight: 600; color: var(--muted); padding: 20px 14px 6px; }
.page-heading { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 20px; margin-bottom: 28px; }
.eyebrow { font-size: 12px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.lead { color: var(--muted); max-width: 640px; font-size: 14px; margin: 0; }
.toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 16px; margin: 24px 0; }
.toolbar .mud-input-control { min-width: 0; flex: 1 1 170px; }
.section { padding: 24px 0; border-top: 1px solid var(--line); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 16px; margin-bottom: 18px; }
.section-head h2 { margin: 0; }
.split { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); gap: 32px; }
.two-column { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 32px; }
.archive-list { list-style: none; padding: 0; margin: 0; }
.list-surface { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 0 24px; }
.archive-row { display: flex; flex-wrap: wrap; align-items: center; gap: 16px; padding: 16px 0; border-bottom: 1px solid var(--line); }
.list-surface > .archive-row:last-child, .list-surface > .archive-list > .archive-row:last-child { border-bottom: 0; }
.archive-row a { color: var(--ink); font-weight: 550; text-decoration: none; display: flex; align-items: center; min-width: 44px; min-height: 44px; max-width: 100%; overflow-wrap: anywhere; }
.archive-row a:hover { color: var(--accent); text-decoration: underline; }
.row-icon { color: var(--muted); width: 30px; flex-shrink: 0; }
.row-main { min-width: 0; flex: 1 1 180px; }
.row-main a { overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: 12px; line-height: 1.65; }
.empty-state { padding: 32px 0; color: var(--muted); max-width: 640px; }
.empty-state h2 { color: var(--ink); }
.route-state { margin: 24px auto; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; }
.route-state > .mud-icon-root { color: var(--primary); margin-bottom: 16px; width: 30px; height: 30px; }
.route-state h1 { font-size: 1.65rem; }
.editor { background: var(--surface); padding: 26px; border: 1px solid var(--line); border-radius: 14px; margin: 20px 0; }
.form-surface { max-width: 640px; width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px; margin: 20px 0; }
.form-surface .editor { padding: 0; border: 0; border-radius: 0; background: transparent; }
.form-section { display: grid; gap: 16px; padding: 20px 0; }
.form-section + .form-section { border-top: 1px solid var(--line); }
.form-section h2, .form-section h3 { font-size: 15px; margin: 0; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-stack { display: flex; flex-direction: column; gap: 18px; }
.form-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; margin-top: 22px; }
.field-label { display: flex; flex-direction: column; gap: 8px; font-size: 13px; color: var(--ink); }
.field-label input, .field-label select, .field-label textarea, .native-input {
    background: var(--input);
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 11px 12px;
    color: var(--ink);
    min-height: 44px;
    min-width: 0;
    max-width: 100%;
    width: 100%;
    transition: border-color 140ms, background 140ms;
}
.field-label input::placeholder, .field-label textarea::placeholder, .native-input::placeholder { color: var(--muted); }
.field-label textarea { resize: vertical; min-height: 100px; }
.field-label input[type=checkbox] { width: 22px; min-height: 22px; }
.field-label input:disabled, .field-label select:disabled, .field-label textarea:disabled, .native-input:disabled { cursor: not-allowed; }
.field-label .invalid, .native-input.invalid { border-color: #ae342a; }
.validation-message, .validation-errors { color: #ae342a; }
.full-width { grid-column: 1 / -1; }
.status-tag { display: inline-block; padding: 5px 9px; font-size: 12px; border-radius: 6px; background: var(--input); color: #536047; white-space: normal; line-height: 1.4; }
.status-tag.approved { background: var(--selected); color: var(--primary); }
.status-tag.proposal { background: #edf0e2; color: #4b5e33; }
.status-tag.manual { background: #fff0d6; color: #805715; }
.status-tag.failed { background: #fbe6e2; color: #9b3027; }
.status-message { margin: 14px 0; }
.page-status { margin: 12px 0; }
.page-status-loading { max-width: 640px; margin: 12px 0; }
.details-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.details-grid dt { font-size: 12px; color: var(--muted); margin-bottom: 6px; }
.details-grid dd { margin: 0; overflow-wrap: anywhere; }
.detail-frame { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; min-width: 0; }
.detail-header { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 20px; padding: 28px 32px; }
.detail-header h1 { margin-bottom: 6px; }
.detail-header .form-actions { margin-top: 0; }
/* MudTabs also contains its panels. Only the direct tabbar receives tab styling. */
.detail-tabs { min-width: 0; }
.detail-tabs > .mud-tabs-tabbar { padding-inline: 24px; background: transparent; border-bottom: 1px solid var(--line); }
.detail-tabs > .mud-tabs-tabbar .mud-tab { min-height: 48px; padding: 12px 14px; color: var(--muted); font-family: var(--font); font-size: 14px; text-transform: none; letter-spacing: normal; }
.detail-tabs > .mud-tabs-tabbar .mud-tab:not(.mud-disabled):hover { background: var(--input); color: var(--ink); }
.detail-tabs > .mud-tabs-tabbar .mud-tab.mud-tab-active { color: var(--primary); font-weight: 600; }
.detail-body { padding: 28px 32px; min-width: 0; }
.page-breadcrumb { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; color: var(--muted); font-size: 12px; margin-bottom: 20px; }
.page-breadcrumb a { display: inline-flex; align-items: center; min-height: 44px; max-width: 100%; }
.secondary-details { border-top: 1px solid var(--line); margin-top: 20px; }
.secondary-details > summary { color: var(--ink); font-weight: 550; }
.note { padding: 18px 0; border-bottom: 1px solid var(--line); white-space: pre-wrap; overflow-wrap: anywhere; }
.original-text { white-space: pre-wrap; overflow-wrap: anywhere; background: var(--input); border-radius: 10px; padding: 18px; font-size: 13px; line-height: 1.7; max-height: 420px; overflow: auto; }
.proposal-row { border-top: 1px solid var(--line); padding: 24px 0; }
.info-callout { border-left: 3px solid var(--accent); border-radius: 0 8px 8px 0; background: var(--input); padding: 14px 16px; color: var(--ink); font-size: 13px; margin: 18px 0; }
.info-callout p:last-child { margin-bottom: 0; }
.document-preview { width: 100%; max-height: 560px; object-fit: contain; background: var(--input); border: 0; }
.pdf-preview { height: 560px; }
.download-block { background: var(--input); border-radius: 10px; padding: 30px; text-align: center; }
.skip-link { position: fixed; left: 15px; top: -70px; z-index: 1600; background: var(--surface); border: 1px solid var(--line); border-radius: 8px; padding: 12px; }
.skip-link:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); white-space: nowrap; border: 0; }
.login-panel { max-width: 460px; margin: 30px auto; }
.login-panel form { display: flex; flex-direction: column; gap: 20px; }
.metric-line { display: flex; flex-wrap: wrap; gap: 34px; border-bottom: 1px solid var(--line); padding: 0 0 26px; margin-bottom: 32px; }
.metric-line strong { font-family: var(--font); display: block; font-size: 30px; color: var(--ink); font-weight: 600; letter-spacing: -.6px; }
.metric-line span { font-size: 12px; color: var(--muted); }
.inline-check { display: flex; align-items: center; gap: 10px; min-width: 44px; min-height: 44px; max-width: 100%; }
.inline-check input { flex-shrink: 0; accent-color: var(--primary); }
.member-list { display: flex; flex-wrap: wrap; gap: 12px; }
.table-scroll { overflow: auto; }
#blazor-error-ui { display: none; background: #fff0d6; color: #624610; padding: 16px; position: fixed; bottom: 0; left: 0; right: 0; z-index: 1500; }
.muted { color: var(--muted); }
/* Shared layout contracts allow arbitrary field labels and long names to wrap. */
.page-content :where(.page-heading, .section-head, .toolbar, .archive-row, .form-actions, .form-grid, .form-stack, .split, .two-column, .details-grid, .metric-line, .member-list, .detail-header, .detail-tabs) > * { min-width: 0; max-width: 100%; }
.page-content fieldset { min-width: 0; }
.page-content button, .page-content .mud-button-root, .workspace-header .mud-button-root { min-width: 44px; min-height: 44px; max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
.page-content .mud-button-label, .workspace-header .mud-button-label { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.page-content .mud-button-label :is(.mud-button-icon-start, .mud-button-icon-end) { flex-shrink: 0; }
.page-content .inline-check, .page-content .mud-checkbox { min-width: 44px; min-height: 44px; max-width: 100%; }
.page-content .mud-checkbox .mud-typography { min-width: 0; }
.page-content > a.mud-link, .page-content .section-head > a, .page-content .section > a, .page-content .note > .meta > a, .page-content .form-actions > a, .page-content .mud-alert-message > a { display: inline-flex; align-items: center; min-width: 44px; min-height: 44px; max-width: 100%; overflow-wrap: anywhere; }
.page-content summary { min-width: 44px; min-height: 44px; padding: 12px 0; cursor: pointer; white-space: normal; }
/* Style the actual MudBlazor input wrapper, leaving its validation and disabled states intact. */
.page-content :is(.mud-input-control, .mud-input-control-input-container, .mud-input, .mud-select) { min-width: 0; max-width: 100%; }
.page-content .mud-input { min-height: 44px; }
.page-content .mud-input.mud-input-outlined, .page-content .mud-input.mud-input-filled { background: var(--input); border-radius: 10px; }
.page-content .mud-input:not(.mud-input-error):not(.mud-disabled) .mud-input-outlined-border { border-color: var(--line); }
.page-content .mud-input:not(.mud-input-error):not(.mud-disabled):hover .mud-input-outlined-border { border-color: #a8b5a5; }
.page-content .mud-input:not(.mud-input-error):not(.mud-disabled):focus-within .mud-input-outlined-border { border-color: var(--primary); }
.page-content .mud-select .mud-select-input .mud-input-slot { height: auto; white-space: normal; overflow: visible; overflow-wrap: anywhere; text-overflow: clip; }
.page-content .mud-input > textarea.mud-input-root { overflow-wrap: anywhere; }
.page-content .mud-button-root:focus-visible, .workspace-header .mud-button-root:focus-visible, .page-content .mud-input:focus-within { outline: 3px solid var(--primary); outline-offset: 3px; }
.page-content input[type=file]::file-selector-button { font: inherit; min-width: 44px; min-height: 44px; max-width: 100%; white-space: normal; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; color: var(--primary); background: var(--selected); cursor: pointer; }
/* Select/menu portals render outside page-content. */
.mud-popover .mud-list-item-clickable, .mud-popover .mud-menu-item { min-width: 44px; min-height: 44px; overflow-wrap: anywhere; }
.mud-popover .mud-list-item-text, .mud-popover .mud-menu-item-text { min-width: 0; white-space: normal; overflow-wrap: anywhere; }
.mud-popover .mud-list-item-clickable:focus-visible, .mud-popover .mud-menu-item:focus-visible { outline: 3px solid var(--primary); outline-offset: -3px; }
.workspace-header .header-search button, .workspace-header .header-search input { min-height: 44px; }
.workspace-header .header-search button { min-width: 44px; }
.upload-button { min-height: 44px; padding: 10px 20px; color: white; background: var(--accent); border: 0; border-radius: 10px; cursor: pointer; }
.upload-button:disabled { opacity: .6; cursor: not-allowed; }
h1:focus { outline: none; }
@keyframes page-in { from { opacity: 0; transform: translateY(4px); } to { opacity: 1; transform: none; } }
@media (max-width: 1000px) {
    .page-content { padding: 30px 24px 40px; }
    .split { gap: 24px; }
}
@media (max-width: 760px) {
    .page-content { padding: 26px 20px 36px; }
    .page-heading { align-items: flex-start; margin-bottom: 24px; }
    .split, .two-column, .form-grid, .details-grid { grid-template-columns: 1fr; gap: 22px; }
    .editor, .form-surface { padding: 22px; }
    .list-surface { padding-inline: 20px; }
    .workspace-footer { padding: 18px 20px; gap: 8px; }
    .metric-line { gap: 24px; }
    .archive-row { gap: 10px; }
    .row-icon { width: 24px; }
    .section-head { align-items: flex-start; }
    .mud-icon-button { min-width: 44px; min-height: 44px; }
    .original-text { max-height: 280px; }
}
/* Wrap detail tabs on narrow screens: native focus scrolling must not add
   another offset to MudTabs' transform-based scroll position. */
@media (max-width: 760px) {
    .detail-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-content { overflow: visible; }
    .detail-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-wrapper { width: 100%; flex-wrap: wrap; transform: none !important; transition: none; }
    .detail-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-wrapper > * { max-width: 100%; }
    .detail-tabs > .mud-tabs-tabbar .mud-tabs-scroll-button,
    .detail-tabs > .mud-tabs-tabbar .mud-tab-slider { display: none; }
    .detail-tabs > .mud-tabs-tabbar .mud-tab { min-width: 0 !important; width: auto; max-width: 100%; border-bottom: 2px solid transparent; }
    .detail-tabs > .mud-tabs-tabbar .mud-tab.mud-tab-active { border-bottom-color: var(--primary); }
}
@media (max-width: 570px) {
    .page-content { padding: 24px 16px 32px; }
    .detail-header, .detail-body { padding: 22px 20px; }
    .detail-tabs > .mud-tabs-tabbar { padding-inline: 10px; }
    .detail-tabs > .mud-tabs-tabbar .mud-tab { padding: 12px 10px; min-height: 44px; font-size: 13px; }
    .route-state { padding: 24px 20px; }
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
}
