/* R-Carnet Intranet - stílusok */

:root {
    --primary: #1a56db;
    --primary-dark: #1443b0;
    --primary-light: #e8effc;
    --bg: #f3f5f9;
    --surface: #ffffff;
    --border: #e2e6ee;
    --text: #1e2532;
    --text-muted: #6b7486;
    --success: #0e9f6e;
    --success-bg: #e6f7f1;
    --danger: #e02424;
    --danger-bg: #fdecec;
    --sidebar-bg: #141b2b;
    --sidebar-text: #aeb6c8;
    --sidebar-active: #ffffff;
    --radius: 10px;
    --shadow: 0 1px 3px rgba(20, 27, 43, .08), 0 4px 16px rgba(20, 27, 43, .05);
    --sidebar-w: 250px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    background: var(--bg);
    color: var(--text);
    font-size: 15px;
    line-height: 1.5;
}

h1 { font-size: 1.5rem; margin: 0 0 4px; }
h2 { font-size: 1.15rem; margin: 0 0 12px; }
a { color: var(--primary); text-decoration: none; }
.muted { color: var(--text-muted); }
code { background: var(--primary-light); padding: 1px 5px; border-radius: 4px; font-size: .9em; }

/* ---------- Elrendezés ---------- */

.app { min-height: 100vh; }

.content {
    padding: 24px;
    margin-left: var(--sidebar-w);
    max-width: 1200px;
}

/* ---------- Oldalsáv ---------- */

.sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: var(--sidebar-w);
    background: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    z-index: 40;
    transition: transform .25s ease;
}

.sidebar-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}

.brand-logo {
    height: 36px;
    width: auto;
    max-width: 100%;
    display: block;
}

.sidebar-nav { flex: 1; overflow-y: auto; padding: 12px 8px; }

.nav-section {
    font-size: .72rem;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #5c667c;
    padding: 14px 10px 6px;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--sidebar-text);
    padding: 9px 10px;
    border-radius: 8px;
    margin-bottom: 2px;
    font-size: .93rem;
}
.nav-item:hover { background: rgba(255,255,255,.06); color: var(--sidebar-active); }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-icon {
    width: 22px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.nav-svg { width: 18px; height: 18px; display: block; }

.nav-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px; height: 20px;
    border-radius: 6px;
    background: rgba(255,255,255,.12);
    font-size: .7rem;
    font-weight: 700;
}
.nav-item.active .nav-monogram { background: rgba(255,255,255,.22); }

.sidebar-footer { padding: 8px; border-top: 1px solid rgba(255,255,255,.08); }
.nav-logout:hover { background: rgba(224,36,36,.15); color: #f8b4b4; }

/* ---------- Mobil fejléc ---------- */

.topbar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--sidebar-bg);
    color: #fff;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
}
.topbar-logo { height: 22px; width: auto; margin-right: auto; }
.topbar-user { font-size: .85rem; color: var(--sidebar-text); }

.menu-toggle {
    background: none;
    border: none;
    padding: 6px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.menu-toggle span {
    display: block;
    width: 20px; height: 2px;
    background: #fff;
    border-radius: 2px;
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.45);
    z-index: 35;
}

/* ---------- Kártyák ---------- */

.card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    margin-bottom: 20px;
}

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

.module-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
    gap: 16px;
}

.module-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 20px;
    display: block;
    color: var(--text);
    transition: transform .15s ease, box-shadow .15s ease;
}
.module-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(20,27,43,.12);
}
.module-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 42px; height: 42px;
    border-radius: 10px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: 1.15rem;
    font-weight: 700;
}
.module-card h3 { margin: 10px 0 4px; font-size: 1.02rem; }
.module-card p { margin: 0; font-size: .85rem; color: var(--text-muted); }

.badge {
    display: inline-block;
    font-size: .72rem;
    font-weight: 600;
    padding: 3px 9px;
    border-radius: 99px;
    margin-top: 10px;
}
.badge-view { background: var(--primary-light); color: var(--primary-dark); }
.badge-edit { background: var(--success-bg); color: var(--success); }
.badge-admin { background: #fdf2e3; color: #b45309; }
.badge-inactive { background: var(--danger-bg); color: var(--danger); }

/* ---------- Űrlapok ---------- */

label { display: block; margin-bottom: 14px; font-weight: 500; font-size: .9rem; }

input[type=text], input[type=email], input[type=password], select, textarea {
    display: block;
    width: 100%;
    margin-top: 5px;
    padding: 9px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-size: .95rem;
    font-family: inherit;
    background: #fff;
    color: var(--text);
}
input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(26,86,219,.15);
}

