:root {
    --bg-color: #f0f2f5;
    --surface-color: #ffffff;
    --surface-hover: #f5f8ff;
    --text-primary: #1a1a2e;
    --text-secondary: #5a5f7a;
    --text-muted: #8e92a4;
    --primary: #0d7c66;
    --primary-light: #e8f5f0;
    --primary-hover: #096b57;
    --primary-gradient: linear-gradient(135deg, #0d7c66 0%, #2a9d6e 100%);
    --success: #22c55e;
    --success-light: #f0fdf4;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --danger-light: #fef2f2;
    --danger-hover: #dc2626;
    --warning: #f59e0b;
    --warning-light: #fffbeb;
    --info: #3b82f6;
    --info-light: #eff6ff;
    --border-color: #e5e7eb;
    --border-light: #f3f4f6;
    --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 -1px rgba(0,0,0,0.04);
    --shadow-lg: 0 10px 25px -5px rgba(0,0,0,0.1), 0 8px 10px -6px rgba(0,0,0,0.05);
    --sidebar-bg: #0a2e24;
    --sidebar-text: #94a3b8;
    --sidebar-active: #ffffff;
    --sidebar-hover: rgba(255,255,255,0.06);
    --sidebar-width: 250px;
    --topbar-height: 60px;
    --radius: 8px;
    --radius-lg: 12px;

    --font-heading: 'Kanit', sans-serif;
    --font-body: 'Kanit', 'Inter', sans-serif;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    background-color: var(--bg-color);
    color: var(--text-primary);
    font-family: var(--font-body);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
    display: flex;
    height: 100vh;
    overflow: hidden;
}

/* Typography */
h1, h2, h3, h4, h5, h6 {
    font-family: var(--font-heading);
    color: var(--text-primary);
    margin-bottom: 0.5rem;
    font-weight: 500;
}

/* ==================== */
/* FORM ELEMENTS        */
/* ==================== */
input, select, textarea {
    width: 100%;
    padding: 10px 14px;
    background-color: #fff;
    border: 1.5px solid var(--border-color);
    color: var(--text-primary);
    border-radius: var(--radius);
    font-family: inherit;
    font-size: 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(40, 152, 203, 0.12);
}

label {
    display: block;
    margin-bottom: 6px;
    font-weight: 400;
    font-size: 13px;
    color: var(--text-secondary);
}

/* ==================== */
/* BUTTONS              */
/* ==================== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 9px 18px;
    font-size: 13px;
    font-weight: 500;
    border-radius: var(--radius);
    border: 1.5px solid transparent;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: inherit;
    gap: 6px;
    white-space: nowrap;
}

.btn-sm {
    padding: 5px 12px;
    font-size: 12px;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #ffffff;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(13,124,102,0.3);
}
.btn-primary:hover {
    background: linear-gradient(135deg, #096b57 0%, #1e8c5e 100%);
    box-shadow: 0 4px 8px rgba(13,124,102,0.4);
    transform: translateY(-1px);
}

.btn-success {
    background: linear-gradient(135deg, #22c55e 0%, #16a34a 100%);
    color: #ffffff;
    box-shadow: 0 2px 4px rgba(34,197,94,0.3);
}
.btn-success:hover {
    background: linear-gradient(135deg, #16a34a 0%, #15803d 100%);
    transform: translateY(-1px);
}

.btn-danger {
    background-color: transparent;
    color: var(--danger);
    border-color: var(--danger);
}
.btn-danger:hover { background-color: var(--danger-light); }

.btn-outline {
    background-color: transparent;
    border-color: var(--border-color);
    color: var(--text-secondary);
}
.btn-outline:hover {
    background-color: var(--surface-hover);
    border-color: var(--primary);
    color: var(--primary);
}

.btn-create {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 10px 24px;
    font-size: 14px;
    border-radius: var(--radius);
    box-shadow: 0 2px 4px rgba(13,124,102,0.3);
}
.btn-create:hover {
    background: linear-gradient(135deg, #096b57 0%, #1e8c5e 100%);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(13,124,102,0.4);
}

/* ==================== */
/* LAYOUT               */
/* ==================== */
.app-container {
    display: flex;
    width: 100%;
    height: 100%;
}

/* ==================== */
/* SIDEBAR - Dark Style */
/* ==================== */
.sidebar {
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    transition: transform 0.3s ease;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.1); border-radius: 4px; }

.sidebar-header {
    padding: 20px 20px 16px;
    display: flex;
    align-items: center;
    gap: 12px;
    border-bottom: 1px solid rgba(255,255,255,0.06);
}

.sidebar-header .logo-icon {
    width: 36px;
    height: 36px;
    background: var(--primary-gradient);
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 17px;
    box-shadow: 0 2px 8px rgba(13,124,102,0.4);
}

.sidebar-header h2 {
    font-size: 17px;
    font-weight: 600;
    color: #fff;
    margin: 0;
    letter-spacing: -0.2px;
}

