/* ===================================
   N1Med Agenda — Design System v2
   Refined Medical SaaS
   =================================== */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:ital,opsz,wght@0,9..40,300;0,9..40,400;0,9..40,500;0,9..40,600;0,9..40,700&display=swap');

/* --- CSS Variables --- */
:root {
    --brand: #42BD8D;
    --brand-dark: #1E565A;
    --brand-hover: #38a67d;
    --brand-subtle: #edf8f3;
    --brand-glow: rgba(66, 189, 141, 0.12);

    --success: #22c55e;
    --success-bg: #f0fdf4;
    --warning: #eab308;
    --warning-bg: #fefce8;
    --danger: #ef4444;
    --danger-bg: #fef2f2;
    --info: #3b82f6;
    --info-bg: #eff6ff;

    --bg: #f5f6f8;
    --surface: #ffffff;
    --surface-hover: #fafbfc;
    --border: #e5e7eb;
    --border-light: #f3f4f6;

    --text: #111827;
    --text-secondary: #6b7280;
    --text-muted: #9ca3af;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
    --shadow-md: 0 4px 6px rgba(0, 0, 0, 0.04), 0 2px 4px rgba(0, 0, 0, 0.03);
    --shadow-lg: 0 10px 15px rgba(0, 0, 0, 0.06), 0 4px 6px rgba(0, 0, 0, 0.03);
    --shadow-xl: 0 20px 25px rgba(0, 0, 0, 0.08), 0 8px 10px rgba(0, 0, 0, 0.03);

    --radius-xs: 4px;
    --radius-sm: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --radius-xl: 16px;

    --font: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
    --transition: 150ms var(--ease);

    /* legacy aliases used in inline styles */
    --color-primary: var(--brand);
    --color-primary-dark: var(--brand-dark);
    --color-text-secondary: var(--text-secondary);
    --color-text-muted: var(--text-muted);
    --color-border: var(--border);
    --color-surface: var(--surface);
    --color-danger-light: var(--danger-bg);
    --color-danger: var(--danger);
    --font-family: var(--font);
    --color-primary-light: var(--brand-subtle);
    --color-primary-glow: var(--brand-glow);
    --color-border-light: var(--border-light);
    --color-text: var(--text);
    --color-bg: var(--bg);
    --color-surface-hover: var(--surface-hover);
    --color-success: var(--success);
    --color-success-light: var(--success-bg);
    --color-warning: var(--warning);
    --color-warning-light: var(--warning-bg);
    --color-info: var(--info);
    --color-info-light: var(--info-bg);
}

/* --- Reset & Base --- */
*,
*::before,
*::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    line-height: 1.5;
    min-height: 100vh;
}

a {
    color: var(--brand);
    text-decoration: none;
}

/* ============================================
   LOGIN PAGE
   ============================================ */
