:root {
    --bg: #f4f1ea;
    --panel: #fffdf9;
    --ink: #202124;
    --muted: #6a6d75;
    --accent: #245f54;
    --accent-strong: #153a34;
    --border: #d8d1c5;
    --danger: #9b2c2c;
    --success: #1f6f43;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: Arial, "Helvetica Neue", Helvetica, "Nimbus Sans L", "Liberation Sans", Roboto, "Noto Sans", sans-serif;
    color: var(--ink);
    background:
        radial-gradient(circle at top left, rgba(36, 95, 84, 0.16), transparent 30%),
        linear-gradient(180deg, #f7f3ec, var(--bg));
}

.app-shell {
    display: grid;
    grid-template-columns: 260px 1fr;
    min-height: 100vh;
}

.sidebar {
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
    overflow-y: auto;
    padding: 2rem;
    background: var(--accent-strong);
    color: #fff;
}

.brand {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.brand-mark {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 0.9rem;
    background: rgba(255, 255, 255, 0.12);
    box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.12);
}

.brand-mark svg {
    width: 1.4rem;
    height: 1.4rem;
}

.brand-copy {
    min-width: 0;
}

.brand-kicker {
    font-size: 0.72rem;
    line-height: 1;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    opacity: 0.72;
}

.brand-name {
    margin-top: 0.2rem;
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.2;
}

.sidebar nav,
.sidebar form,
.stack {
    display: grid;
    gap: 0.75rem;
}

.sidebar-primary {
    margin: 2rem 0;
}

.sidebar-footer {
    margin-top: auto;
}

.sidebar-secondary {
    margin: 0 0 1.5rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.14);
}

.sidebar a,
.link-button {
    color: #fff;
    text-decoration: none;
    background: transparent;
    border: 0;
    padding: 0;
    text-align: left;
    cursor: pointer;
    font: inherit;
}

.content {
    padding: 2rem;
    min-width: 0;
}

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

.auth-main {
    width: min(420px, 92vw);
}

.card {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 18px;
    padding: 1.5rem;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
    min-width: 0;
}

.auth-card {
    padding: 2rem;
}

.grid {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    margin-bottom: 1rem;
}

