/*
 * The admin's design system.
 *
 * Written for the analytics dashboard and now shared by every screen being brought up to it,
 * one at a time. Apply it by putting .ua-page on a page's outermost element (analytics uses
 * .ua-dash, which is the same thing plus its own panel behaviour); every component class
 * below then works inside it.
 *
 * It sits on the admin's Bootstrap 5 and CoreUI but deliberately does not look like them. The
 * surrounding admin is stock Bootstrap -- hard 1px borders, sharp corners, outline buttons,
 * everything the same weight -- and a page built that way gives every element equal
 * importance, which is the opposite of what a dashboard is for.
 *
 * What this does instead:
 *
 *  - Depth comes from layered surfaces and soft shadows, not from borders. Borders draw boxes;
 *    shadows suggest a hierarchy without adding lines to read.
 *  - One accent colour, used only for data and for the thing currently selected. Everything
 *    else is neutral, so colour always means something.
 *  - A real type scale. The figure is large, its label is small and quiet, and the difference
 *    between them is what makes a KPI readable at a glance.
 *  - Generous, consistent spacing from a 4px rhythm. Cramped dashboards read as dense; spaced
 *    ones read as considered.
 *
 * Everything is namespaced under .ua- so none of it can reach the rest of the admin.
 */

.ua-dash,
.ua-page {
    /* Neutrals: a slate ramp rather than pure greys, which photograph as flat and cold. */
    --ua-bg: #f7f8fa;
    --ua-card: #ffffff;
    --ua-raised: #ffffff;
    --ua-line: #eceff3;
    --ua-line-strong: #dfe4ea;
    --ua-text: #0f172a;
    --ua-text-soft: #475569;
    --ua-muted: #8b95a5;

    --ua-accent: #2563eb;
    --ua-accent-ink: #1d4ed8;
    --ua-accent-wash: #eff4ff;
    --ua-accent-line: #c7dafe;

    --ua-up: #047857;
    --ua-up-wash: #ecfdf5;
    --ua-down: #be123c;
    --ua-down-wash: #fff1f3;

    --ua-bar: #eaf0fb;
    --ua-hover: #f8fafc;

    --ua-r-sm: 8px;
    --ua-r: 12px;
    --ua-r-lg: 16px;

    --ua-shadow: 0 1px 2px rgba(15, 23, 42, .04), 0 1px 3px rgba(15, 23, 42, .06);
    --ua-shadow-lift: 0 4px 6px -1px rgba(15, 23, 42, .07), 0 2px 4px -2px rgba(15, 23, 42, .05);

    color: var(--ua-text);
    padding-bottom: 3rem;
    font-feature-settings: "cv02", "cv03", "cv04";
    -webkit-font-smoothing: antialiased;
}

@media (prefers-color-scheme: dark) {
    .ua-dash,
    .ua-page {
        --ua-bg: #0b0f16;
        --ua-card: #131924;
        --ua-raised: #182030;
        --ua-line: #1f2836;
        --ua-line-strong: #2a3444;
        --ua-text: #e8edf4;
        --ua-text-soft: #aab6c6;
        --ua-muted: #7c8899;

        --ua-accent: #5b8cff;
        --ua-accent-ink: #7ba3ff;
        --ua-accent-wash: #16233c;
        --ua-accent-line: #24365a;

        --ua-up: #34d399;
        --ua-up-wash: #10251f;
        --ua-down: #fb7185;
        --ua-down-wash: #2a1520;

        --ua-bar: #1b2536;
        --ua-hover: #18202e;

        --ua-shadow: 0 1px 2px rgba(0, 0, 0, .3);
        --ua-shadow-lift: 0 6px 16px rgba(0, 0, 0, .4);
    }

    .ua-dash .form-control,
    .ua-dash .form-select,
    .ua-page .form-control,
    .ua-page .form-select {
        background-color: var(--ua-raised);
        border-color: var(--ua-line-strong);
        color: var(--ua-text);
    }
}

/*
 * The loading line.
 *
 * A tab change fetches and swaps rather than reloading, which is fast enough that a spinner
 * would flash and be gone. This is a hairline at the top of the panel that only appears if the
 * fetch takes long enough to notice -- feedback when it is needed, invisible when it is not.
 */
.ua-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    border-radius: 2px;
    overflow: hidden;
    opacity: 0;
    transition: opacity .2s ease .18s;
    pointer-events: none;
    z-index: 1019;
}

.ua-progress.is-active { opacity: 1; }

.ua-progress::after {
    content: "";
    position: absolute;
    inset: 0;
    width: 40%;
    border-radius: 2px;
    background: linear-gradient(90deg, transparent, var(--ua-accent), transparent);
    animation: ua-progress 1s ease-in-out infinite;
}

@keyframes ua-progress {
    0% { transform: translateX(-100%); }
    100% { transform: translateX(350%); }
}

.ua-dash { position: relative; }

/* The outgoing view fades very slightly rather than blanking, so a swap reads as the same
   page updating instead of a new one arriving. */
.ua-dash[aria-busy="true"] .ua-card,
.ua-dash[aria-busy="true"] .ua-kpis { opacity: .6; transition: opacity .15s ease; }

@media (prefers-reduced-motion: reduce) {
    .ua-progress::after { animation: none; width: 100%; }
    .ua-dash[aria-busy="true"] .ua-card,
    .ua-dash[aria-busy="true"] .ua-kpis { opacity: 1; }
}

/* ------------------------------------------------------------------ layout */

/*
 * The controls stick below the admin's own header rather than at the top of the viewport.
 * CoreUI's .header is itself sticky at top:0, so pinning this there too puts two bars in the
 * same place. The offset is measured at runtime by dashboard.js because the header's height
 * changes with the window width.
 */
.ua-sticky {
    position: sticky;
    top: var(--ua-sticky-top, 0px);
    z-index: 1018;
    background: var(--ua-bg);
    padding: 1.25rem 0 0;
    margin: 0 0 1.5rem;
    border-bottom: 1px solid var(--ua-line);
}

.ua-dash h1,
.ua-page h1 {
    font-size: 1.5rem;
    font-weight: 650;
    letter-spacing: -.02em;
    margin: 0;
}

/* Segmented control for the range picker, instead of a row of outline buttons. */
.ua-seg {
    display: inline-flex;
    background: var(--ua-bar);
    border-radius: 10px;
    padding: 3px;
    gap: 2px;
}

.ua-seg a {
    display: inline-flex;
    align-items: center;
    padding: .35rem .7rem;
    border-radius: 7px;
    font-size: .8125rem;
    font-weight: 550;
    color: var(--ua-text-soft);
    text-decoration: none;
    white-space: nowrap;
    transition: background .14s ease, color .14s ease;
}

.ua-seg a:hover { color: var(--ua-text); }

.ua-seg a.is-active {
    background: var(--ua-card);
    color: var(--ua-accent-ink);
    box-shadow: var(--ua-shadow);
}

/* Toolbar buttons: quiet by default, filled only when switched on. */
.ua-btn {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    height: 34px;
    padding: 0 .75rem;
    border: 1px solid var(--ua-line-strong);
    border-radius: 9px;
    background: var(--ua-card);
    color: var(--ua-text-soft);
    font-size: .8125rem;
    font-weight: 550;
    text-decoration: none;
    cursor: pointer;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.ua-btn:hover {
    background: var(--ua-hover);
    color: var(--ua-text);
    border-color: var(--ua-line-strong);
}

.ua-btn.is-on {
    background: var(--ua-accent);
    border-color: var(--ua-accent);
    color: #fff;
}

.ua-btn.is-on:hover { background: var(--ua-accent-ink); color: #fff; }

.ua-btn i { font-size: .8rem; opacity: .85; }

.ua-btn--danger { color: var(--ua-down); border-color: var(--ua-line-strong); }
.ua-btn--danger:hover { background: var(--ua-down-wash); color: var(--ua-down); border-color: var(--ua-down); }
.ua-btn--off, .ua-btn--off:hover { opacity: .45; cursor: not-allowed; background: transparent; color: var(--ua-muted); border-color: var(--ua-line-strong); box-shadow: none; }

.ua-btn.disabled, .ua-btn:disabled { opacity: .45; pointer-events: none; }
.ua-btn.w-100 { justify-content: center; }

/* The pager's three controls read as one segmented unit. */
.ua-pager .btn-group .ua-btn { border-radius: 0; margin-left: -1px; }
.ua-pager .btn-group .ua-btn:first-child { border-radius: 9px 0 0 9px; margin-left: 0; }
.ua-pager .btn-group .ua-btn:last-child { border-radius: 0 9px 9px 0; }

.ua-dash .form-control-sm,
.ua-page .form-control-sm {
    height: 34px;
    border-radius: 9px;
    border-color: var(--ua-line-strong);
    font-size: .8125rem;
}

.ua-tabs {
    border-bottom: 0;
    flex-wrap: wrap;
    gap: .25rem;
    margin-top: 1rem;
}

.ua-tabs .nav-link {
    border: 0;
    border-radius: 8px 8px 0 0;
    color: var(--ua-muted);
    padding: .5rem .85rem;
    font-size: .875rem;
    font-weight: 550;
    position: relative;
    transition: color .14s ease, background .14s ease;
}

.ua-tabs .nav-link:hover { color: var(--ua-text); background: var(--ua-hover); }

.ua-tabs .nav-link.active {
    color: var(--ua-accent-ink);
    background: transparent;
}

/* The indicator is a bar under the active tab, drawn on the container's edge. */
.ua-tabs .nav-link.active::after {
    content: "";
    position: absolute;
    left: .5rem;
    right: .5rem;
    bottom: -1px;
    height: 2px;
    border-radius: 2px 2px 0 0;
    background: var(--ua-accent);
}

.ua-grid {
    display: grid;
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

.ua-grid--2 { grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); }
.ua-grid--3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.ua-card--wide { grid-column: 1 / -1; }

.ua-card {
    background: var(--ua-card);
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-lg);
    padding: 1.25rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--ua-shadow);
    overflow: hidden;
}

.ua-card__head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    flex-wrap: wrap;
    margin-bottom: 1rem;
}

/*
 * Section titles are sentence case at a normal weight, not the shouty uppercase tracking that
 * dates a dashboard faster than anything else on it.
 */
.ua-card__title {
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -.01em;
    text-transform: none;
    color: var(--ua-text);
    margin: 0;
}

.ua-muted { color: var(--ua-muted); }

/* The bot-exclusion line. Quiet, but present above every report. */
.ua-notice {
    font-size: .8125rem;
    color: var(--ua-muted);
    margin: -.25rem 0 1.25rem;
}

.ua-notice a { color: var(--ua-accent-ink); text-decoration: none; font-weight: 550; }
.ua-notice a:hover { text-decoration: underline; }

.ua-label {
    font-size: .75rem;
    font-weight: 550;
    color: var(--ua-muted);
}

.ua-empty {
    color: var(--ua-muted);
    font-size: .875rem;
    padding: 2rem 0;
    margin: 0;
    text-align: center;
}

.ua-note {
    color: var(--ua-muted);
    font-size: .8125rem;
    line-height: 1.6;
    margin: 1rem 0 0;
    padding-top: .875rem;
    border-top: 1px solid var(--ua-line);
}

/* --------------------------------------------------------------------- KPI */

.ua-kpis {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
    gap: .875rem;
    margin-bottom: 1.5rem;
}

.ua-kpi {
    background: var(--ua-card);
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    padding: 1rem 1.125rem 2.25rem;
    position: relative;
    min-height: 124px;
    box-shadow: var(--ua-shadow);
    transition: box-shadow .16s ease, transform .16s ease;
}

.ua-kpi:hover { box-shadow: var(--ua-shadow-lift); }

.ua-kpi__label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ua-muted);
    text-transform: none;
    letter-spacing: 0;
    margin-bottom: .375rem;
}

.ua-kpi__value {
    font-size: 1.875rem;
    font-weight: 650;
    line-height: 1.1;
    letter-spacing: -.028em;
    font-variant-numeric: tabular-nums;
    margin-bottom: .5rem;
}

.ua-kpi__foot {
    font-size: .75rem;
    display: flex;
    gap: .4rem;
    align-items: center;
    flex-wrap: wrap;
    color: var(--ua-muted);
    /* One line, always. Wrapping turned "up 24% vs 7,973" into four stacked fragments on a
       narrow tile, which is unreadable and ragged next to its neighbours. */
    flex-wrap: nowrap;
    white-space: nowrap;
    overflow: hidden;
}

/* The change reads as a badge, so up and down are distinguishable before the number is read. */
.ua-delta {
    display: inline-flex;
    align-items: center;
    gap: .15rem;
    font-weight: 600;
    font-size: .75rem;
    padding: .1rem .4rem;
    border-radius: 6px;
    font-variant-numeric: tabular-nums;
}

.ua-delta--up { color: var(--ua-up); background: var(--ua-up-wash); }
.ua-delta--down { color: var(--ua-down); background: var(--ua-down-wash); }
.ua-delta--flat { color: var(--ua-muted); background: var(--ua-bar); }

/*
 * A strip across the foot of the tile rather than a thumbnail tucked in the corner.
 *
 * In the corner it competed with the comparison figure for the same few pixels, and on a
 * narrow tile one of them always lost. Full width it is out of the text's way, and the trend
 * is legible instead of being a squiggle the size of a word.
 */
.ua-spark {
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 30px;
    opacity: .5;
    pointer-events: none;
}

/* ------------------------------------------------------------------ chips */

.ua-chip {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    background: var(--ua-accent-wash);
    border: 1px solid var(--ua-accent-line);
    border-radius: 999px;
    padding: .25rem .5rem .25rem .7rem;
    font-size: .8125rem;
    color: var(--ua-text);
}

.ua-chip strong {
    text-transform: none;
    font-size: .75rem;
    font-weight: 550;
    color: var(--ua-accent-ink);
}

.ua-chip a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 17px;
    height: 17px;
    border-radius: 50%;
    text-decoration: none;
    font-size: .875rem;
    line-height: 1;
    color: var(--ua-accent-ink);
    background: rgba(37, 99, 235, .1);
    transition: background .14s ease, color .14s ease;
}