.login-container {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(to bottom right, #ecfdf5, #ffffff, #ecfdf5);
    padding: 24px;
    position: relative;
    overflow: hidden;
}

.login-container::before {
    content: '';
    position: absolute;
    top: -120px;
    right: -120px;
    width: 400px;
    height: 400px;
    background: rgba(66, 189, 141, 0.08);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.login-container::after {
    content: '';
    position: absolute;
    bottom: -80px;
    left: -80px;
    width: 300px;
    height: 300px;
    background: rgba(30, 86, 90, 0.06);
    border-radius: 50%;
    filter: blur(60px);
    pointer-events: none;
}

.login-card {
    background: var(--surface);
    border-radius: var(--radius-xl);
    padding: 48px 40px;
    width: 100%;
    max-width: 400px;
    border: 1px solid #f3f4f6;
    position: relative;
    z-index: 1;
    animation: loginEnter 0.5s var(--ease);
    box-shadow: 0 20px 25px rgba(30, 86, 90, 0.05), 0 8px 10px rgba(30, 86, 90, 0.03);
}

@keyframes loginEnter {
    from {
        opacity: 0;
        transform: translateY(16px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.login-logo {
    text-align: center;
    margin-bottom: 36px;
}

.login-logo img {
    max-width: 140px;
    height: auto;
    margin-bottom: 12px;
}

.login-logo h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand-dark);
    letter-spacing: -0.3px;
}

.login-logo p {
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    margin-top: 4px;
    letter-spacing: 0.2px;
}

.login-field {
    position: relative;
}

.login-field .login-field-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--text-muted);
    pointer-events: none;
    display: flex;
    align-items: center;
}

.login-field .login-field-icon svg {
    width: 18px;
    height: 18px;
}

.form-group .login-field input {
    padding-left: 42px;
}

.login-card .btn-primary {
    background: var(--brand-dark);
    border-color: var(--brand-dark);
    box-shadow: 0 4px 12px rgba(30, 86, 90, 0.2);
}

.login-card .btn-primary:hover {
    background: #174a4d;
    border-color: #174a4d;
    box-shadow: 0 6px 16px rgba(30, 86, 90, 0.3);
    transform: translateY(-1px);
}

.login-error {
    background: var(--danger-bg);
    color: var(--danger);
    padding: 10px 14px;
    border-radius: var(--radius-md);
    font-size: 13px;
    font-weight: 500;
    margin-bottom: 20px;
    display: none;
    border: 1px solid rgba(239, 68, 68, 0.15);
}

.login-error.active {
    display: block;
    animation: fadeShake 0.35s var(--ease);
}

@keyframes fadeShake {
    0% {
        opacity: 0;
        transform: translateX(-6px);
    }

    40% {
        transform: translateX(4px);
    }

    70% {
        transform: translateX(-2px);
    }

    100% {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ============================================
   FORM ELEMENTS
   ============================================ */
.form-group {
    margin-bottom: 18px;
}

.form-group label {
    display: block;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 5px;
    letter-spacing: 0.01em;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: #f9fafb;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.form-group select {
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 36px;
    cursor: pointer;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background: var(--surface);
}

.form-group input::placeholder,
.form-group textarea::placeholder {
    color: var(--text-muted);
}

.form-group input[readonly] {
    background: var(--bg);
    color: var(--text-secondary);
}

.form-group textarea {
    resize: vertical;
    min-height: 72px;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}

/* Standalone selects (filter bars, etc.) */
select {
    font-family: var(--font);
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 10px center;
    background-color: #f9fafb;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 8px 32px 8px 12px;
    font-size: 13px;
    color: var(--text);
    cursor: pointer;
    outline: none;
    transition: border-color var(--transition), box-shadow var(--transition);
}

select:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
    background-color: var(--surface);
}

/* ============================================
   BUTTONS
   ============================================ */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 20px;
    border: 1px solid transparent;
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    line-height: 1.4;
}

.btn svg {
    width: 16px;
    height: 16px;
}

.btn-primary {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

.btn-primary:hover {
    background: var(--brand-hover);
    border-color: var(--brand-hover);
    box-shadow: 0 2px 8px rgba(66, 189, 141, 0.3);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text);
    border-color: var(--border);
}

.btn-secondary:hover {
    background: var(--bg);
    border-color: #d1d5db;
}

.btn-success {
    background: var(--success);
    color: white;
    border-color: var(--success);
}

.btn-success:hover {
    background: #16a34a;
    border-color: #16a34a;
}

.btn-danger {
    background: var(--danger);
    color: white;
    border-color: var(--danger);
}

.btn-danger:hover {
    background: #dc2626;
    border-color: #dc2626;
}

.btn-outline {
    background: transparent;
    border: 1px solid var(--brand);
    color: var(--brand);
}

.btn-outline:hover {
    background: var(--brand);
    color: white;
}

.btn-sm {
    padding: 6px 12px;
    font-size: 13px;
    border-radius: var(--radius-sm);
}

.btn-block {
    width: 100%;
}

.btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    pointer-events: none;
}

