/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --sidebar-width: 260px;
    --header-height: 64px;
    --bg-primary: #f0f2f5;
    --bg-white: #ffffff;
    --bg-sidebar: #0f172a;
    --bg-sidebar-hover: #1e293b;
    --bg-sidebar-active: #2563eb;
    --text-primary: #1e293b;
    --text-secondary: #64748b;
    --text-muted: #94a3b8;
    --text-sidebar: #cbd5e1;
    --text-sidebar-active: #ffffff;
    --border-color: #e2e8f0;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --green: #16a34a;
    --green-light: #f0fdf4;
    --orange: #ea580c;
    --orange-light: #fff7ed;
    --red: #dc2626;
    --red-light: #fef2f2;
    --purple: #7c3aed;
    --purple-light: #f5f3ff;
    --teal: #0d9488;
    --teal-light: #f0fdfa;
    --yellow: #ca8a04;
    --yellow-light: #fefce8;
    --pink: #db2777;
    --pink-light: #fdf2f8;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.05);
    --shadow-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -2px rgba(0,0,0,0.05);
    --shadow-lg: 0 10px 15px -3px rgba(0,0,0,0.08), 0 4px 6px -4px rgba(0,0,0,0.04);
    --radius: 8px;
    --radius-lg: 12px;
    --transition: 0.2s ease;
}

html { font-size: 14px; }
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background: var(--bg-primary);
    color: var(--text-primary);
    display: flex;
    min-height: 100vh;
    overflow-x: hidden;
}

a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Login Page ──────────────────────────────────────────────────────────── */
.login-body {
    display: flex;
    min-height: 100vh;
    background: var(--bg-primary);
}
.login-container {
    display: flex;
    width: 100%;
    min-height: 100vh;
}
.login-left {
    width: 420px;
    background: linear-gradient(135deg, #0f172a 0%, #1e3a5f 100%);
    color: #fff;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: 60px 48px;
    flex-shrink: 0;
}
.login-brand { margin-bottom: 48px; }
.login-logo { font-size: 3rem; color: var(--blue); margin-bottom: 12px; }
.login-brand h1 { font-size: 2rem; font-weight: 700; margin-bottom: 4px; }
.login-tagline { color: var(--text-muted); font-size: 0.95rem; }
.login-features { display: flex; flex-direction: column; gap: 16px; }
.login-feature {
    display: flex; align-items: center; gap: 12px;
    font-size: 0.95rem; color: var(--text-sidebar);
}
.login-feature i { width: 20px; text-align: center; color: var(--blue); }
.login-footer-text { margin-top: auto; padding-top: 48px; font-size: 0.78rem; color: var(--text-muted); }

.login-right {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 48px;
}
.login-form-wrapper {
    width: 100%;
    max-width: 420px;
}
.login-form-wrapper h2 { font-size: 1.75rem; font-weight: 700; margin-bottom: 4px; }
.login-subtitle { color: var(--text-secondary); margin-bottom: 28px; font-size: 0.95rem; }
.login-error {
    background: var(--red-light);
    border: 1px solid #fca5a5;
    color: var(--red);
    padding: 10px 14px;
    border-radius: var(--radius);
    margin-bottom: 20px;
    font-size: 0.88rem;
    display: flex;
    align-items: center;
    gap: 8px;
}
.login-form { display: flex; flex-direction: column; gap: 18px; }
.login-form .form-group label {
    display: block;
    font-weight: 600;
    font-size: 0.85rem;
    margin-bottom: 6px;
    color: var(--text-primary);
}
.input-icon-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}
.input-icon-wrapper i {
    position: absolute;
    left: 14px;
    color: var(--text-muted);
    font-size: 0.9rem;
}
.input-icon-wrapper input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.95rem;
    outline: none;
    transition: var(--transition);
    background: var(--bg-white);
}
.input-icon-wrapper input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.12);
}
.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.85rem;
}
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; color: var(--text-secondary); }
.forgot-link { color: var(--blue); font-weight: 500; }
.login-btn {
    width: 100%;
    padding: 12px;
    background: var(--blue);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}