.ua-chip a:hover { background: var(--ua-down); color: #fff; }

/* ----------------------------------------------------------------- tables */

.ua-table { font-size: .875rem; margin-bottom: 0; }

.ua-table thead th {
    font-weight: 550;
    font-size: .75rem;
    color: var(--ua-muted);
    border-bottom: 1px solid var(--ua-line);
    padding: .5rem .625rem;
    background: transparent;
}

.ua-table tbody td,
.ua-table tbody th {
    border-bottom: 1px solid var(--ua-line);
    border-top: 0;
    padding: .625rem;
    font-weight: 400;
    vertical-align: middle;
}

.ua-table tbody tr:last-child td,
.ua-table tbody tr:last-child th { border-bottom: 0; }

.ua-table tbody tr { transition: background .12s ease; }
.ua-table tbody tr:hover { background: var(--ua-hover); }
.ua-table td { font-variant-numeric: tabular-nums; color: var(--ua-text-soft); }

.ua-table__label {
    position: relative;
    max-width: 400px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--ua-text);
}

.ua-table__label a { text-decoration: none; color: inherit; }
.ua-table__label a:hover { color: var(--ua-accent-ink); }

/* The ranking bar sits behind the label rather than taking a column of its own. */
.ua-bar {
    position: absolute;
    left: 0;
    top: 3px;
    bottom: 3px;
    background: var(--ua-bar);
    border-radius: 5px;
    z-index: 0;
    pointer-events: none;
}

.ua-table__label > a,
.ua-table__label > span:not(.ua-bar) { position: relative; z-index: 1; }

.ua-sort {
    color: inherit;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    gap: .2rem;
}

.ua-sort:hover { color: var(--ua-text); }
.ua-sort.is-active { color: var(--ua-accent-ink); font-weight: 600; }

.ua-pager {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-top: 1rem;
    margin-top: .25rem;
    border-top: 1px solid var(--ua-line);
}

.ua-total th, .ua-total td {
    font-weight: 650;
    color: var(--ua-text);
    border-top: 1px solid var(--ua-line-strong);
}

.ua-row--warn { background: var(--ua-down-wash); }

/*
 * A floor plan that is off the site still sits in the list, because the only way back is from
 * there. It reads as set aside rather than deleted: dimmed, with the date it goes for good
 * printed beside its title.
 */
.ua-row-hidden > td { opacity: .55; }
.ua-row-hidden > td:last-child { opacity: 1; }

/*
 * A filled button that is a link. `.ua-btn.is-on` makes the text white, but the admin's link
 * colour outranked it on an <a>, so the icon was drawn blue on blue and the button looked empty.
 */
.ua-page a.ua-btn.is-on,
.ua-page a.ua-btn.is-on:hover,
.ua-page a.ua-btn.is-on i { color: #fff; }

/* The KPI tiles on the leads inbox are also filters: they look like the plain tiles, but lift. */
a.ua-kpi { display: block; color: inherit; text-decoration: none; }
a.ua-kpi:hover { color: inherit; }
.ua-subtable { font-size: .8125rem; }
.ua-expanded > td { background: var(--ua-hover); padding: .875rem; }
.ua-meta span { display: inline-block; margin-right: .75rem; }
.ua-meta strong { color: var(--ua-muted); font-weight: 550; margin-right: .2rem; }

.ua-folder__toggle {
    background: none;
    border: 0;
    padding: 0;
    color: inherit;
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: .35rem;
}

.ua-folder__toggle span[aria-hidden] { transition: transform .16s ease; display: inline-block; }
.ua-folder__toggle[aria-expanded="true"] span[aria-hidden] { transform: rotate(90deg); }
.ua-folder > * { background: var(--ua-hover); }
.ua-folder__child > * { background: var(--ua-card); }

/* ----------------------------------------------------------------- charts */

.ua-chart { position: relative; height: 310px; }
.ua-chart--short { height: 215px; }
.ua-chart--heatmap { height: 340px; }
.ua-chart--minutes { height: 190px; }
.ua-chart--donut { height: 230px; }
.ua-chart > div { width: 100%; height: 100%; }

.ua-heatmap-table { margin-top: .75rem; }

.ua-heatmap-table summary {
    cursor: pointer;
    font-size: .8125rem;
    color: var(--ua-muted);
    padding: .25rem 0;
    list-style: none;
}

.ua-heatmap-table summary::-webkit-details-marker { display: none; }
.ua-heatmap-table summary::before { content: "▸ "; }
.ua-heatmap-table[open] summary::before { content: "▾ "; }
.ua-heatmap-table summary:hover { color: var(--ua-accent-ink); }
.ua-heatmap-table table { font-size: .75rem; margin-top: .75rem; }

/* ------------------------------------------------------------- right now */

.ua-now { display: flex; align-items: baseline; gap: .6rem; margin-bottom: .75rem; }

/*
 * The live card: the count on the left, the last half hour beside it.
 *
 * Side by side rather than stacked, because the number on its own answers "how many" and the
 * chart on its own answers "and is that normal" -- reading one without the other is what made
 * this tab a wall of figures.
 */
.ua-live-top {
    display: grid;
    grid-template-columns: minmax(150px, 190px) 1fr;
    gap: 1.25rem;
    align-items: center;
}

@media (max-width: 720px) {
    .ua-live-top { grid-template-columns: 1fr; }
}

.ua-live-figures {
    display: flex;
    flex-direction: column;
    gap: 1rem;
    padding-right: 1.25rem;
    border-right: 1px solid var(--ua-line);
}

@media (max-width: 720px) {
    .ua-live-figures {
        flex-direction: row;
        gap: 2rem;
        padding: 0 0 1rem;
        border-right: 0;
        border-bottom: 1px solid var(--ua-line);
    }
}

.ua-live-figure { display: flex; flex-direction: column; gap: .15rem; }

.ua-live-figure__value {
    font-size: 2.75rem;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
    color: var(--ua-text);
}

.ua-live-figure--sub .ua-live-figure__value { font-size: 1.5rem; color: var(--ua-text-soft); }

.ua-live-figure__label {
    font-size: .75rem;
    color: var(--ua-muted);
    letter-spacing: .01em;
}


.ua-now__figure {
    font-size: 2.5rem;
    font-weight: 650;
    line-height: 1;
    letter-spacing: -.03em;
    font-variant-numeric: tabular-nums;
}

.ua-now__list { list-style: none; padding: 0; margin: 0; font-size: .8125rem; }

.ua-now__list li {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: .5rem 0;
    border-bottom: 1px solid var(--ua-line);
    color: var(--ua-text-soft);
}

.ua-now__list li:last-child { border-bottom: 0; }

/*
 * A bar behind each row, scaled to the busiest page. Same trick as the tables: it costs a
 * pseudo-element and turns ten numbers into a shape you can read at a glance.
 */
.ua-now__list li { position: relative; }

.ua-now__list li::before {
    content: "";
    position: absolute;
    inset: 2px auto 2px 0;
    width: var(--ua-fill, 0%);
    border-radius: 4px;
    background: var(--ua-bar);
    z-index: 0;
}

.ua-now__list li > * { position: relative; z-index: 1; }

.ua-now__list li span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ua-now__list li strong { color: var(--ua-text); font-variant-numeric: tabular-nums; }

.ua-live {
    display: inline-block;
    vertical-align: middle;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--ua-up);
    box-shadow: 0 0 0 3px var(--ua-up-wash);
    animation: ua-pulse 2s ease-in-out infinite;
}

@keyframes ua-pulse {
    0%, 100% { opacity: 1; }
    50% { opacity: .3; }
}

@media (prefers-reduced-motion: reduce) {
    .ua-live { animation: none; }
    .ua-kpi, .ua-table tbody tr, .ua-btn, .ua-seg a { transition: none; }
}

.ua-pill {
    font-size: .6875rem;
    font-weight: 550;
    letter-spacing: .01em;
    padding: .15rem .45rem;
    border-radius: 6px;
    background: var(--ua-bar);
    color: var(--ua-text-soft);
}

.ua-pill--conversion { background: var(--ua-up-wash); color: var(--ua-up); }

/* -------------------------------------------------------------- anomalies */

.ua-anomalies {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: .875rem;
    margin-bottom: 1.5rem;
}

.ua-anomaly {
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    padding: .875rem 1rem;
    background: var(--ua-card);
    font-size: .875rem;
    box-shadow: var(--ua-shadow);
    position: relative;
    padding-left: 1.125rem;
}

/* A soft rail rather than a heavy 3px border, which reads as an alert. */
.ua-anomaly::before {
    content: "";
    position: absolute;
    left: 0;
    top: .875rem;
    bottom: .875rem;
    width: 3px;
    border-radius: 0 3px 3px 0;
}

.ua-anomaly--up::before { background: var(--ua-up); }
.ua-anomaly--down::before { background: var(--ua-down); }
.ua-anomaly__title { font-weight: 600; margin-bottom: .15rem; }
.ua-anomaly__detail { color: var(--ua-muted); font-size: .8125rem; line-height: 1.5; }

.ua-anomaly__link {
    font-size: .8125rem;
    font-weight: 550;
    color: var(--ua-accent-ink);
    text-decoration: none;
    display: inline-block;
    margin-top: .375rem;
}

.ua-anomaly__link:hover { text-decoration: underline; }

/* ----------------------------------------------------------------- splits */

.ua-split__bar {
    display: flex;
    height: 10px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: .875rem;
    gap: 2px;
}

.ua-split__new { background: var(--ua-accent); border-radius: 999px 0 0 999px; }
.ua-split__returning { background: var(--ua-up); border-radius: 0 999px 999px 0; }

.ua-legend { list-style: none; padding: 0; margin: 0; font-size: .8125rem; color: var(--ua-text-soft); }
.ua-legend li { padding: .25rem 0; }
.ua-legend--wide { columns: 2; }

