/* ARSAGO product UI — Polaris-aligned, project-native design system */
:root {
    --app-nav: 232px;
    --font-ui: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --text-strong: #202223;
    --text: #303438;
    --text-muted: #68686f;
    --text-faint: #929298;
    --canvas: #f6f6f7;
    --surface: #ffffff;
    --surface-subdued: #f2f2f3;
    --surface-hover: #f7f7f8;
    --sidebar: #18181b;
    --sidebar-hover: #27272a;
    --sidebar-active: #3f3f46;
    --border: #dedee2;
    --border-strong: #b9b9c0;
    --accent: #27272a;
    --accent-hover: #18181b;
    --accent-soft: #f0f0f2;
    --success: #3f3f46;
    --success-soft: #f1f1f3;
    --info: #256b91;
    --info-soft: #e7f1f7;
    --warning: #8a5d21;
    --warning-soft: #f8efe1;
    --danger: #b42318;
    --danger-hover: #921f16;
    --danger-soft: #fbeae8;
    --radius: 8px;
    --control-height: 42px;
    --shadow-card: 0 1px 2px rgba(24, 24, 27, .05);
    --shadow-overlay: 0 18px 48px rgba(24, 24, 27, .18);
    --space-1: 4px;
    --space-2: 8px;
    --space-3: 12px;
    --space-4: 16px;
    --space-5: 20px;
    --space-6: 24px;
    --space-8: 32px;
    --space-10: 40px;
    /* Legacy component aliases; kept neutral until older views are migrated. */
    --ink: var(--text-strong);
    --muted: var(--text-muted);
    --paper: var(--canvas);
    --card: var(--surface);
    --line: var(--border);
    --green: var(--accent);
    --green-soft: var(--accent-soft);
}

