:root {
    --bg: #f4f7fb;
    --surface: #ffffff;
    --text: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --primary: #2563eb;
    --primary-dark: #1d4ed8;
    --sidebar: #0f172a;
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: "Segoe UI", Arial, sans-serif;
}

body[data-theme="dark"] {
    --bg: #020617;
    --surface: #0f172a;
    --text: #e2e8f0;
    --muted: #94a3b8;
    --line: #1e293b;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 290px;
    background: linear-gradient(180deg, #0f172a 0%, #172554 100%);
    color: #fff;
    padding: 1.5rem;
    position: sticky;
    top: 0;
    min-height: 100vh;
}

.sidebar.collapsed {
    width: 92px;
}

.sidebar.collapsed .brand h1,
.sidebar.collapsed .brand p,
.sidebar.collapsed .clinic-card,
.sidebar.collapsed .nav-link span {
    display: none;
}

.brand,
.topbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.brand h1,
.guest-brand h1 {
    font-size: 1.5rem;
    margin: 0;
}

.brand p,
.guest-brand p {
    color: rgba(255, 255, 255, 0.74);
    margin: 0.4rem 0 0;
    font-size: 0.95rem;
}

.clinic-card {
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.08);
    border-radius: 20px;
    padding: 1rem;
    margin: 1.5rem 0;
}

.clinic-card h2 {
    font-size: 1.1rem;
    margin: 0.75rem 0 0.25rem;
}

.clinic-card p {
    margin: 0;
    color: rgba(255, 255, 255, 0.7);
}

.nav-link {
    border-radius: 14px;
    color: rgba(255, 255, 255, 0.8);
    display: flex;
    gap: 0.75rem;
    align-items: center;
    padding: 0.9rem 1rem;
}

.nav-link.active,
.nav-link:hover {
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
}

.main-content {
    flex: 1;
    padding: 1.75rem;
}

.topbar {
    margin-bottom: 1.5rem;
    gap: 1rem;
}

.topbar h3 {
    margin: 0;
}

.topbar-actions {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.metric-card {
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: 20px;
    padding: 1.25rem;
    box-shadow: 0 8px 25px rgba(15, 23, 42, 0.05);
}

.metric-card span {
    color: var(--muted);
    display: block;
    margin-bottom: 0.35rem;
}

.metric-card strong {
    font-size: 1.55rem;
}

.alert-card {
    border-color: rgba(245, 158, 11, 0.3);
}

.card {
    background: var(--surface);
    border-color: var(--line) !important;
}

.table,
.form-control,
.form-select,
.text-muted {
    color: var(--text) !important;
}

.table thead th {
    color: var(--muted);
    font-weight: 600;
}

.guest-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    background: radial-gradient(circle at top, #dbeafe 0%, #eff6ff 30%, #f8fafc 100%);
}

.guest-wrapper {
    width: min(100%, 460px);
    padding: 1.5rem;
}

.guest-panel {
    background: #0f172a;
    color: #fff;
    border-radius: 28px;
    padding: 2rem;
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.18);
}

.guest-panel .card {
    background: #fff;
    color: #0f172a;
    border-radius: 18px;
}

.timeline-list {
    display: grid;
    gap: 1rem;
}

.timeline-item {
    border: 1px solid var(--line);
    border-radius: 16px;
    padding: 1rem;
    background: rgba(37, 99, 235, 0.03);
}

.timeline-item h5 {
    margin-bottom: 0.75rem;
}

.odontogram-grid {
    display: grid;
    grid-template-columns: repeat(8, minmax(0, 1fr));
    gap: 0.6rem;
}

.tooth-box {
    border: 1px solid var(--line);
    border-radius: 14px;
    padding: 0.75rem 0.35rem;
    text-align: center;
    font-weight: 700;
    background: var(--surface);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.04);
}

@media (max-width: 991px) {
    .app-shell {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        min-height: auto;
        position: relative;
    }

    .odontogram-grid {
        grid-template-columns: repeat(4, minmax(0, 1fr));
    }
}
