/* AbilityGuard admin UI - original design, wp-admin-inspired aesthetic */

:root {
  --bg: #f6f7f8;
  --surface: #ffffff;
  --surface-2: #fafbfc;
  --border: #dcdfe3;
  --border-strong: #c5c9cf;
  --ink: #1d2327;
  --ink-2: #50575e;
  --ink-3: #787c82;
  --accent: #2563aa;
  --accent-hover: #1d4d87;
  --focus: #2271b1;
  --focus-ring: 0 0 0 2px #ffffff, 0 0 0 4px #2271b1;

  --ok-bg: #ecf6ec;
  --ok-fg: #1f6f30;
  --err-bg: #fbeceb;
  --err-fg: #a8301f;
  --warn-bg: #fdf3dd;
  --warn-fg: #8a5a00;
  --neutral-bg: #eef0f2;
  --neutral-fg: #50575e;

  --diff-add-bg: #e7f5ea;
  --diff-add-fg: #155724;
  --diff-rem-bg: #fbe9e9;
  --diff-rem-fg: #842029;

  --danger: #b32d2e;
  --danger-hover: #8c2122;

  --radius: 3px;
  --radius-lg: 4px;

  --shadow-sm: 0 1px 1px rgba(0,0,0,0.04);
  --shadow-md: 0 1px 2px rgba(0,0,0,0.06), 0 4px 12px rgba(0,0,0,0.05);
  --shadow-modal: 0 10px 40px rgba(0,0,0,0.18), 0 2px 6px rgba(0,0,0,0.08);
}

.ag-root {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  padding: 20px 24px 60px;
  min-height: 100%;
  box-sizing: border-box;
}

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

.mono {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-feature-settings: "calt" 0;
}

/* ---------- Page header ---------- */
.ag-header { margin-bottom: 18px; }
.ag-header h1 {
  font-size: 23px;
  font-weight: 400;
  margin: 0 0 4px;
  color: var(--ink);
  letter-spacing: -0.005em;
}
.ag-header .sub {
  font-size: 13px;
  color: var(--ink-2);
  margin: 0;
}
.ag-breadcrumb {
  font-size: 12px;
  color: var(--ink-2);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ag-breadcrumb a { color: var(--accent); text-decoration: none; }
.ag-breadcrumb a:hover { color: var(--accent-hover); text-decoration: underline; }
.ag-breadcrumb .sep { color: var(--ink-3); }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 13px;
  line-height: 1;
  padding: 7px 12px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  cursor: pointer;
  text-decoration: none;
  white-space: nowrap;
  transition: background 80ms, border-color 80ms;
}
.btn:hover { background: var(--surface-2); border-color: #9ea4ab; }
.btn:focus-visible { outline: none; box-shadow: var(--focus-ring); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #fff;
}
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }

.btn-danger {
  background: var(--danger);
  border-color: var(--danger);
  color: #fff;
}
.btn-danger:hover { background: var(--danger-hover); border-color: var(--danger-hover); }
.btn-danger.outline {
  background: transparent;
  color: var(--danger);
  border-color: var(--danger);
}
.btn-danger.outline:hover { background: rgba(179,45,46,0.06); }

.btn-link {
  background: none;
  border: none;
  color: var(--accent);
  padding: 0;
  font: inherit;
  font-size: 12px;
  cursor: pointer;
  text-decoration: none;
}
.btn-link:hover { color: var(--accent-hover); text-decoration: underline; }

.btn-sm { padding: 4px 8px; font-size: 12px; }

/* ---------- Form controls ---------- */
.field { display: flex; flex-direction: column; gap: 4px; }
.field label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  font-weight: 600;
}
.input, .select {
  font: inherit;
  font-size: 13px;
  padding: 6px 8px;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  background: var(--surface);
  color: var(--ink);
  height: 30px;
  min-width: 0;
}
.input:focus, .select:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 1px var(--focus); }
.select {
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-2) 50%), linear-gradient(135deg, var(--ink-2) 50%, transparent 50%);
  background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  padding-right: 26px;
}
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  user-select: none;
}
.checkbox input { margin: 0; accent-color: var(--accent); }

/* ---------- Filter bar ---------- */
.filter-bar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 14px;
  align-items: flex-end;
  margin-bottom: 14px;
}
.filter-bar .field.search { flex: 1 1 240px; max-width: 320px; }
.filter-bar .field.range { flex-direction: row; align-items: center; gap: 6px; }
.filter-bar .field.range .input { width: 130px; }
.filter-bar .reset { margin-left: auto; padding-bottom: 7px; }
.filter-bar .checkbox { padding-bottom: 9px; }

/* ---------- Tables-actions row ---------- */
.tablenav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  font-size: 13px;
  color: var(--ink-2);
}
.tablenav.bottom { border-top: 1px solid var(--border); margin-top: -1px; }
.tablenav .bulk { display: flex; align-items: center; gap: 6px; }
.tablenav .count { margin-left: auto; }
.pager { display: inline-flex; align-items: center; gap: 4px; }
.pager button {
  width: 28px; height: 28px; padding: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--radius); cursor: pointer; color: var(--ink-2);
  font-size: 13px;
}
.pager button:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.pager button:disabled { opacity: 0.4; cursor: not-allowed; }
.pager .of { padding: 0 8px; color: var(--ink-2); }
.pager .num {
  height: 28px; padding: 0 8px;
  border: 1px solid var(--border-strong); border-radius: var(--radius);
  background: var(--surface); font: inherit; width: 50px; text-align: center;
}

