*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --primary: #1B6CA8;
    --primary-dark: #155a8a;
    --primary-light: #e8f2fb;
    --accent: #E8A020;
    --bg: #f4f6f9;
    --bg-card: #ffffff;
    --border: #e2e8f0;
    --text: #1a202c;
    --text-muted: #718096;
    --sidebar-w: 240px;
    --topbar-h: 60px;
    --radius: 10px;
    --radius-sm: 6px;
    --shadow: 0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.04);
    --shadow-md: 0 4px 12px rgba(0,0,0,.1);
}

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

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

.sidebar {
    width: var(--sidebar-w);
    background: #fff;
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0; left: 0; bottom: 0;
    z-index: 100;
    transition: transform .25s;
    overflow-y: auto;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 18px 16px;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.logo-icon { width: 34px; height: 34px; color: var(--primary); flex-shrink: 0; }
.logo-text { font-size: 18px; font-weight: 800; color: var(--text); }
.logo-text span { color: var(--primary); }

.sidebar-nav { flex: 1; padding: 12px 10px; }

.nav-section {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .08em;
    color: var(--text-muted);
    padding: 14px 8px 5px;
}
.nav-section:first-child { padding-top: 4px; }

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 10px;
    border-radius: var(--radius-sm);
    color: var(--text-muted);
    text-decoration: none;
    font-size: 13.5px;
    font-weight: 500;
    transition: background .15s, color .15s;
    margin-bottom: 1px;
}
.nav-item:hover { background: var(--bg); color: var(--text); }
.nav-item.active { background: var(--primary-light); color: var(--primary); font-weight: 600; }
.nav-item svg { flex-shrink: 0; }

.sidebar-footer { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sidebar-user { display: flex; align-items: center; gap: 8px; }
.sidebar-user-info { flex: 1; min-width: 0; }
.sidebar-user-name { font-size: 13px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-role { font-size: 11px; color: var(--text-muted); }
.logout-btn { color: var(--text-muted); display: flex; padding: 4px; border-radius: 4px; }
.logout-btn:hover { color: #e53e3e; }

.user-avatar { width: 32px; height: 32px; border-radius: 50%; background: var(--primary); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; flex-shrink: 0; }
.user-avatar.sm { width: 30px; height: 30px; font-size: 12px; }

.sidebar-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,.4); z-index: 99; }

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

.topbar {
    height: var(--topbar-h);
    background: #fff;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 24px;
    position: sticky;
    top: 0;
    z-index: 50;
}
.sidebar-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 4px; }
.topbar-brand { font-weight: 700; color: var(--text-muted); font-size: 13px; }
.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 12px; }
.topbar-user { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500; }

.lang-switcher { display: flex; gap: 4px; }
.lang-btn { padding: 3px 8px; border-radius: 4px; font-size: 11px; font-weight: 700; color: var(--text-muted); text-decoration: none; }
.lang-btn:hover, .lang-btn.active { background: var(--primary-light); color: var(--primary); }

.page-content { flex: 1; padding: 24px; }