.ua-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: .45rem; }
.ua-dot--new, .ua-dot--direct { background: var(--ua-accent); }
.ua-dot--returning, .ua-dot--search { background: var(--ua-up); }
.ua-dot--social { background: #8b5cf6; }
.ua-dot--referral { background: #f59e0b; }
.ua-dot--campaign { background: #ec4899; }

.ua-sourcebar {
    display: flex;
    height: 14px;
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: 1rem;
    gap: 2px;
}

.ua-sourcebar__seg { display: block; height: 100%; transition: opacity .14s ease; }
.ua-sourcebar__seg:hover { opacity: .75; }
.ua-sourcebar__seg--direct { background: var(--ua-accent); }
.ua-sourcebar__seg--search { background: var(--ua-up); }
.ua-sourcebar__seg--social { background: #8b5cf6; }
.ua-sourcebar__seg--referral { background: #f59e0b; }
.ua-sourcebar__seg--campaign { background: #ec4899; }

/* -------------------------------------------------------------------- map */

.ua-map svg { width: 100%; height: auto; display: block; }
.ua-map__country { fill: var(--ua-bar); stroke: var(--ua-card); stroke-width: .3; transition: fill .14s ease; }
.ua-map__country.is-active { cursor: pointer; }
.ua-map__country.is-active:hover { stroke: var(--ua-text); stroke-width: .6; }

/* ----------------------------------------------------------------- funnel */

.ua-funnel { margin-top: 1.25rem; }
.ua-funnel__row { margin-bottom: 1.125rem; }

.ua-funnel__label {
    display: flex;
    justify-content: space-between;
    font-size: .875rem;
    margin-bottom: .375rem;
    gap: 1rem;
}

.ua-funnel__track {
    position: relative;
    background: var(--ua-bar);
    border-radius: 9px;
    height: 34px;
    overflow: hidden;
}

.ua-funnel__fill {
    background: linear-gradient(90deg, var(--ua-accent), var(--ua-accent-ink));
    height: 100%;
    border-radius: 9px;
    transition: width .4s cubic-bezier(.16, 1, .3, 1);
}

.ua-funnel__pct {
    position: absolute;
    right: .625rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .8125rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
}

.ua-funnel__drop { font-size: .8125rem; color: var(--ua-muted); margin-top: .375rem; }

.ua-funnel-steps { display: grid; grid-template-columns: repeat(auto-fit, minmax(270px, 1fr)); gap: .625rem; }
.ua-funnel-step { display: flex; align-items: center; gap: .45rem; }

.ua-funnel-step__n {
    width: 24px;
    height: 24px;
    flex: 0 0 24px;
    border-radius: 50%;
    background: var(--ua-accent-wash);
    color: var(--ua-accent-ink);
    display: grid;
    place-items: center;
    font-size: .75rem;
    font-weight: 650;
}

.ua-dash .form-select-sm,
.ua-page .form-select-sm { height: 34px; border-radius: 9px; border-color: var(--ua-line-strong); font-size: .8125rem; }

/* ---------------------------------------------------------------- settings */

.ua-fields { display: grid; gap: 1rem; }

.ua-switch {
    display: flex;
    gap: .75rem;
    align-items: flex-start;
    cursor: pointer;
    padding: .875rem 1rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-card);
    transition: border-color .14s ease, background .14s ease;
}

.ua-switch:hover { border-color: var(--ua-accent-line); background: var(--ua-hover); }
.ua-switch input { margin-top: .2rem; flex: 0 0 auto; width: 16px; height: 16px; }
.ua-switch span { display: block; }
.ua-switch strong { font-weight: 600; font-size: .9375rem; }

.ua-switch em {
    display: block;
    font-style: normal;
    font-size: .8125rem;
    color: var(--ua-muted);
    line-height: 1.6;
    margin-top: .25rem;
}

.ua-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .8125rem; }

.ua-health { list-style: none; padding: 0; margin: 0; font-size: .875rem; }

.ua-health li {
    padding: .625rem 0;
    border-bottom: 1px solid var(--ua-line);
    display: flex;
    gap: .5rem;
    flex-wrap: wrap;
    align-items: baseline;
}

.ua-health li:last-child { border-bottom: 0; }
.ua-health li > span:first-child { min-width: 190px; color: var(--ua-muted); }

.ua-code {
    background: var(--ua-hover);
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    padding: 1rem;
    font-size: .8125rem;
    line-height: 1.6;
    overflow-x: auto;
}

.ua-dash code,
.ua-page code {
    background: var(--ua-bar);
    color: var(--ua-accent-ink);
    padding: .1rem .3rem;
    border-radius: 5px;
    font-size: .85em;
}

.ua-code code { background: none; color: inherit; padding: 0; }

/* ----------------------------------------------------------------- footer */

.ua-footer {
    margin-top: 2rem;
    padding-top: 1.25rem;
    border-top: 1px solid var(--ua-line);
    color: var(--ua-muted);
    font-size: .8125rem;
    line-height: 1.8;
}

.ua-footer strong { color: var(--ua-text-soft); font-weight: 600; }

/* ------------------------------------------------------------------ small */

@media (max-width: 991px) {
    .ua-sticky { position: static; }
    .ua-kpis { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
    .ua-kpi__value { font-size: 1.625rem; }
    .ua-legend--wide { columns: 1; }
    .ua-table__label { max-width: 220px; }
    .ua-grid--2 { grid-template-columns: 1fr; }
}

/* --------------------------------------------------------- the rest of the admin */

/*
 * A KPI tile that is also a link.
 *
 * The whole tile is the target, so the label is not a separate small thing to aim at, and it
 * must not pick up the link colour -- a blue figure would read as selected.
 */
a.ua-kpi { display: block; color: inherit; text-decoration: none; }
a.ua-kpi:hover { border-color: var(--ua-accent-line); }

/* Nothing is pinned to the bottom of these ones, so there is no strip to leave room for. */
.ua-kpi--plain { padding-bottom: 1.125rem; min-height: 0; }

/* Who is in the admin right now. */
.ua-presence { display: flex; flex-wrap: wrap; gap: .5rem; }

.ua-presence__person {
    display: flex;
    align-items: center;
    gap: .5rem;
    min-width: 190px;
    padding: .45rem .7rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-sm);
    background: var(--ua-hover);
}

.ua-presence__dot { width: 8px; height: 8px; min-width: 8px; border-radius: 50%; }
.ua-presence__who { min-width: 0; }

.ua-presence__name {
    font-size: .8125rem;
    font-weight: 550;
    color: var(--ua-text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.ua-presence__where {
    font-size: .7rem;
    color: var(--ua-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/*
 * A filter bar: the controls that narrow a list, grouped so they read as one instrument rather
 * than as a row of unrelated inputs.
 */
.ua-filters {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
    gap: .75rem;
    align-items: end;
    padding: .875rem 1rem;
    background: var(--ua-hover);
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    margin-bottom: 1rem;
}

.ua-filters label {
    display: block;
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
    margin-bottom: .25rem;
}

.ua-filters__actions { display: flex; gap: .5rem; }

/* A row that has not been read yet, marked on its leading edge rather than by shading the
   whole row -- shading fights with the hover state and with every badge in the row. */
.ua-table tr.ua-row--unread td:first-child { box-shadow: inset 3px 0 0 var(--ua-accent); }
.ua-table tr.ua-row--unread .ua-table__label { font-weight: 600; }

/* Severity, as a quiet tinted pill rather than a saturated Bootstrap badge. */
.ua-tag {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    font-size: .6875rem;
    font-weight: 550;
    padding: .18rem .5rem;
    border-radius: 999px;
    background: var(--ua-bar);
    color: var(--ua-text-soft);
    white-space: nowrap;
}

.ua-tag--info { background: var(--ua-accent-wash); color: var(--ua-accent-ink); }
.ua-tag--success { background: var(--ua-up-wash); color: var(--ua-up); }
.ua-tag--warning { background: #fff7ed; color: #b45309; }
.ua-tag--critical { background: var(--ua-down-wash); color: var(--ua-down); }

@media (prefers-color-scheme: dark) {
    .ua-tag--warning { background: #2a1f10; color: #fbbf24; }
}

/* The round icon beside a notification. */
.ua-avatar {
    width: 34px;
    height: 34px;
    min-width: 34px;
    border-radius: 50%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: .8125rem;
    background: var(--ua-bar);
    color: var(--ua-text-soft);
}

.ua-avatar--info { background: var(--ua-accent-wash); color: var(--ua-accent-ink); }
.ua-avatar--success { background: var(--ua-up-wash); color: var(--ua-up); }
.ua-avatar--warning { background: #fff7ed; color: #b45309; }
.ua-avatar--critical { background: var(--ua-down-wash); color: var(--ua-down); }

@media (prefers-color-scheme: dark) {
    .ua-avatar--warning { background: #2a1f10; color: #fbbf24; }
}

/* A count beside a segment label needs air, or "Unread31" reads as one word. */
.ua-seg a .ua-muted { margin-left: .35rem; font-variant-numeric: tabular-nums; }
.ua-seg a.is-active .ua-muted { color: inherit; opacity: .6; }

/* --------------------------------------------------------------------- forms */

/*
 * Bootstrap's form controls, brought into line with everything else.
 *
 * Only inside .ua-page, so a screen that has not been converted yet keeps exactly the controls
 * it has always had rather than getting half of a redesign.
 */
/*
 * A field label.
 *
 * The small-caps treatment is for the kit's own form grid, where every label gets it and they
 * line up as a column of quiet headings. Applied to any .form-label it looked wrong on the
 * unconverted forms, where some labels carry the class and some do not -- half a form in small
 * caps and half in sentence case reads as a mistake. Those get the gentler version.
 */
.ua-page .form-label {
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ua-text-soft);
    margin-bottom: .3rem;
}

.ua-form-grid .form-label,
.ua-filters label,
.ua-page .ua-form-grid .form-label {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
}

.ua-page .form-control,
.ua-page .form-select,
.ua-page textarea.form-control {
    border-radius: 9px;
    border-color: var(--ua-line-strong);
    color: var(--ua-text);
    background-color: var(--ua-card);
    font-size: .875rem;
    padding: .45rem .7rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}

/* The red "*" of a required field is a 12px span inside an 11px label: two baselines made the label 25px tall
   instead of 18, and that field's box sat 4-7px lower than its neighbours' (Latitude beside Location). */
.ua-page .form-label .text-danger,
.ua-page .form-label .required,
.ua-page label .text-danger {
    line-height: 1;
}

/* One height for a one-line box, input or select: a select came out 2px shorter than the input beside it. */
.ua-page .form-control:not(textarea):not(.form-control-sm):not([type=file]),
.ua-page .form-select:not([multiple]):not([size]):not(.form-select-sm) {
    min-height: 38px;
}

.ua-page .form-control:focus,
.ua-page .form-select:focus {
    border-color: var(--ua-accent);
    box-shadow: 0 0 0 3px var(--ua-accent-wash);
}

.ua-page .form-control::placeholder { color: var(--ua-muted); }
.ua-page .form-control[readonly], .ua-page .form-control:disabled { background: var(--ua-hover); }

.ua-page .input-group-text {
    border-radius: 9px 0 0 9px;
    border-color: var(--ua-line-strong);
    background: var(--ua-hover);
    color: var(--ua-muted);
    font-size: .8125rem;
}

.ua-page .form-check-input:checked {
    background-color: var(--ua-accent);
    border-color: var(--ua-accent);
}

.ua-page .form-check-input:focus {
    border-color: var(--ua-accent);
    box-shadow: 0 0 0 3px var(--ua-accent-wash);
}

.ua-page .is-invalid,
.ua-page .form-control.is-invalid,
.ua-page .form-select.is-invalid { border-color: var(--ua-down); }

.ua-page .invalid-feedback, .ua-page .text-danger { color: var(--ua-down) !important; }

/* A required field says so once, quietly, rather than with a red star nobody has a key for. */
.ua-page .form-label .ua-required { color: var(--ua-down); margin-left: .15rem; }

/*
 * A form laid out in columns that collapse on a narrow screen. Two fields per row by default;
 * .ua-field--wide takes the whole width for the things that need it, like an address.
 */
.ua-form-grid {
    display: grid;
    /* min() so a column never insists on 240px inside a card narrower than that -- a fixed
       minimum in minmax() is what makes a grid overflow its own card on a small screen. */
    grid-template-columns: repeat(auto-fit, minmax(min(240px, 100%), 1fr));
    gap: 1rem 1.25rem;
}

.ua-field--wide { grid-column: 1 / -1; }

/* The bar of actions at the end of a form. */
.ua-card__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem;
    margin-top: 1.25rem;
    padding-top: 1rem;
    border-top: 1px solid var(--ua-line);
}

.ua-card__foot .ua-spacer { margin-left: auto; }

/* A heading inside a card, for a form long enough to need sections. */
.ua-fieldset { margin-bottom: 1.5rem; }
.ua-fieldset:last-child { margin-bottom: 0; }

.ua-fieldset__title {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ua-text);
    margin-bottom: .2rem;
}

.ua-fieldset__hint { font-size: .75rem; color: var(--ua-muted); margin-bottom: .875rem; }

/* ------------------------------------------------------------------- details */

/*
 * A read-only record: labels and their values, in two columns that stack when there is no room.
 */
.ua-detail { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 1rem 1.5rem; }
.ua-detail--single { grid-template-columns: 1fr; }

.ua-detail__label {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
    margin-bottom: .15rem;
}

.ua-detail__value { font-size: .875rem; color: var(--ua-text); word-break: break-word; }
.ua-detail__value a { color: var(--ua-accent-ink); text-decoration: none; }
.ua-detail__value a:hover { text-decoration: underline; }

/* The identity block at the top of a person's page. */
.ua-identity { display: flex; align-items: center; gap: 1rem; flex-wrap: wrap; }

.ua-identity__photo {
    width: 72px;
    height: 72px;
    min-width: 72px;
    border-radius: 50%;
    object-fit: cover;
    border: 2px solid var(--ua-card);
    box-shadow: var(--ua-shadow-lift);
    background: var(--ua-bar);
}

.ua-identity__name { font-size: 1.25rem; font-weight: 650; letter-spacing: -.02em; line-height: 1.2; }
.ua-identity__meta { font-size: .8125rem; color: var(--ua-muted); }

/* ------------------------------------------------------------------- choices */

/*
 * A checkbox with a name and an explanation, as one target.
 *
 * Roles and permissions were bare checkboxes in nested cards; what a role actually granted was
 * either three cards deep or not written down at all. The whole row is the label, so the click
 * target is the size of the thing being described.
 */
.ua-choice {
    display: flex;
    align-items: flex-start;
    gap: .625rem;
    padding: .625rem .75rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-sm);
    margin-bottom: .5rem;
    cursor: pointer;
    transition: border-color .12s ease, background .12s ease;
}

.ua-choice:hover { border-color: var(--ua-line-strong); background: var(--ua-hover); }
.ua-choice:has(input:checked) { border-color: var(--ua-accent-line); background: var(--ua-accent-wash); }
.ua-choice:last-child { margin-bottom: 0; }

.ua-choice__name { display: block; font-size: .8125rem; font-weight: 550; color: var(--ua-text); }

.ua-choice__hint {
    display: block;
    font-size: .6875rem;
    color: var(--ua-muted);
    line-height: 1.4;
    margin-top: .1rem;
    /* Two lines of permissions, then it stops. The full list is in the role's own page. */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ua-choice--tight { padding: .4rem .6rem; align-items: center; margin-bottom: .375rem; }

.ua-choice-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: .375rem .5rem;
    max-height: 420px;
    overflow-y: auto;
}

.ua-choice-grid .ua-choice { margin-bottom: 0; }

/*
 * Shared components that other, unconverted screens still use keep their Bootstrap classes --
 * restyling them would reach pages that have not been converted. They are brought into line
 * here instead, where the tokens exist.
 */
.ua-page .bulk-delete {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    height: 36px;
    padding: 0 .75rem;
    border-radius: 9px;
    border: 1px solid var(--ua-line-strong);
    background: var(--ua-card);
    color: var(--ua-down);
    font-size: .8125rem;
    font-weight: 500;
}

.ua-page .bulk-delete:hover { background: var(--ua-down-wash); border-color: var(--ua-down); color: var(--ua-down); }

/*
 * Laravel's Bootstrap paginator, brought into line.
 *
 * It arrives as .pagination markup from the framework, so it cannot be restyled at the source
 * without touching every screen at once -- including the ones still on Bootstrap.
 */
.ua-pager { flex-wrap: wrap; gap: .5rem; }
.ua-pager .pagination { margin-bottom: 0; gap: .25rem; }

.ua-pager .page-link {
    border: 1px solid var(--ua-line);
    border-radius: 8px;
    color: var(--ua-text-soft);
    background: var(--ua-card);
    font-size: .8125rem;
    padding: .3rem .6rem;
    box-shadow: none;
}

.ua-pager .page-link:hover { background: var(--ua-hover); color: var(--ua-text); border-color: var(--ua-line-strong); }
.ua-pager .page-item.active .page-link { background: var(--ua-accent); border-color: var(--ua-accent); color: #fff; }
.ua-pager .page-item.disabled .page-link { color: var(--ua-muted); background: var(--ua-card); opacity: .55; }
.ua-pager .pagination svg { width: 14px; height: 14px; }

/* The framework's paginator also prints a sentence about which rows these are; it duplicates
   the count already beside the search box. */
.ua-pager .pagination-info, .ua-pager p.small { color: var(--ua-muted); margin-bottom: 0; }

/*
 * Select2, where a converted screen uses it.
 *
 * It renders its own markup at the end of the body, so the dropdown itself cannot be scoped to
 * .ua-page -- only the closed control can. The result is a control that matches the inputs
 * beside it, which is the part that is looked at.
 */
.ua-page .select2-container--default .select2-selection--single,
.ua-page .select2-container--default .select2-selection--multiple {
    border-radius: 9px;
    border-color: var(--ua-line-strong);
    background: var(--ua-card);
    min-height: 38px;
    padding: .15rem .25rem;
}

/*
 * A chosen item.
 *
 * Select2 4.1 puts the remove button in the corner of the chip absolutely, and relies on the
 * chip's own left padding to keep the label clear of it. Setting padding as a shorthand wiped
 * that out and the x sat on top of the first letter -- so the padding is asymmetric on purpose.
 */
.ua-page .select2-container--default .select2-selection--multiple .select2-selection__choice {
    display: inline-flex;
    align-items: center;
    background: var(--ua-accent-wash);
    border: 1px solid var(--ua-accent-line);
    border-radius: 6px;
    color: var(--ua-accent-ink);
    font-size: .75rem;
    line-height: 1.5;
    padding: .1rem .45rem .1rem 1.4rem;
    margin: .15rem .25rem .15rem 0;
    position: relative;
}

.ua-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 1.15rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 0;
    border-right: 1px solid var(--ua-accent-line);
    border-radius: 5px 0 0 5px;
    background: transparent;
    color: var(--ua-accent-ink);
    font-size: .8125rem;
    padding: 0;
    margin: 0;
}

.ua-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:hover,
.ua-page .select2-container--default .select2-selection--multiple .select2-selection__choice__remove:focus {
    background: var(--ua-down-wash);
    color: var(--ua-down);
    border-right-color: var(--ua-down);
}

.ua-page .select2-container--default .select2-selection--multiple .select2-selection__rendered {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    padding: .15rem .3rem;
    margin: 0;
}

.ua-page .select2-container--default .select2-search--inline .select2-search__field {
    margin-top: .2rem;
    font-size: .8125rem;
    color: var(--ua-text);
}

.ua-page .select2-container--default .select2-selection--single .select2-selection__rendered {
    color: var(--ua-text);
    line-height: 34px;
    font-size: .875rem;
}

.ua-page .select2-container--default .select2-selection--single .select2-selection__arrow { height: 36px; }

/* A code span in a note: a path or a setting value, not decoration. */
.ua-page code {
    background: var(--ua-bar);
    border-radius: 5px;
    padding: .1rem .35rem;
    font-size: .8125rem;
    color: var(--ua-accent-ink);
}

/*
 * A radio that looks like a button.
 *
 * Bootstrap's .btn-check needs a sibling .btn to toggle against, so these keep the .btn class
 * and are restyled rather than replaced -- .ua-btn has no checked state to hook into.
 */
.ua-page .ua-choice-btn {
    border: 1px solid var(--ua-line-strong);
    border-radius: 9px;
    background: var(--ua-card);
    color: var(--ua-text-soft);
    font-size: .8125rem;
    padding: .4rem .8rem;
}

.ua-page .ua-choice-btn:hover { background: var(--ua-hover); color: var(--ua-text); }

.ua-page .btn-check:checked + .ua-choice-btn {
    background: var(--ua-accent);
    border-color: var(--ua-accent);
    color: #fff;
}

/* -------------------------------------------------------------------- colour */

/*
 * A colour setting: the swatch is the control, and it is the size of the decision.
 *
 * These were native colour inputs the size of a text field with their internal key printed in
 * the label and a paragraph of explanation underneath, so the one thing you scan for -- what
 * the colour currently is -- was the smallest mark on the row.
 */
.ua-color {
    display: flex;
    gap: .875rem;
    align-items: flex-start;
    padding: .875rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-card);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.ua-color:hover { border-color: var(--ua-line-strong); box-shadow: var(--ua-shadow); }
.ua-color.is-invalid { border-color: var(--ua-down); }

.ua-color__swatch {
    position: relative;
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 12px;
    cursor: pointer;
    overflow: hidden;
    /* An inset line rather than a border, so a white swatch still has an edge and a dark one
       is not outlined in grey. */
    box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .12), var(--ua-shadow);
}

.ua-color__swatch:hover { box-shadow: inset 0 0 0 1px rgba(15, 23, 42, .2), var(--ua-shadow-lift); }

/* The native picker fills the swatch and is invisible: the swatch is the target. */
.ua-color__picker {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    border: 0;
    padding: 0;
    cursor: pointer;
}

.ua-color__body { min-width: 0; flex: 1; }

.ua-color__name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ua-text);
    margin-bottom: .35rem;
}

.ua-color__hex {
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    text-transform: lowercase;
    max-width: 8.5rem;
}

.ua-color__key {
    display: inline-block;
    margin-top: .35rem;
    font-size: .6875rem;
    background: var(--ua-bar);
    color: var(--ua-muted);
    border-radius: 5px;
    padding: .05rem .3rem;
}

/*
 * What the colour is for.
 *
 * Some of these notes list eight places on the public site, which is genuinely useful and
 * genuinely long. Two lines by default, all of it on hover, so the cards stay the same height
 * as each other.
 */
.ua-color__note {
    font-size: .6875rem;
    line-height: 1.45;
    color: var(--ua-muted);
    margin: .35rem 0 0;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.ua-color:hover .ua-color__note { -webkit-line-clamp: 12; }

@media (prefers-color-scheme: dark) {
    .ua-color__swatch { box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .16), var(--ua-shadow); }
}

/*
 * A permission name is one long word with underscores in it, and it will not break on its own.
 *
 * view_neighbourhoods_categories is 30 characters; in a 180px column it ran out past the chip's
 * own edge and sat on top of the checkbox next to it.
 */
.ua-choice__name { overflow-wrap: anywhere; word-break: break-word; }
.ua-choice--tight { align-items: flex-start; }
.ua-choice--tight .form-check-input { margin-top: .15rem; }
.ua-choice-grid { grid-template-columns: repeat(auto-fill, minmax(215px, 1fr)); }

/* ==========================================================================
   The compatibility layer.

   Everything above this line is the design system's own vocabulary: .ua-card, .ua-btn,
   .ua-table. A converted screen uses it directly.

   This section is for the screens that have not been converted. They are built from Bootstrap
   and CoreUI classes -- .card, .table, .btn-primary -- and there are a hundred and twenty of
   them. Rewriting each one is a hundred and twenty chances to drop a field or break a form.
   Mapping their classes onto the same surfaces, type scale and spacing is one stylesheet, it
   cannot break a page, and it reaches all of them at once.

   Everything here is scoped to .ua-page, which the admin layout puts on its content container,
   so none of it escapes into the public site.
   ========================================================================== */

/* ----------------------------------------------------------- cards and panels */

.ua-page .card {
    background: var(--ua-card);
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-lg);
    box-shadow: var(--ua-shadow);
    margin-bottom: 1.25rem;
}

/* A card nested inside a card -- common in these forms -- should read as a section, not as a
   second panel floating on the first. */
.ua-page .card .card {
    box-shadow: none;
    border-radius: var(--ua-r);
    background: var(--ua-hover);
}

.ua-page .card-header {
    background: transparent;
    border-bottom: 1px solid var(--ua-line);
    padding: 1rem 1.25rem;
    font-size: .9375rem;
    font-weight: 600;
    color: var(--ua-text);
    border-radius: var(--ua-r-lg) var(--ua-r-lg) 0 0;
}

.ua-page .card-body { padding: 1.25rem; }

.ua-page .card-footer {
    background: transparent;
    border-top: 1px solid var(--ua-line);
    padding: .875rem 1.25rem;
    color: var(--ua-muted);
    font-size: .8125rem;
}

/* An empty footer is a rule and twenty pixels of nothing, and several of these pages have one. */
.ua-page .card-footer:empty { display: none; }

/* CoreUI's accent stripe, in the kit's accent rather than Bootstrap's. */
.ua-page .card-accent-primary,
.ua-page .card-accent-info { border-top: 3px solid var(--ua-accent); }
.ua-page .card-accent-success { border-top: 3px solid var(--ua-up); }
.ua-page .card-accent-danger { border-top: 3px solid var(--ua-down); }

/* ------------------------------------------------------------------- headings */

.ua-page .card-title {
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: -.01em;
    color: var(--ua-text);
}

.ua-page .card-title small { font-weight: 400; color: var(--ua-muted); font-size: .8125rem; }

/* The rule the old section header prints under itself. */
.ua-page hr { border-color: var(--ua-line); opacity: 1; margin: 1rem 0; }

/* -------------------------------------------------------------------- tables */

/*
 * Bootstrap tables on the kit rhythm.
 *
 * .ua-table is the converted version and is left alone; this is the same treatment applied to
 * a plain .table, so the two read alike when they sit a click apart.
 */
.ua-page .table:not(.ua-table) {
    font-size: .875rem;
    color: var(--ua-text-soft);
    border-color: var(--ua-line);
    margin-bottom: 0;
}

.ua-page .table:not(.ua-table) > thead > tr > th {
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
    background: transparent;
    border-bottom: 1px solid var(--ua-line-strong);
    padding: .625rem .75rem;
    white-space: nowrap;
}

.ua-page .table:not(.ua-table) > tbody > tr > td,
.ua-page .table:not(.ua-table) > tbody > tr > th {
    border-bottom: 1px solid var(--ua-line);
    padding: .625rem .75rem;
    vertical-align: middle;
}

.ua-page .table:not(.ua-table) > tbody > tr:last-child > td { border-bottom: 0; }

.ua-page .table-hover > tbody > tr:hover > * {
    background: var(--ua-hover);
    --cui-table-accent-bg: transparent;
}

.ua-page .table-striped > tbody > tr:nth-of-type(odd) > * {
    --cui-table-accent-bg: transparent;
    background: transparent;
}

.ua-page .table td a { color: var(--ua-accent-ink); text-decoration: none; }
.ua-page .table td a:hover { text-decoration: underline; }

/* A cell holding a thumbnail should not be dragged taller by it. */
.ua-page .table img { border-radius: 8px; object-fit: cover; }

/* ------------------------------------------------------------------- buttons */

/*
 * Bootstrap buttons, brought to the kit shape.
 *
 * A shape and size change rather than a colour one: these pages use btn-success for "create"
 * and btn-info for "show", and repainting them all one colour would take away the only signal
 * their action columns have.
 */
.ua-page .btn {
    border-radius: 9px;
    font-size: .8125rem;
    font-weight: 500;
    padding: .45rem .8rem;
    box-shadow: none;
    transition: filter .12s ease, box-shadow .12s ease;
}

.ua-page .btn-sm { border-radius: 8px; padding: .3rem .55rem; font-size: .75rem; }
.ua-page .btn:hover { filter: brightness(.95); }
.ua-page .btn:focus, .ua-page .btn:active { box-shadow: 0 0 0 3px var(--ua-accent-wash) !important; }

.ua-page .btn-primary { background: var(--ua-accent); border-color: var(--ua-accent); }
.ua-page .btn-primary:hover { background: var(--ua-accent-ink); border-color: var(--ua-accent-ink); }

/*
 * The outline variants were hard boxes in six different colours. They become one quiet control
 * with coloured text, which is what an icon button in a table wants to be.
 */
.ua-page .btn-outline-primary,
.ua-page .btn-outline-secondary,
.ua-page .btn-outline-success,
.ua-page .btn-outline-info,
.ua-page .btn-outline-dark {
    border-color: var(--ua-line-strong);
    background: var(--ua-card);
    color: var(--ua-text-soft);
}

.ua-page .btn-outline-primary:hover,
.ua-page .btn-outline-secondary:hover,
.ua-page .btn-outline-success:hover,
.ua-page .btn-outline-info:hover,
.ua-page .btn-outline-dark:hover {
    background: var(--ua-hover);
    border-color: var(--ua-line-strong);
    color: var(--ua-text);
}

.ua-page .btn-outline-danger {
    border-color: var(--ua-line-strong);
    background: var(--ua-card);
    color: var(--ua-down);
}

.ua-page .btn-outline-danger:hover {
    background: var(--ua-down-wash);
    border-color: var(--ua-down);
    color: var(--ua-down);
}

/* --------------------------------------------------------------------- tags */

.ua-page .badge {
    font-size: .6875rem;
    font-weight: 550;
    border-radius: 999px;
    padding: .25rem .5rem;
}

/* -------------------------------------------------------------------- alerts */

.ua-page .alert {
    border-radius: var(--ua-r);
    border: 1px solid var(--ua-line);
    font-size: .875rem;
    padding: .875rem 1rem;
}

.ua-page .alert-info { background: var(--ua-accent-wash); border-color: var(--ua-accent-line); color: var(--ua-accent-ink); }
.ua-page .alert-success { background: var(--ua-up-wash); border-color: var(--ua-up); color: var(--ua-up); }
.ua-page .alert-danger { background: var(--ua-down-wash); border-color: var(--ua-down); color: var(--ua-down); }

/* ---------------------------------------------------------------------- tabs */

.ua-page .nav-tabs { border-bottom: 1px solid var(--ua-line); gap: .125rem; }

.ua-page .nav-tabs .nav-link {
    border: 0;
    border-radius: 9px 9px 0 0;
    color: var(--ua-muted);
    font-size: .875rem;
    font-weight: 500;
    padding: .55rem .9rem;
}

.ua-page .nav-tabs .nav-link:hover { background: var(--ua-hover); color: var(--ua-text); }

.ua-page .nav-tabs .nav-link.active {
    background: transparent;
    color: var(--ua-accent-ink);
    box-shadow: inset 0 -2px 0 var(--ua-accent);
}

/* ------------------------------------------------------------------- modals */

.ua-page .modal-content,
.modal-content.ua-page {
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-lg);
    box-shadow: 0 20px 48px rgba(15, 23, 42, .18);
}

.ua-page .modal-header,
.modal-content.ua-page .modal-header { border-bottom-color: var(--ua-line); }

.ua-page .modal-footer,
.modal-content.ua-page .modal-footer { border-top-color: var(--ua-line); }

/* ------------------------------------------------------------- the paginator */

/* These pages print their paginator in a bare row rather than in a .ua-pager. */
.ua-page .pagination { margin-bottom: 0; gap: .25rem; }

.ua-page .page-link {
    border: 1px solid var(--ua-line);
    border-radius: 8px;
    color: var(--ua-text-soft);
    background: var(--ua-card);
    font-size: .8125rem;
    padding: .3rem .6rem;
    box-shadow: none;
}

.ua-page .page-link:hover { background: var(--ua-hover); color: var(--ua-text); border-color: var(--ua-line-strong); }
.ua-page .page-item.active .page-link { background: var(--ua-accent); border-color: var(--ua-accent); color: #fff; }
.ua-page .page-item.disabled .page-link { color: var(--ua-muted); opacity: .55; }

/* --------------------------------------------------------------- odds and ends */

.ua-page .text-muted { color: var(--ua-muted) !important; }
.ua-page .form-text { color: var(--ua-muted); font-size: .75rem; }
.ua-page .bg-light { background: var(--ua-hover) !important; }
.ua-page .border { border-color: var(--ua-line) !important; }

/* Several of these pages set a tall min-height on their outer card so a short list does not
   leave a stub of a page. With the new spacing it just leaves a tall empty card. */
.ua-page .body-content { min-height: 0 !important; }

/* ------------------------------------------------- action buttons in a table */

/*
 * The buttons in a row's action column.
 *
 * They arrive as solid btn-success, btn-primary and btn-danger, so twenty rows of three
 * buttons is sixty saturated rectangles, all shouting at the same volume as each other and
 * louder than the data they belong to. In a table the row is the subject and the buttons are
 * the verb: one quiet control, with colour kept for the one that cannot be undone.
 *
 * Only inside a cell. The coloured buttons at the top of the page -- create, export, bulk
 * edit -- are page-level actions and keep their colour.
 */
.ua-page td > .btn,
.ua-page td > form > .btn,
.ua-page td > a.btn,
.ua-page td > button.btn,
.ua-page td .btn-group > .btn {
    background: var(--ua-card);
    border: 1px solid var(--ua-line-strong);
    color: var(--ua-text-soft);
    margin: 0 .1rem .1rem 0;
    padding: .3rem .5rem;
    font-size: .75rem;
    line-height: 1.2;
}

.ua-page td > .btn:hover,
.ua-page td > form > .btn:hover,
.ua-page td > a.btn:hover,
.ua-page td > button.btn:hover,
.ua-page td .btn-group > .btn:hover {
    background: var(--ua-hover);
    border-color: var(--ua-line-strong);
    color: var(--ua-text);
    filter: none;
}

/* Delete keeps its colour, because it is the one action in the row that cannot be taken back. */
.ua-page td > .btn-danger,
.ua-page td > form > .btn-danger,
.ua-page td > a.btn-danger,
.ua-page td > button.btn-danger { color: var(--ua-down); }

.ua-page td > .btn-danger:hover,
.ua-page td > form > .btn-danger:hover,
.ua-page td > a.btn-danger:hover,
.ua-page td > button.btn-danger:hover {
    background: var(--ua-down-wash);
    border-color: var(--ua-down);
    color: var(--ua-down);
}

/* Keep a row's actions on one line where the column allows it. */
.ua-page td.text-end, .ua-page td.text-right { white-space: nowrap; }

/*
 * The status switch.
 *
 * Its size is fine; its "on" colour was a different blue from everything else on the page,
 * which made it read as a third state rather than as the same accent.
 */
.ua-page .switch { margin-bottom: 0; vertical-align: middle; }
.ua-page .switch input:checked + .slider { background-color: var(--ua-accent); }
.ua-page .switch input:focus + .slider { box-shadow: 0 0 0 3px var(--ua-accent-wash); }

/* A record's picture in a table row.

   Square, fixed, and never larger than its cell, because a list is read by scanning the column
   of names down the left -- an image that changes height row to row breaks that scan. A record
   with no image, or one whose file has gone, gets the placeholder below rather than the
   browser's broken-image glyph, which reads as a broken page rather than an empty field. */
.ua-thumb {
    width: 40px;
    height: 40px;
    min-width: 40px;
    border-radius: 8px;
    object-fit: cover;
    background: var(--ua-bar);
    border: 1px solid var(--ua-line);
    display: inline-block;
}

.ua-thumb--missing {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: var(--ua-hover);
}

/* Drawn rather than lettered, so it says "no picture" in any language the admin is read in. */
.ua-thumb--missing::after {
    content: "";
    width: 18px;
    height: 14px;
    border: 1.5px solid var(--ua-line-strong);
    border-radius: 3px;
    background:
        radial-gradient(circle at 5px 4px, var(--ua-line-strong) 1.6px, transparent 1.7px),
        linear-gradient(to top right, transparent 48%, var(--ua-line-strong) 48%, var(--ua-line-strong) 62%, transparent 62%);
}

/* ---------------------------------------------------------------------------------------------
   Long forms.

   The project form is around a hundred fields on one page, and the two things that made it hard
   to fill in were not the fields: finding the one a validation message referred to, and reaching
   the Save button from wherever you happened to be.
   --------------------------------------------------------------------------------------------- */

.ua-page .ua-errors {
    border: 1px solid var(--ua-down);
    border-left-width: 3px;
    border-radius: var(--ua-r);
    background: var(--ua-down-wash);
    padding: .875rem 1rem;
    margin-bottom: 1.25rem;
}

.ua-page .ua-errors:focus { outline: none; }

.ua-page .ua-errors__head {
    margin: 0 0 .5rem;
    font-weight: 600;
    color: var(--ua-text);
}

.ua-page .ua-errors__list {
    margin: 0;
    padding-left: 1.1rem;
    display: grid;
    gap: .15rem;
}

.ua-page .ua-errors__link {
    color: var(--ua-text-soft);
    text-decoration: underline;
    text-underline-offset: 2px;
    text-decoration-color: var(--ua-line-strong);
}

.ua-page .ua-errors__link:hover {
    color: var(--ua-text);
    text-decoration-color: currentColor;
}

/* Where a message sent you. Fades on its own, because a marker that stays put stops meaning
   "this one" the moment you click the second message. */
.ua-field-flagged {
    animation: ua-field-flag 2.4s ease-out 1;
    border-radius: var(--ua-r-sm);
}

@keyframes ua-field-flag {
    0%, 55% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--ua-accent) 55%, transparent); }
    100%    { box-shadow: 0 0 0 3px transparent; }
}

@media (prefers-reduced-motion: reduce) {
    .ua-field-flagged { animation: none; box-shadow: 0 0 0 3px var(--ua-accent); }
}

.ua-page .ua-formbar {
    position: sticky;
    bottom: 0;
    z-index: 20;
    margin: 1.5rem -1.25rem -1.25rem;
    padding: .75rem 1.25rem;
    background: var(--ua-card);
    border-top: 1px solid var(--ua-line);
    /* Lifted off the content behind it so it reads as a bar rather than as the last row. */
    box-shadow: 0 -6px 18px color-mix(in srgb, var(--ua-text) 7%, transparent);
}

.ua-page .ua-formbar__inner {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: .5rem;
}

.ua-page .ua-formbar__note {
    margin-right: auto;
    color: var(--ua-muted);
    font-size: .8125rem;
}

/* A section of a long form, so the page reads as a handful of parts rather than one column of
   ninety rows. */
.ua-page .ua-formsection {
    border-top: 1px solid var(--ua-line);
    padding-top: 1.25rem;
    margin-top: 1.75rem;
}

.ua-page .ua-formsection:first-of-type {
    border-top: 0;
    padding-top: 0;
    margin-top: 0;
}

.ua-page .ua-formsection__title {
    font-size: .8125rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ua-muted);
    margin: 0 0 1rem;
}

