/* iola search console components. Loaded after tokens.css and app.css (the research.my house
   system shared with bf1a); only iola-specific pieces live here. */

/* ---------- Brand mark (assets/img/basic-logo.png, 600 x 105): only width is ever set ---------- */
.basic-mark { display: block; height: auto; max-width: 100%; aspect-ratio: 600 / 105; flex: 0 0 auto; align-self: flex-start; }
.basic-mark--sidebar { width: 104px; }
.basic-mark--login { width: 150px; align-self: center; }

/* ---------- Shell ---------- */
.icon { width: 16px; height: 16px; flex-shrink: 0; }
.skip-link { position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: #fff; padding: 8px 14px; border-radius: var(--radius-sm); font-weight: 600; }
.skip-link:focus { top: 12px; color: #fff; }
.content:focus { outline: none; }
.content { max-width: 1320px; }
.nav-item__ext { margin-left: auto; display: inline-flex; opacity: .55; }
.nav-item__ext .icon, .nav-item .nav-item__ext svg { width: 12px; height: 12px; }
.sidebar__user { position: relative; }
.sidebar__user-meta { flex: 1; }
.sidebar__role { flex-shrink: 0; }
.sidebar__user-sub form { display: inline; }
.topbar__title { color: var(--text-secondary); font-weight: 500; font-size: 14px; }
.menu-toggle { padding: 6px; margin-left: -6px; border-radius: var(--radius-sm); align-items: center; }
.menu-toggle:hover { background: var(--bg-hover); }
.menu-toggle .icon { width: 20px; height: 20px; }
.scrim { position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,.55); }

/* ---------- Page head, cards ---------- */
.page-head h1 { font-size: 24px; }
.page-head p { line-height: 1.55; }
.page-head__actions .btn .icon { width: 14px; height: 14px; }
.card__head h2 { margin: 0; }
.card--flush .card__head { padding: 14px 18px 0; margin-bottom: 12px; }
.card__foot { padding: 12px 18px 14px; font-size: 12px; color: var(--text-tertiary); border-top: 1px solid var(--border); line-height: 1.55; }
.card__foot--plain { padding: 12px 0 0; margin-top: 4px; }
.table-wrap--flush { border: none; border-radius: 0; border-top: 1px solid var(--border); }
.table-wrap--flush table.data thead th { top: 0; }
table.data tr.is-muted td:not(:last-child) { opacity: .6; }
table.data td:first-child .cell-sub { white-space: nowrap; }
table.data td.empty-state { padding: 28px 16px; }
.stat__value--badge { display: flex; align-items: center; min-height: 32px; }
.stat__value--badge .badge { font-size: 13px; padding: 5px 11px; }
.stat__unit { font-family: var(--font-body); font-size: 13px; font-weight: 500; color: var(--text-tertiary); margin-left: 6px; letter-spacing: 0; }
.stat .meter { margin: 8px 0 6px; }
.grid-split { --split: 1.7fr; align-items: start; }

/* Usage meter next to a count (meter() in helpers.php) */
.meter { display: block; height: 4px; border-radius: 2px; background: var(--bg-hover); overflow: hidden; margin-top: 5px; min-width: 60px; }
.meter > span { display: block; height: 100%; background: var(--accent); border-radius: 2px; }
.meter--amber > span { background: var(--warning); }
.meter--red > span { background: var(--danger); }

/* Key-value rows */
.kv { display: grid; grid-template-columns: minmax(110px, 38%) minmax(0, 1fr); gap: 0; margin: 0; }
.kv dt, .kv dd { padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px; margin: 0; }
.kv dt { color: var(--text-tertiary); padding-right: 12px; }
.kv dd { color: var(--text); font-variant-numeric: tabular-nums; min-width: 0; overflow-wrap: anywhere; }
.kv dt:nth-last-of-type(1), .kv dd:last-child { border-bottom: none; }

/* ---------- Callouts (app.css has the base + warn) ---------- */
.callout { margin-bottom: 16px; }
.callout .icon { width: 18px; height: 18px; color: var(--accent-hover); flex-shrink: 0; margin-top: 1px; }
.callout__body code { font-size: 12px; }
.callout--info { border-left-color: var(--info); }
.callout--info .icon { color: var(--info); }
.callout--warn .icon { color: var(--warning); }
.callout--err { border-left-color: var(--danger); background: linear-gradient(90deg, var(--danger-dim), var(--bg-elevated) 60%); }
.callout--err .icon { color: var(--danger); }
.callout--ok { border-left-color: var(--success); }
.callout--ok .icon { color: var(--success); }
.otp__row { display: flex; align-items: center; gap: 10px; margin-top: 10px; flex-wrap: wrap; }
.otp__code { font-family: var(--font-mono); font-size: 17px; letter-spacing: .08em; background: var(--bg-sunk); border: 1px solid var(--border-light); border-radius: var(--radius-sm); padding: 6px 12px; color: var(--text); user-select: all; }

/* ---------- Forms ---------- */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr) minmax(140px, .6fr) auto; gap: 12px; align-items: end; }
.stack { display: grid; gap: 14px; }
.row-actions { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
.inline-form { display: inline-flex; gap: 6px; align-items: center; margin: 0; }
.inline-form select { width: auto; min-width: 140px; }
.login-form .form-hint { margin-top: 2px; }
code { font-family: var(--font-mono); font-size: .92em; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }
pre.code { font-family: var(--font-mono); font-size: 12.5px; line-height: 1.7; background: var(--bg-sunk); border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 12px 14px; overflow-x: auto; color: var(--text-secondary); white-space: pre; }
.text-warn { color: var(--warning); }

/* ---------- Pages that still use the older card / .tbl markup (CAPTCHA log, UA) ---------- */
.card > h2 { font-size: 14px; margin-bottom: 12px; }
.card > .muted, .content > .muted { font-size: 13px; margin-bottom: 12px; }
.card:has(> .tbl) { overflow-x: auto; }
.content > .card + .card, .content > section.card { margin-bottom: 16px; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-family: var(--font-mono); font-size: 10.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-tertiary); padding: 9px 12px; border-bottom: 1px solid var(--border); background: var(--bg-elevated); white-space: nowrap; }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--border); color: var(--text); font-variant-numeric: tabular-nums; vertical-align: top; }
.tbl tbody tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: var(--bg-hover); }
.filters { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; margin-bottom: 16px; }
.filters label { display: flex; flex-direction: column; gap: 5px; font-size: 12px; color: var(--text-secondary); }
.filters select { min-width: 160px; }
.filters button { padding: 9px 16px; border-radius: var(--radius-sm); font-size: 13px; font-weight: 600; background: var(--accent); color: #fff; border: none; cursor: pointer; font-family: var(--font-body); }
.filters button:hover { background: var(--accent-hover); }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .form-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .form-grid .btn { justify-self: start; }
}
@media (max-width: 860px) {
  .sidebar { visibility: hidden; transition: transform var(--transition), visibility 0s linear 140ms; }
  .sidebar.open { visibility: visible; transition: transform var(--transition); }
  .topbar__kicker { display: none; }
}
@media (min-width: 861px) { .scrim { display: none; } }
@media (max-width: 640px) {
  .topbar__title { display: inline; }
  .page-head h1 { font-size: 21px; }
  .form-grid { grid-template-columns: minmax(0, 1fr); }
  .form-grid .btn { justify-self: stretch; }
  .kv { grid-template-columns: minmax(96px, 42%) minmax(0, 1fr); }
  .row-actions { justify-content: flex-start; }
  .login-card { padding: 30px 22px; }
}

