/**
 * Clinic Design System - Shared styles from DESIGN_SYSTEM.md
 * Base path: from project root use assets/css/design-system.css
 * From admin/ use ../assets/css/design-system.css; from receptionist/ or doctor/ same.
 */

/* ========== CSS Variables ========== */
:root {
    --primary-gradient: linear-gradient(135deg, #14b8a6, #10b981);
    --primary-solid: #06b6d4;
    --primary-glow: rgba(6, 182, 212, 0.4);
    --primary-teal: #14b8a6;
    --primary-green: #10b981;
    --bg-light: #f8f9fa;
    --bg-card: #ffffff;
    --font-app: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    --sidebar-font-size: 0.9rem;
    --sidebar-header-size: 1.1rem;
    --base-font-size: 14px;
    --sidebar-bg: linear-gradient(180deg, #1a472a 0%, #0d2818 100%);
    --sidebar-icon: #4ade80;
    --sidebar-link: rgba(255,255,255,0.85);
    --sidebar-link-hover: rgba(74, 222, 128, 0.1);
    --sidebar-link-active-bg: rgba(74, 222, 128, 0.15);
    --sidebar-link-active: #4ade80;
    --text-primary: #374151;
    --text-heading: #1f2937;
    --text-muted: #6b7280;
    --border-topbar: #e5e7eb;
    --border-card: #f1f3f4;
    --border-form: #d1d5db;
    --shadow-card: 0 3px 12px rgba(0,0,0,0.1);
    --shadow-card-hover: 0 6px 20px rgba(0,0,0,0.15);
    --shadow-topbar: 0 1px 3px rgba(0,0,0,0.05);
    --shadow-sidebar: 2px 0 10px rgba(0,0,0,0.15);
    --radius-card: 12px;
    --radius-btn: 8px;
    --radius-form: 8px;
    --sidebar-width: 260px;
    --sidebar-width-laptop: 220px;
}

/* ========== Base ========== */
html {
    font-size: var(--base-font-size);
    -webkit-font-smoothing: antialiased;
}

body {
    font-family: var(--font-app);
    font-size: 1rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-light);
    min-height: 100vh;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

*, *::before, *::after {
    box-sizing: border-box;
}

/* ========== Layout: Sidebar ========== */
.app-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: var(--sidebar-width);
    background: var(--sidebar-bg);
    box-shadow: var(--shadow-sidebar);
    z-index: 200;
    transition: transform 0.3s ease, width 0.3s ease;
    overflow-y: auto;
}

.sidebar-header {
    padding: 16px 20px;
    background: rgba(0,0,0,0.15);
    border-bottom: 1px solid rgba(255,255,255,0.1);
    font-size: var(--sidebar-header-size);
    font-weight: 600;
    color: var(--sidebar-link);
    letter-spacing: 0.5px;
}

.sidebar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    color: var(--sidebar-link);
    text-decoration: none;
    font-size: var(--sidebar-font-size);
    transition: all 0.2s ease;
    border-left: 3px solid transparent;
}

.sidebar-link:hover {
    background: var(--sidebar-link-hover);
    color: #fff;
}

.sidebar-link.active {
    background: var(--sidebar-link-active-bg);
    color: var(--sidebar-link-active);
    border-left-color: var(--sidebar-link-active);
}

.sidebar-link i, .sidebar-link .sidebar-icon {
    color: var(--sidebar-icon);
    width: 1.5em;
    font-size: 0.95rem;
    display: inline-block;
    vertical-align: middle;
}

/* ========== Layout: Topbar ========== */
.topbar {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-bottom: 1px solid var(--border-topbar);
    box-shadow: var(--shadow-topbar);
    z-index: 100;
    padding: 10px 20px;
}

.topbar-inner {
    display: flex;
    justify-content: space-between;
    align-items: center;
    max-width: 1400px;
    margin: 0 auto;
}

.topbar-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-heading);
    margin: 0;
}

.topbar-user {
    display: flex;
    align-items: center;
    gap: 12px;
}

.topbar-user-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 12px;
    background: var(--bg-card);
    border: 1px solid var(--border-topbar);
    border-radius: var(--radius-btn);
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    cursor: pointer;
    transition: all 0.2s ease;
}

