/* Storg's components (design.md): the TextField with its floating label, the Select, the Button
   variants, the specialty chips, the card, the step counter, the notice, the Toast and the
   navigation rail. Every colour is a token of storg-tokens.css, so one rule serves both themes. */

.storg-page,
.storg-page button,
.storg-page input,
.storg-page select,
.storg-page textarea {
    font-family: var(--font-foxe);
}

/* Every number a person reads (amount, date, time, age, count, code) stays in FoXE, its figures
   drawn tabular so they line up in a column (design.md, "Fonts"). */
.storg-number {
    font-variant-numeric: tabular-nums;
}

/* A component's own display never overrides the hidden attribute a script toggles. */
.storg-page [hidden] {
    display: none !important;
}

/* A page's own ground is --bg-page: nothing is written on --bg-body, the ground behind it. */
.storg-page {
    margin: 0;
    background: var(--bg-page);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 24px;
}

/* TextField: the label sits on the border, notched into it, in the field's fill. */
.storg-field {
    position: relative;
    margin-top: var(--space-20);
    text-align: left;
}

.storg-field > label,
.storg-field > .storg-field-label {
    position: absolute;
    top: -9px;
    left: var(--space-10);
    padding: 0 var(--space-4);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 13.6px;
    font-weight: 500;
    line-height: 16px;
    z-index: 1;
}

.storg-field input,
.storg-field select,
.storg-field textarea {
    box-sizing: border-box;
    width: 100%;
    min-height: var(--field-height);
    padding: var(--space-10) var(--space-12);
    background: var(--surface-input);
    color: var(--text-primary);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    font-size: 16px;
    line-height: 24px;
}

.storg-field textarea {
    min-height: 96px;
    resize: vertical;
}

.storg-field input::placeholder,
.storg-field textarea::placeholder {
    color: var(--text-placeholder);
    opacity: 1;
}

.storg-field input:hover,
.storg-field input:focus,
.storg-field select:hover,
.storg-field select:focus,
.storg-field textarea:hover,
.storg-field textarea:focus {
    outline: none;
    box-shadow: var(--shadow-focus);
}

/* Select: the native list, its arrow replaced by the Bootstrap Icons chevron. A line with its
   suggestions (<input list>) draws the same chevron over the browser's own triangle, kept unseen
   in its place, so a click on the chevron still opens the suggestions. */
.storg-select {
    position: relative;
    display: block;
}

.storg-field .storg-select select {
    appearance: none;
    padding-right: 40px;
    cursor: pointer;
}

.storg-select input::-webkit-calendar-picker-indicator {
    opacity: 0;
    cursor: pointer;
}

.storg-select > .bi-chevron-down {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    color: var(--text-primary);
    font-size: 14px;
    pointer-events: none;
}

.storg-field select:disabled {
    opacity: 0.6;
}

.storg-field.is-invalid input,
.storg-field.is-invalid select,
.storg-field.is-invalid textarea,
.storg-field.is-invalid .specialty-picker {
    border-color: var(--danger-text);
}

.storg-field-error {
    margin-top: var(--space-4);
    color: var(--danger-text);
    font-size: 14px;
    line-height: 20px;
}

.storg-field-error:empty {
    display: none;
}

/* Date field (assets/js/date-field.js): the date typed as dd/mm/yyyy in a text field, a calendar
   button opening the browser's picker, the date input itself kept under them unseen so a form posts
   and a script reads it as before. */
.storg-date-field {
    position: relative;
    display: block;
}

.storg-field .storg-date-field .storg-date-shown {
    padding-right: 44px;
}

.storg-date-pick {
    position: absolute;
    top: 50%;
    right: var(--space-8);
    transform: translateY(-50%);
    padding: var(--space-4) var(--space-8);
    background: none;
    border: 0;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

.storg-date-pick:focus-visible {
    outline: 2px solid var(--focus-ring);
    border-radius: var(--radius-sm);
}

.storg-field .storg-date-field .storg-date-native,
.storg-date-field .storg-date-native {
    position: absolute;
    inset: 0;
    width: 100%;
    min-height: 0;
    height: 100%;
    margin: 0;
    padding: 0;
    border: 0;
    opacity: 0;
    pointer-events: none;
}

/* Button: 43px tall, 16px Regular labels, 12px corners. */
.storg-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-8);
    min-height: var(--button-height);
    padding: 0 var(--space-20);
    border: 1px solid transparent;
    border-radius: var(--radius-xl);
    background: var(--primary);
    color: var(--on-primary);
    font-size: 16px;
    text-decoration: none;
    cursor: pointer;
}

