/* ============================================================
   Contact Log Management System - Design System
   Theme: Navy Blue + White
   Font: Inter
   ============================================================ */

:root {
    /* Primary Navy */
    --primary:        #0B1F3A;
    --primary-dark:   #07162B;
    --primary-light:  #163A63;

    /* Backgrounds */
    --bg-page:        #F5F7FA;
    --bg-card:        #FFFFFF;
    --bg-sidebar:     #0B1F3A;
    --bg-sidebar-2:   #163A63;
    --bg-hover:       #F1F5F9;

    /* Text */
    --text-primary:   #172033;
    --text-secondary: #475569;
    --text-muted:     #6B7280;
    --text-inverse:   #FFFFFF;

    /* Border */
    --border:         #E2E8F0;
    --border-strong:  #CBD5E1;

    /* Status */
    --st-new:         #D97706;
    --st-progress:    #2563EB;
    --st-waiting:     #7C3AED;
    --st-followup:    #EA580C;
    --st-overdue:     #DC2626;
    --st-completed:   #16A34A;
    --st-closed:      #475569;

    /* Priority */
    --pr-low:         #16A34A;
    --pr-normal:      #2563EB;
    --pr-high:        #EA580C;
    --pr-urgent:      #DC2626;

    /* Misc */
    --radius:         8px;
    --radius-lg:      12px;
    --shadow-sm:      0 1px 2px rgba(15, 23, 42, 0.04);
    --shadow:         0 2px 8px rgba(15, 23, 42, 0.06);
    --shadow-lg:      0 10px 25px rgba(15, 23, 42, 0.10);
    --transition:     150ms cubic-bezier(.4,0,.2,1);

    /* Layout */
    --sidebar-w:      260px;
    --topbar-h:       64px;
}

/* ============== RESET ============== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-page);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
button { font-family: inherit; cursor: pointer; }
input, select, textarea { font-family: inherit; font-size: 14px; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-weight: 600; color: var(--text-primary); }
hr { border: 0; border-top: 1px solid var(--border); margin: 16px 0; }

/* ============== LAYOUT ============== */
.app-layout {
    display: flex;
    min-height: 100vh;
}
.main-wrap {
    flex: 1;
    margin-left: var(--sidebar-w);
    min-width: 0;
    display: flex;
    flex-direction: column;
}
.page-content {
    flex: 1;
    padding: 24px 28px;
    max-width: 1600px;
    width: 100%;
    margin: 0 auto;
}

