/* CollHub - platform console. */
/* app.css locks the page (html/body 100%, body overflow hidden) for the single-page app, whose views scroll
   on their own: the console is a normal page and must scroll as a whole. */
html:has(body.console), body.console { height: auto; }
body.console { min-height: 100%; overflow: visible; }
.c-shell { min-height: 100vh; display: flex; flex-direction: column; }
.c-top { display: flex; align-items: center; gap: 22px; background: #16202b; color: #cfd7df; padding: 10px 22px; flex-wrap: wrap; }
.c-brand { display: inline-flex; align-items: center; gap: 10px; color: #fff; font-size: 20px; }
.c-brand:hover { text-decoration: none; }
.c-brand small { font-family: var(--font); font-size: 11px; text-transform: uppercase; letter-spacing: 1px; color: #f0a47f; font-weight: 700; margin-left: 2px; }
.c-nav { display: flex; gap: 4px; flex-wrap: wrap; }
.c-nav a { color: #cfd7df; padding: 8px 12px; border-radius: 8px; font-weight: 600; display: inline-flex; gap: 8px; align-items: center; --fa-secondary-opacity: .45; cursor: pointer; }
.c-nav a:hover { background: rgba(255,255,255,.06); color: #fff; text-decoration: none; }
.c-nav a.is-active { background: rgba(31, 111, 139, .45); color: #fff; }
.c-me { margin-left: auto; display: flex; align-items: center; gap: 8px; font-weight: 600; }
.c-me .badge { background: rgba(255,255,255,.12); color: #fff; border: 0; }
.c-light { color: #cfd7df; }
.c-light:hover { background: rgba(255,255,255,.08); color: #fff; }
.c-main { flex: 1; }
.c-stats { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 16px; }
.c-stat { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 14px 16px; display: flex; align-items: center; gap: 12px; box-shadow: var(--shadow-sm); }
.c-stat i { font-size: 22px; color: var(--primary); }
.c-stat.is-ok i { color: var(--success); }
.c-stat.is-warn i { color: var(--warning); }
.c-stat b { font-size: 24px; }
.c-stat span { color: var(--muted); font-size: 13px; }
.c-recent { margin-top: 16px; }
.c-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.c-warn { background: var(--warning-50); color: #7a5002; border-radius: var(--radius); padding: 10px 14px; margin-bottom: 14px; font-weight: 600; }
.c-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 14px; }
.c-grid + .card, .card + .card { margin-top: 14px; }
.c-kv { display: flex; flex-direction: column; gap: 6px; }
.c-kv-row { display: grid; grid-template-columns: 140px minmax(0, 1fr); gap: 10px; font-size: 13.5px; }
.c-kv-row > span { color: var(--muted); }
.c-kv-row > div { overflow-wrap: anywhere; }
.c-admins { margin-top: 8px; font-size: 13px; }
.c-h { margin: 6px 0 10px; font-size: 13px; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); }
.c-url { font-size: 16px; font-weight: 700; }
.c-cred { display: flex; gap: 18px; align-items: center; background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; flex-wrap: wrap; }
.c-cred > div { display: flex; flex-direction: column; }
.c-cred span { font-size: 12px; color: var(--muted); }
.c-cred b { font-family: Consolas, "Cascadia Mono", monospace; font-size: 16px; }
.c-log tr.is-failed td { color: var(--danger); }
.c-detail { font-size: 12.5px; color: var(--ink-2); max-width: 520px; }
.find-suffix { display: flex; align-items: center; gap: 6px; }
.find-suffix span { color: var(--muted); font-weight: 600; white-space: nowrap; }
@media (max-width: 1000px) {
    .c-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .c-grid { grid-template-columns: 1fr; }
}

/* Integrations (clients, keys, permissions, webhooks) */
.c-int { border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; margin-top: 12px; }
.c-int-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.c-int-head .spacer { flex: 1; }
.c-int-dot { width: 12px; height: 12px; border-radius: 50%; display: inline-block; }
.c-int-err { color: var(--danger); }
.c-int-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 4px; }
.c-int-url { font-family: Consolas, "Cascadia Mono", monospace; font-size: 12.5px; overflow-wrap: anywhere; }
.c-int-actions { margin: 10px 0 0; }
.c-int code, .c-scope code, .c-log code { font-size: 12px; background: var(--surface-2); border-radius: 4px; padding: 1px 5px; }
.c-secret { overflow-wrap: anywhere; font-size: 14px !important; }
.c-scope { border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; margin: 0 0 12px; }
.c-scope legend { font-weight: 700; padding: 0 6px; }
.c-scope-row, .c-scope-new { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 6px; }
.c-scope-row .input, .c-scope-new .input { width: 200px; max-width: 100%; }
.c-scope-new label { font-size: 13px; color: var(--muted); }
.c-check { display: flex; align-items: center; gap: 8px; cursor: pointer; padding: 3px 0; }
.c-check input { cursor: pointer; }
.c-scroll { overflow-x: auto; }

/* C12: the console at phone width, no horizontal page scroll */
@media (max-width: 640px) {
    .c-top { padding: 10px 16px; gap: 10px; }
    .c-me { margin-left: 0; }
    .c-main .page { padding: 14px 16px 30px; }
    .c-stats { grid-template-columns: 1fr 1fr; }
    .c-kv-row { grid-template-columns: 1fr; gap: 2px; }
    .grid-table { display: block; overflow-x: auto; max-width: 100%; }
    .page-head { flex-wrap: wrap; }
    .c-scope-row .input, .c-scope-new .input { width: 100%; }
    .field-row { grid-template-columns: 1fr; }
}

/* organization chart card (DirectoryConsole) */
.c-int-row > div { flex-basis: 100%; }
.c-modes { display: grid; gap: 8px; margin-bottom: 14px; }
.c-mode { display: flex; align-items: flex-start; gap: 10px; border: 1px solid var(--line); border-radius: var(--radius); padding: 10px 12px; min-height: 44px; cursor: pointer; }
.c-mode:has(input:checked) { border-color: var(--primary); background: var(--surface-2); }
.c-mode input { margin-top: 3px; cursor: pointer; }
.c-mode > i { color: var(--primary); margin-top: 3px; width: 18px; text-align: center; }
.c-mode span { display: flex; flex-direction: column; gap: 2px; }
.c-mode small { color: var(--muted); font-size: 12.5px; }

/* Billing and data */
.c-billing-bar { align-items: flex-end; }
.c-billing-bar .field { margin: 0; }
.c-pending { margin: 0; padding-left: 20px; }
.c-pending li { margin: 2px 0; }
.c-person-row { display: flex; align-items: center; gap: 8px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.c-person-row span { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.c-person-row small { color: var(--muted); overflow: hidden; text-overflow: ellipsis; }
.c-people-pick { max-height: 50vh; overflow-y: auto; }
@media (max-width: 760px) {
    .c-billing-bar > * { width: 100%; }
    .c-person-row { flex-wrap: wrap; }
    .c-person-row .btn { min-height: 44px; }
}

/* Paged logs (platform log, operations): filters, pager, rows as cards on a phone */
.c-filter-toggle { display: none; margin: 12px 14px 0; }
.c-filters { display: flex; flex-wrap: wrap; gap: 10px 12px; align-items: flex-end; padding: 12px 14px; border-bottom: 1px solid var(--line); }
.c-filters .field { margin: 0; min-width: 150px; }
.c-filters .c-filter-wide { flex: 1 1 260px; }
.c-filters .form-text { font-size: 12px; }
.c-filter-actions { display: flex; gap: 8px; }
.c-pager { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; border-top: 1px solid var(--line); }
.c-pager .spacer { flex: 1; }
.c-pad { padding: 12px 14px; margin: 0; }
@media (max-width: 640px) {
    .c-filter-toggle { display: inline-flex; min-height: 44px; }
    .c-filters { display: none; flex-direction: column; align-items: stretch; }
    .c-filters.is-open { display: flex; }
    .c-filters .field, .c-filter-actions .btn { width: 100%; }
    .c-filter-actions { flex-direction: column; }
    .c-pager .btn { min-height: 44px; flex: 1; }
    .c-pager .spacer { display: none; }
    .c-pager > .muted { width: 100%; }
    table.c-rowcards, table.c-rowcards tbody, table.c-rowcards tr, table.c-rowcards td { display: block; width: 100%; }
    table.c-rowcards { overflow: visible; }
    table.c-rowcards thead { display: none; }
    table.c-rowcards tr { border-bottom: 1px solid var(--line); padding: 8px 14px; }
    table.c-rowcards td { border: 0; padding: 2px 0; white-space: normal; }
    table.c-rowcards td[data-label]::before { content: attr(data-label); display: block; font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: .03em; }
}
