/* =============================================================
   Lobyt — Design System
   ============================================================= */

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

:root {
    /* Cores principais */
    --primary:        #16A34A;
    --primary-hover:  #15803D;
    --primary-light:  #F0FDF4;
    --primary-mid:    #DCFCE7;

    --success:        #10B981;
    --success-light:  #ECFDF5;
    --warning:        #F59E0B;
    --warning-light:  #FFFBEB;
    --danger:         #EF4444;
    --danger-light:   #FEF2F2;
    --info:           #06B6D4;
    --info-light:     #ECFEFF;

    /* Neutros */
    --gray-50:  #F9FAFB;
    --gray-100: #F3F4F6;
    --gray-200: #E5E7EB;
    --gray-300: #D1D5DB;
    --gray-400: #9CA3AF;
    --gray-500: #6B7280;
    --gray-600: #4B5563;
    --gray-700: #374151;
    --gray-800: #1F2937;
    --gray-900: #111827;

    /* Superfícies */
    --bg:           #F6FAF7;
    --surface:      #FFFFFF;
    --surface-2:    #F9FAFB;
    --border:       #E5E7EB;
    --border-focus: #86EFAC;

    /* Sidebar */
    --sidebar-bg:     #FFFFFF;
    --sidebar-hover:  #DCFCE7;
    --sidebar-active: #16A34A;
    --sidebar-text:   #4B6E57;
    --sidebar-text-active: #15803D;
    --sidebar-width:  260px;

    /* Tipografia */
    --font:       'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --text:       #111827;
    --text-muted: #6B7280;
    --text-light: #9CA3AF;

    /* Espaçamentos */
    --header-height: 64px;

    /* Sombras */
    --shadow-sm: 0 1px 2px rgba(0,0,0,.05);
    --shadow:    0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.05);
    --shadow-md: 0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.04);
    --shadow-lg: 0 10px 15px rgba(0,0,0,.08), 0 4px 6px rgba(0,0,0,.04);
    --shadow-xl: 0 20px 25px rgba(0,0,0,.08), 0 8px 10px rgba(0,0,0,.03);

    /* Bordas */
    --radius-sm: 6px;
    --radius:    10px;
    --radius-lg: 16px;
    --radius-xl: 24px;
    --radius-full: 9999px;

    /* Transições */
    --transition: 200ms ease;
    --transition-slow: 350ms ease;
}

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; transition: color var(--transition); }
a:hover { color: var(--primary-hover); }

img { max-width: 100%; display: block; }

/* ── Scrollbar ────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--gray-300); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--gray-400); }

/* ── Layout Principal ─────────────────────────────────────── */
.app-wrapper {
    display: flex;
    min-height: 100vh;
}

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

.page-body {
    flex: 1;
    padding: 28px 32px;
    margin-top: var(--header-height);
}

/* ── Sidebar ─────────────────────────────────────────────── */
.sidebar {
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
    overflow-y: auto;
    overflow-x: hidden;
}

.sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 20px 20px 16px;
    text-decoration: none;
}

.sidebar-logo .logo-icon {
    width: 36px;
    height: 36px;
    background: linear-gradient(135deg, #16A34A 0%, #22C55E 100%);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 16px;
    flex-shrink: 0;
    box-shadow: 0 4px 12px rgba(22,163,74,.35);
}

.sidebar-logo .logo-text {
    font-size: 18px;
    font-weight: 700;
    color: #111827;
    letter-spacing: -.3px;
}

.sidebar-logo .logo-text span {
    color: var(--primary);
}

.sidebar-section {
    padding: 20px 12px 8px;
}

.sidebar-section-label {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--gray-500);
    padding: 0 8px;
    margin-bottom: 4px;
}

.sidebar-nav {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text);
    font-size: 14px;
    font-weight: 500;
    transition: background var(--transition), color var(--transition);
    position: relative;
    text-decoration: none;
}

