:root {
    /* AI accent — teal, distinct from the warm brand accent */
    --ai: #0d9488;
    --ai-deep: #0f766e;
    --ai-soft: rgba(13, 148, 136, 0.10);
    --ai-mid: rgba(13, 148, 136, 0.20);
    /* Clean Light Palette */
    --bg: #f5f6f8;
    --bg-secondary: #ffffff;
    --bg-hover: #eef1f5;
    --text: #111826;
    --text-secondary: #5b6675;
    --text-muted: #98a1ad;
    --primary: #1f2937;
    --primary-hover: #111826;
    --on-primary: #ffffff;
    --secondary: #eef1f5;
    --secondary-hover: #e2e6ec;
    --green: #059669;
    --green-hover: #047857;
    --blue: #2563eb;
    --blue-hover: #1d4ed8;
    --red: #dc2626;
    --red-hover: #b91c1c;
    --purple: #7c3aed;
    --purple-hover: #6d28d9;
    --border: #e4e7ec;
    --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.06);
    --shadow: 0 1px 3px rgba(16, 24, 40, 0.08), 0 1px 2px rgba(16, 24, 40, 0.04);
    --shadow-md: 0 4px 8px -2px rgba(16, 24, 40, 0.10), 0 2px 4px -2px rgba(16, 24, 40, 0.06);
    --shadow-lg: 0 12px 24px -6px rgba(16, 24, 40, 0.12), 0 4px 8px -4px rgba(16, 24, 40, 0.08);
    --shadow-xl: 0 24px 48px -12px rgba(16, 24, 40, 0.18), 0 8px 16px -8px rgba(16, 24, 40, 0.10);
    --border-radius: 8px;
    --border-radius-xs: 4px;
    --border-radius-sm: 8px;
    --border-radius-lg: 12px;
    --transition: all 0.3s ease;
    /* Status Tokens — light tint background + saturated foreground */
    --status-inspected-bg: rgba(37, 99, 235, 0.10);
    --status-inspected-fg: #1d4ed8;
    --status-estimating-bg: rgba(124, 58, 237, 0.10);
    --status-estimating-fg: #6d28d9;
    --status-sent-bg: rgba(217, 119, 6, 0.12);
    --status-sent-fg: #b45309;
    --status-approved-bg: rgba(5, 150, 105, 0.12);
    --status-approved-fg: #047857;
    --status-paid-bg: rgba(79, 70, 229, 0.10);
    --status-paid-fg: #4338ca;
    /* Workflow Tokens */
    --workflow-pending: #64748b;
    --workflow-in-progress: #2563eb;
    --workflow-awaiting-repair: #d97706;
    --workflow-awaiting-approval: #059669;
    --workflow-awaiting-payment: #4f46e5;
    --workflow-completed: #4338ca;
}

/* DESIGN.md token aliases — use these names in new code */
:root {
    --background:        var(--bg);
    --surface:           var(--bg-secondary);
    --surface-elevated:  #f3f5f8;
    --on-surface:        var(--text);
    --on-surface-variant: var(--text-secondary);
    --on-surface-muted:  var(--text-muted);
    --positive:          var(--green);
    --positive-hover:    var(--green-hover);
    --negative:          var(--red);
    --negative-hover:    var(--red-hover);
    --info:              var(--blue);
    --info-hover:        var(--blue-hover);
    --special:           var(--purple);
    --special-hover:     var(--purple-hover);
    --rounded-sm:        var(--border-radius-sm);
    --rounded-md:        var(--border-radius-lg);
    --rounded-full:      9999px;
    /* Derived tints — avoids hardcoded rgba() throughout */
    --primary-bg:        rgba(31, 41, 55, 0.06);
    --primary-tint:      rgba(31, 41, 55, 0.10);
    --negative-tint:     rgba(220, 38, 38, 0.12);
    --positive-tint:     rgba(5, 150, 105, 0.12);
    --special-tint:      rgba(124, 58, 237, 0.12);
    --overlay:           rgba(17, 24, 38, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Inter', system-ui, sans-serif;
    color: var(--text);
    background:
        radial-gradient(1200px 600px at 80% -200px, rgba(31, 41, 55, 0.04), transparent 60%),
        radial-gradient(900px 500px at -200px 30%, rgba(13, 148, 136, 0.04), transparent 60%),
        var(--bg);
    line-height: 1.5;
    color-scheme: light;
}

.hidden {
    display: none !important;
}

/* Header / Topbar */
.app-header {
    background: rgba(255, 255, 255, 0.85);
    border-bottom: 1px solid var(--border);
    backdrop-filter: blur(20px);
    position: sticky;
    top: 0;
    z-index: 50;
}

.topbar__inner {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    height: 64px;
}

.topbar__brand {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.topbar__logo {
    width: 36px;
    height: 36px;
    border-radius: var(--border-radius-sm);
    display: block;
}

.topbar__title {
    font-size: 15px;
    font-weight: 700;
    line-height: 1.1;
    color: var(--text);
}

.topbar__sub {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-top: 2px;
}

.topbar__nav {
    display: flex;
    gap: 4px;
    margin-left: 16px;
}

.topbar__navbtn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: var(--border-radius-sm);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    background: none;
    border: none;
    cursor: pointer;
    transition: all 0.15s;
}

.topbar__navbtn:hover {
    color: var(--text);
    background: var(--surface);
}

.topbar__navbtn.active {
    color: var(--text);
    background: var(--surface-elevated);
}

.topbar__navbtn--icon {
    width: 36px;
    padding: 0;
    justify-content: center;
}

.topbar__spacer {
    flex: 1;
}

.topbar__search {
    display: flex;
    align-items: center;
    gap: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    padding: 8px 12px;
    width: 300px;
    color: var(--text-secondary);
    font-size: 13px;
    flex-shrink: 0;
}

.topbar__search input {
    background: transparent;
    border: 0;
    outline: 0;
    color: var(--text);
    flex: 1;
    min-width: 0;
    font-size: 13px;
    font-family: inherit;
}

.topbar__search input::placeholder {
    color: var(--text-muted);
}

.topbar__search kbd {
    font: 600 10px/1 'JetBrains Mono', ui-monospace, monospace;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 3px 5px;
    color: var(--text-muted);
    flex-shrink: 0;
}

/* Legacy nav-btn kept for modals that reference it */
.nav-btn {
    background: none;
    border: 1px solid transparent;
    cursor: pointer;
    padding: 8px 14px;
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    font-weight: 500;
    font-size: 13px;
    transition: 0.25s;
    border-radius: var(--border-radius-sm);
}

.nav-btn:hover {
    background-color: var(--bg-hover);
    color: var(--text);
}

.nav-icon {
    font-size: 16px;
}

/* Buttons */
.btn-primary, .btn-secondary, .btn-danger {
    cursor: pointer;
    border: none;
    font-weight: 600;
    border-radius: var(--border-radius-sm);
    transition: var(--transition);
}

.btn-primary {
    background: var(--primary);
    color: var(--on-primary);
    padding: 10px 20px;
    font-size: 13px;
}

.btn-primary:hover {
    background: var(--primary-hover);
}

.btn-secondary {
    background: var(--secondary);
    border: 1px solid var(--border);
    color: var(--text);
    padding: 8px 14px;
    font-size: 13px;
}

.btn-secondary:hover {
    background: var(--secondary-hover);
    color: var(--text);
}

.btn-danger {
    background: var(--red);
    color: var(--text);
    padding: 10px 16px;
    font-size: 13px;
}

.btn-danger:hover {
    background: var(--red-hover);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* Search Bar */
.search-bar {
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
}

.search-bar input {
    width: 100%;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    padding: 8px 12px;
    font-size: 14px;
    border-radius: var(--border-radius-sm);
}

.search-bar input::placeholder {
    color: var(--text-muted);
}

.search-bar input:focus {
    background-color: var(--bg-hover);
    border-color: var(--primary);
    outline: none;
}

/* Stats Bar */
.stats-bar {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 18px 20px;
    display: flex;
    flex-direction: column;
    transition: border-color 0.15s;
}

.stat-card:hover {
    border-color: var(--primary);
}

.stat--hero {
    background: linear-gradient(135deg, var(--surface) 0%, var(--surface-elevated) 100%);
}

.stat-label {
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.stat-value {
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
    color: var(--text);
}

.stat--hero .stat-value {
    color: var(--primary);
}

.stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Dashboard wrapper */
.dashboard {
    max-width: 1800px;
    margin: 0 auto;
    padding: 24px 24px 80px;
}

.dash__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 20px;
}

.dash__title {
    font-size: 24px;
    font-weight: 700;
    letter-spacing: -0.02em;
    line-height: 1.1;
}

.dash__hint {
    color: var(--text-secondary);
    font-size: 13px;
    margin-top: 4px;
}

/* Section header */
.section-h {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 0 0 14px;
}

.section-h__title {
    font-size: 15px;
    font-weight: 700;
}

.section-h__hint {
    color: var(--text-secondary);
    font-size: 12px;
}

/* Dashboard two-column grid (kanban + inbox) */
.dash__grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 24px;
    align-items: start;
}

/* ===== Job board (card grid + status filter) ===== */
.board__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.jobfilter {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 2px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.jobfilter::-webkit-scrollbar { display: none; }
.jobfilter__btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 34px;
    padding: 0 14px;
    border: 1px solid var(--border);
    border-radius: var(--rounded-full);
    background: var(--surface);
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 600;
    font-family: inherit;
    white-space: nowrap;
    cursor: pointer;
    transition: all 0.15s;
}
.jobfilter__btn:hover { border-color: var(--border-strong); color: var(--text); }
.jobfilter__btn.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--on-primary);
}
.jobfilter__count {
    font-size: 11px;
    font-weight: 700;
    padding: 1px 7px;
    border-radius: var(--rounded-full);
    background: var(--surface-elevated);
    color: var(--text-secondary);
}
.jobfilter__btn.is-active .jobfilter__count {
    background: rgba(255, 255, 255, 0.22);
    color: #fff;
}
.jobfilter__dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.job-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
    align-items: start;
}
.job-empty {
    text-align: center;
    color: var(--text-muted);
    padding: 56px 20px;
    font-size: 14px;
}
.kcard__badges { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }

