/* Application shell: app bar, quick actions, content surface, sign-in card */

:root {
    --ui-bg: #f3f5f9;
    --ui-surface: #ffffff;
    --ui-border: #e3e8ef;
    --ui-text: #1f2937;
    --ui-muted: #6b7280;
    --ui-accent: #0366d6;
    --ui-accent-soft: rgba(3, 102, 214, .1);
    --ui-radius: 16px;
    --ui-shadow-sm: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
    --ui-shadow-md: 0 6px 16px rgba(16, 24, 40, .1), 0 2px 4px rgba(16, 24, 40, .06);
}

body {
    color: var(--ui-text);
    -webkit-font-smoothing: antialiased;
}

/* App bar */

.app-bar {
    position: sticky;
    top: 0;
    z-index: 50;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem 1rem;
    margin: -1.1rem -1.5rem 1.5rem;
    padding: .6rem 1.5rem;
    background: rgba(255, 255, 255, .92);
    -webkit-backdrop-filter: saturate(180%) blur(10px);
    backdrop-filter: saturate(180%) blur(10px);
    border-bottom: 1px solid var(--ui-border);
    box-shadow: var(--ui-shadow-sm);
}

@media (min-width: 768px) {
    .app-bar {
        margin-left: -2rem;
        padding-left: 2rem;
    }
}

.app-bar__brand {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    color: var(--ui-text);
    font-size: 1.15rem;
    font-weight: 700;
    letter-spacing: .01em;
}

    .app-bar__brand:hover {
        color: var(--ui-accent);
        text-decoration: none;
    }

.app-bar__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    color: #fff;
    background: linear-gradient(135deg, #0366d6, #17a2b8);
}

.app-bar__nav {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.icon-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    color: var(--ui-muted);
    transition: background-color .15s ease, color .15s ease;
}

    .icon-btn:hover,
    .icon-btn:focus {
        color: var(--ui-accent);
        background: var(--ui-accent-soft);
        text-decoration: none;
    }

.app-bar__search {
    flex: 1 1 20rem;
    min-width: 0;
    max-width: 44rem;
    text-align: left;
}

    .app-bar__search .blazored-typeahead {
        border-radius: 999px;
        background: #fff;
    }

    .app-bar__search .blazored-typeahead__controls {
        border-radius: 999px;
    }

    .app-bar__search .row {
        margin: 0;
    }

.app-bar__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.meta-chip {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .2rem .65rem;
    border-radius: 999px;
    border: 1px solid var(--ui-border);
    background: var(--ui-bg);
    color: var(--ui-muted);
    font-size: .78rem;
    line-height: 1.4;
    white-space: nowrap;
}

.meta-chip--danger {
    color: #b42318;
    background: #fef3f2;
    border-color: #fecdca;
}

/* Login / logout */

.login-display {
    display: inline-block;
    margin: 0;
}

.login-display__btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    border-radius: 999px;
    padding-left: .9rem;
    padding-right: .9rem;
    white-space: nowrap;
}

/* Dashboard quick actions */

.quick-actions {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(6.75rem, 1fr));
    gap: .75rem;
    margin: 0 auto 1.25rem;
}

.action-tile {
    --tile: #007bff;
    --tile-soft: rgba(0, 123, 255, .12);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .55rem;
    padding: 1rem .5rem .85rem;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    color: var(--ui-text);
    box-shadow: var(--ui-shadow-sm);
    cursor: pointer;
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}

    .action-tile:hover {
        transform: translateY(-2px);
        border-color: var(--tile);
        box-shadow: var(--ui-shadow-md);
    }

    .action-tile:focus {
        outline: 2px solid var(--tile);
        outline-offset: 2px;
    }

    .action-tile:active {
        transform: translateY(0);
    }

.action-tile__icon {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3rem;
    height: 3rem;
    border-radius: 14px;
    font-size: 1.35rem;
    color: var(--tile);
    background: var(--tile-soft);
}

.action-tile__badge {
    position: absolute;
    top: -.4rem;
    right: -.55rem;
    min-width: 1.35rem;
    padding: 0 .35rem;
    border-radius: 999px;
    border: 2px solid var(--ui-surface);
    background: var(--tile);
    color: #fff;
    font-size: .72rem;
    font-weight: 700;
    line-height: 1.2rem;
}

.action-tile__label {
    font-size: .85rem;
    font-weight: 600;
    line-height: 1.2;
}

.action-tile--danger {
    --tile: #dc3545;
    --tile-soft: rgba(220, 53, 69, .12);
}

.action-tile--info {
    --tile: #17a2b8;
    --tile-soft: rgba(23, 162, 184, .14);
}

