:root {
    --dp-ink: #17212b;
    --dp-muted: #687582;
    --dp-border: #dde3e8;
    --dp-canvas: #f4f6f7;
    --dp-navy: #18324a;
    --dp-blue: #1f5d83;
    --dp-teal: #087f78;
    --dp-green: #26835b;
    --dp-amber: #bd7415;
    --dp-white: #ffffff;
    --dp-sidebar-width: 200px;
    --bs-primary: #1f5d83;
    --bs-primary-rgb: 31, 93, 131;
    --bs-body-color: #17212b;
    --bs-border-color: #dde3e8;
    --bs-border-radius: 0.375rem;
    --bs-border-radius-lg: 0.5rem;
    letter-spacing: 0;
}

* { box-sizing: border-box; }

body {
    font-family: Inter, "Segoe UI", Arial, sans-serif;
    background: var(--dp-canvas);
    color: var(--dp-ink);
    letter-spacing: 0;
}

.btn {
    font-weight: 650;
    letter-spacing: 0;
}

.btn-primary {
    --bs-btn-bg: var(--dp-blue);
    --bs-btn-border-color: var(--dp-blue);
    --bs-btn-hover-bg: #174b6b;
    --bs-btn-hover-border-color: #174b6b;
    --bs-btn-active-bg: #133f5a;
}

.btn-icon {
    width: 2.5rem;
    height: 2.5rem;
    display: inline-grid;
    place-items: center;
    padding: 0;
    border: 1px solid var(--dp-border);
    background: var(--dp-white);
    color: var(--dp-ink);
}

.portal-sidebar {
    width: var(--dp-sidebar-width) !important;
    background: var(--dp-navy);
    color: #dce6ed;
    border-right: 0;
}

.sidebar-inner {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    padding: 1.5rem 0.75rem;
}

.brand-link {
    display: inline-flex;
    align-items: center;
    gap: 0.75rem;
    color: inherit;
    text-decoration: none;
}

.sidebar-brand {
    padding: 0 0.5rem 2rem;
    color: #fff;
}

.sidebar-brand strong,
.sidebar-brand small {
    display: block;
    line-height: 1.15;
}