.topbar-user-btn:hover {
    border-color: var(--primary-teal);
    color: var(--primary-teal);
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: var(--radius-btn);
    background: var(--primary-gradient);
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.85rem;
    font-weight: 600;
}

.user-dropdown {
    position: relative;
}

.user-dropdown-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 4px;
    min-width: 200px;
    background: var(--bg-card);
    border: 1px solid var(--border-topbar);
    border-radius: var(--radius-card);
    box-shadow: 0 10px 40px rgba(0,0,0,0.12);
    padding: 8px 0;
    z-index: 150;
    display: none;
}

.user-dropdown.open .user-dropdown-menu {
    display: block;
}

.user-dropdown-menu a {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px 16px;
    color: var(--text-primary);
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.15s;
}

.user-dropdown-menu a:hover {
    background: var(--bg-light);
}

.user-dropdown-menu a i {
    width: 1em;
    opacity: 0.8;
}

.user-dropdown-menu .dropdown-divider {
    height: 1px;
    background: var(--border-card);
    margin: 4px 0;
}

/* ========== Main content ========== */
.main-content {
    flex: 1;
    margin-left: var(--sidebar-width);
    padding: 20px;
    min-height: 100vh;
}

.page-header {
    margin-bottom: 20px;
    padding: 14px 20px 0;
}

.page-header h1 {
    font-size: 1.3rem;
    font-weight: 600;
    color: #1a1a1a;
    margin: 0 0 4px 0;
}

.page-header .subtitle {
    font-size: 0.875rem;
    color: #6c757d;
    margin: 0;
}

.container {
    max-width: 1400px;
    margin: 0 auto;
    padding: 28px 20px 0;
}

.container-narrow {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ========== Cards ========== */
.card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    margin-bottom: 20px;
    overflow: hidden;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.card:hover {
    box-shadow: var(--shadow-card-hover);
}

.card-header {
    background: var(--bg-card);
    padding: 20px 25px;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
    border-bottom: 1px solid var(--border-card);
    border-radius: var(--radius-card) var(--radius-card) 0 0;
}

.card-header.card-header-gradient {
    background: var(--primary-gradient);
    color: #fff;
    border-bottom: none;
}

.card-body, .card-content {
    padding: 25px;
}

/* ========== Stat cards ========== */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 20px;
    margin-bottom: 25px;
}

.stat-card {
    background: var(--bg-card);
    border-radius: 15px;
    padding: 25px;
    box-shadow: var(--shadow-card);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.stat-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
}

