@import url('https://fonts.googleapis.com/css2?family=Schibsted+Grotesk:wght@400;500;600;700;800&family=Chakra+Petch:wght@500;600;700&display=swap');

:root {
    --brand-red: #7b5a46;
    --brand-orange: #b79a84;
    --brand-navy: #2f2b28;
    --text-muted: #6e665f;
    --bg: #f4efe9;
    --bg-soft: #fcfaf7;
    --line: #e4dad0;
    --green: #0c8f4e;
    --green-soft: #e8f8ef;
    --danger: #b91c1c;
    --danger-soft: #feecec;
    --warning: #9a5b00;
    --warning-soft: #fff4dd;
    --info: #6b7b86;
    --info-soft: #edf2f4;
    --radius: 14px;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: 'Schibsted Grotesk', sans-serif;
    color: var(--brand-navy);
    background: var(--bg);
    line-height: 1.4;
}

h1,
h2,
h3,
h4,
h5 {
    margin: 0;
    font-family: 'Chakra Petch', sans-serif;
    color: var(--brand-navy);
}

p {
    margin: 0;
}

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

.bg-layer {
    position: fixed;
    inset: 0;
    z-index: -1;
    background: linear-gradient(180deg, #f7f2ec 0%, #f4efe9 100%);
}

.app-shell {
    max-width: 1320px;
    margin: 0 auto;
    padding: 18px 16px 36px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 18px;
    border-radius: 18px;
    padding: 18px 20px;
    background: #f0e7dd;
    color: var(--brand-navy);
    border: 1px solid var(--line);
    box-shadow: 0 4px 12px rgba(47, 43, 40, 0.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 16px;
}

.brand-logo {
    object-fit: contain;
    display: block;
}

.brand-logo-full {
    width: clamp(210px, 34vw, 390px);
    height: auto;
    max-height: 90px;
    border: 0;
    border-radius: 0;
    background: transparent;
    padding: 0;
    filter: drop-shadow(0 2px 6px rgba(47, 43, 40, 0.12));
}

.brand-copy h1 {
    color: #fff;
    font-size: 1.35rem;
    line-height: 1.15;
}

.brand-kicker {
    font-size: 0.74rem;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    opacity: 0.85;
    margin-bottom: 5px;
}

.brand-sub {
    margin-top: 4px;
    opacity: 0.9;
    font-size: 0.9rem;
}

.user-box {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 4px;
}

.user-name {
    font-size: 1rem;
    font-weight: 700;
}

.user-role {
    font-size: 0.84rem;
    opacity: 0.92;
}

.navbar {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    margin: 16px 0;
}

.nav-item {
    border-radius: 11px;
    border: 1px solid var(--line);
    background: #fff;
    color: var(--brand-navy);
    padding: 10px 14px;
    font-size: 0.92rem;
    text-decoration: none;
    font-weight: 600;
    transition: 0.2s ease;
}

.nav-item:hover,
.nav-item.active {
    background: #efe5db;
    border-color: #d4c6b7;
    color: var(--brand-navy);
}

.content {
    display: block;
}

.panel {
    background: var(--bg-soft);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 6px 14px rgba(20, 25, 60, 0.05);
    animation: panel-rise 0.36s ease both;
}

.panel-head {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 12px;
}

.panel-head p {
    color: var(--text-muted);
    font-size: 0.92rem;
}

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

.card-stat {
    border-radius: 12px;
    border: 1px solid var(--line);
    background: #fff;
    padding: 14px;
}

.card-stat .label {
    color: var(--text-muted);
    font-size: 0.82rem;
    margin-bottom: 6px;
}

.card-stat .value {
    font-size: 1.65rem;
    line-height: 1;
    font-weight: 800;
    color: var(--brand-navy);
}

.card-stat .trend {
    margin-top: 6px;
    color: var(--brand-red);
    font-size: 0.82rem;
    font-weight: 600;
}

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

.kpi-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    background: #fff;
}

.kpi-box h3 {
    font-size: 1rem;
    margin-bottom: 7px;
}

.kpi-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.kpi-value {
    color: var(--brand-navy) !important;
    font-size: 1.24rem !important;
    font-weight: 800;
    margin-bottom: 2px;
}

.flash {
    border-radius: 11px;
    border: 1px solid transparent;
    padding: 12px 14px;
    margin-bottom: 12px;
    font-weight: 600;
}

.flash-success {
    background: var(--green-soft);
    color: var(--green);
    border-color: #bde7ce;
}

.flash-error {
    background: var(--danger-soft);
    color: var(--danger);
    border-color: #f8c3c3;
}

.flash-info {
    background: var(--info-soft);
    color: var(--info);
    border-color: #c4d3ff;
}

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

.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.field label {
    color: var(--text-muted);
    font-size: 0.84rem;
    font-weight: 600;
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid #d4dcec;
    border-radius: 10px;
    padding: 10px 11px;
    font-size: 0.92rem;
    font-family: 'Schibsted Grotesk', sans-serif;
    color: var(--brand-navy);
    background: #fff;
}

.field textarea {
    min-height: 100px;
    resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(229, 36, 33, 0.55);
    box-shadow: 0 0 0 3px rgba(229, 36, 33, 0.12);
}

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

.inline-form {
    display: inline-flex;
    gap: 6px;
}

.btn {
    border: 0;
    border-radius: 10px;
    padding: 9px 13px;
    font-size: 0.88rem;
    text-decoration: none;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-family: 'Chakra Petch', sans-serif;
}

.btn:focus-visible,
.nav-item:focus-visible {
    outline: 3px solid rgba(229, 36, 33, 0.35);
    outline-offset: 2px;
}

.btn-primary {
    background: #6f5443;
    color: #fff;
}

.btn-primary:hover {
    background: #5e483a;
}

.btn-secondary {
    border: 1px solid #d3d9ea;
    background: #fff;
    color: var(--brand-navy);
}

.btn-secondary:hover {
    border-color: rgba(20, 25, 60, 0.42);
}

.btn-warning {
    background: var(--brand-orange);
    color: #2f2b28;
}

.btn-danger {
    background: var(--danger);
    color: #fff;
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #fff;
}

table {
    width: 100%;
    border-collapse: collapse;
    min-width: 840px;
}

thead {
    background: #f4f6fc;
}

th,
td {
    border-bottom: 1px solid var(--line);
    padding: 10px;
    text-align: left;
    vertical-align: top;
    font-size: 0.9rem;
}

th {
    font-family: 'Chakra Petch', sans-serif;
    font-weight: 600;
    font-size: 0.86rem;
    color: var(--brand-navy);
}

td .row-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.badge {
    display: inline-flex;
    border-radius: 999px;
    padding: 3px 9px;
    font-size: 0.78rem;
    font-weight: 700;
}

.badge-success {
    background: var(--green-soft);
    color: var(--green);
}

.badge-warning {
    background: var(--warning-soft);
    color: var(--warning);
}

.badge-danger {
    background: var(--danger-soft);
    color: var(--danger);
}

.badge-info {
    background: var(--info-soft);
    color: var(--info);
}

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

.login-shell {
    max-width: 450px;
    margin: 70px auto;
}

.login-title {
    margin-bottom: 6px;
}

.login-sub {
    color: var(--text-muted);
    margin-bottom: 12px;
}

.footer {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.84rem;
    padding: 8px 0 0;
}

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

.small-input {
    width: 120px;
}

.site-load-item {
    margin-bottom: 12px;
}

.site-load-head {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    font-size: 0.9rem;
    margin-bottom: 4px;
}

.site-load-progress {
    height: 8px;
    border-radius: 999px;
    background: #eceff7;
    overflow: hidden;
}

.site-load-progress span {
    display: block;
    height: 100%;
    border-radius: inherit;
    background: #8f7763;
}

.alert-stack {
    display: grid;
    gap: 10px;
}

.alert-box {
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px;
    background: #fff;
}

.alert-box h4 {
    margin: 0 0 4px;
    font-family: 'Chakra Petch', sans-serif;
    font-size: 0.96rem;
}

.alert-box p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

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

.export-card {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 14px;
    text-decoration: none;
    color: var(--brand-navy);
    background: #fff;
    transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.export-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px rgba(20, 25, 60, 0.08);
    border-color: rgba(229, 36, 33, 0.34);
}

.export-card h3 {
    margin-bottom: 6px;
    font-size: 1rem;
}

.export-card p {
    color: var(--text-muted);
    font-size: 0.89rem;
}

.export-card.active {
    border-color: #d4c6b7;
    background: #f3ebe3;
}

.table-meta {
    color: var(--text-muted);
    font-size: 0.85rem;
}

.helper-note {
    margin-top: 10px;
    color: var(--text-muted);
    font-size: 0.85rem;
}

@keyframes panel-rise {
    from {
        opacity: 0;
        transform: translateY(8px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

@media (max-width: 1024px) {
    .topbar {
        padding: 16px;
    }

    .brand-copy h1 {
        font-size: 1.2rem;
    }
}

@media (max-width: 768px) {
    .app-shell {
        padding: 14px 10px 26px;
    }

    .topbar {
        border-radius: 14px;
    }

    .brand {
        width: 100%;
    }

    .user-box {
        width: 100%;
        align-items: flex-start;
    }

    .login-shell {
        margin-top: 36px;
    }

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

    .actions {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .grid-cards {
        grid-template-columns: 1fr;
    }

    .form-grid,
    .two-col {
        grid-template-columns: 1fr;
    }

    .brand-logo-full {
        width: min(260px, 86vw);
        max-height: none;
    }

    .brand-copy h1 {
        font-size: 1.05rem;
    }
}
