/*  The admin's frame and the SuperAdmin pages: the top bar's wordmark, the SuperAdmin tab row, the dashboard,
    the list of every site and the settings. In the content workspace's world (content-workspace.css): the same
    canvas, panels, accent and live cyan, so the SuperAdmin pages read as the same product as the owner's.
    Linked after admin.css and content-workspace.css, whose rules it leaves alone.  */

/* ---------------------------------------------------------------- frame --- */

.admin-nav .admin-brand {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    color: #ffffff;
    font-size: 1.2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-decoration: none;
}

.admin-nav .admin-brand:hover { color: #ffffff; }

.admin-brand__dot {
    width: 7px;
    height: 7px;
    margin: 0 0 0.55em 2px;
    border-radius: 50%;
    background: #63f0f9;
    box-shadow: 0 0 10px rgba(99, 240, 249, 0.7);
}

/* ------------------------------------------------------------ the area --- */

.sa {
    --edge: rgba(255, 255, 255, 0.08);
    --edge-strong: rgba(255, 255, 255, 0.16);
    --ink: #ffffff;
    --ink-dim: #b9b6cd;
    --ink-faint: #8f8aa8;
    --accent: #87b1d6;
    --accent-bright: #b0daff;
    --live: #63f0f9;
    --error: #ff9c9c;
    --warning: #ffcf7a;
    --surface: rgba(255, 255, 255, 0.04);
    --panel: rgba(12, 10, 28, 0.55);
    --raised: linear-gradient(to bottom, #533e7e, #3c3666);
    --active: linear-gradient(to bottom, #63358d, #7d3d7b);
    /* the providers' series, checked apart for colour-blind readers on this panel (dataviz validator, dark) */
    --series-1: #17a2b0;
    --series-2: #5b6fe0;
    --series-3: #d55181;
    --series-other: #6d6889;

    display: flex;
    flex-direction: column;
    gap: 18px;
    max-width: 1480px;
    margin: 0 auto;
    padding: 4px 4px 40px;
    color: var(--ink);
    text-align: left;
    font-size: 0.9rem;
}

/* only the tab row, above a page of its own design */
.sa--bare { padding-bottom: 12px; }

.sa *,
.sa *::before,
.sa *::after { box-sizing: border-box; }

.sa ::selection { background: rgba(135, 177, 214, 0.35); color: #ffffff; }

.sa :focus-visible {
    outline: 2px solid var(--accent-bright);
    outline-offset: 2px;
}

.sa p { margin: 0; font-size: inherit; text-align: left; }

/* one row, scrolled sideways on a narrow screen rather than wrapped over the page's title */
.sa-tabs {
    display: flex;
    gap: 4px;
    padding-bottom: 12px;
    border-bottom: 1px solid var(--edge);
    overflow-x: auto;
    scrollbar-width: none;
    /* the row's end fades, so a tab beyond the edge shows that the row goes on */
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 40px), transparent);
}

.sa-tabs::-webkit-scrollbar { display: none; }

/* a little room after the last tab, so it can scroll clear of the fade */
.sa-tabs::after { content: ""; flex: 0 0 32px; }

.sa-tabs a {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 7px 14px;
    border-radius: 10px;
    color: var(--ink-dim);
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 150ms ease, color 150ms ease;
}

.sa-tabs a:hover { background: var(--surface); color: var(--ink); }

.sa-tabs a.active {
    background: var(--active);
    color: var(--ink);
    box-shadow: 0 6px 18px -10px rgba(125, 61, 123, 0.9);
}

.sa-head {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.sa-head h1 {
    margin: 0;
    font-size: 1.75rem;
    font-weight: 600;
    letter-spacing: -0.02em;
}

.sa-head__note {
    max-width: 75ch;
    margin-top: 2px !important;
    color: var(--ink-faint);
    font-size: 0.82rem !important;
}

/* the period switch, and any other one-of-a-few choice */
.sa-seg {
    display: inline-flex;
    padding: 3px;
    border: 1px solid var(--edge-strong);
    border-radius: 12px;
    background: var(--surface);
}

.sa-seg button {
    flex: 0 0 auto;
    white-space: nowrap;
    padding: 6px 14px;
    border: 0;
    border-radius: 9px;
    background: transparent;
    color: var(--ink-dim);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 150ms ease, color 150ms ease;
}

.sa-seg button:hover { color: var(--ink); background: rgba(255, 255, 255, 0.06); }

.sa-seg button[aria-pressed="true"] {
    background: var(--accent);
    color: #0b1020;
    font-weight: 600;
}

.sa-panel {
    min-width: 0;
    border: 1px solid var(--edge);
    border-radius: 20px;
    background: var(--panel);
    box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 40px -30px rgba(0, 0, 0, 0.9);
}

.sa-panel__head {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    justify-content: space-between;
    gap: 8px 14px;
    padding: 16px 20px 0;
}

.sa-panel__head h2 {
    margin: 0;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--ink-dim);
}

.sa-panel__meta { color: var(--ink-faint); font-size: 0.78rem; }

.sa-panel__body { padding: 14px 20px 18px; }

.sa-link {
    color: var(--accent-bright);
    text-decoration: none;
    font-size: 0.82rem;
}

.sa-link:hover { text-decoration: underline; text-underline-offset: 3px; }

.sa-hint { color: var(--ink-faint); font-size: 0.8rem; line-height: 1.5; }

.sa-loading { transition: opacity 200ms ease; }
.sa-loading[aria-busy="true"] { opacity: 0.55; }

/* ---------------------------------------------------------- dashboard --- */

.sa-tiles {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 16px;
}

@media (max-width: 1200px) { .sa-tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 640px) { .sa-tiles { grid-template-columns: minmax(0, 1fr); } }

.sa-tile {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 16px 18px 14px;
    color: inherit;
    text-decoration: none;
    transition: border-color 150ms ease, transform 150ms ease;
}

a.sa-tile:hover { border-color: var(--edge-strong); }

.sa-tile__label { color: var(--ink-dim); font-size: 0.82rem; }

.sa-tile__value {
    font-size: 2.1rem;
    font-weight: 600;
    letter-spacing: -0.02em;
    line-height: 1.15;
}

.sa-tile__value small { font-size: 0.95rem; font-weight: 500; color: var(--ink-dim); letter-spacing: 0; margin-left: 4px; }

.sa-tile__value--bad { color: var(--error); }
.sa-tile__value--good { color: var(--live); }

.sa-tile__detail { color: var(--ink-faint); font-size: 0.8rem; min-height: 1.2em; }

.sa-delta { font-size: 0.8rem; color: var(--ink-dim); }
.sa-delta b { font-weight: 600; }
.sa-delta--good b { color: var(--live); }
.sa-delta--bad b { color: var(--error); }

/* a tile's history: a bar per day, the value on hover */
.sa-history {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 1px;
    height: 36px;
    margin-top: 10px;
    border-bottom: 1px solid var(--edge-strong);
}

.sa-history__day {
    position: relative;
    flex: 1 1 0;
    height: 100%;
    display: flex;
    align-items: flex-end;
}

.sa-history__day i {
    display: block;
    width: 100%;
    max-width: 14px;
    margin: 0 auto;
    min-height: 0;
    border-radius: 2px 2px 0 0;
    background: var(--history, var(--live));
    opacity: 0.85;
    transition: opacity 150ms ease;
}

.sa-history__day:hover i { opacity: 1; filter: brightness(1.2); }

.sa-history--error { --history: var(--error); }
.sa-history--live { --history: var(--live); }
.sa-history--accent { --history: var(--accent); }

.sa-tip {
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    z-index: 5;
    min-width: max-content;
    padding: 7px 10px;
    border: 1px solid var(--edge-strong);
    border-radius: 10px;
    background: #1b1733;
    box-shadow: 0 12px 28px -12px rgba(0, 0, 0, 0.9);
    color: var(--ink-dim);
    font-size: 0.75rem;
    line-height: 1.4;
    text-align: left;
    white-space: nowrap;
    transform: translateX(-50%);
    pointer-events: none;
    /* out of the layout while hidden, so a tip near the edge never widens the page */
    display: none;
}

.sa-tip b { display: block; color: var(--ink); font-size: 0.85rem; font-weight: 600; }

.sa-history__day:hover .sa-tip,
.sa-column:hover .sa-tip,
.sa-column:focus-visible .sa-tip { display: block; }

/* the days near either end open their tip inward */
.sa-history__day:nth-child(-n+3) .sa-tip,
.sa-column:nth-of-type(-n+3) .sa-tip { left: 0; transform: none; }
.sa-history__day:nth-last-child(-n+3) .sa-tip,
.sa-column:nth-last-of-type(-n+3) .sa-tip { left: auto; right: 0; transform: none; }

/* the sites tile: how the sites divide between their own domain, SeemGen and drafts */
.sa-mix {
    display: flex;
    gap: 2px;
    height: 10px;
    margin-top: 16px;
    border-radius: 5px;
    overflow: hidden;
}

.sa-mix span { min-width: 0; }

.sa-mix__key {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 4px 6px;
    margin-top: 8px;
    color: var(--ink-faint);
    font-size: 0.74rem;
}

.sa-mix__key i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-left: 6px; }
.sa-mix__key i:first-child { margin-left: 0; }

.sa-row {
    display: grid;
    grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
    gap: 16px;
}

@media (max-width: 1100px) { .sa-row { grid-template-columns: minmax(0, 1fr); } }

/* model calls per day, stacked by provider, the period before as a line */
.sa-chart {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    grid-template-rows: 160px auto;
    column-gap: 8px;
    margin-top: 6px;
}

.sa-chart__axis {
    position: relative;
    color: var(--ink-faint);
    font-size: 0.72rem;
    font-variant-numeric: tabular-nums;
    text-align: right;
}

.sa-chart__axis span { position: absolute; right: 0; transform: translateY(50%); }

.sa-chart__plot {
    position: relative;
    display: flex;
    align-items: flex-end;
    gap: 2px;
    border-bottom: 1px solid #4a4566;
}

.sa-chart__grid {
    position: absolute;
    left: 0;
    right: 0;
    height: 1px;
    background: rgba(255, 255, 255, 0.07);
    pointer-events: none;
}

.sa-chart__ghost {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
}

.sa-chart__ghost polyline {
    fill: none;
    stroke: rgba(255, 255, 255, 0.4);
    stroke-width: 2;
    stroke-linejoin: round;
    stroke-linecap: round;
    vector-effect: non-scaling-stroke;
}

.sa-column {
    position: relative;
    flex: 1 1 0;
    height: 100%;
    display: flex;
    flex-direction: column-reverse;
    align-items: center;
    gap: 2px;
    outline-offset: 0;
}

.sa-column:hover { background: rgba(255, 255, 255, 0.03); }

.sa-column i {
    display: block;
    width: 100%;
    max-width: 24px;
    flex: 0 0 auto;
}

.sa-column i:last-of-type { border-radius: 4px 4px 0 0; }

.sa-tip__row { display: flex; align-items: center; gap: 8px; color: var(--ink-dim); }
.sa-tip__row em { display: inline-block; width: 12px; height: 2px; border-radius: 1px; }
.sa-tip__row strong { margin-left: auto; padding-left: 14px; color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.sa-chart__days {
    grid-column: 2;
    display: flex;
    justify-content: space-between;
    padding-top: 6px;
    color: var(--ink-faint);
    font-size: 0.72rem;
}

.sa-legend {
    display: flex;
    flex-wrap: wrap;
    gap: 6px 18px;
    margin-top: 10px;
    color: var(--ink-dim);
    font-size: 0.8rem;
}

.sa-legend span { display: inline-flex; align-items: center; gap: 7px; }
.sa-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; }
.sa-legend i.sa-legend__line { width: 14px; height: 2px; border-radius: 1px; background: rgba(255, 255, 255, 0.4); }
.sa-legend b { color: var(--ink); font-weight: 600; font-variant-numeric: tabular-nums; }

.sa-table-view { margin-top: 12px; }
.sa-table-view summary { color: var(--accent-bright); font-size: 0.8rem; cursor: pointer; }
.sa-table-view summary:hover { text-decoration: underline; text-underline-offset: 3px; }
.sa-table-view[open] .sa-table { margin-top: 8px; max-height: 260px; overflow-y: auto; display: block; }

/* the latest errors */
.sa-events { list-style: none; margin: 0; padding: 0; }

.sa-events li {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr);
    gap: 4px 10px;
    padding: 10px 0;
    border-top: 1px solid var(--edge);
}