/* ============== SIDEBAR ============== */
.sidebar {
    width: var(--sidebar-w);
    background: var(--bg-sidebar);
    color: #fff;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition);
}
.sidebar-header {
    padding: 20px 18px;
    border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 12px;
}
.sidebar-logo-mark {
    width: 40px; height: 40px;
    background: linear-gradient(135deg, #2563EB, #0B1F3A);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 14px;
    color: #fff;
    letter-spacing: .5px;
}
.sidebar-logo-title {
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 1.5px;
    color: #fff;
}
.sidebar-logo-sub {
    font-size: 11px;
    color: rgba(255,255,255,.55);
    margin-top: 2px;
}
.sidebar-nav {
    flex: 1;
    padding: 12px 0;
    overflow-y: auto;
}
.nav-item, .nav-subitem {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 18px;
    color: rgba(255,255,255,.75);
    font-size: 13.5px;
    font-weight: 500;
    transition: all var(--transition);
    border-left: 3px solid transparent;
    text-decoration: none;
}
.nav-item:hover, .nav-subitem:hover {
    background: rgba(255,255,255,.05);
    color: #fff;
    text-decoration: none;
}
.nav-item.active {
    background: var(--bg-sidebar-2);
    color: #fff;
    border-left-color: #2563EB;
}
.nav-subitem {
    padding-left: 38px;
    font-size: 13px;
    color: rgba(255,255,255,.6);
}
.nav-subitem.active { color: #fff; }
.nav-icon { font-size: 16px; width: 20px; text-align: center; }
.nav-divider {
    height: 1px;
    background: rgba(255,255,255,.08);
    margin: 12px 18px;
}
.nav-badge {
    margin-left: auto;
    background: #DC2626;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 7px;
    border-radius: 10px;
    min-width: 18px;
    text-align: center;
}

.sidebar-footer {
    border-top: 1px solid rgba(255,255,255,.08);
    padding: 14px 12px;
}
.user-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: 8px;
    background: rgba(255,255,255,.04);
    margin-bottom: 8px;
}
.user-avatar {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, #2563EB, #7C3AED);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: #fff;
}
.user-name {
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.user-role {
    font-size: 11px;
    color: rgba(255,255,255,.5);
}
.logout-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 12px;
    color: rgba(255,255,255,.6);
    font-size: 13px;
    border-radius: 6px;
    transition: var(--transition);
}
.logout-btn:hover { background: rgba(220,38,38,.15); color: #fff; text-decoration: none; }

/* ============== TOPBAR ============== */
.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.topbar-left {
    display: flex;
    align-items: center;
    gap: 16px;
    min-width: 0;
    flex: 1;
}
.hamburger {
    display: none;
    background: transparent;
    border: 0;
    font-size: 22px;
    color: var(--primary);
    padding: 6px 10px;
    border-radius: 6px;
}
.hamburger:hover { background: var(--bg-hover); }
.page-title-wrap { min-width: 0; }
.page-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}
.breadcrumbs {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}
.breadcrumbs a { color: var(--text-muted); }
.breadcrumbs a:hover { color: var(--primary); }
.bc-current { color: var(--text-primary); font-weight: 500; }
.bc-sep { margin: 0 6px; opacity: .6; }

.topbar-right {
    display: flex;
    align-items: center;
    gap: 12px;
}
.topbar-date {
    font-size: 12.5px;
    color: var(--text-muted);
}
.topbar-search {
    position: relative;
    width: 240px;
}
.topbar-search .ts-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 13px;
}
.topbar-search input {
    width: 100%;
    padding: 7px 12px 7px 32px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: var(--bg-page);
    outline: none;
    transition: var(--transition);
}
.topbar-search input:focus {
    border-color: var(--primary);
    background: #fff;
    box-shadow: 0 0 0 3px rgba(11, 31, 58, .08);
}
.topbar-icon {
    position: relative;
    width: 38px; height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    color: var(--text-secondary);
    font-size: 18px;
    transition: var(--transition);
}
.topbar-icon:hover { background: var(--bg-hover); color: var(--primary); text-decoration: none; }
.icon-badge {
    position: absolute;
    top: 4px; right: 4px;
    background: var(--st-overdue);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 1px 5px;
    border-radius: 10px;
    min-width: 16px;
    text-align: center;
}
.topbar-user {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 8px;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
}
.topbar-user:hover { background: var(--bg-hover); }
.tb-avatar {
    width: 32px; height: 32px;
    background: linear-gradient(135deg, #2563EB, #0B1F3A);
    color: #fff;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    font-size: 13px;
}
.tb-user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    line-height: 1.2;
}
.tb-user-role {
    font-size: 11px;
    color: var(--text-muted);
}
.user-dropdown {
    position: absolute;
    top: calc(var(--topbar-h) - 4px);
    right: 24px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 8px;
    box-shadow: var(--shadow-lg);
    min-width: 200px;
    padding: 6px;
    z-index: 200;
}
.user-dropdown a {
    display: block;
    padding: 8px 12px;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 6px;
}
.user-dropdown a:hover { background: var(--bg-hover); text-decoration: none; }
.user-dropdown hr { margin: 4px 0; }

