/* ── Reset & base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --clr-primary:   #6B8F71;
    --clr-primary-d: #547059;
    --clr-bg:        #f3f4f6;
    --clr-surface:   #ffffff;
    --clr-border:    #e5e7eb;
    --clr-text:      #1f2937;
    --clr-muted:     #6b7280;
    --clr-success:   #16a34a;
    --clr-danger:    #dc2626;
    --clr-warning:   #d97706;
    --radius:        10px;
    --shadow:        0 2px 12px rgba(0,0,0,.08);
    --nav-h:         60px;
}

html { font-size: 16px; }

body {
    font-family: 'Segoe UI', Arial, sans-serif;
    background: var(--clr-bg);
    color: var(--clr-text);
    line-height: 1.6;
    min-height: 100dvh;
}

a { color: var(--clr-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

img { max-width: 100%; display: block; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.page-wrap {
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
}

.main-content {
    flex: 1;
    padding: 24px 16px 48px;
    max-width: 960px;
    width: 100%;
    margin: 0 auto;
}

/* ── Nav ──────────────────────────────────────────────────────────────────── */
.site-nav {
    background: var(--clr-primary);
    height: var(--nav-h);
    display: flex;
    align-items: center;
    padding: 0 20px;
    position: sticky;
    top: 0;
    z-index: 100;
    box-shadow: 0 2px 8px rgba(0,0,0,.12);
}

.nav-brand {
    font-size: 1rem;
    font-weight: 700;
    color: #fff;
    flex: 1;
}
.nav-brand span { font-weight: 400; opacity: .8; }

.nav-links {
    display: flex;
    align-items: center;
    gap: 4px;
    list-style: none;
}

.nav-links a {
    color: rgba(255,255,255,.85);
    font-size: .875rem;
    padding: 6px 12px;
    border-radius: 6px;
    transition: background .15s, color .15s;
    white-space: nowrap;
}

.nav-links a:hover,
.nav-links a.active {
    background: rgba(255,255,255,.18);
    color: #fff;
    text-decoration: none;
}

.nav-hamburger {
    display: none;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px;
    color: #fff;
}

.nav-hamburger svg { display: block; }

/* Mobile nav — full-screen overlay z dużymi targetami */
@media (max-width: 640px) {
    .nav-hamburger { display: flex; }

    .nav-links {
        display: none;
        position: fixed;
        top: var(--nav-h);
        left: 0; right: 0;
        bottom: 0;
        height: calc(100dvh - var(--nav-h));
        background: var(--clr-primary-d);
        flex-direction: column;
        align-items: stretch;
        padding: 16px;
        gap: 10px;
        overflow-y: auto;
        z-index: 90;
    }

    .nav-links.open { display: flex; }

    .nav-links li { list-style: none; }

    .nav-links a {
        display: flex;
        align-items: center;
        min-height: 70px;
        padding: 12px 18px;
        font-size: 1.05rem;
        font-weight: 600;
        border-radius: 10px;
        background: rgba(255,255,255,.08);
        color: #fff;
        transition: background .15s, transform .08s;
    }
    .nav-links a:hover,
    .nav-links a:active { background: rgba(255,255,255,.18); }
    .nav-links a.active { background: rgba(255,255,255,.22); }
}

/* ── Cards ────────────────────────────────────────────────────────────────── */
.card {
    background: var(--clr-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 24px;
    margin-bottom: 20px;
}

.card-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--clr-text);
    margin-bottom: 16px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--clr-border);
}

/* ── Auth form (login / set-password) ─────────────────────────────────────── */
.auth-wrap {
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    background: var(--clr-bg);
}

.auth-box {
    background: var(--clr-surface);
    border-radius: 14px;
    box-shadow: 0 4px 24px rgba(0,0,0,.10);
    padding: 36px 32px;
    width: 100%;
    max-width: 420px;
}

.auth-logo {
    text-align: center;
    margin-bottom: 28px;
}