.sidebar-section {
    padding: 2px 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.sidebar-section-title {
    padding: 10px 20px 10px;
    font-size: 11px;
    font-weight: 600;
    color: rgba(200,210,220,0.85);
    letter-spacing: 0.3px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: space-between;
    transition: all 0.15s;
    user-select: none;
}

.sidebar-section-title:hover {
    color: #fff;
    background: rgba(255,255,255,0.04);
}

.sidebar-section-title .section-icon {
    width: 20px;
    text-align: center;
    margin-right: 8px;
    font-size: 12px;
    color: rgba(148,163,184,0.7);
}

.sidebar-section-title .section-label {
    flex: 1;
}

.sidebar-section-title .chevron {
    font-size: 10px;
    transition: transform 0.25s ease;
    color: rgba(148,163,184,0.4);
}

.sidebar-section.collapsed .chevron {
    transform: rotate(-90deg);
}

.sidebar-section .section-links {
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.3s ease, opacity 0.2s ease;
    opacity: 1;
}

.sidebar-section.collapsed .section-links {
    max-height: 0;
    opacity: 0;
}

.section-links .nav-link {
    padding-left: 48px;
}

/* Active section highlight */
.sidebar-section-title.has-active {
    color: var(--primary);
}

.sidebar-section-title.has-active .section-icon {
    color: var(--primary);
}

/* Section badge count */
.sidebar-section-title .section-badge {
    background: var(--primary);
    color: #fff;
    font-size: 9px;
    padding: 1px 6px;
    border-radius: 10px;
    margin-right: 6px;
    font-weight: 700;
    min-width: 16px;
    text-align: center;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    flex: 1;
}

.nav-link {
    display: flex;
    align-items: center;
    padding: 9px 20px;
    color: var(--sidebar-text);
    text-decoration: none;
    font-size: 13px;
    font-weight: 400;
    transition: all 0.15s;
    gap: 12px;
    border-left: 3px solid transparent;
    margin: 1px 0;
}

.nav-link i {
    width: 18px;
    text-align: center;
    font-size: 14px;
    opacity: 0.7;
}

.nav-link:hover {
    background-color: var(--sidebar-hover);
    color: #fff;
}
.nav-link:hover i {
    opacity: 1;
}

.nav-link.active {
    background-color: rgba(13,124,102,0.15);
    color: #fff;
    border-left-color: var(--primary);
    font-weight: 500;
}
.nav-link.active i {
    opacity: 1;
    color: var(--primary);
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 20px;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.sidebar-footer .btn {
    width: 100%;
    justify-content: center;
    background: transparent;
    border: 1px solid rgba(255,255,255,0.15);
    color: var(--sidebar-text);
    font-size: 13px;
}
.sidebar-footer .btn:hover {
    background: rgba(255,255,255,0.06);
    color: #fff;
    border-color: rgba(255,255,255,0.3);
}

/* ==================== */
/* MAIN CONTENT         */
/* ==================== */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    position: relative;
    background: var(--bg-color);
}

.topbar {
    height: var(--topbar-height);
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 28px;
    background-color: #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.topbar h3 {
    font-size: 17px;
    font-weight: 500;
    margin: 0;
    color: var(--text-primary);
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-company-info {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12.5px;
    color: #64748b;
    padding-right: 8px;
    border-right: 1px solid #e2e8f0;
    margin-right: 4px;
}
.topbar-tenant-name {
    font-weight: 500;
    color: #334155;
    max-width: 220px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.topbar-tenant-name i {
    color: #94a3b8;
    margin-right: 4px;
    font-size: 11px;
}
.topbar-divider {
    color: #cbd5e1;
    font-weight: 300;
}
.topbar-customer-code {
    font-size: 11.5px;
    color: #64748b;
    background: #f1f5f9;
    padding: 2px 10px;
    border-radius: 4px;
    border: 1px solid #e2e8f0;
    font-weight: 500;
    white-space: nowrap;
}

.user-profile {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: var(--radius);
    transition: background 0.15s;
}
.user-profile:hover {
    background: var(--bg-color);
}

.user-avatar {
    width: 34px;
    height: 34px;
    background: var(--primary-gradient);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 600;
    color: white;
    font-size: 14px;
    box-shadow: 0 2px 4px rgba(13,124,102,0.3);
}

.page-content {
    flex: 1;
    padding: 28px 32px;
    overflow-y: auto;
    background: var(--bg-color);
}

/* ==================== */
/* VIEW SECTIONS        */
/* ==================== */
.view-section {
    animation: viewFadeIn 0.3s ease;
}
@keyframes viewFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ==================== */
/* PAGE HEADER          */
/* ==================== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
    gap: 16px;
    flex-wrap: wrap;
}
.page-header h2 {
    font-size: 20px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    color: var(--text-primary);
}
.page-header h2 i {
    font-size: 22px;
}
.page-header p {
    margin: 4px 0 0 0;
    font-size: 13px;
    color: var(--text-muted);
}
.page-header .btn,
.page-header .flex {
    flex-shrink: 0;
}

/* ==================== */
/* CARDS                */
/* ==================== */
.card {
    background-color: var(--surface-color);
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow-sm);
    transition: box-shadow 0.2s;
}

/* Dashboard Stat Cards */
.stat-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow-sm);
    position: relative;
    overflow: hidden;
    transition: transform 0.2s, box-shadow 0.2s;
}
.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
}
.stat-card:nth-child(1)::before { background: var(--primary-gradient); }
.stat-card:nth-child(2)::before { background: linear-gradient(90deg, #ef4444, #f97316); }
.stat-card:nth-child(3)::before { background: linear-gradient(90deg, #22c55e, #10b981); }
.stat-card:nth-child(4)::before { background: linear-gradient(90deg, #8b5cf6, #6366f1); }

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 8px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 600;
    margin: 0;
    letter-spacing: -0.5px;
}

.stat-card .stat-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
}

/* Dashboard icon */
.stat-icon {
    width: 42px; height: 42px; border-radius: 12px;
    display: flex; align-items: center; justify-content: center;
    font-size: 18px; margin-bottom: 12px;
}

/* Dashboard grid layouts */
.dash-grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1rem; }
.dash-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
@media (max-width: 1100px) { .dash-grid-4 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 768px) { .dash-grid-4, .dash-grid-2 { grid-template-columns: 1fr; } }

/* Dashboard cards */
.dash-card-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 16px;
}
.dash-card-header h3 {
    font-size: 14px; font-weight: 600; margin: 0;
    display: flex; align-items: center; gap: 8px;
}
.dash-chart-card { min-height: 280px; }
.dash-chart-wrap { position: relative; height: 220px; }

/* Dashboard list items */
.dash-list-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 12px; border-radius: 8px; margin-bottom: 4px;
    transition: background 0.15s;
}
.dash-list-item:hover { background: var(--primary-light); }
.dash-list-item .dash-item-title { font-size: 13px; font-weight: 500; }
.dash-list-item .dash-item-sub { font-size: 11px; color: var(--text-muted); }
.dash-list-item .dash-item-amount { font-size: 14px; font-weight: 600; text-align: right; }

/* Top customer bar */
.dash-bar-wrap { margin-bottom: 10px; }
.dash-bar-label { display: flex; justify-content: space-between; font-size: 13px; margin-bottom: 4px; }
.dash-bar { height: 8px; border-radius: 4px; background: #e5e7eb; overflow: hidden; }
.dash-bar-fill { height: 100%; border-radius: 4px; background: var(--primary-gradient); transition: width 0.6s ease; }

/* ==================== */
/* TABLES               */
/* ==================== */
.table-container {
    overflow-x: auto;
    width: 100%;
    border-radius: var(--radius);
}

table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
}

th {
    padding: 12px 16px;
    font-weight: 500;
    color: var(--text-secondary);
    font-size: 12px;
    background: #f8fafc;
    border-bottom: 2px solid var(--border-color);
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

td {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    font-size: 13px;
    color: var(--text-primary);
    transition: background 0.1s;
}

tr:hover td {
    background-color: #f8fafc;
}

tr:last-child td {
    border-bottom: none;
}

/* Empty table state */
.empty-state, tbody tr td[colspan] {
    text-align: center;
    color: var(--text-muted);
    padding: 48px 20px !important;
    font-size: 14px;
}
.empty-state i, tbody tr td[colspan] i {
    display: block;
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.25;
    color: var(--text-muted);
}
.empty-state p {
    margin: 0;
    font-size: 14px;
}

/* Checkbox in table */
.row-checkbox {
    width: 16px;
    height: 16px;
    cursor: pointer;
    accent-color: var(--primary);
}

/* Document number link */
.doc-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 500;
}
.doc-link:hover {
    text-decoration: underline;
    color: var(--primary-hover);
}

/* ==================== */
/* STATUS BADGES        */
/* ==================== */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
    gap: 4px;
}

