:root {
    --bg: #eef3f5;
    --bg-soft: #f7faf9;
    --panel: #ffffff;
    --panel-alt: #f6f9f8;
    --text: #142724;
    --muted: #65746f;
    --line: #dce8e4;
    --line-strong: #c7d7d1;
    --brand: #06483d;
    --brand-2: #0d7668;
    --accent: #b58b1a;
    --blue: #276aa6;
    --teal: #319795;
    --danger: #ba3f3f;
    --ok: #2e7d50;
    --warn-bg: #fff7df;
    --danger-bg: #fff0ef;
    --ok-bg: #edf8f1;
    --radius: 8px;
    --shadow-sm: 0 1px 2px rgba(20, 39, 36, .06), 0 8px 18px rgba(20, 39, 36, .06);
    --shadow-md: 0 18px 42px rgba(20, 39, 36, .11);
}

* { box-sizing: border-box; }

html { min-height: 100%; }

body {
    margin: 0;
    min-height: 100%;
    background:
        radial-gradient(circle at 16% 0%, rgba(49, 151, 149, .12), transparent 32rem),
        linear-gradient(135deg, #edf5f1 0%, #f5f7fb 48%, #eef3f5 100%);
    color: var(--text);
    font-family: Inter, "Segoe UI", Roboto, Arial, Helvetica, sans-serif;
    letter-spacing: 0;
    text-rendering: optimizeLegibility;
}

/* Quiet dashboard layer: fewer decorative effects and clearer hierarchy. */
body { background: #f4f6f7; }
.app-sidebar { background: #123f38; box-shadow: none; }
.app-sidebar .nav-link.active { background: rgba(255, 255, 255, .14); box-shadow: none; }
.panel,
.kpi-card,
.learning-card,
.help-panel,
.executive-brief,
.status-card,
.insight-card { box-shadow: none; background: var(--panel); }
.page-heading h1 { font-size: clamp(27px, 3vw, 36px); }

.summary-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.summary-card {
    display: flex;
    min-width: 0;
    min-height: 132px;
    flex-direction: column;
    justify-content: space-between;
    padding: 17px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    transition: border-color .15s ease, transform .15s ease;
}

a.summary-card:hover {
    color: var(--text);
    border-color: var(--brand-2);
    transform: translateY(-2px);
}

.summary-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.summary-card strong {
    margin: 8px 0;
    color: var(--text);
    font-size: 32px;
    line-height: 1;
}

.summary-card small {
    color: var(--brand-2);
    font-weight: 700;
}

.summary-card.static small { color: var(--muted); }

.focus-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    margin-bottom: 20px;
    padding: 20px;
    border-radius: var(--radius);
    background: #174f46;
    color: #fff;
}

.focus-banner .eyebrow { color: #aee3d9; }
.focus-banner h2 { margin: 7px 0 5px; font-size: 21px; }
.focus-banner p { margin: 0; color: #d6e9e5; font-size: 14px; }

.panel-heading-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 12px;
}

.panel-heading-row h2 { margin-bottom: 3px; }
.panel-heading-row > a { font-size: 13px; font-weight: 750; text-decoration: none; }
.dashboard-charts { margin-bottom: 18px; }
.dashboard-charts .chart-box { height: 275px; min-height: 240px; }
.chart-box.chart-box-short { height: 245px; min-height: 220px; }

.recent-panel { margin-top: 18px; }
.simple-list { display: grid; }
.simple-list article {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 13px 2px;
    border-top: 1px solid var(--line);
}
.simple-list article div { min-width: 0; }
.simple-list strong, .simple-list span { display: block; }
.simple-list strong { margin-bottom: 4px; font-size: 14px; }
.simple-list span { color: var(--muted); font-size: 12px; overflow-wrap: anywhere; }
.simple-list b { flex: 0 0 auto; color: var(--brand-2); font-size: 13px; }
.empty-state { margin: 0; padding: 20px 0; color: var(--muted); }

.inline-filter {
    display: grid;
    min-width: min(100%, 270px);
    gap: 5px;
}
.inline-filter label {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
}

.comment-summary { padding-right: 78px; }
.comment-edit { margin-top: 10px; }
.comment-edit summary {
    width: fit-content;
    color: var(--brand-2);
    cursor: pointer;
    font-size: 12px;
    font-weight: 750;
}
.comment-edit .stack-form { margin-top: 10px; }
.comment-delete { position: absolute; top: 12px; right: 12px; }
.decision-comments article { position: relative; }

@media (max-width: 1050px) {
    .summary-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 680px) {
    .summary-grid { grid-template-columns: 1fr; }
    .summary-card { min-height: 112px; }
    .focus-banner, .simple-list article, .panel-heading-row { align-items: stretch; flex-direction: column; }
    .simple-list b { margin-top: 3px; }
    .inline-filter { width: 100%; }
    .comment-summary { padding-right: 0; }
    .comment-delete { position: static; margin-top: 10px; }
}

a { color: var(--brand-2); }

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
}

.app-sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    gap: 16px;
    overflow: auto;
    padding: 24px 18px;
    color: #fff;
    background:
        linear-gradient(180deg, rgba(6, 72, 61, .97), rgba(14, 49, 46, .99)),
        linear-gradient(135deg, #0d7668, #1f2937);
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, .08);
}

.brand {
    display: grid;
    grid-template-columns: 58px minmax(0, 1fr);
    gap: 12px;
    align-items: center;
    color: #fff;
    text-decoration: none;
    padding: 6px 6px 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .14);
}