/* ============================================
   DASHBOARD LAYOUT
   ============================================ */
.dashboard {
    display: flex;
    min-height: 100vh;
}

/* --- Sidebar (white) --- */
.sidebar {
    width: 248px;
    background: #ffffff;
    border-right: 1px solid var(--border);
    padding: 0;
    display: flex;
    flex-direction: column;
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transition: transform 0.25s var(--ease);
}

.sidebar-logo {
    padding: 20px 20px 16px;
    border-bottom: 1px solid var(--border);
}

.sidebar-logo img {
    max-width: 140px;
    height: auto;
    margin-bottom: 2px;
}

.sidebar-logo h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--brand-dark);
}

.sidebar-logo span {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1.5px;
    display: block;
    margin-top: 2px;
    font-weight: 600;
}

.sidebar-nav {
    flex: 1;
    padding: 12px 10px;
    overflow-y: auto;
}

.sidebar-nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    color: var(--text-secondary);
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    transition: all var(--transition);
    margin-bottom: 2px;
    border: 1px solid transparent;
}

.sidebar-nav a:hover {
    background: var(--bg);
    color: var(--text);
}

.sidebar-nav a.active {
    background: var(--brand-subtle);
    color: var(--brand-dark);
    font-weight: 600;
    border-color: rgba(66, 189, 141, 0.2);
}

.sidebar-nav a .icon {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.sidebar-nav a .icon svg {
    width: 18px;
    height: 18px;
}

.sidebar-nav a.active .icon svg {
    color: var(--brand);
}

.sidebar-user {
    padding: 14px 16px;
    border-top: 1px solid var(--border);
    margin-top: auto;
}

.sidebar-user .user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 10px;
}

.sidebar-user .user-avatar {
    width: 34px;
    height: 34px;
    border-radius: var(--radius-md);
    background: var(--brand);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    font-size: 13px;
    flex-shrink: 0;
}

.sidebar-user .user-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

.sidebar-user .user-perfil {
    font-size: 11px;
    color: var(--text-muted);
    font-weight: 500;
}

.btn-logout {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: var(--radius-md);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    transition: all var(--transition);
    flex-shrink: 0;
    padding: 0;
}

.btn-logout svg {
    width: 16px;
    height: 16px;
}

.btn-logout:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

/* --- Main Content --- */
.main-content {
    flex: 1;
    margin-left: 248px;
    padding: 28px 32px;
    max-width: calc(100% - 248px);
    min-height: 100vh;
}

.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 24px;
}

.page-header h1 {
    font-size: 22px;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.3px;
}

.page-header p {
    color: var(--text-muted);
    font-size: 13px;
    margin-top: 2px;
    font-weight: 500;
}

/* ============================================
   CARDS
   ============================================ */
.card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    transition: box-shadow var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-sm);
}

.card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.card-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

/* ============================================
   STATS CARDS
   ============================================ */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 14px;
    margin-bottom: 24px;
}

.stat-card {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 18px 20px;
    border: 1px solid var(--border);
    position: relative;
    overflow: hidden;
    transition: box-shadow var(--transition);
}

.stat-card:hover {
    box-shadow: var(--shadow-sm);
}

.stat-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 3px;
    height: 100%;
    border-radius: 0 2px 2px 0;
}

.stat-card.stat-primary::before {
    background: var(--brand);
}

.stat-card.stat-success::before {
    background: var(--success);
}

.stat-card.stat-warning::before {
    background: var(--warning);
}

.stat-card.stat-danger::before {
    background: var(--danger);
}

.stat-card.stat-info::before {
    background: var(--info);
}

.stat-card .stat-icon {
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--brand-subtle);
    border-radius: var(--radius-md);
    margin-bottom: 10px;
}

.stat-card.stat-warning .stat-icon {
    background: var(--warning-bg);
}

.stat-card.stat-danger .stat-icon {
    background: var(--danger-bg);
}

.stat-card.stat-info .stat-icon {
    background: var(--info-bg);
}

