/* ===== jnsngy. – sötét téma ===== */
:root {
    --bg:        #12151A;
    --bg-warm:   #2B241C;
    --surface:   rgba(255,255,255,.045);
    --surface-2: rgba(255,255,255,.07);
    --text:      #FFFFFF;
    --muted:     #9aa0ab;
    --border:    rgba(255,255,255,.10);
    --primary:   #FBA225;
    --primary-d: #e28d16;
    --on-primary:#12151A;
    --danger:    #f4506b;
    --success:   #35c07a;
    --info:      #5aa2f0;
    --shadow:    0 10px 34px rgba(0,0,0,.38);
    --radius:    14px;
    --sidebar-w: 250px;
    color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; min-height: 100%; }
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    color: var(--text);
    -webkit-font-smoothing: antialiased;
    line-height: 1.5;
    min-height: 100vh;
    background:
        radial-gradient(1100px 760px at 82% -8%, rgba(43,36,28,.95) 0%, rgba(43,36,28,0) 58%),
        radial-gradient(900px 700px at 0% 110%, rgba(43,36,28,.55) 0%, rgba(43,36,28,0) 55%),
        var(--bg);
    background-attachment: fixed;
}
/* Halvány zaj réteg */
body::before {
    content: ''; position: fixed; inset: 0; z-index: -1; pointer-events: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
    opacity: .05;
}
a { color: inherit; text-decoration: none; }

/* ---------- Auth (login / install) ---------- */
.auth-body {
    min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px;
}
.auth-card {
    width: 100%; max-width: 400px;
    background: var(--surface-2); border: 1px solid var(--border);
    border-radius: 18px; padding: 34px 30px; box-shadow: var(--shadow);
    backdrop-filter: blur(6px);
}
.auth-brand {
    display: flex; align-items: center; gap: 10px;
    font-weight: 700; font-size: 15px; color: var(--primary); margin-bottom: 18px;
}
.auth-title { margin: 0 0 20px; font-size: 24px; }

/* ---------- Form elemek ---------- */
.field { display: block; margin-bottom: 16px; }
.field > span {
    display: block; font-size: 13px; font-weight: 600; color: var(--muted); margin-bottom: 6px;
}
.field input, .field select, .field textarea {
    width: 100%; padding: 12px 14px;
    border: 1px solid var(--border); border-radius: 10px;
    font-size: 15px; background: rgba(0,0,0,.25); color: var(--text);
    font-family: inherit; transition: border-color .15s, box-shadow .15s;
}
.field textarea { resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus {
    outline: none; border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(251,162,37,.22); background: rgba(0,0,0,.35);
}
.field input::placeholder, .field textarea::placeholder { color: #6b7280; }

.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 11px 18px; border: none; border-radius: 10px;
    font-size: 14px; font-weight: 600; cursor: pointer;
    transition: background .15s, transform .05s, border-color .15s; font-family: inherit;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--primary); color: var(--on-primary); }