/* ===== AI auto-draft callout (estimate) ===== */
.autodraft {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-wrap: wrap;
    background: var(--ai-soft);
    border: 1px solid var(--ai-mid);
    border-radius: var(--rounded-md);
    padding: 14px 16px;
    margin: 10px 0 16px;
}
.autodraft__txt { display: flex; flex-direction: column; gap: 3px; min-width: 220px; flex: 1; }
.autodraft__txt strong {
    display: flex; align-items: center; gap: 6px;
    font-size: 13px; font-weight: 700; color: var(--ai-deep);
}
.autodraft__txt strong svg { width: 13px; height: 13px; }
.autodraft__txt span { font-size: 12px; color: var(--text-secondary); line-height: 1.45; }
.autodraft .btn--ai { flex-shrink: 0; }
.scope-paste { margin: 0 0 12px; }
.scope-paste textarea { width: 100%; resize: vertical; font-family: inherit; line-height: 1.5; }

/* Main Content */
.main-content {
    display: block;
}

/* Status dot colors — used by the job board's status filter bar
   (.jobfilter__dot provides the 8px circle shape; these set the color). */
.dot-pending   { background: var(--status-inspected-fg); }
.dot-progress  { background: var(--status-estimating-fg); }
.dot-repair    { background: var(--status-sent-fg); }
.dot-approval  { background: var(--status-approved-fg); }
.dot-completed { background: var(--status-paid-fg); }

/* Ollama status classes */
.ollama-online  { color: var(--green); }
.ollama-offline { color: var(--red); }

/* List View */
.list-view {
    width: 100%;
    overflow-y: auto;
    height: 100%;
}

.list-table {
    width: 100%;
    border-collapse: collapse;
}