.brand:hover { color: #fff; }

.brand-mark {
    width: 58px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 2px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--brand);
    font-weight: 900;
    letter-spacing: 0;
    box-shadow: 0 14px 24px rgba(0, 0, 0, .18);
}

.brand-mark span { color: var(--brand); font-size: 21px; line-height: 1; }

.brand-mark small {
    display: inline-grid;
    place-items: center;
    width: 22px;
    height: 22px;
    margin: 0;
    border-radius: 999px;
    background: var(--teal);
    color: #fff;
    font-size: 10px;
    font-weight: 800;
}

.brand strong {
    display: block;
    font-size: 17px;
    line-height: 1.15;
}

.brand small {
    display: block;
    color: #cfe4dd;
    font-size: 12px;
    line-height: 1.35;
    margin-top: 3px;
}

.app-sidebar .nav {
    gap: 4px !important;
    padding-top: 2px;
}

.app-sidebar .nav-link {
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr);
    align-items: center;
    min-height: 46px;
    color: #d5e5e0;
    border-radius: var(--radius);
    padding: 6px 10px 6px 6px;
    font-size: 14px;
    font-weight: 650;
}

.app-sidebar .nav-link i {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 8px;
    color: #9edbd1;
    background: rgba(255, 255, 255, .08);
    font-size: 16px;
}

.app-sidebar .nav-link span {
    min-width: 0;
    overflow-wrap: anywhere;
}

.app-sidebar .nav-link:hover {
    color: #fff;
    background: rgba(255, 255, 255, .09);
}

.app-sidebar .nav-link.active {
    color: #fff;
    background: linear-gradient(135deg, rgba(49, 151, 149, .36), rgba(181, 139, 26, .24));
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .12);
}

.app-sidebar .nav-link.active i {
    color: #063f36;
    background: #ffffff;
}

.sidebar-user {
    margin-top: auto;
    padding: 14px 10px 2px;
    border-top: 1px solid rgba(255, 255, 255, .14);
    color: #d5e5e0;
    font-size: 13px;
}

.sidebar-user span {
    display: block;
    margin-bottom: 8px;
    font-weight: 800;
    overflow-wrap: anywhere;
}

.sidebar-user a {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: #fff;
    text-decoration: none;
    font-weight: 750;
}

.sidebar-user a:hover { color: #d8f7ef; }

.app-main {
    min-width: 0;
    width: min(100%, 1560px);
    padding: 30px clamp(18px, 3vw, 42px) 42px;
}

.page-heading {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 22px;
    padding-bottom: 18px;
    margin-bottom: 22px;
    border-bottom: 1px solid rgba(20, 39, 36, .09);
}

.page-heading h1 {
    font-size: clamp(28px, 4vw, 42px);
    line-height: 1.04;
    margin: 4px 0 8px;
    font-weight: 850;
    color: #10231f;
}

.page-heading p {
    margin: 0;
    color: var(--muted);
    max-width: 780px;
    font-size: 15px;
    line-height: 1.55;
}

.eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: var(--brand-2);
    font-weight: 800;
    font-size: 12px;
    line-height: 1;
    text-transform: uppercase;
}