.sidebar-link:hover {
    background: var(--sidebar-hover);
    color: var(--sidebar-text-active);
}

.sidebar-link.active {
    background: #DCFCE7;
    color: var(--sidebar-text-active);
    position: relative;
}
.sidebar-link.active::before {
    content: '';
    position: absolute;
    left: 0; top: 6px; bottom: 6px;
    width: 3px;
    background: var(--primary);
    border-radius: 0 3px 3px 0;
}

.sidebar-link .nav-icon {
    width: 18px;
    text-align: center;
    font-size: 14px;
    flex-shrink: 0;
}

.sidebar-link .nav-badge {
    margin-left: auto;
    background: var(--danger);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: var(--radius-full);
    line-height: 1.4;
}

.sidebar-footer {
    margin-top: auto;
    padding: 16px 12px;
    border-top: none;
}

.sidebar-user {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: background var(--transition);
    text-decoration: none;
}

.sidebar-user:hover { background: #DCFCE7; }

.sidebar-user .avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-full);
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    flex-shrink: 0;
}

.sidebar-user .user-info { flex: 1; min-width: 0; }
.sidebar-user .user-name { font-size: 13px; font-weight: 600; color: #111827; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user .user-role { font-size: 11px; color: var(--text-muted); }

.plan-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    padding: 2px 8px;
    border-radius: var(--radius-full);
    background: #DCFCE7;
    color: #15803D;
    margin: 0 12px 12px;
}

/* ── Header ────────────────────────────────────────────────── */
.app-header {
    position: fixed;
    top: 0;
    left: var(--sidebar-width);
    right: 0;
    height: var(--header-height);
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 32px;
    gap: 16px;
    z-index: 90;
    transition: left var(--transition-slow);
}

.header-title { flex: 1; }
.header-title h1 { font-size: 18px; font-weight: 700; color: var(--gray-900); line-height: 1.2; }
.header-title .breadcrumb { font-size: 12px; color: var(--text-muted); margin-top: 1px; }

.header-actions { display: flex; align-items: center; gap: 8px; }

.header-btn {
    width: 36px;
    height: 36px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    cursor: pointer;
    transition: all var(--transition);
    position: relative;
    font-size: 14px;
}

.header-btn:hover { background: var(--gray-100); color: var(--text); border-color: var(--gray-300); }

.header-btn .notif-dot {
    position: absolute;
    top: 6px;
    right: 6px;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid var(--surface);
}

/* ── Cards ─────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.card-title {
    font-size: 15px;
    font-weight: 700;
    color: var(--gray-900);
}

.card-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 2px;
}

.card-body { padding: 24px; }
.card-body-sm { padding: 16px 24px; }
.card-footer {
    padding: 14px 24px;
    border-top: 1px solid var(--border);
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}

/* ── Metric Cards ─────────────────────────────────────────── */
.metric-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    padding: 20px 24px;
    display: flex;
    align-items: center;
    gap: 16px;
    box-shadow: var(--shadow-sm);
    transition: transform var(--transition), box-shadow var(--transition);
}

.metric-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.metric-icon {
    width: 52px;
    height: 52px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    flex-shrink: 0;
}

.metric-icon.blue   { background: var(--primary-light);  color: var(--primary); }
.metric-icon.green  { background: var(--success-light);  color: var(--success); }
.metric-icon.yellow { background: var(--warning-light);  color: var(--warning); }
.metric-icon.red    { background: var(--danger-light);   color: var(--danger); }
.metric-icon.cyan   { background: var(--info-light);     color: var(--info); }

.metric-info { flex: 1; min-width: 0; }
.metric-label { font-size: 12px; color: var(--text-muted); font-weight: 500; margin-bottom: 4px; }
.metric-value { font-size: 24px; font-weight: 800; color: var(--gray-900); line-height: 1.1; }
.metric-trend {
    font-size: 12px;
    font-weight: 600;
    margin-top: 4px;
    display: flex;
    align-items: center;
    gap: 3px;
}
.metric-trend.up   { color: var(--success); }
.metric-trend.down { color: var(--danger); }
.metric-trend.neutral { color: var(--text-muted); }