.sa-events li:first-child { border-top: 0; padding-top: 2px; }

.sa-events__dot {
    width: 8px;
    height: 8px;
    margin-top: 6px;
    border-radius: 50%;
    background: var(--error);
}

/* a line each; the whole message on hover, and in the log */
.sa-events__text {
    min-width: 0;
    color: var(--ink);
    font-size: 0.84rem;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.sa-events__when { grid-column: 2; color: var(--ink-faint); font-size: 0.75rem; }

.sa-checks { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.sa-checks li { display: flex; gap: 10px; align-items: baseline; color: var(--ink-dim); font-size: 0.84rem; }
.sa-checks i { flex: 0 0 auto; font-size: 0.8rem; }
.sa-checks .fa-circle-check { color: var(--live); }
.sa-checks .fa-triangle-exclamation { color: var(--warning); }
.sa-checks .fa-circle-xmark { color: var(--error); }

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

.sa-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}

.sa-table th {
    padding: 8px 10px;
    border-bottom: 1px solid var(--edge-strong);
    color: var(--ink-faint);
    font-size: 0.74rem;
    font-weight: 600;
    text-align: left;
    white-space: nowrap;
}

.sa-table td {
    padding: 10px;
    border-bottom: 1px solid var(--edge);
    color: var(--ink-dim);
    vertical-align: middle;
}

.sa-table tbody tr { transition: background 150ms ease; }
.sa-table tbody tr:hover { background: rgba(255, 255, 255, 0.03); }

.sa-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.sa-table th.num { text-align: right; }
.sa-table .num .sa-chip { margin-left: 6px; }
.sa-unpriced { display: block; color: var(--ink-faint); font-size: 0.72rem; }

.sa-count {
    margin-left: 4px;
    color: inherit;
    opacity: 0.7;
    font-variant-numeric: tabular-nums;
}

.sa-table th button {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0;
    border: 0;
    background: none;
    color: inherit;
    font: inherit;
    cursor: pointer;
}

.sa-table th button:hover { color: var(--ink); }
.sa-table th[aria-sort] button { color: var(--ink); }
.sa-table th .fa-solid { font-size: 0.65rem; }

.sa-site {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.sa-site__mark {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 10px;
    background: var(--raised);
    color: var(--ink);
    font-size: 0.85rem;
    font-weight: 700;
    overflow: hidden;
}

.sa-site__mark { position: relative; }

/* the logo over the site's initial, which shows when the logo does not load */
.sa-site__mark img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: rgba(255, 255, 255, 0.92);
    padding: 3px;
}



.sa-site__text { display: flex; flex-direction: column; min-width: 0; }
.sa-site__name { color: var(--ink); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-site__addr { color: var(--ink-faint); font-size: 0.76rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.sa-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 2px 10px;
    border: 1px solid var(--edge-strong);
    border-radius: 999px;
    color: var(--ink-dim);
    font-size: 0.74rem;
    white-space: nowrap;
}

.sa-chip--own { border-color: rgba(99, 240, 249, 0.4); color: var(--live); }
.sa-chip--published { border-color: rgba(176, 218, 255, 0.35); color: var(--accent-bright); }
.sa-chip--warn { border-color: rgba(255, 207, 122, 0.4); color: var(--warning); }
.sa-chip--bad { border-color: rgba(255, 156, 156, 0.45); color: var(--error); }

.sa-bar {
    display: inline-block;
    height: 6px;
    margin-right: 8px;
    border-radius: 3px;
    background: var(--live);
    vertical-align: middle;
}

.sa-actions { display: flex; gap: 6px; justify-content: flex-end; white-space: nowrap; }

.sa-actions a {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: 1px solid var(--edge);
    border-radius: 9px;
    color: var(--ink-dim);
    transition: background 150ms ease, color 150ms ease, border-color 150ms ease;
}

.sa-actions a:hover { background: rgba(255, 255, 255, 0.08); border-color: var(--accent); color: var(--ink); }

/* --------------------------------------------------------- sites list --- */

.sa-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
}

.sa-input {
    min-width: 0;
    padding: 8px 12px;
    border: 1px solid var(--edge-strong);
    border-radius: 12px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.85rem;
    transition: border-color 150ms ease, background 150ms ease;
}

.sa-input::placeholder { color: var(--ink-faint); }
.sa-input:focus { outline: none; border-color: var(--accent); background: rgba(135, 177, 214, 0.08); }

.sa-search { position: relative; flex: 1 1 260px; max-width: 360px; }
.sa-toolbar .sa-seg { max-width: 100%; overflow-x: auto; }
.sa-search .sa-input { width: 100%; padding-left: 34px; }
.sa-search i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-faint); font-size: 0.8rem; }