/* CARDS */
.card { background: #fff; border-radius: var(--radius); border: 1px solid var(--border); box-shadow: var(--shadow); margin-bottom: 20px; }
.card-header { padding: 14px 20px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.card-header h3 { font-size: 14px; font-weight: 600; }
.card-body { padding: 20px; }
.card-footer { padding: 12px 20px; border-top: 1px solid var(--border); background: var(--bg); border-radius: 0 0 var(--radius) var(--radius); }

/* PAGE HEADER */
.page-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.page-header h1 { font-size: 20px; font-weight: 700; }
.page-header p { color: var(--text-muted); font-size: 13px; margin-top: 2px; }

/* GRID */
.grid { display: grid; gap: 20px; }
.grid-2 { grid-template-columns: repeat(2, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }

/* STAT CARDS */
.stat-card { display: flex; align-items: center; gap: 16px; }
.stat-icon { width: 48px; height: 48px; border-radius: 10px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.stat-info h3 { font-size: 22px; font-weight: 700; line-height: 1; }
.stat-info p { color: var(--text-muted); font-size: 12px; margin-top: 4px; }

/* TABLE */
.table { width: 100%; border-collapse: collapse; }
.table th { background: var(--bg); padding: 10px 14px; text-align: left; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 11px 14px; border-bottom: 1px solid var(--border); font-size: 13.5px; vertical-align: middle; }
.table tr:last-child td { border-bottom: none; }
.table tbody tr:hover { background: #fafbfc; }
.table td a { color: var(--primary); text-decoration: none; font-weight: 500; }
.table td a:hover { text-decoration: underline; }
.actions { white-space: nowrap; }

/* BUTTONS */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 16px; border-radius: var(--radius-sm); font-size: 13.5px; font-weight: 600; border: none; cursor: pointer; text-decoration: none; transition: background .15s, opacity .15s; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-dark); }
.btn-outline { background: #fff; color: var(--text); border: 1px solid var(--border); }
.btn-outline:hover { background: var(--bg); }
.btn-danger { background: #e53e3e; color: #fff; }
.btn-success { background: #38a169; color: #fff; }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-group { display: flex; gap: 8px; flex-wrap: wrap; }
.btn-icon { background: none; border: none; cursor: pointer; padding: 5px; border-radius: 4px; color: var(--text-muted); display: inline-flex; align-items: center; text-decoration: none; }
.btn-icon:hover { background: var(--bg); color: var(--text); }
.btn-icon.danger:hover { color: #e53e3e; }

/* BADGES */
.badge { display: inline-block; padding: 2px 8px; border-radius: 20px; font-size: 11px; font-weight: 700; }
.badge-default   { background: #f0f0f0; color: #666; }
.badge-new       { background: #e3f2fd; color: #1565c0; }
.badge-confirmed { background: #e8eaf6; color: #283593; }
.badge-paid      { background: #e8f5e9; color: #2e7d32; }
.badge-progress  { background: #fff8e1; color: #e65100; }
.badge-completed { background: #f3e5f5; color: #6a1b9a; }
.badge-cancelled { background: #ffebee; color: #b71c1c; }
.badge-info      { background: #e3f2fd; color: #1565c0; }
.badge-success   { background: #e8f5e9; color: #2e7d32; }
.badge-warning   { background: #fff8e1; color: #e65100; }
.badge-danger    { background: #ffebee; color: #b71c1c; }

/* FORMS */
.form-group { margin-bottom: 16px; }
.form-group label { display: block; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: .04em; }
.form-control { width: 100%; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13.5px; color: var(--text); background: #fff; transition: border-color .15s; }
.form-control:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(27,108,168,.1); }
textarea.form-control { resize: vertical; }
select.form-control { cursor: pointer; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.form-actions { display: flex; gap: 10px; margin-top: 20px; padding-bottom: 24px; }
.input-group { position: relative; }
.input-group .form-control { padding-right: 40px; }
.input-group-btn { position: absolute; right: 0; top: 0; height: 100%; padding: 0 10px; background: none; border: none; cursor: pointer; color: var(--text-muted); }

/* CHECKBOX */
.checkbox-group { display: flex; flex-wrap: wrap; gap: 14px; }
.checkbox-label { display: flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13.5px; font-weight: 400; color: var(--text); text-transform: none; letter-spacing: 0; }
.checkbox-label input[type="checkbox"] { width: 15px; height: 15px; accent-color: var(--primary); }

/* INFO TABLE */
.info-table { width: 100%; border-collapse: collapse; }
.info-table tr { border-bottom: 1px solid var(--border); }
.info-table tr:last-child { border-bottom: none; }
.info-table td { padding: 9px 12px; font-size: 13.5px; }
.info-table td.label { color: var(--text-muted); width: 42%; font-weight: 500; font-size: 12.5px; }

/* ALERTS */
.alert { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 16px; font-size: 13.5px; }
.alert-danger  { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; }
.alert-success { background: #f0fff4; border: 1px solid #c6f6d5; color: #276749; }
.alert-info    { background: #ebf8ff; border: 1px solid #bee3f8; color: #2b6cb0; }

/* PAGINATION */
.pagination { display: flex; gap: 4px; flex-wrap: wrap; align-items: center; }
.pagination a, .pagination span { display: inline-flex; align-items: center; justify-content: center; min-width: 32px; height: 32px; padding: 0 8px; border: 1px solid var(--border); border-radius: var(--radius-sm); font-size: 13px; color: var(--text-muted); text-decoration: none; }
.pagination a.active { background: var(--primary); color: #fff; border-color: var(--primary); font-weight: 700; }
.pagination a:hover:not(.active) { background: var(--bg); color: var(--text); }
.pagination span.dots { border: none; color: var(--text-muted); }
.pagination a.prev-next { font-weight: 600; padding: 0 12px; }

/* PROGRESS */
.progress { height: 6px; background: var(--bg); border-radius: 3px; overflow: hidden; }
.progress-bar { height: 100%; background: var(--primary); border-radius: 3px; }

/* SEARCH FORM */
.search-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.search-form .form-control { min-width: 180px; }

/* TABS */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--border); margin-bottom: 20px; }
.tab { padding: 10px 18px; border: none; background: none; cursor: pointer; font-size: 13.5px; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent; margin-bottom: -2px; }
.tab.active { color: var(--primary); border-bottom-color: var(--primary); }
.tab-pane { display: none; }
.tab-pane.active { display: block; }

/* TOAST */
.toast-container { position: fixed; bottom: 24px; right: 24px; z-index: 999; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 12px 18px; border-radius: var(--radius-sm); background: var(--text); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-md); animation: slideIn .25s; max-width: 300px; }
.toast.success { background: #38a169; }
.toast.error   { background: #e53e3e; }
.toast.info    { background: var(--primary); }
@keyframes slideIn { from { transform: translateX(110%); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

/* TEXT UTILS */
.text-muted   { color: var(--text-muted); }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-success { color: #38a169; }
.text-danger  { color: #e53e3e; }
.fw-bold      { font-weight: 700; }
.mt-1 { margin-top: 8px; }
.mt-2 { margin-top: 16px; }
.mt-3 { margin-top: 24px; }
code { background: var(--bg); padding: 2px 6px; border-radius: 4px; font-family: monospace; font-size: 12.5px; }

/* LOGIN PAGE */
.login-page { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(135deg, #1B6CA8 0%, #0e4a78 100%); padding: 20px; }
.login-box { background: #fff; border-radius: 16px; box-shadow: 0 20px 60px rgba(0,0,0,.25); width: 100%; max-width: 440px; padding: 40px; }
.login-logo { display: flex; align-items: center; gap: 10px; margin-bottom: 28px; }
.login-logo-icon { width: 42px; height: 42px; color: var(--primary); }
.login-logo-text { font-size: 22px; font-weight: 800; }
.login-logo-text span { color: var(--primary); }
.login-title { font-size: 20px; font-weight: 700; margin-bottom: 6px; }
.login-sub { color: var(--text-muted); font-size: 13.5px; margin-bottom: 28px; }
.login-tabs { display: flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; margin-bottom: 24px; }
.login-tab { flex: 1; padding: 9px 4px; border: none; background: none; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.login-tab.active { background: var(--primary); color: #fff; }
.login-error { background: #fff5f5; border: 1px solid #fed7d7; color: #c53030; padding: 10px 14px; border-radius: 6px; font-size: 13px; margin-bottom: 16px; }

/* RESPONSIVE */
@media (max-width: 900px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); }
    .sidebar-overlay.open { display: block; }
    .sidebar-toggle { display: flex; }
    .main-content { margin-left: 0; }
    .grid-2, .grid-3, .grid-4 { grid-template-columns: 1fr; }
    .form-row { grid-template-columns: 1fr; }
    .page-content { padding: 16px; }
}