.login-btn:hover { background: #1d4ed8; }
.login-help { margin-top: 24px; text-align: center; font-size: 0.85rem; color: var(--text-muted); }

/* ── Sidebar ─────────────────────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--bg-sidebar);
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    overflow-y: auto;
}
.sidebar-header { padding: 20px 20px 16px; border-bottom: 1px solid rgba(255,255,255,0.08); }
.logo { display: flex; align-items: center; gap: 10px; font-size: 1.35rem; font-weight: 700; color: #fff; }
.logo i { font-size: 1.5rem; color: var(--blue); }
.company-label { font-size: 0.75rem; color: var(--text-muted); margin-top: 6px; letter-spacing: 0.02em; }
.sidebar-nav { flex: 1; padding: 12px 0; }
.nav-section-label { font-size: 0.68rem; font-weight: 600; color: var(--text-muted); padding: 16px 20px 6px; letter-spacing: 0.08em; text-transform: uppercase; }
.nav-item {
    display: flex; align-items: center; gap: 12px;
    padding: 10px 20px; color: var(--text-sidebar);
    font-size: 0.93rem; font-weight: 400;
    transition: var(--transition); text-decoration: none;
    border-left: 3px solid transparent;
}
.nav-item:hover { background: var(--bg-sidebar-hover); color: #fff; text-decoration: none; }
.nav-item.active { background: rgba(37,99,235,0.15); color: var(--text-sidebar-active); border-left-color: var(--blue); font-weight: 500; }
.nav-item i { width: 20px; text-align: center; font-size: 1rem; }
.sidebar-footer { padding: 16px 20px; border-top: 1px solid rgba(255,255,255,0.08); }
.user-info { display: flex; align-items: center; gap: 10px; }
.user-avatar { width: 36px; height: 36px; background: var(--blue); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-weight: 600; font-size: 0.8rem; flex-shrink: 0; }
.user-name { color: #fff; font-weight: 500; font-size: 0.9rem; }
.user-role { color: var(--text-muted); font-size: 0.75rem; }
.user-details { flex: 1; min-width: 0; }
.logout-btn { color: var(--text-muted); font-size: 1rem; padding: 4px; transition: var(--transition); }
.logout-btn:hover { color: var(--red); text-decoration: none; }

/* ── Main Content ────────────────────────────────────────────────────────── */
.main-content { margin-left: var(--sidebar-width); flex: 1; display: flex; flex-direction: column; min-height: 100vh; min-width: 0; }

/* ── Top Header ──────────────────────────────────────────────────────────── */
.top-header {
    height: var(--header-height);
    background: var(--bg-white);
    border-bottom: 1px solid var(--border-color);
    padding: 0 28px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: sticky;
    top: 0; z-index: 50;
    box-shadow: var(--shadow-sm);
    flex-shrink: 0;
}
.page-title { font-size: 1.25rem; font-weight: 600; color: var(--text-primary); }
.breadcrumb { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.breadcrumb a { color: var(--text-secondary); }
.header-right { display: flex; align-items: center; gap: 16px; }
.search-box { position: relative; display: flex; align-items: center; }
.search-box i { position: absolute; left: 12px; color: var(--text-muted); font-size: 0.85rem; }
.search-box input {
    padding: 8px 12px 8px 36px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    background: var(--bg-primary);
    font-size: 0.85rem;
    width: 220px;
    transition: var(--transition);
    outline: none;
}
.search-box input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px rgba(37,99,235,0.12); width: 280px; }
.header-actions { display: flex; gap: 4px; }

/* ── Header Buttons & Dropdowns ──────────────────────────────────────────── */
.dropdown { position: relative; }
.header-btn {
    position: relative;
    width: 38px; height: 38px;
    display: flex; align-items: center; justify-content: center;
    border: none; background: none;
    color: var(--text-secondary);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    font-size: 1rem;
}
.header-btn:hover { background: var(--bg-primary); color: var(--text-primary); }
.header-btn .badge {
    position: absolute; top: 4px; right: 4px;
    background: var(--red); color: #fff;
    font-size: 0.6rem; font-weight: 600;
    width: 16px; height: 16px;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}
.dropdown-menu {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    right: 0;
    width: 340px;
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 200;
    max-height: 420px;
    overflow-y: auto;
}
.dropdown-menu.show { display: block; }
.dropdown-header { padding: 14px 16px; font-weight: 700; font-size: 0.95rem; border-bottom: 1px solid var(--border-color); }
.dropdown-item {
    display: flex; gap: 12px; padding: 12px 16px;
    border-bottom: 1px solid #f1f5f9;
    cursor: pointer; transition: var(--transition);
}
.dropdown-item:hover { background: #f8fafc; }
.dropdown-item.unread { background: var(--blue-light); }
.dropdown-item.unread:hover { background: #dbeafe; }
.dropdown-item i { font-size: 1rem; margin-top: 2px; width: 20px; flex-shrink: 0; }
.dropdown-item p { font-size: 0.82rem; color: var(--text-secondary); margin-top: 2px; line-height: 1.3; }
.dropdown-item strong { font-size: 0.88rem; }
.dropdown-time { font-size: 0.72rem; color: var(--text-muted); margin-top: 4px; display: block; }
.dropdown-footer { padding: 10px 16px; text-align: center; font-size: 0.85rem; border-top: 1px solid var(--border-color); }
.dropdown-footer a { font-weight: 500; }
.text-orange { color: var(--orange); }
.text-blue { color: var(--blue); }
.text-teal { color: var(--teal); }
.text-purple { color: var(--purple); }
.msg-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 0.7rem; font-weight: 600;
    flex-shrink: 0;
}

/* ── Calendar Dropdown ───────────────────────────────────────────────────── */
.dropdown-calendar { width: 300px; }
.mini-calendar { padding: 8px 16px; }
.mini-calendar table { width: 100%; border-collapse: collapse; text-align: center; font-size: 0.8rem; }
.mini-calendar th { color: var(--text-muted); font-weight: 600; padding: 4px; font-size: 0.7rem; }
.mini-calendar td { padding: 5px; border-radius: 6px; cursor: pointer; }
.mini-calendar td:hover { background: var(--bg-primary); }
.mini-calendar td.today { background: var(--blue); color: #fff; font-weight: 700; border-radius: 50%; }
.mini-calendar td.other-month { color: var(--text-muted); }
.cal-events { padding: 8px 16px 12px; border-top: 1px solid var(--border-color); }
.cal-event { display: flex; align-items: center; gap: 8px; font-size: 0.82rem; padding: 4px 0; color: var(--text-secondary); }
.cal-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.cal-dot.blue { background: var(--blue); }
.cal-dot.green { background: var(--green); }
.cal-dot.orange { background: var(--orange); }

/* ── Content Body ────────────────────────────────────────────────────────── */
.content-body { padding: 24px 28px; flex: 1; overflow-x: hidden; }

/* ── KPI Cards ───────────────────────────────────────────────────────────── */
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin-bottom: 20px; }
.kpi-grid.five { grid-template-columns: repeat(5, 1fr); }
.kpi-card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    display: flex;
    align-items: center;
    gap: 14px;
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    transition: var(--transition);
    text-decoration: none;
    color: inherit;
    min-width: 0;
}
.kpi-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); text-decoration: none; }
a.kpi-card.clickable { cursor: pointer; }
.kpi-icon {
    width: 44px; height: 44px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    font-size: 1.1rem; flex-shrink: 0;
}
.kpi-icon.blue   { background: var(--blue-light); color: var(--blue); }
.kpi-icon.green  { background: var(--green-light); color: var(--green); }
.kpi-icon.orange { background: var(--orange-light); color: var(--orange); }
.kpi-icon.red    { background: var(--red-light); color: var(--red); }
.kpi-icon.purple { background: var(--purple-light); color: var(--purple); }
.kpi-icon.teal   { background: var(--teal-light); color: var(--teal); }
.kpi-icon.yellow { background: var(--yellow-light); color: var(--yellow); }
.kpi-icon.pink   { background: var(--pink-light); color: var(--pink); }
.kpi-info { flex: 1; min-width: 0; }
.kpi-value { font-size: 1.35rem; font-weight: 700; color: var(--text-primary); line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kpi-label { font-size: 0.78rem; color: var(--text-secondary); margin-top: 2px; white-space: nowrap; }
.kpi-trend { font-size: 0.72rem; font-weight: 600; padding: 3px 8px; border-radius: 20px; white-space: nowrap; flex-shrink: 0; }
.kpi-trend.up { background: var(--green-light); color: var(--green); }
.kpi-trend.down { background: var(--red-light); color: var(--red); }
.kpi-trend.neutral { background: #f1f5f9; color: var(--text-secondary); }

/* ── Cards ───────────────────────────────────────────────────────────────── */
.card {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-sm);
    border: 1px solid var(--border-color);
    overflow: hidden;
}
.card-header {
    padding: 16px 20px;
    display: flex; align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border-color);
    flex-wrap: wrap; gap: 12px;
}
.card-header h3 { font-size: 1rem; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.card-body { padding: 16px 20px; overflow-x: auto; }
.card-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.link-btn { font-size: 0.82rem; color: var(--blue); font-weight: 500; }

/* ── Charts Row ──────────────────────────────────────────────────────────── */
.charts-row { display: grid; grid-template-columns: 1.6fr 1fr; gap: 16px; margin-bottom: 20px; }
.charts-row .wide { grid-column: span 1; }
.chart-card .card-body { padding: 16px; overflow: hidden; }

/* ── Two Column Layout ───────────────────────────────────────────────────── */
.two-col-layout { display: grid; grid-template-columns: 1fr 340px; gap: 16px; margin-bottom: 24px; }
.col-wide { min-width: 0; }
.col-narrow { min-width: 0; }

/* ── Data Tables ─────────────────────────────────────────────────────────── */
.data-table { width: 100%; border-collapse: collapse; font-size: 0.86rem; }
.data-table thead th {
    text-align: left; padding: 10px 12px;
    font-weight: 600; color: var(--text-secondary);
    font-size: 0.78rem; text-transform: uppercase;
    letter-spacing: 0.04em;
    background: #f8fafc;
    border-bottom: 1px solid var(--border-color);
    white-space: nowrap;
}
.data-table tbody td { padding: 10px 12px; border-bottom: 1px solid #f1f5f9; color: var(--text-primary); vertical-align: middle; }
.data-table tbody tr:hover { background: #f8fafc; }
.data-table tbody tr:last-child td { border-bottom: none; }
.data-table.compact tbody td { padding: 8px 12px; }
.fw-500 { font-weight: 500; }
.monospace { font-family: 'SF Mono', 'Fira Code', Consolas, monospace; font-size: 0.82rem; }
.text-green { color: var(--green); }
.text-red { color: var(--red); }
.text-muted { color: var(--text-muted); }

/* ── Status Badges ───────────────────────────────────────────────────────── */
.status-badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; text-transform: capitalize; white-space: nowrap; }
.status-badge.pending    { background: #fef3c7; color: #92400e; }
.status-badge.confirmed  { background: var(--blue-light); color: var(--blue); }
.status-badge.processing { background: var(--purple-light); color: var(--purple); }
.status-badge.shipped    { background: var(--teal-light); color: var(--teal); }
.status-badge.delivered  { background: var(--green-light); color: var(--green); }
.status-badge.cancelled  { background: #f1f5f9; color: var(--text-muted); }
.status-badge.active     { background: var(--green-light); color: var(--green); }
.status-badge.inactive   { background: #f1f5f9; color: var(--text-muted); }
.status-badge.on-leave   { background: var(--orange-light); color: var(--orange); }
.status-badge.draft      { background: #f1f5f9; color: var(--text-secondary); }
.status-badge.sent       { background: var(--blue-light); color: var(--blue); }
.status-badge.paid       { background: var(--green-light); color: var(--green); }
.status-badge.overdue    { background: var(--red-light); color: var(--red); }
.status-badge.approved   { background: var(--green-light); color: var(--green); }
.status-badge.rejected   { background: var(--red-light); color: var(--red); }
.status-badge.received   { background: var(--green-light); color: var(--green); }
.status-badge.partial    { background: var(--orange-light); color: var(--orange); }
.status-badge.discontinued { background: var(--red-light); color: var(--red); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
    display: inline-flex; align-items: center; gap: 6px;
    padding: 8px 16px; border-radius: var(--radius);
    font-size: 0.85rem; font-weight: 500;
    border: none; cursor: pointer; transition: var(--transition); white-space: nowrap;
}
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: #1d4ed8; }
.btn-outline { background: var(--bg-white); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-outline:hover { background: var(--bg-primary); }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-danger-outline { color: var(--red); border-color: #fecaca; }
.btn-danger-outline:hover { background: var(--red-light); border-color: #fca5a5; }
.fw-600 { font-weight: 600; }

.detail-toolbar {
    display: flex; align-items: center; justify-content: space-between;
    flex-wrap: wrap; gap: 12px; margin-bottom: 20px;
}
.detail-toolbar-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 20px; margin-bottom: 20px; }
.detail-dl { display: flex; flex-direction: column; gap: 12px; }
.detail-dl > div { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; border-bottom: 1px solid #f1f5f9; padding-bottom: 10px; }
.detail-dl > div:last-child { border-bottom: none; padding-bottom: 0; }
.detail-label { font-size: 0.8rem; color: var(--text-muted); flex-shrink: 0; }
.detail-value { text-align: right; font-size: 0.9rem; }
.detail-notes { font-size: 0.9rem; line-height: 1.5; color: var(--text-secondary); }
table.data-table[data-entity] tbody tr[data-id] { cursor: pointer; }
table.data-table[data-entity] tbody tr[data-id] .action-btns { cursor: default; }
.btn-secondary { background: var(--bg-primary); color: var(--text-primary); border: 1px solid var(--border-color); }
.btn-secondary:hover { background: #e2e8f0; }
.icon-btn {
    width: 30px; height: 30px;
    display: inline-flex; align-items: center; justify-content: center;
    border: none; background: none;
    color: var(--text-muted); cursor: pointer;
    border-radius: 6px; transition: var(--transition); font-size: 0.85rem;
}
.icon-btn:hover { background: var(--bg-primary); color: var(--blue); }
.action-btns { display: flex; gap: 2px; }

/* ── Filter Group ────────────────────────────────────────────────────────── */
.filter-group { display: flex; gap: 4px; flex-wrap: wrap; }
.filter-btn {
    padding: 5px 12px; border-radius: 20px;
    font-size: 0.78rem; font-weight: 500;
    color: var(--text-secondary); background: var(--bg-primary);
    text-decoration: none; transition: var(--transition); white-space: nowrap;
}
.filter-btn:hover { background: #e2e8f0; text-decoration: none; }
.filter-btn.active { background: var(--blue); color: #fff; }
.mini-select {
    padding: 5px 10px; border: 1px solid var(--border-color);
    border-radius: var(--radius); font-size: 0.8rem;
    color: var(--text-secondary); background: var(--bg-white);
    outline: none; cursor: pointer;
}

/* ── Category & Department Tags ──────────────────────────────────────────── */
.category-tag, .dept-tag { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 0.75rem; font-weight: 500; background: #f1f5f9; color: var(--text-secondary); white-space: nowrap; }

/* ── Activity Feed ───────────────────────────────────────────────────────── */
.activity-feed { display: flex; flex-direction: column; }
.activity-item { display: flex; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.activity-item:last-child { border-bottom: none; }
.activity-dot { width: 8px; height: 8px; background: var(--blue); border-radius: 50%; margin-top: 6px; flex-shrink: 0; }
.activity-text { font-size: 0.84rem; line-height: 1.4; }
.activity-meta { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.module-tag { padding: 1px 6px; background: var(--blue-light); color: var(--blue); border-radius: 3px; font-size: 0.7rem; font-weight: 600; }
.activity-time { font-size: 0.72rem; color: var(--text-muted); }

/* ── Employee Name ───────────────────────────────────────────────────────── */
.emp-name { display: flex; align-items: center; gap: 8px; }
.emp-avatar { width: 30px; height: 30px; background: linear-gradient(135deg, var(--blue), var(--purple)); border-radius: 50%; display: flex; align-items: center; justify-content: center; color: #fff; font-size: 0.65rem; font-weight: 600; flex-shrink: 0; }

/* ── Sidebar lists ───────────────────────────────────────────────────────── */
.po-list, .dept-list { display: flex; flex-direction: column; }
.po-item, .dept-item { padding: 12px 0; border-bottom: 1px solid #f1f5f9; }
.po-item:last-child, .dept-item:last-child { border-bottom: none; }
.po-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.po-details { display: flex; justify-content: space-between; font-size: 0.84rem; margin-bottom: 2px; }
.po-dates { font-size: 0.75rem; }
.dept-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 4px; }
.head-count { font-size: 0.8rem; color: var(--text-muted); }
.dept-budget { display: flex; justify-content: space-between; font-size: 0.84rem; margin-bottom: 6px; }
.budget-bar { height: 4px; background: #f1f5f9; border-radius: 2px; overflow: hidden; }
.budget-fill { height: 100%; background: linear-gradient(90deg, var(--blue), var(--teal)); border-radius: 2px; transition: width 0.6s ease; }

/* ── Top Customer List ───────────────────────────────────────────────────── */
.top-customer-list { display: flex; flex-direction: column; }
.top-customer-item { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid #f1f5f9; }
.top-customer-item:last-child { border-bottom: none; }
.tc-rank { width: 28px; height: 28px; background: var(--bg-primary); border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 700; font-size: 0.8rem; color: var(--text-secondary); flex-shrink: 0; }
.tc-info { flex: 1; min-width: 0; }
.tc-info .fw-500 { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tc-stats { font-size: 0.8rem; display: flex; gap: 4px; margin-top: 2px; }

/* ── Tabs ────────────────────────────────────────────────────────────────── */
.tabs-container { margin-bottom: 24px; }
.tab-buttons { display: flex; border-bottom: 2px solid var(--border-color); margin-bottom: 16px; }
.tab-btn { padding: 10px 20px; font-size: 0.9rem; font-weight: 500; border: none; background: none; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; transition: var(--transition); }
.tab-btn:hover { color: var(--text-primary); }
.tab-btn.active { color: var(--blue); border-bottom-color: var(--blue); }
.tab-content { display: none; }
.tab-content.active { display: block; }

/* ── Reports ─────────────────────────────────────────────────────────────── */
.report-actions-bar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.report-tabs { display: flex; gap: 4px; }
.report-tab { padding: 8px 16px; border-radius: var(--radius); font-size: 0.85rem; font-weight: 500; border: 1px solid var(--border-color); background: var(--bg-white); color: var(--text-secondary); cursor: pointer; transition: var(--transition); }
.report-tab:hover { border-color: var(--blue); color: var(--blue); }
.report-tab.active { background: var(--blue); color: #fff; border-color: var(--blue); }
.report-export { display: flex; gap: 8px; }
.report-panel { display: none; }
.report-panel.active { display: flex; flex-direction: column; gap: 16px; }

/* ── Utilization Bar ─────────────────────────────────────────────────────── */
.util-bar-container { display: flex; align-items: center; gap: 8px; }
.util-bar-container .util-bar { height: 6px; background: var(--blue); border-radius: 3px; min-width: 4px; max-width: 120px; flex-shrink: 0; }
.util-bar-container span { font-size: 0.8rem; font-weight: 500; color: var(--text-secondary); white-space: nowrap; }

/* ── Modal ────────────────────────────────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(4px);
}
.modal-overlay.show { display: flex; }
.modal-dialog {
    background: var(--bg-white);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 600px;
    max-height: 85vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 20px 60px rgba(0,0,0,0.15);
    animation: modalIn 0.2s ease;
}
@keyframes modalIn { from { transform: translateY(20px) scale(0.97); opacity: 0; } to { transform: none; opacity: 1; } }
.modal-header { padding: 20px 24px 16px; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--border-color); }
.modal-title { font-size: 1.15rem; font-weight: 700; }
.modal-close { background: none; border: none; font-size: 1.5rem; color: var(--text-muted); cursor: pointer; width: 36px; height: 36px; display: flex; align-items: center; justify-content: center; border-radius: var(--radius); transition: var(--transition); }
.modal-close:hover { background: var(--bg-primary); color: var(--text-primary); }
.modal-body { padding: 20px 24px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 16px 24px; border-top: 1px solid var(--border-color); display: flex; justify-content: flex-end; gap: 8px; }

/* ── Forms ────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-weight: 600; font-size: 0.82rem; margin-bottom: 5px; color: var(--text-primary); }
.form-input, .modal-body input, .modal-body select, .modal-body textarea {
    width: 100%;
    padding: 9px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 0.88rem;
    outline: none;
    transition: var(--transition);
    background: var(--bg-white);
    font-family: inherit;
}
.form-input:focus, .modal-body input:focus, .modal-body select:focus, .modal-body textarea:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px rgba(37,99,235,0.1);
}
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.form-actions-bar { margin-top: 16px; display: flex; justify-content: flex-end; gap: 8px; }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.detail-item { padding: 8px 0; }
.detail-label { font-size: 0.75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.04em; margin-bottom: 2px; }
.detail-value { font-size: 0.95rem; font-weight: 500; }
.detail-full { grid-column: span 2; }

/* ── Order items in modal ────────────────────────────────────────────────── */
.order-item-row { display: flex; gap: 8px; align-items: end; margin-bottom: 8px; }
.order-item-row select { flex: 2; }
.order-item-row input { flex: 1; }
.order-item-row .remove-item-btn { flex-shrink: 0; width: 32px; height: 36px; background: var(--red-light); color: var(--red); border: none; border-radius: var(--radius); cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; }
.order-item-row .remove-item-btn:hover { background: var(--red); color: #fff; }
.add-item-link { color: var(--blue); font-weight: 500; font-size: 0.85rem; cursor: pointer; display: inline-flex; align-items: center; gap: 4px; margin-top: 4px; }
.add-item-link:hover { text-decoration: underline; }

/* ── Toast ────────────────────────────────────────────────────────────────── */
#toastContainer { position: fixed; top: 80px; right: 28px; z-index: 2000; display: flex; flex-direction: column; gap: 8px; }
.toast {
    display: flex; align-items: center; gap: 10px;
    padding: 12px 18px;
    background: var(--bg-sidebar);
    color: #fff;
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    font-size: 0.88rem;
    animation: toastIn 0.3s ease, toastOut 0.3s ease 2.7s forwards;
    max-width: 380px;
}
.toast.success { border-left: 4px solid var(--green); }
.toast.error { border-left: 4px solid var(--red); }
.toast.info { border-left: 4px solid var(--blue); }
@keyframes toastIn { from { transform: translateX(100%); opacity: 0; } to { transform: none; opacity: 1; } }
@keyframes toastOut { to { transform: translateX(100%); opacity: 0; } }

/* ── Settings Page ───────────────────────────────────────────────────────── */
.settings-grid { display: flex; flex-direction: column; gap: 20px; }
.settings-form { max-width: 700px; }
.settings-toggle-list { display: flex; flex-direction: column; gap: 0; }
.settings-toggle {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; border-bottom: 1px solid #f1f5f9;
}
.settings-toggle:last-child { border-bottom: none; }
.settings-toggle p { font-size: 0.82rem; margin-top: 2px; }
.toggle { position: relative; display: inline-block; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
    position: absolute; inset: 0;
    background: #cbd5e1; border-radius: 24px;
    cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
    content: ''; position: absolute;
    width: 18px; height: 18px;
    border-radius: 50%; background: #fff;
    left: 3px; bottom: 3px;
    transition: var(--transition);
}
.toggle input:checked + .toggle-slider { background: var(--blue); }
.toggle input:checked + .toggle-slider::before { transform: translateX(20px); }
.sys-info-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; }
.sys-info-item { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid #f1f5f9; padding-right: 20px; }

/* ── Help Page ───────────────────────────────────────────────────────────── */
.help-grid { display: flex; flex-direction: column; gap: 20px; }
.help-hero { text-align: center; padding: 40px 0 20px; }
.help-hero i { font-size: 3rem; color: var(--blue); margin-bottom: 12px; }
.help-hero h2 { font-size: 1.5rem; margin-bottom: 16px; }
.help-search-box { position: relative; max-width: 480px; margin: 0 auto; }
.help-search-box i {
    position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
    color: var(--text-muted); font-size: 0.85rem; line-height: 1;
}
.help-search-box input { padding-left: 40px; }
.help-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.help-card {
    background: var(--bg-white); border: 1px solid var(--border-color);
    border-radius: var(--radius-lg); padding: 24px;
    text-align: center; cursor: pointer; transition: var(--transition);
}
.help-card:hover { box-shadow: var(--shadow-md); border-color: var(--blue); transform: translateY(-2px); }
.help-card i { font-size: 1.8rem; color: var(--blue); margin-bottom: 12px; }
.help-card h3 { font-size: 1rem; margin-bottom: 6px; }
.help-card p { font-size: 0.82rem; color: var(--text-secondary); line-height: 1.4; }
.faq-list { display: flex; flex-direction: column; }
.faq-item { border-bottom: 1px solid #f1f5f9; }
.faq-item:last-child { border-bottom: none; }
.faq-question {
    display: flex; justify-content: space-between; align-items: center;
    padding: 14px 0; cursor: pointer; font-weight: 500; font-size: 0.95rem;
}
.faq-question i { transition: var(--transition); color: var(--text-muted); }
.faq-item.open .faq-question i { transform: rotate(180deg); color: var(--blue); }
.faq-answer { display: none; padding: 0 0 14px; font-size: 0.88rem; color: var(--text-secondary); line-height: 1.6; }
.faq-item.open .faq-answer { display: block; }

/* ── Scrollbar ───────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ── Print ───────────────────────────────────────────────────────────────── */
@media print {
    .sidebar, .top-header, .filter-group, .card-actions, .action-btns, .kpi-trend, #toastContainer { display: none !important; }
    .main-content { margin-left: 0; }
    .content-body { padding: 0; }
    .card { box-shadow: none; border: 1px solid #ddd; break-inside: avoid; }
}

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 1200px) {
    .kpi-grid { grid-template-columns: repeat(2, 1fr); }
    .kpi-grid.five { grid-template-columns: repeat(3, 1fr); }
    .charts-row { grid-template-columns: 1fr; }
    .two-col-layout { grid-template-columns: 1fr; }
    .help-cards { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 768px) {
    .kpi-grid, .kpi-grid.five { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .detail-grid { grid-template-columns: 1fr; }
    .help-cards { grid-template-columns: 1fr; }
}