.stat-card.stat-card-1 { background: var(--bg-card); border-left: 4px solid var(--primary-teal); }
.stat-card.stat-card-2 { background: var(--bg-card); border-left: 4px solid var(--primary-solid); }
.stat-card.stat-card-3 { background: var(--bg-card); border-left: 4px solid #f59e0b; }
.stat-card.stat-card-4 { background: var(--bg-card); border-left: 4px solid #0d9488; }
.stat-card.stat-card-5 { background: var(--bg-card); border-left: 4px solid #dc2626; }

.stat-icon {
    width: 48px;
    height: 48px;
    border-radius: var(--radius-btn);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    margin-bottom: 15px;
    background: rgba(20, 184, 166, 0.12);
    color: var(--primary-teal);
}

.stat-card.stat-card-2 .stat-icon { background: rgba(6, 182, 212, 0.12); color: var(--primary-solid); }
.stat-card.stat-card-3 .stat-icon { background: rgba(245, 158, 11, 0.12); color: #f59e0b; }
.stat-card.stat-card-4 .stat-icon { background: rgba(13, 148, 136, 0.12); color: #0d9488; }
.stat-card.stat-card-5 .stat-icon { background: rgba(220, 38, 38, 0.12); color: #dc2626; }

.stat-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.stat-label {
    font-size: 0.8125rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ========== Buttons ========== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 12px 20px;
    font-family: var(--font-app);
    font-size: 0.875rem;
    font-weight: 600;
    line-height: 1.5;
    border-radius: var(--radius-btn);
    border: none;
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s ease;
}

.btn-primary {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
}

.btn-primary:hover {
    filter: brightness(1.08);
    box-shadow: 0 4px 12px rgba(20,184,166,0.4);
    transform: translateY(-1px);
}

.btn-outline {
    background: transparent;
    color: var(--primary-teal);
    border: 2px solid var(--primary-teal);
}

.btn-outline:hover {
    background: rgba(20, 184, 166, 0.1);
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--text-primary);
    border: 1px solid var(--border-form);
}

.btn-secondary:hover {
    background: #e5e7eb;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    color: #fff;
    border: none;
}

.btn-danger:hover {
    filter: brightness(1.08);
}

.btn-sm {
    padding: 8px 14px;
    font-size: 0.8125rem;
}

.btn-lg {
    padding: 12px 30px;
    font-size: 1rem;
}

.btn-login {
    padding: 12px 30px;
    border-radius: 12px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #10b981 100%);
    color: #fff;
}

.btn-login:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.4);
}

/* ========== Tables ========== */
.table-wrapper {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 20px;
}

.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.table th {
    background: var(--bg-light);
    color: #495057;
    font-size: 0.8125rem;
    font-weight: 600;
    padding: 15px 12px;
    text-align: left;
    border-bottom: 1px solid #dee2e6;
}

.table td {
    padding: 12px;
    border-bottom: 1px solid var(--border-card);
    color: var(--text-primary);
}

.table tbody tr:hover {
    background: var(--bg-light);
}

.table tbody tr:last-child td {
    border-bottom: none;
}

/* ========== Forms ========== */
.form-group {
    margin-bottom: 20px;
}

.form-label {
    display: block;
    margin-bottom: 6px;
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-heading);
}

.form-control {
    width: 100%;
    padding: 12px 15px;
    font-family: var(--font-app);
    font-size: 0.875rem;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-card);
    border: 1px solid var(--border-form);
    border-radius: var(--radius-form);
    transition: all 0.2s ease;
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(20,184,166,0.15);
}

.form-control::placeholder {
    color: var(--text-muted);
}

select.form-control {
    cursor: pointer;
}

textarea.form-control {
    min-height: 100px;
    resize: vertical;
}

.form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

@media (max-width: 767.98px) {
    .form-row {
        grid-template-columns: 1fr;
    }
}

.form-text {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin-top: 4px;
}

/* ========== Modal ========== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 10px 40px rgba(0,0,0,0.2);
}

.modal-header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 20px 25px;
    border-radius: var(--radius-card) var(--radius-card) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h2 {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 600;
}

.modal-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0;
    line-height: 1;
    opacity: 0.9;
}

.modal-close:hover {
    opacity: 1;
}

.modal-body {
    padding: 25px;
}

.role-badge.role-admin { background: rgba(245,158,11,0.2); color: #92400e; }
.role-badge.role-doctor { background: rgba(6, 182, 212, 0.2); color: #0e7490; }
.role-badge.role-receptionist { background: rgba(236, 72, 153, 0.2); color: #be185d; }
.badge-active, .status-active { background: rgba(20, 184, 166, 0.15); color: #0f766e; }
.badge-inactive, .status-inactive { background: #fef2f2; color: #991b1b; }

/* ========== Badges / Status ========== */
.badge, .status-badge {
    display: inline-block;
    padding: 5px 12px;
    font-size: 0.8125rem;
    font-weight: 500;
    border-radius: 20px;
    line-height: 1.2;
}

.badge-primary {
    background: var(--primary-gradient);
    color: #fff;
}

.status-waiting, .badge-warning {
    background: rgba(245,158,11,0.12);
    color: #856404;
}

.status-completed, .badge-success {
    background: rgba(20, 184, 166, 0.15);
    color: #0f766e;
}

.status-with-doctor {
    background: rgba(6, 182, 212, 0.12);
    color: #0c5460;
}

.status-with-reception {
    background: rgba(245,158,11,0.12);
    color: #b8860b;
}

.status-waiting_reception {
    background: rgba(245,158,11,0.12);
    color: #856404;
}

/* ========== Alerts ========== */
.alert {
    padding: 16px 20px;
    border-radius: var(--radius-form);
    margin-bottom: 20px;
    font-size: 0.875rem;
}

.alert-success {
    background: #d1fae5;
    color: #065f46;
    border: 1px solid #a7f3d0;
}

.alert-error, .alert-danger {
    background: #fef2f2;
    color: #991b1b;
    border: 1px solid #fecaca;
}

.alert-warning {
    background: rgba(245,158,11,0.12);
    color: #92400e;
    border: 1px solid #fcd34d;
}

.alert-info {
    background: #ecfeff;
    color: #0e7490;
    border: 1px solid #a5f3fc;
}

.info-box {
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: var(--radius-form);
    padding: 15px;
    margin-bottom: 20px;
    color: #0e7490;
    font-size: 0.875rem;
}

.warning-box {
    background: rgba(245,158,11,0.12);
    border: 1px solid #f59e0b;
    border-radius: var(--radius-form);
    padding: 15px;
    margin-bottom: 20px;
    color: #92400e;
    font-size: 0.875rem;
}

.settings-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

.settings-grid .full-width {
    grid-column: 1 / -1;
}

@media (max-width: 767.98px) {
    .settings-grid {
        grid-template-columns: 1fr;
    }
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.info-item {
    background: var(--bg-card);
    padding: 15px;
    border-radius: var(--radius-form);
    border-left: 4px solid var(--primary-teal);
}

.info-label {
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.info-value {
    color: var(--text-muted);
    font-size: 0.875rem;
}

/* ========== Utility classes ========== */
.text-muted { color: var(--text-muted); }
.text-gradient {
    background: var(--primary-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.bg-gradient-primary { background: var(--primary-gradient); }
.bg-warning-soft { background: rgba(245,158,11,0.12); }
.shadow-custom { box-shadow: var(--shadow-card); }
.rounded-custom { border-radius: var(--radius-card); }
.mb-0 { margin-bottom: 0; }
.mt-3 { margin-top: 1rem; }

/* ========== Login page specific ========== */
.body-login {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #fff;
    padding: 20px;
}

.login-card {
    background: linear-gradient(180deg, #f0fdfa 0%, #ecfeff 50%, #f0fdfa 100%);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(20, 184, 166, 0.2);
    padding: 2rem;
    width: 100%;
    max-width: 450px;
    border: 1px solid rgba(20, 184, 166, 0.2);
}

/* Split login card: gradient header + white form body */
.login-card-split {
    padding: 0;
    max-width: 420px;
    border-radius: 18px;
    border: none;
    box-shadow: 0 4px 24px rgba(6, 182, 212, 0.15), 0 0 0 1px rgba(20, 184, 166, 0.12);
    overflow: hidden;
}

.login-card-header {
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 40%, #10b981 100%);
    padding: 32px 28px;
    text-align: center;
    color: #fff;
}

.login-card-header .fas {
    font-size: 2rem;
    margin-bottom: 12px;
    opacity: 0.95;
}

.login-card-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin: 0 0 8px 0;
    color: #fff;
    letter-spacing: -0.02em;
}

.login-card-subtitle {
    font-size: 0.9rem;
    margin: 0;
    color: rgba(255, 255, 255, 0.92);
    font-weight: 400;
}

.login-card-body {
    background: #fff;
    padding: 28px 28px 32px;
}

.login-card-body .form-group {
    margin-bottom: 18px;
}

.login-card-body .form-group:last-of-type {
    margin-bottom: 22px;
}

.login-input {
    width: 100%;
    padding: 12px 14px;
    font-size: 1rem;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    background: #fff;
    color: var(--text-primary);
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.login-input::placeholder {
    color: #9ca3af;
}

.login-input:focus {
    outline: none;
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.15);
}

.btn-login-block {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 12px 20px;
    font-size: 1rem;
    font-weight: 600;
    color: #fff;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, #0d9488 0%, #14b8a6 50%, #10b981 100%);
    cursor: pointer;
    transition: box-shadow 0.2s ease, transform 0.1s ease;
}

.btn-login-block:hover {
    box-shadow: 0 8px 24px rgba(20, 184, 166, 0.4);
}

.btn-login-block:active {
    transform: scale(0.99);
}

.login-info {
    margin-top: 24px;
    padding-top: 20px;
    border-top: 1px solid #f1f3f4;
    font-size: 0.8rem;
    color: var(--text-muted);
    line-height: 1.5;
}

.login-footer-link {
    margin: 16px 0 0 0;
    text-align: center;
    font-size: 0.9rem;
}

.login-footer-link a {
    color: var(--primary-teal);
    font-weight: 500;
    text-decoration: none;
}

.login-footer-link a:hover {
    text-decoration: underline;
}

.login-card .form-control {
    border-color: rgba(20, 184, 166, 0.3);
}

.login-card .form-control:focus {
    border-color: var(--primary-teal);
    box-shadow: 0 0 0 0.2rem rgba(20, 184, 166, 0.2);
}

/* ========== Public / standalone pages (index, error, etc.) ========== */
.body-standalone {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--primary-gradient);
    padding: 20px;
}

.standalone-card {
    background: var(--bg-card);
    border-radius: 20px;
    box-shadow: 0 8px 32px rgba(20, 184, 166, 0.2);
    padding: 40px;
    width: 100%;
    max-width: 600px;
    text-align: center;
}

/* Token kiosk (index) */
.body-standalone .standalone-card {
    min-width: 320px;
    max-width: 800px;
    padding: 40px 60px;
    text-align: center;
}

.standalone-card .logo-circle {
    width: 120px;
    height: 120px;
    border-radius: 50%;
    margin: 0 auto 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 60px;
    color: #fff;
    font-weight: 700;
    background: var(--primary-gradient);
}

.standalone-card h1 {
    color: var(--text-heading);
    font-size: 1.75rem;
    margin-bottom: 10px;
    font-weight: 600;
}

.standalone-card .slogan {
    color: var(--text-muted);
    font-size: 1.1rem;
    margin-bottom: 40px;
}

.token-display-kiosk {
    margin-top: 40px;
    padding: 30px;
    background: var(--primary-gradient);
    border-radius: 15px;
    color: #fff;
}

.token-display-kiosk .token-number {
    font-size: 4rem;
    font-weight: 700;
    margin: 20px 0;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.2);
}

.token-display-kiosk .token-info {
    background: rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 15px;
    margin-top: 20px;
    font-size: 0.9rem;
}

.time-display-kiosk {
    position: absolute;
    top: 20px;
    right: 20px;
    background: rgba(255,255,255,0.95);
    padding: 10px 20px;
    border-radius: 12px;
    font-weight: 600;
    color: var(--text-heading);
    font-size: 0.9rem;
}

.btn-token {
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    padding: 20px 50px;
    font-size: 1.25rem;
    border-radius: 50px;
    cursor: pointer;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    transition: all 0.2s ease;
    box-shadow: 0 4px 12px rgba(20,184,166,0.4);
}

.btn-token:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(20,184,166,0.4);
}

.btn-token.btn-print {
    background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
    box-shadow: 0 4px 12px rgba(6,182,212,0.4);
}

.button-group {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 20px;
    flex-wrap: wrap;
}

.instructions {
    margin-top: 30px;
    color: var(--text-muted);
    font-size: 1rem;
    line-height: 1.6;
}

.auto-print-option {
    margin-top: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    color: var(--text-muted);
    font-size: 0.9rem;
}

.refresh-notice {
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: var(--radius-form);
    padding: 10px 15px;
    margin-top: 15px;
    color: #0e7490;
    font-size: 0.9rem;
}

@media print {
    .body-standalone { background: #fff !important; }
    .time-display-kiosk, .btn-token, .instructions, .auto-print-option, .refresh-notice, .no-print { display: none !important; }
    .token-display-kiosk { background: #fff !important; color: var(--text-heading) !important; border: 3px solid var(--primary-teal); }
    .token-display-kiosk .token-number { color: var(--primary-teal) !important; text-shadow: none; }
    .token-display-kiosk .token-info { background: var(--bg-light) !important; color: var(--text-primary) !important; border: 1px solid var(--border-form); }
    .standalone-card .logo-circle { background: #fff !important; color: var(--primary-teal) !important; border: 3px solid var(--primary-teal); }
    .standalone-card h1, .standalone-card .slogan { color: var(--text-heading) !important; }
}

/* ========== Action cards (quick links) ========== */
.quick-actions, .action-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 20px;
}

.action-card {
    display: block;
    background: var(--bg-card);
    border-radius: var(--radius-card);
    padding: 25px;
    text-align: center;
    box-shadow: var(--shadow-card);
    text-decoration: none;
    color: var(--text-primary);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: none;
}

.action-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--shadow-card-hover);
    color: var(--text-primary);
    text-decoration: none;
}

.action-icon {
    width: 50px;
    height: 50px;
    border-radius: 12px;
    margin: 0 auto 15px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
    background: var(--primary-gradient);
    color: #fff;
}

.action-title {
    font-weight: 600;
    margin-bottom: 4px;
    font-size: 1rem;
}

.action-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ========== Activity list ========== */
.activity-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 0;
    border-bottom: 1px solid var(--border-card);
}

.activity-item:last-child {
    border-bottom: none;
}

.activity-title {
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.activity-desc {
    color: var(--text-muted);
    font-size: 0.9rem;
}

.activity-time {
    color: var(--text-muted);
    font-size: 0.8rem;
}

.token-list {
    max-height: 400px;
    overflow-y: auto;
}

.token-item, .patient-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-form);
    margin-bottom: 15px;
    transition: all 0.2s ease;
    flex-wrap: wrap;
    gap: 10px;
}