.list-header {
    position: sticky;
    top: 0;
    z-index: 1;
    display: flex;
    padding: 8px 16px;
    border-bottom: 1px solid var(--border);
    background: var(--bg-secondary);
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.list-row {
    display: flex;
    padding: 12px 16px;
    border-bottom: 1px solid var(--border);
    cursor: pointer;
    transition: var(--transition);
}

.list-row:hover {
    background-color: var(--bg-hover);
}

.list-cell {
    flex: 1;
    font-size: 13px;
}

.list-cell a {
    color: var(--blue);
    text-decoration: none;
    font-weight: 500;
}

.list-cell a:hover {
    text-decoration: underline;
}

.list-cell .subtext {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

/* Status Badges - DESIGN.md colors */
.status-badge {
    padding: 4px 8px;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 600;
    display: inline-block;
    align-items: center;
    gap: 4px;
    justify-content: center;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

/* 5 status states using DESIGN.md palette */
.status-badge.inspected,
.status-inspected {
    background-color: var(--status-inspected-bg);
    color: var(--status-inspected-fg);
}

.status-badge.estimating,
.status-estimating {
    background-color: var(--status-estimating-bg);
    color: var(--status-estimating-fg);
}

.status-badge.sent,
.status-sent {
    background-color: var(--status-sent-bg);
    color: var(--status-sent-fg);
}

.status-badge.approved,
.status-approved {
    background-color: var(--status-approved-bg);
    color: var(--status-approved-fg);
}

.status-badge.paid,
.status-paid {
    background-color: var(--status-paid-bg);
    color: var(--status-paid-fg);
}

.status-select {
    display: flex;
    gap: 8px;
    margin-top: 8px;
    flex-wrap: wrap;
}

.status-btn {
    padding: 6px 12px;
    border: 1px solid var(--border);
    background: var(--bg);
    color: var(--text);
    cursor: pointer;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 500;
    transition: var(--transition);
}

.status-btn:hover {
    background: var(--bg-hover);
}

.status-btn.active {
    background: var(--primary);
    color: var(--on-primary);
    border-color: var(--primary);
}

/* Form Inputs */
.form-input {
    width: 100%;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    transition: var(--transition);
    background: var(--bg);
    color: var(--text);
}

.form-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-tint);
}

.form-row {
    margin-bottom: 12px;
}

.form-row label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

/* Photo Gallery */
.photo-gallery {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.photo-wrapper {
    position: relative;
    aspect-ratio: 1;
    border-radius: var(--border-radius);
    overflow: hidden;
    border: 1px solid var(--border);
    background: var(--bg-hover);
}

.photo-wrapper img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.photo-wrapper::before {
    content: '📷 Image';
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    background: var(--bg-secondary);
    opacity: 0;
    transition: opacity 0.2s;
}

.photo-wrapper:hover::before {
    opacity: 0.15;
}

.photo-overlay {
    position: absolute;
    inset: 0;
    background: var(--overlay);
    opacity: 0;
    transition: opacity 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.photo-wrapper:hover .photo-overlay {
    opacity: 1;
}

.photo-remove-btn {
    background: var(--red);
    color: white;
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.photo-remove-btn:hover {
    background: var(--red-hover);
}

.photo-number-badge {
    position: absolute;
    top: 6px;
    left: 6px;
    background: var(--overlay);
    color: white;
    font-size: 11px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 999px;
    pointer-events: none;
    z-index: 1;
}

/* Drop Zone */
.photo-drop-zone {
    border: 2px dashed var(--border);
    border-radius: var(--border-radius);
    padding: 32px;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    margin-top: 12px;
}

.photo-drop-zone:hover {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.photo-drop-zone.drag-over {
    border-color: var(--primary);
    background: var(--primary-tint);
}

/* Estimate Builder */
.estimate-header-row {
    display: grid;
    grid-template-columns: 2fr 80px 80px 80px 80px 40px;
    gap: 8px;
    margin-bottom: 8px;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.estimate-row {
    display: grid;
    grid-template-columns: 2fr 80px 80px 80px 80px 40px;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    align-items: center;
}

.estimate-item-input,
.estimate-unit-input,
.estimate-qty-input,
.estimate-price-input {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 13px;
    background: var(--bg);
    color: var(--text);
    width: 100%;
}

.estimate-item-input:focus,
.estimate-unit-input:focus,
.estimate-qty-input:focus,
.estimate-price-input:focus {
    outline: none;
    border-color: var(--primary);
}

.estimate-add-row {
    display: grid;
    grid-template-columns: 2fr 80px 80px 80px 40px;
    gap: 8px;
    margin-top: 12px;
}

.btn-add-item {
    background: var(--primary);
    color: var(--on-primary);
    border: none;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 14px;
    font-weight: 600;
    padding: 8px 16px;
    display: inline-block;
    margin-top: 12px;
    transition: var(--transition);
}

.btn-add-item:hover {
    background: var(--primary-hover);
}

.btn-remove-item {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 18px;
    padding: 4px;
    color: var(--text-muted);
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.btn-remove-item:hover {
    color: var(--red);
}

/* Comparison Chart */
.comparison-chart {
    margin-top: 24px;
    padding: 16px;
    background: var(--bg-secondary);
    border-radius: var(--border-radius);
}

.chart-bar-group {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.chart-bar-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    min-width: 120px;
}

.chart-bar-container {
    flex: 1;
    background: var(--bg);
    border-radius: var(--border-radius-sm);
    overflow: hidden;
}

.chart-bar {
    height: 32px;
    display: flex;
    align-items: center;
    padding: 0 12px;
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.chart-bar-offer {
    background: var(--blue);
    width: 60%;
}

.chart-bar-estimate {
    background: var(--green);
    width: 80%;
}

/* Gap Alert */
.gap-alert {
    margin-top: 16px;
    padding: 16px;
    background: var(--bg-hover);
    border-radius: var(--border-radius);
    display: flex;
    align-items: center;
    gap: 12px;
}

.gap-amount {
    font-size: 18px;
    font-weight: 700;
    color: var(--red);
}

.gap-label {
    font-size: 14px;
    color: var(--text-secondary);
}

/* Justification */
.justification-text {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 12px;
}

.justification-edit {
    position: relative;
}

.justification-edit textarea {
    width: 100%;
    min-height: 120px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 14px;
    font-family: inherit;
    resize: vertical;
    background: var(--bg);
    color: var(--text);
}

.justification-edit textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.justify-edit {
    display: flex;
    align-items: flex-end;
    gap: 8px;
    margin-top: 8px;
}

/* AI Analysis */
.ai-placeholder {
    padding: 24px;
    border: 1px dashed var(--border);
    border-radius: var(--border-radius);
    text-align: center;
}

.ai-content {
    margin-top: 12px;
}

.ai-badge {
    display: inline-block;
    background: var(--bg-hover);
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 8px;
}

.ai-detectors {
    display: flex;
    gap: 8px;
    margin-top: 12px;
    flex-wrap: wrap;
}

.ai-detectors span {
    padding: 4px 8px;
    border-radius: var(--border-radius-sm);
    background: var(--bg-hover);
    font-size: 12px;
    color: var(--text-secondary);
}

/* Export Actions */
.export-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 12px;
    margin-top: 12px;
}

.btn-export {
    padding: 16px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 12px;
    background: var(--bg-secondary);
    color: var(--text);
}

.btn-export:hover {
    background: var(--bg-hover);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.btn-export span:first-child {
    font-size: 24px;
}

.export-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.export-desc {
    font-size: 12px;
    color: var(--text-muted);
}

/* Detail Panel - now also uses variables for consistency */
.detail-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: var(--overlay);
    display: flex;
    justify-content: flex-end;
    z-index: 1000;
}

.detail-section {
    margin-bottom: 24px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 24px;
}

.detail-section:last-child {
    border-bottom: none;
    padding-bottom: 0;
}

.section-title {
    font-size: 16px;
    font-weight: 600;
    margin-bottom: 12px;
    color: var(--text);
}

.section-subtitle {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin: 16px 0 8px;
}

/* Info Grid */
.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 16px;
}

.info-item {
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
}

.info-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.info-value {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    margin-top: 4px;
}

/* Share Link Modal */
.share-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1100;
}

.share-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    width: min(560px, 94vw);
    padding: 24px;
}

.share-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.share-modal-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
    color: var(--text);
}

.share-modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.share-modal-hint {
    margin: 0;
    font-size: 13px;
    color: var(--text-muted);
}

.share-modal-note {
    margin: 0;
    font-size: 12px;
    color: var(--primary);
}

.share-url-row {
    display: flex;
    gap: 8px;
}

.share-url-input {
    flex: 1;
    font-family: monospace;
    font-size: 12px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* Toast */
.toast {
    position: fixed;
    bottom: 24px;
    right: 24px;
    background: var(--bg);
    color: var(--text);
    padding: 12px 20px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: center;
    gap: 12px;
    z-index: 2000;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.3s ease;
    pointer-events: none;
}

.toast.show {
    opacity: 1;
    transform: translateY(0);
}

.toast-success { background: var(--green); color: white; }
.toast-error { background: var(--red); color: white; }
.toast-info { background: var(--blue); color: white; }

.toast-icon {
    font-size: 16px;
}

.toast-text {
    font-size: 14px;
    font-weight: 500;
}

/* Settings Modal */
.settings-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: var(--overlay);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
}

.settings-modal {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    width: 100%;
    max-width: 520px;
    padding: 24px;
}

.settings-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

.settings-header h3 {
    font-size: 16px;
    font-weight: 700;
    color: var(--text);
}

.settings-body {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.api-key-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    line-height: 1.4;
}

.settings-backup {
    margin-top: 20px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

.backup-label {
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    margin-bottom: 10px;
}

.backup-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

.settings-footer {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    margin-top: 24px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
}

/* Backend Toggle */
.backend-toggle-group {
    display: flex;
    gap: 8px;
}

.backend-toggle-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    background: var(--bg);
    border: 2px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}

.backend-toggle-btn:hover {
    border-color: var(--text-muted);
}

.backend-toggle-btn.active {
    border-color: var(--primary);
    background: var(--primary-bg);
    color: var(--primary);
}

.backend-icon {
    font-size: 16px;
}

.backend-status {
    font-size: 10px;
    font-weight: 400;
    opacity: 0.7;
    margin-left: 4px;
}

/* Model Select Row */
.model-select-row {
    display: flex;
    gap: 8px;
}

.model-select-row select {
    flex: 1;
}

.btn-small {
    padding: 8px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius);
    color: var(--text);
    font-size: 13px;
    cursor: pointer;
    transition: var(--transition);
    white-space: nowrap;
}

.btn-small:hover {
    border-color: var(--primary);
    color: var(--primary);
}

/* AI Status Badge in Header */
.ai-status-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 11px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 12px;
    margin-top: 4px;
}

.ai-status-badge.ollama-online {
    background: var(--positive-tint);
    color: var(--green);
}

.ai-status-badge.ollama-offline {
    background: var(--negative-tint);
    color: var(--red);
}

.ai-status-badge.anthropic {
    background: var(--special-tint);
    color: var(--purple);
}

.btn-loading {
    opacity: 0.65;
    cursor: not-allowed;
    pointer-events: none;
}

/* Utility classes replacing inline styles */
.input-large { font-size: 18px; font-weight: 600; }
.gap-icon { font-size: 24px; }
.drop-zone-icon { font-size: 36px; margin-bottom: 8px; }
.drop-zone-hint { font-size: 14px; color: var(--text-secondary); }
.estimate-total-row { margin-top: 16px; font-size: 18px; font-weight: 600; }
.textarea-justification { min-height: 120px; resize: vertical; }
.repair-items-list { list-style: disc; padding-left: 20px; font-size: 14px; color: var(--text-secondary); margin-top: 12px; }
.estimate-cell-total { font-weight: 600; }
.kanban-card-status { margin-top: 6px; }

/* Photo card: thumbnail + caption */
.photo-card {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.photo-caption-input {
    padding: 4px 8px;
    border: 1px solid var(--border);
    border-radius: var(--rounded-sm);
    background: var(--surface-elevated);
    color: var(--on-surface);
    font-size: 12px;
    font-family: inherit;
    width: 100%;
}

.photo-caption-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* Estimate controls (add + template picker) */
.estimate-controls {
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
    margin-top: 12px;
}

.template-picker-wrapper {
    position: relative;
}

.btn-templates {
    white-space: nowrap;
    font-size: 13px;
}

.template-picker {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    z-index: 200;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--rounded-md);
    padding: 6px;
    min-width: 240px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    box-shadow: var(--shadow-md);
}

.template-option {
    text-align: left;
    padding: 8px 12px;
    background: none;
    border: none;
    border-radius: var(--rounded-sm);
    color: var(--on-surface);
    font-size: 13px;
    cursor: pointer;
    transition: background 0.15s;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 8px;
    width: 100%;
}

.template-option:hover {
    background: var(--surface-elevated);
}

.template-unit {
    color: var(--on-surface-variant);
    font-size: 11px;
    white-space: nowrap;
}

.template-group-label {
    padding: 6px 12px 4px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--primary);
    background: var(--surface);
    border-top: 1px solid var(--border);
    margin-top: 2px;
}
.template-group-label:first-child {
    border-top: none;
    margin-top: 0;
}

