/* ── Reset & Base ───────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 15px; }
body { font-family: 'Segoe UI', system-ui, -apple-system, sans-serif; background: #f1f5f9; color: #1e293b; line-height: 1.5; }
a { text-decoration: none; color: inherit; }
input, select, textarea, button { font-family: inherit; font-size: inherit; }

/* ── Layout ─────────────────────────────────────────── */
.layout { display: flex; min-height: 100vh; }
.main-area { flex: 1; display: flex; flex-direction: column; min-width: 0; }

/* ── Sidebar ─────────────────────────────────────────── */
.sidebar { width: 230px; background: #0f172a; color: #cbd5e1; display: flex; flex-direction: column; flex-shrink: 0; min-height: 100vh; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.logo { display: flex; align-items: center; gap: 10px; padding: 18px 16px; border-bottom: 1px solid #1e293b; }
.logo-icon { width: 34px; height: 34px; background: #3b82f6; border-radius: 8px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.logo-name { font-size: 13px; font-weight: 600; color: #f8fafc; }
.logo-ver { font-size: 10px; color: #475569; }
.nav { padding: 12px 10px; flex: 1; }
.nav-section { font-size: 10px; color: #475569; text-transform: uppercase; letter-spacing: .08em; padding: 14px 8px 6px; font-weight: 600; }
.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 7px; cursor: pointer; font-size: 13px; color: #94a3b8; margin-bottom: 2px; transition: background .15s, color .15s; }
.nav-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: .65; }
.nav-item:hover { background: #1e293b; color: #e2e8f0; }
.nav-item:hover svg { opacity: .9; }
.nav-item.active { background: #1e3a5f; color: #60a5fa; font-weight: 500; }
.nav-item.active svg { opacity: 1; }

/* ── Topbar ─────────────────────────────────────────── */
.topbar { display: flex; align-items: center; justify-content: space-between; padding: 13px 24px; background: #fff; border-bottom: 1px solid #e2e8f0; position: sticky; top: 0; z-index: 10; }
.page-title { font-size: 17px; font-weight: 600; color: #0f172a; }
.topbar-right { display: flex; align-items: center; gap: 12px; }
.user-pill { font-size: 12px; color: #64748b; background: #f1f5f9; padding: 5px 12px; border-radius: 20px; border: 1px solid #e2e8f0; }
.btn-logout { font-size: 12px; color: #ef4444; border: 1px solid #fca5a5; padding: 5px 12px; border-radius: 6px; transition: background .15s; }
.btn-logout:hover { background: #fee2e2; }

/* ── Content Area ───────────────────────────────────── */
.content { padding: 24px; flex: 1; }

/* ── Stats Cards ────────────────────────────────────── */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; padding: 16px 18px; }
.stat-label { font-size: 11px; color: #64748b; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.stat-value { font-size: 26px; font-weight: 700; }
.stat-note { font-size: 11px; color: #94a3b8; margin-top: 4px; }
.stat-blue  .stat-value { color: #2563eb; }
.stat-green .stat-value { color: #16a34a; }
.stat-amber .stat-value { color: #d97706; }
.stat-red   .stat-value { color: #dc2626; }

/* ── Cards & Tables ─────────────────────────────────── */
.card { background: #fff; border: 1px solid #e2e8f0; border-radius: 10px; overflow: hidden; margin-bottom: 20px; }
.card-header { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid #f1f5f9; }
.card-title { font-size: 14px; font-weight: 600; color: #0f172a; }
.card-body { padding: 18px; }

table { width: 100%; border-collapse: collapse; }
thead th { text-align: left; padding: 10px 16px; font-size: 11px; font-weight: 600; color: #64748b; text-transform: uppercase; letter-spacing: .04em; background: #f8fafc; border-bottom: 1px solid #e2e8f0; }
tbody td { padding: 11px 16px; font-size: 13px; border-bottom: 1px solid #f1f5f9; color: #334155; }
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

/* ── Badges / Status ────────────────────────────────── */
.badge { display: inline-flex; align-items: center; padding: 3px 9px; border-radius: 5px; font-size: 11px; font-weight: 600; }
.badge-green  { background: #dcfce7; color: #166534; }
.badge-amber  { background: #fef9c3; color: #854d0e; }
.badge-red    { background: #fee2e2; color: #991b1b; }
.badge-blue   { background: #dbeafe; color: #1e40af; }
.badge-gray   { background: #f1f5f9; color: #475569; }
.badge-purple { background: #ede9fe; color: #5b21b6; }

/* ── Buttons ────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: 7px; font-size: 13px; font-weight: 500; cursor: pointer; border: 1px solid #e2e8f0; background: #fff; color: #334155; transition: background .15s, border-color .15s; }
.btn:hover { background: #f1f5f9; }
.btn-primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.btn-primary:hover { background: #1d4ed8; border-color: #1d4ed8; }
.btn-danger  { background: #dc2626; color: #fff; border-color: #dc2626; }
.btn-danger:hover  { background: #b91c1c; }
.btn-success { background: #16a34a; color: #fff; border-color: #16a34a; }
.btn-success:hover { background: #15803d; }
.btn-sm { padding: 5px 11px; font-size: 12px; }

/* ── Forms ──────────────────────────────────────────── */
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group label { font-size: 12px; font-weight: 600; color: #475569; }
.form-group input, .form-group select, .form-group textarea {
    padding: 9px 12px; border: 1px solid #cbd5e1; border-radius: 7px; font-size: 13px; color: #1e293b; background: #fff; outline: none; transition: border-color .15s, box-shadow .15s;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: #3b82f6; box-shadow: 0 0 0 3px rgba(59,130,246,.12); }
.form-group textarea { resize: vertical; min-height: 80px; }
.form-group.full { grid-column: 1 / -1; }
.form-actions { display: flex; gap: 10px; margin-top: 8px; }

/* ── Alerts ─────────────────────────────────────────── */
.alert { padding: 12px 16px; border-radius: 8px; margin-bottom: 18px; font-size: 13px; font-weight: 500; }
.alert-success { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.alert-error   { background: #fef2f2; color: #991b1b; border: 1px solid #fecaca; }
.alert-info    { background: #eff6ff; color: #1e40af; border: 1px solid #bfdbfe; }

/* ── Search & Filters ───────────────────────────────── */
.toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.search-input { display: flex; align-items: center; gap: 8px; background: #fff; border: 1px solid #e2e8f0; border-radius: 7px; padding: 8px 12px; }
.search-input input { border: none; outline: none; font-size: 13px; min-width: 200px; background: transparent; }
.search-input svg { width: 15px; height: 15px; color: #94a3b8; flex-shrink: 0; }
.filter-select { padding: 8px 12px; border: 1px solid #e2e8f0; border-radius: 7px; font-size: 13px; color: #334155; background: #fff; cursor: pointer; }

/* ── Asset tag link ─────────────────────────────────── */
.asset-tag { color: #2563eb; font-weight: 600; font-size: 12px; font-family: monospace; }

/* ── Login Page ─────────────────────────────────────── */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%); }
.login-box { background: #fff; border-radius: 14px; padding: 40px 36px; width: 380px; box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.login-logo { display: flex; align-items: center; gap: 12px; margin-bottom: 28px; }
.login-logo-icon { width: 42px; height: 42px; background: #2563eb; border-radius: 10px; display: flex; align-items: center; justify-content: center; }
.login-title { font-size: 17px; font-weight: 700; color: #0f172a; }
.login-sub { font-size: 12px; color: #64748b; margin-top: 2px; }
.login-box h2 { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-box p { font-size: 13px; color: #64748b; margin-bottom: 24px; }
.login-box .form-group { margin-bottom: 14px; }
.login-box .btn-primary { width: 100%; justify-content: center; padding: 11px; font-size: 14px; }

/* ── Responsive ─────────────────────────────────────── */
@media (max-width: 768px) {
    .sidebar { width: 200px; }
    .content { padding: 14px; }
    .stats-grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 600px) {
    .layout { flex-direction: column; }
    .sidebar { width: 100%; min-height: auto; height: auto; position: relative; }
    .stats-grid { grid-template-columns: 1fr; }
}

/* ── Pagination ─────────────────────────────────────── */
.pagination { display: flex; gap: 4px; margin-top: 16px; }
.pagination a, .pagination span { padding: 6px 12px; border-radius: 6px; font-size: 13px; border: 1px solid #e2e8f0; background: #fff; color: #334155; }
.pagination a:hover { background: #f1f5f9; }
.pagination .current { background: #2563eb; color: #fff; border-color: #2563eb; }

/* ── Empty state ────────────────────────────────────── */
.empty-state { text-align: center; padding: 48px 24px; color: #94a3b8; }
.empty-state svg { width: 48px; height: 48px; margin: 0 auto 12px; display: block; opacity: .4; }
.empty-state h3 { font-size: 15px; font-weight: 600; color: #475569; margin-bottom: 6px; }

/* ── Modal ──────────────────────────────────────────── */
.modal-backdrop { display: none; position: fixed; inset: 0; background: rgba(15,23,42,.5); z-index: 50; align-items: center; justify-content: center; }
.modal-backdrop.open { display: flex; }
.modal { background: #fff; border-radius: 12px; width: 90%; max-width: 560px; max-height: 90vh; overflow-y: auto; }
.modal-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid #f1f5f9; }
.modal-title { font-size: 15px; font-weight: 600; }
.modal-close { background: none; border: none; font-size: 20px; cursor: pointer; color: #94a3b8; line-height: 1; padding: 0 4px; }
.modal-close:hover { color: #334155; }
.modal-body { padding: 20px; }
.modal-footer { padding: 14px 20px; border-top: 1px solid #f1f5f9; display: flex; justify-content: flex-end; gap: 10px; }