.sidebar-brand strong { font-size: 1.05rem; }
.sidebar-brand small { color: #9fb2c1; font-size: 0.72rem; margin-top: 0.2rem; }

.brand-mark {
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 2.35rem;
    display: inline-grid;
    place-items: center;
    border-radius: 0.375rem;
    color: #fff;
    background: var(--dp-teal);
    font-size: 1.05rem;
}

.portal-nav { display: grid; gap: 0.25rem; }

.nav-label {
    margin: 0 0.625rem 0.4rem;
    color: #7f98aa;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
}

.portal-nav .nav-link {
    min-height: 2.7rem;
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.7rem 0.625rem;
    color: #c2d0da;
    border-radius: 0.375rem;
    font-size: 0.9rem;
    font-weight: 600;
}

.portal-nav .nav-link i { width: 1.2rem; font-size: 1rem; }
.portal-nav .nav-link:hover { background: #23435d; color: #fff; }
.portal-nav .nav-link.active { background: #2b4b64; color: #fff; }
.portal-nav .nav-link-muted { color: #9fb2c1; cursor: default; }

.status-dot {
    width: 0.5rem;
    height: 0.5rem;
    display: inline-block;
    border-radius: 50%;
    background: #36b37e;
    box-shadow: 0 0 0 3px rgba(54, 179, 126, 0.14);
}

.sidebar-footer {
    margin-top: auto;
    padding: 1rem 0.25rem 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    flex-direction: column;
    align-items: stretch;
    gap: 0.75rem;
}

.sidebar-footer form { width: 100%; }

.btn-signout {
    width: 100%;
    min-height: 2.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.55rem;
    color: #c2d0da;
    border: 1px solid rgba(255, 255, 255, 0.15);
    background: transparent;
    font-size: 0.8rem;
}

.btn-signout:hover,
.btn-signout:focus-visible {
    color: #fff;
    border-color: rgba(255, 255, 255, 0.28);
    background: #23435d;
}

.user-summary { min-width: 0; display: flex; align-items: center; gap: 0.7rem; }
.user-avatar {
    width: 2.2rem;
    height: 2.2rem;
    flex: 0 0 2.2rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    color: #fff;
    background: #315873;
    font-weight: 700;
}
.user-copy { min-width: 0; }
.user-copy strong, .user-copy small { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-copy strong { color: #fff; font-size: 0.83rem; }
.user-copy small { color: #9fb2c1; font-size: 0.7rem; }

.portal-main { min-height: 100vh; }
.page-shell { max-width: 1580px; margin: 0 auto; padding: 2.25rem 2.5rem 1.5rem; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin-bottom: 1.75rem;
}

.eyebrow {
    margin: 0 0 0.45rem;
    color: var(--dp-teal);
    font-size: 0.71rem;
    font-weight: 800;
    text-transform: uppercase;
}

.page-header h1 {
    margin: 0;
    font-size: 2.35rem;
    line-height: 1.15;
    font-weight: 720;
}

.page-subtitle { margin: 0.55rem 0 0; color: var(--dp-muted); }
.header-actions { display: flex; align-items: center; gap: 0.75rem; }
.data-freshness {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dp-muted);
    font-size: 0.8rem;
    white-space: nowrap;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.metric-card {
    min-width: 0;
    min-height: 132px;
    padding: 1.25rem;
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    background: var(--dp-white);
    border: 1px solid var(--dp-border);
    border-radius: 0.5rem;
}

.metric-icon {
    width: 2.65rem;
    height: 2.65rem;
    flex: 0 0 2.65rem;
    display: grid;
    place-items: center;
    border-radius: 0.375rem;
    font-size: 1.2rem;
}
.metric-icon-teal { color: #086a65; background: #dff3ef; }
.metric-icon-blue { color: #1f5d83; background: #e2edf4; }
.metric-icon-green { color: #267451; background: #e4f2e9; }
.metric-icon-amber { color: #9a5b0f; background: #f8ecd8; }
.metric-card > div:last-child { min-width: 0; }
.metric-label, .metric-card small { display: block; }
.metric-label { color: var(--dp-muted); font-size: 0.75rem; font-weight: 650; }
.metric-card strong { display: block; margin: 0.15rem 0; font-size: 1.72rem; line-height: 1.25; }
.metric-card small { color: #84909b; font-size: 0.7rem; }

.analysis-grid {
    display: grid;
    grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.85fr);
    min-height: 490px;
    margin-bottom: 1.25rem;
    background: var(--dp-white);
    border: 1px solid var(--dp-border);
    border-radius: 0.5rem;
    overflow: hidden;
}

.analysis-workspace { padding: 1.75rem; }
.section-heading { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; margin-bottom: 1.35rem; }
.section-heading h2 { margin: 0; font-size: 1.22rem; font-weight: 720; }
.section-heading p:not(.eyebrow) { margin: 0.35rem 0 0; color: var(--dp-muted); font-size: 0.86rem; }
.model-badge, .legend {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--dp-muted);
    font-size: 0.75rem;
    white-space: nowrap;
}

.question-form {
    border: 1px solid #bfcbd3;
    border-radius: 0.5rem;
    overflow: hidden;
    transition: border-color 160ms ease, box-shadow 160ms ease;
}
.question-form:focus-within { border-color: var(--dp-blue); box-shadow: 0 0 0 3px rgba(31, 93, 131, 0.12); }
.question-form textarea {
    width: 100%;
    min-height: 164px;
    padding: 1.15rem;
    border: 0;
    outline: 0;
    resize: vertical;
    color: var(--dp-ink);
    font-size: 0.98rem;
    line-height: 1.55;
}
.question-form textarea::placeholder { color: #89949d; }
.question-toolbar {
    min-height: 60px;
    padding: 0.7rem 0.8rem 0.7rem 1rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    background: #f7f9fa;
    border-top: 1px solid var(--dp-border);
}
.question-toolbar > span { color: var(--dp-muted); font-size: 0.73rem; }

.suggested-prompts { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.suggested-prompts > span { color: var(--dp-muted); font-size: 0.74rem; font-weight: 700; }
.suggested-prompts button {
    padding: 0.4rem 0.65rem;
    border: 1px solid var(--dp-border);
    border-radius: 0.375rem;
    background: #fff;
    color: #425362;
    font-size: 0.72rem;
}
.suggested-prompts button:hover { border-color: #9eafb9; background: #f7f9fa; }

.insight-panel {
    min-width: 0;
    padding: 1.75rem;
    display: flex;
    background: #eef3f5;
    border-left: 1px solid var(--dp-border);
}
.insight-empty, .insight-loading, .insight-error { margin: auto; max-width: 330px; text-align: center; }
.insight-symbol, .analysis-pulse {
    width: 3rem;
    height: 3rem;
    margin: 0 auto 1rem;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #d8e7eb;
    color: var(--dp-teal);
    font-size: 1.3rem;
}
.insight-panel h2 { margin: 0; font-size: 1.05rem; }
.insight-panel p { margin: 0.5rem 0 0; color: var(--dp-muted); font-size: 0.83rem; }
.analysis-pulse { animation: pulse 1.7s ease-in-out infinite; }
@keyframes pulse { 50% { transform: scale(1.08); background: #c8e1e0; } }
.insight-content { width: 100%; display: flex; flex-direction: column; }
.insight-kicker { margin-bottom: 1rem; color: var(--dp-teal); font-size: 0.72rem; font-weight: 800; text-transform: uppercase; }
.analysis-answer { flex: 1; min-width: 0; color: #263642; font-size: 0.86rem; line-height: 1.62; }
.analysis-answer > :first-child { margin-top: 0; }
.analysis-answer > :last-child { margin-bottom: 0; }
.analysis-answer h2,
.analysis-answer h3,
.analysis-answer h4,
.analysis-answer h5 {
    margin: 1.25rem 0 0.5rem;
    color: var(--dp-ink);
    line-height: 1.3;
    font-weight: 720;
}
.analysis-answer h2 { font-size: 1.12rem; }
.analysis-answer h3 { font-size: 1rem; }
.analysis-answer h4,
.analysis-answer h5 { font-size: 0.9rem; }
.analysis-answer p { margin: 0 0 0.85rem; color: #344753; font-size: inherit; }
.analysis-answer ul,
.analysis-answer ol { margin: 0 0 1rem; padding-left: 1.25rem; }
.analysis-answer li { padding-left: 0.2rem; margin-bottom: 0.35rem; }
.analysis-answer strong { color: var(--dp-ink); font-weight: 720; }
.analysis-answer code {
    padding: 0.12rem 0.3rem;
    border: 1px solid #d5e0e5;
    border-radius: 0.25rem;
    background: #f7f9fa;
    color: #244b63;
    font-size: 0.78rem;
}
.analysis-answer a { color: var(--dp-blue); text-underline-offset: 0.15rem; }
.analysis-answer blockquote {
    margin: 0 0 1rem;
    padding: 0.75rem 0.9rem;
    border-left: 3px solid var(--dp-teal);
    background: rgba(255, 255, 255, 0.55);
    color: #41545f;
}
.analysis-answer hr { margin: 1.2rem 0; border-color: #cbd8de; opacity: 1; }
.analysis-table-wrap { max-width: 100%; margin: 0.75rem 0 1rem; overflow-x: auto; }
.analysis-table {
    width: 100%;
    border-collapse: collapse;
    background: rgba(255, 255, 255, 0.62);
    font-size: 0.76rem;
}
.analysis-table th,
.analysis-table td {
    padding: 0.55rem 0.65rem;
    border: 1px solid #d5e0e5;
    text-align: left;
    vertical-align: top;
}
.analysis-table th {
    background: #dfe9ed;
    color: #314653;
    font-weight: 750;
    white-space: nowrap;
}
.analysis-table tbody tr:nth-child(even) { background: rgba(239, 244, 246, 0.8); }
.analysis-meta { display: flex; flex-wrap: wrap; gap: 0.4rem 0.8rem; padding-top: 1rem; margin-top: 1rem; border-top: 1px solid #d4dfe4; color: #75838d; font-size: 0.67rem; }

.processing-section {
    padding: 1.5rem 1.75rem 0;
    background: var(--dp-white);
    border: 1px solid var(--dp-border);
    border-radius: 0.5rem;
}
.section-heading-row { align-items: flex-end; }
.processing-table { font-size: 0.82rem; }
.processing-table thead th { padding: 0.8rem 0.75rem; border-bottom-width: 1px; color: #77848e; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.processing-table tbody td { padding: 0.9rem 0.75rem; border-color: #edf0f2; }
.retailer-cell { min-width: 210px; display: flex; align-items: center; gap: 0.75rem; }
.retailer-code { width: 2.55rem; height: 2.2rem; display: grid; place-items: center; border-radius: 0.375rem; background: #e9eff2; color: #455966; font-size: 0.68rem; font-weight: 800; }
.retailer-cell strong, .retailer-cell small { display: block; }
.retailer-cell small { margin-top: 0.15rem; color: #87939c; font-size: 0.68rem; }
.state-badge { display: inline-flex; align-items: center; gap: 0.4rem; font-size: 0.72rem; font-weight: 700; white-space: nowrap; }
.state-badge > span { width: 0.45rem; height: 0.45rem; border-radius: 50%; background: currentColor; }
.state-good { color: var(--dp-green); }
.state-progress { color: var(--dp-blue); }
.state-warning { color: var(--dp-amber); }
.state-idle { color: #7b8790; }
.coverage-cell { min-width: 190px; display: flex; align-items: center; gap: 0.75rem; }
.coverage-cell .progress { width: 120px; height: 0.38rem; background: #e9edef; }
.coverage-cell strong { min-width: 3.2rem; font-size: 0.76rem; }
.tabular { font-variant-numeric: tabular-nums; }
.link-search-form { display: flex; flex-wrap: wrap; gap: 0.75rem; align-items: end; }
.link-search-form > div { flex: 1 1 180px; }
.link-search-form label { display: block; font-size: 0.85rem; margin-bottom: 0.35rem; }
.link-search-form .link-check { display: flex; align-items: center; gap: 0.4rem; padding: 0.5rem 0; }
.link-pager { display: flex; gap: 0.75rem; align-items: center; margin-top: 0.75rem; }
.link-review { padding: 1.25rem; border: 1px solid var(--dp-border); border-radius: 0.5rem; background: var(--dp-white); }
.match-search { max-width: 360px; }
.match-quantity { max-width: 180px; }
.match-card { border: 1px solid var(--dp-border); padding: 1rem; margin-top: 0.75rem; border-radius: 0.375rem; }
.product-links-table .source-link { overflow-wrap: anywhere; }
.linking-workspace { height: 100dvh; padding: 1.25rem; display: flex; flex-direction: column; gap: 1rem; overflow: hidden; }
.linking-workspace [hidden] { display: none !important; }
.linking-header { display: flex; justify-content: space-between; align-items: center; gap: 1rem; flex-shrink: 0; }
.linking-header .eyebrow { margin-bottom: 0.25rem; }
.linking-header h1 { font-size: 1.65rem; font-weight: 720; margin: 0; }
.linking-price-control { display: flex; align-items: center; gap: 0.6rem; font-size: 0.8rem; }
.linking-price-control label { white-space: nowrap; }
.linking-price-control select { width: 160px; }
.linking-layout { flex: 1; min-height: 0; display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 1rem; }
.linking-detail { min-width: 0; min-height: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.linking-panel { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #fff; border: 1px solid var(--dp-border); border-radius: 0.5rem; overflow: hidden; }
.linking-panel-header { padding: 1rem; flex-shrink: 0; border-bottom: 1px solid var(--dp-border); }
.linking-panel-header h2 { margin: 0; font-size: 0.92rem; font-weight: 750; }
.linking-panel-header p { margin: 0.3rem 0 0; color: var(--dp-muted); font-size: 0.74rem; }
.catalogue-search { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.75rem; }
.catalogue-search input { min-width: 0; }
.linking-panel-scroll { min-height: 0; flex: 1; overflow: auto; padding: 0.75rem; }
.catalogue-results { padding: 0.5rem; }
.linking-panel-footer { flex-shrink: 0; padding: 0.65rem; margin: 0; font-size: 0.7rem; justify-content: space-between; }
.linking-panel-footer:empty { display: none; }
.master-result { display: block; width: 100%; text-align: left; border: 1px solid transparent; background: transparent; border-radius: 0.375rem; padding: 0.8rem; margin-bottom: 0.2rem; color: var(--dp-ink); }
.master-result:hover { background: #f4f7f9; }
.master-result[aria-pressed="true"] { background: #edf6f7; border-color: var(--dp-teal); }
.master-result strong { display: block; font-size: 0.82rem; line-height: 1.45; }
.master-result small { display: block; margin-top: 0.25rem; color: var(--dp-muted); font-size: 0.7rem; }
.master-result .master-link-count { color: var(--dp-teal); font-weight: 700; }
.workspace-empty { padding: 2.5rem 1rem; text-align: center; color: var(--dp-muted); font-size: 0.85rem; }
.workspace-empty i { display: block; font-size: 1.6rem; margin-bottom: 0.65rem; color: #90a4b1; }
.workspace-message { font-size: 0.74rem; color: var(--dp-muted); line-height: 1.5; margin: 0.5rem 0 0; }
.workspace-message:empty { display: none; }
.comparison-product { padding: 0.25rem 0.25rem 0.75rem; }
.comparison-product h3 { font-size: 0.95rem; line-height: 1.4; margin: 0 0 0.3rem; }
.comparison-product p { margin: 0; font-size: 0.72rem; color: var(--dp-muted); }
.retailer-link-row { padding: 0.85rem; border: 1px solid var(--dp-border); border-radius: 0.375rem; margin-bottom: 0.6rem; }
.retailer-link-heading { display: flex; justify-content: space-between; align-items: start; gap: 0.5rem; }
.retailer-link-heading strong { font-size: 0.8rem; }
.retailer-link-heading small { font-size: 0.68rem; color: var(--dp-muted); }
.retailer-link-description { font-size: 0.8rem; line-height: 1.45; margin: 0.4rem 0 0.6rem; }
.link-price-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.5rem; }
.link-price-metrics small { display: block; font-size: 0.65rem; color: var(--dp-muted); }
.link-price-metrics strong { font-size: 0.85rem; overflow-wrap: anywhere; }
.link-price-metrics .unit-price strong { color: var(--dp-teal); }
.retailer-link-footer { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.35rem; font-size: 0.68rem; margin-top: 0.65rem; color: var(--dp-muted); }
.retailer-link-footer a { font-size: 0.7rem; }
.suggestions-workspace { display: flex; flex-direction: column; flex: 1; min-height: 0; }
.suggestion-controls { padding: 0.75rem 1rem; flex-shrink: 0; border-bottom: 1px solid var(--dp-border); }
.suggestion-controls > .workspace-message:first-child { margin-top: 0; }
.suggestion-filter-row { display: flex; gap: 0.4rem; margin-top: 0.6rem; }
.suggestion-filter-row select { min-width: 0; flex: 1; }
.suggestion-filter-row button { white-space: nowrap; }
.suggestion-new-filter { display: flex; align-items: center; gap: 0.4rem; font-size: 0.7rem; margin-top: 0.6rem; color: var(--dp-muted); }
.first-link-search { margin-top: 0.65rem; }
.first-link-search > label { font-size: 0.72rem; }
.suggestion-results { padding: 0.75rem; }
.suggestion-card { border: 1px solid var(--dp-border); border-radius: 0.375rem; padding: 0.85rem; margin-bottom: 0.6rem; }
.suggestion-card > strong { font-size: 0.82rem; }
.suggestion-card p { font-size: 0.74rem; line-height: 1.5; margin: 0.4rem 0; }
.suggestion-card details { font-size: 0.72rem; color: var(--dp-muted); margin: 0.6rem 0; }
.suggestion-card details p { margin-bottom: 0; }
.suggestion-confidence { font-size: 0.65rem; color: var(--dp-teal); font-weight: 700; margin-left: 0.35rem; }
.link-confirmation { padding: 0.85rem 1rem; background: #f1f8f8; border-top: 1px solid #bbd8d5; flex-shrink: 0; max-height: 45%; overflow: auto; }
.link-confirmation h3 { margin: 0 0 0.4rem; font-size: 0.85rem; }
.confirmation-source { font-size: 0.74rem; line-height: 1.45; max-height: 3.2rem; overflow: auto; }
.confirmation-action-row { display: flex; align-items: end; gap: 0.65rem; margin-top: 0.5rem; }
.confirmation-action-row > div { flex: 1; min-width: 0; }
.confirmation-action-row label { font-size: 0.7rem; margin-bottom: 0.2rem; }
.confirmation-action-row button { white-space: nowrap; }
@media (min-width: 1600px) {
    .linking-layout { grid-template-columns: 290px minmax(0, 1fr); }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
    .linking-layout { grid-template-columns: 235px minmax(0, 1fr); }
    .linking-detail { grid-template-columns: minmax(0, 1fr); grid-template-rows: minmax(0, 1fr) minmax(0, 1fr); }
}
@media (max-width: 991.98px) {
    .linking-workspace { height: auto; min-height: calc(100dvh - 64px); padding: 1rem; overflow: visible; }
    .linking-layout { grid-template-columns: minmax(0, 1fr); }
    .catalogue-panel { max-height: 380px; }
    .linking-detail { grid-template-columns: minmax(0, 1fr); }
    .confirmed-panel, .suggestions-panel { max-height: 650px; min-height: 250px; }
    .linking-header { flex-wrap: wrap; }
}
.loading-row { height: 100px; text-align: center; color: var(--dp-muted) !important; }

.portal-footer { display: flex; justify-content: space-between; gap: 1rem; padding: 1.25rem 0 0; color: #89949d; font-size: 0.68rem; }

.admin-page { max-width: 1500px; }
.admin-create-section,
.admin-users-section {
    padding: 1.5rem 1.75rem;
    margin-bottom: 1.25rem;
    background: var(--dp-white);
    border: 1px solid var(--dp-border);
    border-radius: 0.5rem;
}
.admin-create-form {
    display: grid;
    grid-template-columns: minmax(160px, 0.8fr) minmax(220px, 1fr) minmax(240px, 1fr) minmax(280px, 1.25fr) auto;
    align-items: end;
    gap: 1rem;
}
.admin-create-form > .text-danger { grid-column: 1 / -1; }
.admin-create-form .form-label,
.role-options legend { margin-bottom: 0.4rem; font-size: 0.74rem; font-weight: 750; }
.role-options { min-width: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 0.5rem 0.85rem; border: 0; }
.role-options legend { float: none; width: 100%; }
.role-options label,
.role-editor label { color: #52616c; font-size: 0.72rem; white-space: nowrap; }
.admin-users-section { padding-bottom: 0; }
.admin-users-table { font-size: 0.8rem; }
.admin-users-table thead th { padding: 0.75rem; border-bottom-width: 1px; color: #77848e; font-size: 0.68rem; font-weight: 800; text-transform: uppercase; white-space: nowrap; }
.admin-users-table tbody td { padding: 0.9rem 0.75rem; border-color: #edf0f2; }
.admin-avatar { color: #fff; background: var(--dp-blue); }
.role-editor { min-width: 310px; display: flex; align-items: center; flex-wrap: wrap; gap: 0.4rem 0.65rem; }
.user-actions { min-width: 245px; display: flex; justify-content: flex-end; gap: 0.5rem; }
.modal-content { border: 0; border-radius: 0.5rem; box-shadow: 0 1rem 3rem rgba(24, 50, 74, 0.22); }

.mobile-header {
    height: 64px;
    padding: 0 1rem;
    align-items: center;
    justify-content: space-between;
    background: var(--dp-white);
    border-bottom: 1px solid var(--dp-border);
}

.login-page { min-height: 100vh; background: #eef2f4; }
.login-shell { min-height: 100vh; display: grid; grid-template-columns: minmax(380px, 0.85fr) minmax(500px, 1.15fr); }
.login-brand { padding: clamp(2.5rem, 7vw, 7rem); display: flex; flex-direction: column; justify-content: center; color: #fff; background: var(--dp-navy); }
.brand-mark-lg { width: 3.2rem; height: 3.2rem; margin-bottom: 2.5rem; font-size: 1.4rem; }
.login-brand .eyebrow { color: #71d2c7; }
.login-brand h1 { max-width: 560px; margin: 0; font-size: 3.5rem; line-height: 1.07; font-weight: 720; }
.login-brand > p:not(.eyebrow) { max-width: 520px; margin: 1.4rem 0 0; color: #b7c8d4; font-size: 1rem; line-height: 1.65; }
.login-metric { margin-top: 3.5rem; padding-top: 1.4rem; display: flex; align-items: center; gap: 0.7rem; border-top: 1px solid rgba(255, 255, 255, 0.14); color: #c7d5de; font-size: 0.78rem; }
.login-metric i { color: #71d2c7; font-size: 1.1rem; }
.login-panel { padding: 2rem; display: grid; place-items: center; background: #fff; }
.login-form-wrap { width: min(100%, 430px); }
.login-form-wrap h2 { margin: 0; font-size: 1.8rem; font-weight: 720; }
.login-form-wrap .form-label { font-size: 0.8rem; font-weight: 700; }
.login-form-wrap .input-group-text { color: #697985; background: #f4f6f7; }
.login-form-wrap .form-control, .login-form-wrap .input-group-text { font-size: 0.92rem; }

@media (min-width: 992px) {
    .portal-sidebar { position: fixed; inset: 0 auto 0 0; transform: none !important; visibility: visible !important; }
    .portal-main { margin-left: var(--dp-sidebar-width); }
}

@media (max-width: 1199.98px) {
    .page-shell { padding: 1.75rem; }
    .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .analysis-grid { grid-template-columns: minmax(0, 1fr); }
    .insight-panel { min-height: 340px; border-left: 0; border-top: 1px solid var(--dp-border); }
    .admin-create-form { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .admin-create-form .role-options { grid-column: 1 / -1; }
    .admin-create-form > .btn { justify-self: start; }
}

@media (max-width: 767.98px) {
    .page-shell { padding: 1.25rem 1rem; }
    .page-header { align-items: flex-start; flex-direction: column; gap: 1rem; }
    .page-header h1 { font-size: 1.8rem; }
    .header-actions { width: 100%; justify-content: space-between; }
    .metric-grid { grid-template-columns: 1fr; }
    .metric-card { min-height: 112px; }
    .analysis-workspace, .insight-panel { padding: 1.25rem; }
    .question-toolbar { align-items: flex-end; }
    .question-toolbar > span { max-width: 150px; }
    .processing-section { padding: 1.25rem 1rem 0; }
    .admin-create-section, .admin-users-section { padding: 1.25rem 1rem; }
    .admin-create-form { grid-template-columns: 1fr; }
    .admin-create-form .role-options { grid-column: auto; }
    .section-heading-row { align-items: flex-start; flex-direction: column; }
    .portal-footer { flex-direction: column; }
    .login-shell { grid-template-columns: 1fr; }
    .login-brand { min-height: 34vh; padding: 2rem 1.5rem; }
    .login-brand h1 { font-size: 2rem; }
    .login-brand > p:not(.eyebrow), .login-metric { display: none; }
    .brand-mark-lg { margin-bottom: 1.5rem; }
    .login-panel { padding: 2rem 1.25rem; align-items: start; }
}

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