:root {
    --bg: #f0f4f8;
    --primary: #0d6efd;
    --danger: #dc3545;
    --text: #1e293b;
    --muted: #64748b;
    --card: #fff;
}

* { box-sizing: border-box; }
body {
    margin: 0;
    font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
}
.ascuns { display: none !important; }
.muted { color: var(--muted); font-size: 0.9rem; margin-left: 8px; }

.ecran { min-height: 100vh; }
.card-auth {
    max-width: 380px;
    margin: 10vh auto;
    background: var(--card);
    padding: 28px 24px;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.08);
}
.card-auth h1 { margin: 0 0 20px; font-size: 1.35rem; color: var(--primary); }
.card-auth label { display: block; font-weight: 600; font-size: 0.85rem; margin: 12px 0 4px; }
.card-auth input {
    width: 100%;
    padding: 10px 12px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
}
.btn-primar, .btn-secundar, .btn-link, .btn-mic {
    border: none;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 700;
}
.btn-primar {
    width: 100%;
    margin-top: 18px;
    padding: 12px;
    background: var(--primary);
    color: #fff;
    font-size: 1rem;
}
.btn-secundar {
    padding: 8px 14px;
    background: #e2e8f0;
    color: var(--text);
}
.btn-link {
    background: transparent;
    color: var(--primary);
    margin-top: 12px;
    padding: 0;
}
.btn-mic {
    padding: 4px 8px;
    font-size: 0.8rem;
    background: #e8f0fe;
    color: #1a56db;
}
.mesaj-eroare {
    margin-top: 12px;
    padding: 10px;
    background: #fee2e2;
    color: #991b1b;
    border-radius: 8px;
    font-size: 0.9rem;
}
.btn-magazin {
    display: block;
    width: 100%;
    margin: 8px 0;
    padding: 12px;
    background: #fff;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
}

.app-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--card);
    padding: 12px 16px;
    box-shadow: 0 1px 4px rgba(0,0,0,0.06);
    gap: 10px;
    flex-wrap: wrap;
}
.tab-uri {
    display: flex;
    gap: 6px;
    padding: 10px 16px;
    background: #e2e8f0;
}
.tab {
    padding: 8px 14px;
    border: none;
    border-radius: 8px 8px 0 0;
    background: transparent;
    font-weight: 700;
    color: var(--muted);
    cursor: pointer;
}
.tab.activ { background: var(--card); color: var(--primary); }
.app-main { max-width: 1100px; margin: 0 auto; padding: 16px; }
.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 14px;
    align-items: center;
}
.toolbar input[type="search"], .toolbar select {
    padding: 8px 10px;
    border: 1px solid #cbd5e1;
    border-radius: 8px;
    min-width: 140px;
}
.toolbar .btn-primar, .toolbar .btn-secundar { width: auto; margin: 0; }
.chk { font-size: 0.9rem; display: flex; align-items: center; gap: 4px; }

.lista-produse { display: flex; flex-direction: column; gap: 8px; }
.rand-produs {
    background: var(--card);
    border-radius: 10px;
    padding: 12px 14px;
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    align-items: center;
    border-left: 4px solid #cbd5e1;
}
.rand-produs.indisponibil { opacity: 0.55; }
.rand-produs .nume { font-weight: 800; font-size: 1.05rem; }
.rand-produs .meta { font-size: 0.85rem; color: var(--muted); }
.rand-produs .pret { font-weight: 900; color: var(--primary); font-size: 1.1rem; }
.rand-actiuni { display: flex; flex-wrap: wrap; gap: 6px; justify-content: flex-end; }

.modal-overlay {
    position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,0.5);
    display: flex; align-items: center; justify-content: center;
    padding: 16px;
}
.modal-box {
    background: #fff;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 12px;
    padding: 20px;
}
.modal-box label { display: block; font-weight: 600; font-size: 0.85rem; margin: 10px 0 4px; }
.modal-box input, .modal-box select, .modal-box textarea {
    width: 100%;
    padding: 10px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
}
.rand-ean {
    display: flex;
    gap: 8px;
    align-items: stretch;
}
.rand-ean input { flex: 1; min-width: 0; }
.rand-ean .btn-secundar {
    width: auto;
    margin: 0;
    white-space: nowrap;
    flex-shrink: 0;
}
.modal-actiuni { display: flex; gap: 10px; justify-content: flex-end; margin-top: 16px; }
.modal-actiuni .btn-primar { width: auto; margin: 0; }

.ecran-mentenanta {
    position: fixed; inset: 0; z-index: 20000;
    background: rgba(15, 23, 42, 0.92);
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
}
.card-mentenanta {
    background: #fff;
    max-width: 420px;
    width: 100%;
    border-radius: 12px;
    padding: 28px 24px;
    text-align: center;
}
.card-mentenanta h2 { margin: 0 0 12px; color: #b45309; }

.snackbar {
    position: fixed;
    left: 50%;
    bottom: 24px;
    transform: translateX(-50%);
    z-index: 30000;
    max-width: min(420px, calc(100vw - 24px));
    padding: 12px 18px;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 8px 24px rgba(0,0,0,0.18);
    color: #fff;
    text-align: center;
}
.snackbar.ok { background: #15803d; }
.snackbar.eroare { background: #b91c1c; }
.snackbar.info { background: #1e40af; }

.hint {
    display: inline-block;
    margin-left: 4px;
    width: 1.15em;
    height: 1.15em;
    line-height: 1.15em;
    text-align: center;
    border-radius: 50%;
    background: #e2e8f0;
    color: var(--muted);
    font-size: 0.75rem;
    font-weight: 700;
    cursor: help;
    vertical-align: middle;
}
.subtitlu-sectiune {
    margin: 16px 0 8px;
    font-size: 0.95rem;
    color: var(--muted);
}
.meta { color: var(--muted); font-size: 0.85rem; margin-top: 2px; }


.rand-cu-scan {
    display: flex;
    gap: 8px;
    align-items: stretch;
    flex: 1;
    min-width: 160px;
}
.rand-cu-scan input { flex: 1; min-width: 0; }
.btn-scan {
    display: none;
    align-items: center;
    justify-content: center;
    width: 42px;
    flex-shrink: 0;
    margin: 0;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    color: var(--text);
    cursor: pointer;
}
.rand-cu-scan:focus-within .btn-scan,
.rand-ean:focus-within .btn-scan,
.rand-cu-scan:hover .btn-scan {
    display: inline-flex;
}
.btn-scan:hover { background: #e8f0fe; color: #1a56db; border-color: #bfdbfe; }

.overlay-scan {
    position: fixed;
    inset: 0;
    z-index: 40000;
    background: rgba(15, 23, 42, 0.92);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.overlay-scan-box {
    width: min(480px, 100%);
    background: #0f172a;
    border-radius: 12px;
    padding: 12px;
    text-align: center;
}
.overlay-scan-box video {
    width: 100%;
    max-height: 70vh;
    border-radius: 8px;
    background: #000;
    object-fit: cover;
}
.overlay-scan-hint {
    color: #e2e8f0;
    font-size: 0.9rem;
    margin: 10px 0;
}
.overlay-scan-box .btn-secundar { width: auto; }

@media (max-width: 720px) {
    .rand-produs { grid-template-columns: 1fr; }
    .rand-actiuni { justify-content: flex-start; }
}