/* Test search (admin/test-search.php) */
.search-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(160px, 230px) auto auto; gap: 12px; align-items: end; }
.search-form .check { padding-bottom: 10px; }
.results { list-style: none; margin: 0; padding: 0; }
.results li { padding: 14px 18px; border-bottom: 1px solid var(--border); }
.results li:last-child { border-bottom: none; }
.results__n { display: inline-block; min-width: 26px; color: var(--text-tertiary); font-variant-numeric: tabular-nums; }
.results__title { font-weight: 600; color: var(--accent); text-decoration: none; overflow-wrap: anywhere; }
a.results__title:hover { text-decoration: underline; }
.results__url { margin: 2px 0 0 26px; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-tertiary); overflow-wrap: anywhere; }
.results__snippet { margin: 5px 0 0 26px; font-size: 13px; line-height: 1.5; color: var(--text-secondary); }
.results__meta { margin: 6px 0 0 26px; display: flex; flex-wrap: wrap; gap: 6px; }
@media (max-width: 760px) {
  .search-form { grid-template-columns: minmax(0, 1fr); }
  .search-form .check { padding-bottom: 0; }
}

/* Alerts on the overview (from /health "alerts") */
.alert-list { margin: 4px 0 0; padding-left: 18px; }
.alert-list li + li { margin-top: 4px; }

