:root {
    --tm-bg: #f4f9f5;
    --tm-surface: #ffffff;
    --tm-surface-2: #eef6f0;
    --tm-text: #142318;
    --tm-muted: #5a6b5e;
    --tm-border: #dce8df;
    --tm-primary: #3cac4c;
    --tm-primary-dark: #2a8135;
    --tm-primary-soft: #e8f5ea;
    --tm-success: #059669;
    --tm-success-soft: #d1fae5;
    --tm-warning: #d97706;
    --tm-warning-soft: #fef3c7;
    --tm-danger: #dc2626;
    --tm-danger-soft: #fee2e2;
    --tm-radius: 10px;
    --tm-radius-sm: 7px;
    --tm-shadow: 0 6px 24px rgba(20, 35, 24, 0.06);
    --tm-font: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
    --tm-container: 1000px;
    --tm-space: clamp(0.6rem, 1.5vw, 1rem);
}

*, *::before, *::after { box-sizing: border-box; }

html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: var(--tm-font);
    background: var(--tm-bg);
    color: var(--tm-text);
    line-height: 1.5;
    min-height: 100%;
}

.telemed-app {
    font-size: clamp(0.8125rem, 0.78rem + 0.15vw, 0.9375rem);
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
}

.telemed-app h1 { font-size: clamp(1.15rem, 1rem + 0.8vw, 1.55rem); }
.telemed-app h2 { font-size: clamp(1rem, 0.92rem + 0.4vw, 1.2rem); }
.telemed-app h3 { font-size: clamp(0.9rem, 0.86rem + 0.2vw, 1rem); }

a { color: var(--tm-primary); text-decoration: none; }
a:hover { text-decoration: underline; }

.telemed-app { display: flex; flex-direction: column; min-height: 100vh; }

.telemed-header {
    position: sticky;
    top: 0;
    z-index: 100;
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--tm-border);
}

.telemed-app h1,
.telemed-app h2,
.telemed-app h3,
.telemed-app h4 {
    font-family: var(--tm-font);
    font-weight: 700;
    line-height: 1.25;
    color: var(--tm-text);
}

.telemed-header__inner {
    max-width: var(--tm-container);
    margin: 0 auto;
    padding: 0.45rem var(--tm-space);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: nowrap;
}

.telemed-brand {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    text-decoration: none;
    color: inherit;
    min-width: 0;
    flex-shrink: 1;
}

.telemed-brand__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.85rem;
    flex-shrink: 0;
}

.telemed-brand__text { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.telemed-brand__text strong { font-size: 0.88rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.telemed-brand__text small { color: var(--tm-muted); font-size: 0.68rem; }

.telemed-brand:hover { text-decoration: none; }

.telemed-nav {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex-wrap: nowrap;
    flex-shrink: 0;
}

.telemed-nav a {
    padding: 0.35rem 0.65rem;
    border-radius: 999px;
    color: var(--tm-muted);
    font-size: 0.82rem;
    font-weight: 500;
    text-decoration: none;
    white-space: nowrap;
}

.telemed-nav--minimal { gap: 0.15rem; }
.telemed-nav__sep { color: var(--tm-border); font-size: 0.82rem; user-select: none; padding: 0 0.1rem; }

.telemed-nav a:hover { background: var(--tm-surface-2); color: var(--tm-text); text-decoration: none; }
.telemed-nav a.is-active { background: var(--tm-primary-soft); color: var(--tm-primary); }
.telemed-nav__cta {
    background: var(--tm-primary) !important;
    color: #fff !important;
}
.telemed-nav__cta.is-active { background: var(--tm-primary-dark) !important; }

.telemed-nav--admin { gap: 0.15rem; }
.telemed-nav--admin a { font-size: 0.75rem; padding: 0.3rem 0.5rem; }

.telemed-main {
    flex: 1;
    width: 100%;
    max-width: var(--tm-container);
    margin: 0 auto;
    padding: clamp(0.75rem, 2vw, 1.15rem) var(--tm-space) clamp(1rem, 3vw, 1.75rem);
}

.telemed-hero {
    background: linear-gradient(135deg, #3cac4c 0%, #2a8135 55%, #1f6b2a 100%);
    color: #fff;
    border-radius: var(--tm-radius);
    padding: clamp(0.85rem, 2.5vw, 1.35rem) clamp(0.85rem, 2vw, 1.25rem);
    margin-bottom: clamp(0.75rem, 2vw, 1rem);
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.telemed-hero h1 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.1rem, 0.95rem + 1vw, 1.45rem);
    line-height: 1.2;
    color: #fff;
}

.telemed-hero p {
    margin: 0;
    max-width: 38rem;
    opacity: 0.92;
    font-size: clamp(0.8rem, 0.76rem + 0.2vw, 0.9rem);
}

.telemed-hero__badges {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.telemed-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.25rem 0.55rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.14);
    font-size: 0.75rem;
}

.telemed-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.telemed-card {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: clamp(0.75rem, 2vw, 1rem);
    box-shadow: 0 1px 6px rgba(15, 23, 42, 0.03);
}

.telemed-card__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 7px;
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
    display: grid;
    place-items: center;
    margin-bottom: 0.55rem;
    font-size: 0.8rem;
}

