:root {
    --hospital-blue: #115779;
    --hospital-teal: #0aa7ad;
    --hospital-green: #64ad45;
    --hospital-gold: #f2b84b;
    --ink: #132733;
    --muted: #6b7a86;
    --line: #dfe8ee;
    --soft: #f4faf9;
    --panel: #ffffff;
}

* {
    letter-spacing: 0;
}

body {
    color: var(--ink);
    font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.btn,
.form-control,
.form-select,
.card,
.alert,
.content-card,
.stat-card,
.survey-card,
.question-card {
    border-radius: 8px;
}

.btn-primary {
    --bs-btn-bg: var(--hospital-teal);
    --bs-btn-border-color: var(--hospital-teal);
    --bs-btn-hover-bg: #078d93;
    --bs-btn-hover-border-color: #078d93;
    --bs-btn-active-bg: #067f84;
    --bs-btn-active-border-color: #067f84;
}

.btn-outline-primary {
    --bs-btn-color: var(--hospital-blue);
    --bs-btn-border-color: #9ccbd1;
    --bs-btn-hover-bg: var(--hospital-blue);
    --bs-btn-hover-border-color: var(--hospital-blue);
}

.admin-shell {
    background: #f3f7fa;
}

.admin-layout {
    display: grid;
    grid-template-columns: 280px minmax(0, 1fr);
    min-height: calc(100vh - 68px);
}

.admin-topbar {
    background: var(--panel);
    border-bottom: 1px solid var(--line);
    min-height: 68px;
}

.brand-lockup {
    align-items: center;
    color: var(--ink);
    display: inline-flex;
    gap: 10px;
    text-decoration: none;
}

.brand-lockup small,
.brand-lockup strong {
    display: block;
    line-height: 1.15;
}

.brand-lockup small {
    color: var(--muted);
    font-size: 12px;
    margin-top: 2px;
}

.brand-mark {
    align-items: center;
    background: var(--hospital-blue);
    border-bottom: 5px solid var(--hospital-green);
    color: #ffffff;
    display: inline-flex;
    font-weight: 800;
    height: 38px;
    justify-content: center;
    width: 38px;
}

.admin-user {
    color: var(--muted);
    font-size: 14px;
}

.top-date {
    color: var(--muted);
    font-size: 14px;
    font-weight: 650;
}

.admin-sidebar {
    background: var(--panel);
    border-right: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    min-height: calc(100vh - 68px);
    padding: 18px 14px;
    position: sticky;
    top: 68px;
}

.admin-nav {
    display: grid;
    gap: 4px;
}

.admin-sidebar .nav-link,
.admin-sidebar .nav-link.disabled {
    align-items: center;
    color: #39515f;
    display: flex;
    gap: 10px;
    font-weight: 600;
    padding: 11px 14px;
    text-decoration: none;
}

.admin-sidebar .nav-link i {
    color: var(--hospital-teal);
    font-size: 17px;
    width: 20px;
}

.admin-sidebar .nav-link.active,
.admin-sidebar .nav-link:hover {
    background: var(--soft);
    color: var(--hospital-blue);
}

.nav-section {
    color: #8a9aa5;
    font-size: 11px;
    font-weight: 800;
    margin: 16px 12px 5px;
}

.sidebar-user {
    border-top: 1px solid var(--line);
    display: grid;
    gap: 3px;
    margin-top: 18px;
    padding: 16px 12px 2px;
}

.sidebar-user span {
    color: var(--muted);
    font-size: 13px;
}

.sidebar-user a {
    color: var(--hospital-blue);
    font-size: 13px;
    font-weight: 700;
    margin-top: 6px;
    text-decoration: none;
}

.admin-content {
    padding: 28px;
}

.page-heading {
    align-items: flex-start;
    display: flex;
    justify-content: space-between;
    margin-bottom: 20px;
}

.page-heading h1 {
    font-size: 26px;
    font-weight: 750;
    margin: 0;
}

.breadcrumb {
    margin: 6px 0 0;
}

.breadcrumb-item {
    color: var(--muted);
    font-size: 14px;
}

.content-card,
.stat-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 10px 24px rgba(17, 87, 121, 0.06);
    padding: 22px;
}

