/*
===============================================================================
Allegro - zamówienia / app.css
===============================================================================

KONFIGURACJA KOLORÓW:
Poniższa sekcja :root jest głównym miejscem zmiany kolorystyki.

--page-bg:
    Tło całej strony.

--card-bg:
    Tło kart: nagłówek, wykres, tabela.

--text:
    Główny kolor tekstu.

--muted:
    Kolor tekstu pomocniczego, np. "Ostatnie 7 dni".

--line:
    Linie, obramowania kart i tabel.

--accent:
    Główny akcent: liczba zamówień, link Log, badge.

--accent-dark:
    Ciemniejszy akcent: hover, mocniejsze teksty.

--accent-soft:
    Delikatne tło akcentowe: kafel z liczbą zamówień.

--chart-line:
    Kolor linii wykresu.

--chart-fill:
    Kolor wypełnienia pod linią wykresu.

--chart-work-hours:
    Podświetlenie godzin roboczych poniedziałek-piątek 08:00-16:00.

--chart-grid:
    Linie pomocnicze osi Y na wykresie.
===============================================================================
*/

:root {
    --page-bg: #eff6ff;
    --card-bg: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #dbeafe;

    --accent: #2563eb;
    --accent-dark: #1d4ed8;
    --accent-soft: rgba(37, 99, 235, .10);

    --chart-line: #2563eb;
    --chart-fill: rgba(37, 99, 235, .12);
    --chart-work-hours: rgba(96, 165, 250, .18);
    --chart-grid: rgba(15, 23, 42, .08);

    --danger-bg: #fef2f2;
    --danger-text: #991b1b;
    --danger-border: #fecaca;

    --shadow: 0 18px 45px rgba(15, 23, 42, .08);
    --radius-lg: 24px;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    font-family: "Montserrat", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background: var(--page-bg);
    color: var(--text);
}

body {
    min-height: 100%;
    margin: 0;
    background:
        radial-gradient(circle at top left, rgba(96, 165, 250, .22), transparent 34rem),
        var(--page-bg);
    color: var(--text);
}

.page-shell {
    width: min(1120px, calc(100% - 28px));
    margin: 0 auto;
    padding: 18px 0 32px;
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--line);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow);
}

.hero {
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 16px;
    align-items: center;
    padding: 20px;
}

.hero h1 {
    margin: 0;
    font-size: clamp(1.55rem, 4vw, 2.6rem);
    line-height: 1.08;
    letter-spacing: -.045em;
}

.muted {
    margin: 6px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.metric {
    min-width: 118px;
    padding: 14px 18px;
    border-radius: 18px;
    text-align: center;
    background: var(--accent-soft);
    border: 1px solid rgba(37, 99, 235, .18);
}

.metric-value {
    display: block;
    color: var(--accent-dark);
    font-size: 42px;
    font-weight: 800;
    line-height: .95;
}

.metric-label {
    display: block;
    margin-top: 5px;
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
}

.chart-card {
    position: relative;
    height: min(48vh, 460px);
    min-height: 310px;
    margin-top: 14px;
    padding: 12px;
    overflow: hidden;
}

.chart-card canvas {
    display: block;
    width: 100% !important;
    height: 100% !important;
}

.empty {
    margin: 0;
    padding: 18px;
    color: var(--muted);
    text-align: center;
}

.table-card {
    margin-top: 14px;
    overflow: hidden;
}

.table-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: baseline;
    padding: 14px 18px;
    border-bottom: 1px solid var(--line);
}

.table-header h2 {
    margin: 0;
    font-size: 18px;
    letter-spacing: -.02em;
}

.table-header span {
    color: var(--muted);
    font-size: 12px;
}

.responsive-table {
    width: 100%;
    overflow-x: auto;
}

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

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

th {
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: .06em;
    background: rgba(239, 246, 255, .7);
}

tbody tr:hover {
    background: rgba(239, 246, 255, .65);
}

.right {
    text-align: right;
}

.badge {
    display: inline-flex;
    justify-content: center;
    min-width: 26px;
    padding: 3px 8px;
    border-radius: 999px;
    color: var(--accent-dark);
    background: var(--accent-soft);
    border: 1px solid rgba(37, 99, 235, .18);
    font-weight: 800;
}

.footer-actions {
    margin: 14px 0 0;
    text-align: center;
}

.footer-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 72px;
    padding: 10px 16px;
    border-radius: 999px;
    border: 1px solid var(--line);
    background: var(--card-bg);
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 800;
}

.footer-actions a:hover {
    color: var(--accent-dark);
    border-color: var(--accent);
}

.alert {
    margin-top: 14px;
    padding: 16px;
    color: var(--danger-text);
    background: var(--danger-bg);
    border-color: var(--danger-border);
}

@media (max-width: 680px) {
    .page-shell {
        width: calc(100% - 12px);
        padding: 8px 0 18px;
    }

    .card {
        border-radius: 16px;
    }

    .hero {
        gap: 10px;
        padding: 12px;
    }

    .hero h1 {
        font-size: 19px;
        line-height: 1.1;
    }

    .muted {
        margin-top: 3px;
        font-size: 12px;
        line-height: 1.2;
    }

    .metric {
        min-width: 68px;
        padding: 9px 10px;
        border-radius: 14px;
    }

    .metric-value {
        font-size: 25px;
    }

    .metric-label {
        margin-top: 3px;
        font-size: 10px;
    }

    .chart-card {
        height: 310px;
        min-height: 310px;
        max-height: 310px;
        padding: 8px;
        margin-top: 8px;
        overflow: hidden;
    }

    .chart-card canvas {
        width: 100% !important;
        height: 100% !important;
    }

    .table-card {
        margin-top: 8px;
    }

    .table-header {
        padding: 8px 10px;
    }

    .table-header h2 {
        font-size: 13px;
    }

    .table-header span {
        display: none;
    }

    .responsive-table {
        overflow-x: auto;
    }

    table {
        table-layout: fixed;
        width: 100%;
    }

    th,
    td {
        padding: 5px 4px;
        font-size: 10px;
        line-height: 1.15;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
    }

    th {
        font-size: 9px;
        letter-spacing: .03em;
    }

    th:nth-child(1),
    td:nth-child(1) {
        width: 24%;
    }

    th:nth-child(2),
    td:nth-child(2) {
        width: 22%;
    }

    th:nth-child(3),
    td:nth-child(3) {
        width: 12%;
        text-align: center;
    }

    th:nth-child(4),
    td:nth-child(4) {
        width: 17%;
    }

    th:nth-child(5),
    td:nth-child(5) {
        width: 25%;
    }

    .badge {
        min-width: 20px;
        padding: 2px 5px;
        font-size: 10px;
    }

    .footer-actions {
        margin-top: 8px;
    }

    .footer-actions a {
        padding: 8px 12px;
        font-size: 12px;
    }
}