.telemed-steps {
    display: grid;
    gap: 1rem;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    counter-reset: step;
}

.telemed-step {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius);
    padding: 1.25rem;
    position: relative;
}

.telemed-step::before {
    counter-increment: step;
    content: counter(step);
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 50%;
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
    font-weight: 700;
    font-size: 0.85rem;
    display: grid;
    place-items: center;
}

.telemed-card h2, .telemed-card h3 { margin-top: 0; font-size: 0.95rem; }
.telemed-card p { color: var(--tm-muted); font-size: 0.82rem; }

.telemed-card--accent {
    border-color: #badbcc;
    background: linear-gradient(180deg, #fff, var(--tm-primary-soft));
}

.telemed-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.45rem 0.8rem;
    min-height: 2.15rem;
    border-radius: 999px;
    border: 1px solid transparent;
    font: inherit;
    font-weight: 600;
    font-size: 0.82rem;
    cursor: pointer;
    text-decoration: none;
    touch-action: manipulation;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.telemed-btn:hover { text-decoration: none; transform: translateY(-1px); }
.telemed-btn:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.telemed-btn--primary {
    background: var(--tm-primary);
    color: #fff;
    box-shadow: 0 4px 14px rgba(42, 129, 53, 0.22);
}

.telemed-btn--primary:hover { background: var(--tm-primary-dark); color: #fff; }

.telemed-btn--outline {
    background: #fff;
    border-color: var(--tm-border);
    color: var(--tm-text);
}

.telemed-btn--success { background: var(--tm-success); color: #fff; }
.telemed-btn--block { width: 100%; }

.telemed-form-group { margin-bottom: 1rem; }
.telemed-form-group label {
    display: block;
    margin-bottom: 0.35rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.telemed-input {
    width: 100%;
    max-width: 100%;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-sm);
    font: inherit;
    font-size: 1rem;
    background: #fff;
    color: var(--tm-text);
    -webkit-appearance: none;
    appearance: none;
}

textarea.telemed-input {
    resize: vertical;
    min-height: 5rem;
}

.telemed-input:focus {
    outline: none;
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 3px rgba(60, 172, 76, 0.2);
}

.telemed-field-hint {
    margin: 0.35rem 0 0;
    font-size: 0.82rem;
    color: var(--tm-muted);
    line-height: 1.45;
}

.telemed-address-status {
    margin-top: 0.45rem;
    font-size: 0.82rem;
    min-height: 1.1rem;
}

.telemed-address-status.is-success {
    color: var(--tm-primary);
}

.telemed-address-status.is-error {
    color: var(--tm-danger, #c0392b);
}

.pac-container {
    z-index: 10000;
    border-radius: var(--tm-radius-sm);
    border: 1px solid var(--tm-border);
    box-shadow: var(--tm-shadow, 0 8px 24px rgba(0, 0, 0, 0.12));
    font-family: inherit;
}

.pac-item {
    padding: 0.45rem 0.65rem;
    font-size: 0.9rem;
}

select.telemed-input {
    background: #fff;
    color: var(--tm-text);
}

.telemed-alert {
    padding: 0.85rem 1rem;
    border-radius: var(--tm-radius-sm);
    margin-bottom: 1rem;
    font-size: 0.95rem;
}

.telemed-alert--success { background: var(--tm-success-soft); color: #065f46; border: 1px solid #a7f3d0; }
.telemed-alert--error { background: var(--tm-danger-soft); color: #991b1b; border: 1px solid #fecaca; }
.telemed-alert--warning { background: var(--tm-warning-soft); color: #92400e; border: 1px solid #fde68a; }

.telemed-auth {
    max-width: 400px;
    margin: 0 auto;
}

.telemed-auth--wide {
    max-width: 520px;
}

.telemed-auth.telemed-card {
    padding: clamp(1rem, 2.5vw, 1.35rem);
}

.telemed-auth__icon {
    width: 2.25rem;
    height: 2.25rem;
    margin: 0 auto 0.65rem;
    border-radius: 50%;
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
    display: grid;
    place-items: center;
    font-size: 0.95rem;
}

.telemed-auth__title {
    margin: 0 0 0.35rem;
    text-align: center;
    font-size: 1.05rem;
}

.telemed-auth__lead {
    text-align: center;
    color: var(--tm-muted);
    margin: 0 0 1rem;
    font-size: 0.8rem;
    line-height: 1.5;
}

.telemed-auth__footer {
    text-align: center;
    margin: 1rem 0 0;
    color: var(--tm-muted);
    font-size: 0.78rem;
}

.telemed-auth__back {
    text-align: center;
    margin: 0.55rem 0 0;
    font-size: 0.78rem;
}

.telemed-form-section-title {
    margin: 0.85rem 0 0.55rem;
    padding-top: 0.65rem;
    border-top: 1px solid var(--tm-border);
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--tm-text);
}

.telemed-form-section-title:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

.telemed-form-check {
    display: flex;
    align-items: flex-start;
    gap: 0.45rem;
    font-weight: 400;
    cursor: pointer;
    font-size: 0.78rem;
    line-height: 1.45;
    color: var(--tm-muted);
}

.telemed-form-check input[type="checkbox"] {
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.telemed-form-actions {
    display: flex;
    gap: 0.45rem;
    flex-wrap: wrap;
    margin-bottom: 0.65rem;
}

.telemed-form-actions .telemed-btn {
    flex: 1;
    min-width: 140px;
}

.telemed-otp-input {
    text-align: center;
    letter-spacing: 0.35em;
    font-size: 1.05rem !important;
    font-weight: 600;
}

.telemed-phone-input {
    display: flex;
    align-items: stretch;
    width: 100%;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-sm);
    background: #fff;
    overflow: hidden;
}

.telemed-phone-input:focus-within {
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 3px rgba(60, 172, 76, 0.2);
}

.telemed-phone-input__prefix {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    flex-shrink: 0;
    padding: 0 0.75rem;
    background: #f8faf9;
    border-right: 1px solid var(--tm-border);
    color: var(--tm-text);
}

.telemed-phone-input__flag {
    display: block;
    width: 1.35rem;
    height: 0.9rem;
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
}

.telemed-phone-input__dial-code {
    font-weight: 600;
    font-size: 0.95rem;
    white-space: nowrap;
}

.telemed-phone-input__number {
    flex: 1;
    min-width: 0;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    background: transparent;
}

.telemed-phone-input__number:focus {
    box-shadow: none !important;
}

.telemed-phone-input.is-readonly {
    background: #f3f4f6;
}

.telemed-phone-input.is-readonly .telemed-phone-input__prefix {
    background: #eceff1;
}

.telemed-phone-input.is-readonly .telemed-phone-input__number {
    background: transparent;
    color: var(--tm-muted);
}

.telemed-form-group .iti {
    width: 100%;
    display: block;
}

.telemed-form-group .iti .iti__tel-input,
.telemed-form-group .iti input.telemed-input {
    width: 100%;
    padding-top: 0.65rem;
    padding-bottom: 0.65rem;
    padding-right: 0.85rem;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-sm);
    font: inherit;
    font-size: 1rem;
    background: #fff;
    color: var(--tm-text);
}

.telemed-form-group .iti .iti__country-container {
    left: 0;
    padding-left: 0.75rem;
}

.telemed-form-group .iti .iti__selected-country {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    padding-right: 0.45rem;
}

.telemed-form-group .iti .iti__selected-dial-code {
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--tm-text);
    margin-left: 0.15rem;
}

.telemed-form-group .iti .iti__flag {
    border-radius: 2px;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.08);
}

.telemed-form-group .iti .iti__tel-input:focus,
.telemed-form-group .iti input.telemed-input:focus {
    outline: none;
    border-color: var(--tm-primary);
    box-shadow: 0 0 0 3px rgba(60, 172, 76, 0.2);
}

.telemed-form-group .iti--allow-dropdown .iti__country-container:hover {
    background: rgba(60, 172, 76, 0.06);
    border-radius: var(--tm-radius-sm) 0 0 var(--tm-radius-sm);
}

.telemed-dashboard-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: 1.5fr 1fr;
    align-items: start;
}

@media (max-width: 900px) {
    .telemed-dashboard-grid { grid-template-columns: 1fr; }
}

.telemed-fee-banner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding: 1rem 1.15rem;
    border-radius: var(--tm-radius-sm);
    background: var(--tm-warning-soft);
    border: 1px solid #fde68a;
    margin-bottom: 1rem;
}

.telemed-fee-banner.is-paid {
    background: var(--tm-success-soft);
    border-color: #a7f3d0;
}

.telemed-fee-amount {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--tm-text);
}