/* The icon beside a button's label. */
.storg-button .bi {
    font-size: var(--icon-label);
}

.storg-button:hover,
.storg-button:focus-visible {
    background: var(--primary-hover);
}

.storg-button:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.storg-button[disabled] {
    opacity: 0.6;
    cursor: progress;
}

.storg-button-save {
    background: var(--accent-save);
    color: var(--on-accent-save);
}

.storg-button-save:hover,
.storg-button-save:focus-visible {
    background: var(--accent-save-hover);
}

.storg-button-outline {
    background: transparent;
    border-color: var(--border-outline);
    color: var(--text-primary);
}

.storg-button-outline:hover,
.storg-button-outline:focus-visible {
    background: var(--tint-primary);
}

.storg-button-quiet {
    background: var(--button-quiet);
    color: var(--text-primary);
}

.storg-button-quiet:hover,
.storg-button-quiet:focus-visible {
    background: var(--tint-primary);
}

.storg-button-block {
    width: 100%;
}

/* Card */
.storg-card {
    background: var(--surface-card);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    padding: var(--space-16);
}

/* Step counter: the step's number in a ring that fills as the steps go by. */
.storg-step-ring {
    --progress: 0;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    margin: 0 auto var(--space-12);
    border-radius: 50%;
    background: conic-gradient(var(--accent) calc(var(--progress) * 1turn), var(--border-default) 0);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 700;
}

.storg-step-ring span {
    display: grid;
    place-items: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: var(--bg-page);
}

/* Notice: an icon and a sentence on a quiet ground. */
.storg-notice {
    display: flex;
    align-items: center;
    gap: var(--space-12);
    padding: var(--space-10) var(--space-12);
    border-radius: var(--radius-sm);
    background: var(--tint-primary);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 20px;
    text-align: left;
}

.storg-notice .bi {
    font-size: 22px;
    color: var(--accent);
}

/* Toast: top centre, 340px wide, a 5px bar on its left. Over the page by its layer; while a modal
   dialog is open, inside it (storg-toast.js), since the top layer is out of any z-index's reach. */
.storg-toast-stack {
    position: fixed;
    top: var(--space-16);
    left: 50%;
    transform: translateX(-50%);
    display: grid;
    gap: var(--space-8);
    z-index: var(--layer-toast);
}

.storg-toast {
    width: min(340px, calc(100vw - 32px));
    padding: var(--space-12) var(--space-16);
    border-left: 5px solid var(--toast-success-border);
    border-radius: var(--radius-sm);
    background: var(--toast-success-bg);
    color: var(--toast-success-text);
    font-size: 15px;
    font-weight: 500;
    line-height: 1.4;
    box-shadow: var(--shadow-dialog);
}

.storg-toast-error {
    border-left-color: var(--toast-error-border);
    background: var(--toast-error-bg);
    color: var(--toast-error-text);
}

/* NavRail (design.md): 64px of 26px icons on the page's left edge, 200px with the labels while the
   pointer rests on it or a link holds the keyboard's focus; links 56px tall, the open view's
   filled with the active colour and marked by a 2px bar. Switch Mode and Cerrar sesión stand at
   its foot, *Mi perfil* among them with the person's picture. In the menu layout (a phone) it is
   the MobileMenu: a full-width menu dropped from the top by the 44 x 42 hamburger at the top right
   (the bell at its left while it is dropped), the page behind dimmed. */
.storg-rail {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    z-index: var(--layer-shell);
    width: 64px;
    overflow: hidden;
    background: var(--bg-sidebar);
    transition: width 0.15s ease;
}