.action-tile--success {
    --tile: #28a745;
    --tile-soft: rgba(40, 167, 69, .14);
}

.action-tile--warning {
    --tile: #d39e00;
    --tile-soft: rgba(255, 193, 7, .2);
}

.action-tile--dark {
    --tile: #343a40;
    --tile-soft: rgba(52, 58, 64, .1);
}

/* Content surface */

/* Keep the page within the window; long unbroken text wraps instead of widening it */
.main {
    min-width: 0;
    max-width: 100%;
}

.app-surface,
.app-surface .container {
    max-width: none;
}

.app-surface {
    min-width: 0;
    overflow-wrap: break-word;
}

.app-surface {
    padding-top: 1rem;
    padding-bottom: 1.5rem;
    margin-bottom: 3rem;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-sm);
}

    .app-surface .row.small {
        border-radius: 8px;
        transition: background-color .12s ease;
    }

        .app-surface .row.small:hover {
            background-color: #f6f8fb;
        }

    .app-surface span[title] {
        cursor: pointer;
    }

    .app-surface .table thead th {
        border-top: 0;
        color: var(--ui-muted);
        font-weight: 600;
    }

/* Sign-in / access code */

.auth-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: calc(100vh - 2.2rem);
}

.auth-card {
    width: 100%;
    max-width: 24rem;
    padding: 2rem 1.75rem 1.5rem;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-surface);
    box-shadow: var(--ui-shadow-md);
    text-align: center;
}

.auth-card__logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.5rem;
    height: 3.5rem;
    margin-bottom: .75rem;
    border-radius: 16px;
    font-size: 1.6rem;
    color: #fff;
    background: linear-gradient(135deg, #0366d6, #17a2b8);
}

.auth-card__title {
    margin-bottom: .25rem;
    font-size: 1.5rem;
    font-weight: 700;
}

.auth-card__hint {
    margin-bottom: 1.25rem;
    color: var(--ui-muted);
    font-size: .9rem;
}

.auth-card__form {
    margin-bottom: 1rem;
    text-align: left;
}

    .auth-card__form label {
        font-size: .85rem;
        font-weight: 600;
    }

    .auth-card__form .input-group {
        margin-bottom: .85rem;
    }

    .auth-card__form .form-control {
        letter-spacing: .2em;
    }

.auth-card__meta {
    margin-top: 1rem;
    padding-top: .85rem;
    border-top: 1px solid var(--ui-border);
    color: var(--ui-muted);
    font-size: .75rem;
    line-height: 1.6;
}

/* Global feedback */

.flash-toast {
    position: fixed;
    top: 1rem;
    left: 50%;
    z-index: 10000000;
    max-width: min(32rem, calc(100vw - 2rem));
    padding: .65rem 1.1rem;
    transform: translateX(-50%);
    border: 1px solid #fecdca;
    border-radius: 12px;
    background: #fef3f2;
    color: #b42318;
    font-size: .9rem;
    font-weight: 600;
    box-shadow: var(--ui-shadow-md);
}

    .flash-toast:empty {
        display: none;
    }

.wait-screen {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 100;
    width: 100%;
    height: 100%;
    visibility: hidden;
    background: rgba(243, 245, 249, .55);
}

/* Small action buttons inside lists */

.app-surface span[title][class^="text-"]:not(.rounded-pill),
.app-surface i[title][class^="text-"],
.app-surface sup[title] {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.7rem;
    height: 1.7rem;
    margin: 1px 0;
    padding: 0 .3rem;
    border-radius: 8px;
    background-color: rgba(16, 24, 40, .06);
    background-color: color-mix(in srgb, currentColor 12%, transparent);
    font-style: normal;
    line-height: 1;
    vertical-align: middle;
    cursor: pointer;
    transition: background-color .12s ease, transform .12s ease;
}

    .app-surface span[title][class^="text-"]:not(.rounded-pill):hover,
    .app-surface i[title][class^="text-"]:hover,
    .app-surface sup[title]:hover {
        background-color: rgba(16, 24, 40, .14);
        background-color: color-mix(in srgb, currentColor 26%, transparent);
        transform: translateY(-1px);
    }

.app-surface sup[title] {
    top: 0;
    padding-left: 0;
    font-size: .8rem;
}

/* Thumbnails wrapped in a clickable span keep their plain look */
.app-surface span[title][class^="text-"]:has(img) {
    display: inline;
    height: auto;
    padding: 0;
    background: none;
    transform: none;
}

