* {
    box-sizing: border-box;
}

body {
    margin: 0;
    color: #233b45;
    background: #f3f8f7;
    font-family: Arial, Helvetica, sans-serif;
}

:root {
    --seal-red: #d52b35;
    --seal-green: #168b89;
    --seal-blue: #174779;
    --seal-gold: #7ac9c2;
    --ink: #26384a;
    --line: #dce4ec;
}

.app-shell {
    min-height: 100vh;
    display: flex;
}

.sidebar {
    width: 280px;
    flex: 0 0 280px;
    background: linear-gradient(180deg, var(--seal-blue), #10395f);
    color: #fff;
    padding: 24px 18px;
    position: sticky;
    top: 0;
    height: 100vh;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    gap: 12px;
    align-items: center;
    padding-bottom: 24px;
    margin-bottom: 18px;
    border-bottom: 1px solid rgba(255, 255, 255, .16);
}

.clinic-brand-frame {
    width: 58px;
    height: 58px;
    flex: 0 0 58px;
    display: grid;
    place-items: center;
    padding: 5px;
    border: 1px solid rgba(255, 255, 255, .65);
    border-radius: 11px;
    background: #fff;
    box-shadow: 0 4px 12px rgba(0, 0, 0, .12);
}

.clinic-mark-sidebar {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.clinic-logo-frame {
    width: min(100%, 228px);
    aspect-ratio: 1;
    display: grid;
    place-items: center;
    margin: 0 auto 20px;
    padding: 10px;
    border: 1px solid #dce4ec;
    border-radius: 14px;
    background: #fff;
    box-shadow: 0 5px 18px rgba(23, 71, 121, .08);
}

.clinic-logo-login {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
}

.brand small {
    display: block;
    color: #cfe3df;
}

.sidebar .nav-link {
    color: #d9e8e5;
    border-radius: 8px;
    padding: 11px 12px;
    margin-bottom: 6px;
}

.sidebar .nav-link:hover,
.sidebar .nav-link.active {
    color: #fff;
    background: rgba(22, 135, 127, .72);
    border-left: 4px solid var(--seal-gold);
}

.sidebar-footer {
    border-top: 1px solid rgba(255, 255, 255, .16);
    margin-top: auto;
    padding-top: 18px;
    display: block;
}

.sidebar-footer .logout-button {
    display: block;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 8px;
    background: linear-gradient(135deg, rgba(255, 255, 255, .14), rgba(255, 255, 255, .06));
    color: #fff;
    font-weight: 700;
    text-decoration: none;
    text-align: center;
    box-shadow: 0 3px 10px rgba(0, 0, 0, .12);
    transition: background .18s ease, border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

.sidebar-footer .logout-button:hover {
    background: linear-gradient(135deg, var(--seal-red), #b6202a);
    border-color: var(--seal-red);
    color: #fff;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .22);
    transform: translateY(-2px);
}

.sidebar-footer .logout-button:focus-visible {
    outline: 3px solid var(--seal-gold);
    outline-offset: 3px;
}

.sidebar-footer .logout-button:active {
    transform: translateY(0);
}

.register-prompt {
    margin: 18px 0 0;
    text-align: center;
    color: #5d6a78;
}

.register-prompt a {
    color: var(--seal-blue);
    font-weight: 700;
}

.page-header-identity {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 8px;
}

.page-header-identity strong {
    color: var(--ink);
    font-size: 1.2rem;
    font-weight: 700;
    overflow-wrap: anywhere;
}

.profile-information {
    max-width: 760px;
}

.profile-details > div {
    display: grid;
    grid-template-columns: minmax(110px, 150px) minmax(0, 1fr);
    gap: 16px;
    border-bottom: 1px solid var(--line);
    padding: 13px 0;
}

.profile-details > div:first-child {
    padding-top: 4px;
}

.profile-details > div:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.profile-details dt {
    color: #5d6a78;
}

.profile-details dd {
    margin: 0;
    font-weight: 700;
}

.medical-record-history {
    display: grid;
    gap: 12px;
    max-height: 320px;
    overflow-y: auto;
}

.medical-record-entry {
    padding: 14px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: #f8fbfd;
}

.medical-record-entry strong {
    display: block;
    margin-bottom: 8px;
}

.medical-record-entry p {
    margin: 5px 0 0;
    white-space: pre-wrap;
}

.content {
    width: 100%;
    padding: 28px;
}

.page-header {
    display: flex;
    justify-content: space-between;
    gap: 16px;
    align-items: center;
    margin-bottom: 24px;
}

.eyebrow {
    margin: 0 0 4px;
    color: var(--seal-red);
    font-weight: 700;
    text-transform: uppercase;
    font-size: .78rem;
}

h1 {
    margin: 0;
    font-size: clamp(1.55rem, 2.5vw, 2.35rem);
    font-weight: 800;
}

h2 {
    margin: 0;
    font-size: 1.35rem;
    font-weight: 800;
}

h3 {
    font-size: 1rem;
    font-weight: 800;
    margin-bottom: 16px;
}

.date-chip {
    white-space: nowrap;
    background: #fff;
    border: 1px solid var(--line);
    padding: 9px 12px;
    border-radius: 8px;
}

.section {
    scroll-margin-top: 24px;
    margin-bottom: 34px;
}

.section-heading {
    display: flex;
    align-items: end;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-heading span {
    color: #5d6a78;
    font-size: .94rem;
}

.section-note {
    color: #5d6a78;
    font-size: .94rem;
    margin: 0 0 14px;
}

.stat-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

.stat-card,
.panel {
    background: #fff;
    border: 1px solid var(--line);
    border-radius: 8px;
    box-shadow: 0 8px 22px rgba(23, 71, 95, .07);
}

.chart-panel {
    height: 100%;
}

.chart-panel h3 {
    margin-bottom: 14px;
}

.chart-wrap {
    position: relative;
    height: 250px;
}

.chart-wrap-wide {
    height: 300px;
}

.stat-card {
    padding: 20px;
    border-top: 5px solid var(--seal-red);
}

.stat-card span {
    display: block;
    color: #5d6a78;
    font-weight: 700;
}

.stat-card strong {
    display: block;
    margin-top: 8px;
    font-size: 2rem;
    color: var(--seal-blue);
}

.panel {
    padding: 18px;
    margin-bottom: 16px;
}

.table {
    margin-bottom: 0;
}

.table thead th {
    color: #5d6a78;
    font-size: .82rem;
    text-transform: uppercase;
}

.qty-input {
    width: 96px;
}

.notice {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 0;
    border-top: 1px solid #edf2f1;
}

.notice p {
    margin: 0;
}

.notice-unread {
    background: #f6f9fc;
    border-radius: 8px;
    padding-left: 10px;
    padding-right: 10px;
}

.notice-read {
    color: #65737f;
}

.btn-primary {
    --bs-btn-bg: var(--seal-red);
    --bs-btn-border-color: var(--seal-red);
    --bs-btn-hover-bg: #b6202a;
    --bs-btn-hover-border-color: #b6202a;
    --bs-btn-active-bg: #a51b24;
    --bs-btn-active-border-color: #a51b24;
}

.btn-outline-primary {
    --bs-btn-color: var(--seal-blue);
    --bs-btn-border-color: var(--seal-blue);
    --bs-btn-hover-bg: var(--seal-blue);
    --bs-btn-hover-border-color: var(--seal-blue);
}

.btn-outline-success {
    --bs-btn-color: var(--seal-green);
    --bs-btn-border-color: var(--seal-green);
    --bs-btn-hover-bg: var(--seal-green);
    --bs-btn-hover-border-color: var(--seal-green);
}

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background-color: #edf7fc;
    background-image: url("assets/clinic-login-background.svg?v=4");
    background-position: center center;
    background-size: cover;
    background-repeat: no-repeat;
    background-attachment: fixed;
}

.login-panel {
    width: min(100%, 460px);
    background: #fff;
    border-radius: 14px;
    padding: 30px;
    box-shadow: 0 24px 60px rgba(12, 54, 64, .24);
    border-top: 6px solid var(--seal-red);
}

.login-panel h1 {
    text-align: center;
    font-size: 1.45rem;
}

.login-panel .eyebrow {
    text-align: center;
}

.login-form {
    margin-top: 14px;
}

.form-control,
.form-select {
    border-color: #d2e1df;
    border-radius: 8px;
}

.form-control:focus,
.form-select:focus {
    border-color: var(--seal-green);
    box-shadow: 0 0 0 .2rem rgba(22, 135, 127, .16);
}

.login-hint {
    margin: 16px 0 0;
    color: #5d6a78;
    text-align: center;
    font-size: .92rem;
}

@media (max-width: 980px) {
    .app-shell {
        display: block;
    }

    .sidebar {
        width: 100%;
        height: auto;
        position: static;
    }

    .sidebar .nav {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 6px;
    }

    .stat-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .content {
        padding: 18px;
    }

    .page-header,
    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    .stat-grid {
        grid-template-columns: 1fr;
    }

    .profile-details > div {
        grid-template-columns: minmax(0, 1fr);
        gap: 4px;
    }

    .notice {
        grid-template-columns: 1fr;
    }
}