/* ACV vs RCV table */
.acv-rcv-table {
    margin-top: 12px;
}

.acv-rcv-row {
    display: grid;
    grid-template-columns: 1fr 90px 110px;
    gap: 8px;
    padding: 8px 0;
    border-bottom: 1px solid var(--border);
    font-size: 13px;
    align-items: center;
}

.acv-rcv-head {
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--on-surface-variant);
    border-bottom: 2px solid var(--border);
}

.acv-rcv-qty {
    color: var(--on-surface-variant);
    font-size: 12px;
}

.acv-rcv-amount {
    font-weight: 600;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

.acv-rcv-empty {
    padding: 16px 0;
    color: var(--on-surface-muted);
    font-size: 13px;
    font-style: italic;
}

.acv-rcv-totals {
    margin-top: 8px;
    padding: 12px 16px;
    background: var(--surface-elevated);
    border-radius: var(--rounded-md);
}

.acv-rcv-total-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    font-size: 14px;
    border-bottom: 1px solid var(--border);
}

.acv-rcv-total-row:last-child {
    border-bottom: none;
}

.acv-rcv-total-rcv {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
}

.acv-rcv-total-acv {
    font-weight: 600;
    color: var(--info);
    font-variant-numeric: tabular-nums;
}

.acv-rcv-gap-row {
    font-weight: 700;
}

.gap-positive {
    color: var(--negative);
    font-variant-numeric: tabular-nums;
}

.gap-negative {
    color: var(--positive);
    font-variant-numeric: tabular-nums;
}

.acv-rcv-no-offer {
    padding: 10px 0;
    color: var(--on-surface-muted);
    font-size: 13px;
    font-style: italic;
}

/* ===== Header & Kanban Badges ===== */
.header-overdue-badge {
    background: var(--negative-tint);
    color: var(--negative);
    font-size: 10px;
    font-weight: 700;
    padding: 3px 8px;
    border-radius: var(--rounded-full);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.kanban-overdue-badge {
    display: inline-block;
    background: var(--negative-tint);
    color: var(--negative);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--rounded-full);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 4px;
    vertical-align: middle;
}

.kanban-dep-badge {
    display: inline-block;
    background: var(--primary-tint);
    color: var(--primary);
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--rounded-full);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 4px;
    vertical-align: middle;
}

/* ===== Kanban Gap Badge ===== */
.kanban-gap-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: var(--rounded-full);
    margin-top: 6px;
    display: inline-block;
}
.kanban-gap-open {
    background: var(--negative-tint);
    color: var(--negative);
}
.kanban-gap-covered {
    background: var(--positive-tint);
    color: var(--positive);
}

/* ===== Depreciation Calculator ===== */
.dep-calc-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--rounded);
    padding: 14px 16px;
    margin-top: 12px;
}
.dep-calc-title {
    font-size: 12px;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-bottom: 10px;
}
.dep-calc-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 10px;
}
.dep-calc-item { display: flex; flex-direction: column; gap: 2px; }
.dep-calc-label { font-size: 11px; color: var(--text-muted); }
.dep-calc-value { font-size: 15px; font-weight: 700; color: var(--text); }
.dep-calc-positive { color: var(--positive); }
.dep-calc-deadline { color: var(--primary); }
.dep-calc-warning {
    margin-top: 10px;
    font-size: 12px;
    color: var(--negative);
    background: var(--negative-tint);
    border-radius: var(--rounded-sm);
    padding: 6px 10px;
    font-weight: 600;
}

/* ===== Supplement Rounds ===== */
.supp-round-card {
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: var(--rounded);
    padding: 14px 16px;
    margin-bottom: 12px;
}
.supp-round-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 10px;
    flex-wrap: wrap;
}
.supp-round-num {
    font-size: 13px;
    font-weight: 700;
    color: var(--primary);
    white-space: nowrap;
}
.supp-round-date { max-width: 140px; }
.supp-round-status-sel { max-width: 160px; }
.supp-round-amounts {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px;
    margin-bottom: 10px;
}
.supp-round-field { display: flex; flex-direction: column; gap: 4px; }
.supp-round-field label { font-size: 11px; color: var(--text-muted); font-weight: 600; }
.supp-round-narrative { min-height: 60px; resize: vertical; }

/* ===== NOAA Button ===== */
.btn-noaa {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 14px;
    background: var(--primary-tint);
    color: var(--primary);
    border: 1px solid var(--primary);
    border-radius: var(--rounded);
    font-size: 12px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.15s;
}
.btn-noaa:hover { background: var(--gold-mid); }

/* ===== Overdue Indicators ===== */
.overdue-text {
    color: var(--negative);
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    margin-left: 6px;
}

.input-overdue {
    border-color: var(--negative) !important;
    color: var(--negative);
}

.input-overdue:focus {
    box-shadow: 0 0 0 3px var(--negative-tint) !important;
}

/* ===== Field Hint ===== */
.field-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 4px;
    line-height: 1.4;
}

/* ===== Checkbox Label ===== */
.checkbox-label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    margin-top: 6px;
}

.checkbox-label input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--primary);
    cursor: pointer;
}

/* ===== Roof Squares Display ===== */
.roof-squares-display {
    font-size: 18px;
    font-weight: 600;
    color: var(--text);
    padding: 6px 0;
}

/* ===== Estimate Row with Code Column (7-col) ===== */
.estimate-row-with-code {
    grid-template-columns: 90px 2fr 80px 80px 80px 80px 40px !important;
}