.telemed-pay-tabs {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.telemed-pay-tab {
    flex: 1;
    padding: 0.65rem;
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-sm);
    background: #fff;
    cursor: pointer;
    font: inherit;
    font-weight: 600;
}

.telemed-pay-tab.is-active {
    border-color: var(--tm-primary);
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
}

.telemed-pay-panel { display: none; }
.telemed-pay-panel.is-active { display: block; }

.telemed-status {
    display: none;
    margin-top: 1rem;
    padding: 1rem;
    border-radius: var(--tm-radius-sm);
    background: var(--tm-surface-2);
}

.telemed-status.is-visible { display: block; }
.telemed-status[data-state="waiting"] { background: var(--tm-warning-soft); border: 1px solid #fde68a; }
.telemed-status[data-state="accepted"],
.telemed-status[data-state="in_progress"] { background: var(--tm-success-soft); border: 1px solid #a7f3d0; }

.telemed-spinner {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    border: 2px solid rgba(0,0,0,0.15);
    border-top-color: currentColor;
    border-radius: 50%;
    animation: tm-spin 0.8s linear infinite;
    vertical-align: -0.15em;
    margin-right: 0.35rem;
}

@keyframes tm-spin { to { transform: rotate(360deg); } }

.telemed-live-dot {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.82rem;
    color: var(--tm-muted);
}

.telemed-live-dot::before {
    content: '';
    width: 0.45rem;
    height: 0.45rem;
    border-radius: 50%;
    background: var(--tm-primary);
    animation: tm-pulse 1.6s ease-out infinite;
}

@keyframes tm-pulse {
    0% { box-shadow: 0 0 0 0 rgba(11, 95, 255, 0.5); }
    70% { box-shadow: 0 0 0 6px rgba(11, 95, 255, 0); }
    100% { box-shadow: 0 0 0 0 rgba(11, 95, 255, 0); }
}

.telemed-footer {
    margin-top: auto;
    background: linear-gradient(180deg, #fff 0%, var(--tm-surface-2) 100%);
    border-top: 1px solid var(--tm-border);
    padding: clamp(1.5rem, 4vw, 2.5rem) var(--tm-space) clamp(1rem, 3vw, 1.5rem);
}

.telemed-footer__inner {
    max-width: var(--tm-container);
    margin: 0 auto;
}

.telemed-footer__grid {
    display: grid;
    gap: clamp(1.25rem, 3vw, 2rem);
    grid-template-columns: 1.4fr repeat(3, 1fr);
    margin-bottom: clamp(1.25rem, 3vw, 1.75rem);
}

.telemed-footer__brand {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.telemed-footer__logo {
    display: inline-flex;
    align-items: center;
    gap: 0.65rem;
    text-decoration: none;
    color: var(--tm-text);
    font-weight: 700;
    font-size: 0.95rem;
}

.telemed-footer__logo:hover { text-decoration: none; color: var(--tm-primary-dark); }

.telemed-footer__logo-icon {
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-size: 0.95rem;
    flex-shrink: 0;
}

.telemed-footer__tagline {
    margin: 0;
    color: var(--tm-muted);
    font-size: 0.85rem;
    line-height: 1.55;
    max-width: 22rem;
}

.telemed-footer__contact {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    margin-top: 0.15rem;
}

.telemed-footer__contact a {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    color: var(--tm-muted);
    font-size: 0.85rem;
    text-decoration: none;
}

.telemed-footer__contact a:hover {
    color: var(--tm-primary-dark);
    text-decoration: none;
}

.telemed-footer__col h4 {
    margin: 0 0 0.65rem;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--tm-text);
}

.telemed-footer__links {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
}

.telemed-footer__links a {
    color: var(--tm-muted);
    font-size: 0.85rem;
    text-decoration: none;
    transition: color 0.15s ease;
}

.telemed-footer__links a:hover {
    color: var(--tm-primary-dark);
    text-decoration: none;
}

.telemed-footer__bottom {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
    padding-top: clamp(0.85rem, 2vw, 1.15rem);
    border-top: 1px solid var(--tm-border);
    color: var(--tm-muted);
    font-size: 0.8rem;
}

.telemed-footer__bottom-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem 0.85rem;
}

.telemed-footer__bottom-links a {
    color: var(--tm-muted);
    text-decoration: none;
}

.telemed-footer__bottom-links a:hover {
    color: var(--tm-primary-dark);
    text-decoration: none;
}

/* Admin */
.telemed-admin-stats {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: 0.55rem;
    margin-bottom: 0.85rem;
}

.telemed-stat {
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    border-radius: var(--tm-radius-sm);
    padding: 0.65rem 0.5rem;
    text-align: center;
}

.telemed-stat strong {
    display: block;
    font-size: 1.25rem;
    line-height: 1.2;
}

.telemed-stat span { color: var(--tm-muted); font-size: 0.68rem; }

.telemed-table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }

.telemed-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.8rem;
}