.section-title {
    align-items: flex-start;
    display: flex;
    gap: 12px;
    margin-bottom: 18px;
}

.section-title h2 {
    font-size: 18px;
    font-weight: 800;
    margin: 0;
}

.section-title p {
    color: var(--muted);
    font-size: 14px;
    margin: 3px 0 0;
}

.section-icon {
    align-items: center;
    background: var(--soft);
    color: var(--hospital-blue);
    display: inline-flex;
    flex: 0 0 40px;
    height: 40px;
    justify-content: center;
    width: 40px;
}

.narrow-card {
    max-width: 720px;
}

.stat-card {
    min-height: 118px;
}

.stat-card-icon {
    align-items: center;
    display: flex;
    gap: 14px;
}

.stat-icon {
    align-items: center;
    background: var(--soft);
    color: var(--hospital-teal);
    display: inline-flex !important;
    flex: 0 0 48px;
    font-size: 22px !important;
    height: 48px;
    justify-content: center;
    margin: 0 !important;
    width: 48px;
}

.stat-card span {
    color: var(--muted);
    display: block;
    font-size: 14px;
    margin-bottom: 12px;
}

.stat-card strong {
    color: var(--hospital-blue);
    display: block;
    font-size: 32px;
    line-height: 1;
}

.stat-card small {
    color: var(--muted);
    display: block;
    font-size: 13px;
    margin-top: 7px;
}

.stat-card-large {
    min-height: 172px;
}

.stat-card-large strong {
    font-size: 56px;
}

.code-pill {
    background: #e8f5f3;
    color: var(--hospital-blue);
    display: inline-block;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    font-size: 13px;
    padding: 4px 8px;
}

.dashboard-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.chart-card {
    min-height: 310px;
}

.chart-card canvas {
    max-height: 240px;
}

.question-list {
    display: grid;
    gap: 12px;
}

.question-row {
    align-items: flex-start;
    border: 1px solid var(--line);
    display: flex;
    gap: 16px;
    justify-content: space-between;
    padding: 16px;
}

.question-builder-card {
    position: sticky;
    top: 92px;
}

.option-builder[hidden] {
    display: none !important;
}

.option-builder-list {
    display: grid;
    gap: 10px;
}

.question-preview {
    background: #f8fbfc;
    border: 1px solid var(--line);
    display: grid;
    gap: 9px;
    padding: 14px;
}

.question-preview > span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 800;
}

.question-preview strong {
    color: var(--ink);
    font-size: 16px;
}

.preview-stars {
    color: var(--hospital-gold);
    font-size: 24px;
}

.preview-pills,
.preview-emoji,
.preview-list {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.preview-pills span,
.preview-list span {
    background: #eef6f7;
    color: #315463;
    font-weight: 700;
    padding: 6px 10px;
}

.preview-emoji span {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    display: inline-flex;
    font-size: 22px;
    height: 42px;
    justify-content: center;
    width: 42px;
}

.preview-input,
.preview-textarea {
    background: #ffffff;
    border: 1px solid var(--line);
    height: 42px;
}

.preview-textarea {
    height: 82px;
}

.question-row-pro {
    align-items: stretch;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
}

.question-order {
    align-items: center;
    background: var(--soft);
    color: var(--hospital-blue);
    display: flex;
    font-size: 18px;
    font-weight: 900;
    justify-content: center;
}

.question-row-body {
    min-width: 0;
}

.question-row-body strong {
    overflow-wrap: anywhere;
}

.question-row-actions {
    display: flex;
    gap: 6px;
}

.question-row-actions form {
    display: inline-flex;
}

.option-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-top: 10px;
}

.option-chips span {
    background: #f3f7fa;
    color: #315463;
    font-size: 13px;
    font-weight: 650;
    padding: 5px 8px;
}

