/* ============================================
   EPG Inventory Dashboard
   ============================================ */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

:root {
    --bg-dark: #0d0d0d;
    --bg-primary: #111111;
    --bg-secondary: #171717;
    --bg-card: #1a1a1a;
    --bg-card-hover: #1f1f1f;
    --accent: #E8C830;
    --accent-hover: #f0d44a;
    --accent-glow: rgba(232, 200, 48, 0.2);
    --accent-dim: rgba(232, 200, 48, 0.08);
    --text-primary: #F0F0F0;
    --text-secondary: #7a7a7a;
    --text-muted: #555;
    --border: #2a2a2a;
    --border-hover: #3a3a3a;
    --red: #e05555;
    --orange: #ffa726;
    --red-dim: rgba(224, 85, 85, 0.12);
    --green: #4caf6e;
    --blue: #5b9bd5;
    --blue-dim: rgba(91, 155, 213, 0.12);
    --purple: #9b7fd5;
}

html { font-size: 16px; }
#app { display: flex; flex-direction: column; height: 100vh; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.5;
    min-height: 100vh;
    -webkit-font-smoothing: antialiased;
}

/* ============================================ NAV ============================================ */
.topnav {
    position: sticky; top: 0; z-index: 100;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1.5rem;
    display: flex; align-items: center; justify-content: space-between;
    gap: 1rem; flex-wrap: wrap;
}
.topnav-brand { display: flex; align-items: center; gap: 0.6rem; }
.logo-en  { color: var(--text-secondary); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; }
.logo-vision { color: var(--accent); font-size: 1.15rem; font-weight: 700; letter-spacing: 0.04em; }
.topnav-divider { width: 1px; height: 18px; background: var(--border); }
.topnav-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-muted); }
.topnav-center { display: flex; align-items: center; }
.topnav-controls { display: flex; align-items: center; }
.controls-group { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }

/* View Tabs */
.view-tabs { display: flex; gap: 0.2rem; background: var(--bg-card); border-radius: 6px; padding: 0.18rem; }
.view-tab {
    background: none; border: none; color: var(--text-secondary);
    font-family: inherit; font-size: 0.75rem; font-weight: 500;
    padding: 0.38rem 0.9rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.view-tab:hover { color: var(--text-primary); }
.view-tab.active { background: var(--accent); color: #111; font-weight: 600; }

/* Filter Tabs */
.filter-tabs { display: flex; gap: 0.2rem; background: var(--bg-card); border-radius: 6px; padding: 0.18rem; }
.tab {
    background: none; border: none; color: var(--text-secondary);
    font-family: inherit; font-size: 0.72rem; font-weight: 500;
    padding: 0.35rem 0.7rem; border-radius: 4px; cursor: pointer; transition: all 0.2s;
}
.tab:hover { color: var(--text-primary); }
.tab.active { background: var(--accent); color: #111; font-weight: 600; }

/* Search */
.search-input {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
    padding: 0.4rem 0.75rem; color: var(--text-primary); font-family: inherit;
    font-size: 0.78rem; width: 180px; outline: none; transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.search-input::placeholder { color: var(--text-muted); }

/* Buttons */
.btn-add {
    background: var(--accent); color: #111; border: none; border-radius: 6px;
    padding: 0.4rem 0.95rem; font-family: inherit; font-size: 0.72rem; font-weight: 600;
    letter-spacing: 0.04em; cursor: pointer; transition: all 0.2s; white-space: nowrap;
}
.btn-add:hover { background: var(--accent-hover); transform: translateY(-1px); box-shadow: 0 3px 10px var(--accent-glow); }

/* ============================================ VIEWS ============================================ */
.view { display: none; }
.view.active { display: block; }

/* ============================================ MAIN ============================================ */
.main { max-width: 1200px; margin: 0 auto; padding: 1.75rem 1.5rem 4rem; }

/* ============================================ STATS ============================================ */
.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; margin-bottom: 1.75rem; }
.stat-card { background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; padding: 1.1rem 1.25rem; }
.stat-label { font-size: 0.68rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.4rem; }
.stat-value { font-size: 1.65rem; font-weight: 700; color: var(--accent); letter-spacing: -0.02em; }

/* ============================================ ITEM CARDS ============================================ */
.items-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 1rem; }

.item-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 1.4rem; position: relative; overflow: hidden;
    transition: border-color 0.3s, transform 0.2s, background 0.2s;
}
.item-card::before {
    content: ''; position: absolute; top: 0; left: 0; right: 0; height: 2px;
    background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 0.35s ease;
}
.item-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-2px); }
.item-card:hover::before { transform: scaleX(1); }