.checkbox-label { display: flex; align-items: center; gap: 8px; font-weight: 400; }
.checkbox-label input { width: auto; margin: 0; }

.btn {
    display: inline-block;
    border: none;
    border-radius: 8px;
    padding: 9px 18px;
    font-size: .93rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    text-align: center;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-secondary { background: #e6e9f0; color: var(--text); }
.btn-secondary:hover { background: #d8dce6; }
.btn-danger { background: var(--danger-bg); color: var(--danger); }
.btn-danger:hover { background: #f9d3d3; }
.btn-sm { padding: 5px 12px; font-size: .83rem; }
.btn-block { display: block; width: 100%; }

/* ---------- Táblázatok ---------- */

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

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

th, td {
    text-align: left;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
th {
    font-size: .78rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--text-muted);
}
tr:last-child td { border-bottom: none; }
tr:hover td { background: #f8fafd; }

/* ---------- Jogosultsági mátrix ---------- */

.perm-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.perm-row:last-child { border-bottom: none; }
.perm-module { display: flex; align-items: center; gap: 10px; min-width: 200px; }

.perm-monogram {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px; height: 30px;
    border-radius: 8px;
    background: var(--primary-light);
    color: var(--primary-dark);
    font-size: .85rem;
    font-weight: 700;
    flex-shrink: 0;
}

.perm-options { display: flex; gap: 6px; }
.perm-options input[type=radio] { display: none; }
.perm-options label {
    margin: 0;
    padding: 6px 14px;
    border: 1px solid var(--border);
    border-radius: 99px;
    font-size: .83rem;
    font-weight: 500;
    cursor: pointer;
    color: var(--text-muted);
    background: #fff;
}
.perm-options input[value="0"]:checked + label { background: #eceff4; color: var(--text); border-color: #c9cfda; }
.perm-options input[value="1"]:checked + label { background: var(--primary-light); color: var(--primary-dark); border-color: var(--primary); }
.perm-options input[value="2"]:checked + label { background: var(--success-bg); color: var(--success); border-color: var(--success); }

/* ---------- Üzenetek ---------- */

.alert {
    padding: 12px 16px;
    border-radius: 8px;
    margin-bottom: 16px;
    font-size: .92rem;
}
.alert-success { background: var(--success-bg); color: var(--success); }
.alert-error, .alert-danger { background: var(--danger-bg); color: var(--danger); }
.alert-info { background: var(--primary-light); color: var(--primary-dark); }

/* ---------- Bejelentkező / telepítő oldal ---------- */

.auth-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    padding: 16px;
    background: linear-gradient(135deg, #141b2b 0%, #1e2c4a 100%);
}

.auth-card {
    background: var(--surface);
    border-radius: 14px;
    box-shadow: 0 12px 40px rgba(0,0,0,.3);
    padding: 32px;
    width: 100%;
    max-width: 400px;
}
.auth-card h1 { font-size: 1.25rem; margin-bottom: 16px; }

.auth-logo {
    display: block;
    height: 44px;
    width: auto;
    max-width: 100%;
    margin-bottom: 18px;
}

/* ---------- Modul: tabnavigáció ---------- */

.tabs {
    display: flex;
    gap: 4px;
    flex-wrap: wrap;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.tab {
    padding: 8px 14px;
    border-radius: 8px 8px 0 0;
    color: var(--text-muted);
    font-size: .9rem;
    font-weight: 500;
    border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--text); background: #eef1f7; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); font-weight: 600; }

/* ---------- Modul: KPI kártyák ---------- */

.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: 14px;
    margin-bottom: 20px;
}
.kpi {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 16px 18px;
}
.kpi .kpi-value { font-size: 1.7rem; font-weight: 700; }
.kpi .kpi-label { font-size: .82rem; color: var(--text-muted); }
.kpi-blue .kpi-value { color: var(--primary); }
.kpi-green .kpi-value { color: var(--success); }
.kpi-red .kpi-value { color: var(--danger); }
.kpi-orange .kpi-value { color: #b45309; }

/* ---------- Modul: státusz-pipeline ---------- */

.pipeline {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 14px;
    background: #f6f8fc;
    border-radius: 8px;
    padding: 12px 14px;
    margin-bottom: 18px;
    font-size: .82rem;
}
.pipeline .step { display: flex; align-items: center; gap: 6px; color: var(--text-muted); }
.pipeline .dot { width: 9px; height: 9px; border-radius: 50%; background: #cdd4e0; flex-shrink: 0; }
.pipeline .step.done { color: var(--success); }
.pipeline .step.done .dot { background: var(--success); }
.pipeline .step.current { color: var(--primary); font-weight: 700; }
.pipeline .step.current .dot { background: var(--primary); }

/* ---------- Modul: tölcsér ---------- */

.funnel {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 12px;
}
.funnel-step {
    background: #f6f8fc;
    border-radius: 8px;
    padding: 14px;
    text-align: center;
}
.funnel-step .fv { font-size: 1.4rem; font-weight: 700; }
.funnel-step .fl { font-size: .8rem; color: var(--text-muted); }

/* ---------- Modul: vízszintes sávdiagram ---------- */

.hbar-row { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.hbar-label { width: 140px; font-size: .85rem; color: var(--text-muted); flex-shrink: 0; }
.hbar-track { flex: 1; background: #eef1f7; border-radius: 99px; height: 12px; overflow: hidden; }
.hbar-fill { height: 100%; border-radius: 99px; background: var(--primary); }
.hbar-value { width: 30px; text-align: right; font-weight: 600; font-size: .85rem; }

/* ---------- Modul: kiszállítási kártyák ---------- */

.delivery-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 16px;
}
.delivery-card {
    background: var(--surface);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 18px;
}
.delivery-card h3 { margin: 0 0 4px; font-size: 1.05rem; }
.delivery-card .addr { color: var(--text-muted); font-size: .87rem; margin-bottom: 10px; }
.delivery-items {
    background: #f6f8fc;
    border-radius: 8px;
    padding: 10px 12px;
    font-size: .87rem;
    margin: 10px 0;
}
.delivery-actions { display: flex; gap: 8px; margin-top: 12px; }

/* ---------- Modul: egyéb ---------- */

.badge-warn { background: #fdf2e3; color: #b45309; }
.badge-purple { background: #f0e9fc; color: #6d28d9; }
.badge-muted { background: #eceff4; color: var(--text-muted); }

.progress-track { background: #eef1f7; border-radius: 99px; height: 10px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; background: var(--primary); }

.detail-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px 24px;
    margin-bottom: 16px;
}
.detail-grid .dt { font-size: .72rem; text-transform: uppercase; letter-spacing: .04em; color: var(--text-muted); margin-bottom: 2px; }
.detail-grid .dd { font-weight: 500; }

.item-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: #f6f8fc;
    border-radius: 8px;
    padding: 10px 14px;
    margin-bottom: 8px;
    flex-wrap: wrap;
    font-size: .9rem;
}
.item-row code { background: #fff; }

.next-step {
    display: flex;
    align-items: center;
    gap: 14px;
    background: var(--primary-light);
    border-radius: 8px;
    padding: 14px 16px;
    margin: 16px 0;
    flex-wrap: wrap;
}

.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li {
    position: relative;
    padding: 0 0 14px 22px;
    font-size: .87rem;
    border-left: 2px solid var(--border);
    margin-left: 5px;
}
.timeline li::before {
    content: '';
    position: absolute;
    left: -6px; top: 3px;
    width: 10px; height: 10px;
    border-radius: 50%;
    background: var(--primary);
}
.timeline li .tl-meta { color: var(--text-muted); font-size: .78rem; }

.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; }
.inline-form label { margin-bottom: 0; flex: 1; min-width: 130px; }

.followup-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
}
.followup-row:last-child { border-bottom: none; }
.followup-actions { display: flex; gap: 6px; }

/* ---------- Mobil ---------- */

@media (max-width: 900px) {
    .topbar { display: flex; }
    .content { margin-left: 0; padding: 16px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.visible { display: block; }
    .perm-module { min-width: 0; width: 100%; }
    .detail-grid { grid-template-columns: 1fr; }
    .hbar-label { width: 105px; }
}