.eyebrow::before {
    content: "";
    width: 9px;
    height: 9px;
    border-radius: 999px;
    background: var(--accent);
}

.actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    justify-content: flex-end;
    min-width: fit-content;
}

.btn {
    --bs-btn-border-radius: 8px;
    --bs-btn-font-weight: 750;
    --bs-btn-padding-x: .9rem;
    --bs-btn-padding-y: .55rem;
    box-shadow: none !important;
}

.btn-primary {
    --bs-btn-bg: var(--brand-2);
    --bs-btn-border-color: var(--brand-2);
    --bs-btn-hover-bg: #095f54;
    --bs-btn-hover-border-color: #095f54;
    --bs-btn-active-bg: #06483d;
    --bs-btn-active-border-color: #06483d;
}

.btn-outline-secondary {
    --bs-btn-color: #34443f;
    --bs-btn-border-color: var(--line-strong);
    --bs-btn-hover-bg: #10231f;
    --bs-btn-hover-border-color: #10231f;
    --bs-btn-hover-color: #fff;
    background: rgba(255, 255, 255, .72);
}

.btn-light {
    --bs-btn-bg: #fff;
    --bs-btn-border-color: var(--line);
    --bs-btn-hover-bg: #eef5f2;
    --bs-btn-hover-border-color: var(--line-strong);
}

.panel,
.kpi-card,
.learning-card,
.help-panel,
.executive-brief,
.status-card,
.insight-card {
    background: rgba(255, 255, 255, .92);
    border: 1px solid rgba(220, 232, 228, .95);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}

.panel { padding: 18px; }

.panel h2 {
    font-size: 17px;
    line-height: 1.25;
    margin: 0 0 14px;
    font-weight: 800;
    color: #172d28;
}

.help-panel {
    display: grid;
    grid-template-columns: 230px 1fr;
    gap: 16px;
    align-items: stretch;
    border-left: 5px solid var(--brand-2);
    padding: 16px;
    margin-bottom: 18px;
}

.help-title {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
}

.help-title span,
.executive-brief span,
.brief-metrics article span,
.insight-card span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    text-transform: uppercase;
}

.help-title strong {
    font-size: 18px;
    line-height: 1.2;
}

.help-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 10px;
}

.help-grid article,
.strategy-grid article,
.brief-metrics article {
    background: var(--panel-alt);
    border: 1px solid #e3eeea;
    border-radius: var(--radius);
    padding: 13px;
}

.help-grid strong,
.strategy-grid strong {
    display: block;
    font-size: 13px;
    color: var(--text);
    margin-bottom: 5px;
}

.help-grid p,
.strategy-grid p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.executive-brief {
    display: grid;
    grid-template-columns: minmax(0, 1.2fr) minmax(320px, .8fr);
    gap: 18px;
    align-items: stretch;
    border-left: 7px solid var(--brand-2);
    padding: 22px;
    margin-bottom: 18px;
    box-shadow: var(--shadow-md);
}

.executive-brief.status-ok { border-left-color: var(--ok); }
.executive-brief.status-warn { border-left-color: var(--accent); }
.executive-brief.status-risk { border-left-color: var(--danger); }

.executive-brief strong {
    display: block;
    font-size: clamp(24px, 3vw, 34px);
    line-height: 1.12;
    margin: 7px 0 8px;
    color: #10231f;
}

.executive-brief p {
    margin: 0;
    color: #40514c;
    line-height: 1.5;
}

.brief-metrics {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.brief-metrics article strong {
    display: block;
    color: var(--brand-2);
    font-size: clamp(22px, 2.6vw, 30px);
    line-height: 1.05;
    margin: 6px 0 0;
}

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.kpi-card {
    position: relative;
    min-height: 120px;
    padding: 18px;
    overflow: hidden;
}

.kpi-card::after {
    content: "";
    position: absolute;
    right: 16px;
    bottom: 16px;
    width: 36px;
    height: 4px;
    border-radius: 999px;
    background: linear-gradient(90deg, var(--brand-2), var(--accent));
    opacity: .65;
}

.kpi-card span {
    display: block;
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-transform: uppercase;
    margin-bottom: 12px;
}

.kpi-card strong {
    display: block;
    max-width: 100%;
    font-size: clamp(28px, 3.2vw, 36px);
    line-height: 1.08;
    color: var(--brand-2);
    overflow-wrap: anywhere;
}

.kpi-card .small-kpi {
    font-size: 18px;
    line-height: 1.25;
    color: var(--text);
}

.status-grid,
.insight-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 14px;
    margin-bottom: 22px;
}

