:root {
    --teal: #0f766e;
    --teal-dark: #115e59;
    --teal-soft: #ccfbf1;
    --ink: #0f172a;
    --muted: #64748b;
    --bg: #f1f5f9;
    --sidebar: #0b3d3a;
    --card: #ffffff;
    --radius: 16px;
}

* { box-sizing: border-box; }

body {
    font-family: "Plus Jakarta Sans", system-ui, sans-serif;
    background: var(--bg);
    color: var(--ink);
    margin: 0;
}

/* Login */
.login-page {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background:
        radial-gradient(900px 400px at 10% -10%, #99f6e4 0%, transparent 50%),
        radial-gradient(700px 400px at 110% 110%, #a5f3fc 0%, transparent 45%),
        linear-gradient(160deg, #ecfdf5, #f8fafc);
    padding: 24px;
}

.login-card {
    width: 100%;
    max-width: 420px;
    background: #fff;
    border-radius: 24px;
    box-shadow: 0 24px 60px rgba(15, 118, 110, 0.12);
    padding: 40px 36px;
}

.login-logo {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    background: linear-gradient(135deg, #0d9488, #14b8a6);
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 26px;
    margin-bottom: 16px;
}

.login-card h1 {
    font-size: 1.5rem;
    font-weight: 800;
    margin: 0 0 4px;
}

.login-card .sub {
    color: var(--muted);
    margin-bottom: 28px;
}

.form-control, .form-select {
    border-radius: 12px;
    padding: 0.7rem 0.9rem;
    border-color: #e2e8f0;
}

.form-control:focus, .form-select:focus {
    border-color: #14b8a6;
    box-shadow: 0 0 0 0.2rem rgba(20, 184, 166, 0.18);
}

.btn-clinic {
    background: linear-gradient(135deg, #0d9488, #0f766e);
    border: 0;
    color: #fff;
    font-weight: 600;
    border-radius: 12px;
    padding: 0.7rem 1.1rem;
}

.btn-clinic:hover { background: #115e59; color: #fff; }

.hint-box {
    background: #f0fdfa;
    border: 1px solid #99f6e4;
    border-radius: 12px;
    padding: 12px 14px;
    font-size: 0.82rem;
    color: #115e59;
    margin-top: 18px;
}

/* App shell */
.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 260px 1fr;
}

.app-sidebar {
    background: var(--sidebar);
    color: #fff;
    padding: 24px 18px;
    display: flex;
    flex-direction: column;
    position: sticky;
    top: 0;
    height: 100vh;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding: 4px 8px 22px;
}

.brand-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    background: #14b8a6;
    display: grid;
    place-items: center;
    font-size: 20px;
}

.brand-name { font-weight: 800; letter-spacing: -0.02em; }
.brand-sub { font-size: 0.75rem; opacity: 0.7; text-transform: capitalize; }

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.side-link {
    color: rgba(255,255,255,0.78);
    text-decoration: none;
    padding: 10px 12px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 500;
}

.side-link:hover, .side-link.active {
    background: rgba(20, 184, 166, 0.22);
    color: #fff;
}

.sidebar-foot { margin-top: auto; padding-top: 16px; }

.user-chip {
    display: flex;
    gap: 10px;
    align-items: center;
    margin-bottom: 12px;
    padding: 8px;
}

.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #14b8a6;
    display: grid;
    place-items: center;
    font-weight: 700;
}

.user-name { font-size: 0.9rem; font-weight: 600; }
.user-role { font-size: 0.75rem; opacity: 0.7; }

.app-main { min-width: 0; }

.app-topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 22px 28px 8px;
}

.app-topbar h1 {
    font-size: 1.55rem;
    font-weight: 800;
    margin: 0;
}

.topbar-date { color: var(--muted); margin: 0; font-size: 0.9rem; }

.app-content { padding: 12px 28px 40px; }

.stat-card {
    background: var(--card);
    border: 0;
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    padding: 20px;
    height: 100%;
}

.stat-label { color: var(--muted); font-size: 0.85rem; margin-bottom: 6px; }
.stat-value { font-size: 1.8rem; font-weight: 800; letter-spacing: -0.03em; }
.stat-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: var(--teal-soft);
    color: var(--teal);
    font-size: 1.2rem;
}

.panel {
    background: var(--card);
    border-radius: var(--radius);
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.04);
    padding: 22px;
}

.token-hero {
    background: linear-gradient(135deg, #0f766e, #14b8a6);
    color: #fff;
    border-radius: 20px;
    padding: 28px;
    text-align: center;
}

.token-hero .label { opacity: 0.85; letter-spacing: 0.08em; text-transform: uppercase; font-size: 0.8rem; }
.token-hero .number { font-size: 4rem; font-weight: 800; line-height: 1.1; }
.token-hero .code { opacity: 0.9; }

.table > :not(caption) > * > * { vertical-align: middle; }
.table thead th {
    font-size: 0.78rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--muted);
    font-weight: 700;
}

.patient-card dt { color: var(--muted); font-weight: 500; font-size: 0.82rem; }
.patient-card dd { font-weight: 600; margin-bottom: 10px; }

.history-item {
    border-left: 3px solid #14b8a6;
    padding-left: 14px;
    margin-bottom: 16px;
}

@media (max-width: 991px) {
    .app-shell { grid-template-columns: 1fr; }
    .app-sidebar { display: none; }
    .app-content { padding: 12px 16px 32px; }
    .app-topbar { padding: 16px; }
}

/* Print */
@media print {
    .app-sidebar, .app-topbar, .no-print, .btn, .alert { display: none !important; }
    .app-shell, .app-main, .app-content, .print-wrap { display: block !important; padding: 0 !important; margin: 0 !important; }
    body { background: #fff; }
}

.print-sheet {
    max-width: 800px;
    margin: 0 auto;
    background: #fff;
    border: 1px solid #e2e8f0;
    border-radius: 12px;
    padding: 32px;
}

.print-head {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    border-bottom: 2px solid #0f766e;
    padding-bottom: 16px;
    margin-bottom: 20px;
}

.print-head h2 { margin: 0; color: #0f766e; font-weight: 800; }
.print-meta { font-size: 0.9rem; color: #475569; }

.rx-mark {
    font-size: 2rem;
    font-weight: 800;
    color: #0f766e;
    font-family: Georgia, serif;
}

.pre-wrap { white-space: pre-wrap; font-family: inherit; }
