:root {
    --primary:  #2563eb;
    --success:  #16a34a;
    --error:    #dc2626;
    --warning:  #d97706;
    --purple:   #9333ea;
    --info:     #0891b2;
    --bg:       #f1f5f9;
    --bg-alt:   #f8fafc;
    --card:     #ffffff;
    --border:   #e2e8f0;
    --text:     #1e293b;
    --muted:    #64748b;
    --nav-bg:   #0f172a;
    --font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: var(--font); background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.6; }

/* ── Nav ── */
.nav { background: var(--nav-bg); height: 52px; display: flex; align-items: center; padding: 0 24px; gap: 4px; }
.nav-brand { color: #fff; font-weight: 700; font-size: 15px; text-decoration: none; margin-right: 12px; letter-spacing: -.3px; }
.nav a { color: #94a3b8; text-decoration: none; padding: 6px 11px; border-radius: 6px; font-size: 13px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.1); }
.nav-space { flex: 1; }
.nav-logout { color: #f87171 !important; }

/* ── Layout ── */
.container { max-width: 1320px; margin: 0 auto; padding: 28px 20px; }
.page-title { font-size: 20px; font-weight: 700; margin-bottom: 22px; }
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 22px; }
.page-header h1 { font-size: 20px; font-weight: 700; margin: 0; }
.section-title { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; margin-bottom: 12px; }

/* ── Cards ── */
.card { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 20px; margin-bottom: 18px; }
.card.mb0 { margin-bottom: 0; }
.card + .card { margin-top: 0; }

/* ── Grid ── */
.g2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 18px; }
.g3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 16px; margin-bottom: 18px; }
.g4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; margin-bottom: 18px; }
.g5 { display: grid; grid-template-columns: repeat(5,1fr); gap: 14px; margin-bottom: 18px; }

/* ── Stat box ── */
.stat { background: var(--card); border: 1px solid var(--border); border-radius: 10px; padding: 18px 20px; }
.stat-val { font-size: 28px; font-weight: 700; line-height: 1.1; }
.stat-lbl { font-size: 12px; color: var(--muted); margin-top: 4px; }
.stat-sub  { font-size: 11px; color: var(--muted); margin-top: 3px; }