.stat-card.stat-success .stat-icon {
    background: var(--success-bg);
}

.stat-card .stat-icon svg {
    width: 20px;
    height: 20px;
}

.stat-card .stat-value {
    font-size: 26px;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 2px;
    letter-spacing: -0.5px;
    line-height: 1.2;
}

.stat-card .stat-label {
    font-size: 12px;
    color: var(--text-muted);
    font-weight: 500;
}

/* ============================================
   TABLES
   ============================================ */
.table-container {
    overflow-x: auto;
    margin: -4px;
    padding: 4px;
}

table {
    width: 100%;
    border-collapse: collapse;
}

thead th {
    text-align: left;
    padding: 10px 14px;
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    border-bottom: 1px solid var(--border);
    white-space: nowrap;
    background: var(--bg);
}

thead th:first-child {
    border-radius: var(--radius-sm) 0 0 0;
}

thead th:last-child {
    border-radius: 0 var(--radius-sm) 0 0;
}

tbody td {
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    vertical-align: middle;
    color: var(--text);
}

tbody tr {
    transition: background var(--transition);
}

tbody tr:hover {
    background: var(--surface-hover);
}

tbody tr:last-child td {
    border-bottom: none;
}

/* Action buttons inside table cells */
tbody td .btn {
    vertical-align: middle;
}

tbody td .btn+.btn {
    margin-left: 6px;
}

/* Right-align the last column (headings) */
th:last-child {
    text-align: right;
}

/* Right-align the last column (cells) */
tbody td:last-child {
    text-align: right;
    white-space: nowrap;
}

/* ============================================
   BADGES
   ============================================ */
.badge {
    display: inline-flex;
    align-items: center;
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.2px;
}

.badge-success {
    background: var(--success-bg);
    color: #15803d;
}

.badge-warning {
    background: var(--warning-bg);
    color: #a16207;
}

.badge-danger {
    background: var(--danger-bg);
    color: #dc2626;
}

.badge-info {
    background: var(--info-bg);
    color: #1d4ed8;
}

/* ============================================
   CALENDAR
   ============================================ */
.calendar {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
    max-width: 480px;
}

.calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.calendar-header h3 {
    font-size: 15px;
    font-weight: 600;
    color: var(--text);
}

.calendar-nav {
    display: flex;
    gap: 6px;
}

.calendar-nav button {
    width: 32px;
    height: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--surface);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    font-size: 14px;
    color: var(--text-secondary);
}

.calendar-nav button:hover {
    background: var(--brand);
    color: white;
    border-color: var(--brand);
}

.calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
}

.calendar-day-header {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.calendar-day {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: default;
    transition: all var(--transition);
    position: relative;
    padding: 8px 4px;
    color: var(--text);
    border: 1px solid transparent;
}

.calendar-day.other-month {
    color: var(--text-muted);
    opacity: 0.4;
}

.calendar-day.today {
    background: var(--brand-subtle);
    color: var(--brand-dark);
    font-weight: 700;
    border-color: rgba(66, 189, 141, 0.3);
}

.calendar-day.available {
    background: #f0fdf4;
    color: #15803d;
    cursor: pointer;
    font-weight: 600;
}

.calendar-day.available:hover {
    background: #dcfce7;
    border-color: #86efac;
    color: #166534;
}

.calendar-day.selected {
    background: var(--brand);
    color: white;
    font-weight: 700;
    border-color: var(--brand);
}

.calendar-day.blocked {
    background: var(--danger-bg);
    color: var(--danger);
    cursor: default;
    text-decoration: line-through;
    opacity: 0.6;
}

.calendar-day.blocked:hover {
    opacity: 0.8;
}

.calendar-day .day-dot {
    width: 4px;
    height: 4px;
    border-radius: 50%;
    background: var(--success);
    margin-top: 2px;
}

.calendar-day.has-appointments .day-count {
    font-size: 10px;
    color: inherit;
    opacity: 0.8;
}

/* ============================================
   MODALS
   ============================================ */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    backdrop-filter: blur(4px);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}