.option-line {
    color: var(--muted);
    font-size: 14px;
    margin-top: 7px;
}

.qr-grid {
    display: grid;
    gap: 14px;
}

.qr-grid-pro {
    gap: 18px;
}

.qr-card {
    align-items: center;
    border: 1px solid var(--line);
    display: grid;
    gap: 16px;
    grid-template-columns: 132px 1fr;
    padding: 16px;
}

.qr-card-pro {
    align-items: stretch;
    grid-template-columns: 178px minmax(0, 1fr);
    padding: 18px;
}

.qr-image-wrap {
    align-items: center;
    background: #f8fbfc;
    border: 1px solid var(--line);
    display: flex;
    justify-content: center;
    min-height: 178px;
}

.qr-preview {
    background: #ffffff;
    border: 1px solid var(--line);
    height: 132px;
    object-fit: contain;
    padding: 8px;
    width: 132px;
}

.qr-preview-lg {
    border: 0;
    height: 158px;
    padding: 0;
    width: 158px;
}

.qr-card-body {
    display: grid;
    gap: 5px;
}

.qr-card-body span,
.qr-url {
    color: var(--muted);
}

.qr-url {
    overflow-wrap: anywhere;
}

.qr-meta {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 8px 0;
}

.qr-meta div {
    background: #f8fbfc;
    border: 1px solid var(--line);
    padding: 9px 10px;
}

.qr-meta dt {
    color: var(--muted);
    font-size: 12px;
    margin-bottom: 3px;
}

.qr-meta dd {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
}

.qr-url-row {
    align-items: center;
    display: flex;
    gap: 10px;
    justify-content: space-between;
}

.qr-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-top: 8px;
}

.qr-actions form {
    display: inline-flex;
}

.empty-state {
    align-items: center;
    border: 1px dashed #b9cbd4;
    color: var(--muted);
    display: grid;
    justify-items: center;
    min-height: 180px;
    padding: 28px;
    text-align: center;
}

.empty-state i {
    color: var(--hospital-teal);
    font-size: 34px;
    margin-bottom: 8px;
}

.empty-state strong {
    color: var(--ink);
}

.result-list {
    display: grid;
    gap: 14px;
}

.result-row {
    border-bottom: 1px solid var(--line);
    display: grid;
    gap: 7px;
    padding-bottom: 14px;
}

.result-row:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.result-value {
    color: var(--hospital-teal);
    font-size: 24px;
    font-weight: 800;
}

.result-counts {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.result-counts span {
    background: var(--soft);
    color: #315463;
    padding: 6px 10px;
}

.login-shell,
.public-shell {
    background:
        linear-gradient(180deg, rgba(10, 167, 173, 0.08), rgba(100, 173, 69, 0.05)),
        #f5faf9;
    min-height: 100vh;
}

.login-panel {
    align-items: center;
    display: flex;
    min-height: 100vh;
    padding: 24px;
}

.login-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 24px 50px rgba(17, 87, 121, 0.12);
    margin: 0 auto;
    max-width: 430px;
    padding: 34px;
    width: 100%;
}

.login-note {
    color: var(--muted);
    font-size: 13px;
}

.public-wrap {
    margin: 0 auto;
    max-width: 760px;
    padding: 18px;
}

.survey-card {
    background: var(--panel);
    border: 1px solid var(--line);
    box-shadow: 0 18px 46px rgba(17, 87, 121, 0.11);
    margin: 18px auto;
    padding: 22px;
}

.survey-header {
    border-bottom: 1px solid var(--line);
    margin-bottom: 22px;
    padding-bottom: 20px;
}

.hospital-logo {
    align-items: center;
    color: var(--hospital-blue);
    display: flex;
    font-weight: 800;
    gap: 10px;
    margin-bottom: 18px;
}

.survey-header h1,
.survey-card h1 {
    color: var(--hospital-blue);
    font-size: clamp(26px, 7vw, 38px);
    font-weight: 800;
    line-height: 1.12;
    margin-bottom: 12px;
}

