/* assets/css/app.css */
:root {
    --bg: #0d0f14;
    --bg2: #13161e;
    --bg3: #1a1e28;
    --bg4: #212636;
    --border: #2a2f3f;
    --border2: #353c52;
    --text: #e8eaf0;
    --text2: #9ba3b8;
    --text3: #636b82;
    --accent: #f59e0b;
    --accent2: #d97706;
    --accent3: #fef3c7;
    --green: #10b981;
    --green-bg: rgba(16,185,129,.12);
    --red: #ef4444;
    --red-bg: rgba(239,68,68,.12);
    --blue: #3b82f6;
    --blue-bg: rgba(59,130,246,.12);
    --orange: #f97316;
    --orange-bg: rgba(249,115,22,.12);
    --purple: #8b5cf6;
    --purple-bg: rgba(139,92,246,.12);
    --yellow: #eab308;
    --yellow-bg: rgba(234,179,8,.12);
    --sidebar-w: 260px;
    --topbar-h: 60px;
    --radius: 10px;
    --radius-lg: 16px;
    --shadow: 0 4px 24px rgba(0,0,0,.4);
    --font: 'Sora', sans-serif;
    --mono: 'JetBrains Mono', monospace;
    --transition: .18s ease;
}
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 14px; }
body { font-family: var(--font); background: var(--bg); color: var(--text); min-height: 100vh; }
a { color: inherit; text-decoration: none; }
input, select, textarea, button { font-family: inherit; }

/* ─── APP SHELL ─── */
.app-shell { display: flex; min-height: 100vh; }