.status-card {
    min-height: 172px;
    padding: 16px;
    border-top: 5px solid var(--brand-2);
}

.status-card.status-ok { border-top-color: var(--ok); }
.status-card.status-warn { border-top-color: var(--accent); }
.status-card.status-risk { border-top-color: var(--danger); }

.status-card span,
.decision-item span,
.tag {
    display: inline-flex;
    align-items: center;
    width: fit-content;
    border-radius: 999px;
    background: #e7f4f0;
    color: var(--brand-2);
    padding: 5px 10px;
    font-size: 11px;
    font-weight: 850;
    line-height: 1;
    text-transform: uppercase;
    margin-bottom: 11px;
}

.status-card.status-ok span,
.decision-item.status-ok span,
.tag-ok {
    background: var(--ok-bg);
    color: var(--ok);
}

.status-card.status-warn span,
.decision-item.status-warn span {
    background: var(--warn-bg);
    color: #786018;
}

.status-card.status-risk span,
.decision-item.status-risk span,
.tag-danger {
    background: var(--danger-bg);
    color: var(--danger);
}

.status-card strong {
    display: block;
    font-size: 16px;
    line-height: 1.25;
    margin-bottom: 9px;
}

.status-card b {
    display: block;
    color: var(--brand-2);
    font-size: 30px;
    line-height: 1;
    margin-bottom: 11px;
}

.status-card p,
.insight-card p,
.decision-item p,
.learning-card p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.45;
}

.insight-card {
    min-height: 126px;
    padding: 16px;
    border-left: 5px solid var(--brand-2);
}

.insight-card.risk { border-left-color: var(--danger); }

.insight-card span {
    display: block;
    margin-bottom: 9px;
}

.insight-card strong {
    display: block;
    color: var(--text);
    font-size: 19px;
    line-height: 1.2;
    margin-bottom: 8px;
}

.decision-layout {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.decision-playbook,
.narrative-brief,
.definition-brief {
    display: grid;
    grid-template-columns: minmax(260px, .75fr) minmax(0, 1.25fr);
    gap: 18px;
    align-items: stretch;
    margin-bottom: 22px;
    padding: 18px;
    border: 1px solid rgba(199, 215, 209, .9);
    border-radius: var(--radius);
    background:
        linear-gradient(135deg, rgba(255, 255, 255, .94), rgba(246, 249, 248, .9)),
        linear-gradient(135deg, rgba(13, 118, 104, .08), rgba(181, 139, 26, .08));
    box-shadow: var(--shadow-sm);
}

.playbook-heading h2,
.narrative-brief h2,
.definition-brief h2 {
    margin: 8px 0 8px;
    font-size: 22px;
    line-height: 1.18;
    font-weight: 850;
    color: #10231f;
}

.playbook-heading p,
.narrative-brief > div > p,
.definition-brief > div > p,
.panel-intro {
    margin: 0;
    color: var(--muted);
    line-height: 1.5;
}

.decision-option-grid,
.narrative-actions,
.definition-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 12px;
}

.decision-option,
.narrative-actions article,
.definition-grid article {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr);
    gap: 12px;
    padding: 14px;
    border: 1px solid #e3eeea;
    border-radius: var(--radius);
    background: #fff;
}