.auth-logo h1 {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--clr-primary);
}

.auth-logo p {
    font-size: .875rem;
    color: var(--clr-muted);
    margin-top: 4px;
}

@media (max-width: 460px) {
    .auth-box { padding: 28px 20px; }
}

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 16px; }

.form-label {
    display: block;
    font-size: .875rem;
    font-weight: 500;
    margin-bottom: 6px;
    color: var(--clr-text);
}

.form-control {
    display: block;
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--clr-border);
    border-radius: 8px;
    font-size: .9375rem;
    color: var(--clr-text);
    background: #fff;
    transition: border-color .15s, box-shadow .15s;
    appearance: none;
}

.form-control:focus {
    outline: none;
    border-color: var(--clr-primary);
    box-shadow: 0 0 0 3px rgba(107,143,113,.18);
}

.form-control::placeholder { color: #9ca3af; }

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-size: .9375rem;
    font-weight: 500;
    cursor: pointer;
    transition: background .15s, opacity .15s;
    text-decoration: none;
    white-space: nowrap;
}

.btn:hover { text-decoration: none; opacity: .9; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary {
    background: var(--clr-primary);
    color: #fff;
}
.btn-primary:hover { background: var(--clr-primary-d); opacity: 1; }

.btn-outline {
    background: #fff;
    color: var(--clr-text);
    border: 1px solid var(--clr-border);
}
.btn-outline:hover { background: var(--clr-bg); opacity: 1; }

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

.btn-sm { padding: 6px 14px; font-size: .8125rem; }
.btn-full { width: 100%; }

/* ── Alerts ───────────────────────────────────────────────────────────────── */
.alert {
    padding: 12px 16px;
    border-radius: 8px;
    font-size: .9rem;
    margin-bottom: 16px;
    border-left: 3px solid transparent;
}

.alert-error   { background: #fef2f2; color: #991b1b; border-color: var(--clr-danger); }
.alert-success { background: #f0fdf4; color: #166534; border-color: var(--clr-success); }
.alert-info    { background: #eff6ff; color: #1e40af; border-color: #3b82f6; }

/* ── Page title ───────────────────────────────────────────────────────────── */
.page-title {
    font-size: 1.375rem;
    font-weight: 700;
    margin-bottom: 20px;
    color: var(--clr-text);
}

/* ── Stats grid (dashboard) ───────────────────────────────────────────────── */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--clr-surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px 16px;
    text-align: center;
}

.stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: var(--clr-primary);
    line-height: 1;
}

.stat-label {
    font-size: .8125rem;
    color: var(--clr-muted);
    margin-top: 6px;
}

/* ── Table ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }

table.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: .9rem;
}

.data-table th,
.data-table td {
    padding: 10px 14px;
    text-align: left;
    border-bottom: 1px solid var(--clr-border);
}

.data-table th {
    font-weight: 600;
    font-size: .8125rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--clr-muted);
    background: #f9fafb;
}

.data-table tr:last-child td { border-bottom: none; }
.data-table tbody tr:hover { background: #f9fafb; }

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: .75rem;
    font-weight: 600;
}

.badge-green  { background: #dcfce7; color: #166534; }
.badge-gray   { background: #f3f4f6; color: #4b5563; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }

/* ── Empty state ──────────────────────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 48px 16px;
    color: var(--clr-muted);
}
.empty-state p { margin-top: 8px; font-size: .9rem; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
    background: var(--clr-surface);
    border-top: 1px solid var(--clr-border);
    padding: 16px;
    text-align: center;
    font-size: .8125rem;
    color: var(--clr-muted);
}

/* ── Responsive tweaks ────────────────────────────────────────────────────── */
@media (min-width: 641px) {
    .main-content { padding: 32px 24px 64px; }
}

@media (max-width: 640px) {
    .page-title { font-size: 1.2rem; }
    .card { padding: 18px 16px; }
    .data-table th, .data-table td { padding: 8px 10px; }
}