/* Let the action column grow so the buttons stay on one line */
.app-surface .row.small > .col-sm-1:first-child {
    flex: 0 0 auto;
    width: auto;
    max-width: none;
}

.app-surface .rounded-pill[title] {
    display: inline-flex;
    align-items: center;
    padding-top: .3rem;
    padding-bottom: .3rem;
    font-style: normal;
    font-weight: 600;
    box-shadow: var(--ui-shadow-sm);
    transition: filter .12s ease, box-shadow .12s ease, transform .12s ease;
}

    .app-surface .rounded-pill[title]:hover {
        filter: brightness(1.07);
        box-shadow: var(--ui-shadow-md);
        transform: translateY(-1px);
    }

.app-surface .btn-sm {
    padding: .2rem .8rem;
    border-radius: 999px;
    font-weight: 600;
}

/* The new-patients list asks for the full viewport width; keep it inside the card */
.app-surface .container.vw-100 {
    width: 100% !important;
}

/* Section headers: collapse, refresh, show all, hide */
.section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .5rem;
    margin-top: 1rem;
    padding: .3rem .25rem;
    border-bottom: 1px solid var(--ui-border);
    font-style: normal;
    text-align: left;
}

.section-toggle {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    min-width: 0;
    padding: .15rem .4rem;
    border: 0;
    border-radius: 8px;
    background: transparent;
    color: var(--ui-text);
    font-size: .9rem;
    font-weight: 600;
    cursor: pointer;
}

    .section-toggle:hover {
        background: #f6f8fb;
    }

.section-caret {
    width: 1em;
    color: var(--ui-muted);
}

.section-scope {
    color: var(--ui-muted);
    font-size: .78rem;
    font-weight: 400;
}

.section-actions {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    flex-shrink: 0;
}

.section-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 1.9rem;
    height: 1.9rem;
    padding: 0 .4rem;
    border: 1px solid var(--ui-border);
    border-radius: 999px;
    background: var(--ui-surface);
    color: var(--ui-muted);
    font-size: 1rem;
    line-height: 1;
    cursor: pointer;
    transition: background-color .12s ease, color .12s ease;
}

    .section-btn:hover:not(:disabled) {
        background: var(--ui-accent-soft);
        color: var(--ui-accent);
    }

    .section-btn:disabled {
        opacity: .6;
        cursor: default;
    }

.section-btn-text {
    padding: 0 .7rem;
    font-size: .75rem;
    font-weight: 600;
}

.section-spin {
    display: inline-block;
    animation: section-spin .8s linear infinite;
}

@keyframes section-spin {
    to {
        transform: rotate(360deg);
    }
}

/* Patient page */

button.icon-btn {
    padding: 0;
    border: 0;
    background: transparent;
}

.patient-view {
    padding: .5rem .25rem 1rem;
    text-align: left;
}

    .patient-view .quick-actions {
        max-width: none;
    }

.patient-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem 1rem;
    margin-bottom: 1.25rem;
}

.patient-header__avatar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.25rem;
    height: 3.25rem;
    border-radius: 50%;
    font-size: 1.4rem;
    color: #fff;
    background: linear-gradient(135deg, #0366d6, #17a2b8);
}

.patient-header__name {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 700;
    line-height: 1.2;
}

.patient-header__sub {
    color: var(--ui-muted);
    font-size: .9rem;
}

.patient-header__copy {
    color: var(--ui-muted);
    font-size: .72rem;
    font-style: italic;
}

.patient-header__status {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .35rem;
    margin-left: auto;
}

.action-tile--secondary {
    --tile: #6c757d;
    --tile-soft: rgba(108, 117, 125, .14);
}

.action-tile__badge--alert {
    background: #dc3545;
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
    gap: .75rem;
    margin-bottom: 1rem;
}

.info-card {
    padding: .75rem 1rem;
    border: 1px solid var(--ui-border);
    border-radius: 12px;
    background: #fafbfd;
    overflow-wrap: anywhere;
}

.info-card__label {
    display: block;
    margin-bottom: .25rem;
    color: var(--ui-muted);
    font-size: .72rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.info-card__value {
    font-weight: 600;
}

.info-card__sub {
    color: var(--ui-muted);
    font-size: .9rem;
}

.contact-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .1rem .35rem;
}

.contact-row__number {
    margin-right: .25rem;
    font-weight: 600;
    white-space: nowrap;
}

.patient-note {
    margin-bottom: .75rem;
}

/* Calendar dialog */

.cal {
    max-width: 100%;
    font-size: .9rem;
    color: var(--ui-text);
}