.dashboard-kpis {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.dashboard-panels {
    align-items: start;
}

.dashboard-main-panels,
.dashboard-forms-panels {
    grid-template-columns: repeat(12, minmax(0, 1fr));
    align-items: start;
}

.dashboard-review-kpis {
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.combined-review-card {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 0.75rem;
}

.combined-kpi-card {
    margin-top: 0.9rem;
}

.combined-review-metric {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(21, 58, 52, 0.1);
    border-radius: 14px;
    background: rgba(21, 58, 52, 0.04);
}

.combined-review-metric span {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.combined-review-metric strong {
    font-size: 1.9rem;
    color: var(--accent-strong);
}

.combined-review-metric small {
    display: block;
    margin-top: 0.25rem;
    color: var(--muted);
}

.metric-badge-row {
    display: flex;
    align-items: center;
    margin-top: 0.45rem;
}

.metric-badge-row .badge {
    width: auto;
    max-width: 100%;
    justify-content: space-between;
    gap: 0.7rem;
}

.metric-badge-row .badge strong {
    font-size: 0.9rem;
    color: inherit;
}

.dashboard-panel-wide {
    grid-column: span 12;
}

.dashboard-panel-half {
    grid-column: span 6;
}

.dashboard-section {
    margin-top: 1.5rem;
}

.dashboard-section-header {
    margin-bottom: 0.75rem;
}

.admin-snapshot-row {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1rem;
}

.snapshot-metric {
    padding: 1rem 1.1rem;
    border: 1px solid rgba(21, 58, 52, 0.1);
    border-radius: 14px;
    background: rgba(21, 58, 52, 0.04);
}

.snapshot-metric span {
    display: block;
    margin-bottom: 0.45rem;
    color: var(--muted);
}

.snapshot-metric strong {
    font-size: 1.45rem;
    color: var(--accent-strong);
}

.kpi-card strong {
    display: block;
    margin: 0.35rem 0 0.6rem;
    font-size: 2rem;
    line-height: 1;
    color: var(--accent-strong);
}

.kpi-card p {
    margin: 0.2rem 0;
    color: var(--muted);
}

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

.filters {
    display: flex;
    gap: 1rem;
    align-items: end;
    flex-wrap: wrap;
}

.filter-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.alert {
    padding: 0.85rem 1rem;
    border-radius: 12px;
    margin-bottom: 1rem;
}

.alert-success {
    background: rgba(31, 111, 67, 0.12);
    color: var(--success);
}

.alert-error {
    background: rgba(155, 44, 44, 0.12);
    color: var(--danger);
}

label {
    display: grid;
    gap: 0.4rem;
}

.helper-text {
    margin: 0;
    color: var(--muted);
}

.helper-text-spaced {
    margin-bottom: 1rem;
}

.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    padding: 0.2rem 0.6rem;
    border-radius: 999px;
    border: 1px solid rgba(21, 58, 52, 0.14);
    background: rgba(21, 58, 52, 0.08);
    color: var(--accent-strong);
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.2;
    white-space: nowrap;
}

.badge-source-ecommerce {
    border-color: rgba(42, 103, 176, 0.18);
    background: rgba(42, 103, 176, 0.12);
    color: #1e4b82;
}

.badge-source-retail {
    border-color: rgba(31, 111, 67, 0.18);
    background: rgba(31, 111, 67, 0.12);
    color: #1f6f43;
}

.badge-language-english {
    border-color: rgba(163, 92, 31, 0.2);
    background: rgba(163, 92, 31, 0.12);
    color: #9a5416;
}

.badge-language-french {
    border-color: rgba(144, 52, 126, 0.2);
    background: rgba(144, 52, 126, 0.12);
    color: #7f2f6f;
}

.badge-attention {
    border-color: rgba(155, 44, 44, 0.22);
    background: rgba(155, 44, 44, 0.12);
    color: #8f2626;
}

input,
select,
button {
    font: inherit;
}

input,
select {
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
}

textarea {
    width: 100%;
    min-height: 3.5rem;
    padding: 0.75rem 0.85rem;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: #fff;
    resize: vertical;
    font: inherit;
}

button,
.button-link {
    display: inline-block;
    padding: 0.85rem 1.1rem;
    border-radius: 999px;
    border: 0;
    background: var(--accent);
    color: #fff;
    text-decoration: none;
    cursor: pointer;
}

.inline-toggle {
    padding: 0;
    background: transparent;
    color: var(--accent);
    border: 0;
    border-radius: 0;
}

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

.card th,
.card td {
    text-align: left;
    padding: 0.8rem 0.6rem;
    border-bottom: 1px solid var(--border);
}

.card thead th {
    background: rgba(21, 58, 52, 0.08);
    color: var(--accent-strong);
    font-weight: 700;
}

.card tbody tr:nth-child(even) td {
    background: rgba(36, 95, 84, 0.04);
}

.card tbody tr:hover td {
    background: rgba(36, 95, 84, 0.12);
}

.activity-details-row td {
    background: rgba(21, 58, 52, 0.03);
    padding: 0;
}

.activity-details {
    padding: 1rem;
}

.diagnostics {
    margin-top: 2rem;
    padding: 1rem 1.25rem;
    border: 1px solid #e3b4b4;
    border-radius: 14px;
    background: #fff3f3;
}

.diagnostic-item + .diagnostic-item {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid #e8caca;
}

.diagnostics pre {
    overflow-x: auto;
    padding: 0.75rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 8px;
}

.card pre {
    max-width: 100%;
    overflow-x: auto;
    white-space: pre-wrap;
    overflow-wrap: anywhere;
    word-break: break-word;
    padding: 0.9rem 1rem;
    background: rgba(21, 58, 52, 0.05);
    border: 1px solid rgba(21, 58, 52, 0.08);
    border-radius: 12px;
}

.card td {
    vertical-align: top;
    overflow-wrap: anywhere;
    word-break: break-word;
}

.split-actions {
    display: flex;
    gap: 1rem;
    flex-wrap: wrap;
}

.split-actions form {
    margin: 0;
}

details summary {
    cursor: pointer;
    color: var(--accent);
}

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

    .sidebar {
        position: static;
        height: auto;
        overflow: visible;
    }

    .page-header {
        display: block;
    }

    .dashboard-panel-half,
    .dashboard-panel-wide {
        grid-column: span 12;
    }

    .admin-snapshot-row {
        grid-template-columns: 1fr;
    }

    .combined-review-card {
        grid-template-columns: 1fr;
    }
}
