:root {
    --bg: #f4f6fb;
    --panel: #ffffff;
    --text: #172033;
    --muted: #6f7b91;
    --line: #e3e8f1;
    --primary: #1f64ff;
    --primary-dark: #154bd1;
    --danger: #d12f2f;
    --success: #138a44;
    --warning: #ad7a00;
    --shadow: 0 14px 40px rgba(30, 45, 80, .08);
    --radius: 18px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { font-family: Inter, Arial, sans-serif; background: var(--bg); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
.layout { display: flex; min-height: 100vh; }
.sidebar { width: 280px; background: #101827; color: #fff; padding: 22px; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; gap: 12px; align-items: center; }
.brand-mark { width: 44px; height: 44px; border-radius: 14px; background: linear-gradient(135deg, #3d7cff, #20b6ff); display: grid; place-items: center; font-weight: 800; }
.brand-title { font-weight: 800; letter-spacing: .2px; }
.brand-subtitle { color: #9ba9c2; font-size: 13px; }
.nav { margin-top: 28px; display: grid; gap: 8px; }
.nav-link { color: #c8d3e8; padding: 12px 14px; border-radius: 12px; font-weight: 650; }
.nav-link:hover { background: rgba(255,255,255,.08); text-decoration: none; color: #fff; }
.nav-link.active { background: #fff; color: #101827; }
.sidebar-footer { margin-top: auto; display: grid; gap: 12px; }
.user-box { background: rgba(255,255,255,.08); border: 1px solid rgba(255,255,255,.08); border-radius: 14px; padding: 12px; color: #dbe5f8; }
.link-button { border: 0; background: transparent; color: #c8d3e8; cursor: pointer; font-size: 14px; padding: 0; }
.content { flex: 1; padding: 28px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; margin-bottom: 22px; }
h1 { margin: 0; font-size: 30px; }
h2 { margin: 0 0 14px; font-size: 20px; }
h3 { margin: 18px 0 8px; font-size: 15px; }
p { color: var(--muted); margin: 6px 0 0; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; }
.cards { display: grid; grid-template-columns: repeat(6, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.stat span { color: var(--muted); font-size: 13px; }
.stat strong { display: block; margin-top: 8px; font-size: 24px; }
.grid-two { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(320px, .75fr); gap: 18px; }
.table-card { padding: 0; overflow: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { background: #f8faff; color: #566276; text-align: left; font-weight: 750; }
.table th, .table td { padding: 13px 14px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.table.compact th, .table.compact td { padding: 10px; }
.right { text-align: right; }
.muted { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.button { display: inline-flex; align-items: center; justify-content: center; border: 1px solid var(--line); background: #fff; color: var(--text); padding: 10px 14px; border-radius: 12px; font-weight: 750; cursor: pointer; min-height: 42px; }
.button:hover { text-decoration: none; border-color: #b9c5d8; }
.button.primary { background: var(--primary); color: #fff; border-color: var(--primary); }
.button.primary:hover { background: var(--primary-dark); }
.button.small { padding: 7px 10px; min-height: 32px; border-radius: 10px; font-size: 13px; }
.button.full { width: 100%; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; }
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 18px; box-shadow: none; }
.input, input[type="text"], input[type="password"], input[type="email"], input[type="number"], select, textarea { width: 100%; border: 1px solid #d7deea; background: #fff; border-radius: 12px; padding: 11px 12px; font: inherit; color: var(--text); }
.input:focus, input:focus, select:focus, textarea:focus { outline: 3px solid rgba(31,100,255,.13); border-color: var(--primary); }
.form { max-width: 740px; display: grid; gap: 14px; }
.form.wide { max-width: 1100px; }
.form-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; }
.field label { display: block; margin-bottom: 6px; color: #334158; font-weight: 750; }
.wide-field { grid-column: 1 / -1; }
.form-actions { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.help { color: var(--muted); font-size: 12px; margin-top: 5px; }
.field-error { color: var(--danger); font-size: 13px; margin-top: 5px; }
.messages { display: grid; gap: 8px; margin-bottom: 16px; }
.message { border-radius: 12px; padding: 12px 14px; background: #eef4ff; border: 1px solid #dce7ff; color: #173a7a; }
.message.success { background: #effaf3; border-color: #cdeed9; color: #125f32; }
.message.error { background: #fff0f0; border-color: #f1c9c9; color: #9d1f1f; }
.message.warning { background: #fff8e6; border-color: #f0dda2; color: #865d00; }
.badge { display: inline-flex; padding: 5px 9px; border-radius: 999px; font-size: 12px; font-weight: 800; background: #edf1f7; color: #34425a; white-space: nowrap; }
.badge.stock { background: #eef4ff; color: #2453b8; }
.badge.showcase { background: #effaf3; color: var(--success); }
.badge.reserved { background: #fff8e6; color: var(--warning); }
.badge.repair { background: #f0f0ff; color: #4c45bd; }
.badge.sold { background: #f1f4f8; color: #596579; }
.badge.written_off { background: #fff0f0; color: var(--danger); }
.details { display: grid; grid-template-columns: 170px 1fr; gap: 10px 14px; margin: 0; }
.details dt { color: var(--muted); }
.details dd { margin: 0; font-weight: 650; }
.barcode-box { border: 1px dashed #c7d1e2; border-radius: 16px; padding: 18px; background: #fff; }
.barcode-box svg { width: 100%; height: auto; }
.mt { margin-top: 24px; }
.log-mini { margin: 0; padding-left: 18px; color: #34425a; }
.log-mini li { margin: 8px 0; }
.log-mini span { color: var(--muted); font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }
.login-body { display: grid; place-items: center; min-height: 100vh; padding: 18px; background: radial-gradient(circle at top, #eaf1ff, #f7f8fb); }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 24px; box-shadow: var(--shadow); padding: 28px; }
.login-brand { margin-bottom: 24px; color: var(--text); }
.login-brand .brand-subtitle { color: var(--muted); }
.login-card input { margin-bottom: 14px; }
@media (max-width: 1200px) { .cards { grid-template-columns: repeat(3, 1fr); } .filters { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
    .layout { display: block; }
    .sidebar { position: static; width: 100%; height: auto; }
    .content { padding: 18px; }
    .page-head, .grid-two { display: block; }
    .actions { justify-content: flex-start; margin-top: 12px; }
    .cards, .form-grid, .filters { grid-template-columns: 1fr; }
    .card { margin-bottom: 14px; }
}
.cards.three { grid-template-columns: repeat(3, minmax(180px, 1fr)); }
.filters.small-filters { grid-template-columns: 2fr 1fr auto; }
.scan-form { max-width: 900px; grid-template-columns: 1fr auto; align-items: end; }
.scan-input { font-size: 22px; font-weight: 750; letter-spacing: .5px; }
.inline { display: inline-flex; margin: 2px; }
.badge.in_transit, .badge.pending { background: #fff8e6; color: var(--warning); }
.badge.accepted, .badge.issued, .badge.ready { background: #effaf3; color: var(--success); }
.badge.canceled { background: #fff0f0; color: var(--danger); }
.badge.diagnostics { background: #eef4ff; color: #2453b8; }
.badge.in_work, .badge.accepted { background: #f0f0ff; color: #4c45bd; }
@media (max-width: 860px) { .scan-form { grid-template-columns: 1fr; } }