.sa-scroll { overflow-x: auto; }

.sa-empty {
    padding: 36px 20px;
    color: var(--ink-dim);
    text-align: center;
}

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

.sa-settings { display: flex; flex-direction: column; gap: 16px; }

.sa-setting {
    display: grid;
    grid-template-columns: minmax(0, 1.1fr) minmax(0, 1.4fr) auto;
    gap: 8px 18px;
    align-items: center;
    padding: 14px 20px;
    border-top: 1px solid var(--edge);
}

@media (max-width: 900px) { .sa-setting { grid-template-columns: minmax(0, 1fr); } }

.sa-setting__key { color: var(--ink); font-weight: 600; font-size: 0.86rem; overflow-wrap: anywhere; }
.sa-setting__desc { margin-top: 2px !important; color: var(--ink-faint); font-size: 0.78rem; line-height: 1.45; }

.sa-setting__value { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.sa-setting__now { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; color: var(--ink-dim); font-size: 0.8rem; }
.sa-setting__shown { color: var(--ink); font-size: 0.82rem; overflow-wrap: anywhere; }
.sa-setting__edit { display: flex; gap: 8px; }
.sa-setting__edit .sa-input { flex: 1 1 auto; }

.sa-setting__note { color: var(--ink-faint); font-size: 0.75rem; }
.sa-setting__problem { color: var(--error); font-size: 0.78rem; }

.sa-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 7px;
    padding: 7px 12px;
    border: 1px solid var(--edge-strong);
    border-radius: 10px;
    background: var(--surface);
    color: var(--ink);
    font: inherit;
    font-size: 0.8rem;
    white-space: nowrap;
    cursor: pointer;
    transition: background 150ms ease, border-color 150ms ease;
}

