/* UniBiller page style: the look of the Mgmt dashboard, shared so other pages can take it on.
   Wrap a page in <div class="ub">, open it with a .ub-hero band, then use cards, tiles and .ub-table.
   Colours are the brand's teal, navy and amber. A status colour always comes with an icon and words. */

.ub {
    --teal: #17b3a0; --teal-deep: #0e8f80; --navy: #0b4f6c; --amber: #f7b83d;
    --ink: #14303f; --ink-soft: #5a6f7c; --line: #e6ecef; --card: #fff; --wash: #f5f8f9;
    --chart-collected: #0e9f8c; --chart-billed: #5b8def;
    --tone-teal: #dcf5f1; --tone-teal-ink: #0b7367;
    --tone-blue: #dfeafd; --tone-blue-ink: #2554b0;
    --tone-red: #fde4e1; --tone-red-ink: #b3261e;
    --tone-amber: #fdf0d5; --tone-amber-ink: #8a5a00;
    --tone-violet: #ebe5fb; --tone-violet-ink: #5b3db0;
    color: var(--ink);
}
.ub a { text-decoration: none; }
.ub-muted { color: var(--ink-soft); }
.ub-empty { color: var(--ink-soft); padding: .75rem 0; display: flex; align-items: center; gap: .5rem; }
.ub-empty i { color: var(--teal-deep); font-size: 1.1rem; }