.decision-option i,
.narrative-actions i {
    display: grid;
    place-items: center;
    width: 42px;
    height: 42px;
    border-radius: 8px;
    color: #fff;
    background: linear-gradient(135deg, var(--brand-2), #276aa6);
    font-size: 18px;
}

.decision-option span,
.narrative-actions span,
.definition-grid span {
    display: block;
    color: var(--brand-2);
    font-size: 12px;
    font-weight: 850;
    line-height: 1.2;
    text-transform: uppercase;
    margin-bottom: 5px;
}

.decision-option strong,
.narrative-actions strong,
.definition-grid strong {
    display: block;
    color: var(--text);
    font-size: 15px;
    line-height: 1.25;
    margin-bottom: 6px;
}

.decision-option p,
.narrative-actions p,
.definition-grid p {
    margin: 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.42;
}

.decision-option small {
    display: block;
    margin-top: 9px;
    color: #40514c;
    font-size: 12px;
    line-height: 1.38;
    font-weight: 700;
}

.threshold-form {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
    gap: 12px;
}

.threshold-form label {
    display: grid;
    gap: 6px;
}

.threshold-form label span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
    line-height: 1.25;
    text-transform: uppercase;
}

.threshold-form .btn {
    align-self: end;
}

.decision-comments {
    display: grid;
    gap: 10px;
    margin-top: 14px;
}

.decision-comments article {
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: var(--panel-alt);
}

.decision-comments span {
    display: inline-flex;
    width: fit-content;
    margin-bottom: 7px;
    padding: 4px 9px;
    border-radius: 999px;
    background: #e7f4f0;
    color: var(--brand-2);
    font-size: 11px;
    font-weight: 850;
    text-transform: uppercase;
}

.decision-comments strong {
    display: block;
    margin-bottom: 5px;
}

.decision-comments p {
    margin: 0 0 7px;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.42;
}

.decision-comments small {
    color: var(--muted);
    font-size: 12px;
}

.decision-list {
    display: grid;
    gap: 12px;
}

.decision-item {
    border: 1px solid var(--line);
    border-left: 5px solid var(--brand-2);
    border-radius: var(--radius);
    background: var(--panel-alt);
    padding: 14px;
}

.decision-item.status-ok { border-left-color: var(--ok); }
.decision-item.status-warn { border-left-color: var(--accent); }
.decision-item.status-risk { border-left-color: var(--danger); }

.decision-item strong {
    display: block;
    color: var(--text);
    margin-bottom: 6px;
}

.chart-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.chart-grid.compact { margin-bottom: 18px; }
.chart-wide { grid-column: 1 / -1; }

.chart-box {
    height: 330px;
    min-height: 280px;
}

.strategy-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 12px;
}

.table-panel {
    padding: 0;
    overflow: hidden;
}

.table {
    margin: 0;
    min-width: 980px;
}

.table th {
    position: sticky;
    top: 0;
    z-index: 1;
    background: #eef6f3;
    color: #243e38;
    font-size: 12px;
    line-height: 1.25;
    text-transform: uppercase;
}

.table td,
.table th {
    vertical-align: top;
    padding: 13px 14px;
    border-color: var(--line);
}

.data-table tbody tr:hover td { background: #f6faf8; }

.user-inline-form {
    display: grid;
    grid-template-columns: repeat(2, minmax(150px, 1fr));
    gap: 8px;
    min-width: 360px;
}

.user-inline-form .btn {
    width: fit-content;
}

.filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(185px, 1fr));
    gap: 10px;
    margin-bottom: 18px;
}

.form-control,
.form-select {
    min-height: 42px;
    border-color: var(--line-strong);
    border-radius: var(--radius);
    color: var(--text);
}

.form-control:focus,
.form-select:focus {
    border-color: var(--brand-2);
    box-shadow: 0 0 0 .2rem rgba(13, 118, 104, .14);
}

.stack-form {
    display: grid;
    gap: 12px;
}

.check-row {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--muted);
    font-size: 14px;
}

.backup-actions { margin-bottom: 18px; }

.danger-zone {
    border-top: 1px solid var(--line);
    padding-top: 18px;
    margin-top: 18px;
}

.learning-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 14px;
}

.learning-card {
    padding: 18px;
    border-left: 5px solid var(--brand-2);
}

.learning-card.ok { border-left-color: var(--ok); }
.learning-card.risk { border-left-color: var(--danger); }
.learning-card.finding { border-left-color: var(--accent); }

.learning-card span {
    display: block;
    font-weight: 850;
    margin-bottom: 8px;
}

.learning-card p {
    color: #3c4e49;
    margin-bottom: 14px;
}

.learning-card small { color: var(--muted); }