/* Release notes (release-notes.php, from CHANGELOG.md) */
.release__note { margin: 0 0 12px; font-size: 13.5px; color: var(--text-secondary); }
.release__section + .release__section { margin-top: 16px; }
.release__kind { margin-bottom: 8px; }
.release__items { margin: 0; padding-left: 20px; display: grid; gap: 7px; font-size: 13.5px; line-height: 1.55; color: var(--text); }
.release__items code, .release__note code, .page-head code { font-family: var(--font-mono); font-size: 12px; background: var(--bg-sunk); border: 1px solid var(--border-light); border-radius: 4px; padding: 0 4px; }
.release__items a { color: var(--accent); overflow-wrap: anywhere; }
a.release__commit { text-decoration: none; }
a.release__commit code { color: var(--accent); }

/* Pacing (admin/pacing.php): the table is editable in place for administrators */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.data--pacing tbody td { vertical-align: middle; }
.data--pacing .cell-sub { white-space: nowrap; }
table.data tr.is-dirty, table.data tr.is-dirty:hover { background: var(--accent-dim); }
.pace-pair { display: inline-flex; align-items: center; gap: 6px; }
.pace-input { width: 78px !important; text-align: right; font-family: var(--font-mono) !important; }
.pace-input--cap { width: 100px !important; }
.pace-input:invalid { border-color: var(--danger) !important; }
.switch { position: relative; display: inline-flex; align-items: center; gap: 8px; cursor: pointer; white-space: nowrap;
  font-family: var(--font-mono); font-size: 10.5px; letter-spacing: 0.04em; text-transform: uppercase; font-weight: 600; }
.switch input { position: absolute; opacity: 0; width: 1px; height: 1px; margin: 0; }
.switch__track { position: relative; flex-shrink: 0; width: 30px; height: 17px; border-radius: 9px; background: var(--bg-hover); border: 1px solid var(--border-light); transition: background var(--transition), border-color var(--transition); }
.switch__track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 11px; height: 11px; border-radius: 50%; background: var(--text-tertiary); transition: transform var(--transition), background var(--transition); }
.switch input:checked + .switch__track { background: var(--accent); border-color: var(--accent); }
.switch input:checked + .switch__track::after { transform: translateX(13px); background: #fff; }
.switch input:focus-visible + .switch__track { box-shadow: 0 0 0 3px var(--accent-dim); }
.switch__on { display: none; color: var(--accent-hover); }
.switch__off { color: var(--text-tertiary); }
.switch input:checked ~ .switch__on { display: inline; }
.switch input:checked ~ .switch__off { display: none; }
.pacing-foot { display: flex; flex-wrap: wrap; gap: 12px 20px; align-items: flex-end; justify-content: space-between; }
.pacing-foot p { margin: 0; flex: 1 1 420px; }
.pacing-foot code { font-family: var(--font-mono); font-size: 11.5px; }
.pacing-foot__actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.pacing-foot__dirty { font-size: 12px; color: var(--warning); white-space: nowrap; }
