/*
 * What this system adds on top of the Hope UI theme (public/vendor/hope-ui, MIT, unchanged).
 *
 *  1. The brand bridge: Preferências colors, fonts and corners reach the theme through Bootstrap variables
 *     (set inline from Settings::brand()); here only the parts that are not plain variables are handled.
 *  2. The public pages (no sidebar) and the sign-in pages.
 *  3. A compatibility layer for the simple markup older screens still use (a bare <input>, <button>, <table>,
 *     .card, .badge ok...). It gives them the exact values of the theme's .form-control, .btn, .table, .badge, so
 *     they look like the theme without every view being rewritten. New screens should use the theme's classes.
 *  4. Small things the theme has no component for: the segmented filter, the slot buttons, stacked tables on phones.
 */

/* ---------- 1. Brand bridge ---------- */
.iq-header-img img { filter: var(--hp-banner-filter, none); display: var(--hp-banner-image, block); }
.iq-navbar-header { background-color: var(--hp-banner-solid, transparent); }

/* A menu color picked in Preferências: light keeps the theme's own look, dark gets white text. */
.sidebar.sidebar-default { background-color: var(--side, #fff); }
.sidebar.menu-dark .logo-title,
.sidebar.menu-dark .nav-item.static-item .default-icon,
.sidebar.menu-dark .nav-item.static-item .mini-icon { color: #fff; }
.sidebar.menu-dark .sidebar-header { border-bottom-color: rgba(255, 255, 255, 0.14); }
.sidebar.menu-dark .nav-link:not(.active):not([aria-expanded=true]):not(.static-item) { color: rgba(255, 255, 255, 0.78); }
.sidebar.menu-dark .nav-link:not(.active):not([aria-expanded=true]):not(.static-item):hover { background: rgba(255, 255, 255, 0.08); color: #fff; }

/* The sidebar scrolls on its own (the theme's custom scrollbar plugin is not used). */
.sidebar .sidebar-body { overflow-y: auto; max-height: calc(100vh - 66px); padding-bottom: 1.5rem; }
.sidebar .brand-logo-img, .brand-logo-img { max-height: 36px; max-width: 150px; width: auto; }
.sidebar-toggle { z-index: 5; }
/* A long system name must not run under the round toggle. */
.sidebar .logo-title { max-width: 150px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 0; }

.dropdown-menu form { margin: 0; }
.dropdown-menu .dropdown-item { cursor: pointer; }

/* ---------- 2. Public pages and sign-in ---------- */
.guest-content { margin-left: 0; }
.guest-content .iq-navbar { position: relative; }
.guest-content .iq-navbar .navbar-nav .nav-link { color: var(--bs-body-color); }
.guest-content .iq-navbar .navbar-nav .nav-link:hover, .guest-content .iq-navbar .navbar-nav .nav-link.active { color: var(--bs-primary); }
.guest-inner { max-width: 1240px; margin-left: auto; margin-right: auto; }
.guest-content .iq-navbar .container-fluid { max-width: 1240px; }

.login-content .auth-row { min-height: 100vh; height: auto !important; }
.login-content .auth-card .card-body { padding-top: 1.5rem; padding-bottom: 1.5rem; }
/* The artwork stays in view while a long form scrolls. */
.login-content .auth-art-col { align-self: flex-start; position: sticky; top: 0; min-height: 100vh; }
.login-content .auth-art-col img { filter: var(--hp-banner-filter, none); }
.auth-legal a { color: var(--bs-body-color); }
.touch-link { display: inline-block; padding: 0.25rem 0; }

/* ---------- 3. Compatibility layer for the simple markup of the older screens ---------- */
.content-inner .card:not(:has(> .card-body)):not(:has(> table)):not(.card-slide) { padding: var(--bs-card-spacer-y, 1.5rem) var(--bs-card-spacer-x, 1.5rem); }
.content-inner .card:has(> table), .content-inner .card:has(> .card-head) { overflow-x: auto; }
.content-inner .card > h2:first-child { margin-bottom: 0.4rem; }
.content-inner .card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; padding: 1.5rem 1.5rem 1rem; }
.content-inner .card-head h2 { margin: 0; }
.content-inner .card-head p { margin: 0; font-size: 0.875rem; }
.content-inner h2 { font-size: calc(1.275rem + 0.3vw); font-weight: 500; margin-bottom: 0.25rem; }
.content-inner h3 { font-size: 1.125rem; font-weight: 500; }
.content-inner .muted { color: var(--bs-body-color); }
.content-inner strong { color: var(--bs-heading-color); }

/* Text fields: the theme's .form-control */
.content-inner :is(input, textarea):not([type=checkbox]):not([type=radio]):not([type=color]):not([type=range]):not([type=hidden]):not([type=submit]):not([type=button]),
.login-content :is(input, textarea):not([type=checkbox]):not([type=radio]):not([type=hidden]) {
    display: block; width: 100%; padding: 0.5rem 1rem; font-size: 1rem; font-weight: 400; line-height: 1.5;
    color: var(--bs-body-color); background-color: var(--bs-gray-900); background-clip: padding-box;
    border: var(--bs-border-width, 1px) solid var(--bs-border-color); border-radius: var(--bs-border-radius);
    appearance: none; transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}
.content-inner :is(input, textarea):focus, .login-content :is(input, textarea):focus { border-color: var(--bs-primary); outline: 0; box-shadow: 0 0.125rem 0.25rem rgba(var(--bs-primary-rgb), 0.25); }
.content-inner input::placeholder, .content-inner textarea::placeholder { color: var(--bs-gray-600); opacity: 1; }
.content-inner input[type=file] { padding: 0.375rem 1rem; }
.content-inner input[type=color] { width: 100%; height: 42px; padding: 0.25rem; border: var(--bs-border-width, 1px) solid var(--bs-border-color); border-radius: var(--bs-border-radius); background: var(--bs-gray-900); }
.content-inner select {
    display: block; width: 100%; padding: 0.5rem 3rem 0.5rem 1rem; font-size: 1rem; line-height: 1.5; color: var(--bs-body-color);
    background-color: var(--bs-gray-900); border: var(--bs-border-width, 1px) solid var(--bs-border-color); border-radius: var(--bs-border-radius);
    appearance: none; background-repeat: no-repeat; background-position: right 1rem center; background-size: 16px 12px;
    background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3e%3cpath fill='none' stroke='%23343a40' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='m2 5 6 6 6-6'/%3e%3c/svg%3e");
}
.content-inner select:focus { border-color: var(--bs-primary); outline: 0; }
.content-inner label:not(.form-check-label):not(.check) { display: inline-block; margin: 0.9rem 0 0.5rem; color: var(--bs-heading-color); }
.content-inner input[type=checkbox], .content-inner input[type=radio] { width: 1.05rem; height: 1.05rem; margin-right: 0.5rem; accent-color: var(--bs-primary); }
.check { position: relative; display: block; padding-left: 1.9rem; font-size: 0.9375rem; }
.check input[type=checkbox] { position: absolute; left: 0; top: 0.2rem; margin: 0; }
.check.reveal { margin: 0.35rem 0 0; font-size: 0.8125rem; cursor: pointer; }
.hint { font-size: 0.8125rem; margin: 0.25rem 0 0; }
.field-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 0 1rem; }
.settings-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 1rem; }
.inline-label { display: inline-flex !important; align-items: center; gap: 0.5rem; margin: 0 !important; white-space: nowrap; }
.inline-label input { width: auto !important; }

/* Buttons: the theme's .btn.btn-primary, and .btn-outline-primary for the secondary ones */
.content-inner :is(button, a.btn):not([class*="btn-primary"]):not([class*="btn-outline"]):not([class*="btn-soft"]):not([class*="btn-link"]):not([class*="btn-secondary"]):not([class*="btn-light"]):not([class*="btn-danger"]):not([class*="btn-close"]):not(.dropdown-item):not(.accordion-button) {
    display: inline-block; padding: 0.5rem 1.5rem; font-size: 1rem; font-weight: 400; line-height: 1.5; text-align: center; text-decoration: none; vertical-align: middle; cursor: pointer;
    color: #fff; background-color: var(--bs-primary); border: var(--bs-border-width, 1px) solid var(--bs-primary); border-radius: 0.25rem;
    transition: color 0.15s ease-in-out, background-color 0.15s ease-in-out, border-color 0.15s ease-in-out;
}
.content-inner :is(button, a.btn):not([class*="btn-primary"]):not([class*="btn-outline"]):not([class*="btn-soft"]):not([class*="btn-link"]):not([class*="btn-secondary"]):not([class*="btn-light"]):not([class*="btn-danger"]):not([class*="btn-close"]):hover { color: #fff; background-color: var(--bs-primary-hover-bg); border-color: var(--bs-primary-hover-border); }
.content-inner :is(button, a.btn).secondary { color: var(--bs-primary); background-color: transparent; }
.content-inner :is(button, a.btn).secondary:hover { color: #fff; background-color: var(--bs-primary); border-color: var(--bs-primary); }
.content-inner button.danger { background-color: var(--bs-danger); border-color: var(--bs-danger); }
.content-inner button.danger:hover { background-color: #a02b1c; border-color: #96281a; }
.content-inner button:disabled { opacity: 0.65; cursor: not-allowed; }
.content-inner :is(button, a.btn):focus-visible, .btn:focus-visible { outline: 0; box-shadow: 0 0 0 0.25rem rgba(var(--bs-primary-rgb), 0.35); }
.content-inner td :is(button, a.btn) { padding: 0.25rem 0.75rem; font-size: 0.875rem; }
.btn-block { width: 100%; }
.btn-lg { padding: 0.75rem 1.5rem; font-size: 1.125rem; }
form.inline { display: inline; }
.actions { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 1rem; }
.actions form { margin: 0; }
.content-inner p:has(> button:only-child), .content-inner p:has(> .btn:only-child) { margin-top: 1.25rem; }

/* Tables: the theme's .table */
.content-inner table { width: 100%; margin: 0; color: var(--bs-body-color); border-collapse: collapse; }
.content-inner th { padding: 0.75rem 1rem; font-weight: 700; text-align: left; color: var(--bs-body-color); background-color: var(--bs-body-bg); white-space: nowrap; }
.content-inner td { white-space: normal; padding: 0.75rem 1rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--bs-border-color); }
.content-inner tr:last-child td { border-bottom: 0; }
.content-inner td strong { font-weight: 500; }
.content-inner .card:not(:has(> table)) table th:first-child, .content-inner .card:not(:has(> table)) table td:first-child { padding-left: 0.75rem; }
.content-inner td form input { min-width: 220px; }
.content-inner td form + form, .content-inner td form + p { margin-top: 0.5rem; }

/* Status badges: the theme's soft colors */
.content-inner .badge, .page-hero .badge, .iq-navbar-header .badge { padding: 0.3rem 0.6rem; font-size: 0.75rem; font-weight: 600; line-height: 1; border-radius: 0.25rem; color: var(--bs-gray-700); background-color: var(--bs-gray-200); }
.badge.ok { color: var(--bs-success-text-emphasis); background-color: var(--bs-success-bg-subtle); }
.badge.warn { color: var(--bs-warning-text-emphasis); background-color: var(--bs-warning-bg-subtle); }
.badge.err { color: var(--bs-danger-text-emphasis); background-color: var(--bs-danger-bg-subtle); }
.badge.info { color: var(--bs-primary-text-emphasis); background-color: var(--bs-primary-bg-subtle); }
.iq-navbar-header .badge { background-color: #fff; }
.iq-navbar-header a { color: #fff; }
.iq-navbar-header .back-link { display: inline-block; margin-bottom: 0.25rem; opacity: 0.9; text-decoration: none; }
.iq-navbar-header p { margin-bottom: 0; }

/* Segmented filter */
.seg { display: inline-flex; max-width: 100%; margin-bottom: 1.5rem; overflow-x: auto; border-radius: 0.25rem; box-shadow: 0 10px 30px 0 rgba(17, 38, 146, 0.05); }
.seg a { padding: 0.5rem 1.25rem; white-space: nowrap; text-decoration: none; color: var(--bs-primary); background: var(--bs-gray-900); border: 1px solid var(--bs-primary); margin-left: -1px; }
.seg a:first-child { border-radius: 0.25rem 0 0 0.25rem; margin-left: 0; }
.seg a:last-child { border-radius: 0 0.25rem 0.25rem 0; }
.seg a.on { color: #fff; background: var(--bs-primary); }
.seg a:hover:not(.on) { background: var(--bs-primary-bg-subtle); }

/* Pagination */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 0.9rem 1.5rem; border-top: 1px solid var(--bs-border-color); font-size: 0.875rem; }
.pager-item { padding: 0.25rem 0.9rem; border: 1px solid var(--bs-border-color); border-radius: 0.25rem; background: var(--bs-gray-900); color: var(--bs-primary); text-decoration: none; }
.pager-item:hover { background: var(--bs-primary-bg-subtle); }
.pager-item.disabled { opacity: 0.45; }

/* ---------- 4. Small things the theme has no component for ---------- */
.back-link { display: inline-block; margin-bottom: 0.75rem; font-size: 0.875rem; text-decoration: none; }
.qr { max-width: 260px; margin: 0 auto; }
.big-code { font-size: 1.6rem; letter-spacing: 0.15em; color: var(--bs-heading-color); font-weight: 700; }
.patient-name { font-size: 1.4rem; margin-bottom: 0.25rem; }

.slots { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-top: 0.9rem; }
.slots form { margin: 0; }
.content-inner .slots button, .content-inner .slots .btn { min-width: 76px; padding: 0.4rem 1rem; color: var(--bs-primary); background: var(--bs-primary-bg-subtle); border-color: var(--bs-primary-bg-subtle); }
.content-inner .slots button:hover { color: #fff; background: var(--bs-primary); border-color: var(--bs-primary); }

.prose h2 { margin-top: 1.5rem; }
.prose h2:first-child { margin-top: 0; }
.prose ul { margin: 0 0 0.75rem; padding-left: 1.25rem; }
.prose li { margin-bottom: 0.3rem; }

.logo-preview { display: flex; align-items: center; gap: 1rem; padding: 0.75rem; border: 1px dashed var(--bs-border-color); border-radius: 0.25rem; margin-top: 0.3rem; }
.logo-preview img { max-height: 48px; max-width: 160px; }

.manual-refund { margin-top: 0.5rem; max-width: 240px; }
.manual-refund summary { cursor: pointer; font-size: 0.8125rem; color: var(--bs-primary); }
.manual-refund form { margin-top: 0.5rem; }
.manual-refund input, .content-inner td form input.compact, .manual-refund form input { min-width: 0; width: 100%; }

.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.doc-head p { margin: 0 0 0.5rem; }
.doc-form { display: flex; align-items: center; gap: 0.6rem; flex-wrap: wrap; margin-top: 0.5rem; }
.content-inner .doc-form input[type=file], .content-inner .doc-form input[name=reason] { flex: 1 1 260px; width: auto; }
.actions .doc-form { margin: 0; flex: 1 1 320px; }

.perm-group { border: 1px solid var(--bs-border-color); border-radius: 0.25rem; margin: 0 0 1rem; padding: 0.5rem 1rem 0.75rem; }
.perm-group legend { float: none; width: auto; padding: 0 0.4rem; margin: 0; font-weight: 600; color: var(--bs-heading-color); font-size: 0.9375rem; }
.check.perm { margin: 0.35rem 0; }
.perm-name { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 0.72rem; margin-left: 0.35rem; }

/* Settings: live preview */
.settings-layout { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1.5rem; align-items: start; }
.settings-layout .preview-panel { order: -1; }
.preview-card { padding: 1rem !important; margin-bottom: 0; }
.preview-head { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; flex-wrap: wrap; }
.preview-head h2 { margin: 0; }
.preview-head .seg { margin: 0; box-shadow: none; }
.preview-state { margin: 0.5rem 0 0.75rem; }
.preview-state.unsaved { color: var(--bs-warning); font-weight: 600; }
.preview-warn { margin: 0 0 0.75rem; }
.preview-stage { position: relative; overflow: hidden; border: 1px solid var(--bs-border-color); border-radius: 0.25rem; background: var(--bs-body-bg); }
.preview-stage iframe { position: absolute; top: 0; left: 0; border: 0; transform-origin: top left; background: var(--bs-body-bg); }
@media (min-width: 1280px) {
    .settings-layout { grid-template-columns: minmax(0, 1fr) 440px; }
    .settings-layout .preview-panel { order: 0; position: sticky; top: 1rem; }
}

/* ---------- Phones ---------- */
html { -webkit-text-size-adjust: 100%; }
body { overflow-wrap: break-word; }

@media (max-width: 1199.98px) {
    /* The sidebar slides in over the page (the theme's own mini state moves it out of view). */
    .sidebar { z-index: 1040; width: min(300px, 85vw); box-shadow: 0 0 40px rgba(35, 45, 66, 0.25); }
    .main-content { padding-top: env(safe-area-inset-top); }
}

@media (max-width: 800px) {
    /* 16px stops iOS from zooming into a field; 44px is the comfortable tap size */
    .content-inner :is(input, select, textarea):not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),
    .login-content .form-control { font-size: 1rem; min-height: 44px; }
    .content-inner textarea { min-height: 96px; }
    .content-inner :is(button, a.btn), .login-content .btn { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; }
    .content-inner td :is(button, a.btn) { min-height: 40px; }
    .content-inner input[type=checkbox], .content-inner input[type=radio] { width: 22px; height: 22px; }
    .check { min-height: 32px; padding-left: 2.2rem; }
    .seg { display: flex; }
    .seg a { flex: 1 0 auto; text-align: center; padding: 0.7rem 0.9rem; }
    .field-grid, .settings-grid { grid-template-columns: 1fr; }
    .content-inner .card:not(:has(> .card-body)):not(:has(> table)):not(.card-slide) { padding: 1rem; }
    .content-inner .card-head { padding: 1rem; }
    .pager { padding: 0.75rem 1rem; flex-wrap: wrap; justify-content: center; }
    .pager-item { min-height: 40px; display: inline-flex; align-items: center; }
    .content-inner .slots button, .content-inner .slots .btn { min-width: 84px; min-height: 48px; }
    .content-inner input[type=file] { min-width: 0; max-width: 100%; height: auto; font-size: 0.875rem; }
    .doc-form > * { min-width: 0; }
    .content-inner .doc-form input[type=file], .content-inner .doc-form input[name=reason] { flex-basis: 100%; }
    .doc-form button { width: 100%; }
    .actions .doc-form { flex-basis: 100%; }
    .inline-label { white-space: normal; flex-wrap: wrap; }
    .manual-refund { max-width: none; }
    .manual-refund summary { padding: 0.5rem 0; }
    .big-code { font-size: 1.35rem; }
    .qr { max-width: 220px; }
    .footer .footer-body { flex-direction: column; text-align: center; gap: 0.25rem; }
    .footer a { display: inline-block; padding: 0.4rem 0.3rem; }
    .back-link { padding: 0.6rem 0; margin-bottom: 0.25rem; }
    .iq-navbar-header h1 { font-size: 1.6rem; }

    /* Tables become a stack of cards: one block per row, the column title beside each value */
    /* A card that is only a table drops its frame so each row becomes the card; one with a header keeps its frame. */
    .content-inner .card:has(> table):not(:has(> .card-head)) { background: transparent; box-shadow: none; overflow: visible; }
    .content-inner .card:has(> .card-head) table.stackable { padding: 0 0.75rem 0.75rem; }
    table.stackable, table.stackable tbody, table.stackable tr, table.stackable td { display: block; width: 100%; }
    table.stackable thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
    table.stackable tr { background: var(--bs-gray-900); border-radius: 0.25rem; box-shadow: 0 10px 30px 0 rgba(17, 38, 146, 0.05); margin-bottom: 0.9rem; padding: 0.35rem 0; }
    table.stackable td { display: flex; justify-content: space-between; align-items: center; gap: 1rem; text-align: right; padding: 0.6rem 1rem; border-bottom: 1px solid var(--bs-border-color); }
    table.stackable tr td:last-child { border-bottom: 0; }
    table.stackable td::before { content: attr(data-label); flex: none; max-width: 42%; text-align: left; font-size: 0.75rem; font-weight: 700; color: var(--bs-heading-color); }
    table.stackable td.long { flex-direction: column; align-items: flex-start; gap: 0.15rem; text-align: left; }
    table.stackable td.long::before { max-width: none; }
    table.stackable td:not([data-label])::before, table.stackable td[data-label=""]::before { content: none; }
    table.stackable td > * { max-width: 100%; }
    table.stackable td form { width: 100%; }
    table.stackable td form input, table.stackable td form select { min-width: 0; width: 100%; }
    table.stackable td.actions-cell, table.stackable td:has(> form) { flex-direction: column; align-items: stretch; text-align: left; }
    table.stackable td:has(> form)::before { max-width: none; }
    table.stackable td button, table.stackable td .btn { width: 100%; }
    table.stackable td a:not(.btn) { display: inline-block; padding: 0.55rem 0; }
    .content-inner .card:not(:has(> table)) table.stackable tr { box-shadow: none; border: 1px solid var(--bs-border-color); }
    .content-inner .card:not(:has(> table)) table th:first-child, .content-inner .card:not(:has(> table)) table td:first-child { padding-left: 1rem; }
}

@media (max-width: 600px) {
    .actions { flex-direction: column; }
    .actions form, .actions .btn-lg, .actions button { width: 100%; }
    .hero-actions { flex-direction: column; width: 100%; }
    .hero-actions .btn { width: 100%; min-height: 48px; }
    .content-inner th, .content-inner td { padding-left: 0.9rem; padding-right: 0.9rem; }
}

/* The account dropdown opens over the page at every width (Bootstrap makes it static inside a collapsed navbar). */
.iq-navbar .custom-drop .dropdown-menu { position: absolute; right: 0; left: auto; min-width: 12rem; }
.iq-navbar .navbar-list { flex-wrap: nowrap; }

/* Standalone links on the sign-in pages and in the footer are big enough to hit with a thumb. */
.login-content .auth-card p a:not(.touch-link), .login-content .auth-legal a { display: inline-block; padding: 0.55rem 0.25rem; }
.login-content .auth-card label a { display: inline; padding: 0; }
.login-content .navbar-brand { min-height: 44px; }
.touch-link { min-height: 40px; display: inline-flex; align-items: center; }
.footer .footer-body a { display: inline-block; padding: 0.5rem 0.25rem; }
.content-inner p a:not(.btn), .content-inner .alert a { display: inline-block; padding: 0.35rem 0; }

/* One row in the top bar on a phone: [menu] [name ........] [account]. */
.iq-navbar .navbar-inner { flex-wrap: nowrap; gap: 0.5rem; }
.iq-navbar .navbar-brand { min-width: 0; flex: 0 1 auto; }
.iq-navbar .navbar-brand .logo-title { max-width: 55vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; margin-bottom: 0; }
.iq-navbar .navbar-list { margin-left: auto; flex: none; }
@media (max-width: 1199.98px) {
    .iq-navbar .navbar-inner { padding-left: 3rem; }
    .iq-navbar .navbar-brand { margin-right: 0; }
    .iq-navbar .search-input { display: none; }
}
.iq-navbar .custom-drop .dropdown-menu { min-width: 15rem; }
.iq-navbar .custom-drop .dropdown-item { min-height: 44px; display: flex; align-items: center; }

/* The preview folds on a phone (a <details>); the summary is the header. */
.preview-details > summary { list-style: none; cursor: pointer; }
.preview-details > summary::-webkit-details-marker { display: none; }
.preview-open-hint { font-size: 0.8125rem; font-weight: 400; color: var(--bs-body-color); }
.preview-details[open] .preview-open-hint { display: none; }
@media (min-width: 1280px) { .preview-open-hint { display: none; } .preview-details > summary { cursor: default; } }

/* A shorter banner on a phone, so the content starts higher on the screen. */
@media (max-width: 800px) {
    .iq-navbar-header { min-height: 140px !important; }
    .iq-navbar-header .container-fluid { padding-top: 1.25rem; padding-bottom: 1.25rem; }
    .iq-navbar-header h1 { font-size: 1.5rem; line-height: 1.25; margin-bottom: 0.25rem; }
    .iq-navbar-header p { font-size: 0.9rem; }
    .content-inner.mt-n5 { margin-top: -2.5rem !important; }
}

/* A list of label/value pairs (Meus dados) reads as two columns on a wide screen and one block each on a phone. */
.data-list dt { color: var(--bs-heading-color); font-weight: 600; padding: 0.6rem 0 0; }
.data-list dd { margin: 0; padding: 0 0 0.6rem; border-bottom: 1px solid var(--bs-border-color); overflow-wrap: anywhere; }
.data-list dd:last-child { border-bottom: 0; }
@media (min-width: 576px) { .data-list dt, .data-list dd { padding: 0.6rem 0; border-bottom: 1px solid var(--bs-border-color); } .data-list dd:last-child, .data-list dt:nth-last-child(2) { border-bottom: 0; } }
.error-card{max-width:32rem}

/* Home: the three steps of the booking, as cards with a soft icon tile instead of a metric ring. */
.step-card { position: relative; overflow: hidden; }
.step-card::before { content: ''; position: absolute; inset: 0 0 auto 0; height: 4px; background: var(--step-color); }
.step-card .card-body { padding: 1.5rem; }
.step-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
.step-icon { width: 3.5rem; height: 3.5rem; border-radius: 1rem; display: inline-flex; align-items: center; justify-content: center; color: var(--step-color); background: color-mix(in srgb, var(--step-color) 12%, transparent); }
.step-number { font-size: .75rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--step-color); background: color-mix(in srgb, var(--step-color) 12%, transparent); padding: .25rem .65rem; border-radius: 2rem; }
.step-title { margin-bottom: .4rem; }
.step-text { color: var(--bs-body-color); }
.step-primary { --step-color: var(--bs-primary); }
.step-info { --step-color: var(--bs-info); }
.step-success { --step-color: var(--bs-success); }

/* Profile photo (or initial tile) in the navbar and on "Minha conta". */
.avatar-img { border-radius: 50%; object-fit: cover; flex: 0 0 auto; display: inline-flex; }
.avatar-initial { align-items: center; justify-content: center; font-weight: 700; color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .12)); }
.account-menu-head { max-width: 16rem; }
.iq-navbar .dropdown-item { min-height: 44px; display: flex; align-items: center; }

/* "Minha conta": profile header, segmented tabs, section headings, strength bar. */
.profile-card .card-body { padding: 1.5rem; }
.profile-main { display: flex; align-items: center; gap: 1.5rem; flex-wrap: wrap; }
.profile-photo { position: relative; flex: 0 0 auto; line-height: 0; }
.profile-photo .avatar-img { box-shadow: 0 0 0 4px var(--bs-body-bg, #fff), 0 0 0 6px var(--bs-primary-bg-subtle, rgba(58, 87, 232, .2)); }
.photo-button { position: absolute; right: -2px; bottom: -2px; width: 40px; height: 40px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--bs-primary); color: #fff; cursor: pointer; border: 3px solid #fff; box-shadow: 0 2px 8px rgba(0, 0, 0, .18); transition: transform .15s; }
.photo-button:hover, .photo-button:focus-within { transform: scale(1.08); }
.photo-button input { position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0; cursor: pointer; font-size: 0; }
.profile-who { flex: 1 1 14rem; min-width: 0; }
.profile-mail { color: var(--bs-body-color); overflow-wrap: anywhere; }
.profile-actions { flex: 0 0 auto; }

.account-tabs { display: flex; gap: .25rem; padding: .3rem; margin: 0 0 1rem; background: var(--bs-body-bg, #fff); border-radius: .75rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); overflow-x: auto; scrollbar-width: none; width: fit-content; max-width: 100%; }
.account-tabs::-webkit-scrollbar { display: none; }
.account-tab { flex: 0 0 auto; min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.1rem; border-radius: .55rem; font-weight: 600; color: var(--bs-body-color); text-decoration: none; white-space: nowrap; }
.account-tab:hover { color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .08)); }
.account-tab.active { color: #fff; background: var(--bs-primary); }

.section-head { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.4rem; }
.section-icon { width: 2.75rem; height: 2.75rem; flex: 0 0 auto; border-radius: .8rem; display: inline-flex; align-items: center; justify-content: center; color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .12)); }
.content-inner .card .form-control { min-height: 48px; border-radius: .6rem; }
.content-inner .card .form-control:disabled { background: var(--bs-secondary-bg, #f1f3f9); }
.form-footer { display: flex; align-items: center; justify-content: flex-end; flex-wrap: wrap; gap: .75rem 1rem; padding: 1rem 1.5rem; background: transparent; border-top: 1px solid var(--bs-border-color); }
.form-footer .hint { flex: 1 1 14rem; }
.password-gate { padding: 1rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }

.strength { height: 6px; border-radius: 3px; background: var(--bs-border-color); margin-top: .5rem; overflow: hidden; }
.strength span { display: block; height: 100%; width: 0; border-radius: 3px; transition: width .2s, background .2s; }
.strength[data-level="1"] span { width: 25%; background: var(--bs-danger); }
.strength[data-level="2"] span { width: 50%; background: var(--bs-warning); }
.strength[data-level="3"] span { width: 75%; background: var(--bs-info); }
.strength[data-level="4"] span { width: 100%; background: var(--bs-success); }

.device-row { display: flex; align-items: center; gap: .9rem; padding: .8rem 0; border-bottom: 1px solid var(--bs-border-color); }
.device-dot { width: .7rem; height: .7rem; border-radius: 50%; background: var(--bs-border-color); flex: 0 0 auto; }
.device-dot.ok { background: var(--bs-success); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bs-success) 18%, transparent); }
.device-dot.warn { background: var(--bs-warning); box-shadow: 0 0 0 4px color-mix(in srgb, var(--bs-warning) 22%, transparent); }

@media (max-width: 575.98px) {
    .profile-main { flex-direction: column; text-align: center; gap: 1rem; }
    .profile-who { flex: 0 0 auto; }
    .profile-main .d-flex { justify-content: center; }
    .account-tabs { width: 100%; }
    .form-footer .btn { width: 100%; }
}

/* Patient pages: search, service cards, slot chips, appointment cards. */
.search-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 0 1rem; align-items: end; }
.search-submit .btn { width: 100%; min-height: 48px; }
.content-inner .card .form-select { min-height: 48px; }

a.service-card, a.appt-card { color: inherit; text-decoration: none; transition: transform .15s, box-shadow .15s; }
a.service-card:hover, a.appt-card:hover { transform: translateY(-2px); box-shadow: 0 8px 24px rgba(58, 87, 232, .14); color: inherit; }
a.service-card:focus-visible, a.appt-card:focus-visible { outline: 2px solid var(--bs-primary); outline-offset: 2px; }
.service-name { margin-bottom: .6rem; }
.service-clinic { display: flex; gap: .5rem; align-items: flex-start; margin: 0; color: var(--bs-body-color); }
.service-clinic svg { flex: 0 0 auto; margin-top: .15rem; color: var(--bs-primary); }
.service-foot { display: flex; justify-content: space-between; align-items: center; gap: 1rem; padding: 1rem 1.25rem; background: transparent; border-top: 1px dashed var(--bs-border-color); }
.service-price { font-weight: 700; color: var(--bs-primary); font-size: 1.05rem; }

.detail-head { display: flex; gap: 1rem; align-items: center; margin-bottom: 1.25rem; }
.fact-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 1rem; margin-bottom: 1.25rem; }
.fact { padding: .9rem 1rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.fact small { display: block; }
.slot-day { text-transform: capitalize; margin-bottom: .9rem; color: var(--bs-heading-color); }
.slots { display: flex; flex-wrap: wrap; gap: .6rem; }
.slots form.inline { margin: 0; }
.slot-chip { min-width: 4.5rem; min-height: 44px; padding: 0 1rem; display: inline-flex; align-items: center; justify-content: center; border-radius: 2rem; font-weight: 700; color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .1)); border: 1px solid transparent; transition: background .15s, color .15s; }
button.slot-chip { cursor: pointer; }
button.slot-chip:hover, button.slot-chip:focus-visible { color: #fff; background: var(--bs-primary); }
.slot-chip.disabled { opacity: .7; }

.appt-card { margin-bottom: .9rem; }
.appt-body { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.25rem; }
.date-tile { flex: 0 0 auto; width: 3.6rem; height: 3.9rem; border-radius: .9rem; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1.1; color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .12)); }
.date-tile strong { font-size: 1.35rem; }
.date-tile small { font-size: .65rem; letter-spacing: .08em; font-weight: 700; }
.appt-info { flex: 1 1 auto; min-width: 0; }
.appt-meta { display: flex; flex-wrap: wrap; gap: .25rem .9rem; align-items: center; }
.appt-status { flex: 0 0 auto; }
.empty-state .card-body { padding: 2.5rem 1.5rem; }
@media (max-width: 575.98px) {
    .appt-body { flex-wrap: wrap; }
    .appt-status { margin-left: 4.6rem; }
}
.content-inner button.slot-chip { color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .1)); box-shadow: none; }
.content-inner button.slot-chip:hover, .content-inner button.slot-chip:focus-visible { color: #fff; background: var(--bs-primary); }

/* Number cards (dashboards): icon tile in the tone's colour, label, number, note. */
.kpi-card { --kpi-color: var(--bs-primary); }
.kpi-info { --kpi-color: var(--bs-info); }
.kpi-success { --kpi-color: var(--bs-success); }
.kpi-warning { --kpi-color: var(--bs-warning); }
.kpi-danger { --kpi-color: var(--bs-danger); }
.kpi-card .card-body { display: flex; align-items: center; gap: 1rem; padding: 1.25rem 1.5rem; }
.kpi-icon { width: 3.4rem; height: 3.4rem; flex: 0 0 auto; border-radius: 1rem; display: inline-flex; align-items: center; justify-content: center; color: var(--kpi-color); background: color-mix(in srgb, var(--kpi-color) 14%, transparent); }
.kpi-text { min-width: 0; }
.kpi-label { margin: 0 0 .15rem; font-size: .8rem; font-weight: 600; letter-spacing: .02em; color: var(--bs-body-color); }
.kpi-value { margin: 0; font-size: 1.6rem; line-height: 1.2; overflow-wrap: anywhere; }
.kpi-note { display: block; margin-top: .15rem; color: var(--bs-body-color); }
.row.g-3 > .col > .kpi-card, .row > .col > .kpi-card { margin-bottom: 0; }

/* Polish for lists and headings on every screen (wide layouts; phones keep their stacked cards). */
.content-inner .card-head h2 { font-size: 1.15rem; display: flex; align-items: center; gap: .6rem; }
.content-inner .card-head h2::before { content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--bs-primary); flex: 0 0 auto; }
.content-inner .card > h2 { font-size: 1.15rem; margin-bottom: 1rem; display: flex; align-items: center; gap: .6rem; }
.content-inner .card > h2::before { content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--bs-primary); flex: 0 0 auto; }
.content-inner thead th { font-size: .72rem; letter-spacing: .06em; text-transform: uppercase; color: var(--bs-body-color); background: var(--bs-secondary-bg, #f1f3f9); border-bottom: 1px solid var(--bs-border-color); }
.content-inner td[colspan] { text-align: center; padding: 2.25rem 1rem; color: var(--bs-body-color); }
@media (min-width: 800px) {
    .content-inner tbody tr { transition: background .12s; }
    .content-inner tbody tr:hover { background: color-mix(in srgb, var(--bs-primary) 4%, transparent); }
    .content-inner tbody td:first-child strong { font-weight: 600; color: var(--bs-heading-color); }
    /* The action in a row is a quiet button; the main button of a form stays solid. */
    html body .content-inner td > :is(button, a.btn):not(.danger):not([class*="btn-"]), html body .content-inner td form > button:not(.danger):not([class*="btn-"]) { color: var(--bs-primary) !important; background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .1)) !important; box-shadow: none; border-color: transparent; }
    html body .content-inner td > :is(button, a.btn):not(.danger):not([class*="btn-"]):hover, html body .content-inner td form > button:not(.danger):not([class*="btn-"]):hover { color: #fff !important; background: var(--bs-primary) !important; }
}

/* Backoffice clinic cards: who it is, a checklist of set-up steps, and the decision buttons. */
.clinic-card { margin-bottom: 1rem; }
.clinic-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.clinic-title { flex: 1 1 12rem; min-width: 0; }
.step-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem; }
.step-box { padding: 1rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; margin: 0; }
.step-box-head { display: flex; align-items: center; gap: .6rem; margin-bottom: .5rem; }
.step-box .form-control { min-height: 42px; min-width: 0; width: 100%; }
.clinic-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .75rem; padding: 1rem 1.5rem; background: transparent; border-top: 1px solid var(--bs-border-color); }
.reject-form { display: flex; gap: .5rem; flex: 1 1 18rem; margin: 0; }
.reject-form .form-control { min-height: 44px; }
.clinic-actions form.inline { margin: 0; }
@media (max-width: 575.98px) { .clinic-actions .btn, .reject-form { width: 100%; } .reject-form { flex-direction: column; } }

