html, body {
    font-family: 'Nunito Sans', 'Inter', 'Helvetica Neue', Helvetica, Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Mobile: tighter container padding so cards breathe edge-to-edge */
@media (max-width: 599px) {
    .mud-container {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    .mud-appbar .mud-toolbar {
        padding-left: 12px !important;
        padding-right: 12px !important;
    }
}

/* Make small icon buttons reach the recommended 44px tap target on touch devices. Not the date
   picker's days: its calendar is a grid of 36px days, seven to a row in a box of fixed height, so
   larger days wrap six to a row (dates under the wrong weekday) and the last weeks are cut off. */
@media (pointer: coarse) {
    .mud-button-root.mud-icon-button:not(.mud-picker-calendar-day) {
        min-width: 44px;
        min-height: 44px;
    }
}

/* A date picker opened as a dialog has nothing under its calendar, so a month that spans six
   weeks ran its last week into the rounded bottom edge. */
.mud-dialog.mud-picker .mud-picker-calendar-container {
    padding-bottom: 12px;
}

/* Soft elevation tweak — MudBlazor default cards can look flat against light backgrounds */
.tapture-card {
    box-shadow: 0 1px 3px rgba(15, 23, 42, 0.06), 0 1px 2px rgba(15, 23, 42, 0.04) !important;
    border: 1px solid rgba(15, 23, 42, 0.06);
    transition: box-shadow 150ms ease, transform 150ms ease;
}

.tapture-card:hover {
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08), 0 2px 4px rgba(15, 23, 42, 0.05) !important;
}

/* The welcome-back banner. */
.tapture-hero {
    background: linear-gradient(135deg, #2F6FED 0%, #1E4FB8 100%);
    color: #FFFFFF;
}

/* Bible reading content styling */
.bible-content {
    max-width: 720px;
    margin: 0 auto;
    font-size: 1.05rem;
    line-height: 1.7;
}

@media (max-width: 599px) {
    .bible-content {
        font-size: 1rem;
        line-height: 1.65;
    }
}

a, .btn-link {
    color: var(--mud-palette-primary, #2F6FED);
}

.btn-primary {
    color: #fff;
    background-color: #2F6FED;
    border-color: #1E4FB8;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #93B4F6;
}

.content {
    padding-top: 0.5rem;
}

#blazor-error-ui {
    color-scheme: light only;
    background: #FEF3C7;
    bottom: 0;
    box-shadow: 0 -1px 4px rgba(15, 23, 42, 0.15);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.75rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wM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-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}
/* File inputs opened by a <label for="..."> upload button. Invisible but still in the layout:
   older iPhone Safari won't open the picker from a label whose input is display:none. */
.tapture-file-input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    overflow: hidden;
    pointer-events: none;
}

/* "Messages & other apps" in the invite dialog: only where the browser has a share sheet
   (tapture-share.js adds .tapture-can-share). */
.tapture-share-only {
    display: none;
}

.tapture-can-share .tapture-share-only {
    display: block;
}

/* Light-only app: see the color-scheme meta tag in App.razor. */
:root {
    color-scheme: only light;
}

/* Tab headers that scroll by swiping/dragging instead of MudBlazor's arrow buttons.
   MudBlazor slides the header strip with a transform and clips it (overflow: hidden); here the
   strip scrolls natively instead (touch, trackpad, shift+wheel; mouse drag via tapture-tabs.js). */
.tapture-swipe-tabs .mud-tabs-tabbar-content {
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
}

.tapture-swipe-tabs .mud-tabs-tabbar-content::-webkit-scrollbar {
    display: none;
}

.tapture-swipe-tabs .mud-tabs-tabbar-wrapper {
    transform: none !important;
}

.tapture-swipe-tabs .mud-tabs-scroll-button {
    display: none !important;
}

/* ── Staff pages (MainLayout, EmptyLayout: .tapture-staff) ──────────────────
   Colours, fonts and corners come from TaptureTheme; these are the touches a MudBlazor theme
   can't express. Module colours are set inline from IAppTheme.ModuleColor/ModuleTint.
   MudBlazor's stylesheet loads after this one, so overrides here need the extra class. */
.tapture-mark {
    display: inline-grid;
    grid-template-columns: repeat(2, 9px);
    gap: 3px;
    flex: none;
}

.tapture-mark i {
    display: block;
    width: 9px;
    height: 9px;
    border-radius: 50%;
}

.tapture-mark-large {
    grid-template-columns: repeat(2, 22px);
    gap: 7px;
}

.tapture-mark-large i {
    width: 22px;
    height: 22px;
}

.tapture-staff .mud-appbar {
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

/* Pill-shaped buttons (icon buttons are already round). */
.tapture-staff .mud-button-root.mud-button:not(.mud-icon-button) {
    border-radius: 999px;
}

/* Tab names in sentence case, like the buttons. */
.tapture-staff .mud-tab {
    text-transform: none;
}

/* Plain links in the page follow the primary colour (MudBlazor buttons that are links keep their own). */
.tapture-staff .mud-main-content a:not(.mud-button-root):not(.mud-icon-button) {
    color: var(--mud-palette-primary);
}

/* Cards that belong to a module get a stripe of its colour along the top. */
.tapture-staff .tapture-module-card {
    position: relative;
    overflow: hidden;
}

.tapture-staff .tapture-module-card::before {
    content: "";
    position: absolute;
    inset: 0 0 auto 0;
    height: 5px;
    background: var(--tapture-module, var(--mud-palette-primary));
}

.tapture-staff .tapture-card {
    box-shadow: 0 2px 10px rgba(47, 111, 237, 0.08);
}

/* Hints and other quiet text. MudBlazor colours "secondary" text with the palette's secondary
   (purple); everywhere in this app it means muted, so it's the grey secondary text colour. */
.mud-typography.mud-secondary-text,
.mud-icon-root.mud-secondary-text {
    color: var(--mud-palette-text-secondary) !important;
}

/* ── The rail: the dashboard and the person's groups (NavRail.razor) ─────────
   Beside the page from 960px up; on phones and tablets it slides in from the top bar's menu button. */
.tapture-staff .tapture-drawer {
    border-right: 1px solid var(--mud-palette-lines-default);
}

.tapture-rail {
    display: flex;
    flex-direction: column;
    gap: 2px;
    height: 100%;
    padding: 16px 12px 12px;
    box-sizing: border-box;
    overflow-y: auto;
}

.tapture-rail a {
    text-decoration: none;
}

.tapture-rail-brand {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 4px 10px 16px;
    color: var(--mud-palette-text-primary);
    font-family: 'Nunito', 'Nunito Sans', Arial, sans-serif;
    font-weight: 800;
    font-size: 1rem;
    line-height: 1.25;
}

.tapture-rail-item {
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 40px;
    padding: 8px 10px;
    border-radius: 12px;
    color: var(--mud-palette-text-primary);
    font-weight: 600;
    font-size: 0.925rem;
}

.tapture-rail-item:hover {
    background: var(--mud-palette-background-gray);
}

.tapture-rail-item:focus-visible {
    outline: 3px solid var(--mud-palette-primary);
    outline-offset: -1px;
}

.tapture-rail-item > span {
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.tapture-rail-current {
    background: var(--mud-palette-primary-lighten);
    color: var(--mud-palette-primary-darken);
    font-weight: 700;
}

.tapture-rail-dot {
    flex: none;
    width: 8px;
    height: 8px;
    margin: 0 6px;
    border-radius: 50%;
}

.tapture-rail-heading {
    padding: 16px 10px 4px;
    color: var(--mud-palette-text-secondary);
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.tapture-rail-spacer {
    flex: 1;
}

.tapture-rail-user {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-top: 12px;
    padding: 12px 0 0 10px;
    border-top: 1px solid var(--mud-palette-lines-default);
}

.tapture-rail-user-text {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    line-height: 1.25;
}

.tapture-rail-user-name {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 700;
    font-size: 0.875rem;
}

.tapture-rail-user-role {
    color: var(--mud-palette-text-secondary);
    font-size: 0.75rem;
}

/* ── Top bar (phones and tablets) ──────────────────────────────────────────
   A page's own title (SectionContent "tapture-topbar") replaces the app's name. */
.tapture-topbar-slot {
    flex: 1;
    min-width: 0;
    display: flex;
}

.tapture-topbar-slot:empty {
    display: none;
}

.tapture-topbar-brand {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 4px;
}

.tapture-topbar-slot:not(:empty) + .tapture-topbar-brand {
    display: none;
}

.tapture-topbar-title {
    flex: 1;
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 10px;
    margin-left: 4px;
}

/* A full-page editor puts its own back arrow in the bar, in place of the menu button. */
.tapture-topbar:has(.tapture-topbar-back) .mud-toolbar > .mud-icon-button:first-child {
    display: none;
}

.tapture-topbar-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 800 !important;
}

/* The page header that replaces the top bar on laptops. */
.tapture-page-header {
    display: none;
}

@media (min-width: 960px) {
    .tapture-signed-in .tapture-topbar {
        display: none;
    }

    .tapture-signed-in .tapture-main {
        padding-top: 0;
    }

    /* MudBlazor leaves room above the drawer for the top bar, which laptops don't show. */
    .tapture-signed-in .tapture-drawer {
        top: 0;
        height: 100%;
    }

    .tapture-page-header {
        display: flex;
        align-items: center;
        gap: 14px;
        margin: 8px 0 20px;
        padding: 0 4px;
    }
}

/* ── A group's tabs on phones: a floating pill along the bottom of the screen ──
   Centred and clear of the screen's rounded corners. Every module marks its main tabs
   .tapture-swipe-tabs; nested tabs inside a panel aren't affected. */
@media (max-width: 599.98px) {
    .tapture-swipe-tabs > .mud-tabs-tabbar {
        position: fixed;
        left: 50%;
        bottom: calc(12px + env(safe-area-inset-bottom, 0px));
        transform: translateX(-50%);
        width: max-content;
        max-width: calc(100vw - 24px);
        z-index: 1200;
        padding: 4px 6px;
        border-radius: 999px !important;
        border: 1px solid var(--mud-palette-lines-default);
        background: var(--mud-palette-surface);
        box-shadow: 0 6px 20px rgba(22, 33, 62, 0.16);
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-content {
        overflow: visible;
    }

    /* Each tab sits in a tooltip wrapper, which is the flex item: as wide as its name. */
    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tabs-tabbar-wrapper > * {
        flex: 0 0 auto;
        min-width: 0;
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tab {
        width: 100%;
        min-width: 58px !important;
        max-width: 86px;
        min-height: 56px;
        padding: 6px 6px 5px;
        border-radius: 999px;
        flex-direction: column;
        gap: 4px;
        font-size: 0.72rem;
        font-weight: 600;
        line-height: 1.15;
        text-align: center;
        white-space: normal;
        color: var(--mud-palette-text-secondary);
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tab .mud-icon-root {
        margin: 0 !important;
        padding: 3px 14px;
        border-radius: 999px;
        box-sizing: content-box;
    }

    /* Six tabs (a Gathering) are set a little tighter so they fit a 360px-wide phone. */
    .tapture-swipe-tabs > .mud-tabs-tabbar:has(.mud-tabs-tabbar-wrapper > :nth-child(6)) .mud-tab {
        min-width: 52px !important;
        padding: 6px 2px 5px;
        font-size: 0.66rem;
        letter-spacing: 0;
        /* The pill's round ends would otherwise clip the first and last letters of a long name. */
        overflow: visible;
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar:has(.mud-tabs-tabbar-wrapper > :nth-child(6)) .mud-tab .mud-icon-root {
        padding: 3px 11px;
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tab-active {
        color: var(--mud-palette-primary);
        font-weight: 700;
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tab-active .mud-icon-root {
        background: var(--mud-palette-primary-lighten);
    }

    .tapture-swipe-tabs > .mud-tabs-tabbar .mud-tab-slider {
        display: none;
    }

    /* Room under the last of the page for the bar. */
    .tapture-swipe-tabs {
        margin-bottom: calc(96px + env(safe-area-inset-bottom, 0px));
    }
}

/* Pending host invites on the dashboard's Gatherings card (Superadmin), and the signed-in
   person's own invitations at the top of the dashboard. */
.host-invite-row,
.my-invite-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px;
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 8px;
}

.host-invite-text,
.my-invite-text {
    flex: 1;
    min-width: 0;
}

/* The Invite a host dialog: one email field per host, with a remove button after the first. */
.host-email-row {
    display: flex;
    align-items: center;
    gap: 4px;
}

/* The admin AI page (/admin/ai): one column of cards, a switch at the end of each row. */
.ai-settings {
    max-width: 720px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.ai-row {
    display: flex;
    align-items: center;
    gap: 12px;
}

.ai-row-text {
    flex: 1;
    min-width: 0;
}

.ai-key-hint {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

.ai-confirm {
    display: flex;
    flex-direction: column;
    gap: 8px;
    padding: 12px;
    border: 1px solid var(--mud-palette-error);
    border-radius: 8px;
}