.storg-rail:hover,
.storg-rail:has(.storg-rail-link:focus-visible) {
    width: 200px;
    box-shadow: var(--shadow-raised);
}

.storg-rail-menu {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 100%;
    overflow-x: hidden;
    overflow-y: auto;
}

.storg-rail-links {
    margin: 0;
    padding: 0;
    list-style: none;
}

.storg-rail-link {
    display: flex;
    align-items: center;
    gap: var(--space-16);
    box-sizing: border-box;
    width: 100%;
    height: 56px;
    padding: 0 0 0 16px;
    border: 0;
    border-left: 2px solid transparent;
    background: transparent;
    color: var(--nav-label);
    font-size: 16px;
    font-weight: 700;
    line-height: 24px;
    text-align: left;
    text-decoration: none;
    white-space: nowrap;
    cursor: pointer;
}

.storg-rail-link i {
    flex: none;
    width: 28px;
    color: var(--nav-icon);
    font-size: 26px;
    line-height: 1;
    text-align: center;
}

.storg-rail-label {
    opacity: 0;
    transition: opacity 0.15s ease;
}

.storg-rail:hover .storg-rail-label,
.storg-rail:has(.storg-rail-link:focus-visible) .storg-rail-label {
    opacity: 1;
}

.storg-rail-link:hover,
.storg-rail-link[aria-current="page"] {
    background: var(--bg-nav-active);
}

.storg-rail-link[aria-current="page"],
.storg-rail-link[aria-current="page"] i {
    border-left-color: var(--highlight);
    color: var(--highlight);
}

.storg-rail-link:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: -2px;
}

.storg-rail-toggle {
    display: none;
}

/* *Mi perfil*'s icon is the person's picture, centred where the 28px icons stand. */
.storg-rail-avatar {
    display: flex;
    flex: none;
    justify-content: center;
    width: 28px;
}

.storg-rail-avatar .profile-photo {
    border: 2px solid transparent;
    box-sizing: border-box;
}

.storg-rail-avatar .profile-photo-initial {
    background: var(--primary);
    color: var(--on-primary);
}

/* The person signed in is on line: their picture is ringed in green, as a messenger draws it. */
.storg-rail-avatar .profile-photo {
    border-color: var(--online);
}

/* The phone's hamburger carries a red dot while a notification is unread and the menu is collapsed. */
.storg-rail-dot {
    position: absolute;
    top: -3px;
    right: -3px;
    width: 12px;
    height: 12px;
    box-sizing: border-box;
    border: 2px solid var(--bg-body);
    border-radius: var(--radius-pill);
    background: var(--danger-text);
}

.storg-rail-dot[hidden],
.storg-rail[data-open] .storg-rail-dot {
    display: none;
}

.storg-has-rail {
    padding-left: 64px;
}

/* The rail's mode (storg-shell.js, kept per person in the browser): the round chevron on the rail's
   edge, level with the line under Inicio, moves it from collapsed (64px of icons, each link's name
   in its tooltip) to pinned (200px, the page beside it) to auto (64px, 200px under the pointer) and
   back. StorgRail::bootScript() names the mode on <html> before the first paint, and the layout:
   "menu", the hamburger, on a phone, where the mode does not apply and the chevron is not drawn. */
.storg-rail-mode {
    position: fixed;
    top: 42px;
    left: 50px;
    z-index: calc(var(--layer-shell) + 1);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 2px solid var(--bg-page);
    border-radius: var(--radius-pill);
    background: var(--bg-nav-active);
    color: var(--nav-icon);
    font-size: 14px;
    cursor: pointer;
    transition: left 0.15s ease;
}

.storg-rail-mode:hover,
.storg-rail-mode:focus-visible {
    color: var(--highlight);
    outline: none;
    box-shadow: 0 0 0 2px var(--highlight);
}

html[data-rail-layout="menu"] .storg-rail-mode {
    display: none;
}

html[data-rail-layout="rail"][data-rail-mode="pinned"] .storg-rail {
    width: 200px;
}

html[data-rail-layout="rail"][data-rail-mode="pinned"] .storg-rail-label {
    opacity: 1;
}