.telemed-table th, .telemed-table td {
    padding: 0.5rem 0.45rem;
    border-bottom: 1px solid var(--tm-border);
    text-align: left;
    vertical-align: top;
}

.telemed-table th {
    color: var(--tm-muted);
    font-size: 0.68rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.telemed-pill {
    display: inline-block;
    padding: 0.18rem 0.55rem;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 600;
}

.telemed-pill--waiting { background: var(--tm-warning-soft); color: #92400e; }
.telemed-pill--success { background: var(--tm-success-soft); color: #065f46; }
.telemed-pill--danger { background: var(--tm-danger-soft); color: #991b1b; }
.telemed-pill--info { background: var(--tm-primary-soft); color: var(--tm-primary-dark); }

.telemed-link-btn {
    background: none;
    border: 0;
    padding: 0;
    color: var(--tm-primary);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    text-decoration: underline;
}

.telemed-link-btn:hover { color: var(--tm-primary-dark); }

.telemed-modal {
    position: fixed;
    inset: 0;
    z-index: 1200;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.telemed-modal.is-open { display: flex; }

.telemed-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(15, 23, 42, 0.55);
}

.telemed-modal__panel {
    position: relative;
    width: min(720px, 100%);
    max-height: min(85vh, 900px);
    overflow: auto;
    background: var(--tm-surface, #fff);
    border: 1px solid var(--tm-border);
    border-radius: 12px;
    padding: 1.25rem 1.35rem 1.35rem;
    box-shadow: 0 20px 50px rgba(15, 23, 42, 0.25);
}

.telemed-modal__close {
    position: absolute;
    top: 0.75rem;
    right: 0.85rem;
    border: 0;
    background: transparent;
    font-size: 1.5rem;
    line-height: 1;
    cursor: pointer;
    color: var(--tm-muted);
}

.telemed-modal__section {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--tm-border);
}

.telemed-modal__section:first-of-type {
    margin-top: 0.75rem;
    padding-top: 0;
    border-top: 0;
}

.telemed-modal__label {
    display: block;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    color: var(--tm-muted);
    margin-bottom: 0.35rem;
}

.telemed-modal__text {
    margin: 0;
    white-space: pre-wrap;
    font-size: 0.92rem;
    line-height: 1.55;
}

.telemed-modal__meta {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 0.75rem 1rem;
    font-size: 0.92rem;
}

.telemed-nav--patient { flex-wrap: wrap; gap: 0.35rem 0.75rem; }

.telemed-faq { margin-bottom: 0.65rem; padding: 0.65rem 0.85rem; border: 1px solid var(--tm-border); border-radius: 8px; }
.telemed-faq summary { cursor: pointer; font-weight: 600; }
.telemed-faq p { margin: 0.5rem 0 0; color: var(--tm-muted); }

.telemed-settings-group {
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--tm-border);
}

.telemed-settings-group:last-child { border-bottom: 0; }

.telemed-settings-grid {
    display: grid;
    gap: 0.85rem;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
}

.telemed-panel {
    position: relative;
}

.telemed-panel.is-loading {
    pointer-events: none;
}

.telemed-panel.is-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 3;
    border-radius: inherit;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(1px);
}

.telemed-panel.is-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 4;
    width: 1.75rem;
    height: 1.75rem;
    margin: -0.875rem 0 0 -0.875rem;
    border: 2px solid rgba(60, 172, 76, 0.2);
    border-top-color: var(--tm-primary);
    border-radius: 50%;
    animation: tm-spin 0.8s linear infinite;
}

#stripe-payment-element { margin: 1rem 0; }

.telemed-actions { display: flex; gap: 0.65rem; flex-wrap: wrap; margin-top: 1rem; }

/* Patient account sidebar */
.telemed-account-card {
    display: flex;
    flex-direction: column;
    padding: 0;
    overflow: hidden;
    align-self: start;
    position: sticky;
    top: 3.5rem;
}

.telemed-account-card__profile {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 0.25rem;
    padding: 1rem 0.9rem 0.85rem;
    background: linear-gradient(160deg, var(--tm-primary-soft) 0%, #fff 72%);
    border-bottom: 1px solid var(--tm-border);
}

.telemed-account-avatar {
    width: 2.75rem;
    height: 2.75rem;
    margin-bottom: 0.2rem;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-dark));
    color: #fff;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.95rem;
    font-weight: 700;
    letter-spacing: 0.05em;
    box-shadow: 0 4px 12px rgba(60, 172, 76, 0.25);
    border: 2px solid #fff;
}

