/* =============================================================================================
   OSTEO MODAL — the one dialog stylesheet of the web app
   ---------------------------------------------------------------------------------------------
   Markup:  <osteo-modal> tag helper (Osteo/TagHelpers/OsteoModalTagHelper.cs)
   Host:    #exampleModal.osteo-modal-host (Views/Shared/_ModalView.cshtml)
   Script:  FormScripts/osteo-modal.js  (OsteoModal.open/show/close, CreateModelDialog)

   1. Tokens          5. Footer and buttons
   2. Host / overlay  6. Form controls used inside dialogs (moved from modaldesign.css)
   3. Dialog + sizes  7. File upload, loading overlay
   4. Header / body   8. Small screens

   Everything is scoped to .osteo-modal-host / .osteo-modal, so nothing here reaches page
   content. Replaces css/modaldesign.css (its :root colours and bare .progress-bar rule used to
   leak into whichever page opened a dialog).
   ============================================================================================= */

/* 1. Tokens ---------------------------------------------------------------------------------- */
/* THEMING (2026-10-02): the literals that still rooted this family now reference the
   semantic tokens in css/osteo-theme.css, each keeping its original value as the
   fallback. Light is unchanged; dark follows the token switch. */
.osteo-modal-host,
.osteo-modal {
    --om-green: var(--ds-green, #0bb27b);
    --om-green-ink: var(--ds-green-ink, #0a8f63);
    --om-mint-50: var(--ds-mint-50, #f2fbf7);
    --om-mint-100: var(--ds-mint-100, #e6f8f0);
    --om-mint-200: var(--ds-mint-200, #d5f4e7);
    --om-ink: var(--ds-ink, #101a3c);
    --om-text: var(--ds-text, #2b3769);
    --om-muted: var(--ds-muted, #6a7aae);
    --om-border: var(--ds-border, #e3e8f5);
    --om-field: var(--ds-field, #f5f7fc);
    --om-surface: var(--ds-surface, #ffffff);
    --om-danger: var(--ds-danger, #e8434f);
    --om-danger-bg: var(--ds-danger-bg, #fdeaec);
    --om-font: var(--ds-font, 'Poppins', 'Segoe UI', system-ui, sans-serif);
    --om-radius: 16px;
    --om-radius-sm: 10px;
    --om-shadow: var(--elev-lg, 0 24px 64px rgba(16, 26, 60, 0.22));
    --om-ease: var(--ds-ease, cubic-bezier(0.4, 0, 0.2, 1));
    --om-gutter: 24px;
}

/* 2. Host / overlay -------------------------------------------------------------------------- */
/* Bootstrap's .modal gives position/size and display:none; osteo-modal.js toggles display. */
.osteo-modal-host {
    background: rgba(16, 26, 60, 0.5);
    overflow-x: hidden;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}

body.osteo-modal-open {
    overflow: hidden;
}

/* 3. Dialog + sizes -------------------------------------------------------------------------- */
.osteo-modal.modal-dialog {
    --om-width: 560px;
    width: calc(100% - 2rem);
    max-width: var(--om-width);
    margin: 1.75rem auto;
    font-family: var(--om-font);
    pointer-events: auto;
}

/* Centred against the viewport, not the parent: partials often wrap the dialog in a <form>,
   whose auto height made Bootstrap's min-height:100% resolve to nothing. */
.osteo-modal.modal-dialog-centered {
    min-height: calc(100vh - 3.5rem);
    min-height: calc(100dvh - 3.5rem);
}

.osteo-modal--sm.modal-dialog { --om-width: 420px; }
.osteo-modal--md.modal-dialog { --om-width: 560px; }
.osteo-modal--lg.modal-dialog { --om-width: 780px; }
.osteo-modal--xl.modal-dialog { --om-width: 1080px; }

.osteo-modal .osteo-modal__content {
    position: relative;
    border: 0;
    border-radius: var(--om-radius);
    background: var(--om-surface);
    box-shadow: var(--om-shadow);
    overflow: visible;
    animation: osteo-modal-in 0.22s var(--om-ease);
}

@keyframes osteo-modal-in {
    from { opacity: 0; transform: translateY(12px) scale(0.985); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .osteo-modal .osteo-modal__content { animation: none; }
}

/* 4. Header / body --------------------------------------------------------------------------- */
/* Approved design: solid green header, white title and icon. */
.osteo-modal .osteo-modal__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 16px var(--om-gutter);
    background: linear-gradient(120deg, var(--brand-primary, #2cc58e) 0%, var(--brand-primary-light, #5fd7ae) 60%, var(--brand-soft-strongest, #8be3c4) 100%);
    border-bottom: 0;
    border-radius: var(--om-radius) var(--om-radius) 0 0;
    color: var(--brand-on-primary, #fff);
}

.osteo-modal .osteo-modal__icon {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.22);
    color: var(--brand-on-primary, #fff);
    font-size: 16px;
}

.osteo-modal .osteo-modal__icon i,
.osteo-modal .osteo-modal__close i { font-size: inherit; line-height: 1; color: inherit; }

.osteo-modal .osteo-modal__titles {
    flex: 1 1 auto;
    min-width: 0;
}

.osteo-modal .osteo-modal__title {
    margin: 0;
    font-size: 1.1rem;
    font-weight: 700;
    line-height: 1.3;
    color: var(--brand-on-primary, #fff);
    overflow-wrap: anywhere;
}

.osteo-modal .osteo-modal__subtitle {
    margin: 2px 0 0;
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.88);
}

.osteo-modal .osteo-modal__close {
    flex: 0 0 34px;
    width: 34px;
    height: 34px;
    border: 1px solid transparent;
    border-radius: 50%;
    background: transparent;
    color: var(--brand-on-primary, #fff);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, transform 0.18s;
}

.osteo-modal .osteo-modal__close:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: rotate(90deg);
}

.osteo-modal .osteo-modal__close:focus { outline: none; }

.osteo-modal .osteo-modal__close:focus-visible {
    outline: 2px solid #fff;
    outline-offset: 2px;
}

.osteo-modal--danger .osteo-modal__header {
    background: linear-gradient(120deg, var(--state-danger, #e8434f) 0%, var(--state-danger, #f07a83) 100%);
}

.osteo-modal .osteo-modal__body {
    padding: 20px var(--om-gutter);
    color: var(--om-text);
    background: var(--om-surface);
}

.osteo-modal .osteo-modal__body:last-child {
    border-radius: 0 0 var(--om-radius) var(--om-radius);
}

/* 5. Footer and buttons ---------------------------------------------------------------------- */
.osteo-modal .osteo-modal__footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 12px;
    margin: 0;
    padding: 14px var(--om-gutter);
    background: var(--om-field);
    border-top: 1px solid var(--om-border);
    border-radius: 0 0 var(--om-radius) var(--om-radius);
}

.osteo-modal .osteo-modal__footer > * { margin: 0; }

.osteo-modal .osteo-modal__note {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1 1 220px;
    margin: 0;
    font-size: 0.84rem;
    color: var(--om-muted);
}

.osteo-modal .osteo-modal__note i { color: var(--om-green); }

.osteo-modal .osteo-modal__actions {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
    gap: 10px;
    margin-left: auto;
}

.osteo-btn,
.osteo-modal .btn-modern1 {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    min-height: 42px;
    padding: 0 20px;
    border: 1.5px solid transparent;
    border-radius: var(--om-radius-sm, 10px);
    font-family: inherit;
    font-size: 0.92rem;
    font-weight: 600;
    line-height: 1;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.18s, border-color 0.18s, color 0.18s, box-shadow 0.18s, transform 0.18s;
}

.osteo-btn:disabled,
.osteo-btn.is-disabled,
.osteo-modal .btn-modern1:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
    box-shadow: none;
}

.osteo-btn--primary,
.osteo-modal .btn-modern1-primary {
    background: var(--om-green, var(--brand-primary, #0bb27b));
    border-color: var(--om-green, var(--brand-primary, #0bb27b));
    color: var(--brand-on-primary, #fff);
    box-shadow: 0 6px 16px rgba(11, 178, 123, 0.25);
}

.osteo-btn--primary:hover:not(:disabled),
.osteo-modal .btn-modern1-primary:hover:not(:disabled) {
    background: var(--om-green-ink, var(--brand-primary-ink, #0a8f63));
    border-color: var(--om-green-ink, var(--brand-primary-ink, #0a8f63));
    color: var(--brand-on-primary, #fff);
    transform: translateY(-1px);
}

.osteo-btn--secondary,
.osteo-modal .btn-modern1-secondary {
    background: var(--om-surface, #fff);
    border-color: var(--om-border, var(--border-default, #e3e8f5));
    color: var(--om-text, var(--text-body, #2b3769));
}

.osteo-btn--secondary:hover:not(:disabled),
.osteo-modal .btn-modern1-secondary:hover:not(:disabled) {
    border-color: var(--om-muted, var(--text-secondary, #6a7aae));
    color: var(--om-ink, var(--text-primary, #101a3c));
}

.osteo-btn--danger {
    background: var(--om-danger, var(--state-danger, #e8434f));
    border-color: var(--om-danger, var(--state-danger, #e8434f));
    color: #fff;
}

.osteo-btn--danger:hover:not(:disabled) {
    background: var(--state-danger, #cf2f3b);
    border-color: var(--state-danger, #cf2f3b);
    color: #fff;
}

.osteo-btn--warning {
    background: var(--state-warning-soft, #fff6e0);
    border-color: var(--state-warning-soft, #f3dfa8);
    color: var(--state-warning-ink, #8a5f00);
}

/* WHITE ON AMBER IS 2.2:1 IN DARK. --text-inverse is #ffffff in light, so this
   button looks exactly as it did, and near-black in dark, where it is 7.9:1 on
   the amber fill. The other status buttons keep white: their fills stay
   saturated enough in dark to carry it. */
.osteo-btn--warning:hover:not(:disabled) {
    background: var(--state-warning, #c98a00);
    border-color: var(--state-warning, #c98a00);
    color: var(--text-inverse, #fff);
}

.osteo-btn--ghost {
    background: transparent;
    color: var(--om-green-ink, var(--brand-primary-ink, #0a8f63));
}

.osteo-btn--ghost:hover:not(:disabled) {
    background: var(--om-mint-50, var(--brand-soft-weak, #f2fbf7));
}

.osteo-btn:focus-visible,
.osteo-modal .btn-modern1:focus-visible {
    outline: 3px solid rgba(11, 178, 123, 0.35);
    outline-offset: 2px;
}

/* 6. Form controls used inside dialogs ------------------------------------------------------- */
/* 6a. Field grid for new dialogs: .osteo-fields > .osteo-field (label, control, help, error). */
.osteo-modal .osteo-fields {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 18px;
}

.osteo-modal .osteo-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
    min-width: 0;
    margin: 0;
    padding: 0;
    border: 0;
}

.osteo-modal .osteo-field--full { grid-column: 1 / -1; }
.osteo-modal .osteo-field[hidden] { display: none; }

.osteo-modal .osteo-label {
    display: flex;
    align-items: center;
    gap: 4px;
    margin: 0;
    padding: 0;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--om-ink);
}

.osteo-modal .osteo-req { color: var(--om-danger); }
.osteo-modal .osteo-optional { font-weight: 400; color: var(--om-muted); }

.osteo-modal .osteo-field .form-control,
.osteo-modal .osteo-field .form-select {
    min-height: 44px;
    padding: 10px 14px;
    border: 1px solid var(--om-border);
    border-radius: var(--om-radius-sm);
    background-color: var(--om-surface);
    color: var(--om-ink);
    font-family: inherit;
    font-size: 0.9rem;
    box-shadow: none;
}

.osteo-modal .osteo-field .form-select { padding-right: 36px; }
.osteo-modal .osteo-field textarea.form-control { min-height: 120px; resize: vertical; }

.osteo-modal .osteo-field .form-control:focus,
.osteo-modal .osteo-field .form-select:focus {
    border-color: var(--om-green);
    box-shadow: 0 0 0 3px rgba(11, 178, 123, 0.14);
    outline: none;
}

.osteo-modal .osteo-field .is-invalid { border-color: var(--om-danger); }

/* 6b. The shared Canada phone control (.oa-phone + the _PhonePrefix partial) inside a dialog.
   Its base rules live in osteo-brand.css, but the one that strips the inner input's own border
   there keys on .oa-input, and the .form-control equivalent in events.css is scoped to .ev-page
   - neither reaches inside a modal. Without these the field renders a border inside a border,
   and .osteo-field .form-control above (0-3-0) would win anyway. Sized 44px / --om-radius-sm to
   match the controls beside it, not the 48px the auth screens use. */
.osteo-modal .osteo-field .oa-phone {
    height: 44px;
    border-radius: var(--om-radius-sm);
    border-color: var(--om-border);
    background-color: var(--om-surface);
}

.osteo-modal .osteo-field .oa-phone .form-control,
.osteo-modal .osteo-field .oa-phone .form-control:focus {
    min-height: 0;
    height: 100%;
    border: 0;
    border-radius: 0 var(--om-radius-sm) var(--om-radius-sm) 0;
    background: transparent;
    box-shadow: none;
}

.osteo-modal .osteo-field .oa-phone:focus-within {
    border-color: var(--om-green);
    box-shadow: 0 0 0 3px rgba(11, 178, 123, 0.14);
}

/* The box carries the invalid state, not the borderless input inside it. */
.osteo-modal .osteo-field .oa-phone:has(.is-invalid) { border-color: var(--om-danger); }

.osteo-modal .osteo-field .select2-container .select2-selection--multiple {
    min-height: 44px;
    border: 1px solid var(--om-border);
    border-radius: var(--om-radius-sm);
}

.osteo-modal .osteo-help {
    margin: 0;
    font-size: 0.78rem;
    color: var(--om-muted);
}

.osteo-modal .osteo-help--end { text-align: right; }

.osteo-modal .osteo-error {
    font-size: 0.8rem;
    color: var(--om-danger);
}

.osteo-modal .osteo-error:empty { display: none; }

/* 6c. Read-only facts above a form: label / value pairs that state what is being acted on.
   The slot dialogs used to lay these out with .row + .col-md-4 + .col-md-8, which depends on
   the Bootstrap grid being present inside a dialog and gives a fixed one-third label column
   that a long address immediately overruns. This is a two-column grid whose label column is
   sized to its own content and which stacks on a phone. */
.osteo-modal .osteo-facts {
    display: grid;
    grid-template-columns: minmax(0, max-content) minmax(0, 1fr);
    gap: 10px 20px;
    margin: 0 0 20px;
    padding: 0 0 18px;
    border-bottom: 1px solid var(--om-border);
}

.osteo-modal .osteo-facts > dt {
    margin: 0;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--om-muted);
}

.osteo-modal .osteo-facts > dd {
    margin: 0;
    min-width: 0;
    font-size: 0.88rem;
    color: var(--om-ink);
    overflow-wrap: anywhere;
}

@media (max-width: 575.98px) {
    /* Stacked, because a max-content label column plus a value is wider than a phone once the
       label is "Appointment Schedule". */
    .osteo-modal .osteo-facts { grid-template-columns: minmax(0, 1fr); gap: 2px 0; }
    .osteo-modal .osteo-facts > dd { margin-bottom: 8px; }
    .osteo-modal .osteo-facts > dd:last-child { margin-bottom: 0; }
}

/* Select with a leading icon (Related Event, Send To) or a priority dot. */
.osteo-modal .osteo-select-icon,
.osteo-modal .osteo-select-dot { position: relative; display: block; }

.osteo-modal .osteo-select-icon > i {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--om-muted);
    pointer-events: none;
    z-index: 1;
}

.osteo-modal .osteo-select-icon > .form-select { padding-left: 40px; }

.osteo-modal .osteo-select-dot::before {
    content: "";
    position: absolute;
    left: 14px;
    top: 50%;
    width: 10px;
    height: 10px;
    margin-top: -5px;
    border-radius: 50%;
    background: var(--om-green);
    z-index: 1;
    pointer-events: none;
}

.osteo-modal .osteo-select-dot[data-priority="1"]::before { background: var(--text-muted, #9aa6c4); }
.osteo-modal .osteo-select-dot[data-priority="3"]::before { background: var(--om-danger); }
.osteo-modal .osteo-select-dot > .form-select { padding-left: 34px; }

/* Plain check boxes in a row (Send Via). */
.osteo-modal .osteo-checks { display: flex; flex-wrap: wrap; gap: 10px 28px; }

.osteo-modal .osteo-check {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin: 0;
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--om-ink);
    cursor: pointer;
}

.osteo-modal .osteo-check input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--om-green);
    cursor: pointer;
}

.osteo-modal .osteo-check input:disabled { cursor: default; }

/* Check-box chips (e.g. Send Via). The native box stays focusable; the chip is the visual. */
.osteo-modal .osteo-choices { display: flex; flex-wrap: wrap; gap: 10px; }

.osteo-modal .osteo-choice {
    position: relative;
    margin: 0;
    cursor: pointer;
}

.osteo-modal .osteo-choice input {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
}

.osteo-modal .osteo-choice__box {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    min-height: 40px;
    padding: 0 16px;
    border: 1.5px solid var(--om-border);
    border-radius: 999px;
    background: var(--om-surface);
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--om-muted);
    transition: border-color 0.18s, background-color 0.18s, color 0.18s;
}

.osteo-modal .osteo-choice input:checked + .osteo-choice__box {
    border-color: var(--om-green);
    background: var(--om-mint-50);
    color: var(--om-green-ink);
}

.osteo-modal .osteo-choice input:focus-visible + .osteo-choice__box {
    outline: 3px solid rgba(11, 178, 123, 0.35);
    outline-offset: 2px;
}

.osteo-modal .osteo-choice.is-locked { cursor: default; }
.osteo-modal .osteo-choice.is-locked .osteo-choice__box { opacity: 0.85; }

/* 6b. Controls carried over from modaldesign.css (existing dialogs). */
.osteo-modal .form-group-modern { margin-bottom: 14px; }

.osteo-modal .form-label-modern {
    display: block;
    margin-bottom: 6px;
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--om-ink);
}

.osteo-modal .required-star { color: var(--om-danger); margin-left: 2px; }

.osteo-modal .form-input-modern,
.osteo-modal .textarea-modern {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid var(--om-border);
    border-radius: var(--om-radius-sm);
    background: var(--om-surface);
    color: var(--om-text);
    font-family: inherit;
    font-size: 0.95rem;
    transition: border-color 0.18s, box-shadow 0.18s;
}

.osteo-modal .textarea-modern {
    min-height: 110px;
    resize: vertical;
}

.osteo-modal .form-input-modern:focus,
.osteo-modal .textarea-modern:focus {
    outline: none;
    border-color: var(--om-green);
    box-shadow: 0 0 0 3px rgba(11, 178, 123, 0.14);
}

.osteo-modal .form-input-modern.error,
.osteo-modal .textarea-modern.error,
.osteo-modal .input-validation-error {
    border-color: var(--om-danger);
    background: var(--bg-page, #fff8f8);
}

.osteo-modal .error-message,
.osteo-modal .field-validation-error {
    display: block;
    margin-top: 5px;
    font-size: 0.82rem;
    color: var(--om-danger);
}

.osteo-modal .helper-text {
    display: block;
    margin-top: 5px;
    font-size: 0.82rem;
    color: var(--om-muted);
}

.osteo-modal .input-with-icon { position: relative; }

.osteo-modal .input-with-icon .input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--om-muted);
    z-index: 1;
    pointer-events: none;
}

.osteo-modal .input-with-icon .input-icon + .form-input-modern { padding-left: 40px; }

/* 7. File upload, loading overlay ------------------------------------------------------------ */
.osteo-modal .file-upload-container { position: relative; }

.osteo-modal .file-upload-label {
    display: flex;
    align-items: center;
    gap: 14px;
    padding: 18px;
    border: 2px dashed var(--om-border);
    border-radius: var(--om-radius-sm);
    background: var(--om-field);
    cursor: pointer;
    transition: border-color 0.18s, background-color 0.18s;
}

.osteo-modal .file-upload-label:hover,
.osteo-modal .file-upload-label.dragover {
    border-color: var(--om-green);
    background: var(--om-mint-50);
}

.osteo-modal .upload-icon {
    flex: 0 0 46px;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--om-mint-100);
    color: var(--om-green);
    font-size: 1.3rem;
}

.osteo-modal .upload-content { flex: 1 1 auto; min-width: 0; text-align: left; }
.osteo-modal .upload-title { font-weight: 600; color: var(--om-ink); margin-bottom: 2px; }
.osteo-modal .upload-description { font-size: 0.85rem; color: var(--om-muted); margin-bottom: 6px; }

.osteo-modal .file-format-info {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border: 1px solid var(--om-border);
    border-radius: 999px;
    background: var(--om-surface);
    font-size: 0.75rem;
    color: var(--om-muted);
}

.osteo-modal .file-format-info i { color: var(--om-green); }

.osteo-modal .file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.osteo-modal .selected-file,
.osteo-modal .selected-file-wrapper {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-top: 14px;
    padding: 14px;
    border: 1.5px solid var(--om-mint-200);
    border-radius: var(--om-radius-sm);
    background: var(--om-mint-50);
}

.osteo-modal .selected-file-display { margin-top: 14px; }
.osteo-modal .selected-file-display .selected-file-wrapper { margin-top: 0; }

.osteo-modal .file-icon,
.osteo-modal .file-badge {
    flex: 0 0 44px;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--om-green);
    color: var(--brand-on-primary, #fff);
    font-size: 1.2rem;
}

.osteo-modal .file-details,
.osteo-modal .file-content { flex: 1 1 auto; min-width: 0; }

.osteo-modal .file-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 6px;
}

.osteo-modal .file-name {
    font-weight: 600;
    color: var(--om-ink);
    overflow-wrap: anywhere;
}

.osteo-modal .file-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }

.osteo-modal .file-size,
.osteo-modal .file-type-badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 999px;
    background: var(--om-surface);
    font-size: 0.78rem;
    color: var(--om-muted);
}

.osteo-modal .file-type-badge { background: var(--om-mint-100); color: var(--om-green-ink); }

.osteo-modal .remove-file,
.osteo-modal .file-remove-btn {
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    border: 1px solid var(--om-border);
    border-radius: 50%;
    background: var(--om-surface);
    color: var(--om-muted);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: color 0.18s, border-color 0.18s, background-color 0.18s;
}

.osteo-modal .remove-file:hover,
.osteo-modal .file-remove-btn:hover {
    color: var(--om-danger);
    border-color: var(--state-danger-soft, #f7cfd3);
    background: var(--om-danger-bg);
}

.osteo-modal .upload-progress {
    width: 100%;
    height: 4px;
    margin-top: 14px;
    border-radius: 2px;
    background: var(--om-border);
    overflow: hidden;
}

.osteo-modal .upload-progress .progress-bar {
    height: 100%;
    width: 0;
    background: var(--om-green);
    transition: width 0.3s ease;
}

.osteo-modal .loading-overlay {
    position: absolute;
    inset: 0;
    z-index: 10;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
    border-radius: var(--om-radius);
    background: rgba(255, 255, 255, 0.9);
    color: var(--om-muted);
}

.osteo-modal .loading-overlay.d-none { display: none !important; }

.osteo-modal .loading-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid var(--om-border);
    border-top-color: var(--om-green);
    border-radius: 50%;
    animation: osteo-modal-spin 0.9s linear infinite;
}

@keyframes osteo-modal-spin { to { transform: rotate(360deg); } }

/* 8. Small screens --------------------------------------------------------------------------- */
@media (max-width: 576px) {
    .osteo-modal-host,
    .osteo-modal {
        --om-gutter: 16px;
    }

    .osteo-modal.modal-dialog,
    .osteo-modal.modal-dialog-centered {
        width: calc(100% - 1rem);
        margin: 0.5rem auto;
        min-height: calc(100vh - 1rem);
        min-height: calc(100dvh - 1rem);
    }

    .osteo-modal .osteo-modal__header { padding-top: 16px; padding-bottom: 16px; gap: 12px; }
    .osteo-modal .osteo-modal__icon { flex-basis: 38px; width: 38px; height: 38px; font-size: 16px; }
    .osteo-modal .osteo-modal__title { font-size: 1.05rem; }

    .osteo-modal .osteo-fields { grid-template-columns: minmax(0, 1fr); }
    .osteo-modal .osteo-modal__actions { width: 100%; margin-left: 0; }
    .osteo-modal .osteo-modal__actions > .osteo-btn,
    .osteo-modal .osteo-modal__actions > .btn-modern1 { flex: 1 1 0; }

    .osteo-modal .file-upload-label { flex-direction: column; text-align: center; }
    .osteo-modal .upload-content { text-align: center; }
    .osteo-modal .selected-file-wrapper { flex-direction: column; text-align: center; }
    .osteo-modal .file-header { flex-direction: column; }
    .osteo-modal .file-meta { justify-content: center; }
}

/* 9. Tables inside dialogs (Event Invites, Joining Requests) --------------------------------- */
.osteo-modal .osteo-modal-table { width: 100%; margin: 0; }

.osteo-modal .osteo-modal-table thead th {
    padding: 0.75rem 1rem;
    border-bottom: 2px solid var(--om-border);
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    text-transform: uppercase;
    color: var(--om-muted);
}

.osteo-modal .osteo-modal-table tbody td { padding: 0.75rem 1rem; vertical-align: middle; }

@media (max-width: 576px) {
    .osteo-modal .osteo-modal-table { display: block; overflow-x: auto; }
}

/* 10. Drawer placement (<osteo-modal placement="Drawer">) ------------------------------------- */
/* A full-height panel from the right: Add Patient, Filter (Patient Groups). The body scrolls,
   the header and footer stay put. Size sets the width (Sm 420px, Md 480px, Lg 620px). */
.osteo-modal--drawer.modal-dialog {
    --om-width: 480px;
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    width: 100%;
    max-width: var(--om-width);
    min-height: 0;
    height: 100%;
    margin: 0;
}

.osteo-modal--drawer.osteo-modal--sm.modal-dialog { --om-width: 420px; }
.osteo-modal--drawer.osteo-modal--lg.modal-dialog { --om-width: 620px; }

.osteo-modal--drawer .osteo-modal__content {
    display: flex;
    flex-direction: column;
    height: 100%;
    border-radius: var(--om-radius) 0 0 var(--om-radius);
    animation: osteo-drawer-in 0.24s var(--om-ease);
}

@keyframes osteo-drawer-in {
    from { opacity: 0.4; transform: translateX(40px); }
    to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
    .osteo-modal--drawer .osteo-modal__content { animation: none; }
}

.osteo-modal--drawer .osteo-modal__header { flex: 0 0 auto; border-radius: var(--om-radius) 0 0 0; }
.osteo-modal--drawer .osteo-modal__body { flex: 1 1 auto; min-height: 0; overflow-y: auto; }
.osteo-modal--drawer .osteo-modal__body:last-child { border-radius: 0 0 0 var(--om-radius); }
.osteo-modal--drawer .osteo-modal__footer { flex: 0 0 auto; border-radius: 0 0 0 var(--om-radius); }
.osteo-modal--drawer .osteo-fields { grid-template-columns: minmax(0, 1fr); }

@media (max-width: 576px) {
    .osteo-modal--drawer.modal-dialog,
    .osteo-modal--drawer.modal-dialog.osteo-modal {
        width: 100%;
        max-width: 100%;
        min-height: 0;
        height: 100%;
        margin: 0;
    }

    .osteo-modal--drawer .osteo-modal__content,
    .osteo-modal--drawer .osteo-modal__header,
    .osteo-modal--drawer .osteo-modal__footer { border-radius: 0; }
}
