/*
 * SignFlow Admin — enterprise administration console.
 *
 * No external font, image or stylesheet: the Content-Security-Policy allows
 * 'self' only, so every asset is served from this WAR. No inline style and no
 * inline script anywhere in the pages, which is what lets the policy stay
 * strict rather than needing 'unsafe-inline'.
 *
 * Status colour is data-driven: a row renders <span class="pill s-active">,
 * and the s-* classes below decide what that looks like. Adding a status to
 * the platform therefore degrades to a neutral pill instead of breaking the
 * page.
 */

:root {
    --navy:        #0f2144;
    --navy-mid:    #1b3566;
    --navy-soft:   #2a4a86;
    --orange:      #f07c1f;
    --orange-dark: #d3660d;
    --ground:      #f4f6f9;
    --white:       #ffffff;
    --line:        #dfe4ec;
    --line-soft:   #eef1f6;
    --text:        #1d2330;
    --muted:       #5f6a7d;
    --ok:          #1f7a4d;
    --ok-bg:       #e6f4ec;
    --warn:        #a8690a;
    --warn-bg:     #fdf1de;
    --bad:         #b3261e;
    --bad-bg:      #fdeceb;
    --info:        #1b5fa8;
    --info-bg:     #e8f0fa;
    --radius:      6px;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    margin: 0;
    font-family: "Segoe UI", Tahoma, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text);
    background: var(--ground);
}

a { color: var(--navy-soft); text-decoration: none; }
a:hover { color: var(--orange-dark); text-decoration: underline; }

.mono {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
}

code {
    font-family: Consolas, "Courier New", monospace;
    font-size: 12px;
    color: var(--muted);
    word-break: break-all;
}

.skiplink {
    position: absolute;
    left: -9999px;
}
.skiplink:focus {
    left: 8px;
    top: 8px;
    z-index: 10;
    background: var(--white);
    padding: 8px 12px;
    border-radius: var(--radius);
}

/* --- masthead ------------------------------------------------------- */