html[data-rail-layout="rail"][data-rail-mode="pinned"] .storg-has-rail {
    padding-left: 200px;
}

html[data-rail-layout="rail"][data-rail-mode="pinned"] .storg-rail-mode {
    left: 186px;
}

/* Auto: the chevron rides the edge of the rail open under the pointer or a focused link, and holds it
   open while the pointer that came from the rail is on it (storg-shell.js, data-rail-held). */
html[data-rail-layout="rail"][data-rail-mode="auto"] .storg-rail:hover + .storg-rail-mode,
html[data-rail-layout="rail"][data-rail-mode="auto"] .storg-rail:has(.storg-rail-link:focus-visible) + .storg-rail-mode,
html[data-rail-layout="rail"][data-rail-mode="auto"][data-rail-held] .storg-rail-mode {
    left: 186px;
}

html[data-rail-layout="rail"][data-rail-mode="auto"][data-rail-held] .storg-rail {
    width: 200px;
    box-shadow: var(--shadow-raised);
}

html[data-rail-layout="rail"][data-rail-mode="auto"][data-rail-held] .storg-rail-label {
    opacity: 1;
}

html[data-rail-layout="rail"][data-rail-mode="collapsed"] .storg-rail,
html[data-rail-layout="rail"][data-rail-mode="collapsed"] .storg-rail:hover,
html[data-rail-layout="rail"][data-rail-mode="collapsed"] .storg-rail:has(.storg-rail-link:focus-visible) {
    width: 64px;
    box-shadow: none;
}

html[data-rail-layout="rail"][data-rail-mode="collapsed"] .storg-rail .storg-rail-label {
    opacity: 0;
}

html[data-rail-layout="menu"] .storg-has-rail {
    padding-left: 0;
}

html[data-rail-layout="menu"] .storg-rail,
html[data-rail-layout="menu"] .storg-rail:hover,
html[data-rail-layout="menu"] .storg-rail:has(.storg-rail-link:focus-visible) {
    position: static;
    width: auto;
    overflow: visible;
    background: transparent;
    box-shadow: none;
}

html[data-rail-layout="menu"] .storg-rail-toggle {
    position: fixed;
    top: 10px;
    right: 20px;
    z-index: calc(var(--layer-shell) + 3);
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 42px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-xl);
    background: var(--primary);
    color: var(--on-primary);
    font-size: 16px;
    cursor: pointer;
}

html[data-rail-layout="menu"] .storg-rail-toggle:hover,
html[data-rail-layout="menu"] .storg-rail-toggle:focus-visible {
    background: var(--primary-hover);
}

html[data-rail-layout="menu"] .storg-rail-menu {
    display: none;
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: calc(var(--layer-shell) + 2);
    height: auto;
    max-height: 100vh;
    padding-top: 62px;
    background: var(--bg-sidebar);
}

html[data-rail-layout="menu"] .storg-rail[data-open] .storg-rail-menu {
    display: flex;
}

html[data-rail-layout="menu"] .storg-rail[data-open]::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: calc(var(--layer-shell) + 1);
    background: var(--overlay);
}

html[data-rail-layout="menu"] .storg-rail-label {
    opacity: 1;
}

/* A view's submenu (StorgShell.submenu: the consult's tabs) under its link, drawn in the menu layout
   only and only while that view is open; the current entry marked as the open view's link is. */
.storg-rail-submenu {
    display: none;
    margin: 0;
    padding: 0 0 var(--space-8);
    list-style: none;
}

html[data-rail-layout="menu"] .storg-rail-link[aria-current="page"] ~ .storg-rail-submenu {
    display: block;
}

.storg-rail-sublink {
    display: flex;
    align-items: center;
    gap: var(--space-8);
    box-sizing: border-box;
    width: 100%;
    min-height: 44px;
    padding: 0 var(--space-16) 0 60px;
    border: 0;
    border-left: 2px solid transparent;
    background: transparent;
    color: var(--nav-label);
    font: inherit;
    font-size: 15px;
    text-align: left;
    cursor: pointer;
}

.storg-rail-sublink:hover,
.storg-rail-sublink[aria-current="true"] {
    background: var(--bg-nav-active);
}