.token-item:hover, .patient-item:hover {
    border-color: var(--primary-teal);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
}

.token-item .token-number, .patient-item .token-number {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-teal);
    min-width: 70px;
}

.token-info, .patient-info {
    flex-grow: 1;
    min-width: 0;
}

.patient-name {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
}

.patient-details {
    color: var(--text-muted);
    font-size: 0.875rem;
    line-height: 1.5;
}

.queue-section, .section-header + div {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    margin-bottom: 25px;
}

.section-header {
    background: var(--primary-gradient);
    color: #fff;
    padding: 20px 25px;
    font-size: 1rem;
    font-weight: 600;
}

.patient-list {
    padding: 25px;
}

.patient-summary {
    background: var(--bg-light);
    padding: 20px;
    border-radius: var(--radius-form);
    margin-bottom: 25px;
}

.patient-summary h3 {
    margin: 0 0 15px 0;
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-heading);
}

.patient-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 15px;
}

.patient-field {
    background: var(--bg-card);
    padding: 15px;
    border-radius: var(--radius-form);
    border-left: 4px solid var(--primary-teal);
}

.field-label {
    font-weight: 600;
    color: var(--text-heading);
    margin-bottom: 4px;
    font-size: 0.875rem;
}

.field-value {
    color: var(--text-muted);
    font-size: 0.875rem;
}