.estimate-code-input {
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    font-size: 12px;
    font-family: ui-monospace, 'Cascadia Code', monospace;
    background: var(--bg);
    color: var(--text-muted);
    width: 100%;
}

.estimate-code-input:focus {
    outline: none;
    border-color: var(--primary);
    color: var(--text);
}

/* Adjuster Add Button — styled differently from primary add */
.btn-add-adj {
    background: var(--secondary);
    color: var(--text);
    border: 1px solid var(--border);
}

.btn-add-adj:hover {
    background: var(--secondary-hover);
}

/* ===== ACV/RCV 3-Column Comparison ===== */
.acv-rcv-3col {
    grid-template-columns: 1fr 110px 110px !important;
}

.row-missing {
    background: var(--negative-tint);
    border-radius: var(--border-radius-xs);
}

.missing-badge {
    display: inline-block;
    background: var(--negative);
    color: white;
    font-size: 9px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: var(--rounded-full);
    text-transform: uppercase;
    letter-spacing: 0.4px;
    vertical-align: middle;
    margin-left: 4px;
}

.amount-none {
    color: var(--text-muted);
    font-weight: 400;
}

/* ===== Communication Log ===== */
.comm-add-row {
    display: flex;
    gap: 8px;
    align-items: center;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.comm-date-input {
    flex: 0 0 140px;
}

.comm-note-input {
    flex: 1;
    min-width: 180px;
}

.comm-entry {
    padding: 10px 12px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-sm);
    margin-bottom: 8px;
}

.comm-meta {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.comm-date {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.4px;
}

.comm-note {
    font-size: 13px;
    color: var(--text);
    line-height: 1.5;
}

.comm-empty {
    padding: 16px;
    text-align: center;
    color: var(--text-muted);
    font-size: 13px;
    font-style: italic;
}

.comm-delete {
    font-size: 14px;
    padding: 2px 4px;
}

/* ===== Photo Overlay Actions ===== */
.photo-overlay-actions {
    display: flex;
    gap: 8px;
    align-items: center;
    justify-content: center;
}

.photo-action-btn {
    background: var(--overlay);
    border: none;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.15s;
    backdrop-filter: blur(4px);
}

.photo-action-btn:hover {
    background: var(--bg-hover);
    transform: scale(1.1);
}

.photo-action-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

/* AI analysis result below caption */
.photo-analysis {
    font-size: 11px;
    color: var(--text-muted);
    line-height: 1.4;
    padding: 4px 6px;
    background: var(--bg);
    border-left: 2px solid var(--primary);
    border-radius: 0 var(--border-radius-xs) var(--border-radius-xs) 0;
    margin-top: 4px;
    font-style: italic;
}

/* ===== AI damage findings ===== */
.evidence__head {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}
.photo-analyze-hint {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 6px;
}
.photo-analysis--ai {
    font-style: normal;
    background: var(--ai-soft);
    border-left: 2px solid var(--ai);
    color: var(--text-secondary);
    padding: 8px 10px;
}
.photo-analysis__h {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--ai-deep);
    margin-bottom: 6px;
}
.photo-analysis__h svg { width: 11px; height: 11px; }
.photo-analysis__body { font-size: 11.5px; color: var(--text); line-height: 1.45; }
.finding-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-bottom: 6px;
}
.finding-chip {
    font-size: 10px;
    font-weight: 600;
    padding: 2px 7px;
    border-radius: var(--rounded-full);
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-secondary);
    text-transform: capitalize;
}
.finding-chip--type { background: var(--surface-elevated); color: var(--text); }
.sev--severe { background: var(--negative-tint); color: var(--negative); border-color: transparent; }
.sev--moderate { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.sev--minor { background: var(--positive-tint); color: var(--positive); border-color: transparent; }
.conf--high { background: var(--positive-tint); color: var(--positive); border-color: transparent; }
.conf--medium { background: var(--warn-soft); color: var(--warn); border-color: transparent; }
.conf--low { background: var(--negative-tint); color: var(--negative); border-color: transparent; }
.photo-analysis__caveat {
    margin-top: 6px;
    font-size: 11px;
    color: var(--warn);
    background: var(--warn-soft);
    border-radius: var(--border-radius-xs);
    padding: 4px 8px;
}

/* ===== Public read-only share view ===== */
.shared-view {
    max-width: 860px;
    margin: 0 auto;
    padding: 32px 20px 64px;
}
.shared-head {
    display: flex;
    align-items: center;
    gap: 12px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 24px;
}
.shared-logo { width: 40px; height: 40px; border-radius: var(--r-sm); }
.shared-co { font-size: 15px; font-weight: 700; }
.shared-doc {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.shared-title { font-size: 26px; font-weight: 800; letter-spacing: -0.01em; }
.shared-sub { color: var(--text-secondary); font-size: 13px; margin-top: 4px; }
.shared-nums {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 12px;
    margin: 20px 0;
}
.shared-num {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px 16px;
}
.shared-num span {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    color: var(--text-secondary);
}
.shared-num strong { font-size: 20px; font-variant-numeric: tabular-nums; }
.shared-num--gap strong { color: var(--negative); }
.shared-h2 {
    font-size: 14px;
    font-weight: 700;
    margin: 28px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1px solid var(--border);
}
.shared-table { width: 100%; border-collapse: collapse; font-size: 13px; background: var(--surface); }
.shared-table th {
    text-align: left;
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--text-secondary);
    padding: 8px;
    border-bottom: 1px solid var(--border);
}
.shared-table td { padding: 8px; border-bottom: 1px solid var(--border); }
.shared-narrative {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 16px 18px;
    font-size: 13.5px;
    line-height: 1.7;
    white-space: pre-wrap;
}
.shared-photos {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 16px;
}
.shared-photo img {
    width: 100%;
    border-radius: var(--r-sm);
    border: 1px solid var(--border);
    display: block;
}
.shared-photo__cap { font-size: 12px; margin-top: 6px; }
.shared-photo__analysis { font-size: 11px; color: var(--text-secondary); margin-top: 3px; line-height: 1.45; }
.shared-foot {
    margin-top: 32px;
    padding-top: 12px;
    border-top: 1px solid var(--border);
    font-size: 12px;
    color: var(--text-muted);
}
@media (max-width: 640px) { .shared-nums { grid-template-columns: 1fr; } }

/* ===== Advanced disclosure (Settings) ===== */
.adv-disclosure {
    border-top: 1px solid var(--border);
    margin-top: 8px;
    padding-top: 8px;
}
.adv-disclosure > summary {
    cursor: pointer;
    list-style: none;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    padding: 8px 0;
    user-select: none;
}
.adv-disclosure > summary::-webkit-details-marker { display: none; }
.adv-disclosure > summary::before { content: '▸ '; color: var(--text-muted); }
.adv-disclosure[open] > summary::before { content: '▾ '; }
.adv-disclosure > summary:hover { color: var(--text); }

/* ===== Annotation Modal ===== */
.annotation-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.annotation-modal {
    display: flex;
    flex-direction: column;
    gap: 12px;
    max-width: 100%;
    max-height: 100%;
}

.annotation-toolbar {
    display: flex;
    align-items: center;
    gap: 16px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--border-radius-lg);
    padding: 10px 16px;
    flex-wrap: wrap;
}

.ann-tools {
    display: flex;
    gap: 4px;
}

.ann-tool {
    width: 36px;
    height: 36px;
    background: none;
    border: 2px solid transparent;
    border-radius: var(--border-radius-sm);
    cursor: pointer;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: border-color 0.15s, background 0.15s;
}

.ann-tool:hover {
    background: var(--bg-hover);
}

.ann-tool.active {
    border-color: var(--primary);
    background: var(--primary-bg);
}

.ann-colors {
    display: flex;
    gap: 6px;
    align-items: center;
}

