:root {
    --navy: #0f1c3f;
    --navy-light: #16244d;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --yellow: #d97706;
    --yellow-light: #fffbeb;
    --red: #dc2626;
    --red-light: #fef2f2;
    --text-dark: #0f172a;
    --text-muted: #64748b;
    --border: #e2e8f0;
    --bg: #f4f6fb;
    --card: #ffffff;
    --radius: 14px;
}

* { margin:0; padding:0; box-sizing:border-box; }
html, body { overflow-x: hidden; }

body {
    font-family: 'Segoe UI', -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--text-dark);
    font-size: 14px;
}

a { text-decoration:none; color:inherit; }
ul { list-style:none; }
svg.icon { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; flex-shrink: 0; display: block; }

/* ===== Layout ===== */
.app-layout { display:flex; min-height:100vh; }

/* ===== Sidebar ===== */
.sidebar {
    width: 260px;
    background: var(--navy);
    color: #cbd5e1;
    flex-shrink: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    overflow-y: auto;
    scrollbar-width: none;
    z-index: 100;
    transition: transform 0.25s ease;
}
.sidebar::-webkit-scrollbar { display:none; }
.sidebar-brand {
    display:flex; align-items:center; gap:12px;
    padding: 22px 20px;
}
.sidebar-brand .icon-badge {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #2563eb, #3b82f6);
    border-radius: 10px;
    display:flex; align-items:center; justify-content:center;
    color:#fff;
}
.sidebar-brand .icon-badge svg { width:20px; height:20px; }
.sidebar-brand .name { font-size: 17px; font-weight: 700; color:#fff; }
.sidebar-brand .tagline { font-size: 11px; color:#8291b3; }

.sidebar-nav { padding: 8px 12px; flex:1; }
.sidebar-nav .nav-item {
    display:flex; align-items:center; gap:12px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13.5px;
    font-weight: 500;
    color: #aab4cc;
    margin-bottom: 2px;
    cursor: pointer;
}
.sidebar-nav .nav-item:hover { background: rgba(255,255,255,0.06); color:#fff; }
.sidebar-nav .nav-item.active { background: var(--blue); color:#fff; }

.sidebar-section-title {
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: #64749a;
    padding: 16px 14px 6px;
}

.sidebar-promo {
    margin: 16px 12px;
    padding: 18px 16px;
    background: linear-gradient(135deg, #1e3a8a, #2563eb);
    border-radius: 14px;
    text-align: center;
    color:#fff;
}
.sidebar-promo .rocket { width:26px; height:26px; margin:0 auto 8px; }
.sidebar-promo h4 { font-size: 14px; margin-bottom:4px; }
.sidebar-promo p { font-size: 11.5px; opacity:0.85; margin-bottom:12px; }
.sidebar-promo .btn-upgrade {
    display:block; background:#fff; color:#1e3a8a; padding:8px; border-radius:8px;
    font-size:12.5px; font-weight:700;
}

/* ===== Main ===== */
.main-content { margin-left: 260px; flex:1; min-width:0; }

.topbar {
    background:#fff;
    border-bottom: 1px solid var(--border);
    padding: 14px 28px;
    display:flex; align-items:center; justify-content:space-between;
    gap: 16px;
    position: sticky; top:0; z-index: 50;
    overflow: visible;
}
.topbar-search {
    flex:1; max-width: 420px;
    display:flex; align-items:center; gap:10px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 9px 14px;
    color: var(--text-muted);
}
.topbar-search svg { color: var(--text-muted); width:16px; height:16px; }
.topbar-search input { border:none; background:transparent; outline:none; flex:1; font-size:13.5px; }
.menu-toggle { color:#334155; cursor:pointer; display:none; }

.topbar-right { display:flex; align-items:center; gap:14px; }
.icon-btn {
    width: 38px; height: 38px;
    border-radius: 10px;
    background: var(--bg);
    display:flex; align-items:center; justify-content:center;
    position:relative; cursor:pointer; color:#475569;
}
.icon-btn svg { width:17px; height:17px; }
.icon-btn .badge-dot {
    position:absolute; top:-4px; right:-4px;
    background:#dc2626; color:#fff; font-size:10px;
    width:16px; height:16px; border-radius:50%;
    display:flex; align-items:center; justify-content:center;
}
.lang-select { display:flex; align-items:center; gap:6px; font-size:13px; color:#334155; cursor:pointer; }
.lang-select svg { width:15px; height:15px; }
.lang-select svg:last-child { width:14px; height:14px; }
.user-chip { display:flex; align-items:center; gap:10px; cursor:pointer; }
.user-chip img, .user-chip .avatar-fallback {
    width: 38px; height: 38px; border-radius:50%; object-fit:cover;
    background: var(--blue); color:#fff; display:flex; align-items:center; justify-content:center; font-weight:700;
}
.user-chip .u-name { font-size: 13.5px; font-weight:600; }
.user-chip .u-role { font-size: 11.5px; color:var(--text-muted); }

.page-body { padding: 24px 28px 60px; }

.page-header {
    display:flex; align-items:flex-start; justify-content:space-between; flex-wrap:wrap; gap:12px;
    margin-bottom: 22px;
}
.page-header h1 { font-size: 24px; font-weight:700; margin-bottom:4px; }
.page-header p { color: var(--text-muted); font-size: 13.5px; }
.date-chip {
    display:flex; align-items:center; gap:8px;
    background:#fff; border:1px solid var(--border); border-radius:10px;
    padding: 10px 16px; font-size: 13px; font-weight:600; color:#334155;
}
.date-chip svg { width:15px; height:15px; }

/* ===== Cards / Grid ===== */
.grid { display:grid; gap:20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: 2fr 1.3fr 1.5fr; }
.grid-2b { grid-template-columns: 1.4fr 1.4fr 1.3fr; }
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
    .grid-3, .grid-2b { grid-template-columns: 1fr; }
}

.card {
    background: var(--card);
    border-radius: var(--radius);
    border: 1px solid var(--border);
    padding: 22px;
}
.card-head {
    display:flex; align-items:center; justify-content:space-between; margin-bottom:16px;
}
.card-head h3 { font-size: 15.5px; font-weight:700; display:flex; align-items:center; gap:8px; }
.card-head .link { font-size:13px; color:var(--blue); font-weight:600; }

.select-chip {
    border:1px solid var(--border); border-radius:8px; padding:6px 12px; font-size:12.5px; color:#475569; font-weight:600; background:#fff;
    display:flex; align-items:center; gap:6px;
}
.select-chip svg { width:13px; height:13px; }

/* ===== Stat cards ===== */
.stat-card { display:flex; align-items:flex-start; justify-content:space-between; }
.stat-card .stat-icon {
    width: 46px; height: 46px; border-radius:12px;
    display:flex; align-items:center; justify-content:center; margin-bottom:14px;
}
.stat-card .stat-icon svg { width:22px; height:22px; }
.stat-icon.blue { background: var(--blue-light); color: var(--blue); }
.stat-icon.purple { background: var(--purple-light); color: var(--purple); }
.stat-icon.green { background: var(--green-light); color: var(--green); }
.stat-icon.yellow { background: var(--yellow-light); color: var(--yellow); }

.stat-label { font-size: 13px; color: var(--text-muted); font-weight:600; margin-bottom:6px; }
.stat-value { font-size: 24px; font-weight:800; margin-bottom:8px; }
.stat-trend { font-size:12px; font-weight:700; display:flex; align-items:center; gap:3px; }
.stat-trend svg { width:12px; height:12px; }
.stat-trend.up { color: var(--green); }
.stat-trend.down { color: var(--red); }
.stat-trend span { color: var(--text-muted); font-weight:500; }
.stat-spark { width:90px; height:40px; }

/* ===== Tables ===== */
table.data-table { width:100%; border-collapse:collapse; }
table.data-table th {
    text-align:left; font-size:12px; text-transform:uppercase; letter-spacing:0.03em;
    color: var(--text-muted); padding: 10px 8px; border-bottom:1px solid var(--border); font-weight:700;
}
table.data-table td { padding: 12px 8px; border-bottom: 1px solid #f1f5f9; font-size:13.5px; }
table.data-table tr:last-child td { border-bottom:none; }
.row-media { display:flex; align-items:center; gap:10px; }
.row-media .thumb {
    width:34px; height:34px; border-radius:8px; background:var(--blue-light); color:var(--blue);
    display:flex; align-items:center; justify-content:center;
}
.row-media .thumb svg { width:16px; height:16px; }

.badge { padding: 4px 11px; border-radius:999px; font-size:11.5px; font-weight:700; display:inline-block; }
.badge-yellow { background:#fef3c7; color:#b45309; }
.badge-blue { background:#dbeafe; color:#1d4ed8; }
.badge-purple { background:#ede9fe; color:#6d28d9; }
.badge-green { background:#dcfce7; color:#15803d; }
.badge-red { background:#fee2e2; color:#b91c1c; }
.badge-gray { background:#f1f5f9; color:#475569; }

/* ===== Donut legend ===== */
.donut-wrap { display:flex; align-items:center; gap:20px; }
.legend-item { display:flex; align-items:center; gap:8px; margin-bottom:10px; font-size:13px; }
.legend-dot { width:10px; height:10px; border-radius:50%; }
.legend-item .lval { font-weight:700; font-size: 14px; display:block; }

/* ===== Top products / tasks list ===== */
.task-item { display:flex; align-items:flex-start; gap:12px; padding: 10px 0; border-bottom:1px solid #f1f5f9; }
.task-item:last-child { border-bottom:none; }
.task-item input[type=checkbox] { margin-top:3px; width:16px; height:16px; }
.task-title { font-weight:600; font-size:13.5px; }
.task-sub { font-size:12px; color:var(--text-muted); }
.task-date { margin-left:auto; }

.activity-item { display:flex; align-items:center; gap:12px; padding:10px 0; border-bottom:1px solid #f1f5f9; }
.activity-item:last-child { border-bottom:none; }
.activity-icon { width:32px; height:32px; border-radius:8px; display:flex; align-items:center; justify-content:center; flex-shrink:0; }
.activity-icon svg { width:15px; height:15px; }
.activity-msg { font-size:13.5px; font-weight:500; flex:1; }
.activity-time { font-size:11.5px; color:var(--text-muted); white-space:nowrap; }

.summary-box { text-align:center; padding: 14px; background: var(--bg); border-radius:12px; }
.summary-box .lbl { font-size:12.5px; color:var(--text-muted); font-weight:600; margin-bottom:6px; }
.summary-box .val { font-size:19px; font-weight:800; margin-bottom:4px; }

.quicklink-grid { display:grid; grid-template-columns:1fr 1fr; gap:12px; }
.quicklink {
    display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px;
    padding: 18px 8px; border-radius:12px; font-size:12.5px; font-weight:700; text-align:center;
}
.quicklink .qi { width:36px; height:36px; border-radius:9px; display:flex; align-items:center; justify-content:center; }
.quicklink .qi svg { width:17px; height:17px; }

/* ===== Forms ===== */
.form-card { background:#fff; border:1px solid var(--border); border-radius:var(--radius); padding:24px; }
.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:16px; }
.form-field { margin-bottom:16px; }
.form-field label { display:block; font-size:13px; font-weight:600; margin-bottom:6px; color:#334155; }
.form-field input, .form-field select, .form-field textarea {
    width:100%; padding:10px 12px; border:1px solid var(--border); border-radius:9px; font-size:13.5px; font-family:inherit;
}
.form-field input:focus, .form-field select:focus, .form-field textarea:focus { outline:none; border-color:var(--blue); }

.btn { display:inline-flex; align-items:center; gap:8px; padding:10px 18px; border-radius:9px; font-size:13.5px; font-weight:700; cursor:pointer; border:none; }
.btn svg { width:15px; height:15px; }
.btn-primary { background: var(--blue); color:#fff; }
.btn-primary:hover { background:#1d4ed8; }
.btn-outline { background:#fff; border:1px solid var(--border); color:#334155; }
.btn-danger { background: var(--red-light); color: var(--red); }
.btn-sm { padding:6px 12px; font-size:12px; }

.toolbar { display:flex; align-items:center; justify-content:space-between; margin-bottom:18px; flex-wrap:wrap; gap:12px; }
.search-box { display:flex; align-items:center; gap:8px; background:#fff; border:1px solid var(--border); border-radius:9px; padding:8px 12px; min-width:260px; }
.search-box input { border:none; outline:none; flex:1; font-size:13.5px; }

.alert-flash { padding:12px 16px; border-radius:10px; font-size:13.5px; margin-bottom:16px; font-weight:600; }
.alert-flash.success { background:#dcfce7; color:#166534; }
.alert-flash.error { background:#fee2e2; color:#991b1b; }

.progress-bar { width:100%; height:8px; background:#e2e8f0; border-radius:999px; overflow:hidden; }
.progress-bar span { display:block; height:100%; background: var(--blue); border-radius:999px; }

.pagination { display:flex; gap:6px; justify-content:flex-end; margin-top:16px; }
.pagination a { padding:6px 12px; border:1px solid var(--border); border-radius:8px; font-size:12.5px; font-weight:600; color:#334155; }
.pagination a.active { background: var(--blue); color:#fff; border-color:var(--blue); }

.login-wrap { min-height:100vh; display:flex; align-items:center; justify-content:center; background: linear-gradient(135deg, #0f1c3f, #1a2a5e); padding:20px; }
.login-card { background:#fff; border-radius:16px; padding:40px; width:100%; max-width:400px; box-shadow:0 20px 60px rgba(0,0,0,0.3); }
.login-card .logo-badge { width:56px;height:56px;background:linear-gradient(135deg,#2563eb,#3b82f6);border-radius:14px;display:flex;align-items:center;justify-content:center;color:#fff;margin:0 auto 14px; }
.login-card h1 { text-align:center; font-size:20px; margin-bottom:4px; }
.login-card p.sub { text-align:center; color:var(--text-muted); font-size:13px; margin-bottom:24px; }
.login-hint { background:var(--blue-light); color:#1d4ed8; padding:10px 14px; border-radius:9px; font-size:12.5px; margin-top:16px; text-align:center; }

@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .main-content { margin-left: 0; }
    .menu-toggle { display:block; }
    .topbar-search { display:none; }
}