.badge-draft { background-color: #f1f5f9; color: #64748b; }
.badge-pending { background-color: #fef3c7; color: #d97706; }
.badge-approved { background-color: #dcfce7; color: #16a34a; }
.badge-processing { background-color: #dbeafe; color: #2563eb; }
.badge-completed { background-color: #dcfce7; color: #16a34a; }
.badge-cancelled { background-color: #fee2e2; color: #dc2626; }
.badge-success { background-color: #dcfce7; color: #16a34a; }
.badge-secondary { background-color: #f1f5f9; color: #64748b; }

/* Status Select */
.status-select {
    padding: 5px 10px;
    font-size: 12px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    background: #fff;
    color: var(--text-primary);
    width: auto;
    min-width: 110px;
    cursor: pointer;
}

/* ==================== */
/* ACTION BUTTONS       */
/* ==================== */
.action-menu-btn {
    width: 30px;
    height: 30px;
    border-radius: var(--radius);
    border: 1px solid var(--border-color);
    background: #fff;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all 0.15s;
}
.action-menu-btn:hover {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.action-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ==================== */
/* TAB BAR              */
/* ==================== */
.tab-bar {
    display: flex;
    align-items: center;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 2px solid var(--border-color);
}

.tab-item {
    padding: 10px 24px;
    font-size: 13px;
    color: var(--text-muted);
    border: none;
    border-bottom: 2px solid transparent;
    background: transparent;
    cursor: pointer;
    transition: all 0.15s;
    font-family: inherit;
    font-weight: 500;
    margin-bottom: -2px;
}

.tab-item:hover {
    color: var(--primary);
}

.tab-item.active {
    color: var(--primary);
    border-bottom-color: var(--primary);
}

/* ==================== */
/* PAGINATION           */
/* ==================== */
.pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 0;
    font-size: 13px;
    color: var(--text-secondary);
}

.pagination-controls {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    width: 34px;
    height: 34px;
    border: 1px solid var(--border-color);
    background: #fff;
    border-radius: var(--radius);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    color: var(--text-secondary);
    font-family: inherit;
    transition: all 0.15s;
}

.page-btn:hover:not(.active):not(:disabled) {
    background: var(--primary-light);
    border-color: var(--primary);
    color: var(--primary);
}

.page-btn.active {
    background: var(--primary-gradient);
    color: #fff;
    border-color: transparent;
    box-shadow: 0 2px 4px rgba(13,124,102,0.3);
}

.page-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.per-page-select {
    width: auto;
    padding: 5px 10px;
    font-size: 13px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
}

/* ==================== */
/* SEARCH BAR           */
/* ==================== */
.search-bar {
    display: flex;
    align-items: center;
    gap: 8px;
}

.search-input {
    width: 260px;
    padding: 9px 14px 9px 36px;
    border: 1.5px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%238e92a4' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85zm-5.242.656a5 5 0 1 1 0-10 5 5 0 0 1 0 10z'/%3E%3C/svg%3E") 12px center no-repeat;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.search-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(13,124,102,0.1);
}

/* Filter bar */
.filter-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    gap: 12px;
    flex-wrap: wrap;
}

/* Card with no padding (table-only cards) */
.card-flush {
    padding: 0;
    overflow: hidden;
}
.card-flush .card-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
}
.card-flush .card-header h3 {
    margin: 0;
    font-size: 16px;
    font-weight: 600;
}
.card-flush .card-body {
    padding: 20px 24px;
}

/* ==================== */
/* MODALS               */
/* ==================== */
.modal-backdrop {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(10, 15, 30, 0.45);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.modal-backdrop.show {
    opacity: 1;
    pointer-events: auto;
}

.modal {
    background-color: #fff;
    border: none;
    border-radius: 16px;
    width: 92%;
    max-width: 620px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.2), 0 0 0 1px rgba(0, 0, 0, 0.04);
    transform: translateY(24px) scale(0.96);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-backdrop.show .modal {
    transform: translateY(0) scale(1);
}

/* Side Panel variant — slides in from right, full height */
.modal-backdrop.side-panel {
    justify-content: flex-end;
    align-items: stretch;
    background-color: rgba(10, 15, 30, 0.3);
    backdrop-filter: blur(4px);
}
.modal-backdrop.side-panel .modal {
    border-radius: 0;
    max-width: none;
    width: calc(100% - var(--sidebar-width, 250px));
    min-width: 480px;
    max-height: 100vh;
    height: 100%;
    margin: 0;
    transform: translateX(100%);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -8px 0 30px rgba(0,0,0,0.12);
    display: flex;
    flex-direction: column;
}
.modal-backdrop.side-panel.show .modal {
    transform: translateX(0);
}
.modal-backdrop.side-panel .modal-header {
    border-radius: 0;
    padding: 16px 24px;
    flex-shrink: 0;
}
.modal-backdrop.side-panel .modal-body {
    padding: 20px 24px;
    overflow-y: auto;
    flex: 1;
}
.modal-backdrop.side-panel .modal-footer {
    border-radius: 0;
    flex-shrink: 0;
}
@media (max-width: 768px) {
    .modal-backdrop.side-panel .modal {
        width: 100%;
        min-width: unset;
    }
}

/* Custom scrollbar for modals */
.modal::-webkit-scrollbar { width: 6px; }
.modal::-webkit-scrollbar-track { background: transparent; }
.modal::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
.modal::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

.modal-header {
    padding: 22px 28px 18px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
    border-radius: 16px 16px 0 0;
}

.modal-header h3 {
    margin: 0;
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.modal-body {
    padding: 24px 28px;
}

.modal-footer {
    padding: 16px 28px 20px;
    border-top: 1px solid var(--border-light);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: #fff;
    z-index: 2;
    border-radius: 0 0 16px 16px;
}

/* Close button in modal header */
.modal-close-btn {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    border: none;
    background: var(--bg-color);
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    transition: all 0.2s;
}
.modal-close-btn:hover {
    background: var(--danger-light);
    color: var(--danger);
    transform: rotate(90deg);
}

/* ==================== */
/* CUSTOM CONFIRM DIALOG */
/* ==================== */
#custom-confirm-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background-color: rgba(10, 15, 30, 0.5);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9998;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}
#custom-confirm-overlay.show {
    opacity: 1;
    pointer-events: auto;
}
.confirm-dialog {
    background: #fff;
    border-radius: 20px;
    width: 90%;
    max-width: 400px;
    padding: 32px;
    text-align: center;
    box-shadow: 0 25px 60px -12px rgba(0, 0, 0, 0.25);
    transform: scale(0.9) translateY(20px);
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}
#custom-confirm-overlay.show .confirm-dialog {
    transform: scale(1) translateY(0);
}
.confirm-icon {
    width: 64px;
    height: 64px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
}
.confirm-icon.warning {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
    color: #d97706;
}
.confirm-icon.danger {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
    color: #dc2626;
}
.confirm-icon.info {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    color: #2563eb;
}
.confirm-icon.success {
    background: linear-gradient(135deg, #d1fae5, #a7f3d0);
    color: #059669;
}
.confirm-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}
.confirm-message {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 28px;
}
.confirm-actions {
    display: flex;
    gap: 12px;
    justify-content: center;
}
.confirm-actions .btn {
    min-width: 110px;
    padding: 10px 20px;
    border-radius: 10px;
    font-weight: 500;
    font-size: 14px;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.confirm-actions .btn-cancel {
    background: var(--bg-color);
    color: var(--text-secondary);
    border: 1px solid var(--border-color);
}
.confirm-actions .btn-cancel:hover {
    background: #e5e7eb;
}
.confirm-actions .btn-confirm {
    background: var(--danger);
    color: #fff;
    box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
}
.confirm-actions .btn-confirm:hover {
    background: var(--danger-hover);
    transform: translateY(-1px);
    box-shadow: 0 6px 16px rgba(239, 68, 68, 0.35);
}
.confirm-actions .btn-confirm.primary {
    background: var(--primary);
    box-shadow: 0 4px 12px rgba(13, 124, 102, 0.3);
}
.confirm-actions .btn-confirm.primary:hover {
    background: var(--primary-hover);
    box-shadow: 0 6px 16px rgba(13, 124, 102, 0.35);
}

/* ==================== */
/* DOCUMENT FORM        */
/* ==================== */
.doc-form-card {
    background: #fff;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-lg);
    padding: 20px;
}

.doc-form-card h4 {
    font-size: 13px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    padding-bottom: 8px;
    border-bottom: 1px solid var(--border-light);
    font-weight: 500;
}

.doc-summary-amount {
    font-size: 30px;
    font-weight: 600;
    color: var(--primary);
    margin: 4px 0 0 0;
    letter-spacing: -0.5px;
}

/* Collapsible extra fields section */
.doc-extra-section {
    animation: docExtraSlideDown 0.25s ease-out;
}
@keyframes docExtraSlideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Items table in document modal */
.items-table-header {
    background: var(--primary-gradient);
    color: #fff;
}

.items-table-header th {
    background: transparent;
    color: #fff;
    font-weight: 500;
    font-size: 12px;
    padding: 10px 12px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.item-input {
    width: 100%;
    border: 1px solid transparent;
    background: transparent;
    padding: 6px 8px;
    color: var(--text-primary);
    font-family: inherit;
    font-size: 13px;
    border-radius: 4px;
}

.item-input:focus {
    border-color: var(--primary);
    background: #fff;
    outline: none;
}

.item-input-num {
    width: 100%;
    border: 1.5px solid var(--border-light);
    background: #fff;
    border-radius: var(--radius);
    padding: 6px 8px;
    text-align: right;
    font-family: inherit;
    font-size: 13px;
    color: var(--text-primary);
    -moz-appearance: textfield;
}
.item-input-num::-webkit-outer-spin-button,
.item-input-num::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.item-input-num:focus {
    border-color: var(--primary);
    outline: none;
    box-shadow: 0 0 0 3px rgba(13,124,102,0.1);
}

/* Summary section */
.summary-section {
    background: #fff;
    border: 1px solid #e5e7eb;
    border-radius: 12px;
    padding: 16px 20px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

.summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    font-size: 13px;
    border-bottom: 1px solid #f3f4f6;
}

.summary-row:last-child {
    border-bottom: none;
}

.summary-row.total {
    border-top: 2px solid var(--primary);
    border-bottom: none;
    padding-top: 14px;
    margin-top: 8px;
    font-size: 17px;
    font-weight: 600;
    color: var(--primary);
}

/* ==================== */
/* STATUS DOTS          */
/* ==================== */
.dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
    margin-right: 6px;
}
.dot-blue { background: var(--primary); }
.dot-green { background: var(--success); }
.dot-orange { background: var(--warning); }
.dot-red { background: var(--danger); }
.dot-gray { background: #cbd5e1; }

/* ==================== */
/* UTILITIES            */
/* ==================== */
.hidden { display: none !important; }
.flex { display: flex; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.items-center { align-items: center; }
.gap-2 { gap: 0.5rem; }
.gap-4 { gap: 1rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-4 { margin-top: 1rem; }
.w-full { width: 100%; }
.text-right { text-align: right; }
.text-center { text-align: center; }
.text-primary { color: var(--primary); }
.text-success { color: var(--success); }
.text-danger { color: var(--danger); }
.text-warning { color: #d97706; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }
.font-medium { font-weight: 500; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 1rem; }
.grid-4 { display: grid; grid-template-columns: 1fr 1fr 1fr 1fr; gap: 1rem; }

/* ==================== */
/* LANDING PAGE         */
/* ==================== */
#landing-screen {
    min-height: 100vh; background: #fff;
    width: 100vw; position: fixed; top: 0; left: 0; right: 0; bottom: 0;
    overflow-y: auto; overflow-x: hidden; z-index: 50;
}
.landing-nav {
    position: fixed; top: 0; left: 0; right: 0; z-index: 100;
    padding: 14px 0; background: rgba(10,46,36,0.95); backdrop-filter: blur(8px);
}
.landing-container { max-width: 1100px; margin: 0 auto; padding: 0 24px; }
.landing-hero {
    background: linear-gradient(135deg, #0a2e24 0%, #0d5c4a 40%, #2a9d6e 100%);
    padding-top: 60px; min-height: 400px; display: flex; align-items: center; justify-content: center;
}
.landing-feature-card {
    padding: 28px; border-radius: 16px; background: #fff; border: 1px solid #eee;
    transition: transform 0.2s, box-shadow 0.2s;
}
.landing-feature-card:hover { transform: translateY(-4px); box-shadow: 0 12px 32px rgba(0,0,0,0.08); }
.landing-feature-icon { width: 48px; height: 48px; border-radius: 14px; display: flex; align-items: center; justify-content: center; font-size: 22px; margin-bottom: 16px; }
.landing-feature-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; }
.landing-feature-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }

.landing-steps { max-width: 720px; margin: 0 auto; }
.landing-step {
    display: flex; gap: 20px; align-items: flex-start;
    padding: 20px 24px; margin-bottom: 12px;
    background: #fff; border-radius: 14px; border: 1px solid #eee;
    transition: box-shadow 0.2s;
}
.landing-step:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.06); }
.landing-step-num {
    min-width: 40px; height: 40px; border-radius: 50%;
    background: var(--primary-gradient); color: #fff; font-weight: 700; font-size: 18px;
    display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.landing-step h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.landing-step p { font-size: 13px; color: var(--text-secondary); line-height: 1.6; margin: 0; }

/* ==================== */
/* LOGIN / REGISTER     */
/* ==================== */
.login-container {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #0a2e24 0%, #0d5c4a 40%, #2a9d6e 100%);
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(42,157,110,0.2) 0%, transparent 70%);
    top: -200px;
    right: -100px;
}

.login-container::after {
    content: '';
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(232,168,56,0.12) 0%, transparent 70%);
    bottom: -150px;
    left: -100px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    padding: 40px 36px;
    border-radius: 16px;
    background: rgba(255,255,255,0.97);
    border: none;
    box-shadow: 0 20px 60px rgba(0,0,0,0.2);
    position: relative;
    z-index: 1;
    backdrop-filter: blur(10px);
}

.login-logo {
    text-align: center;
    margin-bottom: 28px;
}
.login-logo h1 {
    font-size: 26px;
    font-weight: 600;
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 6px;
}
.login-logo p {
    color: var(--text-muted);
    font-size: 14px;
}

/* ==================== */
/* TOAST                */
/* ==================== */
#toast-container {
    position: fixed;
    top: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    pointer-events: none;
}

.toast {
    min-width: 320px;
    max-width: 420px;
    background: #fff;
    color: var(--text-primary);
    padding: 16px 20px;
    border-radius: 14px;
    box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.04);
    border-left: none;
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 13.5px;
    font-weight: 500;
    opacity: 0;
    transform: translateX(40px) scale(0.95);
    transition: all 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
}

.toast::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 4px;
    border-radius: 4px 0 0 4px;
}

.toast.show {
    opacity: 1;
    transform: translateX(0) scale(1);
}

.toast i {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.toast.success::before { background: var(--success); }
.toast.success i { background: var(--success-light); color: var(--success); }
.toast.error::before { background: var(--danger); }
.toast.error i { background: var(--danger-light); color: var(--danger); }
.toast.warning::before { background: var(--warning); }
.toast.warning i { background: var(--warning-light); color: var(--warning); }

/* Toast progress bar animation */
.toast::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    height: 3px;
    background: rgba(0,0,0,0.06);
    border-radius: 0 0 14px 14px;
    animation: toastProgress 3s linear forwards;
}

@keyframes toastProgress {
    from { width: 100%; }
    to { width: 0%; }
}

/* Amount column styling */
.amount-col {
    text-align: right;
    font-weight: 500;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Status column */
.status-col {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* ==================== */
/* SIDEBAR TOGGLE       */
/* ==================== */
.sidebar-toggle {
    display: none;
    background: none;
    border: none;
    font-size: 22px;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 6px;
    border-radius: 8px;
    transition: background 0.15s;
}
.sidebar-toggle:hover {
    background: var(--primary-light);
    color: var(--primary);
}

/* Sidebar overlay for mobile */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.5);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.3s;
}
.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ==================== */
/* RESPONSIVE - iPad Mini (768px) */
/* ==================== */
@media (max-width: 1024px) {
    .sidebar {
        position: fixed;
        top: 0;
        left: 0;
        bottom: 0;
        z-index: 999;
        transform: translateX(-100%);
        width: 260px;
        min-width: 260px;
    }
    .sidebar.open {
        transform: translateX(0);
        box-shadow: 4px 0 30px rgba(0,0,0,0.3);
    }
    .sidebar-toggle {
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .main-content {
        width: 100%;
    }
    .topbar { padding: 0 16px; }
    .page-content { padding: 20px 16px; }
    .grid-2 { grid-template-columns: 1fr; }
    .grid-3 { grid-template-columns: 1fr; }
    .grid-4 { grid-template-columns: 1fr 1fr; }
    .page-header { margin-bottom: 16px; }
    .page-header h2 { font-size: 17px; }

    /* Topbar company info compact */
    .topbar-company-info {
        display: none;
    }

    /* Search bar compact */
    .search-input {
        width: 180px;
    }

    /* Filter bar stack */
    .filter-bar {
        flex-direction: column;
        align-items: stretch;
    }

    /* Side panel full width */
    .modal-backdrop.side-panel .modal {
        width: 100%;
    }

    /* Summary section full width */
    .doc-form-bottom {
        flex-direction: column;
    }
}

/* ==================== */
/* RESPONSIVE - Mobile (480px) */
/* ==================== */
@media (max-width: 480px) {
    :root {
        --topbar-height: 52px;
    }

    body {
        font-size: 13px;
    }

    /* Topbar compact */
    .topbar {
        padding: 0 12px;
    }
    .topbar h3 {
        font-size: 14px;
    }
    .topbar-actions {
        gap: 6px;
    }
    .topbar-actions .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Page content tight padding */
    .page-content {
        padding: 14px 10px;
    }
    .page-header {
        margin-bottom: 12px;
    }
    .page-header h2 {
        font-size: 15px;
    }

    /* Search bar full width */
    .search-bar {
        flex-direction: column;
        align-items: stretch;
    }
    .search-input {
        width: 100%;
    }

    /* Filter bar mobile */
    .filter-bar {
        gap: 8px;
    }
    .filter-bar .btn {
        width: 100%;
        justify-content: center;
    }

    /* Dashboard cards single column */
    .dash-grid-4 {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    .dash-grid-2 {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }
    .dash-card {
        padding: 12px !important;
    }
    .dash-card .dash-value {
        font-size: 18px !important;
    }
    .dash-card .dash-label {
        font-size: 11px !important;
    }

    /* Grid helpers */
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr !important;
        gap: 8px;
    }

    /* Cards compact */
    .card {
        padding: 14px;
        border-radius: 10px;
    }
    .card-header {
        padding: 12px 14px;
    }
    .card-body {
        padding: 12px 14px;
    }

    /* Table compact */
    .table th, .table td {
        padding: 8px 6px;
        font-size: 12px;
    }
    .table th:first-child, .table td:first-child {
        padding-left: 10px;
    }

    /* Table actions buttons compact */
    .table .btn-icon {
        width: 28px;
        height: 28px;
        font-size: 12px;
    }

    /* Buttons compact */
    .btn {
        padding: 7px 12px;
        font-size: 12.5px;
    }
    .btn-sm {
        padding: 4px 8px;
        font-size: 11px;
    }

    /* Modal full screen on mobile */
    .modal-backdrop .modal {
        width: 98%;
        max-width: none;
        max-height: 95vh;
        margin: 10px auto;
        border-radius: 12px;
    }
    .modal-header {
        padding: 12px 14px;
    }
    .modal-body {
        padding: 12px 14px;
    }
    .modal-footer {
        padding: 10px 14px;
    }

    /* Document form - stack all grids to single column */
    .doc-form-grid,
    .modal-body [style*="grid-template-columns"],
    .side-panel [style*="grid-template-columns"] {
        grid-template-columns: 1fr !important;
    }

    /* Item table horizontal scroll */
    .items-table-wrapper {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        margin: 0 -10px;
        padding: 0 10px;
    }

    /* Summary section */
    .summary-section {
        padding: 12px 14px;
    }
    .summary-row {
        font-size: 12px;
    }
    .summary-row.total {
        font-size: 15px;
    }

    /* Tabs compact */
    .tab-bar {
        gap: 0;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .tab-btn {
        padding: 8px 12px;
        font-size: 12px;
        white-space: nowrap;
    }

    /* Pagination compact */
    .pagination {
        flex-wrap: wrap;
        gap: 4px;
        justify-content: center;
    }
    .pagination .btn {
        padding: 6px 10px;
        font-size: 12px;
    }

    /* Landing page mobile */
    .hero-title { font-size: 26px !important; }
    .hero-subtitle { font-size: 14px !important; }
    .landing-nav { padding: 0 12px !important; }
    .features-grid { grid-template-columns: 1fr !important; }
    .pricing-grid { grid-template-columns: 1fr !important; }

    /* Login/Register form */
    .login-card {
        padding: 24px 18px !important;
        max-width: 100%;
        margin: 0 10px;
        border-radius: 14px;
    }

    /* Notification dropdown */
    .notification-dropdown {
        width: calc(100vw - 16px) !important;
        right: -60px;
    }

    /* Toast notifications */
    .toast {
        max-width: calc(100vw - 20px);
        font-size: 12.5px;
    }
}

/* BOQ project row clickable */
#table-boq-projects tbody tr {
    cursor: pointer;
    transition: background 0.15s;
}
#table-boq-projects tbody tr:hover {
    background: var(--primary-light) !important;
}

/* Clickable document rows */
#table-documents tbody tr {
    cursor: pointer;
    transition: background-color 0.15s ease;
}
#table-documents tbody tr:hover {
    background-color: #f0fdf4 !important;
}

/* ==================== */
/* SCROLLBAR            */
/* ==================== */
.page-content::-webkit-scrollbar { width: 6px; }
.page-content::-webkit-scrollbar-track { background: transparent; }
.page-content::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 6px; }
.page-content::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ==================== */
/* TEMPLATE CARDS       */
/* ==================== */
.template-card {
    transition: all 0.2s !important;
}
.template-card:hover {
    border-color: var(--primary) !important;
    box-shadow: var(--shadow-md);
}