.payment-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border: 1px solid var(--border-card);
    border-radius: var(--radius-card);
    margin-bottom: 20px;
    transition: all 0.2s ease;
    flex-wrap: wrap;
    gap: 15px;
}

.payment-item:hover {
    border-color: var(--primary-teal);
    box-shadow: 0 2px 8px rgba(20, 184, 166, 0.1);
}

.payment-info {
    flex-grow: 1;
    min-width: 0;
}

.amount-display {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--primary-teal);
}

.payment-summary .summary-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 0;
    border-bottom: 1px solid var(--border-card);
}

.payment-summary .summary-row:last-child {
    border-bottom: none;
}

.filters-card {
    background: var(--bg-card);
    border-radius: var(--radius-card);
    box-shadow: var(--shadow-card);
    padding: 20px;
    margin-bottom: 25px;
}

.filters-form {
    display: flex;
    gap: 20px;
    align-items: flex-end;
    flex-wrap: wrap;
}

.filter-group {
    flex: 1;
    min-width: 140px;
}

.filter-group .form-label {
    margin-bottom: 6px;
}

.charts-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 991.98px) {
    .charts-grid {
        grid-template-columns: 1fr;
    }
    .filters-form {
        flex-direction: column;
    }
}

.demographic-item {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 12px 0;
    border-bottom: 1px solid var(--border-card);
}