/* ── Table ── */
.tbl-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { text-align: left; padding: 8px 12px; background: #f8fafc; border-bottom: 2px solid var(--border); font-size: 11px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; white-space: nowrap; }
td { padding: 9px 12px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: #f8fafc; }

/* ── Badges ── */
.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.b-success        { background: #dcfce7; color: #15803d; }
.b-error          { background: #fee2e2; color: #b91c1c; }
.b-running        { background: #f3e8ff; color: #7e22ce; }
.b-dry            { background: #fef9c3; color: #854d0e; }
.b-info           { background: #e0f2fe; color: #0369a1; }
.b-stage-download { background: #fef3c7; color: #92400e; }
.b-stage-process  { background: #dbeafe; color: #1d4ed8; }

/* ── Buttons ── */
.btn { display: inline-block; padding: 8px 18px; border-radius: 7px; font-size: 13px; font-weight: 500; text-decoration: none; cursor: pointer; border: none; font-family: var(--font); transition: opacity .15s; }
.btn:hover { opacity: .85; }
.btn-primary  { background: var(--primary); color: #fff; }
.btn-success  { background: var(--success); color: #fff; }
.btn-muted    { background: #e2e8f0; color: var(--text); }
.btn-danger   { background: var(--error); color: #fff; }
.btn-sm { padding: 4px 11px; font-size: 12px; }
.btn-xs { padding: 2px 8px; font-size: 11px; }

/* ── Quick action buttons ── */
.quick-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.quick-actions .btn { font-size: 13px; }

/* ── Filter bar ── */
.filter-bar {
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 18px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}
.filter-bar .fb-search {
    position: relative;
    flex: 1;
    min-width: 180px;
}
.filter-bar .fb-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--muted);
    pointer-events: none;
    font-style: normal;
    font-size: 14px;
}
.filter-bar .fb-search input {
    width: 100%;
    padding: 7px 10px 7px 32px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-alt);
}
.filter-bar .fb-search input:focus {
    outline: none;
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.filter-bar .fb-sep {
    width: 1px;
    height: 24px;
    background: var(--border);
    flex-shrink: 0;
}
.filter-bar select.input-sm {
    padding: 7px 28px 7px 10px;
    border: 1px solid var(--border);
    border-radius: 7px;
    font-size: 13px;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg-alt);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2364748b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    cursor: pointer;
}
.filter-bar select.input-sm:focus {
    outline: none;
    border-color: var(--primary);
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.filter-bar .fb-actions { display: flex; gap: 6px; align-items: center; margin-left: auto; }

/* Active filter chips */
.filter-chips { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.filter-chip { display: inline-flex; align-items: center; gap: 5px; background: #dbeafe; color: #1e40af; padding: 3px 10px; border-radius: 999px; font-size: 12px; }
.filter-chip-x { color: #1e40af; text-decoration: none; font-weight: 700; font-size: 14px; line-height: 1; opacity: .7; }
.filter-chip-x:hover { opacity: 1; }

/* ── Forms ── */
.form-group { margin-bottom: 18px; }
label.lbl { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.input, select.input { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: 7px; font-size: 14px; font-family: var(--font); color: var(--text); background: #fff; }
.input:focus, select.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.checkbox-row { display: flex; align-items: center; gap: 9px; cursor: pointer; font-size: 14px; }
.checkbox-row input[type=checkbox] { width: 16px; height: 16px; cursor: pointer; }

/* ── Alert ── */
.alert { padding: 12px 16px; border-radius: 7px; margin-bottom: 16px; font-size: 13px; }
.a-success { background: #dcfce7; color: #15803d; border: 1px solid #bbf7d0; }
.a-error   { background: #fee2e2; color: #b91c1c; border: 1px solid #fecaca; }
.a-info    { background: #dbeafe; color: #1e40af; border: 1px solid #bfdbfe; }
.a-warning { background: #fef9c3; color: #854d0e; border: 1px solid #fef08a; }

/* ── Status dot ── */
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; margin-right: 5px; vertical-align: middle; }
.dot-ok   { background: var(--success); }
.dot-err  { background: var(--error); }
.dot-warn { background: var(--warning); }

/* ── Log pre ── */
pre.log-block { background: #0f172a; color: #94a3b8; padding: 16px; border-radius: 8px; font-size: 12px; font-family: 'Courier New', monospace; overflow-y: auto; max-height: 480px; white-space: pre-wrap; word-break: break-all; line-height: 1.5; }
.log-INFO  { color: #94a3b8; }
.log-WARN  { color: #fbbf24; }
.log-ERROR { color: #f87171; }

/* ── Info table (kulcs-érték párok) ── */
.info-table { font-size: 13px; width: 100%; }
.info-table td { padding: 5px 0; border: none; vertical-align: top; }
.info-lbl { color: var(--muted); white-space: nowrap; padding-right: 16px !important; min-width: 130px; }

/* ── Divider ── */
hr.divider { border: none; border-top: 1px solid var(--border); margin: 16px 0; }

/* ── Empty state ── */
.empty-state { text-align: center; padding: 32px 20px; color: var(--muted); font-size: 14px; }
.empty-hint { font-size: 12px; margin-top: 6px; opacity: .75; }

/* ── Source / profile pill ── */
.source-pill { display: inline-block; background: #f1f5f9; border: 1px solid var(--border); border-radius: 4px; padding: 1px 7px; font-size: 11px; font-family: 'Courier New', monospace; color: var(--muted); }

/* ── Translation table ── */
.lang-code { display: inline-block; background: #e0f2fe; color: #0369a1; padding: 1px 6px; border-radius: 4px; font-size: 11px; font-weight: 700; font-family: 'Courier New', monospace; }

/* ── Progress bar (run haladás) ── */
.progress-wrap { background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden; margin-top: 4px; }
.progress-bar  { height: 100%; background: var(--primary); border-radius: 4px; transition: width .3s; }

/* ── Misc ── */
.text-muted { color: var(--muted); }
.text-success { color: var(--success); }
.text-error   { color: var(--error); }
.mono { font-family: 'Courier New', monospace; font-size: 12px; }
.flex { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.gap-4 { gap: 4px; }
.mt-0 { margin-top: 0 !important; }
.mb-0 { margin-bottom: 0 !important; }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; display: inline-block; vertical-align: bottom; }

/* ── Responsive fallback ── */
@media (max-width: 900px) {
    .g4 { grid-template-columns: repeat(2,1fr); }
    .g5 { grid-template-columns: repeat(2,1fr); }
    .g3 { grid-template-columns: repeat(2,1fr); }
    .g2 { grid-template-columns: 1fr; }
    .filter-bar { flex-direction: column; }
    .container { padding: 16px 12px; }
}
@media (max-width: 600px) {
    .g3, .g4, .g5 { grid-template-columns: 1fr; }
    .nav-brand { display: none; }
}

/* ── Catalog layout ── */
.catalog-layout {
    display: grid;
    grid-template-columns: 256px 1fr;
    gap: 20px;
    align-items: start;
}
.catalog-summary {
    margin-bottom: 10px;
    padding: 8px 0;
}
.catalog-table td { padding: 7px 10px; }
.catalog-table th { padding: 7px 10px; }

/* ── Category sidebar ── */
.cat-sidebar {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 14px 12px;
    position: sticky;
    top: 16px;
    max-height: calc(100vh - 80px);
    overflow-y: auto;
}
.cat-sidebar-title {
    font-size: 11px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .07em;
    margin-bottom: 10px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border);
}
.cat-source-group { margin-bottom: 14px; }
.cat-source-label {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .08em;
    margin-bottom: 4px;
    padding: 3px 6px;
    background: var(--bg);
    border-radius: 4px;
    display: block;
}

/* Category tree nodes */
.cat-tree, .cat-children {
    list-style: none;
    padding: 0;
    margin: 0;
}
.cat-children { padding-left: 12px; }
.cat-node details { margin: 0; }
.cat-node summary { list-style: none; }
.cat-node summary::-webkit-details-marker { display: none; }

.cat-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 4px;
    padding: 4px 7px;
    border-radius: 5px;
    text-decoration: none;
    color: var(--text);
    font-size: 12.5px;
    transition: background .1s;
    cursor: pointer;
    width: 100%;
}
.cat-link:hover { background: var(--bg); }
.cat-link.active { background: #dbeafe; color: #1d4ed8; font-weight: 600; }
.cat-link.in-path { color: var(--primary); }

.cat-count {
    font-size: 10px;
    color: var(--muted);
    background: var(--bg);
    padding: 1px 5px;
    border-radius: 999px;
    flex-shrink: 0;
    margin-left: auto;
}
.cat-link.active .cat-count { background: #bfdbfe; color: #1d4ed8; }

/* Expand arrow via details state */
.cat-node details > summary .cat-link { padding-left: 4px; }
.cat-node details > summary .cat-link::before {
    content: '▶';
    font-size: 7px;
    opacity: .45;
    transition: transform .12s;
    flex-shrink: 0;
    margin-right: 3px;
}
.cat-node details[open] > summary .cat-link::before { transform: rotate(90deg); }
.cat-leaf .cat-link { padding-left: 16px; }

/* ── Product thumbnail in catalog table ── */
.prod-thumb {
    width: 44px;
    height: 44px;
    object-fit: contain;
    border-radius: 5px;
    background: var(--bg-alt);
    border: 1px solid var(--border);
    display: block;
}
.prod-thumb-placeholder {
    width: 44px;
    height: 44px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 5px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    color: var(--border);
}

/* ── Product hero (view-product) ── */
.product-hero {
    display: grid;
    grid-template-columns: 1fr 220px;
    gap: 18px;
    margin-bottom: 18px;
    align-items: start;
}
.product-hero-image {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 220px;
    padding: 20px !important;
}
.product-hero-image img {
    max-width: 180px;
    max-height: 180px;
    width: 100%;
    object-fit: contain;
}
.product-hero-image.no-image::before {
    content: '🖼';
    font-size: 40px;
    opacity: .2;
}
.product-hero-placeholder { font-size: 40px; opacity: .2; }

/* ── Category breadcrumb ── */
.cat-breadcrumb {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 2px;
    font-size: 12px;
    line-height: 1.6;
}
.cat-breadcrumb-seg {
    color: var(--muted);
    text-decoration: none;
}
.cat-breadcrumb-seg:hover { color: var(--primary); text-decoration: underline; }
.cat-breadcrumb-sep { color: var(--border); margin: 0 1px; }
.cat-breadcrumb-leaf { color: var(--text); font-weight: 500; }
.cat-breadcrumb-leaf:hover { color: var(--primary); }

/* ── Attribute table (view-product) ── */
.attr-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.attr-table td { padding: 5px 0; border-bottom: 1px solid var(--bg); vertical-align: top; }
.attr-table tr:last-child td { border-bottom: none; }
.attr-key {
    color: var(--muted);
    font-size: 12px;
    white-space: nowrap;
    padding-right: 14px !important;
    min-width: 140px;
    max-width: 200px;
}
.attr-val { color: var(--text); }
.attr-unit { color: var(--muted); font-size: 12px; padding-left: 6px !important; white-space: nowrap; }
.attr-scope-sep {
    font-size: 10px;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin: 12px 0 6px;
    padding-top: 10px;
    border-top: 1px solid var(--border);
}

/* ── Document list ── */
.doc-list { display: flex; flex-direction: column; gap: 5px; }
.doc-item {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 7px 10px;
    background: var(--bg-alt);
    border-radius: 6px;
    text-decoration: none;
    color: var(--text);
    transition: background .1s;
}
.doc-item:hover { background: #dbeafe; }
.doc-type {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    color: var(--muted);
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 4px;
    padding: 2px 6px;
    white-space: nowrap;
    flex-shrink: 0;
    margin-top: 1px;
}
.doc-url { font-size: 12px; color: var(--primary); word-break: break-all; }
.doc-item:hover .doc-url { text-decoration: underline; }

/* ── Responsive catalog ── */
@media (max-width: 1100px) {
    .catalog-layout { grid-template-columns: 220px 1fr; }
}
@media (max-width: 860px) {
    .catalog-layout { grid-template-columns: 1fr; }
    .cat-sidebar { position: static; max-height: 260px; }
    .product-hero { grid-template-columns: 1fr; }
    .product-hero-image { min-height: 160px; }
}

/* ── Product images ── */
.product-image-grid {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 4px;
}
.product-image-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--border);
    border-radius: 8px;
    overflow: hidden;
    background: var(--bg-alt);
    text-decoration: none;
    transition: border-color .15s, box-shadow .15s;
    width: 140px;
}
.product-image-item:hover {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.product-image-item img {
    width: 140px;
    height: 140px;
    object-fit: contain;
    padding: 8px;
    display: block;
}
.product-image-item.img-error {
    justify-content: center;
    min-height: 80px;
}
.product-image-item.img-error::before {
    content: '🖼';
    font-size: 32px;
    opacity: .3;
    padding: 16px 0 8px;
}
.product-image-type {
    width: 100%;
    text-align: center;
    font-size: 11px;
    color: var(--muted);
    background: rgba(0,0,0,.03);
    border-top: 1px solid var(--border);
    padding: 4px 6px;
}

/* Alpine cloak */
[x-cloak] { display: none !important; }

/* ── Login page ── */
body.login-bg {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--nav-bg);
    background-image: radial-gradient(ellipse at 60% 20%, #1e3a5f 0%, transparent 60%),
                      radial-gradient(ellipse at 20% 80%, #1e1b4b 0%, transparent 55%);
}
.login-box {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 40px 44px;
    width: 100%;
    max-width: 400px;
    box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.login-logo {
    font-size: 22px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -.4px;
}
.login-sub {
    color: var(--muted);
    font-size: 13px;
    margin-bottom: 28px;
    padding-bottom: 24px;
    border-bottom: 1px solid var(--border);
}
.login-box .form-group { margin-bottom: 16px; }
.login-box .btn-primary { margin-top: 8px; }