.ann-color {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: 2px solid transparent;
    cursor: pointer;
    transition: border-color 0.15s, transform 0.15s;
    padding: 0;
}

.ann-color[data-color="#ef4444"] { background: #ef4444; }
.ann-color[data-color="#fbbf24"] { background: #fbbf24; }
.ann-color[data-color="#ffffff"] { background: #ffffff; box-shadow: inset 0 0 0 1px var(--border); }
.ann-color[data-color="#3b82f6"] { background: #3b82f6; }

.ann-color:hover {
    transform: scale(1.15);
}

.ann-color.active {
    border-color: var(--text);
    transform: scale(1.15);
}

.ann-actions {
    display: flex;
    gap: 8px;
    margin-left: auto;
    flex-wrap: wrap;
}

.annotation-canvas-wrapper {
    overflow: auto;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 160px);
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--border-radius-lg);
    border: 1px solid var(--border);
    background: #000;
}

#annotation-canvas {
    display: block;
    cursor: crosshair;
    max-width: 100%;
    touch-action: none;
}

/* Responsive */
@media (max-width: 1280px) {
    .dash__grid {
        grid-template-columns: 1fr;
    }
    .inbox {
        position: relative;
        top: 0;
    }
}

@media (max-width: 900px) {
    .stats-bar {
        grid-template-columns: repeat(2, 1fr);
    }
    .kanban {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    .topbar__inner {
        padding: 0 16px;
        gap: 8px;
        flex-wrap: wrap;
        height: auto;
        padding-top: 10px;
        padding-bottom: 10px;
    }

    .topbar__brand {
        flex: 1 0 auto;
    }

    .topbar__spacer {
        display: none;
    }

    .topbar__search {
        width: 100%;
        order: 3;
        flex-basis: 100%;
    }

    .topbar__search kbd {
        display: none;
    }

    .dashboard {
        padding: 16px 16px 60px;
    }

    .stats-bar {
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    .kanban {
        grid-template-columns: 1fr;
    }

    .kanban-column, .kcol {
        min-height: 0;
    }

    .list-header {
        display: none;
    }

    .list-row {
        flex-direction: column;
        gap: 4px;
    }

    .detail-panel {
        max-width: 100%;
    }

    .info-grid {
        grid-template-columns: 1fr;
    }

    .estimate-header-row,
    .estimate-row,
    .estimate-add-row {
        grid-template-columns: 1fr;
    }

    .export-actions {
        grid-template-columns: 1fr;
    }

    .detail-actions {
        flex-direction: column;
    }

    .detail-actions button {
        width: 100%;
    }

    .detail-tabs {
        gap: 2px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 4px;
    }

    .detail-tab-btn {
        padding: 8px 10px;
        font-size: 12px;
        white-space: nowrap;
        flex-shrink: 0;
    }

    .estimate-row-with-code {
        grid-template-columns: 1fr !important;
    }

    .photo-gallery {
        grid-template-columns: repeat(2, 1fr);
    }

    .code-upgrade-item {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }

    .btn-upgrade-add {
        width: 100%;
    }

    .acv-rcv-3col {
        grid-template-columns: 1fr 80px 80px !important;
    }

    .comm-add-row {
        flex-direction: column;
    }

    .comm-date-input {
        flex: none;
        width: 100%;
    }
}

/* ===== Code Upgrade Checklist ===== */
.code-upgrade-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 8px;
}

.code-upgrade-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    background: var(--surface-elevated);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}

.code-upgrade-info {
    flex: 1;
    min-width: 0;
}

.code-upgrade-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text);
}

.code-upgrade-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.btn-upgrade-add {
    flex-shrink: 0;
    background: var(--surface);
    color: var(--primary);
    border: 1px solid var(--primary);
    font-weight: 700;
}

.btn-upgrade-add:hover {
    background: var(--primary);
    color: var(--on-primary);
}

/* O&P auto-calculated row highlight */
.oap-item {
    color: var(--primary) !important;
    font-weight: 600;
    background: transparent !important;
}

.oap-total {
    color: var(--primary);
    font-weight: 700;
}

/* ============================================================
   Gap Finder Design System v2 — canonical token names
   ============================================================ */
:root {
    --surface-2:      #f3f5f8;
    --surface-3:      #eaedf2;
    --border-strong:  #d3d8e0;
    --fg:             var(--text);
    --fg-variant:     var(--text-secondary);
    --fg-muted:       var(--text-muted);
    --gold:           var(--primary);
    --gold-hover:     var(--primary-hover);
    --gold-soft:      rgba(31, 41, 55, 0.07);
    --gold-mid:       rgba(31, 41, 55, 0.14);
    --on-gold:        #ffffff;
    --positive-soft:  rgba(5, 150, 105, 0.12);
    --negative-soft:  rgba(220, 38, 38, 0.12);
    --warn:           #d97706;
    --warn-soft:      rgba(217, 119, 6, 0.14);
    --info-soft:      rgba(37, 99, 235, 0.12);
    --status-inspected:  #2563eb;
    --status-estimating: #7c3aed;
    --status-sent:       #d97706;
    --status-approved:   #059669;
    --status-paid:       #4f46e5;
    --r-xs:   4px;
    --r-sm:   8px;
    --r-md:   12px;
    --r-lg:   16px;
    --r-full: 9999px;
    --shadow-card: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 24px -12px rgba(16, 24, 40, 0.10);
    --focus-ring:  0 0 0 3px rgba(31, 41, 55, 0.18);
    --header-h:    64px;
}

/* ============================================================
   Unified button system (.btn)
   ============================================================ */
.btn {
    display: inline-flex; align-items: center; gap: 8px;
    height: 36px; padding: 0 14px;
    font-size: 13px; font-weight: 600;
    border-radius: var(--r-sm);
    background: var(--surface-2);
    color: var(--fg);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    font-family: inherit;
    text-decoration: none;
}
.btn:hover { background: var(--surface-3); border-color: var(--border-strong); color: var(--fg); }
.btn--primary { background: var(--gold); color: var(--on-gold); border-color: transparent; }
.btn--primary:hover { background: var(--gold-hover); color: var(--on-gold); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--fg-variant); }
.btn--ghost:hover { background: var(--surface); color: var(--fg); border-color: transparent; }
.btn--ai { background: var(--ai-soft); color: var(--ai); border: 1px solid var(--ai-mid); }
.btn--ai:hover { background: var(--ai-mid); }
.btn--danger { background: var(--negative-soft); color: var(--negative); border-color: transparent; }
.btn--sm { height: 28px; padding: 0 10px; font-size: 12px; }
.btn--lg { height: 44px; padding: 0 20px; font-size: 14px; }
.btn--icon { width: 36px; padding: 0; justify-content: center; }

/* ============================================================
   Chip + status badge system
   ============================================================ */
.chip {
    display: inline-flex; align-items: center; gap: 6px;
    height: 22px; padding: 0 8px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.04em;
    text-transform: uppercase;
    border-radius: var(--r-full);
    background: var(--surface-2);
    color: var(--fg-variant);
}
.chip--gold { background: var(--gold-soft); color: var(--gold); }
.chip--ai   { background: var(--ai-soft);   color: var(--ai); }
.chip--pos  { background: var(--positive-soft); color: var(--positive); }
.chip--neg  { background: var(--negative-soft); color: var(--negative); }
.chip--warn { background: var(--warn-soft);  color: var(--warn); }
.chip__dot  { width: 6px; height: 6px; border-radius: 50%; background: currentColor; animation: pulse 2s infinite; }