.item-card-header { display: flex; align-items: flex-start; justify-content: space-between; margin-bottom: 0.5rem; gap: 0.5rem; }
.item-card-header h3 { font-size: 0.92rem; font-weight: 600; line-height: 1.3; }
.item-actions, .user-actions { display: flex; gap: 0.3rem; flex-shrink: 0; }
.item-actions button, .user-actions button {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; color: var(--text-secondary);
}
.item-actions button:hover, .user-actions button:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-card-hover); }
.item-actions .btn-trash:hover, .user-actions .btn-trash:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.item-actions .btn-labels {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    width: 28px; height: 28px; display: flex; align-items: center; justify-content: center;
    cursor: pointer; transition: all 0.15s; font-size: 0.75rem; text-decoration: none;
}
.item-actions .btn-labels:hover { border-color: var(--purple); background: rgba(155,127,213,0.12); }
.item-actions .btn-labels svg { width: 13px; height: 13px; stroke: var(--text-secondary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.item-actions .btn-labels:hover svg { stroke: var(--purple); }
.btn-add svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; margin-right: 4px; }
.item-actions svg, .user-actions svg { width: 13px; height: 13px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }

.consumable-badge {
    display: inline-block; font-size: 0.55rem; font-weight: 600; text-transform: uppercase;
    letter-spacing: 0.4px; padding: 0.15rem 0.4rem; border-radius: 3px;
    background: rgba(122,122,122,0.15); color: var(--text-muted); margin-left: 0.4rem; vertical-align: middle;
}
.checkbox-group { margin-top: 0.25rem; }
.checkbox-label { display: flex; align-items: flex-start; gap: 0.4rem; cursor: pointer; color: var(--text-secondary); font-size: 0.78rem; }
.checkbox-label input[type="checkbox"] { margin-top: 2px; accent-color: var(--accent); width: 15px; height: 15px; flex-shrink: 0; }
.checkbox-hint { display: block; font-size: 0.65rem; color: var(--text-muted); margin-top: 0.2rem; margin-left: 1.4rem; }
.cat-badge { display: inline-block; font-size: 0.62rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.18rem 0.5rem; border-radius: 3px; margin-bottom: 0.5rem; }
.cat-badge.lighting { background: rgba(232,200,48,0.12); color: var(--accent); }
.cat-badge.audio    { background: var(--blue-dim);        color: var(--blue); }
.cat-badge.effects  { background: rgba(155,127,213,0.15); color: var(--purple); }
.cat-badge.other    { background: rgba(122,122,122,0.12); color: var(--text-secondary); }

.item-desc { font-size: 0.8rem; color: var(--text-secondary); line-height: 1.5; margin-bottom: 0.85rem; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

.avail-row { display: flex; align-items: center; justify-content: space-between; margin-bottom: 0.4rem; }
.avail-label { font-size: 0.65rem; color: var(--text-muted); font-weight: 500; letter-spacing: 0.05em; text-transform: uppercase; }
.avail-count { font-size: 0.7rem; color: var(--text-secondary); }
.avail-bar-bg { width: 100%; height: 4px; background: var(--bg-primary); border-radius: 2px; overflow: hidden; margin-bottom: 0.85rem; }
.avail-bar-fill { height: 100%; border-radius: 2px; transition: width 0.4s; }
.avail-bar-fill.high { background: var(--green); }
.avail-bar-fill.mid  { background: var(--accent); }
.avail-bar-fill.low  { background: var(--red); }

.item-card-footer { display: flex; align-items: center; justify-content: space-between; padding-top: 0.7rem; border-top: 1px solid var(--border); }
.item-price { font-size: 0.88rem; font-weight: 600; }
.item-price span { font-size: 0.68rem; color: var(--text-muted); font-weight: 400; }

.condition-badge { font-size: 0.62rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; padding: 0.16rem 0.45rem; border-radius: 3px; }
.condition-badge.new          { background: var(--blue-dim);                color: var(--blue); }
.condition-badge.good         { background: rgba(76,175,110,0.12);         color: var(--green); }
.condition-badge.fair         { background: rgba(232,200,48,0.12);         color: var(--accent); }
.condition-badge.needs_repair { background: var(--red-dim);                color: var(--red); }

/* ============================================ INVOICE CARDS ============================================ */
.invoice-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px;
    padding: 1.2rem 1.25rem 1.2rem 1.5rem; cursor: pointer; position: relative;
    transition: border-color 0.2s, transform 0.2s, background 0.2s;
}
.invoice-card::before {
    content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 3px;
    transition: background 0.2s;
}
.invoice-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); transform: translateY(-2px); }
.invoice-card[data-status="draft"]::before    { background: var(--text-muted); }
.invoice-card[data-status="reserved"]::before { background: var(--blue); }
.invoice-card[data-status="packed"]::before   { background: var(--accent); }
.invoice-card[data-status="active"]::before   { background: var(--green); }
.invoice-card[data-status="returned"]::before { background: var(--purple); }