.storg-rail-sublink[aria-current="true"] {
    border-left-color: var(--highlight);
    color: var(--highlight);
    font-weight: 700;
}

.storg-rail-sublink:focus-visible {
    outline: 2px solid var(--highlight);
    outline-offset: -2px;
}

/* A tab holding a value save refused: the mark the consult's tab carries too. */
.storg-rail-sublink.is-invalid::after {
    content: '';
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--event-cancelled-border);
}

/* Tabs (design.md, "Tabs"): a row of named buttons over a line, the open one bolder and underlined in the
   primary colour; Finanzas' tabs and the consult's. */
.storg-tabs {
    display: flex;
    gap: var(--space-4);
    border-bottom: 1px solid var(--border-grid);
}

.storg-tab {
    display: inline-flex;
    flex: none;
    align-items: center;
    gap: var(--space-8);
    padding: var(--space-8) var(--space-12);
    border: 0;
    border-bottom: 3px solid transparent;
    background: none;
    color: var(--tab-fg);
    font: inherit;
    white-space: nowrap;
    cursor: pointer;
}

.storg-tab[hidden] {
    display: none;
}

/* A tab's icon is as large as a row action's. */
.storg-tab .bi {
    font-size: var(--icon-action);
}

.storg-tab[aria-selected="true"] {
    border-bottom-color: var(--primary);
    color: var(--text-strong);
    font-weight: 700;
}

.storg-tab:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

/* The note types' menu (NoteTypeMenuMarkup, note-type-menu.js): a button dropping the list of the
   types a consult is written as, over what follows it; the record's and Inicio's *Nueva consulta*. */
.note-type-menu {
    position: relative;
}

.note-type-list {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: var(--layer-popup);
    min-width: 240px;
    margin: var(--space-4) 0 0;
    padding: var(--space-4) 0;
    list-style: none;
    background: var(--surface-modal);
    text-align: left;
}

.note-type-list[hidden] {
    display: none;
}

.note-type-list button {
    display: block;
    width: 100%;
    padding: var(--space-8) var(--space-16);
    background: none;
    border: 0;
    color: var(--text-primary);
    font: inherit;
    text-align: left;
    cursor: pointer;
}

.note-type-list button:hover,
.note-type-list button:focus {
    background: var(--tint-primary);
    outline: none;
}

/* What a view shows while it arrives, and when it could not. */
.storg-view-state {
    padding: var(--space-32) var(--space-16);
    color: var(--text-muted);
    text-align: center;
}

/* Specialty picker (assets/js/specialty-picker.js): chips and a search box inside one outline,
   its list dropped under it. */
.specialty-picker {
    position: relative;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: var(--space-4);
    box-sizing: border-box;
    min-height: var(--field-height);
    padding: var(--space-4) var(--space-8);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    background: var(--surface-input);
    cursor: text;
}

.specialty-picker:hover,
.specialty-picker:focus-within {
    box-shadow: var(--shadow-focus);
}

.specialty-chips {
    display: contents;
}

.specialty-chip {
    display: inline-flex;
    align-items: center;
    gap: var(--space-4);
    padding: 2px var(--space-4) 2px var(--space-10);
    border-radius: var(--radius-pill);
    background: var(--surface-tab);
    color: var(--text-primary);
    font-size: 14px;
    line-height: 20px;
}

.specialty-chip-remove {
    display: inline-grid;
    place-items: center;
    padding: 2px;
    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.specialty-chip-remove:hover,
.specialty-chip-remove:focus-visible {
    color: var(--text-primary);
}

.storg-field .specialty-search {
    flex: 1;
    min-width: 140px;
    min-height: 34px;
    padding: var(--space-4);
    border: 0;
    background: transparent;
    box-shadow: none;
}

.storg-field .specialty-search:hover,
.storg-field .specialty-search:focus {
    box-shadow: none;
}

.specialty-chevron {
    display: inline-grid;
    flex: none;
    place-items: center;
    width: 28px;
    height: 28px;
    margin-left: auto;
    padding: 0;
    border: 0;
    background: none;
    color: var(--text-muted);
    cursor: pointer;
}

.specialty-chevron:hover {
    color: var(--text-primary);
}

.specialty-list {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    max-height: 240px;
    overflow-y: auto;
    margin: 0;
    padding: var(--space-4) 0;
    list-style: none;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-page);
    box-shadow: var(--shadow-dialog);
    z-index: var(--layer-popup);
}