/* ==================== */
/* NEW: Purchase Order Form */
/* ==================== */
#po-items-tbody input {
    padding: 6px 8px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 13px;
    font-family: var(--font-body);
}
#po-items-tbody input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(13,124,102,0.15);
}

/* ==================== */
/* NEW: Payroll & Inventory */
/* ==================== */
.action-menu-btn {
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 4px;
    transition: background 0.15s;
    font-size: 14px;
}
.action-menu-btn:hover {
    background: var(--bg-color);
}
.action-menu-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

/* Form select consistent styling */
.form-select {
    padding: 8px 12px;
    border: 1px solid var(--border-color);
    border-radius: var(--radius);
    font-size: 14px;
    font-family: var(--font-body);
    background: #fff;
}
.form-select:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(13,124,102,0.15);
}

/* ==================== */
/* NOTIFICATION CENTER  */
/* ==================== */
.notification-bell {
    position: relative;
    width: 40px;
    height: 40px;
    border-radius: 10px;
    border: none;
    background: var(--bg-color);
    color: var(--text-secondary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 17px;
    transition: all 0.2s;
}
.notification-bell:hover {
    background: var(--primary-light);
    color: var(--primary);
    transform: scale(1.05);
}

.notification-badge {
    position: absolute;
    top: -4px;
    right: -4px;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    border-radius: 10px;
    background: var(--danger);
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid #fff;
    animation: badgePulse 2s ease-in-out infinite;
}
.notification-badge.hidden { display: none; }

@keyframes badgePulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.1); }
}