.alert {
    border-radius: var(--radius);
    border-width: 1px;
}

.auth-page {
    min-height: 100vh;
    background:
        linear-gradient(135deg, rgba(6, 72, 61, .94), rgba(20, 39, 36, .9)),
        linear-gradient(135deg, #eef6f3, #f6faf8);
}

.auth-shell {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
}

.auth-panel {
    width: min(100%, 440px);
    background: #fff;
    border: 1px solid rgba(255, 255, 255, .5);
    border-radius: var(--radius);
    padding: 26px;
    box-shadow: var(--shadow-md);
}

.auth-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 26px;
}

.auth-brand strong {
    display: block;
    font-size: 18px;
    line-height: 1.2;
}

.auth-brand small {
    display: block;
    color: var(--muted);
    font-size: 13px;
}

.auth-heading span,
.auth-form label span {
    display: block;
    color: var(--brand-2);
    font-size: 12px;
    font-weight: 850;
    letter-spacing: .08em;
    text-transform: uppercase;
}

.auth-heading h1 {
    margin: 4px 0 8px;
    font-size: 30px;
    line-height: 1.05;
    font-weight: 900;
}

.auth-heading p {
    margin: 0 0 20px;
    color: var(--muted);
}

.auth-form label {
    display: grid;
    gap: 7px;
}

.auth-form .btn {
    min-height: 44px;
    font-weight: 800;
}

.bot-field {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }

    .app-sidebar {
        position: relative;
        height: auto;
        max-height: none;
        padding: 16px;
    }

    .brand {
        padding-bottom: 14px;
        margin: 0;
    }

    .app-sidebar .nav {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
    }

    .app-main {
        padding: 20px 16px 32px;
    }

    .page-heading {
        flex-direction: column;
        gap: 14px;
    }

    .actions {
        justify-content: flex-start;
        width: 100%;
    }

    .chart-grid,
    .decision-layout,
    .executive-brief,
    .help-panel,
    .decision-playbook,
    .narrative-brief,
    .definition-brief {
        grid-template-columns: 1fr;
    }

    .brief-metrics {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .app-sidebar .nav { grid-template-columns: 1fr; }
    .brief-metrics { grid-template-columns: 1fr; }
    .actions .btn,
    .filters .btn {
        width: 100%;
    }
    .chart-box { height: 300px; }
}