.modal-overlay.active {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 520px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: var(--shadow-xl);
    transform: translateY(12px) scale(0.98);
    transition: transform 0.25s var(--ease);
    border: 1px solid var(--border);
}

.modal-overlay.active .modal {
    transform: translateY(0) scale(1);
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px 0;
}

.modal-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: var(--text);
}

.modal-close {
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg);
    border-radius: var(--radius-md);
    font-size: 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all var(--transition);
    color: var(--text-muted);
}

.modal-close:hover {
    background: var(--danger-bg);
    color: var(--danger);
}

.modal-body {
    padding: 20px 24px;
}

.modal-footer {
    padding: 0 24px 20px;
    display: flex;
    gap: 10px;
    justify-content: flex-end;
}

/* ============================================
   TABS
   ============================================ */
.tabs {
    display: flex;
    gap: 2px;
    background: var(--border-light);
    padding: 3px;
    border-radius: var(--radius-md);
    margin-bottom: 20px;
}

.tab {
    flex: 1;
    padding: 8px 16px;
    border: none;
    background: none;
    border-radius: var(--radius-sm);
    font-family: var(--font);
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
    cursor: pointer;
    transition: all var(--transition);
    text-align: center;
}

.tab:hover {
    color: var(--text);
}

.tab.active {
    background: var(--surface);
    color: var(--brand-dark);
    font-weight: 600;
    box-shadow: var(--shadow-xs);
}

.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: tabIn 0.25s var(--ease);
}

@keyframes tabIn {
    from {
        opacity: 0;
        transform: translateY(4px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ============================================
   TOAST NOTIFICATIONS
   ============================================ */
#toast-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 2000;
    display: flex;
    flex-direction: column;
    gap: 8px;
    max-width: 380px;
}

.toast {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 13px;
    font-weight: 500;
    animation: toastIn 0.3s var(--ease);
    border-left: 3px solid var(--info);
    border: 1px solid var(--border);
    border-left: 3px solid var(--info);
}

.toast-success {
    border-left-color: var(--success);
}

.toast-error {
    border-left-color: var(--danger);
}

.toast-warning {
    border-left-color: var(--warning);
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(40px);
    }

    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.toast-fade-out {
    opacity: 0;
    transform: translateX(40px);
    transition: all 0.25s var(--ease);
}

.toast-close {
    border: none;
    background: none;
    font-size: 16px;
    cursor: pointer;
    color: var(--text-muted);
    padding: 0;
    line-height: 1;
    flex-shrink: 0;
}

.toast-close:hover {
    color: var(--text);
}

/* ============================================
   LOADING OVERLAY
   ============================================ */
#loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(4px);
    z-index: 3000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s var(--ease), visibility 0.2s var(--ease);
}

#loading-overlay.active {
    opacity: 1;
    visibility: visible;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--brand);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* ============================================
   SEARCH
   ============================================ */
.search-box {
    position: relative;
}

.search-box input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
    color: var(--text);
}

.search-box input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.search-box::before {
    content: '';
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%239ca3af' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cline x1='21' y1='21' x2='16.65' y2='16.65'/%3E%3C/svg%3E");
    background-size: contain;
    background-repeat: no-repeat;
    z-index: 1;
}

.search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    max-height: 200px;
    overflow-y: auto;
    z-index: 50;
    display: none;
    margin-top: 4px;
}

.search-results.active {
    display: block;
}

.search-result-item {
    padding: 9px 14px;
    cursor: pointer;
    transition: background var(--transition);
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
}