.demographic-label {
    font-weight: 600;
    color: var(--text-heading);
}

.demographic-value {
    background: var(--primary-gradient);
    color: #fff;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.9rem;
    font-weight: 500;
}

.period-summary {
    background: #ecfeff;
    border: 1px solid #a5f3fc;
    border-radius: var(--radius-form);
    padding: 20px;
    margin-bottom: 20px;
    color: #0e7490;
    font-size: 0.875rem;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 2fr 1fr;
    gap: 30px;
    margin-bottom: 30px;
}

@media (max-width: 991.98px) {
    .dashboard-grid {
        grid-template-columns: 1fr;
    }
}

/* Admin dashboard: one-row compact layout */
.dashboard-admin .stats-grid {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
    margin-bottom: 20px;
}

.dashboard-admin .stat-card {
    padding: 16px 18px;
    display: flex;
    align-items: center;
    gap: 14px;
    flex-direction: row;
    text-align: left;
}

.dashboard-admin .stat-card .stat-icon {
    width: 42px;
    height: 42px;
    min-width: 42px;
    min-height: 42px;
    margin-bottom: 0;
    font-size: 1.1rem;
}

.dashboard-admin .stat-card .stat-number {
    font-size: 1.35rem;
    margin-bottom: 2px;
    line-height: 1.2;
}