.department-line {
    color: #315463;
    font-size: 18px;
    margin-bottom: 8px;
}

.survey-description {
    color: var(--muted);
    font-size: 18px;
    margin: 0;
}

.survey-progress {
    background: #f8fbfc;
    border: 1px solid var(--line);
    margin: 16px 0;
    padding: 12px;
}

.survey-progress span {
    color: var(--hospital-blue);
    font-size: 18px;
    font-weight: 800;
}

.survey-progress small {
    color: var(--muted);
    font-weight: 650;
}

.survey-progress .progress {
    background: #e6eef2;
    height: 10px;
    margin-top: 10px;
}

.survey-progress .progress-bar {
    background: var(--hospital-teal);
}

.survey-form {
    display: grid;
    gap: 16px;
}

.question-card {
    border: 1px solid var(--line);
    margin: 0;
    padding: 18px;
}

.question-card.is-invalid-question {
    border-color: #dc3545;
    box-shadow: 0 0 0 3px rgba(220, 53, 69, 0.08);
}

.question-card legend {
    color: var(--ink);
    float: none;
    font-size: 18px;
    font-weight: 750;
    margin-bottom: 14px;
}

.question-card legend span {
    background: #fff4d9;
    color: #785100;
    display: inline-block;
    font-size: 12px;
    font-weight: 700;
    margin-left: 6px;
    padding: 4px 8px;
    vertical-align: middle;
}

.question-error {
    color: #b02a37;
    display: none;
    font-size: 14px;
    font-weight: 700;
    margin-top: 12px;
}

.question-card.is-invalid-question .question-error {
    display: block;
}

.star-rating,
.rating-buttons {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

.emoji-rating {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
}

.emoji-choice {
    align-items: center;
    background: #f8fbfc;
    border: 1px solid var(--line);
    color: #315463;
    cursor: pointer;
    display: grid;
    gap: 6px;
    justify-items: center;
    min-height: 86px;
    padding: 10px 6px;
    text-align: center;
}

.emoji-choice span {
    font-size: 30px;
    line-height: 1;
}

.emoji-choice small {
    font-size: 12px;
    font-weight: 800;
}

.btn-check:checked + .emoji-choice {
    background: #fff8e8;
    border-color: var(--hospital-gold);
    box-shadow: 0 0 0 3px rgba(242, 184, 75, 0.16);
    color: var(--hospital-blue);
}

.star-button {
    align-items: center;
    background: #eef5f6;
    border: 1px solid #d4e6e9;
    color: #8aa1aa;
    display: inline-flex;
    font-size: 32px;
    height: 58px;
    justify-content: center;
    line-height: 1;
    width: 58px;
}

.star-button:focus-visible,
.choice-item:focus-within,
.rating-buttons .btn:focus-visible {
    box-shadow: 0 0 0 4px rgba(10, 167, 173, 0.18);
    outline: 2px solid var(--hospital-teal);
    outline-offset: 2px;
}

.star-button:hover {
    background: #fff8e8;
    border-color: #f2d17f;
    color: var(--hospital-gold);
}

.star-button.is-selected {
    background: #fff6df;
    border-color: #f2d17f;
    color: var(--hospital-gold);
}

.rating-buttons .btn {
    align-items: center;
    display: inline-flex;
    font-size: 20px;
    font-weight: 800;
    height: 54px;
    justify-content: center;
    min-width: 54px;
}

.choice-stack {
    display: grid;
    gap: 10px;
}

.choice-item {
    align-items: center;
    border: 1px solid var(--line);
    display: flex;
    gap: 12px;
    min-height: 54px;
    padding: 12px 14px;
}

.choice-item:hover {
    border-color: #9ccbd1;
    background: #f8fbfc;
}

.choice-item input {
    height: 20px;
    width: 20px;
}

.choice-item span {
    font-size: 17px;
    font-weight: 650;
}

.comment-list {
    display: grid;
    gap: 12px;
}

.comment-item {
    border: 1px solid var(--line);
    display: grid;
    gap: 10px;
    padding: 16px;
}

.comment-item p {
    font-size: 16px;
    margin: 0;
    overflow-wrap: anywhere;
}

.comment-meta,
.comment-context,
.admin-pagination {
    align-items: center;
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: space-between;
}

.comment-meta span,
.comment-context span,
.admin-pagination span {
    color: var(--muted);
    font-size: 13px;
    font-weight: 650;
}

.comment-context {
    justify-content: flex-start;
}

.comment-context span {
    background: #f3f7fa;
    padding: 5px 8px;
}

.admin-pagination {
    border-top: 1px solid var(--line);
    margin-top: 18px;
    padding-top: 16px;
}

.audit-table td {
    vertical-align: top;
}

.survey-submit {
    min-height: 58px;
}

.thanks-icon {
    align-items: center;
    background: #e8f6ed;
    color: var(--hospital-green);
    display: inline-flex;
    font-size: 42px;
    font-weight: 900;
    height: 76px;
    justify-content: center;
    margin-bottom: 18px;
    width: 76px;
}

.thanks-lead {
    color: var(--hospital-blue);
    font-size: 20px;
    font-weight: 800;
    margin-bottom: 8px;
}

.public-footer {
    color: var(--muted);
    font-size: 13px;
    margin: 12px auto 24px;
    max-width: 620px;
    text-align: center;
}

.admin-footer {
    color: var(--muted);
    font-size: 13px;
    margin-top: 28px;
}

.print-shell {
    background: #eef4f6;
}

.print-page {
    margin: 0 auto;
    max-width: 860px;
    padding: 24px;
}

.print-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: center;
    margin-bottom: 18px;
}