.invoice-card-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.45rem; }
.invoice-card-number { font-size: 0.88rem; font-weight: 700; letter-spacing: 0.02em; }
.invoice-card-customer { font-size: 0.84rem; font-weight: 500; margin-bottom: 0.12rem; }
.invoice-card-event  { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.12rem; }
.invoice-card-dates  { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 0.5rem; }
.invoice-card-footer { font-size: 0.72rem; color: var(--text-muted); }
.invoice-card-footer strong { color: var(--accent); font-weight: 600; }

/* Status Badges */
.status-badge { display: inline-block; font-size: 0.6rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; padding: 0.18rem 0.5rem; border-radius: 3px; }
.status-badge.draft    { background: rgba(122,122,122,0.15); color: #7a7a7a; }
.status-badge.reserved { background: var(--blue-dim);                color: var(--blue); }
.status-badge.packed   { background: rgba(232,200,48,0.15);          color: var(--accent); }
.status-badge.active   { background: rgba(76,175,110,0.15);          color: var(--green); }
.status-badge.returned { background: rgba(155,127,213,0.15);         color: var(--purple); }

/* ============================================ INVOICE FORM ============================================ */
.invoice-form-wrapper { max-width: 740px; margin: 0 auto; padding: 1.5rem 1.5rem 3rem; }

.invoice-form-header { display: flex; align-items: center; gap: 0.85rem; margin-bottom: 1.75rem; flex-wrap: wrap; }
.btn-back {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    padding: 0.38rem 0.75rem; color: var(--text-secondary); font-family: inherit;
    font-size: 0.75rem; font-weight: 500; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-back:hover { border-color: var(--border-hover); color: var(--text-primary); }

.invoice-form-title { display: flex; align-items: center; gap: 0.6rem; flex-grow: 1; }
.invoice-form-title h2 { font-size: 1.05rem; font-weight: 600; }

.status-actions { display: flex; gap: 0.5rem; margin-left: auto; }
.btn-status {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    padding: 0.35rem 0.8rem; color: var(--text-secondary); font-family: inherit;
    font-size: 0.68rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase;
    cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-status:hover { border-color: var(--border-hover); color: var(--text-primary); }
.btn-status.forward { background: var(--accent); color: #111; border-color: var(--accent); }
.btn-status.forward:hover { background: var(--accent-hover); border-color: var(--accent-hover); box-shadow: 0 3px 10px var(--accent-glow); }
.btn-status.cancel-btn { color: var(--red); border-color: transparent; }
.btn-status.cancel-btn:hover { border-color: var(--red); background: var(--red-dim); }

/* Form Sections */
.form-section { margin-bottom: 1.5rem; padding-bottom: 1.5rem; border-bottom: 1px solid var(--border); }
.form-section:last-of-type { border-bottom: none; margin-bottom: 0; padding-bottom: 0; }
.form-section-title { font-size: 0.67rem; font-weight: 600; letter-spacing: 0.15em; text-transform: uppercase; color: var(--text-muted); margin-bottom: 0.85rem; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.form-group { margin-bottom: 0.85rem; }
.form-group:last-child { margin-bottom: 0; }
.form-group label { display: block; font-size: 0.67rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--text-secondary); margin-bottom: 0.38rem; }
.form-group input, .form-group select, .form-group textarea {
    width: 100%; padding: 0.55rem 0.7rem; background: var(--bg-card); border: 1px solid var(--border);
    border-radius: 6px; color: var(--text-primary); font-family: inherit; font-size: 0.84rem;
    outline: none; transition: border-color 0.2s, box-shadow 0.2s; -webkit-appearance: none; appearance: none;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }
.form-group input[type="date"] { color-scheme: dark; }
.form-group select {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%237a7a7a'/%3E%3C/svg%3E");
    background-repeat: no-repeat; background-position: right 0.7rem center; padding-right: 2rem; cursor: pointer;
}
.form-group select option { background: var(--bg-card); color: var(--text-primary); }
.form-group textarea { resize: vertical; min-height: 70px; }

/* Line Items */
.line-item-add { display: flex; gap: 0.5rem; margin-bottom: 0.75rem; align-items: center; }
.line-item-add select { flex: 1; min-width: 0; }
.line-item-add .qty-input { width: 55px; text-align: center; }
.btn-add-line {
    background: var(--accent-dim); border: 1px solid rgba(232,200,48,0.3); border-radius: 6px;
    padding: 0.48rem 0.75rem; color: var(--accent); font-family: inherit; font-size: 0.75rem;
    font-weight: 600; cursor: pointer; transition: all 0.15s; white-space: nowrap;
}
.btn-add-line:hover { background: var(--accent); color: #111; border-color: var(--accent); }

.line-items-list { display: flex; flex-direction: column; gap: 0.35rem; }
.line-item-row {
    display: flex; align-items: center; gap: 0.6rem; padding: 0.5rem 0.65rem;
    background: var(--bg-primary); border-radius: 6px; font-size: 0.8rem;
}
.line-item-name { flex: 1; min-width: 0; color: var(--text-primary); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.line-item-meta { display: flex; gap: 0.75rem; color: var(--text-secondary); font-size: 0.72rem; flex-shrink: 0; }
.line-item-subtotal { color: var(--accent); font-weight: 600; font-size: 0.8rem; min-width: 65px; text-align: right; flex-shrink: 0; }
.line-item-remove {
    background: none; border: none; color: var(--text-muted); font-size: 1.05rem;
    cursor: pointer; padding: 0 0.15rem; border-radius: 3px; transition: color 0.15s, background 0.15s; flex-shrink: 0; line-height: 1;
}
.line-item-remove:hover { color: var(--red); background: var(--red-dim); }

.line-items-total { display: flex; justify-content: flex-end; align-items: center; gap: 1rem; padding-top: 0.65rem; margin-top: 0.5rem; border-top: 1px solid var(--border); }
.line-items-total span:first-child { font-size: 0.78rem; color: var(--text-secondary); font-weight: 500; }
.line-items-total span:last-child { color: var(--accent); font-weight: 700; font-size: 0.95rem; }

/* Invoice Form Actions */
.invoice-form-actions { display: flex; justify-content: space-between; align-items: center; padding-top: 1rem; }
.invoice-form-actions-right { display: flex; gap: 0.65rem; }
.btn-delete-invoice {
    background: none; border: 1px solid var(--red); border-radius: 6px;
    padding: 0.42rem 0.9rem; color: var(--red); font-family: inherit; font-size: 0.75rem;
    font-weight: 600; cursor: pointer; transition: all 0.15s;
}
.btn-delete-invoice:hover { background: var(--red-dim); }

/* Readonly form state */
.form-readonly .form-group input,
.form-readonly .form-group select,
.form-readonly .form-group textarea { pointer-events: none; opacity: 0.55; }
.form-readonly .line-item-add { display: none; }
.form-readonly .line-item-remove { display: none; }
.form-readonly #btnInvoiceSave,
.form-readonly #btnInvoiceCancel { display: none; }

/* ============================================ MODALS ============================================ */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.6); backdrop-filter: blur(4px); z-index: 200; align-items: center; justify-content: center; padding: 1rem; }
.modal-overlay.open { display: flex; }
.modal { background: var(--bg-card); border: 1px solid var(--border); border-radius: 10px; width: 100%; max-width: 540px; max-height: 90vh; overflow-y: auto; animation: modalIn 0.2s ease; }
.modal-sm { max-width: 400px; }
@keyframes modalIn { from { opacity: 0; transform: translateY(10px) scale(0.97); } to { opacity: 1; transform: none; } }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 1.25rem 1.5rem 0.9rem; border-bottom: 1px solid var(--border); }
.modal-header h2 { font-size: 1rem; font-weight: 600; }
.modal-close { background: none; border: none; color: var(--text-secondary); font-size: 1.4rem; cursor: pointer; line-height: 1; padding: 0.1rem 0.25rem; border-radius: 4px; transition: color 0.15s, background 0.15s; }
.modal-close:hover { color: var(--text-primary); background: var(--bg-card-hover); }
#itemForm { padding: 1.1rem 1.5rem 1.4rem; }
.modal-actions { display: flex; justify-content: flex-end; gap: 0.65rem; padding: 0 1.5rem 1.4rem; }
.btn-cancel { background: none; border: 1px solid var(--border); border-radius: 6px; padding: 0.45rem 1.1rem; color: var(--text-secondary); font-family: inherit; font-size: 0.78rem; font-weight: 500; cursor: pointer; transition: all 0.15s; }
.btn-cancel:hover { border-color: var(--border-hover); color: var(--text-primary); }
.btn-save { background: var(--accent); color: #111; border: none; border-radius: 6px; padding: 0.45rem 1.3rem; font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: all 0.2s; }
.btn-save:hover { background: var(--accent-hover); box-shadow: 0 3px 10px var(--accent-glow); }
.delete-msg { padding: 0.9rem 1.5rem; font-size: 0.84rem; color: var(--text-secondary); line-height: 1.6; }
.btn-delete { background: var(--red); color: #fff; border: none; border-radius: 6px; padding: 0.45rem 1.1rem; font-family: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: background 0.15s; }
.btn-delete:hover { background: #d04444; }

/* ============================================ ASSET CARDS ============================================ */
.asset-card { text-align: center; padding: 1.2rem 1rem 1rem; }
.asset-card-qr { margin: 0 auto 0.6rem; width: 100px; height: 100px; }
.asset-card-qr img { width: 100%; height: 100%; object-fit: contain; border-radius: 6px; background: #fff; padding: 4px; }
.asset-serial { font-size: 0.85rem; font-weight: 700; font-family: 'Courier New', monospace; color: var(--accent); letter-spacing: 0.5px; margin-bottom: 0.25rem; }
.asset-name { font-size: 0.78rem; color: var(--text-secondary); margin-bottom: 0.5rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-badges { display: flex; justify-content: center; gap: 0.4rem; flex-wrap: wrap; margin-bottom: 0.5rem; }
.asset-invoice { font-size: 0.68rem; color: var(--text-muted); margin-bottom: 0.4rem; }
.asset-actions { margin-top: 0.6rem; }
.status-badge.on-invoice { background: var(--blue-dim); color: var(--blue); }
.status-badge.available  { background: rgba(76,175,110,0.15); color: var(--green); }

/* ============================================ INVOICE OUTPUT BUTTONS ============================================ */
.invoice-form-actions-mid { display: flex; gap: 0.5rem; }
.btn-output {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    padding: 0.4rem 0.85rem; color: var(--text-secondary); font-family: inherit;
    font-size: 0.72rem; font-weight: 600; cursor: pointer; transition: all 0.15s;
    text-decoration: none; white-space: nowrap;
}
.btn-output:hover { border-color: var(--border-hover); color: var(--text-primary); background: var(--bg-card-hover); }
.btn-output svg { width: 12px; height: 12px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; margin-right: 3px; }
.btn-output:disabled { opacity: 0.5; cursor: not-allowed; }

/* ============================================ ASSET DETAIL ============================================ */
.asset-card:hover { border-color: var(--border-hover); background: var(--bg-card-hover); }
.asset-detail-header { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.2rem; }
.asset-detail-title-wrap { display: flex; align-items: center; gap: 0.5rem; flex: 1; min-width: 0; }
.asset-detail-title-wrap h2 { margin: 0; font-size: 1rem; color: var(--text-primary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.asset-detail-summary { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.summary-pill {
    font-size: 0.65rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    padding: 0.22rem 0.55rem; border-radius: 10px;
}
.summary-pill.available     { background: rgba(76,175,110,0.15); color: var(--green); }
.summary-pill.on-invoice    { background: var(--blue-dim); color: var(--blue); }
.summary-pill.damaged       { background: var(--red-dim); color: var(--red); }
.summary-pill.needs_repair  { background: rgba(255,167,38,0.15); color: var(--orange); }

.asset-detail-list { display: flex; flex-direction: column; gap: 0.35rem; }
.asset-detail-row {
    display: grid; grid-template-columns: 160px 1fr 140px 1fr;
    align-items: center; gap: 0.6rem; padding: 0.65rem 0.85rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 6px;
    transition: border-color 0.15s, background 0.15s;
}
.asset-detail-row.status-damaged     { border-color: rgba(239,83,80,0.35); background: rgba(239,83,80,0.06); }
.asset-detail-row.status-needs_repair { border-color: rgba(255,167,38,0.35); background: rgba(255,167,38,0.06); }
.asset-detail-serial { font-family: 'Courier New', monospace; font-size: 0.78rem; font-weight: 700; color: var(--accent); }
.asset-status-select {
    background: var(--bg-input); border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-primary); font-size: 0.72rem; font-family: inherit; padding: 0.3rem 0.5rem;
    cursor: pointer; transition: border 0.15s; appearance: auto;
}
.asset-status-select:focus { outline: none; border-color: var(--accent); }
.asset-detail-invoice { font-size: 0.68rem; color: var(--blue); font-weight: 600; min-width: 0; }
.asset-notes-input {
    background: transparent; border: 1px solid transparent; border-radius: 4px;
    color: var(--text-secondary); font-size: 0.72rem; font-family: inherit; padding: 0.3rem 0.5rem;
    transition: border 0.15s, background 0.15s; min-width: 0; width: 100%;
}
.asset-notes-input:focus { outline: none; border-color: var(--border); background: var(--bg-input); color: var(--text-primary); }
.asset-notes-input::placeholder { color: var(--text-muted); }

/* ============================================ LOGIN SCREEN ============================================ */
.login-screen {
    position: fixed; inset: 0; display: flex; align-items: center; justify-content: center;
    background: var(--bg-primary); z-index: 1000;
}
.login-card {
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 14px;
    padding: 2.5rem 2rem 2rem; width: 100%; max-width: 360px; text-align: center;
}
.login-logo { font-size: 2rem; font-weight: 800; margin-bottom: 0.3rem; }
.login-logo .logo-en { color: var(--text-secondary); }
.login-logo .logo-vision { color: var(--accent); }
.login-subtitle { font-size: 0.72rem; color: var(--text-muted); margin-bottom: 1.8rem; }
.login-form { text-align: left; }
.login-field { margin-bottom: 1rem; }
.login-field label {
    display: block; font-size: 0.68rem; font-weight: 600; color: var(--text-secondary);
    margin-bottom: 0.3rem; text-transform: uppercase; letter-spacing: 0.6px;
}
.login-field input {
    width: 100%; padding: 0.6rem 0.75rem; background: var(--bg-input);
    border: 1px solid var(--border); border-radius: 6px; color: var(--text-primary);
    font-size: 0.85rem; font-family: inherit; box-sizing: border-box; transition: border 0.15s;
}
.login-field input:focus { outline: none; border-color: var(--accent); }
.login-error {
    color: var(--red); font-size: 0.7rem; margin-bottom: 0.75rem;
    padding: 0.4rem 0.6rem; background: var(--red-dim); border-radius: 4px; text-align: center;
}
.btn-login {
    width: 100%; padding: 0.65rem; background: var(--accent); color: #1a1a2e;
    border: none; border-radius: 6px; font-size: 0.8rem; font-weight: 700;
    cursor: pointer; transition: opacity 0.15s; font-family: inherit; margin-top: 0.25rem;
}
.btn-login:hover { opacity: 0.85; }

/* ============================================ USER NAV ============================================ */
.btn-scan {
    background: none; border: 1px solid var(--border); border-radius: 6px;
    width: 32px; height: 32px; display: flex; align-items: center; justify-content: center;
    font-size: 0.9rem; text-decoration: none; transition: all 0.15s; cursor: pointer;
}
.btn-scan:hover { border-color: var(--accent); background: rgba(232,200,48,0.1); }
.btn-scan svg { width: 14px; height: 14px; stroke: var(--text-secondary); fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.btn-scan:hover svg { stroke: var(--accent); }
.topnav-user { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }
.nav-user-role {
    font-size: 0.58rem; text-transform: uppercase; letter-spacing: 0.5px;
    padding: 0.2rem 0.45rem; border-radius: 3px; font-weight: 700;
}
.nav-user-role.admin   { background: rgba(232,200,48,0.15); color: var(--accent); }
.nav-user-role.manager { background: var(--blue-dim); color: var(--blue); }
.nav-user-role.viewer  { background: rgba(122,122,122,0.12); color: var(--text-secondary); }
.nav-user-name { font-size: 0.72rem; color: var(--text-secondary); }
.btn-logout {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    color: var(--text-muted); width: 24px; height: 24px; display: flex;
    align-items: center; justify-content: center; cursor: pointer;
    font-size: 0.7rem; transition: all 0.15s;
}
.btn-logout:hover { border-color: var(--red); color: var(--red); }

/* ============================================ USERS TABLE ============================================ */
.users-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1rem; }
.users-title { font-size: 0.9rem; color: var(--text-primary); font-weight: 600; margin: 0; }
.users-table-wrap { overflow-x: auto; }
.users-table {
    width: 100%; border-collapse: collapse; font-size: 0.78rem;
    background: var(--bg-card); border: 1px solid var(--border); border-radius: 8px; overflow: hidden;
}
.users-table th {
    text-align: left; padding: 0.7rem 1rem; background: var(--bg-primary);
    color: var(--text-muted); font-weight: 600; font-size: 0.65rem;
    text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--border);
}
.users-table td { padding: 0.7rem 1rem; border-bottom: 1px solid var(--border); color: var(--text-secondary); }
.users-table tr:last-child td { border-bottom: none; }
.user-name { color: var(--text-primary); font-weight: 600; }
.user-date { color: var(--text-muted); font-size: 0.7rem; }
.user-actions { display: flex; gap: 0.4rem; }
.btn-text-edit, .btn-text-delete {
    background: none; border: 1px solid var(--border); border-radius: 4px;
    padding: 0.3rem 0.6rem; font-size: 0.7rem; font-weight: 600; font-family: inherit;
    cursor: pointer; transition: all 0.15s; color: var(--text-secondary);
}
.btn-text-edit:hover { border-color: var(--accent); color: var(--accent); background: rgba(232,200,48,0.08); }
.btn-text-delete:hover { border-color: var(--red); color: var(--red); background: var(--red-dim); }
.role-badge {
    font-size: 0.62rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.4px;
    padding: 0.2rem 0.5rem; border-radius: 3px;
}
.role-badge.admin   { background: rgba(232,200,48,0.15); color: var(--accent); }
.role-badge.manager { background: var(--blue-dim); color: var(--blue); }
.role-badge.viewer  { background: rgba(122,122,122,0.12); color: var(--text-secondary); }

/* ============================================ TOAST ============================================ */
.toast { position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%) translateY(100px); background: var(--red); color: #fff; padding: 0.55rem 1.2rem; border-radius: 6px; font-size: 0.8rem; font-weight: 500; z-index: 500; transition: transform 0.3s ease; white-space: nowrap; }
.toast.show { transform: translateX(-50%) translateY(0); }

/* ============================================ EMPTY ============================================ */
.empty-state { text-align: center; padding: 4rem 1rem; color: var(--text-muted); font-size: 0.88rem; }

/* ============================================ RESPONSIVE ============================================ */
@media (max-width: 640px) {
    .topnav { padding: 0.65rem 1rem; }
    .main { padding: 1.25rem 1rem 3rem; }
    .stats-row { grid-template-columns: repeat(2, 1fr); }
    .items-grid { grid-template-columns: 1fr; }
    .search-input { width: 100%; }
    .form-row { grid-template-columns: 1fr; }
    .invoice-form-wrapper { padding: 1rem 1rem 2rem; }
    .invoice-form-header { flex-wrap: wrap; }
    .status-actions { margin-left: 0; width: 100%; }
    .line-item-meta { display: none; }
}