.btn-primary:hover { background: var(--primary-d); }
.btn-block { width: 100%; }
.btn-ghost { background: rgba(255,255,255,.07); color: var(--text); border: 1px solid var(--border); }
.btn-ghost:hover { background: rgba(255,255,255,.12); }
.btn-danger { background: rgba(244,80,107,.14); color: #ff8098; border: 1px solid rgba(244,80,107,.3); }
.btn-danger:hover { background: rgba(244,80,107,.24); }
.btn-sm { padding: 7px 12px; font-size: 13px; }

/* ---------- Alertek ---------- */
.alert { padding: 12px 15px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; border: 1px solid transparent; }
.alert ul { margin: 6px 0 0; padding-left: 18px; }
.alert-error   { background: rgba(244,80,107,.14); color: #ff9aac; border-color: rgba(244,80,107,.3); }
.alert-success { background: rgba(53,192,122,.14); color: #7be0ab; border-color: rgba(53,192,122,.3); }
.muted { color: var(--muted); font-size: 14px; }

/* ---------- App váz ---------- */
.app { display: flex; min-height: 100vh; }

.sidebar {
    width: var(--sidebar-w); flex-shrink: 0;
    background: rgba(9,11,15,.72); border-right: 1px solid var(--border);
    backdrop-filter: blur(10px);
    display: flex; flex-direction: column;
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 40;
    transition: transform .25s ease;
}
.sidebar-brand {
    display: flex; align-items: center; gap: 10px;
    padding: 20px 22px; font-weight: 700; font-size: 17px; color: #fff;
}
.brand-dot {
    width: 12px; height: 12px; border-radius: 50%;
    background: var(--primary); box-shadow: 0 0 14px rgba(251,162,37,.7);
}
.sidebar-nav { flex: 1; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.sidebar-nav a {
    display: flex; align-items: center; gap: 12px;
    padding: 11px 14px; border-radius: 10px;
    font-size: 14px; font-weight: 500; color: #b7bcc6;
    transition: background .15s, color .15s;
}
.sidebar-nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.sidebar-nav a.active { background: var(--primary); color: var(--on-primary); font-weight: 600; }
.menu-btn svg { width: 24px; height: 24px; display: block; }
.sidebar-foot { padding: 12px; border-top: 1px solid var(--border); }
.logout { display: block; padding: 11px 14px; border-radius: 10px; font-size: 14px; color: #b7bcc6; }
.logout:hover { background: rgba(255,255,255,.06); color: #fff; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.55); z-index: 39; }
.sidebar-overlay.show { display: block; }

.main { flex: 1; margin-left: var(--sidebar-w); min-width: 0; }

.topbar {
    position: sticky; top: 0; z-index: 30;
    display: flex; align-items: center; gap: 14px;
    background: rgba(18,21,26,.72); backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border); padding: 14px 24px;
}
.menu-btn { display: none; background: none; border: none; cursor: pointer; color: var(--text); padding: 0; line-height: 1; }
.topbar-title { font-size: 18px; margin: 0; flex: 1; }
.topbar-user { display: flex; align-items: center; gap: 10px; }
.avatar {
    width: 34px; height: 34px; border-radius: 50%;
    background: var(--primary); color: var(--on-primary);
    display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 15px;
}
.uname { font-size: 14px; font-weight: 600; }

.content { padding: 24px; max-width: 1100px; }

/* ---------- Kártyák ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px,1fr)); gap: 16px; margin-bottom: 20px; }
.card {
    background: var(--surface); border: 1px solid var(--border);
    border-radius: var(--radius); box-shadow: var(--shadow);
    padding: 20px; margin-bottom: 20px; backdrop-filter: blur(4px);
}
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; }
.card-head h2 { font-size: 16px; margin: 0; }
.stat { margin-bottom: 0; }
.stat-label { font-size: 13px; color: var(--muted); font-weight: 600; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }

.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }

/* ---------- Formok szélesebb kártyában ---------- */
.form-grid { display: grid; grid-template-columns: repeat(2,1fr); gap: 0 18px; }
.form-grid-4 { grid-template-columns: repeat(4,1fr); }
.form-grid-3 { grid-template-columns: repeat(3,1fr); }
.form-grid .field { grid-column: span 1; }
.form-actions { margin-top: 6px; display: flex; gap: 10px; }

/* Szakaszokra bontott űrlap */
.form-section { margin-bottom: 22px; }
.form-section:last-of-type { margin-bottom: 14px; }
.section-title {
    font-size: 12px; text-transform: uppercase; letter-spacing: .06em;
    color: var(--primary); font-weight: 700; margin: 0 0 14px;
    padding-bottom: 8px; border-bottom: 1px solid var(--border);
}
.sr-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); border: 0; }

/* ---------- Táblázat ---------- */
.table-wrap { overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th {
    text-align: left; font-size: 12px; text-transform: uppercase;
    letter-spacing: .03em; color: var(--muted); padding: 10px 12px;
    border-bottom: 1px solid var(--border);
}
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.row-actions { display: flex; gap: 6px; }
.row-actions form { margin: 0; }

.badge { padding: 3px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-admin { background: rgba(251,162,37,.16); color: var(--primary); }
.badge-user  { background: rgba(255,255,255,.08); color: #c3c8d2; }
.tag { font-size: 11px; background: rgba(255,255,255,.08); color: var(--muted); padding: 1px 6px; border-radius: 6px; }

.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 4px; }
.dot-on  { background: var(--success); }
.dot-off { background: #565b66; }

/* ---------- Toolbar / kereső ---------- */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.toolbar .spacer { flex: 1; }
.toolbar form { margin: 0; }
.search { flex: 1; min-width: 180px; }
.search input {
    width: 100%; padding: 10px 14px; border: 1px solid var(--border);
    border-radius: 10px; font-size: 14px; background: rgba(0,0,0,.25); color: var(--text); font-family: inherit;
}
.search input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(251,162,37,.22); }

/* ---------- Checkbox mező ---------- */
.field.checkbox { display: flex; align-items: center; gap: 8px; }
.field.checkbox input { width: auto; }
.field.checkbox > span { margin: 0; }
.field-full { grid-column: 1 / -1; }

/* ---------- Kattintható sor + pill ---------- */
.clickable { cursor: pointer; transition: background .12s; }
.clickable:hover { background: rgba(255,255,255,.04); }
.pill { background: var(--primary); color: var(--on-primary); font-size: 12px; font-weight: 700; padding: 2px 9px; border-radius: 999px; }

/* ---------- Ügyfél fejléc ---------- */
.client-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.ch-name { margin: 0; font-size: 20px; display: flex; align-items: center; gap: 8px; }
.ch-rate { font-size: 22px; font-weight: 700; color: var(--primary); white-space: nowrap; }
.ch-rate span { font-size: 13px; color: var(--muted); font-weight: 500; margin-left: 4px; }

.info-block { margin-bottom: 0; }
.info-block h3 { margin: 0 0 12px; font-size: 14px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
dl.info { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 14px; }
dl.info dt { color: var(--muted); }
dl.info dd { margin: 0; word-break: break-word; }
dl.info a { color: var(--primary); }
.notes { margin: 0; font-size: 14px; }

/* ---------- Feladat lista ---------- */
.task-add { display: flex; gap: 8px; margin-bottom: 16px; flex-wrap: wrap; }
.task-add input[type=text] { flex: 1; min-width: 160px; }
.task-add input, .task-add select {
    padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px;
    font-size: 14px; font-family: inherit; background: rgba(0,0,0,.25); color: var(--text);
}
.task-add input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(251,162,37,.22); }

.task-list, .sub-list { list-style: none; margin: 0; padding: 0; }
.task-item {
    display: flex; align-items: center; gap: 10px;
    padding: 12px; border: 1px solid var(--border); border-radius: 12px; margin-bottom: 8px;
    background: rgba(255,255,255,.02); border-left: 4px solid #565b66;
}
.task-item.status-open        { border-left-color: var(--primary); }
.task-item.status-in_progress { border-left-color: var(--info); }
.task-item.status-done        { border-left-color: var(--success); }
.task-item.status-done .task-title { text-decoration: line-through; color: var(--muted); }
.task-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.task-title { font-weight: 600; font-size: 15px; }
.task-meta { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-size: 12px; background: rgba(255,255,255,.08); color: var(--muted); padding: 2px 8px; border-radius: 999px; }
.task-item form { margin: 0; }
.status-select {
    padding: 7px 10px; border: 1px solid var(--border); border-radius: 8px;
    font-size: 13px; font-weight: 600; background: rgba(0,0,0,.3); color: var(--text);
    cursor: pointer; font-family: inherit;
}

.badge-status { font-size: 13px; }
.badge-status.status-open        { background: rgba(251,162,37,.16); color: var(--primary); }
.badge-status.status-in_progress { background: rgba(90,162,240,.16); color: var(--info); }
.badge-status.status-done        { background: rgba(53,192,122,.16); color: var(--success); }

/* ---------- Alfeladatok ---------- */
.sub-item { display: flex; align-items: center; gap: 12px; padding: 10px 4px; border-bottom: 1px solid var(--border); }
.sub-item:last-child { border-bottom: none; }
.sub-item form { margin: 0; }
.sub-title { flex: 1; font-size: 14px; }
.sub-item.is-done .sub-title { text-decoration: line-through; color: var(--muted); }
.check {
    width: 24px; height: 24px; border-radius: 7px; border: 2px solid var(--border);
    background: rgba(0,0,0,.2); cursor: pointer; line-height: 1;
    display: flex; align-items: center; justify-content: center;
}
.check.checked { background: var(--success); border-color: var(--success); }
.check.checked::after {
    content: ''; width: 6px; height: 11px; margin-top: -2px;
    border: solid #0d1a12; border-width: 0 2px 2px 0; transform: rotate(45deg);
}

/* ---------- Nyomtatás kalkulátor ---------- */
.print-grid { display: grid; grid-template-columns: 1fr 300px; gap: 20px; align-items: start; }
.calc-panel { position: sticky; top: 80px; }
.calc-panel h3 { margin: 0 0 14px; font-size: 14px; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); }
.calc-row { display: flex; justify-content: space-between; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--border); font-size: 14px; }
.calc-row:last-child { border-bottom: none; }
.calc-row span { color: var(--muted); }
.calc-row b { font-weight: 700; }
.calc-row.profit { margin-top: 6px; padding-top: 12px; border-top: 2px solid var(--border); border-bottom: none; }
.calc-row.profit span { color: var(--text); font-weight: 600; }
.calc-row.profit b { font-size: 20px; color: var(--primary); }
.mini-link { background: none; border: none; color: var(--primary); font-size: 12px; font-weight: 600; cursor: pointer; padding: 0 0 0 6px; font-family: inherit; }
.pos { color: var(--success); }
.neg { color: var(--danger); }

/* ---------- Nyomtatás lista (szűrő + kártyák) ---------- */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 18px; }
.filter-chip {
    padding: 7px 13px; border-radius: 999px; border: 1px solid var(--border);
    background: rgba(255,255,255,.04); color: var(--muted);
    font-size: 13px; font-weight: 600; cursor: pointer; transition: color .15s, background .15s, border-color .15s;
}
.filter-chip:hover { color: #fff; background: rgba(255,255,255,.08); }
.filter-chip.active { background: var(--primary); color: var(--on-primary); border-color: var(--primary); }
.filter-chip .n { opacity: .75; margin-left: 4px; }

.pjob-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.pjob {
    background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
    box-shadow: var(--shadow); padding: 18px; cursor: pointer;
    display: flex; flex-direction: column; gap: 14px;
    transition: border-color .15s, transform .06s; backdrop-filter: blur(4px);
}
.pjob:hover { border-color: rgba(251,162,37,.5); }
.pjob:active { transform: translateY(1px); }
.pjob-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.pjob-type { font-size: 16px; font-weight: 700; line-height: 1.25; }
.pjob-client { font-size: 13px; color: var(--muted); margin-top: 3px; }
.pjob-meta { display: flex; flex-wrap: wrap; gap: 8px 14px; align-items: center; font-size: 13px; color: var(--muted); }
.pjob-meta b { color: var(--text); font-weight: 600; }
.pjob-meta .tag { color: var(--primary); background: rgba(251,162,37,.14); }
.pjob-prog { margin: -2px 0; }
.pjob-prog .prog-bar { height: 8px; margin: 0 0 6px; }
.pjob-prog-label { font-size: 12px; color: var(--muted); }
.pjob-fin { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; border-top: 1px solid var(--border); padding-top: 12px; }
.pjob-fin > div { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.pjob-fin span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
.pjob-fin b { font-size: 15px; font-weight: 700; white-space: nowrap; }
.pjob-foot { display: flex; gap: 8px; }
.pjob-foot form { margin: 0; }

/* Nyomtatás státusz badge-ek */
.pstatus-planned          { background: rgba(255,255,255,.08); color: #c3c8d2; }
.pstatus-in_progress      { background: rgba(90,162,240,.16); color: var(--info); }
.pstatus-production_done  { background: rgba(167,139,250,.16); color: #b9a5fb; }
.pstatus-delivered        { background: rgba(45,212,218,.16); color: #4fd6dc; }
.pstatus-invoiced         { background: rgba(251,162,37,.16); color: var(--primary); }
.pstatus-paid             { background: rgba(53,192,122,.16); color: var(--success); }

/* Haladás kártya */
.progress-card { margin-bottom: 20px; }
.prog-bar { height: 14px; background: rgba(255,255,255,.08); border-radius: 999px; overflow: hidden; margin: 4px 0 10px; }
.prog-fill { height: 100%; background: linear-gradient(90deg,#FBA225,#ffcf7a); border-radius: 999px; transition: width .25s ease; }
.prog-summary { display: flex; justify-content: space-between; font-size: 14px; color: var(--muted); margin-bottom: 18px; }
.prog-summary b { color: var(--text); font-size: 16px; }

.check-inline {
    display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px;
    border: 1px solid var(--border); border-radius: 10px; background: rgba(0,0,0,.2);
    cursor: pointer; font-size: 14px;
}
.check-inline input { width: 18px; height: 18px; accent-color: var(--primary); }

.prog-counters { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 16px; }
.counter { border: 1px solid var(--border); border-radius: 12px; padding: 16px; text-align: center; background: rgba(255,255,255,.02); }
.counter.reject { background: rgba(244,80,107,.08); border-color: rgba(244,80,107,.28); }
.counter-label { font-size: 13px; font-weight: 600; color: var(--muted); }
.counter-val { font-size: 40px; font-weight: 800; line-height: 1.1; margin: 6px 0 12px; }
.counter.reject .counter-val { color: var(--danger); }
.counter-btns { display: flex; gap: 8px; justify-content: center; flex-wrap: wrap; }
.cbtn {
    min-width: 52px; padding: 12px 10px; border-radius: 10px; border: none;
    font-size: 16px; font-weight: 700; cursor: pointer; font-family: inherit;
    transition: transform .05s, background .15s;
}
.cbtn:active { transform: translateY(1px); }
.cbtn:disabled { opacity: .5; }
.cbtn.plus  { background: var(--primary); color: var(--on-primary); }
.cbtn.plus:hover { background: var(--primary-d); }
.cbtn.minus { background: rgba(255,255,255,.08); color: var(--text); }
.cbtn.minus:hover { background: rgba(255,255,255,.14); }

@media (max-width: 860px) {
    .print-grid { grid-template-columns: 1fr; }
    .calc-panel { position: static; }
}
@media (max-width: 520px) {
    .prog-counters { grid-template-columns: 1fr; }
    .cbtn { flex: 1; min-width: 44px; }
}

/* ---------- Reszponzív ---------- */
@media (max-width: 860px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main { margin-left: 0; }
    .menu-btn { display: block; }
    .form-grid, .form-grid-4, .form-grid-3 { grid-template-columns: 1fr; }
}

@media (max-width: 620px) {
    .content { padding: 16px; }
    .uname { display: none; }
    .client-head { flex-direction: column; align-items: flex-start; }
    .task-item { flex-wrap: wrap; }
    .task-main { flex-basis: 100%; }

    /* Táblázat -> kártyák mobilon */
    .table thead { display: none; }
    .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
    .table tr { border: 1px solid var(--border); border-radius: 12px; margin-bottom: 12px; padding: 6px 4px; }
    .table td { border: none; display: flex; justify-content: space-between; gap: 12px; padding: 8px 12px; }
    .table td::before { content: attr(data-label); font-weight: 600; color: var(--muted); font-size: 13px; }
    .row-actions { justify-content: flex-end; }
}