.dp-status {
    display: inline-flex; align-items: center; gap: 6px;
    height: 24px; padding: 0 10px;
    font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    border-radius: var(--r-full);
}
.dp-status--inspected  { background: rgba(96,165,250,0.15);  color: var(--status-inspected); }
.dp-status--estimating { background: rgba(167,139,250,0.15); color: var(--status-estimating); }
.dp-status--sent       { background: rgba(251,191,36,0.15);  color: var(--status-sent); }
.dp-status--approved   { background: rgba(52,211,153,0.15);  color: var(--status-approved); }
.dp-status--paid       { background: rgba(129,140,248,0.15); color: var(--status-paid); }

/* ============================================================
   Kanban card v2 (.kcard)
   ============================================================ */
.kcard {
    background: var(--surface-2);
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: 14px;
    cursor: pointer;
    transition: transform 0.18s cubic-bezier(0.4,0,0.2,1), box-shadow 0.18s, border-color 0.18s;
    position: relative;
    overflow: hidden;
}
.kcard::before {
    content: ''; position: absolute; inset: 0 0 auto 0; height: 2px;
    background: var(--accent, var(--border)); opacity: 0;
    transition: opacity 0.2s;
}
.kcard:hover { transform: translateY(-2px); box-shadow: var(--shadow-card); border-color: var(--border-strong); }
.kcard:hover::before { opacity: 1; }
.kcard__row { display: flex; align-items: flex-start; justify-content: space-between; gap: 8px; }
.kcard__name { font-size: 14px; font-weight: 700; line-height: 1.25; }
.kcard__addr { color: var(--fg-variant); font-size: 12px; margin-top: 2px; }
.kcard__meta { display: flex; align-items: center; gap: 8px; margin-top: 10px; flex-wrap: wrap; }
.kcard__money { font-size: 18px; font-weight: 700; margin-top: 10px; letter-spacing: -0.01em; font-variant-numeric: tabular-nums; }
.kcard__money small { font-size: 11px; color: var(--fg-muted); font-weight: 500; margin-left: 6px; text-transform: uppercase; letter-spacing: 0.04em; }
.kcard__bar { height: 4px; border-radius: 2px; background: var(--surface-3); margin-top: 10px; overflow: hidden; display: flex; }
.kcard__bar > span { display: block; height: 100%; }
.kcard__bar .acv-seg { background: var(--fg-muted); }
.kcard__bar .gap-seg { background: var(--gold); }
.kcard__barlbl { display: flex; justify-content: space-between; font-size: 10px; color: var(--fg-muted); margin-top: 4px; text-transform: uppercase; letter-spacing: 0.04em; }
.kcard__barlbl .lbl-gap { color: var(--gold); }
.kcard__ai {
    margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--border);
    display: flex; align-items: center; gap: 6px; color: var(--ai); font-size: 11px; font-weight: 600;
}
.ai-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--ai); box-shadow: 0 0 8px var(--ai); animation: pulse 2s infinite; flex-shrink: 0; }

/* ============================================================
   Detail panel — slide-in overlay (dp system)
   ============================================================ */
.dp-overlay {
    position: fixed; inset: 0;
    background: var(--overlay);
    backdrop-filter: blur(6px);
    z-index: 100;
    display: flex; align-items: stretch; justify-content: flex-end;
}
.dp-overlay.dp-opening { animation: dp-fade 0.2s ease-out both; }
@keyframes dp-fade { from { opacity: 0; } to { opacity: 1; } }

.dp {
    width: min(1320px, 92vw);
    background: var(--bg);
    border-left: 1px solid var(--border);
    display: flex; flex-direction: column;
    height: 100vh;
    overflow: hidden;
}
.dp.dp-opening { animation: dp-slide 0.28s ease-out both; }
@keyframes dp-slide { from { transform: translateX(40px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.dp__head {
    border-bottom: 1px solid var(--border);
    padding: 14px 24px;
    display: flex; align-items: center; gap: 14px;
    background: var(--surface);
    flex-shrink: 0;
}
.dp__head-info { flex: 1; min-width: 0; }
.dp__title { font-size: 17px; font-weight: 700; }
.dp__addr { color: var(--fg-variant); font-size: 12px; margin-top: 2px; }
.dp__head-right { display: flex; align-items: center; gap: 8px; flex-shrink: 0; margin-left: auto; }

.dp__tabs {
    display: flex; gap: 0;
    padding: 0 16px;
    border-bottom: 1px solid var(--border);
    background: var(--surface);
    overflow-x: auto;
    flex-shrink: 0;
    scrollbar-width: none;
}
.dp__tabs::-webkit-scrollbar { display: none; }

.dp__tab {
    padding: 12px 14px;
    font-size: 13px; font-weight: 500;
    color: var(--fg-variant);
    border-bottom: 2px solid transparent;
    display: flex; align-items: center; gap: 8px;
    transition: color 0.15s, border-color 0.15s;
    white-space: nowrap;
    cursor: pointer;
    background: none; border-top: 0; border-left: 0; border-right: 0;
    font-family: inherit;
}
.dp__tab:hover { color: var(--fg); }
.dp__tab.is-active { color: var(--gold); border-bottom-color: var(--gold); }
.dp__tab__badge {
    background: var(--surface-3); color: var(--fg-variant);
    font-size: 10px; padding: 2px 6px; border-radius: var(--r-full); font-weight: 600;
}
.dp__tab.is-active .dp__tab__badge { background: var(--gold-soft); color: var(--gold); }

.dp__body { flex: 1; overflow-y: auto; }
.dp__body::-webkit-scrollbar { width: 8px; }
.dp__body::-webkit-scrollbar-thumb { background: var(--surface-2); border-radius: 4px; }

.dp__pane { display: block; }
.dp__pane.hidden { display: none; }

/* ============================================================
   Brief tab
   ============================================================ */
.brief { padding: 24px; display: grid; grid-template-columns: 1fr 360px; gap: 24px; align-items: start; }
.brief__main { display: flex; flex-direction: column; gap: 16px; }

.brief__hero {
    background:
        radial-gradient(800px 200px at 80% 0%, var(--ai-soft), transparent 60%),
        var(--surface);
    border: 1px solid var(--border); border-radius: var(--r-lg); padding: 24px;
    position: relative; overflow: hidden;
}
.brief__hero::after {
    content: ''; position: absolute; top: 0; right: 0; bottom: 0; width: 4px;
    background: linear-gradient(180deg, var(--ai), transparent);
}
.brief__hero__topline {
    display: flex; align-items: center; gap: 10px; margin-bottom: 14px;
    color: var(--ai); font-size: 12px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase;
}
.brief__hero h2 { font-size: 22px; font-weight: 700; letter-spacing: -0.01em; line-height: 1.25; margin-bottom: 8px; }
.brief__hero .brief-body { color: var(--fg-variant); font-size: 14px; line-height: 1.6; }

.brief__bignums { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
.brief__bignum {
    background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-md); padding: 14px;
}
.brief__bignum__lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-variant); }
.brief__bignum__val { font-size: 22px; font-weight: 700; margin-top: 6px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.brief__bignum__sub { color: var(--fg-muted); font-size: 11px; margin-top: 4px; }
.brief__bignum--gap .brief__bignum__val { color: var(--gold); }

.brief__noai {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg);
    padding: 40px 32px; text-align: center;
}
.brief__noai h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.brief__noai p { color: var(--fg-variant); font-size: 13px; line-height: 1.6; max-width: 46ch; margin: 0 auto 20px; }

.brief__propfields { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; }
.brief__propfields h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-variant); margin-bottom: 16px; }

