:root {
    --bg: #f4f2ea;
    --panel: #ffffff;
    --panel-soft: #faf8f2;
    --ink: #181a1f;
    --muted: #69707d;
    --line: #e3e0d6;
    --brand: #ff8a00;
    --brand-dark: #1f2328;
    --brand-soft: #fff1db;
    --success: #147d4f;
    --danger: #b42318;
    --shadow: 0 26px 80px rgba(23, 26, 31, .12);
    --glass: rgba(255, 255, 255, .72);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
    margin: 0;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    background:
        radial-gradient(circle at top left, rgba(255, 138, 0, .20), transparent 30rem),
        radial-gradient(circle at 92% 8%, rgba(40, 44, 52, .09), transparent 24rem),
        linear-gradient(180deg, #fbfaf6 0%, var(--bg) 100%);
    color: var(--ink);
}
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; }

.shell {
    display: grid;
    grid-template-columns: 292px minmax(0, 1fr);
    min-height: 100vh;
}

.side {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 18px;
    background:
        linear-gradient(180deg, rgba(255,138,0,.08), transparent 22rem),
        #15171c;
    color: #fff;
    border-right: 1px solid rgba(255,255,255,.08);
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 8px 22px;
}
.brand img { width: 48px; height: 48px; object-fit: cover; border-radius: 12px; box-shadow: 0 0 28px rgba(255,138,0,.28); }
.brand strong { display: block; font-size: 18px; letter-spacing: .2px; }
.brand span { display: block; color: #aeb6c2; font-size: 12px; margin-top: 2px; }

.nav { display: grid; gap: 6px; }
.nav a, .logout {
    width: 100%;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 13px;
    border: 0;
    border-radius: 10px;
    color: #eef1f4;
    background: transparent;
    text-align: left;
    cursor: pointer;
}
.nav a:hover, .logout:hover, .nav a.active {
    background: rgba(255,255,255,.09);
    box-shadow: inset 3px 0 0 var(--brand);
}

.mobile-bar {
    display: none;
    position: sticky;
    top: 0;
    z-index: 20;
    padding: 12px 14px;
    background: rgba(250,248,242,.92);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--line);
}
.menu-toggle {
    width: 42px;
    height: 42px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #fff;
    font-weight: 900;
}

.main { min-width: 0; padding: 30px; }
.top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 16px;
    margin-bottom: 24px;
    padding: 18px;
    border: 1px solid rgba(227,224,214,.82);
    border-radius: 18px;
    background: var(--glass);
    backdrop-filter: blur(18px);
    box-shadow: 0 18px 60px rgba(23,26,31,.07);
}
.command-zone { display: flex; gap: 10px; flex-wrap: wrap; justify-content: flex-end; }
.eyebrow { color: var(--brand); font-weight: 800; font-size: 12px; text-transform: uppercase; }
h1, h2 { letter-spacing: 0; }
h1 { margin: 0; font-size: clamp(26px, 3vw, 38px); line-height: 1.05; }
h2 { font-size: 18px; margin: 0 0 14px; }
.muted { color: var(--muted); }

