* { margin: 0; padding: 0; box-sizing: border-box; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; background: #f4f5f7; color: #1e293b; font-size: 14px; }

.layout { display: flex; min-height: 100vh; }

/* Sidebar */
.sidebar { width: 240px; background: #0b1120; color: #cbd5e1; display: flex; flex-direction: column; padding: 20px 14px; position: sticky; top: 0; height: 100vh; }
.brand { color: #fff; font-size: 19px; font-weight: 700; margin-bottom: 16px; }
.user-chip { display: flex; align-items: center; gap: 6px; font-size: 13px; color: #94a3b8; margin-bottom: 22px; }
.role-badge { background: #2563eb; color: #fff; font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: 5px; }
.side-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.side-nav a { color: #cbd5e1; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; transition: background .12s, color .12s; }
.side-nav a:hover { background: #1e293b; color: #fff; }
.side-nav a.active { background: #2563eb; color: #fff; font-weight: 600; }
.logout { color: #94a3b8; text-decoration: none; padding: 10px 12px; border-radius: 8px; font-size: 14px; margin-top: 10px; }
.logout:hover { background: #1e293b; color: #fff; }

/* Content */
.content { flex: 1; padding: 28px 32px; min-width: 0; }
.page-head { display: flex; justify-content: space-between; align-items: center; gap: 20px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head h1 { font-size: 24px; font-weight: 700; }
.search-box { flex: 1; max-width: 460px; }
.search-box input { width: 100%; padding: 11px 16px; border: 1px solid #e2e8f0; border-radius: 10px; font-size: 14px; background: #fff; }
.search-box input:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }

/* Valuation bar */
.valuation-bar { display: flex; align-items: center; gap: 12px; background: #fff; border: 1px solid #e2e8f0; border-radius: 12px; padding: 16px 20px; margin-bottom: 20px; }
.vb-icon { font-size: 18px; }
.vb-label { font-weight: 600; }
.vb-meta { color: #64748b; font-size: 13px; }
.vb-total { margin-left: auto; font-size: 22px; font-weight: 700; color: #0f172a; }

/* Cards */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 18px; }
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 20px; }
.card-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 14px; }
.card-title { color: #2563eb; font-size: 18px; font-weight: 700; }
.card-brand { color: #64748b; font-size: 12px; font-weight: 600; letter-spacing: .04em; margin-top: 2px; }
.edit-btn { border: 1px solid #e2e8f0; background: #fff; width: 30px; height: 30px; border-radius: 50%; cursor: pointer; color: #64748b; font-size: 13px; }
.edit-btn:hover { background: #f1f5f9; }
.spec { display: flex; justify-content: space-between; padding: 5px 0; font-size: 13px; color: #64748b; }
.spec b { color: #1e293b; font-weight: 600; }
.in-stock { color: #16a34a !important; }
.no-stock { color: #dc2626 !important; }
.valuation-row { border-top: 1px solid #eef2f6; margin-top: 8px; padding-top: 12px; font-size: 14px; }
.valuation-row span { color: #475569; font-weight: 600; }
.valuation-row b { font-size: 15px; }
.btn-add, .btn-reduce { width: 100%; border: none; border-radius: 9px; padding: 11px; font-size: 14px; font-weight: 600; cursor: pointer; margin-top: 10px; color: #fff; }
.btn-add { background: #16a34a; }
.btn-add:hover { background: #15803d; }
.btn-reduce { background: #dc2626; margin-top: 8px; }
.btn-reduce:hover { background: #b91c1c; }
.empty { grid-column: 1 / -1; text-align: center; padding: 60px; color: #94a3b8; background: #fff; border-radius: 14px; border: 1px solid #e2e8f0; }

/* Forms */
.form-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 14px; padding: 26px; max-width: 760px; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px 20px; }
.fg { display: flex; flex-direction: column; gap: 6px; margin-bottom: 4px; }
.fg label { font-size: 13px; font-weight: 600; color: #334155; }
.fg input, .fg select { padding: 10px 12px; border: 1px solid #e2e8f0; border-radius: 9px; font-size: 14px; background: #fff; }
.fg input:focus, .fg select:focus { outline: none; border-color: #2563eb; box-shadow: 0 0 0 3px rgba(37,99,235,.12); }
.btn-primary { margin-top: 18px; width: 100%; background: #2563eb; color: #fff; border: none; border-radius: 10px; padding: 13px; font-size: 15px; font-weight: 600; cursor: pointer; }
.btn-primary:hover { background: #1d4ed8; }
.btn-primary:disabled { opacity: .6; cursor: default; }
.btn-light { background: #f1f5f9; color: #334155; border: none; border-radius: 10px; padding: 13px 18px; font-size: 14px; font-weight: 600; cursor: pointer; }
.btn-light:hover { background: #e2e8f0; }
.error-msg { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; padding: 11px 14px; border-radius: 9px; margin-bottom: 14px; display: none; }
.error-msg.show { display: block; }

/* Modals */
.modal-overlay { position: fixed; inset: 0; background: rgba(15,23,42,.45); display: none; align-items: center; justify-content: center; padding: 20px; z-index: 50; }
.modal-overlay.show { display: flex; }
.modal { background: #fff; border-radius: 14px; padding: 24px; width: 100%; max-width: 460px; }
.modal h2 { font-size: 18px; margin-bottom: 16px; }
.modal .form-grid { grid-template-columns: 1fr 1fr; }
.modal-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.modal-actions .btn-primary { margin-top: 0; width: auto; padding: 11px 22px; }
.modal-err { color: #b91c1c; font-size: 13px; margin-top: 8px; min-height: 16px; }

/* Tables & shared */
.muted { color: #94a3b8; }
.card-panel { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:20px; }
.table-wrap { overflow-x:auto; }
table { width:100%; border-collapse:collapse; background:#fff; }
th, td { text-align:left; padding:11px 14px; border-bottom:1px solid #eef2f6; font-size:13px; }
th { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:#64748b; font-weight:700; }
td.num, th.num { text-align:right; }
td.nowrap { white-space:nowrap; }
tbody tr:hover { background:#f8fafc; }
.tag { font-size:11px; font-weight:700; padding:3px 9px; border-radius:6px; }
.tag-add { background:#dcfce7; color:#15803d; }
.tag-red { background:#fee2e2; color:#b91c1c; }

/* Filter bar */
.filter-bar { display:flex; gap:10px; flex-wrap:wrap; align-items:center; background:#fff; border:1px solid #e2e8f0; border-radius:12px; padding:14px; }
.filter-bar input, .filter-bar select { padding:10px 12px; border:1px solid #e2e8f0; border-radius:9px; font-size:14px; }
.filter-search { flex:1; min-width:220px; }

/* Categories */
.add-row { display:flex; gap:10px; }
.add-row input { flex:1; padding:11px 12px; border:1px solid #e2e8f0; border-radius:9px; font-size:14px; }
.link-danger { background:none; border:none; color:#dc2626; cursor:pointer; font-size:13px; font-weight:600; }
.link-danger:hover { text-decoration:underline; }

/* Export */
.export-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(320px,1fr)); gap:18px; }
.export-card { background:#fff; border:1px solid #e2e8f0; border-radius:14px; padding:20px; display:flex; flex-direction:column; }
.ec-head { display:flex; gap:12px; align-items:center; margin-bottom:14px; }
.ec-icon { width:44px; height:44px; border-radius:11px; display:flex; align-items:center; justify-content:center; font-size:20px; }
.ec-head h3 { font-size:16px; }
.ec-head p { font-size:12px; color:#64748b; }
.ec-stat { display:flex; justify-content:space-between; font-size:13px; color:#64748b; padding:4px 0; }
.ec-stat b { color:#1e293b; }
.ec-btn { margin-top:auto; color:#fff; text-align:center; text-decoration:none; padding:12px; border-radius:10px; font-weight:600; font-size:14px; margin-top:14px; }
.ec-btn:hover { filter:brightness(.94); }

/* Login */
.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background:#0b1120; padding:20px; }
.login-card { background:#fff; border-radius:14px; padding:32px; width:100%; max-width:360px; box-shadow:0 10px 40px rgba(0,0,0,.3); }
.login-logo { font-size:20px; font-weight:700; margin-bottom:4px; }
.login-sub { color:#94a3b8; font-size:13px; margin-bottom:20px; }
.login-card .btn-primary { margin-top:8px; }

/* Role badges */
.role-badge { color:#fff; font-size:10px; font-weight:700; padding:2px 7px; border-radius:5px; }
.role-admin { background:#2563eb; }
.role-user  { background:#16a34a; }
.role-viewer{ background:#7c3aed; }

/* Role tabs + selects */
.role-tabs { display:flex; gap:8px; margin-bottom:14px; }
.rt { border:1px solid #e2e8f0; background:#fff; padding:7px 16px; border-radius:8px; font-size:13px; font-weight:600; color:#475569; cursor:pointer; }
.rt.active { background:#2563eb; color:#fff; border-color:#2563eb; }
.role-select { padding:6px 10px; border:1px solid #e2e8f0; border-radius:7px; font-size:13px; background:#fff; }
.link-btn { background:none; border:none; color:#2563eb; cursor:pointer; font-size:13px; font-weight:600; margin-right:10px; }
.link-btn:hover { text-decoration:underline; }