.specialty-list [role="option"],
.specialty-note {
    padding: var(--space-8) var(--space-12);
    color: var(--text-primary);
}

.specialty-list [role="option"] {
    cursor: pointer;
}

.specialty-list [role="option"][aria-selected="true"],
.specialty-list [role="option"]:hover {
    background: var(--bg-nav-active);
    color: var(--highlight);
}

.specialty-note {
    color: var(--text-muted);
}

/* Country picker (assets/js/country-picker.js): the chosen country's flag and name on a button
   shaped like a field, and a list with a search box, each country with its flag. */
.country-picker {
    position: relative;
}

.country-picker-button {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    box-sizing: border-box;
    width: 100%;
    min-height: var(--field-height);
    padding: var(--space-10) 40px var(--space-10) var(--space-12);
    border: 1px solid var(--border-control);
    border-radius: var(--radius-sm);
    background: var(--surface-input);
    color: var(--text-primary);
    font-size: 16px;
    line-height: 24px;
    text-align: left;
    cursor: pointer;
}

.country-picker-button:hover,
.country-picker-button:focus-visible,
.country-picker-button[aria-expanded="true"] {
    outline: none;
    box-shadow: var(--shadow-focus);
}

.country-picker-button > .bi-chevron-down {
    position: absolute;
    top: 50%;
    right: 14px;
    transform: translateY(-50%);
    font-size: 14px;
    transition: transform 0.15s;
}

.country-picker-button[aria-expanded="true"] > .bi-chevron-down {
    transform: translateY(-50%) rotate(180deg);
}

.country-flag {
    flex: none;
    width: 24px;
    height: 18px;
    border-radius: 2px;
    object-fit: cover;
    background: var(--surface-tab);
}

.country-picker-popup {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    right: 0;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-sm);
    background: var(--bg-page);
    box-shadow: var(--shadow-dialog);
    z-index: var(--layer-popup);
}

.storg-field .country-picker-search {
    min-height: 40px;
    border: 0;
    border-bottom: 1px solid var(--border-default);
    border-radius: var(--radius-sm) var(--radius-sm) 0 0;
    box-shadow: none;
}

.country-picker-list {
    max-height: 260px;
    overflow-y: auto;
    margin: 0;
    padding: var(--space-4) 0;
    list-style: none;
}

.country-picker-list [role="option"] {
    display: flex;
    align-items: center;
    gap: var(--space-10);
    padding: var(--space-8) var(--space-12);
    color: var(--text-primary);
    cursor: pointer;
}

.country-picker-list [role="option"][aria-selected="true"],
.country-picker-list [role="option"].is-active,
.country-picker-list [role="option"]:hover {
    background: var(--bg-nav-active);
    color: var(--highlight);
}

.country-picker-list .country-picker-empty {
    padding: var(--space-8) var(--space-12);
    color: var(--text-muted);
}

/* Modal: the design system's dialog on a native <dialog>, 90% wide up to 560px, over the overlay. */
.storg-modal {
    box-sizing: border-box;
    width: 90%;
    max-width: 560px;
    max-height: calc(100vh - 48px);
    padding: var(--space-24);
    overflow: auto;
    background: var(--surface-modal);
    color: var(--text-primary);
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-dialog);
}

.storg-modal::backdrop {
    background: var(--overlay);
}

.storg-modal h2 {
    margin: 0 0 var(--space-8);
    color: var(--text-strong);
    font-size: 20px;
    line-height: 28px;
}

.storg-modal-question {
    max-width: 440px;
}

.storg-modal-actions {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-12);
    margin-top: var(--space-24);
}

/* The duplicate patient question of assets/js/patient-duplicates.js: a row a match, its facts beside
   *Usar este paciente*. Shared by the Agenda and Pacientes. */