.masthead {
    background: var(--navy);
    color: var(--white);
    padding: 0 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    min-height: 54px;
}
.brand { font-size: 17px; font-weight: 600; letter-spacing: .2px; }
.brand .accent { color: var(--orange); font-weight: 400; }
.whoami { font-size: 12px; color: #c8d2e4; display: flex; align-items: center; gap: 10px; }
.whoami .who { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.whoami .role {
    display: inline-block;
    background: var(--orange);
    color: var(--navy);
    border-radius: 3px;
    padding: 2px 7px;
    font-weight: 600;
    font-size: 11px;
    letter-spacing: .3px;
}
.whoami a { color: var(--white); }

/* --- navigation ----------------------------------------------------- */

.mainnav {
    background: var(--navy-mid);
    padding: 0 12px;
    display: flex;
    flex-wrap: wrap;
}
.mainnav a {
    color: #d5deee;
    padding: 11px 14px;
    font-size: 13px;
    border-bottom: 3px solid transparent;
}
.mainnav a:hover { color: var(--white); text-decoration: none; background: var(--navy-soft); }
.mainnav a.active { color: var(--white); border-bottom-color: var(--orange); font-weight: 600; }

.subnav {
    background: var(--navy-soft);
    padding: 0 16px;
    display: flex;
    flex-wrap: wrap;
}
.subnav a { color: #e2e9f5; padding: 7px 12px; font-size: 12px; }
.subnav a:hover { color: var(--white); text-decoration: underline; }

/* --- layout --------------------------------------------------------- */

.wrap {
    max-width: 1380px;
    margin: 0 auto;
    padding: 20px 20px 48px;
}

h1 { font-size: 21px; margin: 4px 0 2px; font-weight: 600; }
h2 { font-size: 15px; margin: 0 0 12px; font-weight: 600; }
h3 { font-size: 13px; margin: 0 0 8px; font-weight: 600; color: var(--muted);
     text-transform: uppercase; letter-spacing: .5px; }

.sub { color: var(--muted); margin: 0 0 18px; font-size: 13px; }

.crumbs { font-size: 12px; color: var(--muted); margin: 0 0 10px; }
.crumbs a { color: var(--muted); }

.corr { color: var(--muted); font-size: 11px; margin-top: 26px; }

/* --- panels --------------------------------------------------------- */

.panel {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 16px;
    margin-bottom: 16px;
}
.panel.tablewrap { padding: 0; overflow-x: auto; }
/* Layout helpers: the console's CSP is style-src 'self', so inline style=""
   attributes are refused by the browser -- use these instead. */
.panel-head { padding: 14px 16px 0; }
.panel-note { padding: 0 16px; }
.panel.panel-pad { padding: 14px 16px; }
.spaced-top { margin-top: 18px; }
.spaced-bottom { margin-bottom: 18px; }
.inline-form { display: inline; }
.subnav.subnav-tight { margin-top: -8px; }
.toolbar.toolbar-spaced { margin-bottom: 14px; }
.panel.panel-form { padding: 14px 16px; margin-bottom: 14px; }
.spaced-top-sm { margin-top: 10px; }
/* A panel heading with a small control (e.g. the dashboard sort) on its right;
   wraps under the heading on narrow screens. */
.panel-titlebar { display: flex; flex-wrap: wrap; justify-content: space-between;
                  align-items: flex-end; gap: 8px 12px; margin-bottom: 12px; }
.panel-titlebar h2 { margin: 0; }
.sortform { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 6px; }
.prewrap { white-space: pre-wrap; }

.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-6 { grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); }

/* --- stat tiles ----------------------------------------------------- */

.stat {
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 14px 16px;
}
.stat .label {
    font-size: 11px;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .5px;
}
.stat .value { font-size: 26px; font-weight: 600; line-height: 1.2; margin-top: 2px; }
.stat .value.small { font-size: 18px; }
.stat.accent { border-left: 3px solid var(--orange); }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }

/* Compact count list inside a panel. */
.counts { list-style: none; margin: 0; padding: 0; }
.counts li {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid var(--line-soft);
    font-size: 13px;
}
.counts li:last-child { border-bottom: none; }
.counts .n { font-weight: 600; font-variant-numeric: tabular-nums; }

/* --- definition lists ----------------------------------------------- */

dl.facts { margin: 0; display: grid; grid-template-columns: minmax(140px, 200px) 1fr; gap: 0; }
dl.facts dt {
    color: var(--muted);
    font-size: 12px;
    padding: 6px 12px 6px 0;
    border-bottom: 1px solid var(--line-soft);
}
dl.facts dd {
    margin: 0;
    padding: 6px 0;
    border-bottom: 1px solid var(--line-soft);
    word-break: break-word;
}
dl.facts dt:last-of-type, dl.facts dd:last-of-type { border-bottom: none; }

/* --- tables --------------------------------------------------------- */

table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
    text-align: left;
    background: var(--line-soft);
    color: var(--muted);
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: .5px;
    font-weight: 600;
    padding: 9px 12px;
    border-bottom: 1px solid var(--line);
    white-space: nowrap;
}
tbody td {
    padding: 9px 12px;
    border-bottom: 1px solid var(--line-soft);
    vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #fafbfd; }
th.num, td.num { text-align: right; font-variant-numeric: tabular-nums; }
td.nowrap { white-space: nowrap; }
/* An action column that stays in view while a wide table scrolls sideways
   inside .tablewrap (the User directory is wider than most windows). */
th.col-action, td.col-action {
    position: sticky;
    right: 0;
    background: var(--white);
    box-shadow: -1px 0 0 var(--line);
}
thead th.col-action { background: var(--line-soft); }
tbody tr:hover td.col-action { background: #fafbfd; }

/* --- status pills --------------------------------------------------- */

.pill {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: .3px;
    background: var(--line-soft);
    color: var(--muted);
    white-space: nowrap;
}
.s-active, .s-completed, .s-up, .s-delivered, .s-processed, .s-published,
.s-linked, .s-granted, .s-success, .s-valid, .s-sent { background: var(--ok-bg); color: var(--ok); }

.s-pending, .s-pending_verification, .s-invited, .s-retrying, .s-degraded,
.s-in_progress, .s-authorization_pending, .s-authorization_required,
.s-signing, .s-received, .s-not_configured, .s-locked, .s-superseded,
.s-draft, .s-failed_retryable { background: var(--warn-bg); color: var(--warn); }

.s-suspended, .s-closed, .s-failed, .s-dead, .s-down, .s-unavailable,
.s-declined, .s-revoked, .s-expired, .s-cancelled, .s-removed,
.s-reconciliation_required, .s-denied { background: var(--bad-bg); color: var(--bad); }

.s-created, .s-unlinked, .s-ssa, .s-platform_admin, .s-queued, .s-processing { background: var(--info-bg); color: var(--info); }

/* --- forms and toolbars --------------------------------------------- */

.toolbar {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-end;
    margin-bottom: 14px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
}
.field { display: flex; flex-direction: column; gap: 3px; }
.field label { font-size: 11px; color: var(--muted); text-transform: uppercase;
               letter-spacing: .5px; }
.field.grow { flex: 1 1 240px; }

input[type=text], input[type=password], input[type=date], input[type=number],
select, textarea {
    font: inherit;
    font-size: 13px;
    color: var(--text);
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px 9px;
    min-width: 150px;
}
textarea { min-width: 100%; font-family: Consolas, "Courier New", monospace; font-size: 12px; }
input:focus, select:focus, textarea:focus {
    outline: 2px solid var(--navy-soft);
    outline-offset: -1px;
    border-color: var(--navy-soft);
}

.btn {
    display: inline-block;
    font: inherit;
    font-size: 13px;
    font-weight: 600;
    background: var(--navy);
    color: var(--white);
    border: 1px solid var(--navy);
    border-radius: 4px;
    padding: 7px 14px;
    cursor: pointer;
    text-decoration: none;
}
.btn:hover { background: var(--navy-mid); color: var(--white); text-decoration: none; }
.btn-small { font-size: 12px; padding: 5px 10px; }
.btn-secondary { background: var(--white); color: var(--navy); border-color: var(--line); }
.btn-secondary:hover { background: var(--line-soft); color: var(--navy); }
.btn-danger { background: var(--bad); border-color: var(--bad); }
.btn-danger:hover { background: #8f1e17; }
.btn-disabled {
    background: var(--line-soft); color: #9aa4b3; border-color: var(--line);
    cursor: default; pointer-events: none;
}

.chip {
    display: inline-block;
    border: 1px solid var(--line);
    border-radius: 10px;
    padding: 1px 9px;
    font-size: 11px;
    color: var(--muted);
    background: var(--white);
}
.chip-on { background: var(--navy); border-color: var(--navy); color: var(--white); }
.chip:hover { text-decoration: none; }

.actionbar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-end;
    padding-top: 6px;
}

/* --- flashes and states --------------------------------------------- */

.flash {
    border-radius: var(--radius);
    padding: 10px 14px;
    margin-bottom: 14px;
    font-size: 13px;
    border: 1px solid transparent;
}
.flash-ok  { background: var(--ok-bg);  color: var(--ok);  border-color: #bfe0cd; }
.flash-bad { background: var(--bad-bg); color: var(--bad); border-color: #f0c7c4; }
.flash .mono { display: block; margin-top: 4px; opacity: .8; }

.error, .warning, .empty {
    border-radius: var(--radius);
    padding: 14px 16px;
    margin-bottom: 16px;
    font-size: 13px;
    border: 1px solid var(--line);
    background: var(--white);
}
.error   { background: var(--bad-bg);  color: var(--bad);  border-color: #f0c7c4; }
.warning { background: var(--warn-bg); color: var(--warn); border-color: #f0dcb8; }
.empty   { color: var(--muted); text-align: center; padding: 34px 16px; }

.note {
    background: var(--info-bg);
    border: 1px solid #cfe0f3;
    color: var(--info);
    border-radius: var(--radius);
    padding: 10px 14px;
    font-size: 12.5px;
    margin-bottom: 16px;
}

/* --- pagination ----------------------------------------------------- */

.pager {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    align-items: center;
    justify-content: space-between;
    font-size: 12px;
    color: var(--muted);
    padding: 12px 2px 0;
}
.pager-sizes { display: flex; gap: 5px; align-items: center; }
.pager-nav { display: flex; gap: 6px; }

/* --- trend bars (no script, no canvas) ------------------------------ */

.trend { display: flex; align-items: flex-end; gap: 2px; height: 64px; margin-top: 10px; }
.trend .bar { flex: 1 1 auto; background: var(--navy-soft); border-radius: 2px 2px 0 0; min-height: 2px; }
.trend .bar.b1  { height: 6%; }  .trend .bar.b2  { height: 12%; }
.trend .bar.b3  { height: 18%; } .trend .bar.b4  { height: 24%; }
.trend .bar.b5  { height: 30%; } .trend .bar.b6  { height: 36%; }
.trend .bar.b7  { height: 42%; } .trend .bar.b8  { height: 48%; }
.trend .bar.b9  { height: 54%; } .trend .bar.b10 { height: 60%; }
.trend .bar.b11 { height: 66%; } .trend .bar.b12 { height: 72%; }
.trend .bar.b13 { height: 78%; } .trend .bar.b14 { height: 84%; }
.trend .bar.b15 { height: 90%; } .trend .bar.b16 { height: 100%; }

/* --- login ---------------------------------------------------------- */
/* The sign-in page is the standard ThrivoSign one: thrivosign-login.css (do not restyle it here). */

/* --- identifiers ----------------------------------------------------
 *
 * A UUID is 36 characters and an IPv6 address can be longer. In a table cell
 * narrow enough to fit six of them, the browser breaks them wherever it can --
 * which for a hexadecimal string with no spaces in it is EVERY character. That
 * is what turned the audit table into columns of vertical letters.
 *
 * .idshort  the shortened form already produced by AdminDisplay.shortId; the
 *           complete value is on the element's title attribute.
 * .idfull   the complete value, kept on one line and scrollable rather than
 *           wrapped. Used in detail panels, where the whole thing must be
 *           selectable and copyable.
 * .clipcell one line, ellipsised, full value on hover.
 * ------------------------------------------------------------------- */

code.idshort,
code.idfull,
.nowrapcell,
.clipcell {
    white-space: nowrap;
    word-break: normal;
    overflow-wrap: normal;
}

code.idshort {
    display: inline-block;
    max-width: 12ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    cursor: help;
}

code.idfull {
    display: inline-block;
    max-width: 100%;
    overflow-x: auto;
    vertical-align: bottom;
}

.clipcell {
    display: inline-block;
    max-width: 28ch;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: bottom;
    cursor: help;
}

/* --- audit table -----------------------------------------------------
 *
 * Fixed layout, so one long description cannot re-proportion every other
 * column. The widths are percentages of the table, which keeps the six
 * human-readable columns readable at any window size and leaves the
 * technical record to the expandable panel.
 * ------------------------------------------------------------------- */

table.audit-table { table-layout: fixed; }

table.audit-table .col-time    { width: 15%; }
table.audit-table .col-actor   { width: 17%; }
table.audit-table .col-event   { width: 20%; }
table.audit-table .col-target  { width: 16%; }
table.audit-table .col-detail  { width: 20%; }
table.audit-table .col-outcome { width: 7%; }
table.audit-table .col-expand  { width: 5%; }

table.audit-table td.col-time { font-variant-numeric: tabular-nums; }

table.audit-table .who {
    display: block;
    font-weight: 600;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

table.audit-table .change {
    display: block;
    font-family: Consolas, "Courier New", monospace;
    font-size: 11px;
    color: var(--muted);
}

table.audit-table .desc {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
    cursor: help;
}

.pill-cat {
    background: var(--info-bg);
    color: var(--info);
    margin-left: 4px;
    font-weight: 500;
}

/* --- expandable detail -----------------------------------------------
 *
 * No JavaScript: the console's Content-Security-Policy has no
 * 'unsafe-inline' and the pages carry no script of any kind. Each audit
 * entry is two rows: the summary row, whose last cell holds a hidden
 * checkbox and its "Details" label, and a full-width detail row that is
 * shown while that checkbox is ticked.
 *
 * The panel used to be a <details> inside the 5%-wide last column: a 460px
 * box that overflowed the table, was clipped by .tablewrap and stretched the
 * row. Now it spans every column.
 * ------------------------------------------------------------------- */

.rowdetail-toggle {
    position: absolute;
    opacity: 0;
    width: 1px;
    height: 1px;
    margin: 0;
}
.rowdetail-label {
    cursor: pointer;
    font-size: 11px;
    font-weight: 600;
    color: var(--navy-soft);
    text-transform: uppercase;
    letter-spacing: .4px;
    white-space: nowrap;
    user-select: none;
}
.rowdetail-label::after { content: " \25be"; }
.rowdetail-label:hover { color: var(--orange-dark); }
.rowdetail-toggle:focus-visible + .rowdetail-label {
    outline: 2px solid var(--orange);
    outline-offset: 2px;
}

tr.rowdetail-row { display: none; }
tr:has(.rowdetail-toggle:checked) + tr.rowdetail-row { display: table-row; }
tr:has(.rowdetail-toggle:checked) .rowdetail-label::after { content: " \25b4"; }
tr:has(.rowdetail-toggle:checked) > td { background: #f6f8fb; border-bottom-color: transparent; }
tr.rowdetail-row > td { background: #f6f8fb; padding-top: 0; }
tbody tr.rowdetail-row:hover { background: transparent; }

/* A browser without :has() cannot toggle, so it shows every record open
   rather than hiding them. */
@supports not selector(:has(*)) {
    tr.rowdetail-row { display: table-row; }
    .rowdetail-label { display: none; }
}

.rowdetail-body {
    margin: 0 0 4px;
    padding: 10px 14px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
}

/* Two label/value pairs per line: the full-width row has room for them. */
.rowdetail-body dl.facts.facts-tight {
    grid-template-columns: minmax(110px, 150px) minmax(0, 1fr) minmax(110px, 150px) minmax(0, 1fr);
    column-gap: 16px;
}
.rowdetail-body dd { overflow-wrap: anywhere; }

dl.facts.facts-tight { grid-template-columns: minmax(110px, 150px) 1fr; font-size: 12px; }
dl.facts.facts-tight dt, dl.facts.facts-tight dd { padding: 4px 0; }

/* --- pending-activation callout -------------------------------------- */

.panel.callout { border-left: 4px solid var(--orange); }
.panel.callout-pending { background: #fffdf8; }

.pending-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: flex-start;
}
.pending-actions form.inline { margin: 0; }

details.drawer { flex: 0 1 auto; }
details.drawer > summary {
    cursor: pointer;
    list-style: none;
    display: inline-block;
}
details.drawer > summary::-webkit-details-marker { display: none; }

.drawer-body {
    margin-top: 10px;
    padding: 12px;
    background: var(--white);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    max-width: 620px;
}
.drawer-body .field { margin-bottom: 10px; }
.drawer-body input[type="text"] { width: 100%; }

.btn-primary { background: var(--orange); border-color: var(--orange); }
.btn-primary:hover { background: var(--orange-dark); border-color: var(--orange-dark); }

.btn-danger-outline {
    background: var(--white);
    color: var(--bad);
    border-color: var(--bad);
}
.btn-danger-outline:hover { background: var(--bad-bg); color: var(--bad); }

/* Help line under a settings field (integration settings pages). */
.help { font-size: 12px; color: var(--muted); max-width: 640px; }
.field.wide input[type=text], .field.wide input[type=password],
.field.wide input[type=number], .field.wide select { width: 100%; box-sizing: border-box; max-width: 640px; }
.field.wide { margin-bottom: 14px; }

label.check {
    display: block;
    margin: 8px 0 12px;
    font-size: 13px;
    color: var(--text);
}
label.check input { margin-right: 6px; }
/* Checkbox options inside a filter toolbar: stacked, tight, aligned with the inputs. */
.toolbar .checks { display: flex; flex-direction: column; gap: 4px; }
.toolbar .checks label.check { margin: 0; white-space: nowrap; }

/* --- filter bar ------------------------------------------------------ */

.toolbar.filters .field { min-width: 130px; }
.toolbar.filters .field.grow { flex: 1 1 260px; }
/* Company ID filter: wide enough for a whole 36-character company id, the
   same width on every page that filters by company. */
.field.field-company { flex: 0 1 330px; }
.field.field-company input { width: 100%; min-width: 0; box-sizing: border-box; }

/* --- responsive ----------------------------------------------------- */

@media (max-width: 720px) {
    .wrap { padding: 14px 12px 40px; }
    dl.facts { grid-template-columns: 1fr; }
    dl.facts dt { padding-bottom: 0; border-bottom: none; }
    .masthead { padding: 8px 14px; }
    .toolbar { padding: 10px; }
    /* The fixed audit widths assume room for six columns. Below that, let the
       table scroll inside .tablewrap rather than crushing every column. */
    table.audit-table { table-layout: auto; min-width: 760px; }
    .rowdetail-body dl.facts.facts-tight { grid-template-columns: 1fr; }
    .pending-actions { flex-direction: column; align-items: stretch; }
}

/* --- busy state and "show the secret" (integrations pages; behaviour in js/integrations.js) --------- */

.btn:disabled { opacity: .65; cursor: not-allowed; }
.btn-spin {
    display: none;
    width: 11px;
    height: 11px;
    margin-right: 8px;
    border: 2px solid currentColor;
    border-right-color: transparent;
    border-radius: 50%;
    vertical-align: -1px;
}
.is-busy .btn-spin, .btn.is-busy .btn-spin { display: inline-block; animation: ts-spin .8s linear infinite; }
@keyframes ts-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
    .is-busy .btn-spin, .btn.is-busy .btn-spin { animation: none; border-right-color: currentColor; border-style: dotted; }
}
.busy-status { font-size: 12px; color: var(--muted); min-height: 1.2em; margin: 6px 0 0; }

/* The eye needs the script: without it the whole control stays hidden and the field just says "Configured". */
.secret-view { display: none; }
.js-on .secret-view { display: flex; align-items: center; gap: 8px; max-width: 640px; margin-bottom: 6px; }
.secret-view input[type=password], .secret-view input[type=text] {
    flex: 1 1 auto; min-width: 0; width: auto; background: var(--line-soft);
    font-family: Consolas, "Courier New", monospace;
}
.secret-view .btn-eye { flex: 0 0 auto; line-height: 0; padding: 6px 10px; display: inline-flex; align-items: center; gap: 6px; }
.btn-eye svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2;
               stroke-linecap: round; stroke-linejoin: round; }
.btn-eye .eye-off { display: none; }
.btn-eye[aria-pressed=true] .eye-on { display: none; }
.btn-eye[aria-pressed=true] .eye-off { display: inline; }
.btn-eye .eye-text { font-size: 12px; line-height: 1; }
.btn-eye.is-busy svg { display: none; }
.btn-eye .btn-spin { margin-right: 0; }
.secret-note { font-size: 12px; color: var(--muted); min-height: 1.2em; max-width: 640px; }

/* --- lists: whole width, rows that fit, cards on phones ----------------
 *
 * Owner rule for every list (2026-10-31): the name/identifier is the first
 * column, there is a Created column on primary record lists, the row's action
 * buttons are on screen at every width without scrolling sideways, the list
 * uses the whole page width and at 720px and below each row becomes a card.
 *
 * How: the page is no longer capped at 1380px; table cells may break long
 * values (ids, emails, URLs) anywhere, so the table shrinks to its container
 * instead of overflowing it; low-value columns were merged into a second
 * line (.cell-sub) on the pages themselves. At phone width every cell shows
 * its column name from data-label, which js/list-cells.js copies from the
 * table head (CSP: script-src 'self', so no inline script).
 * ------------------------------------------------------------------- */

.tsp .wrap { max-width: none; }
body.tsp .subnav { max-width: none; }
/* A page title or breadcrumb that is a long file name or hash wraps instead of widening the page. */
.tsp .wrap h1, .tsp .wrap .crumbs { overflow-wrap: anywhere; }
/* Filter forms laid out on .grid: a select with long options never pushes its column past the page. */
.tsp .wrap .grid > * { min-width: 0; }
.tsp .wrap .grid select, .tsp .wrap .grid input { max-width: 100%; }
/* Fact lists (detail pages): a long value (phone, zone, id) wraps inside its column instead of widening the panel. */
.tsp dl.facts dd { min-width: 0; overflow-wrap: anywhere; }
/* Audit: room for the "Details" toggle at every width (was 5%, 2px short at 1366). */
.tsp table.audit-table .col-detail { width: 17%; }
.tsp table.audit-table .col-expand { width: 8%; }

.tsp .tablewrap > table,
.tsp .panel > table { width: 100%; }
/* Whole words at wide widths; ids, hashes and second lines may break anywhere (they are what make a row wide).
   Below 1280px every cell may break anywhere and dates may wrap, so the row always fits. */
.tsp .tablewrap > table th,
.tsp .tablewrap > table td,
.tsp .panel > table th,
.tsp .panel > table td { overflow-wrap: break-word; }
.tsp .tablewrap > table td code:not(.idshort):not(.idfull):not(.clipcell):not(.nowrapcell),
.tsp .panel > table td code:not(.idshort):not(.idfull):not(.clipcell):not(.nowrapcell) { word-break: break-all; }
.tsp .tablewrap > table td .cell-sub, .tsp .panel > table td .cell-sub,
.tsp .tablewrap > table td a:not(.btn), .tsp .panel > table td a:not(.btn),
.tsp .tablewrap > table td.cell-break, .tsp .panel > table td.cell-break { overflow-wrap: anywhere; }
.tsp .tablewrap > table td .btn, .tsp .panel > table td .btn { white-space: nowrap; }

/* Secondary facts merged into a cell: a quieter second line. */
.cell-main { font-weight: 600; }
.cell-sub { display: block; margin-top: 2px; color: var(--muted); font-size: 12px; line-height: 1.4; }
.cell-sub code { font-size: 11px; }
.cell-sub .pill { margin-top: 2px; }
.cell-bad { color: var(--bad); }

/* Row actions: buttons wrap inside their cell, never clipped. */
.tsp td.cell-actions { white-space: normal; text-align: right; }
.tsp td.cell-actions .btn { white-space: nowrap; margin: 2px 0 2px 4px; }
.tsp td.cell-actions form { display: inline-block; margin: 0; }

@media (max-width: 1400px) {
    .tsp .tablewrap > table thead th,
    .tsp .panel > table thead th { white-space: normal; }
}
@media (max-width: 1280px) {
    .tsp .tablewrap > table td, .tsp .panel > table td { overflow-wrap: anywhere; }
    .tsp .tablewrap > table td.nowrap,
    .tsp .tablewrap > table td.nowrapcell,
    .tsp .panel > table td.nowrap { white-space: normal; }
}
@media (max-width: 1100px) {
    .tsp .tablewrap > table thead th, .tsp .tablewrap > table tbody td,
    .tsp .panel > table thead th, .tsp .panel > table tbody td { padding: 8px 8px; }
    .tsp .tablewrap > table thead th, .tsp .panel > table thead th { letter-spacing: .03em; }
    .tsp table.audit-table td.col-time { white-space: normal; }
    .tsp table.audit-table .col-detail { width: 15%; }
    .tsp table.audit-table .col-expand { width: 10%; }
    .tsp table.audit-table .rowdetail-label { white-space: normal; }
}
@media (max-width: 900px) {
    .tsp .tablewrap > table th, .tsp .panel > table th { overflow-wrap: anywhere; }
}

/* Phones: one card per row, each value under its column name. */
@media (max-width: 720px) {
    .tsp .tablewrap > table, .tsp .panel > table:not(.compact-table) {
        display: block; min-width: 0; table-layout: auto; border: 0;
    }
    .tsp .tablewrap > table > thead, .tsp .panel > table:not(.compact-table) > thead { display: none; }
    .tsp .tablewrap > table > tbody, .tsp .panel > table:not(.compact-table) > tbody,
    .tsp .tablewrap > table > tbody > tr, .tsp .panel > table:not(.compact-table) > tbody > tr {
        display: block; width: auto;
    }
    .tsp .tablewrap > table > tbody > tr, .tsp .panel > table:not(.compact-table) > tbody > tr {
        margin: 10px 12px; padding: 4px 12px;
        background: var(--white); border: 1px solid var(--line); border-radius: var(--radius);
        box-shadow: 0 2px 8px rgba(11, 42, 85, .06);
    }
    .tsp .panel > table:not(.compact-table) > tbody > tr { margin: 10px 0; }
    .tsp .tablewrap > table > tbody > tr > td, .tsp .panel > table:not(.compact-table) > tbody > tr > td {
        display: grid; grid-template-columns: minmax(6.5rem, 34%) minmax(0, 1fr); column-gap: 10px; align-items: start;
        padding: 6px 0; border-bottom: 1px solid var(--line-soft); text-align: left; white-space: normal;
    }
    .tsp .tablewrap > table > tbody > tr > td:last-child,
    .tsp .panel > table:not(.compact-table) > tbody > tr > td:last-child { border-bottom: 0; }
    .tsp .tablewrap > table > tbody > tr > td::before,
    .tsp .panel > table:not(.compact-table) > tbody > tr > td::before {
        content: attr(data-label); grid-column: 1; grid-row: 1 / span 9;
        color: var(--muted); font-size: 11px; font-weight: 650; text-transform: uppercase; letter-spacing: .05em; padding-top: 2px;
    }
    .tsp .tablewrap > table > tbody > tr > td > *,
    .tsp .panel > table:not(.compact-table) > tbody > tr > td > * { grid-column: 2; justify-self: start; min-width: 0; max-width: 100%; }
    .tsp .tablewrap > table > tbody > tr > td[data-label=""],
    .tsp .panel > table:not(.compact-table) > tbody > tr > td[data-label=""],
    .tsp .tablewrap > table > tbody > tr > td:not([data-label]),
    .tsp .panel > table:not(.compact-table) > tbody > tr > td:not([data-label]) { display: block; }
    .tsp .tablewrap > table > tbody > tr > td[data-label=""]::before,
    .tsp .panel > table:not(.compact-table) > tbody > tr > td[data-label=""]::before,
    .tsp .tablewrap > table > tbody > tr > td:not([data-label])::before,
    .tsp .panel > table:not(.compact-table) > tbody > tr > td:not([data-label])::before { content: none; }
    /* the row's buttons: a full-width strip at the foot of the card */
    .tsp td.cell-actions, .tsp td.col-action {
        position: static; box-shadow: none; background: transparent; text-align: left;
    }
    .tsp td.cell-actions[data-label=""] { display: flex; flex-wrap: wrap; gap: 6px; padding-top: 8px; }
    .tsp td.cell-actions .btn { margin: 0; }
    .tsp tbody tr:hover td.col-action { background: transparent; }
    /* audit: no fixed widths, no minimum; the detail row joins the card above */
    .tsp table.audit-table { table-layout: auto; min-width: 0; }
    .tsp .tablewrap > table > tbody > tr.rowdetail-row { display: none; margin-top: -10px; border-top: 0;
        border-radius: 0 0 var(--radius) var(--radius); }
    .tsp .tablewrap > table > tbody > tr:has(.rowdetail-toggle:checked) + tr.rowdetail-row { display: block; }
    .tsp .rowdetail-body dl.facts.facts-tight { grid-template-columns: 1fr; }
    .tsp .cell-sub code.idshort { max-width: 100%; }
}

/* Phones: the masthead's account items (name, role, Time zone chip, Sign out) wrap onto more lines instead of pushing the
   page sideways; the brand keeps its own line. */
@media (max-width: 720px) {
    .tsp .masthead { flex-wrap: wrap; row-gap: 8px; }
    .tsp .masthead .whoami { flex-wrap: wrap; justify-content: flex-start; max-width: 100%; min-width: 0; row-gap: 6px; }
    .tsp .masthead .whoami .role { max-width: 100%; overflow-wrap: anywhere; }
}