.grid { display: grid; gap: 16px; }
.stats { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.card {
    background: rgba(255,255,255,.78);
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 18px;
    box-shadow: 0 1px 0 rgba(255,255,255,.7) inset, 0 18px 50px rgba(23,26,31,.055);
    backdrop-filter: blur(14px);
}
.metric { font-size: 24px; line-height: 1.1; font-weight: 850; margin-top: 6px; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    border: 0;
    border-radius: 12px;
    padding: 10px 15px;
    background: var(--brand);
    color: #151515;
    font-weight: 850;
    cursor: pointer;
    box-shadow: 0 12px 28px rgba(255,138,0,.22);
    transition: transform .16s ease, box-shadow .16s ease, background .16s ease;
}
.btn:hover { transform: translateY(-1px); box-shadow: 0 16px 34px rgba(255,138,0,.24); }
.btn.secondary { background: #fff; color: var(--ink); border: 1px solid var(--line); box-shadow: none; }
.btn.warn { background: var(--brand-soft); color: #5c3200; border: 1px solid #ffd8a3; box-shadow: none; }
.btn.danger { background: var(--danger); color: #fff; box-shadow: none; }
.btn.ghost { background: transparent; color: inherit; border: 1px solid rgba(255,255,255,.18); box-shadow: none; }

input, select, textarea {
    width: 100%;
    border: 1px solid var(--line);
    border-radius: 12px;
    padding: 12px 13px;
    background: #fff;
    color: var(--ink);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 4px rgba(255,138,0,.13);
}
label { display: grid; gap: 7px; font-size: 13px; font-weight: 800; color: #373b43; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }

.table-wrap {
    overflow: auto;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
}
table { width: 100%; border-collapse: collapse; min-width: 780px; }
th, td { padding: 14px 15px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: middle; }
th { font-size: 11px; text-transform: uppercase; color: var(--muted); background: #fbfaf7; letter-spacing: .04em; }
tr:last-child td { border-bottom: 0; }
.money { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 9px;
    border-radius: 999px;
    background: #eef0f2;
    font-size: 12px;
    font-weight: 850;
    white-space: nowrap;
}
.ok { background: #e3f6ec; color: var(--success); }
.bad { background: #fee4e2; color: var(--danger); }
.notice {
    padding: 12px 14px;
    border-radius: 12px;
    background: #fff7e8;
    border: 1px solid #ffd8a3;
    margin-bottom: 16px;
}
.errors { background: #fff0f0; border-color: #ffd0d0; }

.auth-page {
    min-height: 100vh;
    display: grid;
    grid-template-columns: minmax(0, 1.15fr) minmax(360px, .85fr);
    background: #171a1f;
    color: #fff;
}
.auth-hero {
    position: relative;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: clamp(28px, 5vw, 64px);
    overflow: hidden;
}
.auth-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background: linear-gradient(90deg, rgba(23,26,31,.82), rgba(23,26,31,.46)), url("/images/genc-elektrik-logo.png") center / cover;
    opacity: .9;
}
.auth-hero > * { position: relative; z-index: 1; }
.auth-logo { width: 92px; height: 92px; border-radius: 20px; object-fit: cover; box-shadow: 0 0 45px rgba(255,138,0,.38); }
.auth-title { max-width: 760px; }
.auth-title h1 { font-size: clamp(38px, 7vw, 82px); }
.auth-title p { max-width: 560px; color: #e2e4e7; font-size: 18px; line-height: 1.55; }
.auth-panel {
    display: grid;
    place-items: center;
    padding: 28px;
    background: #f7f4ec;
    color: var(--ink);
}
.auth-card { width: min(460px, 100%); background: #fff; border-radius: 18px; padding: 26px; box-shadow: var(--shadow); }
.step {
    padding: 14px 0;
    border-bottom: 1px solid var(--line);
}
.step:last-child { border-bottom: 0; }

.quote-workspace {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 360px;
    align-items: start;
    gap: 16px;
}
.quote-summary { position: sticky; top: 24px; }
.quote-summary .card {
    background:
        radial-gradient(circle at top right, rgba(255,138,0,.24), transparent 12rem),
        #171a1f;
    color: #fff;
    border-color: #171a1f;
}
.quote-summary .muted { color: #b6bdc7; }
.quote-total { font-size: 34px; font-weight: 900; }
.two-col { grid-template-columns: 1fr 1fr; }

@media (max-width: 1100px) {
    .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .quote-workspace { grid-template-columns: 1fr; }
    .quote-summary { position: static; }
}

@media (max-width: 860px) {
    .mobile-bar { display: flex; justify-content: space-between; align-items: center; }
    .shell { display: block; }
    .side {
        position: fixed;
        inset: 0 auto 0 0;
        z-index: 30;
        width: min(86vw, 320px);
        transform: translateX(-105%);
        transition: transform .2s ease;
        box-shadow: var(--shadow);
    }
    body.menu-open .side { transform: translateX(0); }
    body.menu-open::after {
        content: "";
        position: fixed;
        inset: 0;
        z-index: 25;
        background: rgba(0,0,0,.36);
    }
    .main { padding: 16px; }
    .top { flex-direction: column; border-radius: 14px; padding: 14px; }
    .command-zone { width: 100%; justify-content: stretch; }
    .command-zone > * { flex: 1 1 100%; }
    .form-grid, .stats { grid-template-columns: 1fr; }
    .two-col { grid-template-columns: 1fr; }
    .card { padding: 15px; border-radius: 12px; }
    .actions .btn, .actions select, .actions input { flex: 1 1 100%; }
    .auth-page { grid-template-columns: 1fr; }
    .auth-hero { min-height: 42vh; padding: 24px; }
    .auth-panel { padding: 16px; }
    table { min-width: 0; }
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    .table-wrap table, .table-wrap thead, .table-wrap tbody, .table-wrap tr, .table-wrap th, .table-wrap td { display: block; width: 100%; }
    .table-wrap thead { display: none; }
    .table-wrap tr {
        margin-bottom: 12px;
        border: 1px solid var(--line);
        border-radius: 12px;
        background: #fff;
        overflow: hidden;
    }
    .table-wrap td {
        display: flex;
        justify-content: space-between;
        gap: 12px;
        border-bottom: 1px solid var(--line);
        text-align: right;
    }
    .table-wrap td::before {
        content: attr(data-label);
        min-width: 96px;
        color: var(--muted);
        font-weight: 850;
        text-align: left;
    }
    .table-wrap td:empty { display: none; }
    .quote-items td { display: grid; grid-template-columns: 1fr; text-align: left; }
    .quote-items td::before { min-width: 0; }
    .money { text-align: right; }
}