.tone-teal { --chip: var(--tone-teal); --chip-ink: var(--tone-teal-ink); --edge: var(--teal); }
.tone-blue { --chip: var(--tone-blue); --chip-ink: var(--tone-blue-ink); --edge: #5b8def; }
.tone-red { --chip: var(--tone-red); --chip-ink: var(--tone-red-ink); --edge: #d9483b; }
.tone-amber { --chip: var(--tone-amber); --chip-ink: var(--tone-amber-ink); --edge: var(--amber); }
.tone-violet { --chip: var(--tone-violet); --chip-ink: var(--tone-violet-ink); --edge: #7c5fd6; }
.tone-grey { --chip: #e9eef1; --chip-ink: #4a5d69; --edge: #9fb3c0; }

/* Cards */
.ub-card {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
    height: 100%; display: flex; flex-direction: column; min-width: 0;
}
.ub-card-head {
    display: flex; align-items: center; justify-content: space-between; gap: .75rem;
    padding: .9rem 1.1rem .6rem;
}
.ub-card-head h2 { font-size: 1rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.ub-card-head .more { font-size: .82rem; white-space: nowrap; color: var(--teal-deep); font-weight: 600; }
.ub-card-body { padding: .15rem 1.1rem 1rem; flex: 1 1 auto; min-width: 0; }

/* Bootstrap parts inside a styled page */
.ub .btn-primary { background-color: var(--navy); border-color: var(--navy); color: #fff; }
.ub .btn-primary:hover, .ub .btn-primary:focus { background-color: #093f57; border-color: #093f57; color: #fff; }
.ub .btn-success, .ub .btn-success:disabled { background-color: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.ub .btn-success:hover:not(:disabled), .ub .btn-success:focus:not(:disabled) { background-color: var(--navy); border-color: var(--navy); color: #fff; }
.ub .form-check-input:checked, .ub .form-check-input:indeterminate { background-color: var(--teal-deep); border-color: var(--teal-deep); }
.ub-hero .form-check-input:checked { background-color: var(--amber); border-color: var(--amber); }
.ub .page-link { color: var(--navy); border-color: var(--line); }
.ub .page-link:hover { color: var(--teal-deep); background-color: var(--wash); border-color: var(--line); }
.ub .page-item.disabled .page-link { color: var(--ink-soft); border-color: var(--line); }
.ub-modal .modal-content { border: 0; border-radius: 16px; overflow: hidden; }
.ub-modal .modal-header { background: linear-gradient(120deg, #0f9d8c, #0b4f6c); color: #fff; border: 0; }
.ub-modal .btn-close { filter: invert(1) brightness(2); }

/* Top band */
.ub-hero {
    position: relative; border-radius: 20px; padding: 1.5rem 1.6rem; color: #fff; margin-bottom: 1rem;
    background:
        radial-gradient(circle at 92% -20%, rgba(247, 184, 61, .34), transparent 45%),
        linear-gradient(120deg, #0f9d8c 0%, #0c7482 45%, #0b4f6c 100%);
    box-shadow: 0 10px 28px rgba(11, 79, 108, .22);
}
[dir="rtl"] .ub-hero {
    background:
        radial-gradient(circle at 8% -20%, rgba(247, 184, 61, .34), transparent 45%),
        linear-gradient(240deg, #0f9d8c 0%, #0c7482 45%, #0b4f6c 100%);
}
.ub-hero-grid { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 1.5rem; align-items: center; }
.ub-eyebrow { font-size: .88rem; opacity: .9; }
.ub-hero h1 { font-size: 1.55rem; font-weight: 700; margin: .1rem 0 .85rem; overflow-wrap: anywhere; }

.ub-search { position: relative; max-width: 640px; }
.ub-search i.lead { position: absolute; inset-inline-start: 1rem; top: 50%; transform: translateY(-50%); color: #5a6f7c; font-size: 1.1rem; }
.ub-search input {
    width: 100%; border: 0; border-radius: 14px; padding: .8rem 1rem; padding-inline-start: 2.7rem;
    font-size: 1rem; color: var(--ink); box-shadow: 0 4px 14px rgba(0, 0, 0, .14);
}
.ub-search input:focus { outline: 3px solid var(--amber); outline-offset: 1px; }

.ub-links { display: flex; flex-wrap: wrap; gap: .45rem; margin-top: .85rem; }
.ub-link {
    display: inline-flex; align-items: center; gap: .35rem; color: #fff; font-size: .84rem; font-weight: 600;
    padding: .34rem .75rem; border-radius: 999px; background: rgba(255, 255, 255, .15); border: 1px solid rgba(255, 255, 255, .24);
}
.ub-link:hover { background: rgba(255, 255, 255, .28); color: #fff; }
.ub-cta {
    display: inline-flex; align-items: center; justify-content: center; gap: .4rem; border: 0; border-radius: 12px;
    padding: .7rem 1.15rem; font-weight: 700; white-space: nowrap; background: var(--amber); color: #3d2a00;
    box-shadow: 0 4px 14px rgba(0, 0, 0, .16);
}
.ub-cta:hover { background: #ffc957; color: #3d2a00; }
.ub-eyebrow a { color: #fff; }
.ub-eyebrow a:hover { color: #fff; text-decoration: underline; text-underline-offset: 2px; }

/* A title with its tabs beside it, and the filters of a list page. */
.ub-hero-title { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1rem; margin-bottom: .85rem; }
.ub-hero-title h1 { margin: 0; }
.ub-tabs { display: flex; flex-wrap: wrap; gap: .35rem; list-style: none; margin: 0; padding: 0; }
.ub-tab {
    display: inline-flex; align-items: center; gap: .35rem; color: #fff; font-size: .86rem; font-weight: 600;
    padding: .34rem .85rem; border-radius: 999px; background: rgba(255, 255, 255, .15);
}
.ub-tab:hover { background: rgba(255, 255, 255, .28); color: #fff; }
.ub-tab.active, .ub-tab.active:hover { background: #fff; color: var(--navy); }
.ub-filters { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem; }
.ub-filters .ub-search { flex: 1 1 280px; }
.ub-filters.labelled { align-items: flex-end; }
.ub-field { display: flex; flex-direction: column; gap: .1rem; min-width: 0; }
.ub-field label { font-size: .76rem; font-weight: 600; margin: 0; color: var(--ink-soft); }
.ub-hero .ub-field label { color: #fff; opacity: .92; }
.ub-hero .ub-filters .form-check-label { color: #fff; font-size: .88rem; font-weight: 600; }
.ub-hero .ub-filters .form-select, .ub-hero .ub-filters .form-control { width: auto; max-width: 200px; border: 0; border-radius: 12px; }

.ub-toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: .5rem; margin: 0 .15rem .6rem; }
.ub-toolbar h2 { font-size: .8rem; letter-spacing: .05em; text-transform: uppercase; color: var(--ink-soft); font-weight: 700; margin: 0; }

/* Figure tiles */
.ub-tile {
    position: relative; display: block; height: 100%; padding: .95rem 1.05rem; border-radius: 16px; background: var(--card);
    border: 1px solid var(--line); color: inherit; overflow: hidden;
    box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
    transition: transform .15s ease, box-shadow .15s ease;
}
.ub-tile::before { content: ""; position: absolute; inset-block: 0; inset-inline-start: 0; width: 4px; background: var(--edge); }
a.ub-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11, 79, 108, .12); color: inherit; }
.ub-tile .top { display: flex; align-items: center; gap: .55rem; margin-bottom: .4rem; }
.ub-tile .label { font-size: .86rem; font-weight: 600; color: var(--ink-soft); }
.ub-tile .note { font-size: .8rem; color: var(--ink-soft); margin-top: .25rem; }
.ub-chip {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center;
    background: var(--chip); color: var(--chip-ink); font-size: 1.05rem;
}
.ub-fig { font-size: clamp(1.1rem, .9rem + .75vw, 1.5rem); font-weight: 700; line-height: 1.25; overflow-wrap: anywhere; }
.ub-fig + .ub-fig { font-size: clamp(.98rem, .85rem + .4vw, 1.12rem); }

/* Link tiles: a page of shortcuts */
.ub-nav-tile {
    display: flex; align-items: center; gap: .65rem; height: 100%; padding: .7rem .85rem; border-radius: 14px; background: var(--card);
    border: 1px solid var(--line); color: var(--ink); font-weight: 600; font-size: .92rem; line-height: 1.2;
    box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
    transition: transform .15s ease, box-shadow .15s ease, border-color .15s ease;
}
.ub-nav-tile:hover { transform: translateY(-2px); box-shadow: 0 10px 24px rgba(11, 79, 108, .12); border-color: var(--edge); color: var(--ink); }

/* Small parts */
.ub-avatar {
    flex: 0 0 34px; width: 34px; height: 34px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
    background: var(--chip, var(--tone-teal)); color: var(--chip-ink, var(--tone-teal-ink)); font-weight: 700; font-size: .9rem;
}
.ub-badge {
    display: inline-flex; align-items: center; gap: .25rem; font-size: .74rem; font-weight: 700; line-height: 1.5;
    padding: .1rem .5rem; border-radius: 999px; background: var(--chip); color: var(--chip-ink); white-space: nowrap;
}
a.ub-badge:hover { color: var(--chip-ink); filter: brightness(.96); }
.ub-go {
    flex: 0 0 auto; font-size: .82rem; font-weight: 600; padding: .32rem .7rem; border-radius: 9px;
    background: var(--wash); color: var(--navy); border: 1px solid var(--line); white-space: nowrap;
}
.ub-go:hover { background: var(--tone-teal); color: var(--tone-teal-ink); border-color: transparent; }
.ub-pay { flex: 0 0 auto; font-size: .8rem; font-weight: 700; padding: .28rem .65rem; border-radius: 9px; background: var(--teal-deep); color: #fff; border: 0; }
.ub-pay:hover { background: var(--navy); color: #fff; }
.ub-icon-btn {
    width: 30px; height: 30px; padding: 0; display: inline-flex; align-items: center; justify-content: center; border-radius: 9px;
    background: var(--wash); color: var(--navy); border: 1px solid var(--line); font-size: .85rem;
}
.ub-icon-btn:hover:not(:disabled) { background: var(--tone-blue); color: var(--tone-blue-ink); border-color: transparent; }
.ub-icon-btn.danger:hover:not(:disabled) { background: var(--tone-red); color: var(--tone-red-ink); }
.ub-icon-btn:disabled { opacity: .4; }
.ub-actions { display: flex; align-items: center; justify-content: flex-end; gap: .3rem; }
.ub-actions form { display: inline-flex; gap: .3rem; margin: 0; }

/* A simple list inside a card */
.ub-list-row { display: flex; align-items: center; gap: .7rem; padding: .6rem 0; border-top: 1px solid var(--line); color: inherit; }
.ub-list-row:first-child { border-top: 0; }
a.ub-list-row:hover { color: inherit; background: var(--wash); }
.ub-list-row .who { flex: 1 1 auto; min-width: 0; }
.ub-list-row .name { display: inline-block; max-width: 100%; vertical-align: top; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ub-list-row .sub { font-size: .8rem; color: var(--ink-soft); }
.ub-list-row .amt { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: end; }

/* A strip of tools above a table, such as actions on the ticked rows. */
.ub-bulk {
    display: flex; flex-wrap: wrap; align-items: center; gap: .6rem 1rem; padding: .6rem .9rem; margin-bottom: 1rem;
    background: var(--card); border: 1px solid var(--line); border-radius: 14px;
}
.ub-note {
    display: flex; align-items: center; gap: .6rem; padding: .6rem .9rem; margin-bottom: 1rem; border-radius: 12px;
    background: var(--tone-amber); color: #5e3f00; font-weight: 600;
}
a.ub-note:hover { color: #5e3f00; filter: brightness(.97); }
.ub-hint { font-size: .84rem; color: var(--ink-soft); margin: 0 .15rem 1rem; }
.ub .alert { border-radius: 12px; }
.ub-count { background: var(--tone-teal); color: var(--tone-teal-ink); font-size: .74rem; font-weight: 700; border-radius: 999px; padding: .06rem .5rem; }

/* Tables */
.ub-table-card { height: auto; overflow: hidden; }
.ub-table {
    --bs-table-hover-bg: rgba(23, 179, 160, .07); --bs-table-border-color: var(--line); --bs-table-color: var(--ink);
    margin: 0;
}
.ub-table > thead th {
    background: var(--wash); color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .04em;
    text-transform: uppercase; white-space: nowrap; padding: .7rem .75rem;
}
.ub-table > :not(:first-child) { border-top: 0; }
.ub-table > tbody > tr > td { padding: .6rem .75rem; }
.ub-table > tbody > tr:last-child > td { border-bottom: 0; }
.ub-table-tight > thead th { white-space: normal; letter-spacing: 0; padding: .55rem .45rem; vertical-align: bottom; }
.ub-table-tight > tbody > tr > td { padding: .4rem .45rem; font-size: .9rem; }
.ub-person { display: flex; align-items: center; gap: .65rem; min-width: 0; }
.ub-person .who { min-width: 0; }
/* inline-block so a name in the other script follows the page's alignment instead of jumping across the cell. */
.ub-person .name { display: inline-block; max-width: 100%; font-weight: 600; color: var(--ink); }
.ub-person a.name:hover { color: var(--teal-deep); }
.ub-person .sub { font-size: .8rem; color: var(--ink-soft); }

@media (max-width: 767.98px) {
    .ub-hero { padding: 1.15rem 1.05rem; border-radius: 16px; }
    .ub-hero-grid { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
    .ub-filters .ub-search { flex-basis: 100%; }
    .ub-hero .ub-cta.wide { width: 100%; }

    /* .ub-reflow: the page turns each table row into its own card on a phone. */
    .ub-table-card.ub-reflow { background: none; border: 0; box-shadow: none; overflow: visible; }
    .ub-reflow .ub-table > tbody > tr {
        background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .7rem .8rem; margin-bottom: .6rem;
        box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
    }
}


/* ---- Site-wide layer ----
   _Layout marks <main> with .ub-auto, so every page gets this look without touching its markup:
   the title block becomes the hero band, and Bootstrap's cards, tables, badges, alerts, forms and buttons
   take the brand's colours. Pages built on .ub-hero and friends only pick up the component colours.
   A first div holding cards is a wrapper around the whole page, not a title block, so it stays plain.
   The Bootstrap here is an older 5.x: override real properties, not --bs-* variables. */
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) {
    border-radius: 20px; padding: 1.2rem 1.6rem; color: #fff; margin: 0 0 1rem !important;
    background:
        radial-gradient(circle at 92% -20%, rgba(247, 184, 61, .34), transparent 45%),
        linear-gradient(120deg, #0f9d8c 0%, #0c7482 45%, #0b4f6c 100%);
    box-shadow: 0 10px 28px rgba(11, 79, 108, .22);
}
[dir="rtl"] :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) {
    background:
        radial-gradient(circle at 8% -20%, rgba(247, 184, 61, .34), transparent 45%),
        linear-gradient(240deg, #0f9d8c 0%, #0c7482 45%, #0b4f6c 100%);
}
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))):is(h1, h2), :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(h1, h2) { font-size: 1.55rem; font-weight: 700; margin-bottom: 0; color: #fff !important; overflow-wrap: anywhere; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(.text-primary, .text-success, .text-danger, .text-warning, .text-info, .text-muted, .text-secondary) { color: #fff !important; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(p, .small) { color: #fff; opacity: .92; margin-bottom: 0; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) a:not(.btn, .dropdown-item) { color: #fff; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(.btn-primary, .btn-success) { background-color: var(--amber); border-color: var(--amber); color: #3d2a00; font-weight: 700; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(.btn-primary, .btn-success):hover { background-color: #ffc957; border-color: #ffc957; color: #3d2a00; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) .btn:not(.btn-primary, .btn-success) { background-color: rgba(255, 255, 255, .15); border-color: rgba(255, 255, 255, .24); color: #fff; }
:is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) .btn:not(.btn-primary, .btn-success):hover { background-color: rgba(255, 255, 255, .28); color: #fff; }
.ub-auto > .container-fluid { padding-inline: 0; margin-top: 0 !important; }
.ub-auto > .container-fluid > .row:first-child { margin-inline: 0; align-items: center; }

/* A filter form right under the title sits on its own strip. */
.ub-auto > form[method="get"], .ub-auto > form[method="GET"] {
    background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: .65rem .85rem; margin-inline: 0;
}
.ub-auto > form[method="get"].row, .ub-auto > form[method="GET"].row { margin-top: 0; padding-top: 0; }

/* Colours and text */
.ub a:not([class]) { color: var(--teal-deep); }
.ub a:not([class]):hover { color: var(--navy); }
.ub-auto :is(h3, h4, h5, h6) { color: var(--navy); }
.ub-auto :is(.text-white, .bg-primary, .bg-success, .bg-danger, .bg-dark, .bg-secondary, [style*="gradient"]) :is(h3, h4, h5, h6) { color: inherit; }
.ub-auto .text-primary { color: var(--teal-deep) !important; }
.ub-auto .text-muted { color: var(--ink-soft) !important; }
.ub-auto .bg-primary { background-color: var(--navy) !important; }
.ub-auto .bg-success { background-color: var(--teal-deep) !important; }

/* Cards */
.ub-auto .card {
    border: 1px solid var(--line); border-radius: 16px;
    box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
}
.ub-auto .card.bg-light { background-color: var(--card) !important; }
.ub-auto .card-header { background-color: var(--wash); color: var(--ink); border-bottom: 1px solid var(--line); font-weight: 700; }
.ub-auto .card-header:is(.bg-primary, .bg-success, .bg-danger, .bg-dark, .bg-secondary) { color: #fff; }
.ub-auto .card-header:first-child { border-radius: 15px 15px 0 0; }
.ub-auto .card-footer { background-color: var(--wash); border-top: 1px solid var(--line); }
.ub-auto .card-footer:last-child { border-radius: 0 0 15px 15px; }
.ub-auto .card > .list-group:last-child { border-radius: 0 0 15px 15px; }

/* Tables */
.ub-auto .table:not(.ub-table) { color: var(--ink); border-color: var(--line); margin-bottom: 0; }
.ub-auto .table:not(.ub-table) > :not(:first-child) { border-top: 0; }
.ub-auto .table:not(.ub-table) > thead th {
    background: var(--wash); color: var(--ink-soft); font-size: .72rem; font-weight: 700; letter-spacing: .03em;
    text-transform: uppercase; vertical-align: bottom;
}
.ub-auto .table-hover:not(.ub-table) > tbody > tr:hover > * { background-color: rgba(23, 179, 160, .07); --bs-table-accent-bg: transparent; }
:is(.ub-auto, .ub-auto :not(.card, .card-body, .ub-table-card)) > .table-responsive {
    background: var(--card); border: 1px solid var(--line); border-radius: 16px; margin-bottom: 1rem;
    box-shadow: 0 1px 2px rgba(11, 79, 108, .05), 0 6px 20px rgba(11, 79, 108, .05);
}

/* Badges keep their meaning, in the soft tones. Each also has words next to its colour. */
.ub .badge { font-size: .74rem; font-weight: 700; border-radius: 999px; padding: .22rem .55rem; }
.ub .badge.bg-success { background-color: var(--tone-teal) !important; color: var(--tone-teal-ink) !important; }
.ub .badge.bg-primary, .ub .badge.bg-info { background-color: var(--tone-blue) !important; color: var(--tone-blue-ink) !important; }
.ub .badge.bg-danger { background-color: var(--tone-red) !important; color: var(--tone-red-ink) !important; }
.ub .badge.bg-warning { background-color: var(--tone-amber) !important; color: var(--tone-amber-ink) !important; }
.ub .badge.bg-secondary, .ub .badge.bg-light, .ub .badge.bg-dark { background-color: #e9eef1 !important; color: #4a5d69 !important; border: 0 !important; }

/* Alerts */
.ub .alert { border: 0; }
.ub .alert-success { background: var(--tone-teal); color: var(--tone-teal-ink); }
.ub .alert-info, .ub .alert-primary { background: var(--tone-blue); color: var(--tone-blue-ink); }
.ub .alert-danger { background: var(--tone-red); color: var(--tone-red-ink); }
.ub .alert-warning { background: var(--tone-amber); color: #5e3f00; }
.ub .alert-light, .ub .alert-secondary { background: var(--card); color: var(--ink); border: 1px solid var(--line); }

/* Buttons */
.ub .btn { border-radius: 10px; font-weight: 600; }
.ub .btn-sm { border-radius: 8px; }
.ub .btn-outline-primary { color: var(--navy); border-color: var(--navy); }
.ub .btn-outline-primary:hover { background-color: var(--navy); border-color: var(--navy); color: #fff; }
.ub .btn-outline-success { color: var(--teal-deep); border-color: var(--teal-deep); }
.ub .btn-outline-success:hover { background-color: var(--teal-deep); border-color: var(--teal-deep); color: #fff; }
.ub .btn-outline-secondary, .ub .btn-outline-dark { color: var(--navy); border-color: #cfdae0; }
.ub .btn-outline-secondary:hover, .ub .btn-outline-dark:hover { background-color: var(--wash); border-color: #cfdae0; color: var(--navy); }

/* Forms */
.ub .form-control, .ub .form-select { border-radius: 10px; border-color: #d5dee3; }
.ub .form-control:focus, .ub .form-select:focus { border-color: var(--teal); box-shadow: 0 0 0 3px var(--tone-teal); }
.ub .form-label { font-weight: 600; }
.ub .input-group > :not(:last-child) { border-start-end-radius: 0; border-end-end-radius: 0; }
.ub .input-group > :not(:first-child) { border-start-start-radius: 0; border-end-start-radius: 0; }

/* Lists, tabs, menus */
.ub .list-group { border-radius: 14px; }
.ub .list-group-item { border-color: var(--line); }
.ub .list-group-item.active { background-color: var(--teal-deep); border-color: var(--teal-deep); }
.ub .nav-tabs { border-bottom-color: var(--line); }
.ub .nav-tabs .nav-link { color: var(--ink-soft); font-weight: 600; border: 0; border-bottom: 3px solid transparent; }
.ub .nav-tabs .nav-link:hover { color: var(--teal-deep); }
.ub .nav-tabs .nav-link.active { color: var(--teal-deep); background: none; border-bottom-color: var(--teal); }
.ub .nav-pills .nav-link.active { background-color: var(--teal-deep); }
.ub .dropdown-item:active, .ub .dropdown-item.active { background-color: var(--teal-deep); }
.ub .accordion-button:not(.collapsed) { background-color: var(--tone-teal); color: var(--tone-teal-ink); }
.ub .accordion-item { border-color: var(--line); }

@media (max-width: 767.98px) {
    :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) { padding: 1rem 1.05rem; border-radius: 16px; }
    /* Pages that re-flow rows into cards on a phone don't want a box around the boxes. */
    :is(.ub-auto, .ub-auto :not(.card, .card-body, .ub-table-card)) > .table-responsive { background: none; border: 0; box-shadow: none; }
}

@media print {
    :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) { background: none; color: #000; box-shadow: none; padding: 0; }
    :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))):is(h1, h2), :is(.ub-auto > div:first-of-type:not(.ub, .hero-section, .admin-header, .page-head, .quick-counter, .reading-round, .bill-check, .collect-page):not(:has(.card)):has(> :is(h1, h2), > div > :is(h1, h2)), .ub-auto > :is(h1, h2):first-of-type:not(div ~ *), .ub-auto > .container-fluid > .row:first-child, .ub-auto > :is(.quick-counter, .reading-round) > div:first-of-type:has(> :is(h1, h2))) :is(h1, h2) { color: #000 !important; }
}