/* ── Buttons ───────────────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 9px 18px;
    font-size: 14px;
    font-weight: 600;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1;
    font-family: var(--font);
    text-decoration: none;
}

.btn:disabled { opacity: .6; cursor: not-allowed; }
.btn i { font-size: 13px; }

.btn-primary {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
.btn-primary:hover:not(:disabled) { background: var(--primary-hover); border-color: var(--primary-hover); color: #fff; }

.btn-success {
    background: var(--success);
    color: #fff;
    border-color: var(--success);
}
.btn-success:hover:not(:disabled) { background: #059669; color: #fff; }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border-color: var(--danger);
}
.btn-danger:hover:not(:disabled) { background: #DC2626; color: #fff; }

.btn-outline {
    background: transparent;
    color: var(--primary);
    border-color: var(--primary);
}
.btn-outline:hover:not(:disabled) { background: var(--primary-light); }

.btn-ghost {
    background: transparent;
    color: var(--text-muted);
    border-color: var(--border);
}
.btn-ghost:hover:not(:disabled) { background: var(--gray-100); color: var(--text); }

.btn-sm { padding: 6px 12px; font-size: 13px; }
.btn-lg { padding: 12px 24px; font-size: 16px; }
.btn-icon { padding: 8px; width: 36px; height: 36px; }
.btn-block { width: 100%; }

.btn-loading .btn-text { opacity: .8; }
.btn-loading::after {
    content: '';
    width: 14px;
    height: 14px;
    border: 2px solid currentColor;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
    margin-left: 6px;
}

/* ── Forms ─────────────────────────────────────────────────── */
.form-group { margin-bottom: 20px; }

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--gray-700);
    margin-bottom: 6px;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-control {
    display: block;
    width: 100%;
    padding: 9px 12px;
    font-size: 14px;
    font-family: var(--font);
    color: var(--text);
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    line-height: 1.5;
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(22,163,74,.12);
}

.form-control::placeholder { color: var(--text-light); }
.form-control:disabled { background: var(--gray-100); color: var(--text-muted); cursor: not-allowed; }
.form-control.is-invalid { border-color: var(--danger); box-shadow: 0 0 0 3px rgba(239,68,68,.12); }
.form-control.is-valid   { border-color: var(--success); }

textarea.form-control { resize: vertical; min-height: 100px; }
select.form-control { cursor: pointer; }

.form-text { font-size: 12px; color: var(--text-muted); margin-top: 4px; }
.form-error { font-size: 12px; color: var(--danger); margin-top: 4px; display: flex; align-items: center; gap: 4px; }

.input-group {
    display: flex;
    align-items: stretch;
}

.input-group .form-control {
    border-radius: 0;
}

.input-group .form-control:first-child { border-radius: var(--radius-sm) 0 0 var(--radius-sm); }
.input-group .form-control:last-child  { border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

.input-group-text {
    display: flex;
    align-items: center;
    padding: 0 12px;
    background: var(--gray-100);
    border: 1px solid var(--border);
    font-size: 14px;
    color: var(--text-muted);
}

.input-group-text:first-child {
    border-right: none;
    border-radius: var(--radius-sm) 0 0 var(--radius-sm);
}

.input-group-text:last-child {
    border-left: none;
    border-radius: 0 var(--radius-sm) var(--radius-sm) 0;
}

.input-with-icon { position: relative; }
.input-with-icon .form-control { padding-left: 38px; }
.input-with-icon .input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    font-size: 14px;
    pointer-events: none;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-row-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 16px;
}

/* ── Tables ────────────────────────────────────────────────── */
.table-wrapper {
    overflow-x: auto;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--surface);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 14px;
}