.telemed-account-card__eyebrow {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--tm-muted);
}

.telemed-account-card__name {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.3;
    word-break: break-word;
}

.telemed-account-details {
    display: flex;
    flex-direction: column;
    gap: 0.45rem;
    padding: 0.75rem 0.85rem;
}

.telemed-account-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 0.65rem;
    border-radius: var(--tm-radius-sm);
    background: var(--tm-surface-2);
    border: 1px solid var(--tm-border);
}

.telemed-account-row__icon {
    flex-shrink: 0;
    width: 1.75rem;
    height: 1.75rem;
    border-radius: 6px;
    background: #fff;
    color: var(--tm-primary);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    border: 1px solid var(--tm-border);
}

.telemed-account-row__content {
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
}

.telemed-account-row__label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--tm-muted);
}

.telemed-account-row__value {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--tm-text);
    word-break: break-word;
    line-height: 1.35;
}

.telemed-account-card__footer {
    padding: 0 0.85rem 0.85rem;
}

.telemed-account-card__profile .telemed-pill {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    margin-top: 0.15rem;
    font-size: 0.68rem;
}

.telemed-account-row__value--link {
    text-decoration: none;
    color: var(--tm-text);
}

.telemed-account-row__value--link:hover {
    color: var(--tm-primary);
    text-decoration: underline;
}