.search-result-item:hover {
    background: var(--brand-subtle);
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item .result-subtitle {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

/* ============================================
   SEARCHABLE SELECT
   ============================================ */
.searchable-select {
    position: relative;
}

.ss-input-wrapper {
    position: relative;
}

.ss-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    font-family: var(--font);
    font-size: 14px;
    color: var(--text);
    background: var(--surface);
    transition: border-color var(--transition), box-shadow var(--transition);
    outline: none;
}

.ss-input:focus {
    border-color: var(--brand);
    box-shadow: 0 0 0 3px var(--brand-glow);
}

.ss-input::placeholder {
    color: var(--text-muted);
}

.ss-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    max-height: 200px;
    overflow-y: auto;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    z-index: 50;
    display: none;
    margin-top: 4px;
}

.ss-dropdown.open {
    display: block;
}

.ss-item {
    padding: 9px 14px;
    cursor: pointer;
    font-size: 13px;
    border-bottom: 1px solid var(--border-light);
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background var(--transition);
}

.ss-item:hover {
    background: var(--brand-subtle);
}

.ss-item:last-child {
    border-bottom: none;
}

.ss-item.selected {
    background: var(--brand-subtle);
    color: var(--brand-dark);
    font-weight: 600;
}

.ss-no-results {
    padding: 9px 14px;
    font-size: 13px;
    color: var(--text-muted);
}

.ss-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}

.ss-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    background: var(--brand-subtle);
    color: var(--brand-dark);
    border-radius: 14px;
    font-size: 12px;
    font-weight: 600;
}

.ss-tag-remove {
    cursor: pointer;
    opacity: 0.5;
    border: none;
    background: none;
    padding: 0;
    display: inline-flex;
    color: inherit;
    font-size: 14px;
}

.ss-tag-remove:hover {
    opacity: 1;
}

/* ============================================
   EMPTY STATE
   ============================================ */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: var(--text-muted);
}

.empty-state .empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.4;
}

.empty-state .empty-icon svg {
    width: 40px;
    height: 40px;
}

.empty-state h3 {
    font-size: 16px;
    margin-bottom: 6px;
    color: var(--text-secondary);
    font-weight: 600;
}

.empty-state p {
    font-size: 13px;
    max-width: 320px;
    margin: 0 auto;
}

/* ============================================
   CONFIG CALENDAR (inline overrides)
   ============================================ */
.config-calendar-container {
    margin-top: 16px;
}

.config-calendar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}

.config-calendar-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.config-calendar-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
    max-width: 420px;
}

.config-day-header {
    text-align: center;
    font-size: 10px;
    font-weight: 600;
    color: var(--text-muted);
    padding: 4px 0;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.config-day {
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius-sm);
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    padding: 8px 4px;
    border: 1px solid transparent;
    background: var(--bg);
    color: var(--text);
}

.config-day:hover {
    border-color: var(--brand);
    background: var(--brand-subtle);
}

.config-day.empty {
    cursor: default;
    background: transparent;
}

.config-day.empty:hover {
    border-color: transparent;
    background: transparent;
}

.config-day.blocked {
    background: var(--danger-bg);
    color: var(--danger);
    font-weight: 600;
}

.config-day.today {
    border-color: var(--brand);
    font-weight: 700;
    color: var(--brand-dark);
}

.config-weekend-options {
    display: flex;
    gap: 20px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.config-weekend-options label {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 500;
    cursor: pointer;
    color: var(--text);
}

.config-weekend-options input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--brand);
}

/* ============================================
   DAY DETAIL & AGENDA ITEMS
   ============================================ */
.day-detail {
    background: var(--surface);
    border-radius: var(--radius-lg);
    padding: 20px;
    border: 1px solid var(--border);
}

.day-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border-light);
}

.day-detail-header h3 {
    font-size: 16px;
    font-weight: 600;
}

.day-detail-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(110px, 1fr));
    gap: 10px;
    margin-bottom: 16px;
}

.mini-stat {
    background: var(--bg);
    border-radius: var(--radius-md);
    padding: 12px;
    text-align: center;
}

.mini-stat .mini-value {
    font-size: 22px;
    font-weight: 700;
    color: var(--brand);
    line-height: 1.2;
}

.mini-stat .mini-label {
    font-size: 10px;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 3px;
    font-weight: 600;
}