/* The old segmented filter now looks like the account tabs. */
.seg { gap: .25rem; padding: .3rem; background: var(--bs-body-bg, #fff); border-radius: .75rem; box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.seg a { margin: 0; min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.1rem; border: 0; border-radius: .55rem !important; font-weight: 600; background: transparent; color: var(--bs-body-color); }
.seg a:hover:not(.on) { color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .08)); }
.seg a.on { color: #fff; background: var(--bs-primary); }

/* Sign-in and sign-up pages: pitch over the artwork, account-type switch, numbered sections. */
.login-content .auth-art-col { position: sticky; }
.auth-pitch { position: absolute; inset: auto 0 0 0; padding: 4rem 2.5rem 2.5rem; color: #fff; background: linear-gradient(to top, rgba(8, 20, 80, .78), rgba(8, 20, 80, 0)); }
.auth-pitch h2 { color: #fff; font-size: 1.6rem; line-height: 1.25; margin-bottom: 1.25rem; max-width: 26rem; }
.auth-pitch ul { list-style: none; margin: 0; padding: 0; display: grid; gap: .8rem; max-width: 26rem; }
.auth-pitch li { display: flex; align-items: center; gap: .8rem; font-size: .95rem; }
.auth-pitch li span { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; background: rgba(255, 255, 255, .2); border: 1px solid rgba(255, 255, 255, .45); }

.auth-switch { display: flex; gap: .25rem; padding: .3rem; margin: 0 auto 1.25rem; width: fit-content; max-width: 100%; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.auth-switch a { min-height: 44px; display: inline-flex; align-items: center; padding: 0 1.25rem; border-radius: .55rem; font-weight: 600; color: var(--bs-body-color); text-decoration: none; white-space: nowrap; }
.auth-switch a.on { color: #fff; background: var(--bs-primary); box-shadow: 0 4px 12px rgba(58, 87, 232, .25); }
.auth-switch a:not(.on):hover { color: var(--bs-primary); }

.auth-divider { display: flex; align-items: center; gap: 1rem; margin: 1.5rem 0 1rem; color: var(--bs-body-color); font-size: .875rem; }
.auth-divider::before, .auth-divider::after { content: ''; flex: 1; height: 1px; background: var(--bs-border-color); }
.auth-choices { display: grid; grid-template-columns: 1fr 1fr; gap: .75rem; }
.login-content a.auth-choice { display: block; padding: .9rem 1rem; border: 1px solid var(--bs-border-color); border-radius: .75rem; text-decoration: none; text-align: left; color: var(--bs-heading-color); transition: border-color .15s, background .15s; }
.login-content a.auth-choice:hover { border-color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .06)); }
.auth-choice strong { display: block; color: var(--bs-primary); }
.auth-choice small { display: block; color: var(--bs-body-color); line-height: 1.3; margin-top: .15rem; }

.auth-section { display: flex; align-items: center; gap: .65rem; margin: 1.5rem 0 1rem; font-weight: 700; color: var(--bs-heading-color); }
.auth-section:first-child { margin-top: .5rem; }
.auth-section span { width: 1.7rem; height: 1.7rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: .8rem; color: #fff; background: var(--bs-primary); }
.consent-box { padding: 1rem; margin: .5rem 0 1.25rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.login-content .consent-box label a { color: var(--bs-primary); text-decoration: underline; }
.login-content .btn-lg { min-height: 52px; }
@media (max-width: 575.98px) { .auth-choices { grid-template-columns: 1fr; } .auth-switch { width: 100%; } .auth-switch a { flex: 1; justify-content: center; padding: 0 .5rem; } }
.login-content .col-lg-12.d-flex { gap: 0 1rem; }

/* Error pages. */
.error-card { max-width: 34rem; --err-color: var(--bs-primary); }
.error-warning { --err-color: var(--bs-warning); }
.error-danger { --err-color: var(--bs-danger); }
.error-card .card-body { padding: 2.5rem 2rem; text-align: center; }
.error-icon { width: 4.5rem; height: 4.5rem; margin: 0 auto 1rem; border-radius: 1.25rem; display: inline-flex; align-items: center; justify-content: center; color: var(--err-color); background: color-mix(in srgb, var(--err-color) 14%, transparent); }
.error-code { margin: 0; font-size: 4.5rem; font-weight: 800; line-height: 1; letter-spacing: -.02em; color: var(--err-color); }
.error-text { margin: .75rem auto 1.75rem; max-width: 26rem; color: var(--bs-body-color); }
.error-actions { display: flex; flex-wrap: wrap; gap: .75rem; justify-content: center; }
@media (max-width: 575.98px) { .error-actions .btn { width: 100%; } .error-code { font-size: 3.75rem; } }

/* Home: search box, section titles, benefits, clinic call to action. */
.home-search-form { display: flex; gap: .75rem; }
.home-search-form .form-control { flex: 1 1 auto; min-height: 52px; font-size: 1rem; }
.home-search-form .btn { flex: 0 0 auto; min-height: 52px; padding: 0 1.75rem; }
.home-alt { margin-top: 1rem; font-size: .9rem; }
.section-title { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; margin: 1.75rem 0 .9rem; }
.benefit { display: flex; gap: 1rem; align-items: flex-start; padding: 1.25rem; height: 100%; border-radius: .75rem; background: var(--bs-body-bg, #fff); box-shadow: 0 1px 3px rgba(0, 0, 0, .06); }
.clinic-cta .card-body { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 1rem 2rem; padding: 1.75rem 2rem; }
.clinic-cta { color: #fff; background: linear-gradient(100deg, var(--bs-primary), color-mix(in srgb, var(--bs-primary) 70%, #000)); }
.clinic-cta h2, .clinic-cta p { color: #fff; }
.clinic-cta .btn { color: var(--bs-primary); background: #fff; border-color: #fff; }
.clinic-cta .btn:hover { background: var(--bs-primary-bg-subtle); }
@media (max-width: 575.98px) { .home-search-form { flex-direction: column; } .home-search-form .btn, .clinic-cta .btn { width: 100%; } }

/* Check-in: camera frame, big code field, confirmation card. */
.scan-frame { position: relative; aspect-ratio: 4 / 3; max-height: 420px; width: 100%; border-radius: 1rem; overflow: hidden; background: #0b1230; display: flex; align-items: center; justify-content: center; }
.scan-frame video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.scan-frame video[hidden] + .scan-placeholder { display: flex; }
.scan-frame video:not([hidden]) + .scan-placeholder { display: none; }
.scan-placeholder { flex-direction: column; align-items: center; gap: 1rem; padding: 1rem; text-align: center; color: rgba(255, 255, 255, .75); }
.scan-corners { width: 9rem; height: 9rem; border-radius: 1rem; background:
    linear-gradient(var(--bs-primary), var(--bs-primary)) top left / 2rem 4px no-repeat, linear-gradient(var(--bs-primary), var(--bs-primary)) top left / 4px 2rem no-repeat,
    linear-gradient(var(--bs-primary), var(--bs-primary)) top right / 2rem 4px no-repeat, linear-gradient(var(--bs-primary), var(--bs-primary)) top right / 4px 2rem no-repeat,
    linear-gradient(var(--bs-primary), var(--bs-primary)) bottom left / 2rem 4px no-repeat, linear-gradient(var(--bs-primary), var(--bs-primary)) bottom left / 4px 2rem no-repeat,
    linear-gradient(var(--bs-primary), var(--bs-primary)) bottom right / 2rem 4px no-repeat, linear-gradient(var(--bs-primary), var(--bs-primary)) bottom right / 4px 2rem no-repeat; }
html body .content-inner .card .form-control.code-input { min-height: 64px; text-align: center; font-size: 1.6rem !important; font-weight: 700; letter-spacing: .3em; text-transform: uppercase; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }
.code-input::placeholder { letter-spacing: .3em; font-weight: 400; opacity: .35; }
.confirm-card { max-width: 40rem; }
.confirm-who { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; }
.confirm-actions { display: grid; gap: .75rem; }
.confirm-actions form { margin: 0; }
.confirm-actions .btn { min-height: 56px; }

/* Documents: progress, file row, upload form. */
.doc-progress { height: 10px; border-radius: 5px; background: var(--bs-border-color); overflow: hidden; }
.doc-progress span { display: block; height: 100%; border-radius: 5px; background: linear-gradient(90deg, var(--bs-primary), var(--bs-success)); transition: width .3s; }
.doc-card { margin-bottom: 1rem; }
.doc-card .doc-head { align-items: center; gap: 1rem; flex-wrap: nowrap; }
.doc-card .doc-head .doc-title { flex: 1 1 auto; min-width: 0; }
.doc-card .doc-head p { margin: 0; }
.file-row { display: flex; align-items: center; gap: .9rem; margin-top: 1.1rem; padding: .8rem 1rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); flex-wrap: wrap; }
.file-icon { width: 2.4rem; height: 2.4rem; flex: 0 0 auto; border-radius: .6rem; display: inline-flex; align-items: center; justify-content: center; color: var(--bs-primary); background: var(--bs-body-bg, #fff); }
.file-info { flex: 1 1 12rem; min-width: 0; overflow-wrap: anywhere; }
.upload-form { margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed var(--bs-border-color); }
.upload-form .form-control { min-height: 48px; }
.upload-form .btn { min-height: 48px; }
.doc-card .upload-form input[type=file] { padding-top: .7rem; }
@media (max-width: 575.98px) { .doc-card .doc-head { flex-wrap: wrap; } .upload-form .btn, .upload-form .inline-label, .upload-form .inline-label input { width: 100%; } }

/* Team cards and the appointments list. */
.person-card.is-off { opacity: .75; }
.person-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.1rem; }
.person-id { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.person-role { padding: .9rem 1rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.person-role .doc-form { margin: 0; flex-wrap: nowrap; }
.person-role .form-select { min-height: 44px; }
.person-role .btn { min-height: 44px; }
.person-foot { display: flex; justify-content: flex-end; padding: .75rem 1.25rem; background: transparent; border-top: 1px dashed var(--bs-border-color); }
.person-foot form { margin: 0; }

.list-row { display: flex; align-items: center; gap: 1rem; padding: 1rem 1.5rem; border-bottom: 1px solid var(--bs-border-color); transition: background .12s; }
.list-row:last-child { border-bottom: 0; }
.list-row:hover { background: color-mix(in srgb, var(--bs-primary) 4%, transparent); }
.list-main { flex: 1 1 auto; min-width: 0; }
.list-side { flex: 0 0 auto; display: flex; flex-direction: column; align-items: flex-end; gap: .2rem; text-align: right; max-width: 18rem; }
@media (max-width: 575.98px) {
    .list-row { flex-wrap: wrap; padding: 1rem; }
    .list-main { flex: 1 1 0; }
    .list-side { flex: 1 1 100%; flex-direction: row; flex-wrap: wrap; align-items: center; gap: .4rem .75rem; max-width: none; text-align: left; padding-top: .5rem; border-top: 1px dashed var(--bs-border-color); }
    .list-side small { flex-basis: 100%; }
    .person-role .doc-form { flex-wrap: wrap; }
    .person-role .btn { width: 100%; }
}

/* Services, slots and professionals: inactive cards fade; the neutral badge exists. */
.service-admin-card.is-off { opacity: .7; }
.service-admin-card .service-foot { align-items: center; }
.service-admin-card .service-foot form { margin: 0; }
.content-inner .badge.neutral { color: var(--bs-body-color); background-color: var(--bs-secondary-bg, #f1f3f9); }

/* Roles and permissions. */
.role-row { flex-wrap: wrap; }
.role-name { font-size: .75rem; }
.role-actions { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: flex-end; }
.role-actions form { margin: 0; }
.content-inner .card.perm-group { padding: 0; border: 0; margin: 0; }
.content-inner .card.perm-group legend { float: none; width: 100%; padding: 1rem 1.5rem; margin: 0; font-size: 1rem; font-weight: 700; border-bottom: 1px solid var(--bs-border-color); display: flex; align-items: center; gap: .6rem; }
.content-inner .card.perm-group legend::before { content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--bs-primary); }
.content-inner .card.perm-group .card-body { padding: .75rem 1.5rem 1rem; }
.check.perm { padding: .45rem 0 .45rem 2rem; border-bottom: 1px solid color-mix(in srgb, var(--bs-border-color) 60%, transparent); }
.check.perm:last-child { border-bottom: 0; }
.check.perm input[type=checkbox] { left: 0; top: .6rem; width: 1.15rem; height: 1.15rem; }
@media (max-width: 575.98px) { .role-actions { justify-content: flex-start; width: 100%; } }

/* Settings: sub-headings inside a card, colour pickers, spacing between the stacked forms. */
.settings-sub { margin: 1.75rem 0 .9rem; padding-top: 1.25rem; border-top: 1px dashed var(--bs-border-color); font-weight: 700; }
.settings-forms > .card { margin-bottom: 1rem; }
.content-inner .card .form-control.color-input { width: 100%; max-width: 8rem; min-height: 48px; padding: .3rem; cursor: pointer; }
.logo-preview { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; margin-bottom: .6rem; padding: .75rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.logo-preview img { max-height: 48px; max-width: 160px; }

/* Refunds and document expiry. */
.refund-card { margin-bottom: 1rem; }
.refund-card.is-late { border-left: 4px solid var(--bs-danger); }
.refund-head { display: flex; align-items: center; gap: 1rem; margin-bottom: 1.25rem; flex-wrap: wrap; }
.refund-who { flex: 1 1 12rem; min-width: 0; }
.refund-amount { font-size: 1.5rem; font-weight: 800; color: var(--bs-heading-color); }
.refund-actions { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 1rem; padding: 1rem 1.5rem; background: transparent; border-top: 1px solid var(--bs-border-color); }
.refund-actions form { margin: 0; }
.refund-actions .manual-refund { max-width: 280px; margin: 0; flex: 0 1 280px; }
.refund-actions .manual-refund summary { min-height: 44px; display: flex; align-items: center; font-weight: 600; }
.fact .badge { align-self: flex-start; }
.fact { display: flex; flex-direction: column; gap: .25rem; align-items: flex-start; }
.expiry-row .list-side { flex-direction: row; flex-wrap: wrap; justify-content: flex-end; align-items: center; gap: .5rem; max-width: 22rem; }
@media (max-width: 575.98px) { .refund-actions .btn { width: 100%; } .refund-actions .manual-refund { max-width: none; flex-basis: 100%; } .expiry-row > .btn { width: 100%; } }

/* Users screen. */
.list-row.is-off { opacity: .7; }
.user-mail { overflow-wrap: anywhere; }
.section-icon.danger-tile { color: var(--bs-danger); background: color-mix(in srgb, var(--bs-danger) 14%, transparent); }
.list-row .list-side { flex-direction: row; align-items: center; gap: .6rem; }
@media (max-width: 575.98px) { .list-row .list-side { margin-left: 0; } }

/* Appointment detail (Pix and voucher) and the patient's data page. */
.qr-frame { width: fit-content; max-width: 100%; margin: 1rem auto; padding: 1rem; border-radius: 1rem; background: #fff; border: 1px solid var(--bs-border-color); box-shadow: 0 4px 16px rgba(0, 0, 0, .06); }
.qr-frame svg, .qr-frame img { display: block; width: 100%; max-width: 260px; height: auto; }
.voucher-card { border-top: 4px solid var(--bs-success); }
.voucher-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 1.8rem; font-weight: 800; letter-spacing: .2em; color: var(--bs-heading-color); }
.content-inner .card .pix-code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: .8rem; word-break: break-all; }
.danger-zone { border: 1px solid color-mix(in srgb, var(--bs-danger) 40%, transparent); }
.detail-head .date-tile { flex: 0 0 auto; }

/* Legal pages: a readable column and clear headings. */
.legal-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .6rem; margin-bottom: 1rem; }
.content-inner .card.prose { padding: 0; }
.prose { max-width: 56rem; margin-left: auto; margin-right: auto; padding: 2rem 2.25rem !important; line-height: 1.75; }
.prose h2 { font-size: 1.15rem; margin: 2rem 0 .75rem; padding-top: 1.25rem; border-top: 1px solid var(--bs-border-color); display: flex; align-items: center; gap: .6rem; }
.prose h2:first-child { margin-top: 0; padding-top: 0; border-top: 0; }
.prose h2::before { content: ''; width: 4px; height: 1.1em; border-radius: 2px; background: var(--bs-primary); flex: 0 0 auto; }
.prose p, .prose li { color: var(--bs-body-color); }
.prose li { margin-bottom: .4rem; }
@media (max-width: 575.98px) { .prose { padding: 1.25rem 1rem !important; } }

/* Confirm-your-e-mail steps. */
.verify-steps { list-style: none; margin: 1rem 0 1.5rem; padding: 0; display: grid; gap: .75rem; }
.verify-steps li { display: flex; align-items: center; gap: .8rem; padding: .75rem 1rem; border-radius: .75rem; background: var(--bs-secondary-bg, #f1f3f9); }
.verify-steps span { flex: 0 0 auto; width: 1.9rem; height: 1.9rem; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: .85rem; color: #fff; background: var(--bs-primary); }

/* Document review actions in the backoffice. */
.review-actions { display: flex; flex-wrap: wrap; gap: 1rem; margin-top: 1.1rem; padding-top: 1.1rem; border-top: 1px dashed var(--bs-border-color); }
.review-actions form { margin: 0; }
.review-actions .doc-form { margin: 0; flex: 1 1 18rem; }
.review-actions .form-control { min-height: 44px; }
.review-actions .btn { min-height: 44px; }
@media (max-width: 575.98px) { .review-actions .btn { width: 100%; } }

/* Check-in: today's expected patients. */
.expected-card .card-head { padding-bottom: .5rem; }
.time-tile { flex: 0 0 auto; min-width: 4rem; height: 3rem; padding: 0 .6rem; border-radius: .8rem; display: flex; align-items: center; justify-content: center; font-weight: 800; font-size: 1.05rem; color: var(--bs-primary); background: var(--bs-primary-bg-subtle, rgba(58, 87, 232, .12)); }
.expected-row .list-side form { margin: 0; }
.expected-row .btn { min-height: 48px; }
.expected-row[hidden] { display: none; }
.attended { border-top: 1px solid var(--bs-border-color); }
.attended summary { cursor: pointer; padding: 1rem 1.5rem; font-weight: 600; min-height: 44px; }
.attended-row { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem 1rem; padding: .6rem 1.5rem; border-top: 1px solid color-mix(in srgb, var(--bs-border-color) 60%, transparent); }
@media (max-width: 575.98px) { .expected-row .list-side, .expected-row .btn { width: 100%; } }

/* Two-step sign-in: recovery codes. */
.recovery-codes { display: grid; grid-template-columns: repeat(auto-fit, minmax(9.5rem, 1fr)); gap: .6rem; margin-top: 1rem; }
.recovery-codes code { display: block; padding: .6rem .8rem; text-align: center; font-size: 1rem; font-weight: 700; letter-spacing: .08em; border-radius: .6rem; color: var(--bs-heading-color); background: var(--bs-secondary-bg, #f1f3f9); }
@media print { .iq-navbar, .sidebar, .iq-navbar-header, .account-tabs, .footer, .btn { display: none !important; } .recovery-codes code { border: 1px solid #999; } }