.data-table thead th {
    background: var(--gray-50);
    padding: 11px 16px;
    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;
}

.data-table tbody tr {
    border-bottom: 1px solid var(--gray-100);
    transition: background var(--transition);
}

.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--gray-50); }

.data-table td {
    padding: 12px 16px;
    vertical-align: middle;
    color: var(--text);
}

.data-table td.text-muted { color: var(--text-muted); }

/* ── Badges ─────────────────────────────────────────────────── */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: var(--radius-full);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: .02em;
    white-space: nowrap;
}

.badge-blue    { background: var(--primary-light); color: var(--primary); }
.badge-green   { background: var(--success-light); color: #059669; }
.badge-yellow  { background: var(--warning-light); color: #D97706; }
.badge-red     { background: var(--danger-light);  color: #DC2626; }
.badge-gray    { background: var(--gray-100);       color: var(--gray-600); }
.badge-cyan    { background: var(--info-light);    color: #0891B2; }

/* Status agendamento */
.badge-agendado      { background: #EFF6FF; color: #2563EB; }
.badge-confirmado    { background: #ECFDF5; color: #059669; }
.badge-em_andamento  { background: #FFFBEB; color: #D97706; }
.badge-concluido     { background: #F0FDF4; color: #16A34A; }
.badge-cancelado     { background: #FEF2F2; color: #DC2626; }
.badge-falta         { background: #FFF7ED; color: #EA580C; }

/* ── Avatar ─────────────────────────────────────────────────── */
.avatar {
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0;
    background: var(--primary);
    overflow: hidden;
}

.avatar-sm { width: 28px; height: 28px; font-size: 11px; }
.avatar-md { width: 36px; height: 36px; font-size: 14px; }
.avatar-lg { width: 48px; height: 48px; font-size: 18px; }
.avatar-xl { width: 64px; height: 64px; font-size: 24px; }

/* ── Modals ─────────────────────────────────────────────────── */
.modal-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15,23,42,.5);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition), visibility var(--transition);
    backdrop-filter: blur(2px);
}

.modal-backdrop.show { opacity: 1; visibility: visible; }

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    overflow-y: auto;
    transform: scale(.96) translateY(8px);
    transition: transform var(--transition);
}

.modal-lg { max-width: 760px; }
.modal-xl { max-width: 960px; }

.modal-backdrop.show .modal { transform: scale(1) translateY(0); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 16px;
    border-bottom: 1px solid var(--border);
}

.modal-title { font-size: 17px; font-weight: 700; color: var(--gray-900); }

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--gray-100);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 14px;
    transition: all var(--transition);
}

.modal-close:hover { background: var(--gray-200); color: var(--text); }

.modal-body { padding: 24px; }
.modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
    background: var(--gray-50);
    border-radius: 0 0 var(--radius-xl) var(--radius-xl);
}

/* ── Alerts / Flash ─────────────────────────────────────────── */
.alert {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 14px 16px;
    border-radius: var(--radius);
    font-size: 14px;
    margin-bottom: 20px;
    border: 1px solid transparent;
}

.alert i { font-size: 15px; margin-top: 1px; flex-shrink: 0; }

.alert-success { background: var(--success-light); color: #065F46; border-color: #A7F3D0; }
.alert-danger   { background: var(--danger-light);  color: #7F1D1D; border-color: #FECACA; }
.alert-warning  { background: var(--warning-light); color: #78350F; border-color: #FDE68A; }
.alert-info     { background: var(--info-light);    color: #164E63; border-color: #A5F3FC; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header-left h2 {
    font-size: 22px;
    font-weight: 800;
    color: var(--gray-900);
    line-height: 1.2;
}

.page-header-left p {
    color: var(--text-muted);
    font-size: 14px;
    margin-top: 3px;
}

/* ── Grid Layout ──────────────────────────────────────────── */
.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); }

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar {
    position: relative;
    flex: 1;
    max-width: 340px;
}

.search-bar .form-control {
    padding-left: 38px;
    background: var(--gray-50);
    border-color: var(--border);
}

.search-bar .search-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-light);
    font-size: 13px;
    pointer-events: none;
}

/* ── Empty State ──────────────────────────────────────────── */
.empty-state {
    text-align: center;
    padding: 56px 24px;
}

.empty-state .empty-icon {
    width: 72px;
    height: 72px;
    background: var(--gray-100);
    border-radius: var(--radius-full);
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 20px;
    font-size: 28px;
    color: var(--gray-400);
}

.empty-state h3 { font-size: 17px; font-weight: 700; color: var(--gray-700); margin-bottom: 8px; }
.empty-state p  { font-size: 14px; color: var(--text-muted); max-width: 320px; margin: 0 auto 20px; }

/* ── Dropdown ─────────────────────────────────────────────── */
.dropdown { position: relative; display: inline-block; }

.dropdown-menu {
    position: absolute;
    top: calc(100% + 6px);
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow-lg);
    min-width: 180px;
    z-index: 150;
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-6px);
    transition: all var(--transition);
}