.telemed-account-signout {
    border-color: #f5c6cb;
    color: #b42318;
    background: #fff;
}

.telemed-account-signout:hover {
    background: var(--tm-danger-soft);
    border-color: #fecaca;
    color: #991b1b;
    text-decoration: none;
}

/* Homepage */
.telemed-home {
    display: flex;
    flex-direction: column;
    gap: clamp(1.1rem, 3vw, 1.75rem);
}

.telemed-home-hero {
    position: relative;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: clamp(0.85rem, 2vw, 1.25rem);
    align-items: stretch;
    padding: clamp(1rem, 3vw, 1.65rem);
    border-radius: calc(var(--tm-radius) + 2px);
    color: #fff;
    background: linear-gradient(145deg, #45b855 0%, #3cac4c 35%, #2a8135 100%);
    border: 1px solid rgba(255, 255, 255, 0.14);
    overflow: hidden;
}

.telemed-home-hero::before {
    content: "";
    position: absolute;
    inset: 0;
    background:
        radial-gradient(circle at 85% 15%, rgba(255, 255, 255, 0.14) 0%, transparent 42%),
        radial-gradient(circle at 10% 90%, rgba(0, 0, 0, 0.08) 0%, transparent 38%);
    pointer-events: none;
}

.telemed-home-hero__content,
.telemed-home-hero__aside {
    position: relative;
    z-index: 1;
}

.telemed-home-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    margin-bottom: 0.85rem;
    padding: 0.35rem 0.75rem;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.18);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.telemed-home-hero h1 {
    margin: 0 0 0.5rem;
    font-size: clamp(1.35rem, 1rem + 1.5vw, 1.85rem);
    line-height: 1.12;
    color: #fff;
    letter-spacing: -0.02em;
}

.telemed-home-hero__lead {
    margin: 0;
    max-width: 34rem;
    font-size: clamp(0.82rem, 0.78rem + 0.2vw, 0.92rem);
    line-height: 1.55;
    color: rgba(255, 255, 255, 0.92);
}

.telemed-home-hero__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-top: 1rem;
}

.telemed-btn--lg {
    padding: 0.55rem 1rem;
    min-height: 2.35rem;
    font-size: 0.85rem;
}

.telemed-btn--ghost {
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.28);
    color: #fff;
    box-shadow: none;
}

.telemed-btn--ghost:hover {
    background: rgba(255, 255, 255, 0.18);
    color: #fff;
}

.telemed-home-hero__aside {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    justify-content: center;
}

.telemed-home-stat {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.65rem 0.8rem;
    border-radius: var(--tm-radius-sm);
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.16);
    backdrop-filter: blur(6px);
}

.telemed-home-stat__value {
    flex-shrink: 0;
    min-width: 2.5rem;
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
    text-align: center;
}