.agenda-item {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 12px 14px;
    border-radius: var(--radius-md);
    border: 1px solid var(--border-light);
    margin-bottom: 6px;
    transition: all var(--transition);
}

.agenda-item:hover {
    border-color: var(--brand);
    background: var(--brand-subtle);
}

.agenda-item .order-number {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-sm);
    background: var(--brand-subtle);
    color: var(--brand-dark);
    font-weight: 700;
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.agenda-item .agenda-info {
    flex: 1;
}

.agenda-item .agenda-name {
    font-weight: 600;
    font-size: 14px;
}

.agenda-item .agenda-meta {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 1px;
}

.agenda-item .agenda-actions {
    display: flex;
    gap: 6px;
    flex-shrink: 0;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
.mobile-menu-btn {
    display: none;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 200;
    width: 40px;
    height: 40px;
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-sm);
    cursor: pointer;
    color: var(--text);
}

.mobile-menu-btn svg {
    width: 20px;
    height: 20px;
}

@media (max-width: 768px) {
    .mobile-menu-btn {
        display: flex;
        align-items: center;
        justify-content: center;
    }

    .sidebar {
        transform: translateX(-100%);
        box-shadow: var(--shadow-xl);
    }

    .sidebar.open {
        transform: translateX(0);
    }

    .main-content {
        margin-left: 0;
        max-width: 100%;
        padding: 20px 16px;
        padding-top: 64px;
    }

    .form-row {
        grid-template-columns: 1fr;
    }

    .page-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 10px;
    }

    .stats-grid {
        grid-template-columns: 1fr 1fr;
    }

    .calendar-day {
        min-height: 36px;
        font-size: 12px;
    }

    .config-day {
        min-height: 36px;
        font-size: 12px;
    }

    .agenda-item {
        flex-direction: column;
        align-items: flex-start;
    }

    .login-card {
        padding: 32px 24px;
    }
}

@media (max-width: 480px) {
    .stats-grid {
        grid-template-columns: 1fr;
    }
}

/* --- Sidebar Overlay for Mobile --- */
.sidebar-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 99;
}

.sidebar-overlay.active {
    display: block;
}

/* ============================================
   UTILITIES
   ============================================ */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.mt-16 {
    margin-top: 16px;
}

.mt-24 {
    margin-top: 24px;
}

.mb-16 {
    margin-bottom: 16px;
}

.mb-24 {
    margin-bottom: 24px;
}

.flex {
    display: flex;
}

.items-center {
    align-items: center;
}

.gap-8 {
    gap: 8px;
}

.gap-12 {
    gap: 12px;
}

.gap-16 {
    gap: 16px;
}

.justify-between {
    justify-content: space-between;
}

.flex-1 {
    flex: 1;
}

/* Scrollbar */
::-webkit-scrollbar {
    width: 5px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* Selection */
::selection {
    background: var(--brand-subtle);
    color: var(--brand-dark);
}

/* ============================================
   EMPLOYEE SELECTION (Client Dashboard)
   ============================================ */
.employee-list-container {
    max-height: 300px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    background: #fff;
}

.employee-card {
    padding: 12px 16px;
    border-bottom: 1px solid var(--border-light);
    cursor: pointer;
    transition: background var(--transition);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.employee-card:last-child {
    border-bottom: none;
}

.employee-card:hover {
    background: var(--surface-hover);
}

.employee-card h4 {
    margin: 0 0 4px 0;
    font-size: 14px;
    color: var(--text);
}

.employee-card p {
    margin: 0;
    font-size: 12px;
    color: var(--text-muted);
}

.employee-card .action-icon {
    color: var(--text-muted);
    opacity: 0;
    transition: opacity var(--transition);
}

.employee-card:hover .action-icon {
    opacity: 1;
}

#ag-selected-employee-area {
    background: var(--surface);
    padding: 16px;
    border-radius: var(--radius-md);
    border: 1px solid var(--brand-subtle);
}