.dropdown-menu.show { opacity: 1; visibility: visible; transform: translateY(0); }

.dropdown-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    transition: background var(--transition);
    border: none;
    background: none;
    width: 100%;
    text-align: left;
    font-family: var(--font);
    text-decoration: none;
}

.dropdown-item:hover { background: var(--gray-50); }
.dropdown-item.danger { color: var(--danger); }
.dropdown-item.danger:hover { background: var(--danger-light); }
.dropdown-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ── Pagination ───────────────────────────────────────────── */
.pagination {
    display: flex;
    align-items: center;
    gap: 4px;
}

.page-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-family: var(--font);
}

.page-btn:hover:not(:disabled) { background: var(--gray-100); color: var(--text); }
.page-btn.active { background: var(--primary); border-color: var(--primary); color: #fff; }
.page-btn:disabled { opacity: .5; cursor: not-allowed; }

/* ── Toast ───────────────────────────────────────────────── */
.toast-container {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 999;
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-width: 360px;
}

.toast {
    background: #1F2937;
    color: #fff;
    padding: 14px 18px;
    border-radius: var(--radius);
    font-size: 14px;
    box-shadow: var(--shadow-xl);
    display: flex;
    align-items: flex-start;
    gap: 10px;
    animation: slideIn .3s ease;
    border-left: 4px solid var(--primary);
}

.toast.toast-success { border-color: var(--success); }
.toast.toast-danger  { border-color: var(--danger); }
.toast.toast-warning { border-color: var(--warning); }

.toast i { font-size: 15px; margin-top: 1px; }
.toast-success i { color: var(--success); }
.toast-danger  i { color: var(--danger); }
.toast-warning i { color: var(--warning); }

/* ── Auth Pages ───────────────────────────────────────────── */
.auth-wrapper {
    min-height: 100vh;
    display: flex;
    background: var(--gray-50);
}

.auth-brand {
    width: 480px;
    flex-shrink: 0;
    background: linear-gradient(145deg, #052E16 0%, #14532D 50%, #16A34A 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 40px 48px;
    position: relative;
    overflow: hidden;
}

.auth-brand::before {
    content: '';
    position: absolute;
    top: -100px;
    right: -100px;
    width: 400px;
    height: 400px;
    background: rgba(22,163,74,.2);
    border-radius: 50%;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -60px;
    left: -60px;
    width: 300px;
    height: 300px;
    background: rgba(16,185,129,.1);
    border-radius: 50%;
}

.auth-brand-content { position: relative; z-index: 1; }

.auth-logo {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 60px;
}

.auth-logo .logo-icon {
    width: 44px;
    height: 44px;
    background: var(--primary);
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 20px;
}

.auth-logo .logo-text {
    font-size: 24px;
    font-weight: 800;
    color: #fff;
    letter-spacing: -.5px;
}

.auth-brand h2 {
    font-size: 32px;
    font-weight: 800;
    color: #fff;
    line-height: 1.25;
    margin-bottom: 16px;
}

.auth-brand h2 span { color: #86EFAC; }

.auth-brand p {
    font-size: 16px;
    color: rgba(255,255,255,.65);
    line-height: 1.7;
    margin-bottom: 36px;
}

.auth-features { display: flex; flex-direction: column; gap: 14px; }

.auth-feature {
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255,255,255,.85);
    font-size: 14px;
}

.auth-feature .feat-icon {
    width: 32px;
    height: 32px;
    background: rgba(255,255,255,.1);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    flex-shrink: 0;
}

.auth-brand-footer {
    position: relative;
    z-index: 1;
    font-size: 12px;
    color: rgba(255,255,255,.35);
}

.auth-form-wrapper {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
}

.auth-form-box {
    width: 100%;
    max-width: 440px;
}

.auth-form-box .auth-header { margin-bottom: 32px; }
.auth-form-box .auth-header h1 { font-size: 26px; font-weight: 800; color: var(--gray-900); }
.auth-form-box .auth-header p  { color: var(--text-muted); margin-top: 6px; font-size: 15px; }

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--text-light);
    font-size: 12px;
    margin: 20px 0;
}
.auth-divider::before, .auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.auth-footer { text-align: center; margin-top: 24px; font-size: 14px; color: var(--text-muted); }