.brief__rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.rail__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; }
.rail__card h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-variant); margin-bottom: 14px; }
.rail__kv { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.rail__kv:last-child { border-bottom: 0; padding-bottom: 0; }
.rail__kv:first-of-type { padding-top: 0; }
.rail__kv__k { color: var(--fg-variant); font-size: 12px; flex-shrink: 0; }
.rail__kv__v { font-size: 13px; font-weight: 600; text-align: right; word-break: break-word; }

/* Inline citation pills */
.cite {
    color: var(--gold); font-weight: 600; cursor: pointer;
    background: var(--gold-soft); padding: 1px 6px; border-radius: var(--r-xs); font-size: 12px;
    font-family: 'JetBrains Mono', ui-monospace, monospace; display: inline;
}
.cite:hover { background: var(--gold-mid); }

/* ============================================================
   Estimate tab v2 layout (.est)
   ============================================================ */
.est { padding: 24px; display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.est__main { display: flex; flex-direction: column; gap: 16px; }

.gap-viz { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 20px; }
.gap-viz h4 { font-size: 13px; font-weight: 700; margin-bottom: 16px; }
.gap-bar { height: 36px; background: var(--surface-3); border-radius: var(--r-sm); overflow: hidden; margin-bottom: 8px; display: flex; }
.gap-bar__acv { background: var(--fg-muted); display: flex; align-items: center; padding-left: 10px; font-size: 11px; font-weight: 700; color: #222; min-width: 48px; }
.gap-bar__rcv { background: var(--gold); display: flex; align-items: center; justify-content: flex-end; padding-right: 10px; font-size: 11px; font-weight: 700; color: var(--on-gold); flex: 1; }
.gap-legend { display: flex; justify-content: space-between; font-size: 11px; color: var(--fg-variant); margin-bottom: 16px; }
.gap-stats { display: flex; flex-direction: column; }
.gap-stat { display: flex; align-items: baseline; justify-content: space-between; padding: 8px 0; border-bottom: 1px solid var(--border); }
.gap-stat:last-child { border-bottom: 0; }
.gap-stat__k { font-size: 12px; color: var(--fg-variant); }
.gap-stat__v { font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; }
.gap-stat--hero .gap-stat__v { color: var(--gold); font-size: 22px; letter-spacing: -0.02em; }

/* ============================================================
   Supplement tab v2 (.supp)
   ============================================================ */
.supp { padding: 24px; display: grid; grid-template-columns: 1fr 300px; gap: 24px; align-items: start; }
.supp__doc {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md);
    padding: 32px 40px; font-size: 14px; line-height: 1.7;
}
.supp__doc h2 { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 12px; }
.supp__doc h3 { font-size: 13px; font-weight: 700; margin: 22px 0 10px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.06em; }

.supp__rail { display: flex; flex-direction: column; gap: 14px; position: sticky; top: 0; }
.supp__rail__card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; }
.supp__rail__card h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-variant); margin-bottom: 12px; }

.tonebtn {
    padding: 8px 10px; font-size: 12px; font-weight: 600; border-radius: var(--r-sm);
    border: 1px solid var(--border); background: var(--surface-2); color: var(--fg-variant);
    width: 100%; text-align: left; margin-bottom: 6px; transition: all 0.15s; cursor: pointer; font-family: inherit;
}
.tonebtn.is-active { background: var(--ai-soft); color: var(--ai); border-color: var(--ai-mid); }
.tonebtn:hover { color: var(--fg); }
.tonebtn .desc { display: block; font-size: 11px; color: var(--fg-muted); margin-top: 2px; font-weight: 400; }

/* ============================================================
   Export tab v2 (.export-tab)
   ============================================================ */
.export-tab { padding: 24px; display: grid; grid-template-columns: 1fr 380px; gap: 24px; align-items: start; }
.export-preview { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 40px; min-height: 400px; }
.export-options { display: flex; flex-direction: column; gap: 14px; }
.export-opt { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 18px; }
.export-opt h4 { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--fg-variant); margin-bottom: 12px; }
.export-opt .item { display: flex; align-items: center; gap: 10px; padding: 6px 0; cursor: pointer; }
.export-opt .item input { accent-color: var(--gold); }
.export-opt .item label { flex: 1; font-size: 13px; cursor: pointer; }

/* ============================================================
   Activity / comms inside supplement tab
   ============================================================ */
.activity-section { padding: 20px 24px; display: flex; flex-direction: column; gap: 20px; }
.activity-section h4 { font-size: 13px; font-weight: 700; margin-bottom: 12px; }

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 1280px) {
    .brief, .est, .supp, .export-tab { grid-template-columns: 1fr; }
    .brief__rail, .supp__rail { position: relative; }
}
@media (max-width: 900px) {
    .dp { width: 100vw; }
    .dp__head { padding: 12px 16px; }
}
@media (max-width: 640px) {
    /* Detail-panel header: let the action buttons drop to their own line
       instead of crowding the title on a phone. */
    .dp__head { flex-wrap: wrap; row-gap: 8px; }
    .dp__head-right { width: 100%; justify-content: flex-end; }
    /* Reclaim width for forms inside the panes. */
    .brief, .est, .supp, .export-tab { padding: 16px; }
    /* Three big numbers are tight on a narrow phone — give the gap its own row. */
    .brief__bignums { grid-template-columns: 1fr 1fr; }
    .brief__bignum--gap { grid-column: 1 / -1; }
}

/* ── Login screen ─────────────────────────────────────────────────────────── */
.login-overlay {
    position: fixed; inset: 0; z-index: 200;
    background: var(--bg);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.login-overlay.hidden { display: none; }

.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--r-lg);
    box-shadow: var(--shadow-card);
    padding: 40px 36px;
    width: 100%; max-width: 400px;
}
.login-logo {
    width: 52px; height: 52px; border-radius: var(--r-sm);
    display: block; margin: 0 auto 16px;
}
.login-title {
    text-align: center; font-size: 20px; font-weight: 700;
    color: var(--text); margin-bottom: 4px;
}
.login-sub {
    text-align: center; font-size: 13px; color: var(--fg-muted); margin-bottom: 24px;
}
.login-error {
    background: var(--negative-soft); border: 1px solid rgba(239,68,68,0.3);
    border-radius: var(--r-sm); padding: 10px 14px;
    font-size: 13px; color: #f87171; margin-bottom: 16px;
}
.login-field { margin-bottom: 14px; }
.login-field label { display: block; font-size: 12px; font-weight: 600; color: var(--fg-variant); margin-bottom: 6px; }
.login-divider {
    text-align: center; font-size: 12px; color: var(--fg-muted);
    margin: 16px 0 12px; position: relative;
}
.login-divider::before, .login-divider::after {
    content: ''; position: absolute; top: 50%; width: 30%; height: 1px;
    background: var(--border);
}
.login-divider::before { left: 0; }
.login-divider::after  { right: 0; }

/* ── User badge ───────────────────────────────────────────────────────────── */
.user-badge {
    display: flex; align-items: center; gap: 10px;
    padding: 4px 4px 4px 10px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: var(--r-full); flex-shrink: 0;
}
.user-badge__avatar {
    width: 28px; height: 28px; border-radius: 50%;
    background: var(--gold-soft); border: 1px solid var(--gold-mid);
    display: flex; align-items: center; justify-content: center;
    font-size: 11px; font-weight: 700; color: var(--gold); flex-shrink: 0;
}
.user-badge__info { line-height: 1.2; min-width: 0; }
.user-badge__name { font-size: 12px; font-weight: 600; color: var(--text); white-space: nowrap; }
.user-badge__role { font-size: 11px; color: var(--fg-muted); text-transform: capitalize; }

/* ===== App footer — Conard Technologies licensing credit ===== */
.app-footer { display: flex; align-items: center; justify-content: center; gap: 8px; flex-wrap: wrap; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); margin-top: 12px; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 12px; text-align: center; }
.app-footer-sep { opacity: 0.5; }
.app-footer-brand { color: var(--text-secondary); font-weight: 600; }