* { box-sizing: border-box; }
html { background: var(--canvas); scroll-behavior: smooth; }
body {
    margin: 0;
    background: var(--canvas);
    color: var(--text);
    font-family: var(--font-ui);
    font-size: 14px;
    line-height: 1.5;
    text-rendering: optimizeLegibility;
    -webkit-font-smoothing: antialiased;
}
body:not(.auth-page) { padding-left: var(--app-nav); }
button, input, select, textarea { font: inherit; }
button, input, select, textarea, summary, a { transition: color .16s ease, background-color .16s ease, border-color .16s ease, box-shadow .16s ease; }
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, summary:focus-visible, a:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}
::selection { color: #fff; background: var(--accent); }
* { scrollbar-color: #a9a9b0 transparent; scrollbar-width: thin; }
.eyebrow { display: none !important; }
.sr-only { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; }

/* App shell */
.topbar {
    position: fixed;
    z-index: 60;
    inset: 0 auto 0 0;
    width: var(--app-nav);
    height: 100dvh;
    padding: 24px 14px 16px;
    display: flex;
    flex-direction: column;
    align-items: stretch;
    background: var(--sidebar);
    border-right: 1px solid rgba(255, 255, 255, .07);
    box-shadow: none;
}
.topbar .brand {
    height: 40px;
    padding: 0 10px;
    display: flex;
    align-items: center;
    gap: 11px;
    color: #fafafa;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .15em;
}
.topbar .brand-mark { width: 18px; height: 23px; color: #d4d4d8; border-width: 1.5px; }
.nav-section-label { margin: 30px 12px 8px; color: #71717a; font-size: 10px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; }
.topnav { height: auto; display: flex; flex-direction: column; align-items: stretch; gap: 3px; }
.topnav a {
    height: 42px;
    padding: 0 11px;
    display: flex;
    align-items: center;
    gap: 11px;
    border: 0;
    border-radius: var(--radius);
    color: #b4b4bc;
    font-size: 13px;
    font-weight: 550;
    text-decoration: none;
}
.topnav a svg, .account-menu button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 1.65; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.topnav a:hover { color: #fff; background: var(--sidebar-hover); }
.topnav a.active { color: #fff; background: var(--sidebar-active); box-shadow: none; }
.topnav a.active svg { color: #ffffff; }
.nav-count { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; display: grid; place-items: center; border-radius: 10px; color: #fff; background: var(--danger); font-size: 9px; font-weight: 700; }
.account-menu { margin-top: auto; padding: 14px 8px 0; display: grid; grid-template-columns: 32px minmax(0, 1fr) 32px; align-items: center; gap: 9px; border-top: 1px solid rgba(255, 255, 255, .09); }
.account-avatar { width: 32px; height: 32px; display: grid; place-items: center; border-radius: 50%; color: #f4f4f5; background: #3f3f46; font-size: 11px; font-weight: 700; }
.account-menu > div { min-width: 0; display: flex; flex-direction: column; text-align: left; }
.account-menu strong { overflow: hidden; color: #f4f4f5; font-size: 11px; font-weight: 600; text-overflow: ellipsis; white-space: nowrap; }
.account-menu small { color: #a1a1aa; font-size: 9px; }
.account-menu form { padding: 0; border: 0; }
.account-menu button { width: 32px; height: 32px; padding: 0; display: grid; place-items: center; border: 0; border-radius: var(--radius); color: #a1a1aa; background: transparent; cursor: pointer; }
.account-menu button span { display: none; }
.account-menu button:hover { color: #fff; background: var(--sidebar-hover); }

/* Page and section hierarchy */
.page-shell { width: min(1240px, calc(100% - 64px)); margin: 0 auto; padding: 44px 0 72px; }
.narrow-page { width: min(1080px, calc(100% - 64px)); }
.page-heading { margin: 0 0 28px; padding: 0 0 22px; display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; border-bottom: 1px solid var(--border); }
.page-heading h1, .page-heading h2 { margin: 0; color: var(--text-strong); font-size: 28px; font-weight: 650; line-height: 1.2; letter-spacing: -.025em; text-wrap: balance; }
.page-heading h2 { font-size: 20px; }
.page-heading > div { min-width: 0; }
.page-heading div > p:last-child { max-width: 68ch; margin: 7px 0 0; color: var(--text-muted); font-size: 13px; line-height: 1.55; }
.heading-count { padding: 0; border: 0; border-radius: 0; color: var(--text-muted); background: transparent; font-size: 12px; font-weight: 600; white-space: nowrap; }
.back-link { margin: 0 0 18px; display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 12px; font-weight: 550; text-decoration: none; }
.back-link:hover { color: var(--text-strong); text-decoration: underline; text-underline-offset: 4px; }
.section-heading { margin: 32px 0 14px; display: flex; align-items: center; justify-content: space-between; }
.section-heading h2 { margin: 0; color: var(--text-strong); font-size: 16px; font-weight: 650; }
.section-heading span { color: var(--text-muted); font-size: 11px; }
.section-label { margin: 0 0 10px; padding-bottom: 9px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border); }
.section-label h2, .section-label h3 { margin: 0; color: var(--text-strong); font-size: 13px; font-weight: 650; }
.section-label > span { color: var(--text-muted); font-size: 10px; }

/* Actions */
.primary-button, .secondary-button, .approve-button, .reject-button {
    min-height: var(--control-height);
    padding: 0 15px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 1px solid transparent;
    border-radius: var(--radius);
    font-size: 12px;
    font-weight: 650;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    box-shadow: none;
}
.primary-button { width: 100%; color: #fff; background: var(--accent); }
.primary-button:hover { background: var(--accent-hover); transform: none; }
.primary-button.compact, .secondary-button.compact { width: auto; }
.secondary-button { width: 100%; color: var(--text); background: var(--surface); border-color: var(--border-strong); }
.secondary-button:hover { background: var(--surface-hover); border-color: #929299; }
.approve-button { color: #fff; background: var(--accent); }
.approve-button:hover { background: var(--accent-hover); }
.reject-button { color: var(--danger); background: transparent; border-color: #e1bbb7; }
.reject-button:hover { color: var(--danger-hover); background: var(--danger-soft); }
.primary-button:active, .secondary-button:active, .approve-button:active, .reject-button:active { transform: translateY(1px); }
button:disabled, .primary-button:disabled, .secondary-button:disabled, .approve-button:disabled, .reject-button:disabled { opacity: .48; cursor: not-allowed; transform: none; }
.button-icon, .inline-icon { display: block; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }
.button-icon { width: 16px; height: 16px; }
.inline-icon { width: 14px; height: 14px; }
.ui-icon { width: 15px; height: 15px; display: block; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; flex: 0 0 auto; }

/* Feedback */
.flash { position: fixed; z-index: 90; left: calc(var(--app-nav) + 50%); top: 18px; max-width: min(560px, calc(100vw - var(--app-nav) - 32px)); padding: 11px 14px; transform: translateX(-50%); display: flex; align-items: center; gap: 9px; border: 1px solid transparent; border-radius: var(--radius); box-shadow: var(--shadow-overlay); font-size: 12px; font-weight: 600; line-height: 1.45; }
.flash.success { color: #27272a; background: #f4f4f5; border-color: #d4d4d8; }
.flash.error { color: #8b1d15; background: #fff2f0; border-color: #e8b8b3; }
.field-error { margin-top: 6px; display: flex; align-items: flex-start; gap: 5px; color: var(--danger); font-size: 11px; font-style: normal; font-weight: 550; line-height: 1.4; }
.field-error .ui-icon { width: 14px; height: 14px; margin-top: 1px; }

/* Forms and card architecture */
.detail-layout { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); align-items: start; gap: 24px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(300px, 1fr); align-items: start; gap: 24px; }
.block-stack { display: grid; gap: 20px; }
.primary-content, .secondary-content { min-width: 0; }
.structured-form > .form-actions { position: sticky; z-index: 12; bottom: 0; margin-top: 24px; padding: 16px 0; background: linear-gradient(180deg, rgba(246, 246, 243, 0), var(--canvas) 24%); }
.form-card, .data-card {
    padding: 20px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow-card);
}
.data-card { padding: 0; overflow: hidden; }
.card-header { margin: -2px 0 20px; padding-bottom: 16px; display: flex; align-items: flex-start; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); }
.card-header h2, .form-card > h2, .data-card > h2 { margin: 0; color: var(--text-strong); font-size: 15px; font-weight: 650; line-height: 1.3; }
.card-header p { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; line-height: 1.5; }
.sticky-card { position: sticky; top: 24px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.form-grid .wide { grid-column: 1 / -1; }
.form-card label, .inspector-form label { margin: 0 0 17px; display: block; }
.form-card label:last-child { margin-bottom: 0; }
.form-card label > span, .inspector-form label > span, .login-form label span { margin-bottom: 6px; display: block; color: var(--text-strong); font-size: 12px; font-weight: 600; }
.form-card label small, .upload-field small, .inspector-form label small { max-width: 70ch; margin-top: 6px; display: block; color: var(--text-muted); font-size: 10px; line-height: 1.5; }
.form-card input:not([type=checkbox]), .form-card select, .form-card textarea, .inspector-form input, .inspector-form select, .inspector-form textarea, .login-form input:not([type=checkbox]), .approval-actions input {
    width: 100%;
    min-height: var(--control-height);
    padding: 0 11px;
    border: 1px solid var(--border-strong);
    border-radius: var(--radius);
    outline: 0;
    color: var(--text);
    background: var(--surface);
    box-shadow: none;
    font-size: 12px;
}
.form-card textarea, .inspector-form textarea { padding: 10px 11px; line-height: 1.5; resize: vertical; }
.form-card select[multiple] { min-height: 150px; padding: 7px; }
.form-card input[type=file] { height: auto; padding: 9px; }
.form-card input:hover, .form-card select:hover, .form-card textarea:hover, .inspector-form input:hover, .inspector-form select:hover, .inspector-form textarea:hover { border-color: #909992; }
.form-card input:focus, .form-card select:focus, .form-card textarea:focus, .inspector-form input:focus, .inspector-form select:focus, .inspector-form textarea:focus, .login-form input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(39, 39, 42, .12); }
.form-card input:disabled, .form-card select:disabled, .form-card textarea:disabled { color: var(--text-faint); background: #eceeeb; cursor: not-allowed; }
.form-actions { margin-top: 18px; padding-top: 18px; display: flex; align-items: center; justify-content: flex-end; gap: 12px; border-top: 1px solid var(--border); }
.form-actions > a { min-height: var(--control-height); padding: 0 8px; display: inline-flex; align-items: center; color: var(--text-muted); font-size: 12px; text-decoration: none; }
.form-actions > a:hover { color: var(--text-strong); text-decoration: underline; text-underline-offset: 3px; }
.form-section { margin: 28px 0 16px; padding: 0 0 12px; border: 0; border-bottom: 1px solid var(--border); }
.form-section:first-child { margin-top: 0; }
.form-section h2 { margin: 0; color: var(--text-strong); font-size: 15px; font-weight: 650; }
.form-section p { margin: 4px 0 0; color: var(--text-muted); font-size: 11px; }
.form-section > span { display: none; }
.project-media-settings { margin-top: 48px; }

/* Index metrics and resource lists */
.portfolio-summary, .finance-grid { margin: 0 0 30px; display: grid; grid-template-columns: repeat(4, 1fr); border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); overflow: hidden; }
.finance-grid { grid-template-columns: repeat(3, 1fr); }
.portfolio-summary > div, .finance-stat { min-width: 0; padding: 18px 20px; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
.portfolio-summary > div + div, .finance-stat + .finance-stat { border-left: 1px solid var(--border); }
.portfolio-summary span, .finance-stat span, .finance-stat small { display: block; color: var(--text-muted); font-size: 11px; }
.portfolio-summary strong, .finance-stat strong { display: block; margin: 5px 0 2px; color: var(--text-strong); font-size: 21px; font-weight: 650; letter-spacing: -.02em; font-variant-numeric: tabular-nums lining-nums; }
.finance-stat.collected strong { color: var(--success); }
.finance-stat.balance strong { color: var(--info); }
.finance-stat::after { display: none; }
.project-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.portfolio-card { overflow: hidden; border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: var(--shadow-card); text-decoration: none; }
.portfolio-card:hover { border-color: var(--border-strong); box-shadow: 0 4px 12px rgba(24, 24, 27, .08); transform: none; }
.portfolio-card:focus-visible { outline-offset: 3px; }
.portfolio-cover { min-height: 0; aspect-ratio: 16 / 9; padding: 20px; border-radius: 0; background-color: #27272a; }
.portfolio-cover span { font-size: 9px; font-weight: 600; letter-spacing: .08em; }
.portfolio-cover h2 { margin: 5px 0 2px; font-size: 22px; font-weight: 650; letter-spacing: -.025em; }
.portfolio-cover small { font-size: 10px; }
.portfolio-body { padding: 16px 18px; }
.portfolio-total span { font-size: 10px; }
.portfolio-total strong { font-size: 23px; font-weight: 650; font-variant-numeric: tabular-nums; }
.mini-stats { margin: 12px 0; gap: 12px; }
.mini-stats span { font-size: 10px; }
.mini-stats i, .plan-legend i { width: 7px; height: 7px; box-shadow: none; }
.portfolio-footer { padding-top: 12px; font-size: 10px; }
.portfolio-footer b { color: var(--accent); font-weight: 650; }
.list-heading { min-height: 56px; margin: 0; padding: 0 18px; display: flex; align-items: center; justify-content: space-between; gap: 20px; border-bottom: 1px solid var(--border); color: var(--text); background: var(--surface); }
.list-heading h2 { margin: 0; color: var(--text-strong); font-size: 14px; font-weight: 650; }
.list-heading > span { color: var(--text-muted); font-size: 10px; text-align: right; }
.data-card > h2 { padding: 18px 20px; border-bottom: 1px solid var(--border); }
.data-table { width: 100%; border-collapse: collapse; table-layout: auto; }
.data-table th { height: 40px; padding: 0 16px; border-bottom: 1px solid var(--border); color: var(--text-muted); background: var(--surface-subdued); font-size: 10px; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; white-space: nowrap; }
.data-table td { height: 58px; padding: 11px 16px; border-bottom: 1px solid var(--border); color: var(--text); font-size: 12px; line-height: 1.4; vertical-align: middle; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr:hover, .data-table tbody tr:focus-within { background: var(--surface-hover); }
.data-table td strong { color: var(--text-strong); font-weight: 650; }
.data-table td small { margin-top: 3px; color: var(--text-muted); font-size: 10px; }
.money-cell { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.currency { color: var(--text-faint); font-size: .82em; font-weight: 500; }
.row-action { text-align: right; }
.row-action a { min-height: 34px; padding: 0 9px; display: inline-flex; align-items: center; gap: 5px; border-radius: var(--radius); color: var(--text); background: var(--surface-subdued); font-size: 10px; font-weight: 600; text-decoration: none; }
.row-action a:hover { color: var(--text-strong); background: #e4e4e7; }
.person-avatar { width: 32px; height: 32px; border-radius: 50%; color: var(--text) !important; background: #e4e4e7 !important; font-size: 10px; }
.project-tag, .role-label { font-size: 10px; }
.project-tag { border-color: var(--border); border-radius: 6px; background: var(--surface-subdued); }
.status-badge { padding: 4px 8px; border-radius: 10px; font-size: 9px; font-weight: 650; white-space: nowrap; }
.status-badge.available { color: #3f3f46; background: #ededf0; }
.status-badge.reserved { color: #245f82; background: #e6f0f6; }
.status-badge.sold { color: #a12820; background: #f8e7e5; }
.table-empty { padding: 46px 20px !important; color: var(--text-muted); text-align: center !important; }
.table-empty strong, .table-empty span { display: block; }
.table-empty a { margin-top: 12px; display: inline-flex; align-items: center; gap: 5px; color: var(--accent); }
.empty-state { min-height: 220px; padding: 40px; border: 1px dashed var(--border-strong); border-radius: var(--radius); background: var(--surface); box-shadow: none; }

/* Approvals */
.approval-list { display: grid; gap: 14px; }
.approval-card { padding: 20px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.approval-card > header { align-items: flex-start; }
.approval-card header span { color: var(--accent); font-size: 10px; font-weight: 650; }
.approval-card h2 { margin: 3px 0; color: var(--text-strong); font-size: 18px; font-weight: 650; }
.approval-card time { color: var(--text-muted); font-size: 10px; }
.approval-meta { margin: 14px 0; padding: 0; display: flex; gap: 24px; color: var(--text-muted); background: transparent; font-size: 10px; }
.approval-meta strong { color: var(--text); }
.change-table { border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; background: var(--surface); }
.change-table > div { grid-template-columns: 150px 1fr 1fr; }
.change-table > div > * { padding: 9px 12px; font-size: 10px; }
.change-head { background: var(--surface-subdued); }
.approval-actions { margin-top: 14px; grid-template-columns: 1fr auto auto; gap: 8px; }
.approval-actions label { margin: 0; display: block; }
.approval-actions label > span { margin-bottom: 6px; display: block; color: var(--text-strong); font-size: 11px; font-weight: 600; }
.approval-actions label > small { margin-top: 5px; display: block; color: var(--text-muted); font-size: 9px; }
.approval-actions button { align-self: end; margin-bottom: 19px; }
.approval-actions input { min-height: var(--control-height); }

/* Project operations workspace */
.workspace-page { background: #f0f0f2; }
.workspace { min-height: 100dvh; display: grid; grid-template-columns: 252px minmax(520px, 1fr) 360px; background: #f0f0f2; }
.workspace-sidebar { padding: 20px 18px; color: #f4f4f5; background: #202023; border: 0; }
.workspace-links { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.workspace-sidebar .back-link { color: #a1a1aa; }
.workspace-sidebar .back-link:hover { color: #fff; }
.workspace-sidebar .plan-editor-link { margin: 12px 0 18px; min-height: 40px; color: #18181b; background: #e4e4e7; }
.project-card { margin: 0 0 22px; padding: 0 0 18px; overflow: visible; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .1); border-radius: 0; background: transparent; box-shadow: none; }
.project-card-top { min-height: 96px; padding: 14px; border-radius: var(--radius); background-color: #2c2c30; }
.project-card-top span { font-size: 8px; }
.project-card-top b { font-size: 18px; font-weight: 650; }
.project-card-body { padding: 12px 0 0; }
.project-card-body p { font-size: 8px; }
.project-card-body strong { font-size: 11px; }
.plan-chip span { border-radius: 6px; font-size: 8px; }
.workspace-sidebar .section-label { border-color: rgba(255, 255, 255, .1); }
.workspace-sidebar .section-label h2, .workspace-sidebar .search-section > label { color: #f4f4f5; font-size: 11px; }
.workspace-sidebar .section-label > span, .workspace-sidebar .quick-select-label, .workspace-sidebar .filter-status { color: #a1a1aa; font-size: 9px; }
.stock-summary, .search-section, .activity-section { margin-top: 22px; }
.stock-grid { gap: 1px; border: 1px solid rgba(255, 255, 255, .1); border-radius: var(--radius); overflow: hidden; background: rgba(255, 255, 255, .1); }
.workspace-sidebar .stock-stat { min-height: 58px; padding: 9px; border: 0; border-radius: 0; color: #fff; background: #29292d; }
.workspace-sidebar .stock-stat:hover { background: #35353a; transform: none; }
.workspace-sidebar .stock-stat.active { color: var(--text-strong); background: #f4f4f5; box-shadow: none; }
.workspace-sidebar .stock-stat b { font-size: 17px; font-weight: 650; }
.workspace-sidebar .stock-stat span { color: #a1a1aa; font-size: 8px; }
.workspace-sidebar .stock-stat.active span { color: var(--text-muted); }
.workspace-sidebar .search-box input, .workspace-sidebar .parcel-quick-select { height: 38px; border-color: rgba(255, 255, 255, .14); border-radius: var(--radius); color: #f4f4f5; background: #2c2c30; font-size: 10px; }
.workspace-sidebar .parcel-quick-select option { color: var(--text); background: #fff; }
.workspace-sidebar .search-box input::placeholder { color: #8f8f98; }
.workspace-sidebar .activity-item { padding: 9px 0; border: 0; border-bottom: 1px solid rgba(255, 255, 255, .09); border-radius: 0; background: transparent; }
.workspace-sidebar .activity-item strong { color: #fff; font-size: 9px; }
.workspace-sidebar .activity-item p, .workspace-sidebar .activity-item time { color: #a1a1aa; font-size: 8px; }
.plan-area { padding: 28px clamp(22px, 2vw, 34px); background: #f4f4f5; }
.plan-status-row { margin-bottom: 24px; }
.plan-approval-badge { padding: 7px 10px; border-radius: var(--radius); font-size: 11px; }
.plan-tools > summary { border: 1px solid var(--border); border-radius: var(--radius); color: var(--text); background: var(--surface); box-shadow: none; }
.plan-tools > summary:hover { background: var(--surface-hover); }
.plan-tools > summary small { color: var(--text-muted); }
.plan-export-bar { border-radius: var(--radius); box-shadow: var(--shadow-overlay); }
.plan-header h1 { font-size: 30px; font-weight: 650; letter-spacing: -.025em; }
.plan-header > div > p:last-child { max-width: 62ch; font-size: 12px; }
.view-tools { height: 40px; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: none; }
.view-tools button { width: 40px; }
.view-tools button:hover { background: var(--surface-subdued); }
.view-tools output { font-size: 10px; }
.plan-legend { margin-top: 22px; font-size: 10px; }
.legend-hint { font-size: 10px; }
.plan-viewport { border: 1px solid var(--border); border-radius: var(--radius); box-shadow: 0 8px 24px rgba(24, 24, 27, .1); }
.inspector { top: 0; height: 100dvh; padding: 24px; border: 0; border-left: 1px solid var(--border); background: var(--surface); box-shadow: none; }
.inspector-head h2 { font-size: 26px; font-weight: 650; }
.inspector-label { font-size: 10px; }
.inspector .status-badge { font-size: 10px; }
.parcel-specs { margin: 20px 0; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-subdued); }
.parcel-specs div { padding: 13px; }
.parcel-specs div + div { border-color: var(--border); }
.inspector .parcel-specs span, .inspector .price-section > span, .inspector .record-card span { font-size: 10px; }
.inspector .parcel-specs strong { font-size: 14px; }
.price-section output { font-size: 30px !important; }
.payment-disclosure > summary { padding: 14px 0; font-size: 13px; }
.record-card { padding: 14px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface-subdued); }
.parcel-actions { margin-top: 24px; }
.parcel-actions h3 { font-size: 16px; }
.operation-buttons { gap: 8px; }
.operation-buttons button { min-height: 76px; padding: 13px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.operation-buttons button:hover, .operation-buttons button:focus-visible { border-color: #a1a1aa; background: var(--accent-soft); box-shadow: none; }
.operation-buttons strong { font-size: 13px; }
.transaction-context, .transaction-review { border-radius: var(--radius); background: #f4f4f5; }
.parcel-boundary { fill-opacity: 1; }
.parcel-boundary.selected, .parcel-boundary:focus { stroke-width: 1px; }

/* Authentication */
.auth-page { padding: 0; background: #18181b; }
.login-shell { min-height: 100dvh; grid-template-columns: minmax(440px, 1.05fr) minmax(420px, .95fr); }
.login-story { padding: 48px 56px; background: linear-gradient(130deg, rgba(24, 24, 27, .94), rgba(39, 39, 42, .76)), url("../assets/goynuk-vaziyet-plani.jpeg") center / cover; }
.login-story h1 { font-size: clamp(44px, 5.5vw, 74px); letter-spacing: -.045em; }
.login-story p:not(.eyebrow) { color: rgba(255, 255, 255, .72); }
.login-panel { background: var(--surface); }
.login-form h2 { color: var(--text-strong); font-size: 30px; font-weight: 650; letter-spacing: -.025em; }
.login-form > p:not(.eyebrow) { margin-bottom: 26px; color: var(--text-muted); }
.login-form label small { margin-top: 6px; display: block; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.remember { color: var(--text-muted); font-size: 11px; }

/* Responsive behavior */
@media (max-width: 1280px) and (min-width: 901px) {
    .workspace { grid-template-columns: minmax(0, 1fr) 360px; }
    .workspace-sidebar { grid-column: 1 / -1; display: flex; align-items: center; flex-wrap: wrap; gap: 16px; padding: 14px 20px; }
    .workspace-sidebar .project-card, .workspace-sidebar .activity-section, .workspace-sidebar .plan-editor-link { display: none; }
    .workspace-links, .workspace-sidebar .stock-summary, .workspace-sidebar .search-section { margin: 0; }
    .workspace-sidebar .stock-summary { flex: 1; }
    .workspace-sidebar .stock-grid { grid-template-columns: repeat(4, 1fr); }
    .workspace-sidebar .search-section { width: 230px; }
}

@media (max-width: 900px) {
    :root { --app-nav: 0px; }
    body:not(.auth-page) { padding-left: 0; padding-top: 108px; }
    .topbar { inset: 0 0 auto; width: 100%; height: 108px; padding: 10px 14px 9px; display: grid; grid-template-columns: 1fr auto; grid-template-rows: 38px 42px; gap: 7px 12px; }
    .topbar .brand { padding: 0; }
    .nav-section-label { display: none; }
    .topnav { grid-column: 1 / -1; grid-row: 2; flex-direction: row; gap: 3px; overflow-x: auto; }
    .topnav a { flex: 0 0 auto; height: 38px; padding: 0 10px; }
    .account-menu { grid-column: 2; grid-row: 1; margin: 0; padding: 0; border: 0; }
    .account-menu > div { display: none; }
    .account-menu { grid-template-columns: 32px 32px; }
    .page-shell { width: calc(100% - 28px); padding: 32px 0 64px; }
    .narrow-page { width: calc(100% - 28px); }
    .project-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-layout { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .sticky-card { position: static; }
    .workspace { display: grid; grid-template-columns: minmax(0, 1fr); min-height: calc(100dvh - 108px); }
    .workspace-sidebar { display: grid; grid-template-columns: 1fr; gap: 12px; padding: 18px; }
    .workspace-sidebar .project-card, .workspace-sidebar .activity-section { display: none; }
    .workspace-sidebar .search-section { width: auto; margin: 0; }
    .plan-area { padding: 20px 12px 32px; }
    .plan-header { align-items: flex-start; }
    .plan-header h1 { font-size: 27px; }
    .plan-viewport { max-height: 68dvh; }
    .plan-canvas { min-width: 820px; }
    .inspector { position: fixed; inset: auto 0 0; z-index: 40; width: 100%; height: auto; max-height: 82dvh; padding: 20px 20px calc(20px + env(safe-area-inset-bottom)); overflow-y: auto; border: 0; border-radius: 16px 16px 0 0; box-shadow: 0 -20px 55px rgba(15, 20, 14, .24); transform: translateY(105%); transition: transform .22s cubic-bezier(.2, .8, .2, 1); }
    .mobile-inspector-open .inspector { transform: translateY(0); }
    .mobile-inspector-close { display: block; }
    .finance-grid, .portfolio-summary { grid-template-columns: repeat(2, 1fr); }
    .finance-stat:nth-child(3), .portfolio-summary > div:nth-child(3) { border-left: 0; }
    .finance-stat:nth-child(n+3), .portfolio-summary > div:nth-child(n+3) { border-top: 1px solid var(--border); }
}

@media (max-width: 600px) {
    body:not(.auth-page) { padding-top: 106px; }
    .page-heading { display: grid; align-items: start; gap: 16px; }
    .page-heading h1 { font-size: 25px; }
    .page-heading .primary-button { width: 100%; }
    .project-grid { grid-template-columns: 1fr; }
    .form-grid { display: block; }
    .form-card { padding: 16px; }
    .card-header { margin-bottom: 16px; }
    .structured-form > .form-actions { display: grid; grid-template-columns: auto 1fr; }
    .structured-form > .form-actions .primary-button { width: 100%; }
    .portfolio-summary, .finance-grid { display: block; }
    .portfolio-summary > div + div, .finance-stat + .finance-stat { border-left: 0; border-top: 1px solid var(--border); }
    .management-page .data-card { overflow: visible; border: 0; background: transparent; box-shadow: none; }
    .management-page .list-heading { border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; }
    .management-page .data-table thead { display: none; }
    .management-page .data-table, .management-page .data-table tbody, .management-page .data-table tr, .management-page .data-table td { display: block; width: 100%; }
    .management-page .data-table tr { margin-bottom: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
    .management-page .data-table td { min-height: 38px; height: auto; padding: 8px 0 8px 42%; position: relative; border-bottom: 1px solid var(--border); text-align: left; white-space: normal; }
    .management-page .data-table td:last-child { border-bottom: 0; }
    .management-page .data-table td::before { content: attr(data-label); position: absolute; left: 0; width: 38%; color: var(--text-muted); font-size: 10px; font-weight: 600; text-transform: uppercase; }
    .management-page .data-table .row-action { padding-left: 0; }
    .management-page .data-table .row-action::before { display: none; }
    .management-page .data-table .row-action a { width: 100%; justify-content: center; }
    .login-shell { display: block; }
    .login-story { min-height: 35dvh; padding: 28px 22px; }
    .login-story h1 { font-size: 40px; }
    .story-caption { display: none; }
    .login-panel { min-height: 65dvh; padding: 32px 22px; }
    .plan-status-row { display: grid; }
    .plan-tools { margin: 0; }
    .plan-tools > summary { justify-content: space-between; }
    .operation-buttons { grid-template-columns: 1fr; }
    .operation-buttons button { min-height: 64px; }
    .approval-actions { grid-template-columns: 1fr 1fr; }
    .approval-actions label { grid-column: 1 / -1; }
    .approval-actions button { margin-bottom: 0; }
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
}

/* Parcel plan workbench — guided, progressively disclosed workflow */
.parcel-editor-page { max-width: 1720px; margin: 0 auto; padding: 34px clamp(18px, 3vw, 46px) 64px; color: var(--text); font-size: 14px; }
.parcel-editor-page .editor-heading { margin: 0 0 24px; padding-bottom: 20px; align-items: flex-end; border-bottom: 1px solid var(--border); }
.parcel-editor-page .editor-heading h1 { margin: 4px 0 0; color: var(--text-strong); font-size: 29px; font-weight: 650; letter-spacing: -.025em; }
.parcel-editor-page .editor-heading p { margin-top: 7px; color: var(--text-muted); font-size: 12px; }
.parcel-editor-page .editor-heading > button { width: auto; min-width: 190px; }
.editor-flow { margin: 0 0 16px; padding: 0; display: grid; grid-template-columns: repeat(3, 1fr); list-style: none; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.editor-flow li { min-width: 0; padding: 13px 16px; display: flex; align-items: center; gap: 11px; }
.editor-flow li + li { border-left: 1px solid var(--border); }
.editor-flow li > span { width: 25px; height: 25px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; color: #fff; background: #3f3f46; font-size: 10px; font-weight: 700; }
.editor-flow strong, .editor-flow small { display: block; }
.editor-flow strong { color: var(--text-strong); font-size: 12px; font-weight: 650; }
.editor-flow small { margin-top: 2px; color: var(--text-muted); font-size: 9px; }
.parcel-editor-page .editor-status { margin: 0; padding: 11px 14px; border: 1px solid var(--border); border-radius: var(--radius) var(--radius) 0 0; color: var(--text); background: #f4f4f5; font-size: 11px; }
.parcel-editor-page .editor-status.error { color: var(--danger); border-color: #e1bbb7; background: var(--danger-soft); }
.draft-bar { min-height: 42px; margin: 0 0 16px; padding: 7px 10px 7px 14px; display: flex; align-items: center; gap: 8px; border: 1px solid var(--border); border-top: 0; border-radius: 0 0 var(--radius) var(--radius); color: var(--text-muted); background: var(--surface); font-size: 10px; }
.draft-bar span { margin-right: auto; }
.draft-bar button, .editor-history-tools button, .advanced-tools button, .drawing-actions button, .issue-panel button { min-height: 32px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; color: var(--text); background: var(--surface); cursor: pointer; font-size: 10px; font-weight: 600; }
.parcel-editor-layout { grid-template-columns: minmax(0, 1fr) 350px; gap: 16px; }
.editor-map-panel { border-color: var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.editor-primary-tools { padding: 14px 16px; border-bottom: 1px solid var(--border); }
.editor-primary-tools > div:first-child { display: flex; flex-wrap: wrap; gap: 8px; }
.editor-primary-tools .primary-button, .editor-primary-tools .secondary-button { width: auto; min-height: 38px; font-size: 11px; }
.editor-primary-tools > p { margin: 10px 0 0; color: var(--text-muted); font-size: 10px; line-height: 1.45; }
.editor-history-tools { margin-top: 10px; display: flex; align-items: center; gap: 6px; }
.editor-history-tools label { margin-left: auto; display: flex; align-items: center; gap: 8px; color: var(--text-muted); font-size: 10px; font-weight: 600; }
.editor-history-tools input { accent-color: #3f3f46; }
.drawing-actions:has(:not([hidden])) { padding: 9px 16px; display: flex; gap: 7px; border-bottom: 1px solid var(--border); background: #fafafa; }
.advanced-tools { padding: 0 16px; border-bottom: 1px solid var(--border); }
.advanced-tools > summary, .correction-tools > summary { min-height: 42px; display: flex; align-items: center; color: var(--text-muted); cursor: pointer; font-size: 10px; font-weight: 650; }
.advanced-tools > summary:hover, .correction-tools > summary:hover { color: var(--text-strong); }
.advanced-tools-grid { padding: 4px 0 14px; display: flex; align-items: center; flex-wrap: wrap; gap: 10px; }
.advanced-tools-grid label { display: flex; align-items: center; gap: 7px; color: var(--text); font-size: 10px; }
.advanced-tools-grid select, .editor-settings select { min-height: 34px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 10px; }
.advanced-tools #rasterSettings, .advanced-tools #coordinateImport { padding: 0; border-top: 1px solid var(--border); color: var(--text); }
.advanced-tools #rasterSettings > summary, .advanced-tools #coordinateImport > summary { padding: 10px 0; color: var(--text-muted); font-size: 10px; font-weight: 600; }
.advanced-tools #rasterSettings p, .advanced-tools #coordinateImport > p { color: var(--text-muted); font-size: 10px; }
.editor-settings { gap: 12px; }
.editor-settings label { font-size: 10px; }
.coordinate-import-grid label { color: var(--text); font-size: 10px; }
.coordinate-import-grid input, .coordinate-import-grid textarea { border-color: var(--border); border-radius: 6px; font-size: 11px; }
.editor-viewport { min-height: 430px; max-height: 72vh; background: #27272a; }
.editor-help { padding: 11px 16px; color: var(--text-muted); background: #fafafa; font-size: 10px; line-height: 1.5; }
.editor-polygon { fill: rgba(217, 119, 6, .22); stroke: #d97706; stroke-width: 1.2; }
.editor-polygon.existing { fill: rgba(37, 99, 235, .18); stroke: #2563eb; }
.editor-polygon.approved { fill: rgba(63, 63, 70, .42); stroke: #18181b; }
.editor-polygon.selected { stroke: #fff; stroke-width: 2; }
.editor-label { fill: #fff; stroke: #18181b; opacity: 0; transition: opacity .12s ease; }
.editor-label.selected, .editor-polygon:hover + .editor-label, .editor-polygon:focus + .editor-label { opacity: 1; }
.editor-handle { fill: #fff; stroke: #27272a; }
.editor-sidebar { top: 16px; max-height: calc(100vh - 32px); padding: 0; border-color: var(--border); border-radius: var(--radius); background: var(--surface); box-shadow: var(--shadow-card); }
.editor-sidebar > header { padding: 16px; display: flex; align-items: center; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--border); }
.editor-sidebar > header span { color: var(--text-faint); font-size: 8px; font-weight: 650; letter-spacing: .09em; }
.editor-sidebar > header h2 { margin: 2px 0 0; color: var(--text-strong); font-size: 17px; font-weight: 650; }
.editor-sidebar > header p { margin: 0; color: var(--text-muted); font-size: 10px; white-space: nowrap; }
.issue-panel { margin: 0; padding: 14px 16px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; background: #fafafa; }
.issue-panel label, #candidateForm label { display: grid; gap: 6px; color: var(--text-strong); font-size: 10px; font-weight: 600; }
.issue-panel select, #candidateForm input, #candidateForm select { width: 100%; min-height: 38px; padding: 0 10px; border: 1px solid var(--border); border-radius: 6px; background: var(--surface); font-size: 11px; }
.issue-panel p { margin: 9px 0; color: var(--text-muted); font-size: 10px; }
.issue-panel ul { margin: 8px 0 0; padding-left: 18px; color: var(--danger); font-size: 10px; }
.candidate-empty { padding: 28px 20px; text-align: center; }
.candidate-empty strong { color: var(--text-strong); font-size: 12px; }
.candidate-empty p { margin: 6px auto 0; max-width: 28ch; color: var(--text-muted); font-size: 10px; }
#candidateForm { gap: 0; }
.candidate-fields { padding: 16px; display: grid; gap: 13px; }
#candidateForm label small { color: var(--text-muted); font-size: 9px; font-weight: 450; line-height: 1.4; }
#candidateForm input[readonly] { color: var(--text-muted); background: #f4f4f5; }
#existingNotice, #ocrEvidence { margin: 0; padding: 9px 10px; border-left: 2px solid #71717a; color: var(--text-muted); background: #f4f4f5; font-size: 9px; }
.correction-tools { padding: 0 16px; border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.correction-tools > div { padding: 0 0 15px; display: grid; gap: 8px; }
.correction-tools .secondary-button, .correction-tools .reject-button { width: 100%; min-height: 38px; }
.editor-sidebar > h3 { margin: 16px 16px 9px; color: var(--text-strong); font-size: 11px; font-weight: 650; }
.candidate-list { max-height: 260px; padding: 0 16px 16px; gap: 3px; }
.candidate-list button { padding: 9px 10px; border: 0; border-bottom: 1px solid var(--border); border-radius: 0; color: var(--text); background: var(--surface); font-size: 10px; }
.candidate-list button:hover { background: var(--surface-hover); }
.candidate-list button.selected { color: var(--text-strong); border-color: var(--border); background: #ededf0; }
.parcel-editor-page button:focus-visible, .candidate-list button:focus-visible { outline: 2px solid #52525b; outline-offset: 2px; }

/* Remove the former green status language from legacy surfaces. */
.available i, .plan-legend i.available, .parcel-marker.available { background: #52525b; }
.parcel-boundary { fill: #52525b; stroke: #d4d4d8; }
.status-badge.available { color: #3f3f46; background: #ededf0; }
.payment-card, .gallery-lightbox { background: #18181b; }
.gallery-lightbox { border-color: #3f3f46; }
.gallery-lightbox::backdrop { background: rgba(9, 9, 11, .92); }
.gallery-lightbox button { border-color: #52525b; background: #27272a; }
.gallery-item, .gallery-manage-item { border-color: var(--border); color: var(--text); }
.gallery-item img, .gallery-manage-item img { background: #ededf0; }
.gallery-item:hover { border-color: var(--border-strong); }
.gallery-item:focus-visible, .gallery-lightbox button:focus-visible { outline-color: #71717a; }
.lightbox-status, .lightbox-help { color: #d4d4d8; }
.plan-approval-badge.approved { color: #3f3f46; background: #ededf0; }
.plan-tools[open] > summary { border-color: #a1a1aa; box-shadow: 0 0 0 3px rgba(39, 39, 42, .1); }
.plan-tools > summary:hover { background: #27272a; }
.transaction-context, .transaction-review { border-color: var(--border); background: #f4f4f5; box-shadow: none; }
.transaction-review dl div { border-color: var(--border); }
.transaction-review p { color: var(--text-muted); }
.workspace-sidebar .stock-stat.active { border-color: #d4d4d8; }
.workspace-sidebar .plan-editor-link { box-shadow: none; }
.data-table th, .data-table tbody tr:hover, .data-table tbody tr:focus-within { background: #f4f4f5; }
.row-action a:hover { color: var(--text-strong); background: #e4e4e7; }
.form-card input:hover, .form-card select:hover, .form-card textarea:hover, .inspector-form input:hover, .inspector-form select:hover, .inspector-form textarea:hover { border-color: #a1a1aa; }
.form-card input:disabled, .form-card select:disabled, .form-card textarea:disabled, .inspector-form input:disabled, .inspector-form select:disabled, .inspector-form textarea:disabled { color: #71717a; background: #ededf0; }
.topbar .brand:focus-visible, .topnav a:focus-visible, .account-menu button:focus-visible, .portfolio-card:focus-visible, .workspace-sidebar .stock-stat:focus-visible { outline-color: #a1a1aa; }
.view-tools button:hover { background: #f4f4f5; }
.view-tools button:active { background: #e4e4e7; }

@media (max-width: 1000px) {
    .parcel-editor-layout { grid-template-columns: minmax(0, 1fr); }
    .editor-sidebar { position: static; max-height: none; }
}
@media (max-width: 700px) {
    .parcel-editor-page { padding: 22px 14px 50px; }
    .editor-flow { display: block; }
    .editor-flow li + li { border-left: 0; border-top: 1px solid var(--border); }
    .parcel-editor-page .editor-heading { align-items: stretch; }
    .parcel-editor-page .editor-heading > button { width: 100%; }
    .draft-bar { align-items: stretch; flex-direction: column; }
    .draft-bar span { margin: 0; }
    .editor-primary-tools > div:first-child { display: grid; }
    .editor-primary-tools .primary-button, .editor-primary-tools .secondary-button { width: 100%; }
    .editor-history-tools { flex-wrap: wrap; }
    .editor-history-tools label { width: 100%; margin: 5px 0 0; }
}