/* ─── SIDEBAR ─── */
.sidebar {
    width: var(--sidebar-w); min-height: 100vh;
    background: var(--bg2); border-right: 1px solid var(--border);
    display: flex; flex-direction: column;
    position: fixed; left: 0; top: 0; z-index: 100;
    transition: transform var(--transition);
}
.sidebar-header { padding: 20px 18px 16px; border-bottom: 1px solid var(--border); }
.brand { display: flex; align-items: center; gap: 12px; }
.brand-icon { width:40px; height:40px; background: var(--accent); border-radius:10px; display:flex; align-items:center; justify-content:center; color:#0d0f14; flex-shrink:0; }
.brand-icon svg { width:24px; height:24px; }
.brand-name { font-size:1.1rem; font-weight:700; color:var(--text); line-height:1.2; }
.brand-sub { font-size:.7rem; color:var(--text3); text-transform:uppercase; letter-spacing:.08em; }
.sidebar-body { flex:1; overflow-y:auto; padding:12px 10px; scrollbar-width:thin; scrollbar-color:var(--border) transparent; }
.nav-section { margin-bottom:20px; }
.nav-label { display:block; font-size:.65rem; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:.12em; padding:0 8px; margin-bottom:4px; }
.nav-item {
    display:flex; align-items:center; gap:10px; padding:9px 10px;
    border-radius:8px; color:var(--text2); font-size:.82rem; font-weight:500;
    transition:background var(--transition), color var(--transition);
    margin-bottom:2px; position:relative;
}
.nav-item svg { width:16px; height:16px; flex-shrink:0; }
.nav-item:hover { background:var(--bg4); color:var(--text); }
.nav-item.active { background:rgba(245,158,11,.12); color:var(--accent); }
.nav-item.active::before { content:''; position:absolute; left:0; top:20%; bottom:20%; width:3px; background:var(--accent); border-radius:0 3px 3px 0; }
.badge { margin-left:auto; background:var(--accent); color:#0d0f14; font-size:.65rem; font-weight:700; padding:2px 6px; border-radius:10px; }
.badge.warn { background:var(--red); color:#fff; }
.sidebar-footer { padding:12px 10px; border-top:1px solid var(--border); }
.user-card { display:flex; align-items:center; gap:10px; padding:8px; border-radius:8px; }
.user-avatar { width:34px; height:34px; border-radius:50%; background:var(--accent); color:#0d0f14; display:flex; align-items:center; justify-content:center; font-size:.75rem; font-weight:700; flex-shrink:0; }
.user-info { flex:1; min-width:0; }
.user-name { font-size:.82rem; font-weight:600; color:var(--text); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.user-role { font-size:.7rem; color:var(--text3); text-transform:capitalize; }
.logout-btn { width:28px; height:28px; border-radius:6px; background:var(--bg4); display:flex; align-items:center; justify-content:center; color:var(--text3); transition:all var(--transition); }
.logout-btn:hover { background:var(--red-bg); color:var(--red); }
.logout-btn svg { width:14px; height:14px; }

/* ─── MAIN ─── */
.main-content { margin-left:var(--sidebar-w); flex:1; display:flex; flex-direction:column; min-height:100vh; }
.topbar { height:var(--topbar-h); background:var(--bg2); border-bottom:1px solid var(--border); display:flex; align-items:center; gap:14px; padding:0 24px; position:sticky; top:0; z-index:50; }
.menu-toggle { display:none; background:none; border:none; color:var(--text2); cursor:pointer; width:32px; height:32px; border-radius:6px; align-items:center; justify-content:center; }
.menu-toggle svg { width:18px; height:18px; }
.topbar-title { font-size:.95rem; font-weight:600; color:var(--text); flex:1; }
.topbar-right { display:flex; align-items:center; gap:12px; }
.topbar-date { font-size:.75rem; color:var(--text3); }
.page-content { flex:1; padding:24px; }

/* ─── ALERTS ─── */
.alert { padding:12px 16px; border-radius:var(--radius); margin-bottom:16px; font-size:.84rem; font-weight:500; }
.alert-success { background:var(--green-bg); color:var(--green); border:1px solid rgba(16,185,129,.2); }
.alert-error { background:var(--red-bg); color:var(--red); border:1px solid rgba(239,68,68,.2); }
.alert-info { background:var(--blue-bg); color:var(--blue); border:1px solid rgba(59,130,246,.2); }
.alert-warn { background:var(--yellow-bg); color:var(--yellow); border:1px solid rgba(234,179,8,.2); }

/* ─── CARDS ─── */
.card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:20px; }
.card-header { display:flex; align-items:center; justify-content:space-between; margin-bottom:16px; }
.card-title { font-size:.95rem; font-weight:600; color:var(--text); }
.card-sub { font-size:.78rem; color:var(--text3); margin-top:2px; }

/* ─── STAT CARDS ─── */
.stats-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(180px,1fr)); gap:14px; margin-bottom:24px; }
.stat-card { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:18px; display:flex; align-items:center; gap:14px; transition:border-color var(--transition); }
.stat-card:hover { border-color:var(--border2); }
.stat-icon { width:44px; height:44px; border-radius:10px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.stat-icon svg { width:20px; height:20px; }
.stat-value { font-size:1.6rem; font-weight:700; color:var(--text); line-height:1; font-family:var(--mono); }
.stat-label { font-size:.73rem; color:var(--text3); margin-top:3px; }
.stat-delta { font-size:.72rem; margin-top:4px; }
.stat-delta.up { color:var(--green); }
.stat-delta.down { color:var(--red); }

/* ─── TABLES ─── */
.table-wrap { overflow-x:auto; border-radius:var(--radius-lg); border:1px solid var(--border); }
table { width:100%; border-collapse:collapse; }
thead tr { background:var(--bg3); }
th { padding:10px 14px; text-align:left; font-size:.72rem; font-weight:600; color:var(--text3); text-transform:uppercase; letter-spacing:.07em; white-space:nowrap; }
td { padding:11px 14px; font-size:.83rem; color:var(--text2); border-top:1px solid var(--border); vertical-align:middle; }
tbody tr { transition:background var(--transition); }
tbody tr:hover { background:var(--bg3); }
td strong { color:var(--text); font-weight:600; }
.mono { font-family:var(--mono); font-size:.8rem; }

/* ─── STATUS BADGES ─── */
.status { display:inline-flex; align-items:center; gap:5px; padding:3px 9px; border-radius:20px; font-size:.72rem; font-weight:600; text-transform:uppercase; letter-spacing:.05em; }
.status::before { content:''; width:5px; height:5px; border-radius:50%; }
.status-pending { background:var(--yellow-bg); color:var(--yellow); }
.status-pending::before { background:var(--yellow); }
.status-approved { background:var(--green-bg); color:var(--green); }
.status-approved::before { background:var(--green); }
.status-rejected { background:var(--red-bg); color:var(--red); }
.status-rejected::before { background:var(--red); }
.status-issued, .status-completed, .status-closed { background:var(--blue-bg); color:var(--blue); }
.status-issued::before, .status-completed::before, .status-closed::before { background:var(--blue); }
.status-partial { background:var(--orange-bg); color:var(--orange); }
.status-partial::before { background:var(--orange); }
.status-draft { background:var(--bg4); color:var(--text3); }
.status-draft::before { background:var(--text3); }
.status-sent { background:var(--purple-bg); color:var(--purple); }
.status-sent::before { background:var(--purple); }
.status-received { background:var(--green-bg); color:var(--green); }
.status-received::before { background:var(--green); }
.status-low { background:var(--red-bg); color:var(--red); font-weight:700; }
.status-low::before { background:var(--red); }

/* ─── FORMS ─── */
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-grid.cols3 { grid-template-columns:1fr 1fr 1fr; }
.form-grid.cols1 { grid-template-columns:1fr; }
.form-group { display:flex; flex-direction:column; gap:6px; }
.form-group.full { grid-column:1/-1; }
.form-label { font-size:.78rem; font-weight:600; color:var(--text2); }
.form-label span { color:var(--red); margin-left:2px; }
.form-control {
    background:var(--bg3); border:1px solid var(--border); border-radius:8px;
    padding:9px 12px; color:var(--text); font-size:.84rem;
    transition:border-color var(--transition), box-shadow var(--transition);
    width:100%;
}
.form-control:focus { outline:none; border-color:var(--accent); box-shadow:0 0 0 3px rgba(245,158,11,.12); }
.form-control::placeholder { color:var(--text3); }
select.form-control { cursor:pointer; }
textarea.form-control { resize:vertical; min-height:80px; }

/* ─── BUTTONS ─── */
.btn { display:inline-flex; align-items:center; gap:7px; padding:9px 16px; border-radius:8px; font-size:.83rem; font-weight:600; cursor:pointer; border:none; transition:all var(--transition); white-space:nowrap; }
.btn svg { width:15px; height:15px; }
.btn-primary { background:var(--accent); color:#0d0f14; }
.btn-primary:hover { background:var(--accent2); }
.btn-secondary { background:var(--bg4); color:var(--text); border:1px solid var(--border2); }
.btn-secondary:hover { background:var(--bg3); border-color:var(--border2); }
.btn-success { background:var(--green-bg); color:var(--green); border:1px solid rgba(16,185,129,.2); }
.btn-success:hover { background:rgba(16,185,129,.2); }
.btn-danger { background:var(--red-bg); color:var(--red); border:1px solid rgba(239,68,68,.2); }
.btn-danger:hover { background:rgba(239,68,68,.2); }
.btn-info { background:var(--blue-bg); color:var(--blue); border:1px solid rgba(59,130,246,.2); }
.btn-info:hover { background:rgba(59,130,246,.2); }
.btn-sm { padding:5px 10px; font-size:.75rem; }
.btn-xs { padding:3px 7px; font-size:.7rem; }
.btn-group { display:flex; gap:8px; flex-wrap:wrap; }

/* ─── PAGE HEADER ─── */
.page-header { display:flex; align-items:flex-start; justify-content:space-between; margin-bottom:24px; flex-wrap:wrap; gap:12px; }
.page-heading { font-size:1.3rem; font-weight:700; color:var(--text); }
.page-sub { font-size:.8rem; color:var(--text3); margin-top:3px; }

/* ─── FILTERS BAR ─── */
.filters-bar { display:flex; gap:10px; margin-bottom:18px; flex-wrap:wrap; align-items:center; }
.filters-bar .form-control { width:auto; min-width:130px; padding:7px 10px; font-size:.8rem; }
.search-input { min-width:220px !important; }

/* ─── PAGINATION ─── */
.pagination { display:flex; gap:6px; align-items:center; justify-content:flex-end; margin-top:16px; flex-wrap:wrap; }
.page-link { padding:5px 10px; border-radius:6px; font-size:.78rem; font-weight:500; color:var(--text2); background:var(--bg3); border:1px solid var(--border); transition:all var(--transition); }
.page-link:hover { background:var(--bg4); color:var(--text); }
.page-link.active { background:var(--accent); color:#0d0f14; border-color:var(--accent); }
.page-info { font-size:.78rem; color:var(--text3); margin-right:auto; }

/* ─── EMPTY STATE ─── */
.empty-state { text-align:center; padding:60px 20px; color:var(--text3); }
.empty-state svg { width:48px; height:48px; margin:0 auto 12px; opacity:.3; display:block; }
.empty-state h3 { font-size:.95rem; color:var(--text2); margin-bottom:6px; }
.empty-state p { font-size:.8rem; }

/* ─── MODAL ─── */
.modal-overlay { position:fixed; inset:0; background:rgba(0,0,0,.7); z-index:200; display:flex; align-items:center; justify-content:center; opacity:0; pointer-events:none; transition:opacity var(--transition); }
.modal-overlay.open { opacity:1; pointer-events:all; }
.modal { background:var(--bg2); border:1px solid var(--border); border-radius:var(--radius-lg); padding:24px; max-width:560px; width:90%; max-height:85vh; overflow-y:auto; transform:translateY(20px); transition:transform var(--transition); }
.modal-overlay.open .modal { transform:translateY(0); }
.modal-header { display:flex; justify-content:space-between; align-items:center; margin-bottom:20px; }
.modal-title { font-size:1rem; font-weight:700; }
.modal-close { background:none; border:none; color:var(--text3); cursor:pointer; font-size:1.2rem; width:28px; height:28px; border-radius:6px; display:flex; align-items:center; justify-content:center; transition:all var(--transition); }
.modal-close:hover { background:var(--red-bg); color:var(--red); }

/* ─── DETAIL VIEW ─── */
.detail-grid { display:grid; grid-template-columns:1fr 1fr; gap:14px; }
.detail-item label { font-size:.72rem; color:var(--text3); font-weight:600; text-transform:uppercase; letter-spacing:.05em; display:block; margin-bottom:3px; }
.detail-item p { font-size:.85rem; color:var(--text); }
.detail-item.full { grid-column:1/-1; }
.divider { height:1px; background:var(--border); margin:18px 0; }

/* ─── PROGRESS BAR ─── */
.progress-bar { background:var(--bg4); border-radius:10px; height:6px; overflow:hidden; }
.progress-fill { height:100%; border-radius:10px; background:var(--accent); transition:width .4s ease; }

/* ─── FLOW INDICATOR ─── */
.flow-steps { display:flex; align-items:center; gap:0; margin-bottom:24px; overflow-x:auto; padding-bottom:4px; }
.flow-step { display:flex; align-items:center; gap:0; flex-shrink:0; }
.flow-node { padding:6px 14px; background:var(--bg3); border:1px solid var(--border); border-radius:20px; font-size:.73rem; font-weight:600; color:var(--text3); white-space:nowrap; }
.flow-node.done { background:var(--green-bg); color:var(--green); border-color:rgba(16,185,129,.2); }
.flow-node.active { background:rgba(245,158,11,.15); color:var(--accent); border-color:rgba(245,158,11,.3); }
.flow-arrow { width:28px; color:var(--border2); font-size:.9rem; text-align:center; }

/* ─── LOGIN PAGE ─── */
.login-page { min-height:100vh; background:var(--bg); display:flex; align-items:center; justify-content:center; }
.login-card { background:var(--bg2); border:1px solid var(--border); border-radius:20px; padding:40px; width:100%; max-width:400px; }
.login-brand { text-align:center; margin-bottom:32px; }
.login-brand .brand-icon { width:56px; height:56px; border-radius:14px; margin:0 auto 12px; }
.login-brand .brand-icon svg { width:30px; height:30px; }
.login-brand h1 { font-size:1.4rem; font-weight:700; }
.login-brand p { font-size:.8rem; color:var(--text3); margin-top:4px; }
.login-card .form-group { margin-bottom:14px; }

/* ─── DASHBOARD SPECIFIC ─── */
.section-title { font-size:.85rem; font-weight:700; color:var(--text); margin-bottom:14px; display:flex; align-items:center; gap:8px; }
.section-title::after { content:''; flex:1; height:1px; background:var(--border); }
.dashboard-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.activity-list { display:flex; flex-direction:column; gap:10px; }
.activity-item { display:flex; gap:12px; }
.activity-dot { width:8px; height:8px; border-radius:50%; margin-top:5px; flex-shrink:0; }
.activity-text { font-size:.8rem; color:var(--text2); line-height:1.4; }
.activity-time { font-size:.7rem; color:var(--text3); margin-top:2px; }
.reorder-item { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid var(--border); }
.reorder-item:last-child { border:none; }
.reorder-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.reorder-icon svg { width:16px; height:16px; }

/* ─── RESPONSIVE ─── */
@media (max-width: 900px) {
    .sidebar { transform:translateX(-100%); }
    .sidebar.open { transform:translateX(0); }
    .main-content { margin-left:0; }
    .menu-toggle { display:flex; }
    .form-grid { grid-template-columns:1fr; }
    .form-grid.cols3 { grid-template-columns:1fr; }
    .dashboard-grid { grid-template-columns:1fr; }
    .detail-grid { grid-template-columns:1fr; }
}
@media (max-width: 600px) {
    .page-content { padding:16px; }
    .stats-grid { grid-template-columns:1fr 1fr; }
    .topbar { padding:0 14px; }
}

/* Print */
@media print {
    .sidebar, .topbar, .btn-group, .filters-bar, .pagination { display:none !important; }
    .main-content { margin-left:0; }
    body { background:#fff; color:#000; }
    .card, .table-wrap { border:1px solid #ccc; }
    th, td { color:#000; }
}