.sa-btn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.09); border-color: var(--accent); }
.sa-btn:disabled { opacity: 0.45; cursor: default; }
.sa-btn--primary { border-color: transparent; background: var(--accent); color: #0b1020; font-weight: 600; }
.sa-btn--primary:hover:not(:disabled) { background: var(--accent-bright); }
.sa-btn--danger { color: var(--error); border-color: rgba(255, 156, 156, 0.35); }
.sa-btn--danger:hover:not(:disabled) { background: rgba(255, 92, 92, 0.12); border-color: rgba(255, 156, 156, 0.6); }

.sa-notice {
    display: flex;
    gap: 10px;
    align-items: baseline;
    padding: 12px 16px;
    border: 1px solid rgba(255, 156, 156, 0.4);
    border-radius: 14px;
    background: rgba(255, 92, 92, 0.08);
    color: #ffd0d0;
    font-size: 0.84rem;
}

.sa-notice--calm { border-color: var(--edge-strong); background: var(--surface); color: var(--ink-dim); }

/* the quiet scrollbar the workspace's panels use, here too */
.sa ::-webkit-scrollbar { width: 10px; height: 10px; }
.sa ::-webkit-scrollbar-track { background: transparent; }
.sa ::-webkit-scrollbar-thumb {
    background-color: rgba(255, 255, 255, 0.16);
    border: 3px solid transparent;
    background-clip: content-box;
    border-radius: 999px;
}

/* ------------------------------------------------------------- motion --- */

/* the one moment: a period's bars rise from their baseline when it is read, in the tiles and the chart alike */
@keyframes sa-rise {
    from { transform: scaleY(0.12); opacity: 0.4; }
    to { transform: scaleY(1); opacity: 1; }
}

.sa-history__day i,
.sa-column {
    transform-origin: bottom;
    animation: sa-rise 420ms cubic-bezier(0.16, 1, 0.3, 1) both;
}

@media (prefers-reduced-motion: reduce) {
    .sa-history__day i,
    .sa-column { animation: none; }
}

/* ------------------------------------------------------- narrow screens --- */

@media (max-width: 640px) {
    /* the figures before what draws them: a phone keeps the numbers and loses the owner, content counts and bars */
    .sa-hide-narrow,
    .sa-bar { display: none; }
}