/* ---------- Table ---------- */
.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
table.ag-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.ag-table thead th {
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-2);
  background: var(--surface-2);
  padding: 9px 12px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  user-select: none;
}
.ag-table thead th.sortable { cursor: pointer; }
.ag-table thead th.sortable:hover { color: var(--ink); }
.ag-table thead th .arrow { color: var(--ink-3); margin-left: 4px; font-size: 10px; }
.ag-table tbody td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
  color: var(--ink);
}
.ag-table tbody tr:last-child td { border-bottom: none; }
.ag-table tbody tr:hover { background: #f8fafb; }
.ag-table .col-check { width: 28px; padding-left: 12px; padding-right: 0; }
.ag-table .col-check input { accent-color: var(--accent); margin: 0; }
.ag-table .col-status { width: 110px; }
.ag-table .col-caller { width: 80px; }
.ag-table .col-user { width: 170px; }
.ag-table .col-destructive { width: 90px; text-align: center; }
.ag-table .col-duration { width: 90px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.ag-table .col-when { width: 130px; color: var(--ink-2); }
.ag-table .col-actions { width: 150px; text-align: right; }
.ag-table .ability-name { font-size: 12.5px; }

.row-actions { display: inline-flex; gap: 10px; justify-content: flex-end; }
.row-actions .btn-link { font-size: 12px; }
.row-actions .danger { color: var(--danger); }
.row-actions .danger:hover { color: var(--danger-hover); }

/* ---------- Pills & dots ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11.5px;
  font-weight: 600;
  padding: 2px 7px 2px 6px;
  border-radius: 10px;
  line-height: 1.5;
  letter-spacing: 0.01em;
}
.pill::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex-shrink: 0;
  opacity: 0.85;
}
.pill.ok { background: var(--ok-bg); color: var(--ok-fg); }
.pill.err { background: var(--err-bg); color: var(--err-fg); }
.pill.rolled { background: var(--neutral-bg); color: var(--neutral-fg); }
.pill.pending { background: var(--warn-bg); color: var(--warn-fg); }

.tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius);
  background: var(--neutral-bg);
  color: var(--neutral-fg);
  font-family: "JetBrains Mono", ui-monospace, monospace;
  letter-spacing: 0.01em;
}

.dot-destructive {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--danger);
}
.dot-destructive[title] { cursor: help; }

.dim { color: var(--ink-3); }

/* ---------- User cell ---------- */
.user-cell { display: inline-flex; align-items: center; gap: 8px; }
.avatar {
  width: 22px; height: 22px;
  border-radius: 50%;
  background: linear-gradient(135deg, #c8d4e2, #97a6b8);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 600;
  flex-shrink: 0;
}
.avatar.a-sc { background: linear-gradient(135deg, #d8a8c0, #a85c84); }
.avatar.a-dm { background: linear-gradient(135deg, #b8c8a8, #5c8a4c); }
.avatar.a-jw { background: linear-gradient(135deg, #c0b0d8, #6c4ca8); }
.avatar.a-system { background: #c5c9cf; color: #50575e; font-size: 11px; }
.avatar.a-mt { background: linear-gradient(135deg, #d8c0a8, #a8804c); }
.avatar.a-rk { background: linear-gradient(135deg, #a8c8d8, #4c7c98); }

/* ---------- Detail page ---------- */
.detail-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 11px 16px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.card-head h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: 0.005em;
  display: inline-flex; align-items: center; gap: 8px;
}
.card-head .meta {
  font-size: 12px;
  color: var(--ink-3);
}
.card-body { padding: 14px 16px; }
.card-body.flush { padding: 0; }
.card-body.code { padding: 0; }

.toggle-btn {
  background: none; border: none; cursor: pointer;
  color: var(--ink-2); padding: 0; font: inherit; font-size: 12px;
  display: inline-flex; align-items: center; gap: 4px;
}
.toggle-btn:hover { color: var(--ink); }
.toggle-btn .chev { transition: transform 120ms; }
.toggle-btn.collapsed .chev { transform: rotate(-90deg); }

/* Summary KV */
.kv-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0;
}
.kv-grid .kv {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  align-items: center;
  min-width: 0;
}
.kv-grid .kv:nth-last-child(-n+2) { border-bottom: none; }
.kv-grid .kv .k {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink-3);
  font-weight: 600;
}
.kv-grid .kv .v { font-size: 13px; min-width: 0; overflow: hidden; }
.kv-grid .kv .v.mono { font-size: 12px; }

.copy-inline {
  display: inline-flex; align-items: center; gap: 6px;
  max-width: 100%;
}
.copy-inline .truncate {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  color: var(--ink-2);
  min-width: 0;
}
.copy-btn {
  background: none; border: none; cursor: pointer;
  color: var(--ink-3); padding: 2px; line-height: 0; border-radius: 2px;
  flex-shrink: 0;
}
.copy-btn:hover { color: var(--ink); background: var(--surface-2); }
.copy-btn svg { width: 13px; height: 13px; }

/* Code blocks */
pre.code-block {
  margin: 0;
  padding: 14px 16px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink);
  background: var(--surface);
  overflow: auto;
  max-height: 360px;
  white-space: pre;
}
.tok-key { color: #8c2c8a; }
.tok-str { color: #1f6f30; }
.tok-num { color: #a8301f; }
.tok-bool { color: #1d4d87; font-weight: 600; }
.tok-null { color: var(--ink-3); }
.tok-punct { color: var(--ink-2); }

/* Diff */
.diff-card .card-head { background: var(--surface-2); }
.diff-surface { border-bottom: 1px solid var(--border); }
.diff-surface:last-child { border-bottom: none; }
.diff-surface-head {
  padding: 8px 16px;
  background: #fbfcfd;
  font-size: 12px;
  color: var(--ink-2);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 10px;
}
.diff-surface-head .label {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--ink);
}
.diff-surface-head .changes {
  font-size: 11px; color: var(--ink-3);
}
.diff-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
}
.diff-col { min-width: 0; }
.diff-col + .diff-col { border-left: 1px solid var(--border); }
.diff-col-head {
  padding: 7px 16px;
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--ink-3);
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  display: flex; align-items: center; justify-content: space-between;
}
.diff-rows { padding: 6px 0; }
.diff-row {
  display: grid;
  grid-template-columns: minmax(120px, 30%) 1fr;
  gap: 12px;
  padding: 4px 16px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  line-height: 1.55;
  align-items: baseline;
}
.diff-row .dk { color: var(--ink-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.diff-row .dv { color: var(--ink); word-break: break-word; min-width: 0; }
.diff-row.removed { background: var(--diff-rem-bg); }
.diff-row.removed .dv { color: var(--diff-rem-fg); }
.diff-row.added { background: var(--diff-add-bg); }
.diff-row.added .dv { color: var(--diff-add-fg); }
.diff-row.unchanged .dv { color: var(--ink-2); }
.diff-empty { padding: 18px 16px; color: var(--ink-3); font-style: italic; font-size: 12px; }

/* Activity */
.activity-list { list-style: none; padding: 0; margin: 0; }
.activity-list li {
  display: grid;
  grid-template-columns: 16px 1fr auto;
  gap: 10px;
  padding: 8px 16px;
  align-items: center;
  border-bottom: 1px solid var(--border);
  font-size: 12px;
}
.activity-list li:last-child { border-bottom: none; }
.activity-list .marker {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--accent);
  margin-left: 4px;
}
.activity-list .marker.rolled { background: var(--ink-3); }
.activity-list .marker.error { background: var(--danger); }
.activity-list .when { color: var(--ink-3); font-variant-numeric: tabular-nums; }

/* Detail header */
.detail-header {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 18px;
}
.detail-header .title h1 {
  font-size: 23px; font-weight: 400; margin: 0;
  display: inline-flex; align-items: center; gap: 12px;
}
.detail-header .actions { display: inline-flex; gap: 8px; align-items: center; }

/* ---------- Empty state ---------- */
.empty {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 56px 24px;
  text-align: center;
  max-width: 540px;
  margin: 80px auto;
}
.empty .icon {
  width: 56px; height: 56px;
  margin: 0 auto 18px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  color: var(--ink-3);
}
.empty h2 {
  font-size: 17px; font-weight: 600; margin: 0 0 6px;
  color: var(--ink);
}
.empty p {
  color: var(--ink-2); margin: 0 0 22px; font-size: 13px;
  max-width: 380px; margin-left: auto; margin-right: auto;
}
.empty .actions { display: inline-flex; gap: 8px; }

/* ---------- Modal ---------- */
.modal-backdrop {
  position: relative;
  background: rgba(20, 26, 34, 0.42);
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
  min-height: 480px;
  border-radius: var(--radius-lg);
}
.modal {
  background: var(--surface);
  border-radius: 6px;
  width: 100%;
  max-width: 460px;
  box-shadow: var(--shadow-modal);
  overflow: hidden;
}
.modal-head {
  padding: 16px 20px 4px;
}
.modal-head h2 {
  font-size: 16px; font-weight: 600; margin: 0; color: var(--ink);
}
.modal-body { padding: 6px 20px 16px; font-size: 13px; color: var(--ink-2); }
.modal-body p { margin: 0 0 12px; }
.modal-summary {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-top: 8px;
  display: grid;
  grid-template-columns: 80px 1fr;
  gap: 6px 12px;
  font-size: 12px;
}
.modal-summary .k { color: var(--ink-3); }
.modal-summary .v { color: var(--ink); }
.modal-summary .v.mono { font-family: "JetBrains Mono", ui-monospace, monospace; font-size: 11.5px; }
.modal-foot {
  padding: 12px 20px;
  border-top: 1px solid var(--border);
  background: var(--surface-2);
  display: flex; justify-content: flex-end; gap: 8px;
}
.modal-warn {
  display: flex; gap: 10px;
  padding: 10px 12px;
  background: var(--warn-bg);
  border: 1px solid #f0d68a;
  border-radius: var(--radius);
  color: #6e4a00;
  font-size: 12.5px;
  margin-top: 4px;
}
.modal-warn svg { flex-shrink: 0; margin-top: 1px; }

/* ---------- Notices / toasts ---------- */
.notice {
  background: var(--surface);
  border-left: 4px solid var(--accent);
  padding: 10px 14px;
  margin-bottom: 12px;
  display: flex; align-items: flex-start; gap: 10px;
  font-size: 13px;
  border-radius: 0 var(--radius) var(--radius) 0;
  box-shadow: var(--shadow-sm);
}
.notice.success { border-left-color: var(--ok-fg); }
.notice.error { border-left-color: var(--err-fg); }
.notice .glyph {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
  margin-top: 1px;
}
.notice.success .glyph { background: var(--ok-fg); }
.notice.error .glyph { background: var(--err-fg); }
.notice .body { flex: 1; color: var(--ink); }
.notice .body strong { color: var(--ink); }
.notice .dismiss {
  background: none; border: none; color: var(--ink-3);
  cursor: pointer; font-size: 18px; line-height: 1; padding: 0 4px;
  align-self: flex-start;
}
.notice .dismiss:hover { color: var(--ink); }

/* Floating toast variant */
.toast-stack {
  display: flex; flex-direction: column; gap: 10px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ok-fg);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  padding: 11px 14px;
  display: flex; align-items: flex-start; gap: 10px;
  min-width: 360px;
  max-width: 460px;
}
.toast.error { border-left-color: var(--err-fg); }
.toast .glyph {
  width: 18px; height: 18px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-size: 11px; font-weight: 700;
}
.toast.success .glyph { background: var(--ok-fg); }
.toast.error .glyph { background: var(--err-fg); }
.toast .body { flex: 1; font-size: 13px; }
.toast .body .title { font-weight: 600; color: var(--ink); margin-bottom: 1px; }
.toast .body .desc { color: var(--ink-2); }
.toast .body a { color: var(--accent); text-decoration: none; }
.toast .body a:hover { text-decoration: underline; }
.toast .dismiss {
  background: none; border: none; color: var(--ink-3);
  cursor: pointer; font-size: 16px; line-height: 1; padding: 0 2px;
}
.toast .dismiss:hover { color: var(--ink); }
/* ---------- Narrow (782px-ish) ---------- */
.narrow .filter-bar { padding: 10px 12px; gap: 8px; }
.narrow .filter-bar .field.search,
.narrow .filter-bar .field { flex: 1 1 100%; max-width: none; }
.narrow .filter-bar .field.range { flex-direction: column; align-items: stretch; gap: 4px; }
.narrow .filter-bar .field.range .input { width: 100%; }
.narrow .filter-bar .reset { margin-left: 0; padding-bottom: 0; }

.narrow .ag-table thead { display: none; }
.narrow .ag-table, .narrow .ag-table tbody, .narrow .ag-table tr, .narrow .ag-table td { display: block; width: 100%; }
.narrow .ag-table tr {
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.narrow .ag-table tr:hover { background: transparent; }
.narrow .ag-table td {
  padding: 2px 0;
  border-bottom: none;
  display: flex;
  gap: 10px;
  align-items: center;
}
.narrow .ag-table td.col-check { display: none; }
.narrow .ag-table td.col-status { padding-bottom: 6px; }
.narrow .ag-table td.col-ability { font-size: 13px; padding-bottom: 4px; }
.narrow .ag-table td[data-label]::before {
  content: attr(data-label);
  font-size: 11px; color: var(--ink-3); text-transform: uppercase;
  letter-spacing: 0.04em; min-width: 70px;
  font-weight: 600;
}
.narrow .ag-table td.col-actions { justify-content: flex-start; padding-top: 8px; }
.narrow .ag-table td.col-duration { justify-content: flex-start; text-align: left; }

.narrow .kv-grid { grid-template-columns: 1fr; }
.narrow .kv-grid .kv:nth-last-child(-n+2) { border-bottom: 1px solid var(--border); }
.narrow .kv-grid .kv:last-child { border-bottom: none; }
.narrow .diff-cols { grid-template-columns: 1fr; }
.narrow .diff-col + .diff-col { border-left: none; border-top: 1px solid var(--border); }
.narrow .detail-header { flex-direction: column; align-items: stretch; }
.narrow .detail-header .actions { justify-content: flex-start; }
/* Three innovative directions - out-of-WordPress UX */

/* Shared bits across all directions */
.dir-timeline, .dir-palette, .dir-split {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg-d, #fafafa);
}
.eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-weight: 600;
  color: var(--ink-3);
  margin-bottom: 6px;
}

/* ============================================================
   Timeline / stream layout
   ============================================================ */
.dir-timeline {
  --bg-d: #fafaf9;
  background: var(--bg-d);
  padding: 0;
}
.dt-layout {
  display: grid;
  grid-template-columns: 248px 1fr;
  min-height: 100%;
}
.dt-sidebar {
  padding: 28px 22px;
  border-right: 1px solid #ececea;
  background: #f5f5f3;
  display: flex;
  flex-direction: column;
  gap: 22px;
}
.dt-side-section { display: flex; flex-direction: column; gap: 8px; }
.dt-side-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-3);
}
.dt-checks { display: flex; flex-direction: column; gap: 6px; }
.dt-checks .checkbox { font-size: 12.5px; }
.dt-range-pills { display: flex; flex-wrap: wrap; gap: 4px; }
.dt-pill {
  padding: 4px 9px;
  font-size: 11.5px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--ink-2);
  border-radius: 999px;
  cursor: pointer;
}
.dt-pill:hover { background: rgba(0,0,0,0.04); }
.dt-pill.is-active {
  background: #1d2327;
  color: #fff;
}

.dt-main { padding: 32px 56px 80px; max-width: 880px; }
.dt-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 32px; gap: 24px;
}
.dt-title {
  font-size: 32px; font-weight: 700; margin: 0;
  letter-spacing: -0.02em; color: var(--ink);
}
.dt-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.dt-spark { width: 240px; }
.dt-spark svg { width: 100%; height: 56px; display: block; }
.dt-spark-label { font-size: 10px; text-align: right; margin-top: 2px; }

.dt-stream { position: relative; }
.tl-group { margin-bottom: 28px; }
.tl-group-head {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px;
}
.tl-group-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--ink-3);
}
.tl-group-label {
  font-size: 13px; font-weight: 600; color: var(--ink);
  letter-spacing: -0.005em;
}
.tl-group-sub { font-size: 11px; }

.tl-events {
  position: relative;
  padding-left: 14px;
  border-left: 1px solid #e3e3df;
  margin-left: 4px;
  display: flex; flex-direction: column; gap: 10px;
}
.tl-event {
  position: relative;
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 12px;
  align-items: flex-start;
}
.tl-marker {
  position: absolute;
  left: -22px;
  top: 14px;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 11px; font-weight: 700;
  border: 3px solid var(--bg-d);
  z-index: 1;
}
.tl-card {
  grid-column: 2;
  background: #fff;
  border: 1px solid #ececea;
  border-radius: 8px;
  padding: 12px 14px;
  transition: border-color 100ms;
}
.tl-card:hover { border-color: #d4d4ce; }
.tl-head {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.tl-ability { font-size: 13.5px; font-weight: 500; color: var(--ink); }
.tl-destructive {
  font-size: 10px;
  background: #fbeceb;
  color: var(--err-fg);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}
.tl-when { margin-left: auto; font-size: 11.5px; color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-2);
  flex-wrap: wrap;
}
.tl-id { color: var(--ink-3); }
.tl-sep { color: #c6c6c0; }
.tl-duration { font-size: 11.5px; }
.tl-error {
  margin-top: 8px;
  background: #fbeceb;
  color: var(--err-fg);
  padding: 6px 10px;
  border-radius: 4px;
  font-size: 12px;
  border-left: 2px solid var(--err-fg);
}
.tl-surfaces {
  margin-top: 8px;
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.tl-surface {
  font-size: 11px;
  background: #f3f3f0;
  color: var(--ink-2);
  padding: 2px 7px;
  border-radius: 3px;
}
.tl-rolledby {
  margin-top: 8px;
  font-size: 11.5px;
  color: var(--ink-3);
  font-style: italic;
}
.tl-actions {
  margin-top: 10px;
  display: flex; gap: 14px;
}

/* ============================================================
   Command palette (filter bar + sort)
   ============================================================ */
.dir-palette {
  --bg-d: #f4f4f5;
  background: var(--bg-d);
  padding: 0;
}
.cp-shell {
  max-width: 920px;
  margin: 0 auto;
  padding: 56px 32px 48px;
  display: flex; flex-direction: column;
  gap: 18px;
  min-height: 100%;
  box-sizing: border-box;
}
.cp-top {
  display: flex; align-items: baseline; justify-content: space-between;
}
.cp-eyebrow {
  font-size: 12px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 600; color: var(--ink-3);
}
.cp-stats { font-size: 13px; color: var(--ink-2); display: flex; gap: 12px; align-items: center; }
.cp-stat-sep { width: 3px; height: 3px; border-radius: 50%; background: #c6c6c0; }

.cp-search-wrap { display: flex; flex-direction: column; gap: 10px; }
.cp-search {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid #e3e3e1;
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.04);
  transition: border-color 100ms;
}
.cp-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(37,99,170,0.12), 0 8px 24px rgba(0,0,0,0.06); }
.cp-search-icon { color: var(--ink-3); flex-shrink: 0; }
.cp-input-row {
  flex: 1;
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
  min-width: 0;
}
.cp-input {
  flex: 1; min-width: 200px;
  border: none; outline: none;
  font: inherit;
  font-size: 17px;
  color: var(--ink);
  background: transparent;
  padding: 4px 0;
}
.cp-input::placeholder { color: var(--ink-3); }
.cp-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: #ecf0f7;
  color: #1d4d87;
  font-size: 12.5px;
  padding: 4px 4px 4px 10px;
  border-radius: 6px;
  font-family: "JetBrains Mono", ui-monospace, monospace;
}
.cp-chip strong { font-weight: 600; }
.cp-chip-x {
  background: rgba(29,77,135,0.12);
  border: none;
  color: #1d4d87;
  cursor: pointer;
  width: 18px; height: 18px;
  border-radius: 4px;
  font-size: 12px; line-height: 1;
}
.cp-chip-x:hover { background: rgba(29,77,135,0.2); }
.cp-kbd {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 11px;
  background: #f3f3f0;
  border: 1px solid #dcdcd8;
  border-bottom-width: 2px;
  border-radius: 4px;
  padding: 1px 6px;
  color: var(--ink-2);
}
.cp-suggestions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 4px;
}
.cp-sugg-label { font-size: 12px; }
.cp-sugg {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 12px;
  background: transparent;
  border: 1px dashed #c6c6c0;
  color: var(--ink-2);
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.cp-sugg:hover { border-color: var(--accent); color: var(--accent); }
.cp-sugg strong { color: var(--ink); font-weight: 600; }

.cp-results {
  background: #fff;
  border: 1px solid #e3e3e1;
  border-radius: 12px;
  overflow: hidden;
}
.cp-results-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #ececea;
  font-size: 12px;
  color: var(--ink-2);
  background: #fafafa;
}
.cp-sort { display: flex; gap: 2px; }
.cp-sort-btn {
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 12px; color: var(--ink-3);
  padding: 3px 9px; border-radius: 4px;
}
.cp-sort-btn:hover { color: var(--ink); background: #f0f0ec; }
.cp-sort-btn.is-active { color: var(--ink); background: #ececea; font-weight: 500; }

.cp-list { list-style: none; padding: 0; margin: 0; }
.cp-row {
  display: grid;
  grid-template-columns: 22px 1fr auto auto auto auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f3f0;
  font-size: 13px;
  cursor: pointer;
}
.cp-row:last-child { border-bottom: none; }
.cp-row:hover { background: #fafafa; }
.cp-row.is-focused {
  background: #f0f4fa;
  box-shadow: inset 2px 0 0 var(--accent);
}
.cp-glyph {
  width: 18px; height: 18px;
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%;
  color: #fff; font-size: 11px; font-weight: 700;
}
.cp-ability { font-size: 13px; }
.cp-flag {
  font-size: 10.5px;
  color: var(--err-fg);
  letter-spacing: 0.04em;
  font-weight: 600;
}
.cp-spacer { flex: 1; }
.cp-user { display: inline-flex; align-items: center; gap: 6px; font-size: 12.5px; }
.cp-caller { font-size: 10.5px; }
.cp-duration, .cp-when { font-size: 11.5px; min-width: 38px; text-align: right; }
.cp-kbd-inline { font-size: 10px; }

.cp-foot {
  display: flex; align-items: center; gap: 18px;
  padding: 0 4px;
  font-size: 12px; color: var(--ink-2);
}
.cp-foot kbd { margin-right: 4px; }
/* ============================================================
   Hybrid layout (live)
   ============================================================ */
.dir-hybrid {
  --bg-d: #fafaf9;
  background: var(--bg-d);
  padding: 0;
  width: 100%;
  min-width: 0;
}
.hy-shell {
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  padding: 36px 40px 60px;
  display: flex; flex-direction: column;
  gap: 16px;
  box-sizing: border-box;
}
.hy-top {
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 24px;
}
.hy-title {
  font-size: 28px; font-weight: 700; margin: 0;
  letter-spacing: -0.02em;
}
.hy-sub { margin: 4px 0 0; color: var(--ink-2); font-size: 13px; }
.hy-spark { width: 240px; max-width: 240px; flex-shrink: 0; }
.hy-spark svg { width: 240px; height: 56px; max-width: 100%; display: block; }
.hy-spark-label { font-size: 10px; text-align: right; margin-top: 2px; }

.hy-search {
  display: flex; align-items: center; gap: 12px;
  background: #fff;
  border: 1px solid #e3e3e1;
  border-radius: 12px;
  padding: 12px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03), 0 8px 24px rgba(0,0,0,0.04);
}
.hy-search:focus-within { border-color: var(--accent); }

.hy-filterbar {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 24px;
  align-items: center;
  padding: 8px 4px;
}
.hy-fb-group {
  display: flex; align-items: center; gap: 6px;
  flex-wrap: wrap;
}
.hy-fb-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--ink-3);
  margin-right: 4px;
}
.hy-chip {
  display: inline-flex; align-items: center; gap: 6px;
  background: transparent;
  border: 1px solid transparent;
  cursor: pointer;
  font: inherit;
  padding: 3px 8px;
  border-radius: 999px;
  color: var(--ink-2);
  opacity: 0.55;
  font-size: 12px;
}
.hy-chip:hover { background: rgba(0,0,0,0.04); opacity: 1; }
.hy-chip.is-active {
  background: #fff;
  border-color: #dcdcd8;
  opacity: 1;
}
.hy-chip .pill { background: transparent !important; color: var(--ink) !important; padding: 0; font-size: 11.5px; }

.hy-suggestions {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 0 4px;
  margin-top: -4px;
}

.hy-stream-wrap {
  margin-top: 4px;
}
.hy-stream-head {
  display: flex; justify-content: space-between; align-items: center;
  padding: 4px 4px 14px;
  font-size: 12px;
  border-bottom: 1px solid #ececea;
  margin-bottom: 18px;
}

.hy-foot {
  display: flex; align-items: center; gap: 18px;
  padding: 14px 4px 0;
  border-top: 1px solid #ececea;
  margin-top: 16px;
  font-size: 12px;
}
.hy-foot kbd { margin-right: 4px; }
/* Hybrid full-screen styles */

/* Cards & detail */
.hy-top-sm .hy-title { font-size: 22px; min-width: 0; }
.hy-top-sm { flex-wrap: nowrap; align-items: flex-start; }
.hy-top-sm > div:first-child { min-width: 0; flex: 1 1 auto; }
.hy-top-right { display: flex; gap: 24px; align-items: flex-start; flex-shrink: 0; }
.hy-detail-actions { display: flex; gap: 8px; flex-wrap: nowrap; }
.hy-detail-actions .btn { white-space: nowrap; }
.hy-crumb { font-size: 12px; color: var(--ink-2); margin-bottom: 4px; display: flex; gap: 6px; align-items: center; }
.hy-crumb a { color: var(--accent); text-decoration: none; }
.hy-crumb a:hover { text-decoration: underline; }
.hy-destructive-tag {
  font-size: 10px; background: #fbeceb; color: var(--err-fg);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600;
  padding: 3px 7px; border-radius: 3px;
}

.hy-detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.hy-card {
  background: #fff; border: 1px solid #e3e3e1; border-radius: 10px;
  overflow: hidden;
}
.hy-card.hy-span-2 { grid-column: span 2; }
.hy-card-head {
  padding: 12px 16px;
  border-bottom: 1px solid #ececea;
  background: #fafafa;
  display: flex; align-items: center; justify-content: space-between;
}
.hy-card-head h3 {
  margin: 0; font-size: 13px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em; color: var(--ink-2);
}
.hy-card-tabs { display: flex; gap: 2px; }
.hy-card-tabs button {
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 12px;
  padding: 4px 10px; border-radius: 4px;
  color: var(--ink-3);
}
.hy-card-tabs button:hover { color: var(--ink); background: #ececea; }
.hy-card-tabs button.is-active {
  background: var(--ink); color: #fff;
}

.hy-kv {
  margin: 0; padding: 8px 16px;
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 6px 14px;
  font-size: 12.5px;
}
.hy-kv dt {
  font-size: 11px; color: var(--ink-3); font-weight: 500;
  text-transform: uppercase; letter-spacing: 0.04em;
  padding-top: 1px;
}
.hy-kv dd { margin: 0; color: var(--ink); min-width: 0; }
.hy-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.hy-surfaces { list-style: none; padding: 0; margin: 0; }
.hy-surfaces li {
  padding: 10px 16px;
  border-bottom: 1px solid #f3f3f0;
  display: flex; align-items: center; gap: 10px;
  font-size: 12.5px;
}
.hy-surfaces li:last-child { border-bottom: none; }

.hy-diff-body { padding: 6px 0; }
.hy-diff-surface { padding: 4px 0 10px; }
.hy-diff-surface + .hy-diff-surface { border-top: 1px solid #f3f3f0; padding-top: 10px; }
.hy-diff-shead {
  padding: 6px 16px 8px;
  font-size: 11.5px;
  display: flex; gap: 10px; align-items: center;
}
.hy-diff-row {
  display: grid;
  grid-template-columns: minmax(160px, 220px) 1fr 24px 1fr;
  gap: 10px;
  align-items: center;
  padding: 6px 16px;
  font-size: 12.5px;
}
.hy-diff-key { color: var(--ink-2); }
.hy-diff-before {
  background: var(--diff-rem-bg); color: var(--diff-rem-fg);
  padding: 3px 8px; border-radius: 3px;
  text-decoration: line-through;
  text-decoration-color: rgba(132,34,41,0.4);
}
.hy-diff-arrow { color: var(--ink-3); text-align: center; }
.hy-diff-after {
  background: var(--diff-add-bg); color: var(--diff-add-fg);
  padding: 3px 8px; border-radius: 3px;
  font-weight: 500;
}
.hy-diff-row-rev .hy-diff-before { text-decoration: none; }

.hy-timeline { list-style: none; padding: 0; margin: 0; }
.hy-timeline li {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid #f3f3f0;
  align-items: center;
  font-size: 12.5px;
}
.hy-timeline li:last-child { border-bottom: none; }
.hy-tl-dot { width: 8px; height: 8px; border-radius: 50%; margin-left: 3px; }
.hy-tl-sub { font-size: 11px; margin-top: 1px; }
.hy-tl-when { font-size: 11.5px; }

/* Empty state */
.hy-search-disabled { opacity: 0.5; pointer-events: none; }
.hy-empty {
  display: grid;
  grid-template-columns: 24px 1fr;
  gap: 14px;
  margin-top: 8px;
}
.hy-empty-rail {
  display: flex; flex-direction: column; align-items: center;
  padding-top: 16px;
}
.hy-empty-dot {
  width: 14px; height: 14px; border-radius: 50%;
  background: #fff;
  border: 2px solid var(--accent);
  box-shadow: 0 0 0 4px rgba(37,99,170,0.12);
  animation: hy-pulse 1.8s ease-in-out infinite;
}
@keyframes hy-pulse { 50% { box-shadow: 0 0 0 8px rgba(37,99,170,0.06); } }
.hy-empty-line {
  width: 1px; flex: 1; min-height: 80px;
  background: linear-gradient(to bottom, #c7d2dc, transparent);
  margin-top: 4px;
}
.hy-empty-card {
  background: #fff; border: 1px solid #e3e3e1; border-radius: 10px;
  padding: 22px 24px;
}
.hy-empty-card h2 {
  font-size: 18px; margin: 0 0 6px; font-weight: 600;
  letter-spacing: -0.005em;
}
.hy-empty-card p { color: var(--ink-2); margin: 0 0 18px; max-width: 540px; font-size: 13px; }
.hy-empty-checks { display: flex; flex-direction: column; gap: 6px; margin-bottom: 18px; }
.hy-empty-check { font-size: 12.5px; display: flex; align-items: center; gap: 8px; }
.hy-empty-tick {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%;
  background: var(--ok-fg); color: #fff;
  font-size: 10px; font-weight: 700;
}
.hy-empty-tick-pending { background: #c08400; }
.hy-empty-actions { display: flex; gap: 8px; margin-bottom: 18px; }
.hy-empty-cli {
  font-size: 12px;
  background: #1d2327; color: #d8dde2;
  padding: 10px 12px;
  border-radius: 6px;
  display: flex; gap: 10px; align-items: center;
}
.hy-empty-cli code { color: #ffd479; }

/* Modal */
.hy-modal-stage {
  position: relative;
  min-height: 600px;
  background: rgba(20, 26, 34, 0.45);
  display: flex; align-items: center; justify-content: center;
  overflow: hidden;
  border-radius: 8px;
}
.hy-modal-bg {
  position: absolute; inset: 0;
  padding: 32px 60px;
  filter: blur(2px);
  opacity: 0.55;
}
.hy-modal-bg-list { display: flex; flex-direction: column; gap: 10px; margin-top: 24px; }
.hy-modal-bg-row {
  height: 50px; background: #fff; border: 1px solid #ececea;
  border-radius: 8px;
}
.hy-modal-bg-row-active { border-color: var(--accent); box-shadow: 0 0 0 2px rgba(37,99,170,0.2); }

.hy-modal {
  position: relative;
  width: 100%; max-width: 540px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.25), 0 4px 12px rgba(0,0,0,0.08);
  overflow: hidden;
  z-index: 1;
}
.hy-modal-head {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 12px; align-items: flex-start;
  padding: 18px 18px 14px;
}
.hy-modal-icon {
  width: 36px; height: 36px;
  border-radius: 50%;
  background: #fbeceb; color: var(--err-fg);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 700;
}
.hy-modal-head h2 { margin: 0; font-size: 16px; font-weight: 600; }
.hy-modal-sub { margin: 2px 0 0; font-size: 12px; }
.hy-modal-close {
  background: none; border: none; cursor: pointer;
  font-size: 20px; line-height: 1; color: var(--ink-3); padding: 2px 6px;
  border-radius: 4px;
}
.hy-modal-close:hover { background: #f3f3f0; color: var(--ink); }
.hy-modal-body { padding: 0 18px 14px; }
.hy-modal-summary {
  background: #fafafa; border: 1px solid #ececea; border-radius: 8px;
  padding: 10px 14px;
  display: flex; flex-direction: column; gap: 6px;
  font-size: 12.5px;
}
.hy-modal-summary > div { display: grid; grid-template-columns: 80px 1fr; gap: 12px; align-items: center; }
.hy-modal-k { font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }
.hy-modal-surface {
  display: inline-block;
  background: #ececea; padding: 1px 6px; border-radius: 3px;
  font-size: 11px; margin-right: 4px;
}
.hy-modal-preview { margin-top: 10px; }
.hy-modal-preview summary {
  font-size: 12px; color: var(--ink-2); cursor: pointer;
  padding: 6px 0; user-select: none;
}
.hy-modal-preview summary:hover { color: var(--ink); }
.hy-modal-warn {
  margin-top: 10px;
  display: flex; gap: 8px; align-items: flex-start;
  padding: 8px 10px;
  background: #fdf3dd; color: #6e4a00;
  border-radius: 6px; font-size: 12px;
}
.hy-modal-foot {
  padding: 12px 18px;
  border-top: 1px solid #ececea;
  background: #fafafa;
  display: flex; align-items: center; gap: 12px;
}
.hy-modal-kbd-hint { font-size: 11.5px; }

/* Banners + toasts */
.hy-banner {
  display: grid;
  grid-template-columns: 24px 1fr auto auto auto;
  gap: 12px; align-items: center;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid #e3e3e1;
  border-left: 3px solid var(--ok-fg);
  border-radius: 8px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.03);
  font-size: 13px;
}
.hy-banner.error { border-left-color: var(--err-fg); }
.hy-banner-glyph {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--ok-fg); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.hy-banner.error .hy-banner-glyph { background: var(--err-fg); }
.hy-banner-body { min-width: 0; }
.hy-banner-x {
  background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; color: var(--ink-3); padding: 2px 6px;
  border-radius: 4px;
}
.hy-banner-x:hover { background: #f3f3f0; color: var(--ink); }

.hy-toast-stack { display: flex; flex-direction: column; gap: 10px; align-items: flex-end; }
.hy-toast {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 10px;
  padding: 11px 14px;
  background: #fff;
  border: 1px solid #e3e3e1;
  border-left: 3px solid var(--ok-fg);
  border-radius: 8px;
  min-width: 320px;
  max-width: 460px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.1), 0 1px 2px rgba(0,0,0,0.04);
  font-size: 12.5px;
}
.hy-toast.error { border-left-color: var(--err-fg); }
.hy-toast.pending { border-left-color: #c08400; }
.hy-toast-glyph {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--ok-fg); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.hy-toast.error .hy-toast-glyph { background: var(--err-fg); }
.hy-toast.pending .hy-toast-glyph { background: #c08400; }
.hy-toast-body { min-width: 0; }
.hy-toast-title { font-weight: 600; color: var(--ink); margin-bottom: 2px; font-size: 13px; }
.hy-toast-progress {
  margin-top: 6px; height: 3px; background: #ececea;
  border-radius: 2px; overflow: hidden;
}
.hy-toast-progress span {
  display: block; height: 100%; background: #c08400;
  animation: hy-progress 1.2s ease-in-out infinite alternate;
}
@keyframes hy-progress { from { transform: translateX(-10%); } to { transform: translateX(0); } }

/* Live prototype additions */
.hy-search { transition: border-color 0.15s, box-shadow 0.15s; }
.hy-search-active { position: relative; }

.hy-suggest-pop {
  position: absolute;
  top: calc(100% + 6px);
  left: 0; right: 0;
  background: #fff;
  border: 1px solid #dcdcd8;
  border-radius: 10px;
  box-shadow: 0 12px 32px rgba(0,0,0,0.12), 0 2px 6px rgba(0,0,0,0.04);
  overflow: hidden;
  z-index: 50;
  max-height: 320px;
  overflow-y: auto;
}
.hy-suggest-item {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%;
  padding: 8px 14px;
  background: transparent;
  border: none;
  cursor: pointer;
  font: inherit;
  text-align: left;
  font-size: 13px;
  color: var(--ink);
}
.hy-suggest-item:hover, .hy-suggest-item.is-active {
  background: var(--accent);
  color: #fff;
}
.hy-suggest-item:hover .dim, .hy-suggest-item.is-active .dim { color: rgba(255,255,255,0.75); }
.hy-suggest-foot {
  padding: 8px 14px;
  border-top: 1px solid #ececea;
  font-size: 11px;
  background: #fafafa;
}

.tl-event { cursor: pointer; transition: background 0.1s; }
.tl-event .tl-card { transition: border-color 0.15s, box-shadow 0.15s; }
.tl-event:hover .tl-card { border-color: #c8c8c4; }
.tl-event-selected .tl-card {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,170,0.12);
}
.tl-event:focus { outline: none; }

.hy-no-results {
  padding: 60px 24px;
  text-align: center;
  background: #fff;
  border: 1px dashed #dcdcd8;
  border-radius: 10px;
}
.hy-no-results h3 { margin: 0 0 6px; font-size: 15px; font-weight: 600; }
.hy-no-results p { margin: 0 0 16px; font-size: 13px; }

.hy-codeblock {
  margin: 0;
  padding: 14px 16px;
  background: #1d2327;
  color: #d8dde2;
  font-size: 12.5px;
  line-height: 1.6;
  border-radius: 0;
  overflow-x: auto;
  white-space: pre;
}
.hy-codeblock .jk { color: #79b8ff; }      /* keys: blue */
.hy-codeblock .js { color: #c8e1a0; }      /* strings: green */
.hy-codeblock .jn { color: #ffd479; }      /* numbers: amber */
.hy-codeblock .jb { color: #ff7b72; }      /* booleans: red */
.hy-codeblock .jnl { color: #b392f0; font-style: italic; } /* null: purple */

/* Modal overlay (live, full coverage) */
.hy-modal-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 26, 34, 0.5);
  backdrop-filter: blur(2px);
  display: flex; align-items: center; justify-content: center;
  z-index: 100;
  padding: 20px;
  animation: hy-fade-in 0.15s ease-out;
}
.hy-modal-overlay .hy-modal {
  animation: hy-modal-in 0.18s ease-out;
}
@keyframes hy-fade-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes hy-modal-in {
  from { opacity: 0; transform: translateY(8px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

/* Toast stack - fixed bottom-right */
.hy-toast-fixed {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 200;
  pointer-events: none;
}
.hy-toast-fixed .hy-toast {
  pointer-events: auto;
  animation: hy-toast-in 0.22s ease-out;
}
@keyframes hy-toast-in {
  from { opacity: 0; transform: translateX(20px); }
  to { opacity: 1; transform: translateX(0); }
}
.hy-toast a { color: inherit; text-decoration: underline; }
.hy-toast a:hover { color: var(--accent); }

button[disabled] { opacity: 0.4; cursor: not-allowed; }

/* Snapshot drawer */
.hy-drawer-overlay {
  position: fixed; inset: 0;
  background: rgba(20, 26, 34, 0.4);
  z-index: 90;
  display: flex; justify-content: flex-end;
  animation: hy-fade-in 0.15s ease-out;
}
.hy-drawer {
  width: 540px;
  max-width: 100%;
  height: 100%;
  background: #fafaf9;
  border-left: 1px solid #dcdcd8;
  box-shadow: -8px 0 32px rgba(0,0,0,0.12);
  display: flex; flex-direction: column;
  animation: hy-drawer-in 0.2s cubic-bezier(0.2, 0.8, 0.2, 1);
}
@keyframes hy-drawer-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}
.hy-drawer-head {
  padding: 18px 20px;
  border-bottom: 1px solid #ececea;
  background: #fff;
  display: flex; justify-content: space-between; align-items: flex-start;
  gap: 16px;
  flex-shrink: 0;
}
.hy-drawer-head h2 { margin: 2px 0 0; font-size: 15px; font-weight: 600; }
.hy-drawer-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  display: flex; flex-direction: column; gap: 14px;
}
.hy-drawer-foot {
  padding: 12px 20px;
  border-top: 1px solid #ececea;
  background: #fff;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
}

/* Day-level pagination + jumpbar */
.hy-stream-head { gap: 14px; flex-wrap: wrap; }
.hy-stream-head-left { flex: 1; min-width: 200px; }

.hy-jumpbar {
  display: inline-flex; align-items: center; gap: 4px;
  background: #fff; border: 1px solid #ececea; border-radius: 6px;
  padding: 3px 4px;
}
.hy-jump-step {
  background: transparent; border: none; cursor: pointer;
  font: inherit; font-size: 14px;
  width: 24px; height: 24px;
  border-radius: 4px;
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.hy-jump-step:hover { background: #f3f3f0; color: var(--ink); }
.hy-jump-input {
  border: none; background: transparent; font: inherit; font-size: 12px;
  padding: 3px 4px; min-width: 130px;
  color: var(--ink);
  font-family: var(--font-mono, ui-monospace, monospace);
}
.hy-jump-input:focus { outline: none; box-shadow: 0 0 0 2px rgba(37,99,170,0.18); border-radius: 3px; }
.hy-jump-today {
  margin-left: 4px; padding: 0 6px;
  font-size: 11.5px;
}

.hy-day-head { gap: 10px; }
.hy-day-toggle {
  background: transparent; border: 1px solid transparent;
  cursor: pointer; font: inherit; font-size: 11px;
  padding: 3px 8px; border-radius: 4px;
  color: var(--ink-3);
}
.hy-day-toggle:hover { background: #f3f3f0; color: var(--ink); border-color: #dcdcd8; }
.hy-day-stat-err { color: var(--err-fg); }

.hy-day-pager {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; flex-wrap: wrap;
  padding: 12px 0 6px;
  margin-left: 28px;
  border-top: 1px solid #f3f3f0;
  margin-top: 4px;
}
.hy-day-pager-meta { font-size: 11.5px; }
.hy-day-pager-nums { display: inline-flex; align-items: center; gap: 2px; }
.hy-day-pager-btn {
  background: transparent; border: 1px solid transparent;
  cursor: pointer; font: inherit; font-size: 11.5px;
  min-width: 24px; height: 24px;
  padding: 0 6px;
  border-radius: 4px;
  color: var(--ink-2);
}
.hy-day-pager-btn:hover:not(:disabled) { background: #f3f3f0; color: var(--ink); }
.hy-day-pager-btn:disabled { opacity: 0.35; cursor: default; }
.hy-day-pager-btn.is-active {
  background: var(--ink); color: #fff;
  font-weight: 600;
}
.hy-day-pager-btn.is-active:hover { background: var(--ink); color: #fff; }
.hy-day-pager-ellipsis { padding: 0 4px; font-size: 11.5px; }

.hy-load-more-wrap {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  padding: 24px 0 8px;
}
.hy-load-more-btn { padding: 10px 18px; font-size: 13px; }
.hy-load-more-hint { padding-top: 2px; }

/* Narrow */
.hy-narrow .hy-shell { padding: 22px 18px 40px; max-width: 100%; }
.hy-narrow .hy-top { flex-direction: column; align-items: stretch; gap: 10px; }
.hy-narrow .hy-top-right { justify-content: flex-start; }
.hy-narrow .hy-search { padding: 10px 12px; }
.hy-narrow .cp-input { font-size: 14px; }
.hy-filterbar-narrow { gap: 10px 14px; }
.hy-narrow .hy-detail-grid { grid-template-columns: 1fr; }
.hy-narrow .hy-card.hy-span-2 { grid-column: span 1; }
.hy-narrow .hy-diff-row { grid-template-columns: 1fr; gap: 4px; }
.hy-narrow .hy-diff-arrow { display: none; }

/* Page-shell rules: wp-admin chrome adjustments for the AbilityGuard page. */
.abilityguard-wrap { margin: 0; padding: 0; }
.abilityguard-wrap > #wpfooter, #wpfooter { display: none; }
body.toplevel_page_abilityguard #wpcontent,
body.tools_page_abilityguard #wpcontent { padding-left: 0; }
.abilityguard-wrap .ag-root { margin-left: -20px; margin-right: -20px; }
.ag-approval-flash {
  box-shadow: 0 0 0 2px var(--accent, #ff9b06) !important;
  background: rgba(255, 155, 6, 0.08) !important;
}