/* ---------------------------------------------------------------------------------------------
   SETTINGS FIELDS

   The settings screen is the one form on the admin that every kind of field appears on at once:
   text, a colour, an upload, a switch. These are the pieces that were still wearing the old
   theme's markup -- a label with the config key shouting beside it in small caps, an upload with
   its preview in a nested Bootstrap column, a bare checkbox floating at the top of its cell.
   --------------------------------------------------------------------------------------------- */

.ua-field { min-width: 0; }

/* The config key, beside the label. Quiet, and never small caps: it is a literal. */
.ua-field__key {
    display: inline-block;
    margin-left: .35rem;
    padding: .05rem .3rem;
    border-radius: 5px;
    font-size: .6875rem;
    text-transform: none;
    letter-spacing: 0;
    background: var(--ua-bar);
    color: var(--ua-muted);
}

.ua-field__help {
    display: block;
    margin-top: .35rem;
    font-size: .75rem;
    color: var(--ua-muted);
}

/*
 * Two widths on top of the default grid. The default packs 240px columns, which is right for
 * a phone number and wrong for an upload or a colour with a paragraph of note under it.
 */
.ua-form-grid--media { grid-template-columns: repeat(auto-fit, minmax(min(330px, 100%), 1fr)); }
.ua-form-grid--roomy { grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr)); }