.cal-header {
    display: grid;
    grid-template-columns: 1fr auto 1fr;
    align-items: center;
    gap: .5rem;
    padding: .25rem 0 .75rem;
    margin-bottom: .75rem;
    border-bottom: 1px solid var(--ui-border);
}

.cal-header__side {
    display: flex;
    gap: .4rem;
}

.cal-header__side--end {
    justify-content: flex-end;
}

.cal-header__center {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.cal-date {
    min-width: 13rem;
    line-height: 1.2;
}

.cal-date__day {
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ui-accent);
}

.cal-date__full {
    font-size: 1.15rem;
    font-weight: 600;
}

.cal-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    padding: 0;
    border: 1px solid var(--ui-border);
    border-radius: 10px;
    background: var(--ui-surface);
    color: var(--ui-muted);
    transition: background-color .15s ease, color .15s ease, border-color .15s ease;
}

.cal-btn:hover,
.cal-btn:focus-visible {
    border-color: transparent;
    background: var(--ui-accent-soft);
    color: var(--ui-accent);
    outline: none;
}

.cal-btn--close:hover,
.cal-btn--close:focus-visible {
    background: rgba(220, 53, 69, .12);
    color: #dc3545;
}

.cal-row {
    align-items: center;
    margin: 0;
    padding: .45rem .25rem;
    border-bottom: 1px solid var(--ui-border);
}

.cal-row:hover {
    background: var(--ui-bg);
}

.cal-row--addon {
    padding-top: .2rem;
    padding-bottom: .2rem;
    color: var(--ui-muted);
}

.cal-patient {
    font-weight: 600;
    cursor: pointer;
}

.cal-patient:hover {
    color: var(--ui-accent);
}

.cal-patient .small {
    font-weight: 400;
    color: var(--ui-muted);
}

.cal-patient > svg,
.cal-patient > i {
    margin-right: .25rem;
    color: var(--ui-accent);
}

.cal-time {
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.cal-pill {
    display: inline-block;
    max-width: 100%;
    padding: .15rem .6rem;
    overflow: hidden;
    border-radius: 999px;
    background: var(--ui-bg);
    color: var(--ui-muted);
    font-size: .8rem;
    text-overflow: ellipsis;
    white-space: nowrap;
    vertical-align: middle;
}

.cal-pill--ok {
    background: rgba(40, 167, 69, .14);
    color: #1e7e34;
}

.cal-pill--info {
    background: var(--ui-accent-soft);
    color: var(--ui-accent);
}

.cal-pill--warn {
    background: rgba(220, 53, 69, .12);
    color: #c82333;
}

.cal sup[title] {
    padding: .2rem .3rem;
    border-radius: 6px;
    cursor: pointer;
}

.cal sup[title]:hover {
    background: rgba(0, 0, 0, .07);
}

.cal a.text-black-50 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 1.8rem;
    height: 1.8rem;
    border-radius: 8px;
}

.cal a.text-black-50:hover {
    background: var(--ui-accent-soft);
    color: var(--ui-accent) !important;
}

.cal-empty {
    padding: 1.5rem;
    color: var(--ui-muted);
}

/* Zoom note preview dialog */

.zoom-preview {
    max-width: 100%;
    font-size: .9rem;
    color: var(--ui-text);
}

.zoom-preview__header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding-bottom: .75rem;
    border-bottom: 1px solid var(--ui-border);
}

.zoom-preview__title {
    font-size: 1.15rem;
    font-weight: 600;
}

.zoom-preview__meta,
.zoom-preview__hint {
    color: var(--ui-muted);
}

.zoom-preview__label {
    margin: 1rem 0 .35rem;
    font-size: .75rem;
    font-weight: 600;
    letter-spacing: .08em;
    text-transform: uppercase;
    color: var(--ui-accent);
}

.zoom-preview__hint {
    margin-left: .5rem;
    font-weight: 400;
    letter-spacing: 0;
    text-transform: none;
}

.zoom-preview__box {
    margin: 0;
    padding: .6rem .8rem;
    border: 1px solid var(--ui-border);
    border-radius: var(--ui-radius);
    background: var(--ui-bg);
    font-family: inherit;
    font-size: inherit;
    white-space: pre-wrap;
    word-break: break-word;
}

.zoom-preview__input {
    border-color: var(--ui-border);
    border-radius: var(--ui-radius);
    font-size: inherit;
}

.zoom-preview__box--transcript {
    max-height: 560px;
    overflow-y: auto;
}

@media print {
    .app-bar,
    .quick-actions,
    .section-actions,
    .flash-toast {
        display: none !important;
    }

    .app-surface {
        border: 0;
        box-shadow: none;
    }
}