/* ── Utilities ────────────────────────────────────────────── */
.d-flex         { display: flex; }
.align-center   { align-items: center; }
.justify-between{ justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.gap-20 { gap: 20px; }
.mt-4   { margin-top: 4px; }
.mt-8   { margin-top: 8px; }
.mt-16  { margin-top: 16px; }
.mt-20  { margin-top: 20px; }
.mt-24  { margin-top: 24px; }
.mb-16  { margin-bottom: 16px; }
.mb-20  { margin-bottom: 20px; }
.mb-24  { margin-bottom: 24px; }
.text-center  { text-align: center; }
.text-right   { text-align: right; }
.text-muted   { color: var(--text-muted); }
.text-sm      { font-size: 13px; }
.text-xs      { font-size: 11px; }
.fw-600 { font-weight: 600; }
.fw-700 { font-weight: 700; }
.fw-800 { font-weight: 800; }
.w-100  { width: 100%; }
.flex-1 { flex: 1; }
.truncate { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.hidden { display: none !important; }

/* ── Animations ───────────────────────────────────────────── */
@keyframes spin    { to { transform: rotate(360deg); } }
@keyframes fadeIn  { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(20px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideUp { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

.animate-fadeIn { animation: fadeIn .3s ease; }
.animate-slideUp { animation: slideUp .35s ease; }

/* ── Loading Skeleton ─────────────────────────────────────── */
.skeleton {
    background: linear-gradient(90deg, var(--gray-200) 25%, var(--gray-100) 50%, var(--gray-200) 75%);
    background-size: 200% 100%;
    animation: skeleton 1.5s infinite;
    border-radius: var(--radius-sm);
}

@keyframes skeleton {
    0%   { background-position: 200% 0; }
    100% { background-position: -200% 0; }
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 1200px) {
    .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 992px) {
    .auth-brand { display: none; }
    .auth-form-wrapper { padding: 24px; }
    .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    :root { --sidebar-width: 0px; }
    .sidebar { transform: translateX(-260px); }
    .sidebar.open { transform: translateX(0); width: 260px; }
    .main-content { margin-left: 0; }
    .app-header { left: 0; }
    .page-body { padding: 20px 16px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .form-row, .form-row-3 { grid-template-columns: 1fr; }
    .page-header { flex-direction: column; align-items: flex-start; gap: 12px; }
}