/* ------------------------------------------------------------------- upload */

.ua-upload {
    display: flex;
    gap: .875rem;
    align-items: flex-start;
    padding: .875rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-card);
    transition: border-color .12s ease, box-shadow .12s ease;
}

.ua-upload:hover { border-color: var(--ua-line-strong); box-shadow: var(--ua-shadow); }
.ua-upload.is-invalid { border-color: var(--ua-down); }

/*
 * A fixed tile with the picture contained inside it: a 200x60 logo and a square favicon are
 * different shapes, and stretching both to one box -- which is what the old 250x150 <img> did --
 * tells you nothing about either. The chequer shows through a transparent PNG, which most of
 * these are.
 */
.ua-upload__preview {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 124px;
    height: 82px;
    min-width: 124px;
    padding: 6px;
    border: 1px solid var(--ua-line);
    border-radius: 10px;
    overflow: hidden;
    background-color: var(--ua-card);
    background-image:
        linear-gradient(45deg, var(--ua-hover) 25%, transparent 25%),
        linear-gradient(-45deg, var(--ua-hover) 25%, transparent 25%),
        linear-gradient(45deg, transparent 75%, var(--ua-hover) 75%),
        linear-gradient(-45deg, transparent 75%, var(--ua-hover) 75%);
    background-size: 14px 14px;
    background-position: 0 0, 0 7px, 7px -7px, -7px 0;
}

.ua-upload__preview img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

/* Nothing uploaded: the same drawn picture-frame the tables use, rather than a broken image. */
.ua-upload__preview--empty { background-image: none; background-color: var(--ua-hover); }

.ua-upload__preview--empty::after {
    content: "";
    width: 34px;
    height: 26px;
    border: 1.5px solid var(--ua-line-strong);
    border-radius: 4px;
    background:
        radial-gradient(circle at 9px 7px, var(--ua-line-strong) 2.4px, transparent 2.5px),
        linear-gradient(to top right, transparent 48%, var(--ua-line-strong) 48%, var(--ua-line-strong) 60%, transparent 60%);
}

.ua-upload__body { flex: 1; min-width: 0; }

/* A native file input reports a wide intrinsic size; without this it pushes the card open. */
.ua-upload input[type="file"] { max-width: 100%; }

.ua-upload__name {
    font-size: .8125rem;
    font-weight: 600;
    color: var(--ua-text);
    margin-bottom: .2rem;
}

.ua-upload__hint {
    font-size: .75rem;
    line-height: 1.5;
    color: var(--ua-muted);
    margin: 0 0 .55rem;
}

.ua-upload__file {
    margin: .45rem 0 0;
    font-size: .75rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ---------------------------------------------------------------- jump links */

.ua-jump {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
    margin-bottom: 1.25rem;
}

.ua-jump .ua-chip { text-decoration: none; }
.ua-jump .ua-chip:hover { border-color: var(--ua-accent-line); color: var(--ua-text); }

/* An anchored card should not land under the sticky admin header. */
.ua-page [id^="setting-"] { scroll-margin-top: 90px; }

/* ----------------------------------------------------------------- save bar */

/*
 * Save follows you down the page. This form posts every section at once, so a button waiting
 * at the bottom of a page this long means scrolling past six cards to keep one edit.
 */
.ua-save-bar {
    position: sticky;
    bottom: 1rem;
    z-index: 1019;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    padding: .875rem 1.125rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r-lg);
    background: var(--ua-card);
    box-shadow: var(--ua-shadow-lift);
}

@media (max-width: 767.98px) {
    .ua-upload { flex-direction: column; }
    .ua-upload__preview { width: 100%; min-width: 0; }
    .ua-save-bar { bottom: 0; border-radius: var(--ua-r-lg) var(--ua-r-lg) 0 0; }
}

/*
 * Rows line up even when a label wraps.
 *
 * "Instagram Account URL" runs onto a second line where "Website URL" does not, so the input
 * under it started a line lower than the one beside it and the row read as crooked. Each field
 * is a column that fills its cell, with the control pushed to the bottom of it.
 */
.ua-form-grid > * { min-width: 0; }

.ua-field {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.ua-field > .form-control,
.ua-field > .form-select { margin-top: auto; }

.ua-field > textarea.form-control { margin-top: 0; }

/* An upload or a colour fills its cell too, so a longer hint does not shorten its neighbour. */
.ua-upload,
.ua-form-grid .ua-color { height: 100%; }

/*
 * Label, control and hint share rows across the whole line of fields (20 Nov 2026).
 *
 * Pushing the control to the bottom of its cell (above) lined inputs up when a label wrapped, but
 * broke them the other way whenever one field had a hint under it: that field's input rose by the
 * hint's height ("A new address is sent a link to confirm it." under Email lifted the email box
 * above Name and Mobile beside it). Every form on the kit had the same trap.
 *
 * With subgrid each field spans four rows of the form grid -- label, control, hint, error -- and
 * those rows are shared by every field on the line. A wrapped label makes the label row taller for
 * all of them; a hint makes the hint row taller for all of them; the controls always sit on one
 * line. Gaps are margins, so an unused row costs nothing. Only fields that start with their label
 * are arranged this way; anything else keeps the column layout above.
 */
@supports (grid-template-rows: subgrid) {
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) {
        display: grid;
        grid-row: span 4;
        grid-template-rows: subgrid;
        row-gap: 0;
        height: auto;
        align-content: start;
    }
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) > :first-child {
        grid-row: 1;
        align-self: end;
        margin-bottom: .375rem;
    }
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) > :nth-child(2) {
        grid-row: 2;
        align-self: start;
        margin-top: 0;
    }
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) > :nth-child(3) {
        grid-row: 3;
        align-self: start;
    }
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) > :nth-child(n + 4) {
        grid-row: 4;
        align-self: start;
    }
    /* The form grid's own row gap would now fall between label and control too; the space between
       lines of fields comes from the last row instead. */
    .ua-form-grid:has(> .ua-field > label:first-child, > .ua-field > .form-label:first-child) {
        row-gap: 0;
    }
    .ua-form-grid > .ua-field:has(> label:first-child, > .form-label:first-child) {
        padding-bottom: 1rem;
    }
    /* Anything else in such a grid (an upload, a switch, a hand-built cell) takes a whole line of
       four rows too, so auto-placement never tucks it under a field's label. */
    .ua-form-grid:has(> .ua-field > label:first-child, > .ua-field > .form-label:first-child)
        > :not(.ua-field:has(> label:first-child, > .form-label:first-child)) {
        grid-row: span 4;
        padding-bottom: 1rem;
    }
}