.notification-dropdown {
    position: absolute;
    top: calc(100% + 12px);
    right: 0;
    width: 380px;
    max-height: 520px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 25px 60px -12px rgba(0,0,0,0.2), 0 0 0 1px rgba(0,0,0,0.04);
    z-index: 2000;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: dropdownSlide 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.notification-dropdown.hidden { display: none; }

@keyframes dropdownSlide {
    from { opacity: 0; transform: translateY(-8px) scale(0.97); }
    to { opacity: 1; transform: translateY(0) scale(1); }
}

.notification-header {
    padding: 16px 20px 12px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid var(--border-light);
}
.notification-header h4 {
    margin: 0;
    font-size: 15px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
}
.notification-header h4 i { color: var(--primary); font-size: 16px; }

.notif-mark-all {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 4px 10px;
    border-radius: 6px;
    transition: background 0.2s;
    font-family: inherit;
}
.notif-mark-all:hover { background: var(--primary-light); }

.notification-list {
    flex: 1;
    overflow-y: auto;
    max-height: 400px;
    padding: 6px 0;
}
.notification-list::-webkit-scrollbar { width: 4px; }
.notification-list::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 2px; }

.notification-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 20px;
    cursor: pointer;
    transition: background 0.15s;
    position: relative;
    border-left: 3px solid transparent;
}
.notification-item:hover {
    background: var(--bg-color);
}
.notification-item.unread {
    background: #f0faf7;
    border-left-color: var(--primary);
}
.notification-item.unread:hover {
    background: #e3f5ef;
}