.telemed-home-stat__label {
    font-size: 0.75rem;
    line-height: 1.4;
    color: rgba(255, 255, 255, 0.9);
}

.telemed-home-section__head {
    margin-bottom: 1.15rem;
}

.telemed-home-section__head h2 {
    margin: 0 0 0.35rem;
    font-size: clamp(1.2rem, 1rem + 0.8vw, 1.55rem);
}

.telemed-home-section__head p {
    margin: 0;
    color: var(--tm-muted);
    max-width: 36rem;
}

.telemed-home-steps {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.telemed-home-step {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
    border-radius: var(--tm-radius);
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    transition: border-color 0.2s ease;
}

.telemed-home-step__icon {
    width: 2rem;
    height: 2rem;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
    font-size: 0.8rem;
}

.telemed-home-step__body h3 {
    margin: 0 0 0.25rem;
    font-size: 0.88rem;
}

.telemed-home-step__body p {
    margin: 0;
    color: var(--tm-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.telemed-home-audience {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.65rem;
}

.telemed-home-audience--two {
    grid-template-columns: repeat(2, 1fr);
}

.telemed-home-audience-card {
    display: flex;
    flex-direction: column;
    gap: 0.55rem;
    padding: 0.85rem;
    border-radius: var(--tm-radius);
    background: var(--tm-surface);
    border: 1px solid var(--tm-border);
    transition: border-color 0.2s ease;
}

.telemed-home-audience-card__icon {
    width: 1.85rem;
    height: 1.85rem;
    border-radius: 7px;
    display: grid;
    place-items: center;
    background: var(--tm-primary-soft);
    color: var(--tm-primary);
    flex-shrink: 0;
    font-size: 0.8rem;
}

.telemed-home-audience-card p {
    margin: 0;
    flex: 1;
    color: var(--tm-muted);
    font-size: 0.78rem;
    line-height: 1.5;
}

.telemed-home-audience-card--featured {
    background: linear-gradient(180deg, #fff 0%, var(--tm-primary-soft) 100%);
    border-color: #badbcc;
}

.telemed-home-audience-card__head {
    display: flex;
    align-items: center;
    gap: 0.55rem;
}

.telemed-home-audience-card__head h3 {
    margin: 0;
    font-size: 0.88rem;
}

.telemed-home-audience-card__actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}

.telemed-home-emergency {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.9rem 1.1rem;
    border-radius: var(--tm-radius-sm);
    background: var(--tm-warning-soft);
    border: 1px solid #fde68a;
}

.telemed-home-emergency i {
    color: var(--tm-warning);
    margin-top: 0.15rem;
    flex-shrink: 0;
}

.telemed-home-emergency p {
    margin: 0;
    font-size: 0.88rem;
    color: #92400e;
    line-height: 1.55;
}

.telemed-home-emergency a {
    color: #92400e;
    font-weight: 600;
}

@media (max-width: 900px) {
    .telemed-account-card {
        position: static;
    }

    .telemed-home-hero {
        grid-template-columns: 1fr;
    }

    .telemed-home-steps,
    .telemed-home-audience,
    .telemed-home-audience--two {
        grid-template-columns: 1fr;
    }

    .telemed-clinician-grid {
        grid-template-columns: 1fr;
    }

    .telemed-footer__grid {
        grid-template-columns: 1fr 1fr;
    }

    .telemed-footer__brand {
        grid-column: 1 / -1;
    }
}

@media (max-width: 768px) {
    .telemed-header__inner {
        flex-wrap: wrap;
    }

    .telemed-nav {
        justify-content: flex-end;
    }

    .telemed-nav--admin {
        justify-content: flex-start;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 0.25rem;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }

    .telemed-actions {
        flex-direction: column;
    }

    .telemed-actions .telemed-btn {
        width: 100%;
    }

    .telemed-home-hero__actions,
    .telemed-home-audience-card__actions {
        flex-direction: column;
    }

    .telemed-home-hero__actions .telemed-btn,
    .telemed-home-audience-card__actions .telemed-btn,
    .telemed-home-audience-card > .telemed-btn {
        width: 100%;
    }

    .telemed-fee-banner {
        flex-direction: column;
        align-items: flex-start;
    }

    .telemed-footer__grid {
        grid-template-columns: 1fr;
    }

    .telemed-footer__bottom {
        flex-direction: column;
        align-items: flex-start;
        text-align: left;
    }
}

@media (max-width: 480px) {
    .telemed-brand__text strong { font-size: 0.82rem; }
    .telemed-brand__text small { font-size: 0.65rem; }
    .telemed-brand__icon { width: 1.85rem; height: 1.85rem; font-size: 0.8rem; }
    .telemed-stat strong { font-size: 1.1rem; }
    .telemed-pay-tabs { flex-direction: column; }
}

/* Dashboard page headers */
.telemed-page-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}

.telemed-page-head h1 {
    margin: 0 0 0.15rem;
    font-size: clamp(1rem, 0.92rem + 0.5vw, 1.2rem);
}

.telemed-page-head p {
    margin: 0;
    color: var(--tm-muted);
    font-size: 0.78rem;
}

/* Clinician dashboard */
.telemed-clinician-grid {
    display: grid;
    gap: 0.75rem;
    grid-template-columns: repeat(2, 1fr);
    align-items: start;
}

.telemed-clinician-grid > .telemed-card--full {
    grid-column: 1 / -1;
}

.telemed-clinician-profile {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
}

.telemed-clinician-avatar {
    width: 3rem;
    height: 3rem;
    border-radius: 50%;
    overflow: hidden;
    flex-shrink: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, var(--tm-primary), var(--tm-primary-dark));
    color: #fff;
    font-weight: 700;
    font-size: 0.95rem;
    border: 2px solid var(--tm-primary-soft);
}

.telemed-clinician-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.telemed-clinician-profile__body {
    flex: 1;
    min-width: 0;
}

.telemed-availability {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0.65rem 0.75rem;
    border-radius: var(--tm-radius-sm);
    background: var(--tm-surface-2);
    border: 1px solid var(--tm-border);
}

.telemed-availability.is-online {
    background: var(--tm-success-soft);
    border-color: #a7f3d0;
}

.telemed-availability__text strong {
    display: block;
    font-size: 0.85rem;
}

.telemed-availability__text p {
    margin: 0.2rem 0 0;
    font-size: 0.75rem;
    color: var(--tm-muted);
}

.telemed-queue-list {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.telemed-queue-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.65rem;
    flex-wrap: wrap;
    padding: 0.65rem 0;
    border-bottom: 1px solid var(--tm-border);
}

.telemed-queue-item:last-child {
    border-bottom: 0;
    padding-bottom: 0;
}

.telemed-queue-item__meta strong {
    font-size: 0.85rem;
}

.telemed-queue-item__meta small {
    color: var(--tm-muted);
    font-size: 0.72rem;
}

.telemed-queue-empty {
    color: var(--tm-muted);
    margin: 0;
    font-size: 0.78rem;
    padding: 0.25rem 0;
}

.telemed-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.telemed-card__head h2 {
    margin: 0;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.telemed-card__head h2 i {
    color: var(--tm-primary);
    font-size: 0.8rem;
}

/* Admin panels */
.telemed-admin .telemed-card {
    margin-bottom: 0.75rem;
}

.telemed-admin .telemed-card:last-child {
    margin-bottom: 0;
}

.telemed-admin-panel-title {
    margin: 0 0 0.65rem;
    font-size: 0.9rem;
    display: flex;
    align-items: center;
    gap: 0.35rem;
}

.telemed-admin-panel-title i {
    color: var(--tm-primary);
    font-size: 0.8rem;
}

/* Patient dashboard refinements */
.telemed-patient-dash .telemed-card h2 {
    font-size: 0.9rem;
}

.telemed-patient-dash .telemed-form-group {
    margin-bottom: 0.65rem;
}

.telemed-patient-dash .telemed-form-group label {
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}

.telemed-patient-dash .telemed-input {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

.telemed-fee-banner {
    padding: 0.65rem 0.8rem;
    margin-bottom: 0.65rem;
}

.telemed-pay-tab {
    padding: 0.45rem;
    font-size: 0.78rem;
}

.telemed-input {
    padding: 0.5rem 0.65rem;
    font-size: 0.85rem;
}

.telemed-form-group {
    margin-bottom: 0.65rem;
}

.telemed-form-group label {
    font-size: 0.78rem;
    margin-bottom: 0.25rem;
}

.telemed-alert {
    padding: 0.6rem 0.75rem;
    margin-bottom: 0.65rem;
    font-size: 0.8rem;
}

.telemed-actions {
    gap: 0.45rem;
    margin-top: 0.65rem;
}

/* Edge / cross-browser fixes */
@supports not (gap: 1rem) {
    .telemed-nav a + a { margin-left: 0.25rem; }
    .telemed-clinician-grid > * + * { margin-top: 0.75rem; }
}

.telemed-header,
.telemed-card,
.telemed-home-hero,
.telemed-hero {
    -webkit-backdrop-filter: blur(12px);
}