.qr-print-poster {
    align-items: center;
    background: #ffffff;
    border: 1px solid var(--line);
    display: flex;
    flex-direction: column;
    gap: 14px;
    min-height: 1120px;
    padding: 58px 42px;
    text-align: center;
}

.qr-print-poster h1 {
    color: var(--hospital-blue);
    font-size: 42px;
    font-weight: 900;
    margin: 18px 0 0;
}

.qr-print-poster p {
    color: #315463;
    font-size: 22px;
    margin: 0;
}

.qr-print-image {
    border: 12px solid #f3f7fa;
    height: 420px;
    margin: 28px 0 8px;
    object-fit: contain;
    width: 420px;
}

.scan-note {
    font-weight: 800;
}

.print-department {
    color: var(--hospital-blue);
    font-size: 30px;
}

.qr-print-poster small {
    color: var(--muted);
    overflow-wrap: anywhere;
}

@media (max-width: 991.98px) {
    .admin-layout {
        display: block;
    }

    .admin-sidebar {
        border-bottom: 1px solid var(--line);
        border-right: 0;
        min-height: auto;
        position: static;
    }

    .admin-sidebar .nav-link {
        white-space: nowrap;
    }

    .admin-content {
        padding: 20px 14px;
    }
}

@media (max-width: 575.98px) {
    .login-card,
    .survey-card {
        padding: 18px;
    }

    .admin-user {
        display: none;
    }

    .qr-card {
        grid-template-columns: 1fr;
    }

    .qr-card-pro {
        grid-template-columns: 1fr;
    }

    .qr-meta {
        grid-template-columns: 1fr;
    }

    .star-button {
        height: 52px;
        width: 52px;
    }

    .emoji-rating {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .question-builder-card {
        position: static;
    }

    .question-row-pro {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .question-row-actions {
        grid-column: 1 / -1;
        justify-content: flex-end;
    }
}

@media print {
    @page {
        margin: 12mm;
        size: A4;
    }

    .no-print {
        display: none !important;
    }

    .print-shell {
        background: #ffffff;
    }

    .print-page {
        max-width: none;
        padding: 0;
    }

    .qr-print-poster {
        border: 0;
        min-height: auto;
        padding: 18mm 8mm;
    }

    .qr-print-image {
        height: 120mm;
        width: 120mm;
    }
}