/*
 * Two columns, and two means two.
 *
 * .ua-grid--2 packs as many 360px columns as fit, which on a 1145px page is three -- so a pair
 * of half cards sat in thirds with an empty third beside them, and four cards came out 3 + 1.
 * Here the halves are real halves, and a card that needs the width still takes the whole row
 * with .ua-card--wide.
 */
.ua-grid--pair {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1.25rem;
    margin-bottom: 1.25rem;
}

/* The gap does the spacing; the card's own margin would double it. */
.ua-grid--pair > .ua-card { margin-bottom: 0; }

@media (max-width: 991.98px) {
    .ua-grid--pair { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------------------------------------------
   PINNED LIST

   A short, ordered list you rearrange by dragging: the pre-footer's pinned projects. The order
   of the rows is the saved order -- each row carries the hidden input that posts it -- so the
   number down the left is the position the column will print.
   --------------------------------------------------------------------------------------------- */

.ua-pinlist {
    list-style: none;
    margin: 0 0 .625rem;
    padding: 0;
    display: grid;
    gap: .375rem;
}

.ua-pin {
    display: flex;
    align-items: center;
    gap: .625rem;
    padding: .5rem .625rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-card);
    transition: border-color .12s ease, box-shadow .12s ease, background .12s ease;
}

.ua-pin:hover { border-color: var(--ua-line-strong); }

/* The one part of the row you can pick it up by, so a mis-grab cannot start a drag. */
.ua-pin__handle {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    border-radius: 7px;
    color: var(--ua-muted);
    cursor: grab;
    touch-action: none;
}

.ua-pin__handle:hover { background: var(--ua-hover); color: var(--ua-text); }

.ua-pin__handle:focus-visible {
    outline: none;
    background: var(--ua-accent-wash);
    color: var(--ua-accent);
    box-shadow: 0 0 0 3px var(--ua-accent-wash);
}

.ua-pin--chosen .ua-pin__handle { cursor: grabbing; }

/* Tabular figures so 1 and 10 take the same width and the names line up. */
.ua-pin__n {
    flex: 0 0 auto;
    min-width: 1.35rem;
    font-size: .75rem;
    font-variant-numeric: tabular-nums;
    color: var(--ua-muted);
    text-align: right;
}

.ua-pin__name {
    flex: 1 1 auto;
    min-width: 0;
    font-size: .8125rem;
    color: var(--ua-text);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.ua-pin__remove {
    flex: 0 0 auto;
    width: 26px;
    height: 26px;
    padding: 0;
    border: 0;
    border-radius: 7px;
    background: none;
    color: var(--ua-muted);
    cursor: pointer;
    transition: background .12s ease, color .12s ease;
}

.ua-pin__remove:hover { background: var(--ua-down-wash, var(--ua-hover)); color: var(--ua-down); }

/* Dragging: the gap the row came from, the row under the cursor, and one just added. */
.ua-pin--ghost { opacity: .35; border-style: dashed; background: var(--ua-hover); }
.ua-pin--chosen { border-color: var(--ua-accent-line); box-shadow: var(--ua-shadow-lift); }
.ua-pin--drag { opacity: 1; }
.ua-pin.is-new { border-color: var(--ua-accent-line); background: var(--ua-accent-wash); }

.ua-pinlist__empty {
    margin: 0 0 .625rem;
    padding: .625rem;
    border: 1px dashed var(--ua-line-strong);
    border-radius: var(--ua-r);
    font-size: .75rem;
    color: var(--ua-muted);
}

.ua-pinlist__empty[hidden] { display: none; }

.ua-pinlist__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    margin-top: .4rem;
}

/* At ten there is nothing left to add, so the search box says so by stepping back. */
.is-full .ua-pinlist__add + .select2-container { opacity: .55; }

.ua-pin-dirty { margin-left: .25rem; }

@media (prefers-reduced-motion: reduce) {
    .ua-pin { transition: none; }
}

/* The row being carried (Sortable's fallback drag, parented to <body>). */
.ua-pin--drag,
.ua-pin.sortable-fallback {
    box-shadow: var(--ua-shadow-lift);
    border-color: var(--ua-accent-line);
    background: var(--ua-card);
    opacity: .96;
    cursor: grabbing;
    z-index: 1080;
}

/* A card that is reporting a failure rather than holding a form. */
.ua-card--error { border-color: var(--ua-down); }

.ua-errors {
    margin: .5rem 0 0;
    padding-left: 1.1rem;
    font-size: .8125rem;
    color: var(--ua-down);
}

/* ---------------------------------------------------------------------------------------------
   RECORD EDITOR

   A long record edited section by section: the list of sections down the left, the section
   being edited on the right. The project editor put that panel in a 475px box with its own
   scrollbar, inside the page's own scrollbar, so any form longer than a third of the window was
   read through a slot -- and the menu beside it ran on past the bottom of the panel.
   --------------------------------------------------------------------------------------------- */

.ua-editor__panel { min-width: 0; }

/* The panel is as tall as its contents; the page scrolls. */
.ua-editor__panel > .tab-pane { width: 100%; }

/*
 * The section list follows the page down, so switching section never means scrolling back up
 * to find the menu. It stops itself at the height of the viewport.
 */
@media (min-width: 1200px) {
    /*
     * The whole rail follows the page down -- the section list and the "still missing"
     * checklist together. The checklist was a second card below a sticky one, so it scrolled
     * out of sight and was the first thing lost on a short window.
     *
     * The list is what gives way when there is not enough height for both: it scrolls inside
     * itself, and the checklist stays where it can be read.
     */
    .ua-editor__rail {
        position: sticky;
        /* The admin header is sticky and 102px tall, breadcrumb included; less than that
           and the top of the rail slides underneath it. */
        top: 114px;
        max-height: calc(100vh - 134px);
        display: flex;
        flex-direction: column;
        gap: 1rem;
    }

    .ua-editor__nav {
        flex: 0 1 auto;
        min-height: 0;
        overflow-y: auto;
        margin-bottom: 0;
    }

    .ua-complete { flex: 0 0 auto; }
    .ua-editor__nav + .ua-complete { margin-top: 0; }
}

/* ------------------------------------------------------------ vertical nav */

.ua-vnav { gap: 1px; }

/* A heading over each run of sections, so thirteen links read as four groups. */
.ua-vnav__group {
    margin: .875rem .25rem .3rem;
    font-size: .6875rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: var(--ua-muted);
}

.ua-vnav__group:first-child { margin-top: 0; }

.ua-page .ua-vnav .nav-link {
    display: flex;
    align-items: center;
    gap: .55rem;
    padding: .45rem .6rem;
    border-radius: 9px;
    font-size: .8125rem;
    font-weight: 500;
    color: var(--ua-text-soft);
    background: none;
    transition: background .12s ease, color .12s ease;
}

.ua-page .ua-vnav .nav-link:hover { background: var(--ua-hover); color: var(--ua-text); }

.ua-page .ua-vnav .nav-link.active {
    background: var(--ua-accent-wash);
    color: var(--ua-accent);
    font-weight: 600;
}

/* Every section had the same grid icon, which is the same as having none. */
.ua-vnav__icon {
    flex: 0 0 auto;
    width: 1rem;
    font-size: .8125rem;
    text-align: center;
    color: var(--ua-muted);
}

.ua-page .ua-vnav .nav-link.active .ua-vnav__icon { color: var(--ua-accent); }

.ua-vnav__label {
    flex: 1 1 auto;
    min-width: 0;
    /* Never mid-word: these are labels, not the URLs that rule was written for. */
    overflow-wrap: normal;
    word-break: normal;
}

/*
 * A section that does not apply to this record -- a mortgage calculator on an off-plan
 * project -- says so instead of being dimmed with no explanation.
 */
.ua-page .ua-vnav .nav-link.is-locked {
    pointer-events: none;
    color: var(--ua-muted);
}

.ua-vnav__note {
    flex: 0 0 auto;
    font-size: .625rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
    background: var(--ua-bar);
    border-radius: 5px;
    padding: .1rem .3rem;
}

/*
 * Section headings inside an edited record.
 *
 * The project form runs to a few thousand pixels with two headings in it -- "Hero Section",
 * "Highlights" -- set as plain h5s the same size as everything else, so nothing told you where
 * one part ended and the next began. They are section rules now. Modal titles keep their own
 * size: they are headings of a dialog, not of a section.
 */
/*
 * From here on these are rules about an admin FORM, not about the project editor: the same
 * headings, image frames, label alignment and buttons appear on Amenities, States,
 * Communities, Developers and Sub-communities, and each screen looking like its own product
 * is the thing being fixed. Scoped to .ua-page, which the layout puts on every admin screen.
 */
.ua-page h5:not(.modal-title) {
    margin: 2rem 0 1.15rem;
    padding-top: 1.35rem;
    border-top: 1px solid var(--ua-line);
    font-size: .9375rem;
    font-weight: 600;
    letter-spacing: -.01em;
    color: var(--ua-text);
}

/* The first heading opens the form; it needs no rule above it. */
.ua-page form > h5:first-of-type,
.ua-page .card-body > h5:first-of-type {
    margin-top: 0;
    padding-top: 0;
    border-top: 0;
}

/* The headings do the separating now. */
.ua-page form > hr { display: none; }

/* A label column that sits level with the field beside it, not above its top edge.
   Only a column that holds the label alone: a col-md-3 with its label above its own field (Latitude,
   Longitude on the property form) was pushed 7px lower than the col-md-6 beside it. */
.ua-page .row > [class*="col-md-3"]:not(:has(input, select, textarea)) > .form-label,
.ua-page .row > [class*="col-md-3"]:not(:has(input, select, textarea)) > label {
    padding-top: .45rem;
    margin-bottom: .25rem;
}

/*
 * Below 1200px the two columns stack, and a menu of thirteen sections stacked on top of the
 * form is 660px of links to scroll past before reaching a field. It becomes a strip that
 * scrolls sideways instead; the group headings go, since a row cannot show them.
 *
 * It used to change over at 992px, which left a tablet in landscape with the column layout and
 * a quarter of 960px to draw it in: about 180px once the admin's own sidebar had taken its
 * share. "Mortgage Calculator" then broke one letter per line, because .ua-page a is allowed
 * to break anywhere -- a rule that exists for the bare URLs some fields print. The labels are
 * exempted from it below.
 */
@media (max-width: 1199.98px) {
    .ua-editor__nav {
        margin-bottom: 1rem;
        padding: .6rem;
        overflow: hidden;
    }

    .ua-editor__nav .ua-vnav {
        flex-direction: row !important;
        flex-wrap: nowrap;
        gap: .35rem;
        overflow-x: auto;
        scrollbar-width: thin;
        -webkit-overflow-scrolling: touch;
    }

    .ua-editor__nav .ua-vnav__group { display: none; }
    .ua-editor__nav .ua-vnav .nav-item { flex: 0 0 auto; }

    .ua-page .ua-editor__nav .ua-vnav .nav-link {
        white-space: nowrap;
        border: 1px solid var(--ua-line);
    }

    .ua-page .ua-editor__nav .ua-vnav .nav-link.active { border-color: var(--ua-accent-line); }

    /* A locked section is worth a row on a wide screen, not a strip on a narrow one. */
    .ua-editor__nav .ua-vnav__note { display: none; }
}

/*
 * Some fields print the file they hold as a bare URL, and a URL has no spaces to break at --
 * two of them ran 130px past the page on a narrow screen. The old fixed-height panel hid this
 * inside its own scrollbar.
 */
.ua-page label,
.ua-page .form-text,
.ua-page a { overflow-wrap: anywhere; }

/* ------------------------------------------------------- fields in a record editor */

/* What a figure says in words, how long a line is, which file is attached. */
.ua-fieldhint {
    display: block;
    margin-top: .3rem;
    font-size: .75rem;
    color: var(--ua-muted);
    min-height: 1em;
}

.ua-fieldhint.is-over { color: var(--ua-warn, #b45309); }

.ua-currentfile {
    margin: .4rem 0 0;
    font-size: .75rem;
    overflow-wrap: anywhere;
}

.ua-currentfile i { margin-right: .3rem; color: var(--ua-muted); }
.ua-currentfile.is-pending { color: var(--ua-accent); }

/*
 * The image preview was a raw <img> forced to 120x120, so a 2500x1062 hero photograph was
 * squashed into a square and a logo was stretched. Fixed frame, picture contained in it.
 */
.ua-page .image-input-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 132px;
    height: 96px;
    padding: 6px;
    border: 1px solid var(--ua-line);
    border-radius: 10px;
    overflow: hidden;
    background: var(--ua-hover);
    /*
     * Several forms paint the saved image as a background rather than an <img>, and nothing
     * here ever said how to size it -- so a 2500x3000 floor plate was painted at full size
     * from the top left corner and the frame showed 132x96 pixels of empty margin. It read as
     * "no image attached" on a form that had one.
     */
    background-size: contain;
    background-position: center;
    background-repeat: no-repeat;
}

/* The file just chosen, named under the frame -- proof it was picked up before saving. */
.ua-page .ua-chosenfile {
    margin-top: .35rem;
    font-size: .8125rem;
    color: var(--ua-up, #15803d);
    overflow-wrap: anywhere;
}

.ua-page .ua-chosenfile i { margin-right: .3rem; }

.ua-page .image-input-wrapper img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.ua-page .kt-image-input.is-changed .image-input-wrapper { border-color: var(--ua-accent-line); }

/* The pencil that opens the file picker, on the corner of the frame rather than beside it. */
.ua-page .image-input { position: relative; display: inline-block; }

.ua-page .image-input > label[data-kt-image-input-action] {
    position: absolute;
    top: -8px;
    right: -8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border: 1px solid var(--ua-line);
    border-radius: 50%;
    background: var(--ua-card);
    box-shadow: var(--ua-shadow);
    cursor: pointer;
    font-size: .75rem;
    color: var(--ua-text-soft);
}

.ua-page .image-input > label[data-kt-image-input-action]:hover {
    border-color: var(--ua-accent-line);
    color: var(--ua-accent);
}

.ua-page .image-input input[type="file"] { display: none; }

/* An alt-text box directly under a 132px frame looked like part of the frame. */
.ua-page .image-name-input { margin-top: .6rem; max-width: 520px; }

/* A year, a price or a size does not need 700px of input. */
.ua-page input[type="number"] { max-width: 320px; }
.ua-page .input-group input[type="number"] { max-width: none; }

/*
 * Bootstrap buttons inside an edited record, in the kit's clothes.
 *
 * The thirteen tab partials were written at different times: some carry .ua-btn, most carry
 * Bootstrap's .btn-primary, so "Add Gallery" is a filled blue rectangle two tabs away from a
 * soft-cornered Save. Mapping the three Bootstrap variants here means every tab matches
 * without editing every partial -- and a partial that already uses .ua-btn is untouched.
 */
.ua-page .btn:not(.ua-btn):not(.btn-close) {
    display: inline-flex;
    align-items: center;
    gap: .4rem;
    height: 34px;
    padding: 0 .75rem;
    border-radius: 9px;
    font-size: .8125rem;
    font-weight: 550;
    border: 1px solid var(--ua-line-strong);
    background: var(--ua-card);
    color: var(--ua-text-soft);
    box-shadow: none;
    transition: background .14s ease, border-color .14s ease, color .14s ease;
}

.ua-page .btn:not(.ua-btn):not(.btn-close):hover {
    background: var(--ua-hover);
    color: var(--ua-text);
}

/* The variants have to out-specify the rule above, which carries two :not()s of its own. */
.ua-page .btn.btn-primary:not(.ua-btn):not(.btn-close) {
    background: var(--ua-accent);
    border-color: var(--ua-accent);
    color: #fff;
}

.ua-page .btn.btn-primary:not(.ua-btn):not(.btn-close):hover {
    background: var(--ua-accent-ink);
    border-color: var(--ua-accent-ink);
    color: #fff;
}

.ua-page .btn.btn-danger:not(.ua-btn):not(.btn-close) {
    background: var(--ua-card);
    border-color: var(--ua-line-strong);
    color: var(--ua-down);
}

.ua-page .btn.btn-danger:not(.ua-btn):not(.btn-close):hover {
    background: var(--ua-down-wash);
    border-color: var(--ua-down);
    color: var(--ua-down);
}

/* A button in a table row is a row action: smaller, and square enough to sit in a cell. */
.ua-page .btn-sm:not(.ua-btn) { height: 30px; padding: 0 .55rem; font-size: .75rem; }

/* Tables inside the editor read like the kit's tables. */
.ua-page table th {
    font-size: .6875rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: var(--ua-muted);
    font-weight: 600;
}

.ua-page table td { font-size: .8125rem; vertical-align: middle; }

/* An amenity icon is square art at 44px; the list forced it to 50x100. */
.ua-amenity-icon {
    width: 44px;
    height: 44px;
    object-fit: contain;
}

/* The "remove on save" tick, beside the file it belongs to. */
.ua-currentfile__remove {
    display: inline-flex;
    align-items: center;
    gap: .3rem;
    margin-left: .5rem;
    color: var(--ua-down);
    cursor: pointer;
}

.ua-currentfile__remove .form-check-input { margin: 0; }
.ua-currentfile__remove .form-check-input:checked { background-color: var(--ua-down); border-color: var(--ua-down); }

/*
 * Two fields to a line: tried, measured, not kept.
 *
 * A two-column grid over the whole form came out 830px TALLER, and eight hand-picked pairs
 * saved 5px in total. The reason is that a label-beside-field row here is only 37px high,
 * while a column half the width has to put the label above its field, which makes each row
 * 65px -- so a pair costs 81px where the two separate rows cost 74px. The single column is
 * already the shortest this form gets at a 855px panel; what actually shortened the page was
 * grouping it into sections. Left here so it is not tried again without measuring.
 */

/* ------------------------------------------------------- duplicate warning */

/*
 * Said while the name is being typed, not after a second copy has been saved. A warning,
 * not a refusal: two projects can honestly carry the same name in different communities.
 */
.ua-dupe:empty { display: none; }

.ua-dupe {
    margin-top: .45rem;
    padding: .55rem .7rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-hover);
    font-size: .75rem;
}

.ua-dupe.is-warning {
    border-color: var(--ua-warn, #f59e0b);
    background: var(--ua-warn-wash, rgba(245, 158, 11, .08));
}

.ua-dupe__head {
    font-weight: 600;
    color: var(--ua-warn-ink, #92400e);
    margin-bottom: .3rem;
}

.ua-dupe__row { display: flex; flex-wrap: wrap; align-items: baseline; gap: .35rem; }
.ua-dupe__row + .ua-dupe__row { margin-top: .2rem; }

.ua-dupe__status {
    font-size: .625rem;
    text-transform: uppercase;
    letter-spacing: .04em;
    background: var(--ua-card);
    border: 1px solid var(--ua-line);
    border-radius: 5px;
    padding: .05rem .3rem;
}

/* ---------------------------------------------------------------- completeness */

/*
 * What a record is still missing, beside the sections that would fill it. Counted from the
 * live data: hundreds of published projects have no price, no type or no floor plan, and
 * none of that was visible while editing one.
 */
.ua-complete { margin-bottom: 0; }

.ua-complete__bar {
    height: 5px;
    border-radius: 999px;
    background: var(--ua-bar);
    overflow: hidden;
    margin-bottom: .7rem;
}

.ua-complete__bar span {
    display: block;
    height: 100%;
    border-radius: 999px;
    background: var(--ua-accent);
    transition: width .2s ease;
}

.ua-complete__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.ua-complete__list a {
    display: inline-block;
    padding: .15rem .45rem;
    border: 1px dashed var(--ua-line-strong);
    border-radius: 999px;
    font-size: .75rem;
    color: var(--ua-text-soft);
    text-decoration: none;
}

.ua-complete__list a:hover { border-color: var(--ua-accent); color: var(--ua-accent); }

.ua-complete__done { margin: 0; font-size: .8125rem; color: var(--ua-up, #15803d); }
.ua-complete__done i { margin-right: .3rem; }

@media (min-width: 992px) {
    /* It belongs to the column, under the section list, and rides down with it. */
    .ua-editor__nav + .ua-complete { margin-top: 1rem; }
}

/* ------------------------------------------------------------------ import */

.ua-import-tally {
    display: flex;
    flex-wrap: wrap;
    gap: 1.25rem;
    padding: .7rem .9rem;
    margin-bottom: 1rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-hover);
    font-size: .8125rem;
}

.ua-import-tally strong { font-size: 1.05rem; }
.ua-import-tally .is-bad strong { color: var(--ua-down); }

.ua-import-errors {
    margin-top: 1rem;
    padding: .7rem .9rem;
    border: 1px solid var(--ua-down);
    border-radius: var(--ua-r);
    color: var(--ua-down);
}

.ua-chips { display: flex; flex-wrap: wrap; gap: .3rem; }

.ua-note-list { margin: .5rem 0 0; padding-left: 1.1rem; color: var(--ua-text-soft); }
.ua-note-list li { margin-bottom: .2rem; }

/* "Start from a sample" sits beside the upload, not buried under it. */
.ua-sample {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: .75rem;
    margin-top: 1rem;
    padding: .7rem .9rem;
    border: 1px dashed var(--ua-line-strong);
    border-radius: var(--ua-r);
}

/* ---------------------------------------------------------------------------------------------
   THE "CHOOSE FILE" BUTTON

   Every file field in the admin showed a white strip above, below and to the left of its grey
   button. The button is the browser's own ::file-selector-button, and Bootstrap makes it sit
   flush by giving it a negative margin equal to the control's padding -- but the kit sets that
   padding to .45rem .7rem (7.2 / 11.2px) while Bootstrap's small-control rule still pulls back
   -.25rem -.5rem (4 / 8px). The 3.2px left over is the strip.

   So the button's own padding and its negative margin are both stated here, from the same two
   numbers as the control, and it fills the field exactly. ::-webkit-file-upload-button is the
   same rule again for Safari below 16.4 -- it has to be its own rule, because a browser that
   does not know one selector drops the whole list.
   --------------------------------------------------------------------------------------------- */

input[type="file"].form-control::file-selector-button {
    padding: .45rem .7rem;
    margin: -.45rem .7rem -.45rem -.7rem;
    border: 0;
    border-inline-end: 1px solid var(--ua-line-strong);
    /* The control's 9px radius less its 1px border, so the corners sit inside it. */
    border-radius: 8px 0 0 8px;
    background: var(--ua-hover);
    color: var(--ua-text-soft);
    font-size: inherit;
    line-height: inherit;
    transition: background .12s ease, color .12s ease;
}

input[type="file"].form-control::-webkit-file-upload-button {
    padding: .45rem .7rem;
    margin: -.45rem .7rem -.45rem -.7rem;
    border: 0;
    border-inline-end: 1px solid var(--ua-line-strong);
    border-radius: 8px 0 0 8px;
    background: var(--ua-hover);
    color: var(--ua-text-soft);
    font-size: inherit;
    line-height: inherit;
}

input[type="file"].form-control:hover::file-selector-button { background: var(--ua-bar); color: var(--ua-text); }
input[type="file"].form-control:hover::-webkit-file-upload-button { background: var(--ua-bar); color: var(--ua-text); }

input[type="file"].form-control:disabled::file-selector-button { background: var(--ua-bar); }

/* A file field that is not wearing .form-control still gets a button worth clicking. */
input[type="file"]:not(.form-control)::file-selector-button {
    padding: .35rem .6rem;
    margin-inline-end: .6rem;
    border: 1px solid var(--ua-line-strong);
    border-radius: 8px;
    background: var(--ua-card);
    color: var(--ua-text-soft);
    cursor: pointer;
}

/*
 * Bootstrap's outline variants, which the kit's generic .btn rule would otherwise flatten into
 * one neutral look. They are used where two choices sit side by side -- "Add to existing" and
 * "Replace all" -- and losing the difference between them there would be losing the warning.
 */
.ua-page .btn.btn-outline-danger:not(.ua-btn) { color: var(--ua-down); border-color: var(--ua-line-strong); }
.ua-page .btn-check:checked + .btn.btn-outline-danger {
    background: var(--ua-down-wash, rgba(220, 38, 38, .08));
    border-color: var(--ua-down);
    color: var(--ua-down);
}

.ua-page .btn-check:checked + .btn.btn-outline-primary,
.ua-page .btn-check:checked + .btn.btn-primary {
    background: var(--ua-accent);
    border-color: var(--ua-accent);
    color: #fff;
}

/* ------------------------------------------------------------------- drafts */

/*
 * The bar that offers back what was typed before a refresh. Deliberately at the top of the
 * form and deliberately not automatic: a draft that restores itself is how yesterday's work
 * overwrites this morning's.
 */
.ua-draft {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .6rem;
    margin-bottom: 1rem;
    padding: .7rem .9rem;
    border: 1px solid var(--ua-warn, #f59e0b);
    border-radius: var(--ua-r);
    background: var(--ua-warn-wash, rgba(245, 158, 11, .08));
    font-size: .8125rem;
}

.ua-draft__said { flex: 1 1 260px; min-width: 0; }
.ua-draft.is-done { border-color: var(--ua-accent-line); background: var(--ua-accent-wash); }

/* ------------------------------------------------------------- the map picker
 *
 * A project used to be placed by typing two numbers with nothing on screen to check them
 * against, which is how 82 of them ended up sharing one coordinate. Search, map and the two
 * boxes are one control now; whichever you touch, the others follow.
 */
.ua-mappick {
    margin: 0 0 1rem;
    border: 1px solid var(--ua-line-strong);
    border-radius: var(--ua-r);
    overflow: hidden;
    background: var(--ua-card);
}

.ua-mappick__bar {
    display: flex;
    gap: .5rem;
    padding: .625rem;
    border-bottom: 1px solid var(--ua-line);
    background: var(--ua-hover);
}

.ua-mappick__search { flex: 1 1 auto; min-width: 0; }

.ua-mappick__canvas {
    height: 380px;
    width: 100%;
    background: var(--ua-bar);
}

.ua-mappick__foot {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: .5rem;
    padding: .55rem .75rem;
    border-top: 1px solid var(--ua-line);
    font-size: .8125rem;
    color: var(--ua-text-soft);
}

/* The coordinates read back from the pin, in figures you can compare digit by digit. */
.ua-mappick__coords {
    font-variant-numeric: tabular-nums;
    font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    color: var(--ua-muted);
    white-space: nowrap;
}

.ua-mappick__coords.is-off { color: var(--ua-down); font-weight: 600; }

.ua-mappick__canvas { position: relative; }

/* The search's own suggestions. Google drew these itself; this is the list that replaced it. */
.ua-mappick__results {
    position: absolute;
    top: calc(100% - .375rem);
    left: .625rem;
    right: .625rem;
    z-index: 20;
    margin: 0;
    padding: .25rem 0;
    list-style: none;
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--ua-line-strong, #d5dbe1);
    border-radius: var(--ua-r, 8px);
    background: var(--ua-card, #fff);
    box-shadow: 0 8px 24px rgba(15, 23, 42, .14);
}

.ua-mappick__result {
    display: flex;
    flex-direction: column;
    gap: .1rem;
    padding: .45rem .75rem;
    cursor: pointer;
}

.ua-mappick__result strong { font-weight: 600; font-size: .875rem; color: var(--ua-text, #1f2933); }
.ua-mappick__result small { font-size: .75rem; color: var(--ua-muted, #64748b); }
.ua-mappick__result.is-active,
.ua-mappick__result:hover { background: var(--ua-accent-wash, #edf8f6); }
.ua-mappick__message { padding: .5rem .75rem; font-size: .8125rem; color: var(--ua-text-soft, #475569); }

/* Map | Satellite, over the map's top-left corner. */
.ua-mappick__layers {
    position: absolute;
    top: .625rem;
    left: .625rem;
    z-index: 2;
    display: inline-flex;
    border: 1px solid var(--ua-line-strong, #d5dbe1);
    border-radius: var(--ua-r, 8px);
    overflow: hidden;
    background: var(--ua-card, #fff);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .18);
}

.ua-mappick__layers button {
    border: 0;
    padding: .3rem .7rem;
    font-size: .75rem;
    font-weight: 600;
    background: transparent;
    color: var(--ua-text-soft, #475569);
}

.ua-mappick__layers button[aria-pressed="true"] { background: var(--ua-accent, #087f75); color: #fff; }

@media (max-width: 575.98px) {
    .ua-mappick__canvas { height: 280px; }
    .ua-mappick__bar { flex-wrap: wrap; }
}

/* ------------------------------------------------- buildings within one project */

.ua-buildings {
    margin-top: .75rem;
    padding-top: .75rem;
    border-top: 1px solid var(--ua-line);
}

.ua-buildings__row {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: .5rem;
}

.ua-buildings__label {
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ua-muted);
}

.ua-buildings__chips {
    display: flex;
    flex-wrap: wrap;
    gap: .4rem;
}

/* How many plates the tower holds, so an empty one is obvious before anyone hunts for it. */
.ua-buildings__count {
    font-size: .6875rem;
    font-variant-numeric: tabular-nums;
    color: var(--ua-muted);
}

.ua-buildings__form {
    display: flex;
    align-items: center;
    gap: .4rem;
    margin-top: .6rem;
    max-width: 28rem;
}

.ua-buildings__hint {
    margin: .5rem 0 0;
    font-size: .8125rem;
    color: var(--ua-muted);
    max-width: 62ch;
}

/* ------------------------------------------------------- a switch that looks like one

   .ua-switch is a bordered row with a tick in it. That reads as "choose some of these",
   which is right for a list of options and wrong for a thing that is on or off right now:
   the advertising screen's switches were Bootstrap's bare .form-switch, small and grey, and
   whether a placement was live took a squint. This is the same row with a real switch on the
   right and the state in a word beside it, so the answer is readable across the page.

   The input is visually hidden rather than removed, so the label still toggles it, the tab
   order is unchanged and a screen reader still hears a checkbox. */

.ua-toggle {
    display: flex;
    position: relative;
    align-items: center;
    gap: 1rem;
    padding: .875rem 1rem;
    border: 1px solid var(--ua-line);
    border-radius: var(--ua-r);
    background: var(--ua-card);
    cursor: pointer;
    transition: border-color .14s ease, background .14s ease;
}

.ua-toggle:hover { border-color: var(--ua-accent-line); background: var(--ua-hover); }

.ua-toggle__text { flex: 1 1 auto; min-width: 0; }
.ua-toggle__text strong { display: block; font-weight: 600; font-size: .9375rem; }

.ua-toggle__text em {
    display: block;
    font-style: normal;
    font-size: .8125rem;
    color: var(--ua-muted);
    line-height: 1.6;
    margin-top: .2rem;
}

.ua-toggle input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* A fixed width, or the pill shifts sideways as the word changes length. */
.ua-toggle__state {
    flex: 0 0 auto;
    width: 2.25rem;
    text-align: right;
    font-size: .6875rem;
    font-weight: 650;
    letter-spacing: .06em;
    text-transform: uppercase;
    color: var(--ua-muted);
}

.ua-toggle__state i { font-style: normal; }
.ua-toggle input:checked ~ .ua-toggle__state { color: var(--ua-accent-ink); }
.ua-toggle input:checked ~ .ua-toggle__state [data-off] { display: none; }
.ua-toggle input:not(:checked) ~ .ua-toggle__state [data-on] { display: none; }

.ua-toggle__pill {
    flex: 0 0 auto;
    position: relative;
    width: 42px;
    height: 24px;
    border-radius: 999px;
    background: var(--ua-line-strong);
    transition: background .18s ease, box-shadow .14s ease;
}

.ua-toggle__pill::after {
    content: "";
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .28);
    transition: transform .18s ease;
}

.ua-toggle input:checked ~ .ua-toggle__pill { background: var(--ua-accent); }
.ua-toggle input:checked ~ .ua-toggle__pill::after { transform: translateX(18px); }
.ua-toggle input:focus-visible ~ .ua-toggle__pill { box-shadow: 0 0 0 3px var(--ua-accent-wash); }

/* The smaller one, for options that live underneath a switch rather than beside it. */
.ua-toggle--sub {
    padding: .5rem .75rem;
    gap: .625rem;
    border-radius: 999px;
}

.ua-toggle--sub .ua-toggle__text strong { font-size: .8125rem; font-weight: 550; }
.ua-toggle--sub .ua-toggle__pill { width: 34px; height: 20px; }
.ua-toggle--sub .ua-toggle__pill::after { width: 14px; height: 14px; }
.ua-toggle--sub input:checked ~ .ua-toggle__pill::after { transform: translateX(14px); }

/* What a switch governs, indented under it and greyed while the switch is off. */
.ua-subsettings {
    margin: .5rem 0 0 1rem;
    padding: .75rem 0 .25rem 1rem;
    border-left: 2px solid var(--ua-line);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .5rem .75rem;
    transition: opacity .16s ease;
}

.ua-switchblock:has(> .ua-toggle input:not(:checked)) .ua-subsettings { opacity: .45; }

@media (prefers-reduced-motion: reduce) {
    .ua-toggle, .ua-toggle__pill, .ua-toggle__pill::after, .ua-subsettings { transition: none; }
}

/*
 * The variants the kit had not mapped.
 *
 * .btn:not(.ua-btn) turns every Bootstrap button into the neutral one, and only .btn-primary
 * and .btn-danger were given a colour back. Everything else -- 19 .btn-success, 4 .btn-info,
 * a .btn-warning -- came out identical to a plain button, so a row of three actions read as
 * one action and two blanks. Worse on the floor-plan list, where the Copy button also
 * carried .text-white: a white icon on a white button is an empty box, which is exactly
 * what it looked like.
 *
 * Same treatment as .btn-danger: the kit's own button with the variant's colour on the
 * content, not a filled rectangle, so a row of actions stays quiet until it is pointed at.
 */
.ua-page .btn.btn-info:not(.ua-btn):not(.btn-close),
.ua-page .btn.btn-success:not(.ua-btn):not(.btn-close) {
    background: var(--ua-card);
    border-color: var(--ua-line-strong);
    color: var(--ua-accent-ink);
}

.ua-page .btn.btn-info:not(.ua-btn):not(.btn-close):hover,
.ua-page .btn.btn-success:not(.ua-btn):not(.btn-close):hover {
    background: var(--ua-accent-wash);
    border-color: var(--ua-accent);
    color: var(--ua-accent-ink);
}

.ua-page .btn.btn-warning:not(.ua-btn):not(.btn-close) {
    background: var(--ua-card);
    border-color: var(--ua-line-strong);
    color: #b45309;
}

.ua-page .btn.btn-warning:not(.ua-btn):not(.btn-close):hover {
    background: #fff7ed;
    border-color: #b45309;
    color: #b45309;
}

/* A file field whose file is gone: named, but not offered as a link that cannot open. */
.ua-currentfile__gone {
    color: var(--ua-down);
    text-decoration: line-through;
    text-decoration-thickness: 1px;
}

/*
 * A filter band whose buttons need room.
 *
 * The projects list has five filters and three buttons (Clear, Export, Import). In the grid above,
 * the buttons sat in one cell the width of a single filter, so on a wide screen they ran out of the
 * card on the right and the band overlapped the line under it. As a wrapping row, every filter
 * takes what is left, the buttons keep their own width and sit at the right end of the last line,
 * and nothing can leave the card. Opt in with .ua-filters--flow; the other screens keep the grid.
 */
.ua-filters--flow {
    display: flex;
    flex-wrap: wrap;
}

.ua-filters--flow > div { flex: 1 1 10rem; min-width: 0; }
.ua-filters--flow > div:first-child { flex: 2 1 16rem; }
.ua-filters--flow > .ua-filters__actions { flex: 0 0 auto; margin-left: auto; flex-wrap: wrap; }
.ua-filters--flow .ua-btn { white-space: nowrap; }

/* ------------------------------------------------------ project warning bar */

/* The "check before visitors see it" notice on a project: full width, full text, in the page
   flow. It was a card in the sticky rail, which clipped it. */
.ua-warnbar {
    display: flex;
    gap: .85rem;
    align-items: flex-start;
    margin-bottom: 1rem;
    padding: .85rem 1.1rem;
    border: 1px solid #f5d9a8;
    border-left: 4px solid #d97706;
    border-radius: var(--ua-r, 12px);
    background: #fffaf0;
    color: #78350f;
}

.ua-warnbar__icon { color: #d97706; font-size: 1.15rem; line-height: 1.6; }
.ua-warnbar__body { flex: 1 1 auto; min-width: 0; }
.ua-warnbar__title { font-size: .9rem; font-weight: 600; }

.ua-warnbar__live {
    margin-left: .5rem;
    padding: .1rem .5rem;
    border-radius: 999px;
    background: #fde7c3;
    font-size: .68rem;
    font-weight: 600;
    letter-spacing: .04em;
    text-transform: uppercase;
}

.ua-warnbar__list { margin: .4rem 0 0; padding: 0; list-style: none; font-size: .84rem; }

.ua-warnbar__list li {
    display: flex;
    gap: .75rem;
    justify-content: space-between;
    align-items: baseline;
    padding: .3rem 0;
    border-top: 1px solid #f5e3c0;
}

.ua-warnbar__list li:first-child { border-top: 0; }
.ua-warnbar__list a { flex: 0 0 auto; color: #b45309; font-weight: 600; text-decoration: none; }
.ua-warnbar__list a:hover { text-decoration: underline; }

@media (prefers-color-scheme: dark) {
    .ua-warnbar { background: #2b2113; border-color: #5a4217; color: #f3d9a6; }
    .ua-warnbar__live { background: #4a3514; }
    .ua-warnbar__list li { border-color: #4a3514; }
    .ua-warnbar__list a { color: #fbbf24; }
}

/* ------------------------------------------------------- projects list rows */

/* Live projects whose data looks wrong or is missing, tinted in the list so they can be found
   by looking rather than by opening each one. */
.ua-table tbody tr.ua-row--wrong > td { background: #fffaf0; }
.ua-table tbody tr.ua-row--missing > td { background: #f5f8ff; }
.ua-table tbody tr.ua-row--wrong > td:first-child { box-shadow: inset 3px 0 0 #d97706; }
.ua-table tbody tr.ua-row--missing > td:first-child { box-shadow: inset 3px 0 0 #6b93e6; }

.ua-rowflag { max-width: 270px; white-space: normal; margin-top: .2rem; font-size: .74rem; line-height: 1.35; }
.ua-rowflag--wrong { color: #b45309; }
.ua-rowflag--missing { color: #1d4ed8; }
.ua-rowflag--working { color: #15803d; font-weight: 600; }

.ua-rowflag__dot, .ua-legend__dot {
    display: inline-block;
    width: .5rem;
    height: .5rem;
    margin-right: .25rem;
    border-radius: 50%;
    background: #22c55e;
    box-shadow: 0 0 0 0 rgba(34, 197, 94, .6);
    animation: ua-rowflag-pulse 1.8s infinite;
}

@keyframes ua-rowflag-pulse {
    70% { box-shadow: 0 0 0 .4rem rgba(34, 197, 94, 0); }
    100% { box-shadow: 0 0 0 0 rgba(34, 197, 94, 0); }
}

.ua-legend { display: flex; flex-wrap: wrap; gap: .4rem 1.1rem; align-items: center; }
.ua-legend__swatch { display: inline-block; width: .8rem; height: .8rem; margin-right: .3rem; border-radius: 3px; vertical-align: -1px; }
.ua-legend__swatch--wrong { background: #fde7c3; border: 1px solid #d97706; }
.ua-legend__swatch--missing { background: #dbe6fb; border: 1px solid #6b93e6; }

@media (prefers-color-scheme: dark) {
    .ua-table tbody tr.ua-row--wrong > td { background: #2b2113; }
    .ua-table tbody tr.ua-row--missing > td { background: #172033; }
    .ua-rowflag--wrong { color: #fbbf24; }
    .ua-rowflag--missing { color: #93b4f5; }
    .ua-rowflag--working { color: #4ade80; }
}

/* ------------------------------------------------- quick-add category chips */

/* A tickable pill: the kinds of place to look for on a project's Neighbourhoods tab. */
.ua-chip-choice {
    display: inline-flex;
    align-items: center;
    padding: .3rem .75rem;
    border: 1px solid var(--ua-line, #e5e7eb);
    border-radius: 999px;
    background: var(--ua-card, #fff);
    font-size: .85rem;
    cursor: pointer;
}

.ua-chip-choice:has(input:checked) { border-color: var(--ua-accent, #2563eb); background: var(--ua-accent-wash, #eff4ff); }

/* A figure card that is switched on as a filter, and the dot that says somebody is online. */
a.ua-kpi.is-on { border-color: var(--ua-accent); box-shadow: 0 0 0 1px var(--ua-accent), var(--ua-shadow); }
.ua-online-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--ua-line); vertical-align: middle; }
.ua-online-dot.is-live { background: var(--ua-up); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ua-up) 25%, transparent); }
.ua-up { color: var(--ua-up); }

/* The "last edited by" line under the heading of a plain editor screen. */
.ua-lastedit { display: flex; flex-wrap: wrap; align-items: center; gap: .4rem .6rem; margin: -.25rem 0 1rem; font-size: .8125rem; color: var(--ua-text); }
.ua-lastedit i { color: var(--ua-muted); margin-right: .15rem; }
.ua-down { color: var(--ua-down); font-weight: 600; }

/* password-reveal.js wraps a password box that shares its parent with a label or hint; Bootstrap's error
   text is found as the box's sibling, so it is shown from the wrapper instead. */
.ua-pw-wrap:has(> .is-invalid) ~ .invalid-feedback { display: block; }