.dashboard-admin .stat-card .stat-content {
    display: flex;
    flex-direction: column;
    justify-content: center;
    min-width: 0;
}

.dashboard-admin .stat-card .stat-label {
    font-size: 0.75rem;
    line-height: 1.2;
}

.dashboard-admin .quick-actions {
    grid-template-columns: repeat(5, 1fr);
    gap: 16px;
}

.dashboard-admin .action-card {
    padding: 18px 16px;
}

.dashboard-admin .action-icon {
    width: 42px;
    height: 42px;
    font-size: 1.1rem;
    margin-bottom: 12px;
}

.dashboard-admin .action-title {
    font-size: 0.9rem;
}

.dashboard-admin .action-desc {
    font-size: 0.8rem;
    line-height: 1.3;
}

@media (max-width: 1199.98px) {
    .dashboard-admin .stats-grid {
        grid-template-columns: repeat(3, 1fr);
    }
    .dashboard-admin .quick-actions {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 991.98px) {
    .dashboard-admin .stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .dashboard-admin .quick-actions {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 767.98px) {
    .dashboard-admin .stats-grid {
        grid-template-columns: 1fr;
    }
    .dashboard-admin .stat-card {
        flex-direction: row;
    }
    .dashboard-admin .quick-actions {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .dashboard-admin .stat-card {
        padding: 14px 16px;
    }
    .dashboard-admin .stat-card .stat-icon {
        width: 36px;
        height: 36px;
        min-width: 36px;
        min-height: 36px;
        font-size: 1rem;
    }
    .dashboard-admin .stat-card .stat-number {
        font-size: 1.2rem;
    }
}

/* ========== Chart container ========== */
.chart-container {
    min-height: 280px;
    padding: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--bg-light);
    border-radius: var(--radius-form);
}

/* ========== Mobile menu toggle ========== */
.sidebar-toggle {
    display: none;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    background: var(--primary-gradient);
    color: #fff;
    border: none;
    border-radius: var(--radius-btn);
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(6, 182, 212, 0.4);
    transition: all 0.2s ease;
}

.sidebar-toggle:hover {
    transform: scale(1.05);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.4);
}

.sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 150;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.sidebar-overlay.show {
    display: block;
    opacity: 1;
}

/* ========== Responsive ========== */
@media (max-width: 1199.98px) {
    .sidebar {
        width: var(--sidebar-width-laptop);
    }
    .main-content {
        margin-left: var(--sidebar-width-laptop);
    }
}

@media (max-width: 991.98px) {
    .sidebar {
        transform: translateX(-100%);
        width: 260px;
    }
    .sidebar.open {
        transform: translateX(0);
    }
    .main-content {
        margin-left: 0;
        padding: 10px 15px;
    }
    .sidebar-toggle {
        display: flex;
    }
    .stats-grid {
        grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
        gap: 15px;
    }
    .table-wrapper {
        overflow-x: auto;
    }
    .table {
        min-width: 600px;
    }
}

@media (max-width: 767.98px) {
    .topbar-inner {
        flex-wrap: wrap;
        gap: 10px;
    }
    .form-control {
        font-size: 16px; /* prevents iOS zoom */
    }
    .btn {
        width: 100%;
        justify-content: center;
    }
    .quick-actions, .action-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 575.98px) {
    .stat-card {
        padding: 20px;
    }
    .card-body, .card-content {
        padding: 20px;
    }
}

/* ========== Print ========== */
@media print {
    .sidebar, .topbar, .sidebar-toggle, .sidebar-overlay, .btn, .no-print {
        display: none !important;
    }
    .main-content {
        margin-left: 0 !important;
        padding: 0 !important;
    }
    body {
        background: #fff;
    }
}