.patient-duplicates-list {
    margin: var(--space-16) 0 0;
    padding: 0;
    list-style: none;
}

.patient-duplicates-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-12);
    padding: var(--space-12) 0;
    border-top: 1px solid var(--border-default);
}

.patient-duplicates-facts {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
    min-width: 0;
}

/* The map of Phppot\MapLocationMarkup: its room, reserved before Leaflet arrives, the pin at its
   centre (above the tiles, under the controls), the line it is waiting with, the address under it.
   Leaflet's look in the tokens travels with the map, map-location.css. */
.map-location-frame {
    position: relative;
    height: 320px;
    overflow: hidden;
    border: 1px solid var(--border-default);
    border-radius: var(--radius-lg);
    background: var(--bg-well);
}

.map-location-status {
    display: grid;
    place-items: center;
    height: 100%;
    margin: 0;
    padding: var(--space-16);
    color: var(--text-body);
    text-align: center;
}

.map-location-status[hidden] {
    display: none;
}

.map-location-pin {
    position: absolute;
    top: 50%;
    left: 50%;
    z-index: 650;
    transform: translate(-50%, -100%);
    color: var(--primary);
    font-size: 40px;
    line-height: 1;
    pointer-events: none;
}

.map-location-address {
    display: flex;
    gap: var(--space-8);
    margin: var(--space-12) 0 0;
    color: var(--text-primary);
}

/* The bell floating at the dashboard's top right, drawn with the page (class/NotificationBellMarkup.php),
   above the views as the Agenda's "+" floats at the bottom right, in the same colours; on a phone at
   the left of the rail's hamburger while its menu is dropped. Its panel's rules travel with the list
   in notification-bell.css. */
.storg-bell {
    position: fixed;
    top: 12px;
    right: var(--space-24);
    z-index: var(--layer-shell);
}

.storg-bell-toggle {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: var(--on-primary);
    font-size: 20px;
    box-shadow: var(--shadow-dialog);
    cursor: pointer;
}

/* Wider than a phone the bell is dragged anywhere (bell-position.js): a finger on it moves it, never the page. */
@media screen and (min-width: 659px) {
    .storg-bell-toggle {
        touch-action: none;
    }

    .storg-bell[data-dragging] .storg-bell-toggle {
        cursor: grabbing;
    }
}

/* On a phone the rail's hamburger holds the top right corner (20px in, 44px wide): the bell shows only
   while the menu is dropped, at the hamburger's left over the menu, its count in the hamburger dot's
   red; collapsed, the dot alone tells that something is unread. */
@media screen and (max-width: 658px) {
    .storg-bell {
        top: 9px;
        right: 72px;
        z-index: calc(var(--layer-shell) + 3);
        display: none;
    }

    .storg-has-rail:has(.storg-rail[data-open]) .storg-bell {
        display: block;
    }

    .storg-bell-toggle .storg-bell-count {
        background: var(--event-cancelled);
        color: var(--on-event-cancelled);
    }
}

.storg-bell-toggle:hover,
.storg-bell-toggle[aria-expanded="true"] {
    background: var(--primary-hover);
}

/* On the bell itself the count is drawn the other way round, so it stands out of the button. */
.storg-bell-toggle .storg-bell-count {
    top: -4px;
    right: -4px;
    border: 2px solid var(--primary);
    background: var(--on-primary);
    color: var(--primary);
}

.storg-bell-toggle:focus-visible {
    outline: 2px solid var(--focus-ring);
    outline-offset: 2px;
}

.storg-bell-count {
    position: absolute;
    top: 2px;
    right: 0;
    min-width: 18px;
    padding: 0 var(--space-4);
    border-radius: var(--radius-pill);
    background: var(--primary);
    color: var(--on-primary);
    font-size: 11px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
}

.storg-bell-count[hidden],
.storg-bell-panel[hidden] {
    display: none;
}

/* Who changed an item last (class/ChangeMark.php), a muted line under its name */
.change-mark {
    display: block;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 400;
}

/* Otra ciudad o localidad: the text field the place picker opens under the city list. */
.place-city-other {
    margin-top: var(--space-8);
}