body { background: #f4f6f7; }
.app-shell { grid-template-columns: 260px minmax(0, 1fr); }
.app-sidebar { background: #123f38; box-shadow: 4px 0 22px rgba(18, 63, 56, .08); }
.app-sidebar .nav-link.active { background: rgba(255, 255, 255, .14); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .08); }
.panel,
.kpi-card,
.learning-card,
.help-panel,
.executive-brief,
.status-card,
.insight-card {
    background: #fff;
    border-color: #e1e8e6;
    box-shadow: 0 1px 2px rgba(16, 35, 31, .03), 0 8px 24px rgba(16, 35, 31, .045);
}

body,
button,
input,
select,
textarea { font-family: "Manrope", "Segoe UI", Arial, sans-serif; }

body { line-height: 1.6; }
.app-main { padding-block: 34px 52px; }
.page-heading { margin-bottom: 26px; padding-bottom: 22px; }
.page-heading > div:first-child { min-width: 0; }
.page-heading h1 { line-height: 1.15; margin-bottom: 10px; }
.page-heading p { line-height: 1.65; }
.panel { padding: 22px; }
.panel h2 { line-height: 1.4; }
.summary-grid,
.status-grid,
.insight-grid { gap: 16px; margin-bottom: 24px; }
.summary-card {
    padding: 20px;
    border-color: #e1e8e6;
    box-shadow: 0 1px 2px rgba(16, 35, 31, .025), 0 7px 20px rgba(16, 35, 31, .04);
}
.summary-card strong { line-height: 1.15; }
.focus-banner { margin-bottom: 24px; padding: 24px; box-shadow: 0 10px 28px rgba(18, 79, 70, .13); }
.chart-grid,
.decision-layout { gap: 22px; }
.dashboard-charts { margin-bottom: 22px; }
.recent-panel { margin-top: 22px; }
.status-card,
.insight-card,
.decision-item { padding: 19px; }
.executive-brief { gap: 22px; padding: 24px; margin-bottom: 22px; }
.brief-metrics { gap: 12px; }
.decision-comments { gap: 14px; }
.decision-comments article { padding: 16px; }
.threshold-form,
.stack-form { min-width: 0; }
.threshold-form > *,
.stack-form > * { min-width: 0; }
.inline-filter { min-width: 0; width: min(100%, 280px); }
.panel-heading-row > * { min-width: 0; }
.simple-list article { padding-block: 16px; }
.metric-help {
    margin-left: 4px;
    color: #78908a;
    cursor: help;
    font-size: .9em;
    vertical-align: baseline;
}
.metric-help:hover,
.metric-help:focus { color: var(--brand-2); outline: none; }
.tooltip {
    --bs-tooltip-bg: #173c35;
    --bs-tooltip-opacity: 1;
    --bs-tooltip-max-width: 260px;
    font-family: "Manrope", "Segoe UI", Arial, sans-serif;
    font-size: 12px;
    line-height: 1.5;
}
.tooltip-inner { padding: 9px 11px; text-align: left; }
.auth-heading span,
.auth-form label span { letter-spacing: 0; }

@media (max-width: 980px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { box-shadow: 0 3px 16px rgba(18, 63, 56, .1); }
    .app-main { padding: 28px 22px 44px; }
    .page-heading { margin-bottom: 22px; }
    .decision-layout,
    .chart-grid { gap: 18px; }
    .executive-brief { padding: 21px; }
}

@media (max-width: 720px) {
    .app-main { padding: 24px 18px 40px; }
    .page-heading { gap: 18px; padding-bottom: 20px; }
    .page-heading h1 { font-size: 29px; }
    .actions { gap: 10px; }
    .actions .btn { min-height: 44px; }
    .panel,
    .summary-card,
    .status-card,
    .insight-card { padding: 18px; }
    .focus-banner { padding: 20px; }
    .brief-metrics { grid-template-columns: 1fr; }
    .brief-metrics article { min-height: 88px; }
    .chart-box,
    .dashboard-charts .chart-box { height: 320px; min-height: 280px; }
    .chart-box.chart-box-short { height: 300px; }
    .threshold-form { grid-template-columns: 1fr; }
    .simple-list article { gap: 10px; }
}

@media (max-width: 430px) {
    .app-main { padding-inline: 14px; }
    .app-sidebar { padding: 14px; }
    .brand { grid-template-columns: 50px minmax(0, 1fr); }
    .brand-mark { width: 50px; }
    .panel,
    .summary-card,
    .status-card,
    .insight-card,
    .executive-brief { padding: 16px; }
    .summary-card strong { font-size: 29px; }
    .focus-banner { padding: 18px; }
    .focus-banner .btn { width: 100%; }
    .panel-heading-row { gap: 9px; }
    .chart-box,
    .dashboard-charts .chart-box,
    .chart-box.chart-box-short { height: 290px; min-height: 260px; }
    .comment-edit .btn,
    .comment-delete .btn { width: 100%; }
}

.skip-link {
    position: fixed;
    z-index: 2000;
    top: 10px;
    left: 10px;
    padding: 10px 14px;
    border-radius: var(--radius);
    background: #fff;
    color: var(--brand);
    box-shadow: var(--shadow-md);
    transform: translateY(-160%);
}
.skip-link:focus { transform: translateY(0); }
:focus-visible { outline: 3px solid rgba(39, 106, 166, .45); outline-offset: 3px; }

.global-filters {
    margin-bottom: 24px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 5px 18px rgba(16, 35, 31, .035);
}
.global-filters summary {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 48px;
    padding: 10px 16px;
    cursor: pointer;
    color: var(--text);
    font-size: 13px;
    font-weight: 800;
    list-style: none;
}
.global-filters summary::-webkit-details-marker { display: none; }
.global-filters summary b {
    margin-left: auto;
    padding: 4px 8px;
    border-radius: 999px;
    background: #e7f4f0;
    color: var(--brand-2);
    font-size: 11px;
}
.global-filters form {
    display: grid;
    grid-template-columns: repeat(5, minmax(140px, 1fr)) auto;
    gap: 10px;
    padding: 0 16px 16px;
    border-top: 1px solid var(--line);
}
.global-filters label { display: grid; min-width: 0; gap: 5px; padding-top: 12px; }
.global-filters label span { color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.global-filter-actions { display: flex; align-items: end; gap: 7px; padding-top: 12px; }

.comparison-strip {
    display: grid;
    grid-template-columns: minmax(100px, .8fr) auto minmax(100px, .8fr) minmax(190px, 1.2fr) minmax(190px, 1.2fr);
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
    padding: 16px 20px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    box-shadow: 0 5px 18px rgba(16, 35, 31, .035);
}
.comparison-strip span,
.comparison-strip small { display: block; color: var(--muted); font-size: 11px; font-weight: 700; }
.comparison-strip strong { display: block; font-size: 22px; line-height: 1.3; }
.comparison-delta { padding-left: 16px; border-left: 1px solid var(--line); }
.comparison-delta.positive strong { color: var(--ok); }
.comparison-delta.negative strong { color: var(--danger); }
.target-progress { padding-left: 16px; border-left: 1px solid var(--line); }
.target-progress > div:first-child { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.target-progress .progress { height: 7px; margin-top: 8px; background: #e6eeeb; }
.target-progress .progress-bar { background: var(--brand-2); }
.training-split { grid-template-columns: repeat(3, minmax(110px, 1fr)) minmax(240px, 1.5fr); }

.quality-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.quality-item {
    display: grid;
    grid-template-columns: 42px minmax(0, 1fr) 20px;
    gap: 14px;
    align-items: center;
    padding: 18px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text);
    text-decoration: none;
    box-shadow: 0 5px 18px rgba(16, 35, 31, .035);
}
.quality-item:hover { color: var(--text); border-color: var(--brand-2); }
.quality-item > i:first-child { color: var(--ok); font-size: 25px; }
.quality-item.has-issues > i:first-child { color: var(--danger); }
.quality-item span { color: var(--muted); font-size: 12px; font-weight: 800; text-transform: uppercase; }
.quality-item strong { display: block; font-size: 27px; }
.quality-item p { margin: 2px 0 0; color: var(--muted); font-size: 12px; }
.detail-summary { grid-template-columns: repeat(2, minmax(0, 230px)); }
.table-description { display: block; max-width: 430px; margin-top: 4px; color: var(--muted); line-height: 1.45; }
.pagination-nav { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 20px; }
.pagination-nav span { color: var(--muted); font-size: 13px; font-weight: 700; }
.decision-layout.single { grid-template-columns: 1fr; }
.comment-filters,
.form-row { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.comment-filters { grid-template-columns: repeat(3, minmax(0, 1fr)) auto; margin: 14px 0; }
.decision-comments .priority { margin-left: 5px; }
.priority-alta { background: var(--danger-bg) !important; color: var(--danger) !important; }
.priority-baja { background: #eef4f8 !important; color: var(--blue) !important; }
.comment-history { margin-top: 10px; color: var(--muted); font-size: 12px; }
.comment-history summary { cursor: pointer; font-weight: 700; }
.comment-history small { display: block; margin-top: 5px; }

@media (max-width: 1180px) {
    .global-filters form { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
    .global-filters form,
    .quality-grid,
    .comment-filters,
    .form-row { grid-template-columns: 1fr; }
    .global-filter-actions .btn { flex: 1; }
    .comparison-strip { grid-template-columns: 1fr 1fr; }
    .comparison-strip > i { display: none; }
    .comparison-delta { grid-column: 1 / -1; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
    .target-progress { grid-column: 1 / -1; padding: 12px 0 0; border-top: 1px solid var(--line); border-left: 0; }
    .training-split { grid-template-columns: 1fr; }
    .training-split small { grid-column: auto; }
    .detail-summary { grid-template-columns: 1fr; }
    .pagination-nav { justify-content: space-between; }
    .pagination-nav span { display: none; }
}

@media print {
    body { background: #fff; }
    .app-sidebar,
    .actions,
    .filters {
        display: none !important;
    }
    .app-shell { display: block; }
    .app-main { padding: 0; width: 100%; }
    .panel,
    .kpi-card,
    .learning-card,
    .help-panel,
    .executive-brief,
    .status-card,
    .insight-card {
        box-shadow: none;
        background: #fff;
    }
}
