// Subscribers list and profile.
//
// Written against the theme's own variables rather than fixed colours, so the
// pages follow light and dark like everything else. `--cp-` is the Falcon
// prefix this build uses; the fallbacks are for the handful of spots where the
// theme does not define a token.

// Shared tokens live at the root, not on a wrapper.
//
// `.subs-btn--primary` referenced `--subs-accent`, which was declared on
// `.subs` — so the same button used inside the profile (wrapper `.sub`)
// resolved it to nothing and lost its background entirely. "Change expiry"
// rendered as green text on a dark panel, effectively invisible. A token a
// component depends on has to be reachable wherever that component is used.
:root {
    --subs-line: var(--bs-border-color, rgba(125, 125, 125, 0.22));
    --subs-panel: var(--bs-tertiary-bg, rgba(125, 125, 125, 0.04));
    --subs-dim: var(--bs-secondary-color, #7d899b);
    --subs-accent: #21d07a;

    --sub-line: var(--bs-border-color, rgba(125, 125, 125, 0.22));
    --sub-panel: var(--bs-tertiary-bg, rgba(125, 125, 125, 0.04));
    --sub-dim: var(--bs-secondary-color, #7d899b);
    --sub-accent: #21d07a;
}

.subs {

    // ── Header ──────────────────────────────────────────────────────
    &-head {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 1.5rem;

        &__actions {
            display: flex;
            gap: 0.5rem;
            align-items: center;
        }
    }

    &-crumb {
        font-size: 0.68rem;
        letter-spacing: 0.12em;
        text-transform: uppercase;
        color: var(--subs-dim);
        margin-bottom: 0.35rem;

        span {
            opacity: 0.5;
            margin: 0 0.15rem;
        }
    }

    &-title {
        font-size: clamp(1.5rem, 3vw, 2rem);
        font-weight: 700;
        margin: 0 0 0.35rem;

        em {
            font-style: normal;
            color: var(--subs-accent);
        }
    }

    &-lead {
        margin: 0;
        font-size: 0.86rem;
        color: var(--subs-dim);
    }

    &-risk {
        color: var(--subs-accent);
    }

    &-btn {
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        border: 1px solid var(--subs-line);
        border-radius: 999px;
        padding: 0.5rem 1rem;
        font-size: 0.82rem;
        font-weight: 600;
        text-decoration: none;
        color: inherit;
        background: transparent;
        transition: background 0.15s ease, border-color 0.15s ease;

        &:hover {
            background: var(--subs-panel);
            color: inherit;
        }

        &--primary {
            background: var(--subs-accent);
            border-color: var(--subs-accent);
            color: #05261a;

            &:hover {
                filter: brightness(1.08);
                background: var(--subs-accent);
                color: #05261a;
            }
        }
    }

    // ── Stat strip ──────────────────────────────────────────────────
    &-stats {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
        border: 1px solid var(--subs-line);
        border-radius: 0.9rem;
        overflow: hidden;
        margin-bottom: 1.25rem;
    }

    &-stat {
        padding: 1rem 1.15rem;
        display: flex;
        flex-direction: column;
        gap: 0.3rem;

        // Dividers between cells, but never a trailing one on a wrapped row.
        & + & {
            border-left: 1px solid var(--subs-line);
        }

        @media (max-width: 991px) {
            & + & {
                border-left: none;
                border-top: 1px solid var(--subs-line);
            }
        }

        &__label {
            font-size: 0.76rem;
            color: var(--subs-dim);
        }

        &__value {
            font-size: 1.65rem;
            font-weight: 700;
            line-height: 1.1;

            &--risk {
                color: var(--subs-accent);
            }
        }

        &__sub {
            font-size: 0.7rem;
            color: var(--subs-dim);
            line-height: 1.35;
        }
    }

    // ── Toolbar ─────────────────────────────────────────────────────
    &-toolbar {
        display: flex;
        flex-wrap: wrap;
        gap: 0.75rem;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 1rem;
    }

    &-pills {
        display: inline-flex;
        gap: 0.25rem;
        padding: 0.25rem;
        border: 1px solid var(--subs-line);
        border-radius: 999px;
        background: var(--subs-panel);
    }

    &-pill {
        border: 0;
        background: transparent;
        border-radius: 999px;
        padding: 0.4rem 0.85rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--subs-dim);
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;
        white-space: nowrap;

        span {
            font-size: 0.7rem;
            padding: 0.05rem 0.4rem;
            border-radius: 999px;
            background: var(--subs-line);
            color: inherit;
        }

        &.is-active {
            background: var(--bs-body-bg, #fff);
            color: var(--bs-body-color, inherit);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
        }
    }

    &-tools {
        display: flex;
        gap: 0.5rem;
        align-items: center;
    }

    &-icon-btn {
        width: 38px;
        height: 38px;
        border-radius: 999px;
        border: 1px solid var(--subs-line);
        background: transparent;
        color: inherit;
        display: inline-flex;
        align-items: center;
        justify-content: center;

        &:hover,
        &.is-on {
            background: var(--subs-panel);
        }
    }

    &-search {
        position: relative;
        min-width: 240px;
        flex: 1 1 240px;
        max-width: 420px;

        i {
            position: absolute;
            left: 0.85rem;
            top: 50%;
            transform: translateY(-50%);
            color: var(--subs-dim);
            font-size: 0.85rem;
        }

        input {
            width: 100%;
            border-radius: 999px;
            border: 1px solid var(--subs-line);
            background: transparent;
            color: inherit;
            padding: 0.5rem 1rem 0.5rem 2.3rem;
            font-size: 0.82rem;

            &:focus {
                outline: none;
                border-color: var(--subs-accent);
            }
        }
    }

    &-filters {
        border: 1px solid var(--subs-line);
        border-radius: 0.6rem;
        padding: 0.5rem 0.85rem;
        margin-bottom: 0.85rem;
    }

    // ── Table ───────────────────────────────────────────────────────
    &-table-wrap {
        border: 1px solid var(--subs-line);
        border-radius: 0.9rem;
        // Horizontal scrolling lives here so the page body never does.
        overflow-x: auto;
    }

    &-table {
        width: 100%;
        min-width: 900px;
        border-collapse: collapse;
        font-size: 0.84rem;

        thead th {
            text-align: left;
            font-size: 0.68rem;
            letter-spacing: 0.09em;
            text-transform: uppercase;
            color: var(--subs-dim);
            font-weight: 600;
            padding: 0.85rem 1rem;
            border-bottom: 1px solid var(--subs-line);
            white-space: nowrap;
        }

        tbody td {
            padding: 0.85rem 1rem;
            border-bottom: 1px solid var(--subs-line);
            vertical-align: middle;
        }

        tbody tr:last-child td {
            border-bottom: 0;
        }

        &__check {
            width: 42px;
        }

        &__end {
            width: 56px;
            text-align: right;
        }
    }

    &-row:hover {
        background: var(--subs-panel);
    }

    // Only rows that lead somewhere get the pointer — a binding row has no
    // profile to open, and a hand cursor over it would promise one.
    &-row.is-clickable {
        cursor: pointer;
    }

    &-strong {
        display: block;
        font-weight: 600;

        &.is-over {
            color: #e5484d;
        }
    }

    &-sub {
        display: block;
        font-size: 0.72rem;
        color: var(--subs-dim);
        margin-top: 0.1rem;
    }

    &-muted {
        color: var(--subs-dim);
    }

    &-avatar {
        width: 30px;
        height: 30px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        font-weight: 700;
        color: #fff;
        flex-shrink: 0;
    }

    &-contact {
        display: flex;
        align-items: center;
        gap: 0.6rem;
        position: relative;

        &__name a {
            color: inherit;
            text-decoration: none;
            font-weight: 600;

            &:hover {
                color: var(--subs-accent);
            }
        }
    }

    &-chip {
        display: inline-block;
        font-size: 0.7rem;
        font-weight: 600;
        padding: 0.15rem 0.55rem;
        border-radius: 999px;

        &--online {
            color: var(--subs-accent);
            background: rgba(33, 208, 122, 0.14);
        }

        &--new {
            color: var(--subs-accent);
            background: rgba(33, 208, 122, 0.14);
        }
    }

    &-dots {
        width: 32px;
        height: 32px;
        border-radius: 999px;
        border: 1px solid var(--subs-line);
        background: transparent;
        color: var(--subs-dim);

        &:hover {
            background: var(--subs-panel);
            color: inherit;
        }
    }

    &-empty {
        text-align: center;
        padding: 3.5rem 1rem;
        color: var(--subs-dim);

        i {
            display: block;
            font-size: 1.6rem;
            margin-bottom: 0.5rem;
            opacity: 0.7;
        }
    }

    // ── Hover card ──────────────────────────────────────────────────
    // Teleported to <body>, so its rules live outside `.subs` — see the
    // `.subs-peek` block at the bottom of this file.
    &-peek-placeholder {
        display: none;
    }
}

// The hover card, teleported out of the table so its scrollbox cannot clip it.
// Position comes from Alpine; only appearance is set here.
.subs-peek {
    position: fixed;
    z-index: 1080;
    width: 310px;
    padding: 0.9rem 1rem 0.75rem;
    border-radius: 0.8rem;
    border: 1px solid var(--bs-border-color, rgba(125, 125, 125, 0.22));
    background: var(--bs-body-bg, #1a1c22);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.35);
    // Purely informational, so it must never swallow a click meant for the row
    // it is sitting over.
    pointer-events: none;

    &__head {
        display: flex;
        align-items: center;
        gap: 0.55rem;
        padding-bottom: 0.7rem;
        margin-bottom: 0.15rem;
        border-bottom: 1px solid var(--bs-border-color, rgba(125, 125, 125, 0.22));
    }

    &__name {
        font-weight: 700;
        flex: 1;
    }

    &__facts {
        margin: 0;

        > div {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.4rem 0;
        }

        dt {
            font-weight: 400;
            font-size: 0.78rem;
            color: var(--bs-secondary-color, #7d899b);
        }

        dd {
            margin: 0;
            font-size: 0.78rem;
            font-weight: 600;
            text-align: right;

            span {
                display: block;
                font-weight: 400;
                font-size: 0.7rem;
                color: var(--bs-secondary-color, #7d899b);
            }

            &.is-live {
                color: #21d07a;
            }
        }
    }

    &__foot {
        border-top: 1px solid var(--bs-border-color, rgba(125, 125, 125, 0.22));
        padding-top: 0.55rem;
        margin-top: 0.35rem;
        text-align: center;
        font-size: 0.72rem;
        color: var(--bs-secondary-color, #7d899b);
    }

    .subs-avatar {
        width: 30px;
        height: 30px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 0.68rem;
        font-weight: 700;
        color: #fff;
        flex-shrink: 0;
    }

    .subs-chip--new {
        font-size: 0.7rem;
        font-weight: 600;
        padding: 0.15rem 0.55rem;
        border-radius: 999px;
        color: #21d07a;
        background: rgba(33, 208, 122, 0.14);
    }
}

// A touch device fires hover on tap, which would pop the card and eat the tap
// meant for the row. Not worth showing there at all.
@media (hover: none) {
    .subs-peek {
        display: none !important;
    }
}

// ── Profile ─────────────────────────────────────────────────────────
.sub {

    &-top {
        display: flex;
        flex-wrap: wrap;
        gap: 1rem;
        align-items: flex-start;
        justify-content: space-between;
        margin-bottom: 1.25rem;
    }

    &-name {
        font-size: clamp(1.4rem, 3vw, 1.9rem);
        font-weight: 700;
        margin: 0.35rem 0 0.75rem;
    }

    &-identity {
        display: flex;
        align-items: center;
        gap: 0.85rem;
        flex-wrap: wrap;
    }

    &-avatar {
        width: 52px;
        height: 52px;
        border-radius: 999px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        font-size: 1rem;
        font-weight: 700;
        color: #fff;
        flex-shrink: 0;
    }

    &-badges {
        display: flex;
        flex-wrap: wrap;
        gap: 0.4rem;
        align-items: center;
    }

    &-badge {
        display: inline-flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.74rem;
        padding: 0.22rem 0.6rem;
        border-radius: 999px;
        border: 1px solid var(--sub-line);
        color: var(--sub-dim);
        font-family: var(--bs-font-monospace, ui-monospace, monospace);
        background: transparent;

        // A badge that opens something has to look like it does, or nobody
        // discovers it.
        &--action {
            cursor: pointer;

            &:hover {
                border-color: var(--sub-accent);
                color: var(--sub-accent);
            }
        }

        &--live {
            color: var(--sub-accent);
            border-color: rgba(33, 208, 122, 0.4);
            background: rgba(33, 208, 122, 0.12);
        }
    }

    &-meta {
        display: flex;
        gap: 1rem;
        flex-wrap: wrap;
        margin-top: 0.5rem;
        font-size: 0.8rem;
        color: var(--sub-dim);

        span {
            display: inline-flex;
            align-items: center;
            gap: 0.35rem;
        }
    }

    // Summary cards
    &-cards {
        display: grid;
        grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
        border: 1px solid var(--sub-line);
        border-radius: 0.9rem;
        overflow: hidden;
        margin-bottom: 1.25rem;
    }

    &-card {
        padding: 1rem 1.15rem;

        & + & {
            border-left: 1px solid var(--sub-line);
        }

        @media (max-width: 767px) {
            & + & {
                border-left: none;
                border-top: 1px solid var(--sub-line);
            }
        }

        &__label {
            display: block;
            font-size: 0.76rem;
            color: var(--sub-dim);
            margin-bottom: 0.3rem;
        }

        &__value {
            display: block;
            font-size: 1.4rem;
            font-weight: 700;
            line-height: 1.15;

            &--good {
                color: var(--sub-accent);
            }
        }

        &__sub {
            display: block;
            font-size: 0.72rem;
            color: var(--sub-dim);
            margin-top: 0.25rem;
        }
    }

    // Tabs
    &-tabs {
        display: flex;
        gap: 0.25rem;
        padding: 0.25rem;
        border: 1px solid var(--sub-line);
        border-radius: 999px;
        margin-bottom: 1.25rem;
        overflow-x: auto;
        // The strip scrolls rather than wrapping, so the page never widens.
        -webkit-overflow-scrolling: touch;
    }

    &-tab {
        border: 0;
        background: transparent;
        border-radius: 999px;
        padding: 0.45rem 0.9rem;
        font-size: 0.8rem;
        font-weight: 600;
        color: var(--sub-dim);
        white-space: nowrap;
        display: inline-flex;
        align-items: center;
        gap: 0.4rem;

        span {
            font-size: 0.68rem;
            padding: 0.05rem 0.4rem;
            border-radius: 999px;
            background: var(--sub-line);
        }

        &.is-active {
            background: var(--bs-body-bg, #fff);
            color: var(--bs-body-color, inherit);
            box-shadow: 0 1px 3px rgba(0, 0, 0, 0.18);
        }
    }

    // Panels
    &-panel {
        border: 1px solid var(--sub-line);
        border-radius: 0.9rem;
        overflow: hidden;
        margin-bottom: 1rem;

        &__head {
            display: flex;
            align-items: flex-start;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.9rem 1.1rem;
            border-bottom: 1px solid var(--sub-line);

            h6 {
                margin: 0;
                font-size: 0.92rem;
                font-weight: 700;
            }

            p {
                margin: 0.15rem 0 0;
                font-size: 0.74rem;
                color: var(--sub-dim);
            }
        }

        &__body {
            padding: 1.1rem;
        }
    }

    &-table {
        width: 100%;
        border-collapse: collapse;
        font-size: 0.82rem;

        thead th {
            text-align: left;
            font-size: 0.66rem;
            letter-spacing: 0.09em;
            text-transform: uppercase;
            color: var(--sub-dim);
            font-weight: 600;
            padding: 0.7rem 1.1rem;
            border-bottom: 1px solid var(--sub-line);
            white-space: nowrap;
        }

        tbody td {
            padding: 0.75rem 1.1rem;
            border-bottom: 1px solid var(--sub-line);
            vertical-align: middle;
        }

        tbody tr:last-child td {
            border-bottom: 0;
        }
    }

    &-mono {
        font-family: var(--bs-font-monospace, ui-monospace, monospace);
        font-size: 0.78rem;
    }

    &-up {
        color: #4dabf7;
    }

    &-down {
        color: var(--sub-accent);
    }

    // Timeline on the overview
    &-timeline {
        list-style: none;
        margin: 0;
        padding: 0;

        li {
            display: flex;
            gap: 0.75rem;
            padding: 0.6rem 0;
            font-size: 0.82rem;

            & + li {
                border-top: 1px solid var(--sub-line);
            }
        }

        .dot {
            width: 8px;
            height: 8px;
            border-radius: 999px;
            background: var(--sub-line);
            margin-top: 0.42rem;
            flex-shrink: 0;

            &.is-now {
                background: var(--sub-accent);
                box-shadow: 0 0 0 3px rgba(33, 208, 122, 0.2);
            }
        }

        .when {
            margin-left: auto;
            color: var(--sub-dim);
            font-size: 0.74rem;
            white-space: nowrap;
        }
    }

    // Fact list
    &-facts {
        margin: 0;

        > div {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            padding: 0.5rem 0;

            & + div {
                border-top: 1px solid var(--sub-line);
            }
        }

        dt {
            font-weight: 400;
            font-size: 0.8rem;
            color: var(--sub-dim);
            display: inline-flex;
            align-items: center;
            gap: 0.4rem;
        }

        dd {
            margin: 0;
            font-size: 0.8rem;
            font-weight: 600;
            text-align: right;
            font-family: var(--bs-font-monospace, ui-monospace, monospace);
        }
    }

    // Charts
    &-bars {
        display: flex;
        align-items: flex-end;
        gap: 0.35rem;
        height: 150px;
    }

    &-bar {
        flex: 1;
        min-width: 0;
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 0.3rem;

        .fill {
            width: 100%;
            border-radius: 0.25rem 0.25rem 0 0;
            background: var(--sub-accent);
        }

        .tick {
            font-size: 0.66rem;
            color: var(--sub-dim);
        }
    }

    // Activity heatmap and hour-of-day strip
    &-heat {
        display: grid;
        grid-auto-flow: column;
        grid-template-rows: repeat(7, 1fr);
        gap: 3px;
        overflow-x: auto;

        i {
            width: 10px;
            height: 10px;
            border-radius: 2px;
            background: var(--sub-line);
            display: block;
        }
    }

    &-hours {
        display: grid;
        grid-template-columns: repeat(24, 1fr);
        gap: 3px;

        i {
            height: 26px;
            border-radius: 3px;
            background: var(--sub-line);
            display: block;
        }
    }

    &-legend {
        display: flex;
        align-items: center;
        gap: 0.35rem;
        font-size: 0.68rem;
        color: var(--sub-dim);

        i {
            width: 10px;
            height: 10px;
            border-radius: 2px;
            display: block;
        }
    }

    &-empty {
        text-align: center;
        padding: 3rem 1rem;
        color: var(--sub-dim);
        font-size: 0.85rem;

        i {
            display: block;
            font-size: 1.5rem;
            margin-bottom: 0.5rem;
            opacity: 0.7;
        }
    }

    // Message bubbles
    &-msg {
        padding: 0.75rem 0;
        font-size: 0.82rem;

        & + & {
            border-top: 1px solid var(--sub-line);
        }

        &__meta {
            display: flex;
            justify-content: space-between;
            gap: 1rem;
            margin-bottom: 0.3rem;
            font-size: 0.72rem;
            color: var(--sub-dim);
            font-family: var(--bs-font-monospace, ui-monospace, monospace);
        }

        &__body {
            margin: 0;
            line-height: 1.5;
        }
    }
}

// ── Add a subscriber ────────────────────────────────────────────────
// A single form rather than a wizard: everything here fits on one screen,
// and a multi-step flow for eight fields is ceremony rather than help.
.sub-new {
    max-width: 760px;

    .sub-panel {
        margin-bottom: 1rem;
    }

    .sub-step {
        &__mark {
            width: 34px;
            height: 34px;
            border-radius: 999px;
            background: #21d07a;
            color: #05261a;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            flex-shrink: 0;
        }
    }

    .sub-label {
        font-size: 0.82rem;
        font-weight: 600;
        margin-bottom: 0.35rem;
    }

    // Required marker and the grey aside next to a label carry meaning, so
    // they are styled rather than left to blend into the label text.
    .sub-req {
        color: #e5484d;
    }

    .sub-hint {
        font-weight: 400;
        color: var(--bs-secondary-color, #7d899b);
        font-size: 0.78rem;
    }

    .sub-help {
        font-size: 0.74rem;
        color: var(--bs-secondary-color, #7d899b);
        margin-top: 0.3rem;
        line-height: 1.4;
    }

    .sub-error {
        font-size: 0.75rem;
        color: #e5484d;
        margin-top: 0.3rem;
    }

    .form-control,
    .form-select {
        background: transparent;
        border-color: var(--bs-border-color, rgba(125, 125, 125, 0.22));
        color: inherit;
        padding: 0.6rem 0.85rem;
        border-radius: 0.5rem;

        &:focus {
            background: transparent;
            color: inherit;
            border-color: #21d07a;
            box-shadow: none;
        }

        &::placeholder {
            color: var(--bs-secondary-color, #7d899b);
            opacity: 0.7;
        }
    }

    // Status is two states, not a dropdown — showing both makes the choice
    // and its consequence readable at a glance.
    .sub-toggle {
        display: inline-flex;
        gap: 0.25rem;
        padding: 0.25rem;
        border: 1px solid var(--bs-border-color, rgba(125, 125, 125, 0.22));
        border-radius: 999px;

        &__opt {
            border: 0;
            background: transparent;
            border-radius: 999px;
            padding: 0.35rem 1rem;
            font-size: 0.8rem;
            font-weight: 600;
            color: var(--bs-secondary-color, #7d899b);

            &.is-on {
                background: #21d07a;
                color: #05261a;
            }
        }
    }

    .sub-pass {
        position: relative;
        display: flex;
        align-items: center;

        .form-control {
            padding-right: 4.5rem;
        }

        &__btn {
            position: absolute;
            border: 0;
            background: transparent;
            color: var(--bs-secondary-color, #7d899b);
            padding: 0.25rem 0.4rem;

            &:nth-of-type(1) { right: 2.2rem; }
            &:nth-of-type(2) { right: 0.5rem; }

            &:hover { color: inherit; }
        }
    }
}

// ── Modals ──────────────────────────────────────────────────────────
// Hand-rolled rather than Bootstrap's, because Bootstrap keeps its own
// open/closed state in JS and Livewire re-renders the DOM underneath it — the
// two disagree the moment a form inside the modal round-trips to the server.
// Here the Livewire boolean is the only source of truth.
.sub-modal {
    position: fixed;
    inset: 0;
    z-index: 1090;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;

    &__backdrop {
        position: absolute;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        backdrop-filter: blur(2px);
    }

    &__card {
        position: relative;
        width: 100%;
        max-width: 560px;
        // Never taller than the viewport; the body scrolls instead, so a long
        // form cannot push its own buttons off the screen.
        max-height: calc(100vh - 2rem);
        display: flex;
        flex-direction: column;
        border-radius: 0.9rem;
        border: 1px solid var(--sub-line);
        background: var(--bs-body-bg, #14161a);
        box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
        animation: sub-modal-in 0.14s ease-out;
    }

    &__head {
        display: flex;
        align-items: flex-start;
        justify-content: space-between;
        gap: 1rem;
        padding: 1rem 1.15rem;
        border-bottom: 1px solid var(--sub-line);
        flex-shrink: 0;

        h6 {
            margin: 0;
            font-size: 0.98rem;
            font-weight: 700;
        }

        p {
            margin: 0.2rem 0 0;
            font-size: 0.76rem;
            color: var(--sub-dim);
            line-height: 1.45;
        }
    }

    &__body {
        padding: 1.15rem;
        overflow-y: auto;
    }

    &__foot {
        display: flex;
        justify-content: flex-end;
        gap: 0.5rem;
        padding: 0.85rem 1.15rem;
        border-top: 1px solid var(--sub-line);
        flex-shrink: 0;
    }

    .form-control,
    .form-select {
        background: transparent;
        border-color: var(--sub-line);
        color: inherit;

        &:focus {
            background: transparent;
            color: inherit;
            border-color: var(--sub-accent);
            box-shadow: none;
        }
    }
}

@keyframes sub-modal-in {
    from { opacity: 0; transform: translateY(8px) scale(0.99); }
    to   { opacity: 1; transform: none; }
}

// The page behind a modal must not scroll — otherwise a scroll gesture over
// the backdrop moves the content you were reading.
body.sub-modal-open {
    overflow: hidden;
}

// The refresh icon turns while the request is out, so a slow router reads as
// "working" rather than "nothing happened".
.spin {
    animation: sub-spin 0.8s linear infinite;
}

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