/* ============== BUTTONS ============== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 16px;
    font-size: 13.5px;
    font-weight: 500;
    border-radius: 6px;
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    text-decoration: none;
    line-height: 1.2;
    white-space: nowrap;
}
.btn:hover { text-decoration: none; }
.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover { background: var(--primary-light); }
.btn-secondary {
    background: #fff;
    color: var(--text-primary);
    border-color: var(--border-strong);
}
.btn-secondary:hover { background: var(--bg-hover); }
.btn-danger {
    background: var(--st-overdue);
    color: #fff;
    border-color: var(--st-overdue);
}
.btn-danger:hover { background: #B91C1C; }
.btn-success {
    background: var(--st-completed);
    color: #fff;
    border-color: var(--st-completed);
}
.btn-ghost {
    background: transparent;
    color: var(--text-primary);
    border-color: transparent;
}
.btn-ghost:hover { background: var(--bg-hover); }
.btn-sm { padding: 5px 10px; font-size: 12.5px; }
.btn-lg { padding: 10px 20px; font-size: 14.5px; }
.btn-icon {
    width: 32px; height: 32px;
    padding: 0;
    border-radius: 6px;
}
.btn:disabled, .btn.disabled { opacity: .55; cursor: not-allowed; }

/* ============== CARDS ============== */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-sm);
}
.card-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}
.card-title {
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
}
.card-body { padding: 20px; }
.card-footer {
    padding: 12px 20px;
    border-top: 1px solid var(--border);
    background: #FAFBFC;
    border-radius: 0 0 var(--radius) var(--radius);
}