.notif-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 15px;
    flex-shrink: 0;
}

.notif-content {
    flex: 1;
    min-width: 0;
}
.notif-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 2px;
}
.notif-message {
    font-size: 12.5px;
    color: var(--text-secondary);
    line-height: 1.5;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}
.notif-time {
    font-size: 11.5px;
    color: var(--text-muted);
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.notif-dismiss {
    position: absolute;
    top: 10px;
    right: 10px;
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    transition: all 0.15s;
}
.notification-item:hover .notif-dismiss { display: flex; }
.notif-dismiss:hover {
    background: var(--danger-light);
    color: var(--danger);
}

.notification-footer {
    padding: 10px 20px;
    border-top: 1px solid var(--border-light);
    text-align: center;
}
.notif-generate-btn {
    border: none;
    background: none;
    color: var(--primary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    padding: 6px 14px;
    border-radius: 8px;
    font-family: inherit;
    transition: background 0.2s;
}
.notif-generate-btn:hover { background: var(--primary-light); }

.notification-empty {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}
.notification-empty i {
    font-size: 36px;
    margin-bottom: 12px;
    opacity: 0.3;
}
.notification-empty p {
    font-size: 13px;
    margin: 0;
}

@media (max-width: 480px) {
    .notification-dropdown {
        width: calc(100vw - 20px);
        right: -60px;
    }
}

/* ===== Role-based visibility ===== */
body.role-viewer .btn-create,
body.role-viewer .btn-delete,
body.role-viewer .action-menu-btn[title="แก้ไข"],
body.role-viewer .action-menu-btn[title="ลบ"],
body.role-viewer #btn-create-doc,
body.role-viewer #btn-create-customer,
body.role-viewer #btn-create-product {
    display: none !important;
}

/* ===== Page header ===== */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 12px;
}
.page-header h2 {
    font-size: 18px;
    font-weight: 600;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
}
.page-header p {
    margin: 2px 0 0;
}

/* Report tab content */
.report-tab-content.hidden { display: none; }

/* Print styles */
@media print {
    .sidebar, .landing-nav, .top-bar, .btn, button, .tab-bar, #report-date-filter, #report-year-filter, .search-bar, .pagination, .toast, #toast-container { display: none !important; }
    .main-content { margin-left: 0 !important; padding: 0 !important; }
    .card { box-shadow: none !important; border: 1px solid #ddd !important; page-break-inside: avoid; }
    .view-section { display: block !important; }
    .report-tab-content { page-break-before: auto; }
    body { background: #fff !important; }
}