/* ============== KPI CARDS ============== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 16px;
    margin-bottom: 24px;
}
.kpi-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px 20px;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}
.kpi-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-label {
    font-size: 12px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    margin-bottom: 8px;
}
.kpi-value {
    font-size: 28px;
    font-weight: 700;
    color: var(--primary);
    line-height: 1.1;
}
.kpi-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}
.kpi-accent {
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 3px;
    background: var(--primary);
}
.kpi-card.danger .kpi-value { color: var(--st-overdue); }
.kpi-card.danger .kpi-accent { background: var(--st-overdue); }
.kpi-card.warning .kpi-value { color: var(--st-followup); }
.kpi-card.warning .kpi-accent { background: var(--st-followup); }
.kpi-card.success .kpi-value { color: var(--st-completed); }
.kpi-card.success .kpi-accent { background: var(--st-completed); }

/* ============== FORMS ============== */
.form-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 16px;
}
.form-grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}
.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full { grid-column: 1 / -1; }
.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 4px;
}
.form-label .required { color: var(--st-overdue); }
.form-label .help {
    color: var(--text-muted);
    font-size: 11px;
    font-weight: 400;
    margin-left: 4px;
}
.form-control {
    padding: 9px 12px;
    border: 1px solid var(--border-strong);
    border-radius: 6px;
    background: #fff;
    color: var(--text-primary);
    transition: var(--transition);
    outline: none;
    width: 100%;
}
.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(11, 31, 58, .08);
}
.form-control:disabled { background: var(--bg-page); cursor: not-allowed; }
.form-control.is-invalid { border-color: var(--st-overdue); }
textarea.form-control { resize: vertical; min-height: 80px; }
select.form-control { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%236B7280' d='M2 4l4 4 4-4z'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 10px center; padding-right: 32px; appearance: none; -webkit-appearance: none; }
.form-row { display: flex; gap: 10px; align-items: center; }
.form-actions {
    display: flex;
    gap: 10px;
    justify-content: flex-end;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    margin-top: 8px;
}
.form-error {
    color: var(--st-overdue);
    font-size: 12px;
    margin-top: 2px;
}
.form-hint {
    color: var(--text-muted);
    font-size: 12px;
    margin-top: 2px;
}

/* ============== TABLES ============== */
.table-wrap {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.data-table {
    width: 100%;
    border-collapse: collapse;
}
.data-table thead th {
    background: #F8FAFC;
    color: var(--text-secondary);
    font-size: 11.5px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    padding: 12px 14px;
    text-align: left;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
}
.data-table thead th.sortable { cursor: pointer; }
.data-table thead th.sortable:hover { background: #EEF2F7; }
.data-table tbody td {
    padding: 12px 14px;
    border-bottom: 1px solid var(--border);
    color: var(--text-primary);
    font-size: 13.5px;
    vertical-align: middle;
}
.data-table tbody tr:hover { background: #FAFBFC; }
.data-table tbody tr:last-child td { border-bottom: 0; }
.data-table tbody tr.row-overdue { background: rgba(220, 38, 38, .04); }
.data-table tbody tr.row-overdue:hover { background: rgba(220, 38, 38, .08); }

/* ============== BADGES ============== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    font-size: 11.5px;
    font-weight: 600;
    border-radius: 999px;
    background: #E5E7EB;
    color: var(--text-primary);
    line-height: 1.4;
    white-space: nowrap;
}
.badge-new          { background: #FEF3C7; color: #92400E; }
.badge-in_progress  { background: #DBEAFE; color: #1E40AF; }
.badge-waiting_customer { background: #EDE9FE; color: #5B21B6; }
.badge-follow_up    { background: #FFEDD5; color: #9A3412; }
.badge-completed    { background: #DCFCE7; color: #166534; }
.badge-closed       { background: #E2E8F0; color: #334155; }
.badge-overdue      { background: #FEE2E2; color: #991B1B; }
.badge-low    { background: #DCFCE7; color: #166534; }
.badge-normal { background: #DBEAFE; color: #1E40AF; }
.badge-high   { background: #FFEDD5; color: #9A3412; }
.badge-urgent { background: #FEE2E2; color: #991B1B; }
.badge-active { background: #DCFCE7; color: #166534; }
.badge-inactive { background: #F1F5F9; color: #475569; }

/* ============== ALERTS ============== */
.alert {
    padding: 12px 16px;
    border-radius: 6px;
    border: 1px solid;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13.5px;
    margin-bottom: 16px;
}
.alert-info     { background: #DBEAFE; color: #1E40AF; border-color: #93C5FD; }
.alert-success  { background: #DCFCE7; color: #166534; border-color: #86EFAC; }
.alert-warning  { background: #FFEDD5; color: #9A3412; border-color: #FDBA74; }
.alert-danger   { background: #FEE2E2; color: #991B1B; border-color: #FCA5A5; }
.alert .alert-icon { font-size: 16px; line-height: 1; }

/* ============== TOAST ============== */
.toast-container {
    position: fixed;
    top: 16px;
    right: 16px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}
.toast {
    background: #fff;
    border: 1px solid var(--border);
    border-left: 4px solid var(--primary);
    border-radius: 6px;
    padding: 12px 16px;
    min-width: 280px;
    max-width: 400px;
    box-shadow: var(--shadow-lg);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    pointer-events: all;
    animation: slideIn .25s ease-out;
}
.toast.success { border-left-color: var(--st-completed); }
.toast.error   { border-left-color: var(--st-overdue); }
.toast.warning { border-left-color: var(--st-followup); }
.toast-icon { font-size: 18px; line-height: 1; }
.toast-content { flex: 1; }
.toast-title { font-weight: 600; font-size: 13.5px; color: var(--text-primary); }
.toast-message { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; }
.toast-close { background: none; border: 0; color: var(--text-muted); cursor: pointer; font-size: 16px; }
@keyframes slideIn { from { transform: translateX(20px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* ============== MODAL ============== */
.modal-container {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
/* Important: HTML hidden attr must always hide the modal, even with display:flex */
[hidden] { display: none !important; }
.modal-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, .55);
    backdrop-filter: blur(2px);
}
.modal-dialog {
    position: relative;
    background: #fff;
    border-radius: var(--radius-lg);
    width: 100%;
    max-width: 540px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    box-shadow: var(--shadow-lg);
    animation: modalIn .2s ease-out;
}
.modal-dialog.modal-lg { max-width: 800px; }
.modal-dialog.modal-xl { max-width: 1100px; }
@keyframes modalIn { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-header {
    padding: 16px 20px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.modal-title { font-size: 15.5px; font-weight: 600; color: var(--text-primary); }
.modal-close {
    background: transparent; border: 0;
    color: var(--text-muted);
    font-size: 24px;
    width: 30px; height: 30px;
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
}
.modal-close:hover { background: var(--bg-hover); color: var(--text-primary); }
.modal-body { padding: 20px; overflow-y: auto; flex: 1; }
.modal-footer { padding: 14px 20px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; }

/* ============== PAGINATION ============== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 16px;
    border-top: 1px solid var(--border);
    background: #FAFBFC;
    flex-wrap: wrap;
    gap: 12px;
}
.pagination-info { font-size: 12.5px; color: var(--text-muted); }
.pagination-controls { display: flex; gap: 4px; }
.page-btn {
    min-width: 32px;
    height: 32px;
    padding: 0 8px;
    border: 1px solid var(--border);
    background: #fff;
    border-radius: 6px;
    font-size: 12.5px;
    color: var(--text-primary);
    cursor: pointer;
    transition: var(--transition);
}
.page-btn:hover:not(:disabled) { background: var(--bg-hover); }
.page-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.page-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ============== EMPTY STATE ============== */
.empty-state {
    padding: 60px 20px;
    text-align: center;
    color: var(--text-muted);
}
.empty-icon { font-size: 48px; margin-bottom: 12px; opacity: .4; }
.empty-title { font-size: 15px; font-weight: 600; color: var(--text-secondary); margin-bottom: 6px; }
.empty-msg { font-size: 13px; margin-bottom: 16px; }

/* ============== SKELETON ============== */
.skeleton {
    background: linear-gradient(90deg, #E5E7EB 25%, #F3F4F6 50%, #E5E7EB 75%);
    background-size: 200% 100%;
    animation: shimmer 1.5s infinite;
    border-radius: 4px;
}
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ============== DROPDOWN ============== */
.dropdown { position: relative; display: inline-block; }
.dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    background: #fff;
    border: 1px solid var(--border);
    border-radius: 6px;
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 200;
    padding: 4px;
}
.dropdown-item {
    display: block;
    padding: 7px 12px;
    color: var(--text-primary);
    font-size: 13px;
    border-radius: 4px;
    cursor: pointer;
}
.dropdown-item:hover { background: var(--bg-hover); text-decoration: none; }
.dropdown-divider { border-top: 1px solid var(--border); margin: 4px 0; }

/* ============== UTILITIES ============== */
.flex { display: flex; }
.flex-1 { flex: 1; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.gap-2 { gap: 8px; } .gap-3 { gap: 12px; } .gap-4 { gap: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12.5px; }
.text-xs { font-size: 11.5px; }
.text-lg { font-size: 16px; }
.text-xl { font-size: 18px; }
.font-bold { font-weight: 600; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; } .mb-5 { margin-bottom: 20px; } .mb-6 { margin-bottom: 24px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.hidden { display: none !important; }
.divider { height: 1px; background: var(--border); margin: 16px 0; }

/* Page header */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin-bottom: 20px;
}
.page-header-title { font-size: 22px; font-weight: 600; color: var(--text-primary); }
.page-header-sub { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Filter bar */
.filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
    padding: 12px 16px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.filter-bar .form-group { min-width: 160px; }
.filter-bar .form-control { padding: 7px 10px; font-size: 13px; }

/* ============== RESPONSIVE ============== */
/* =================== FORM GRID 2 =================== */
.form-grid-2 { display:grid; grid-template-columns:repeat(2, 1fr); gap:16px; }

@media (max-width: 1024px) {
    .form-grid { grid-template-columns: 1fr; }
    .form-grid-3 { grid-template-columns: 1fr 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
    :root { --sidebar-w: 260px; }
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 4px 0 20px rgba(0,0,0,.3); }
    .main-wrap { margin-left: 0; }
    .hamburger { display: inline-flex; }
    .topbar-date { display: none; }
    .topbar-search { width: 160px; }
    .tb-user-info { display: none; }
    .page-content { padding: 16px; padding-bottom: 80px; }
    .bottom-nav { display: block; }
    .form-grid-3 { grid-template-columns: 1fr; }
    .form-grid-2 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: 1fr 1fr; }
    .kpi-value { font-size: 22px; }
    .data-table { font-size: 12.5px; }
    .data-table thead th, .data-table tbody td { padding: 8px 10px; }
    .page-header { flex-direction: column; gap: 12px; align-items: flex-start; }
    .filter-bar { flex-direction: column; }
    .filter-bar .form-group { width: 100%; }
    .report-tabs { padding: 0 8px; }
    .report-tab { padding: 10px 14px; font-size: .8rem; }
    .user-dropdown { right: 8px; }
    .card { margin-bottom: 16px; }
}
@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr; }
    .topbar-search { display: none; }
    .page-content { padding: 12px; padding-bottom: 80px; }
}

/* ============== SCROLLBARS ============== */
/* =================== NOTIFICATIONS =================== */
.notif-item { display:flex; align-items:flex-start; gap:12px; padding:14px 16px; border-bottom:1px solid var(--border); cursor:pointer; transition:background .15s; }
.notif-item:hover { background:var(--bg-secondary); }
.notif-item.notif-unread { background:rgba(26,86,219,.04); border-left:3px solid var(--primary); }
.notif-item.notif-read { opacity:.7; }
.notif-icon { width:36px; height:36px; border-radius:50%; display:flex; align-items:center; justify-content:center; font-size:16px; flex-shrink:0; }
.notif-icon.primary { background:rgba(26,86,219,.1); }
.notif-icon.warning { background:rgba(245,158,11,.1); }
.notif-icon.danger { background:rgba(220,38,38,.1); }
.notif-icon.info { background:rgba(14,165,233,.1); }
.notif-body { flex:1; min-width:0; }
.notif-title { font-weight:600; font-size:.875rem; margin-bottom:2px; }
.notif-msg { font-size:.8rem; color:var(--text-secondary); line-height:1.4; }
.notif-time { margin-top:4px; }

/* =================== REPORT TABS =================== */
.report-tabs { display:flex; gap:0; overflow-x:auto; padding:0 16px; }
.report-tab { padding:12px 20px; font-size:.875rem; font-weight:500; color:var(--text-secondary); background:none; border:none; border-bottom:2px solid transparent; cursor:pointer; transition:all .2s; white-space:nowrap; }
.report-tab:hover { color:var(--text-primary); background:var(--bg-secondary); }
.report-tab.active { color:var(--primary); border-bottom-color:var(--primary); font-weight:600; }

/* =================== PROGRESS BAR =================== */
.progress-bar-wrap { display:flex; align-items:center; gap:8px; }
.progress-bar-wrap .progress-bar { height:6px; background:var(--success); border-radius:3px; transition:width .3s; }
.progress-bar-wrap { position:relative; flex:1; }
.progress-bar-wrap::before { content:''; position:absolute; top:0; left:0; right:0; height:6px; background:var(--bg-secondary); border-radius:3px; z-index:0; }
.progress-bar-wrap .progress-bar { position:relative; z-index:1; }
.progress-bar-wrap span { position:relative; z-index:1; font-size:.75rem; font-weight:600; white-space:nowrap; }

/* =================== COLOR DOT =================== */
.color-dot { display:inline-block; width:10px; height:10px; border-radius:50%; margin-right:6px; vertical-align:middle; }

/* =================== MOBILE BOTTOM NAV =================== */
.bottom-nav { display:none; position:fixed; bottom:0; left:0; right:0; background:var(--bg-card); border-top:1px solid var(--border); z-index:100; padding:4px 0 env(safe-area-inset-bottom, 4px); }
.bottom-nav-inner { display:flex; justify-content:space-around; }
.bottom-nav a { display:flex; flex-direction:column; align-items:center; padding:6px 4px; text-decoration:none; color:var(--text-secondary); font-size:.65rem; gap:2px; }
.bottom-nav a.active { color:var(--primary); }
.bottom-nav a .bnav-icon { font-size:1.25rem; }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(15, 23, 42, .15); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(15, 23, 42, .3); }
