/* ═══════════════════════════════════════════════════════════════
   POLICY ADMIN — Settings → Policies & Guardrails
   Tokens: --bg-0/1/2/card, --border, --border-soft,
           --text/-dim/-faint, --accent, --good, --warn, --bad,
           --font-mono, --radius, --radius-lg, --accent-fg, --accent-ghost
═══════════════════════════════════════════════════════════════ */

.pol-admin { color: var(--text); }

.pol-loading {
  padding: 80px 20px; text-align: center; color: var(--text-dim); font-size: 13px;
}

/* ── Overview strip ──────────────────────────────────────── */
.pol-overview {
  display: flex; align-items: center; gap: 28px;
  padding: 18px 22px;
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  margin-bottom: 18px;
}
.pol-overview-stat { display: flex; flex-direction: column; gap: 2px; min-width: 70px; }
.pol-overview-num {
  font-family: var(--font-display);
  font-size: 28px; font-weight: 500;
  line-height: 1; color: var(--text);
  letter-spacing: -0.02em;
}
.pol-overview-denom {
  font-size: 15px; color: var(--text-faint); font-weight: 400; margin-left: 2px;
}
.pol-overview-lbl {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.08em; font-weight: 500;
}
.pol-overview-div {
  width: 1px; align-self: stretch; background: var(--border-soft); margin: 0 6px;
}
.pol-overview-hint {
  margin-left: auto; font-size: 11px; color: var(--text-faint); font-style: italic;
}

/* ── Three-column layout ─────────────────────────────────── */
.pol-layout {
  display: grid;
  grid-template-columns: 320px 1fr 300px;
  gap: 14px;
  min-height: 70vh;
}

/* ── LEFT column — policy list ───────────────────────────── */
.pol-list-col {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.pol-list-head {
  padding: 12px 12px 8px;
  display: flex; gap: 8px; align-items: center;
  border-bottom: 1px solid var(--border-soft);
}
.pol-search {
  flex: 1;
  padding: 7px 10px;
  font-size: 12.5px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.pol-search:focus { border-color: var(--accent); }
.pol-new-btn {
  padding: 7px 12px;
  font-size: 12px; font-weight: 600;
  background: var(--accent);
  color: var(--accent-fg);
  border: 0; border-radius: 6px;
  cursor: pointer; white-space: nowrap;
}
.pol-list-filters {
  padding: 6px 12px 10px;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border-soft);
  font-size: 11.5px; color: var(--text-dim);
}
.pol-filter { display: flex; align-items: center; gap: 6px; cursor: pointer; }
.pol-filter input { margin: 0; }
.pol-reset-btn {
  background: transparent;
  border: 0;
  color: var(--text-faint);
  font-size: 11px;
  cursor: pointer;
  text-decoration: underline;
  font-family: inherit;
}
.pol-reset-btn:hover { color: var(--text-dim); }

.pol-list {
  flex: 1; overflow-y: auto;
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.pol-list-empty {
  padding: 40px 12px; text-align: center; font-size: 12px; color: var(--text-faint);
}

.pol-row {
  text-align: left;
  padding: 11px 12px;
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  cursor: pointer;
  font-family: inherit;
  color: var(--text);
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color .08s, background .08s;
}
.pol-row:hover { border-color: var(--border); }
.pol-row.is-selected {
  border-color: var(--accent);
  background: var(--accent-ghost);
}
.pol-row.is-inactive { opacity: 0.55; }
.pol-row-head {
  display: flex; align-items: center; justify-content: space-between;
}
.pol-row-eff {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.06em;
  display: flex; align-items: center; gap: 4px;
}
.pol-row-eff-glyph { font-size: 13px; }
.pol-row-pri {
  font-size: 10.5px; font-family: var(--font-mono);
  color: var(--text-faint);
  background: var(--bg-2);
  padding: 2px 6px; border-radius: 10px;
}
.pol-row-name {
  font-size: 13px; font-weight: 600; color: var(--text);
  line-height: 1.3;
}
.pol-row-sum {
  font-size: 11.5px; color: var(--text-dim);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.pol-row-tags {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 2px;
}
.pol-row-verb, .pol-row-verb-more, .pol-row-tag {
  font-size: 10px; font-family: var(--font-mono);
  background: var(--bg-2);
  color: var(--text-dim);
  padding: 2px 6px;
  border-radius: 3px;
}
.pol-row-verb-more { color: var(--text-faint); }
.pol-row-tag {
  background: color-mix(in oklab, var(--accent) 12%, var(--bg-2));
  color: var(--accent);
}
.pol-row-foot {
  display: flex; align-items: center; justify-content: space-between; margin-top: 4px;
  padding-top: 8px; border-top: 1px dashed var(--border-soft);
}
.pol-row-builtin {
  font-size: 10px; font-family: var(--font-mono);
  color: var(--text-faint); text-transform: uppercase; letter-spacing: 0.05em;
}

/* Toggle */
.pol-toggle { display: flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; }
.pol-toggle input { display: none; }
.pol-toggle-track {
  width: 26px; height: 14px;
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: 10px; position: relative;
  transition: background .12s;
}
.pol-toggle-thumb {
  position: absolute; top: 1px; left: 1px;
  width: 10px; height: 10px;
  background: var(--text-dim);
  border-radius: 50%;
  transition: transform .12s, background .12s;
}
.pol-toggle input:checked ~ .pol-toggle-track { background: var(--good); border-color: var(--good); }
.pol-toggle input:checked ~ .pol-toggle-track .pol-toggle-thumb {
  transform: translateX(12px); background: white;
}
.pol-toggle-label { font-size: 11px; color: var(--text-dim); }

/* ── CENTER column — editor ──────────────────────────────── */
.pol-editor-col {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow-y: auto;
}
.pol-editor {
  padding: 20px 22px;
  display: flex; flex-direction: column; gap: 20px;
}
.pol-empty-state {
  padding: 80px 20px; text-align: center; color: var(--text-faint);
}
.pol-empty-glyph { font-size: 48px; color: var(--border); margin-bottom: 12px; }
.pol-empty-title { font-size: 15px; font-weight: 500; color: var(--text-dim); margin-bottom: 4px; }
.pol-empty-sub { font-size: 12px; }

.pol-editor-head {
  display: flex; gap: 12px; align-items: flex-start; justify-content: space-between;
}
.pol-editor-name {
  flex: 1;
  font-family: var(--font-display);
  font-size: 22px; font-weight: 500;
  color: var(--text); background: transparent;
  border: 0; border-bottom: 1px solid transparent;
  padding: 4px 0;
  outline: none;
  letter-spacing: -0.01em;
}
.pol-editor-name:hover, .pol-editor-name:focus { border-bottom-color: var(--border-soft); }
.pol-editor-actions { display: flex; gap: 8px; align-items: center; }
.pol-btn-ghost {
  padding: 7px 11px; font-size: 12px; font-weight: 500;
  background: transparent; color: var(--text-dim);
  border: 1px solid var(--border); border-radius: 6px;
  cursor: pointer; font-family: inherit;
}
.pol-btn-ghost:hover { color: var(--text); border-color: var(--text-faint); }
.pol-btn-danger {
  padding: 7px 11px; font-size: 12px; font-weight: 500;
  background: transparent; color: var(--bad);
  border: 1px solid color-mix(in oklab, var(--bad) 35%, var(--border));
  border-radius: 6px;
  cursor: pointer; font-family: inherit;
}
.pol-btn-danger:hover { background: color-mix(in oklab, var(--bad) 10%, transparent); }
.pol-btn-primary {
  padding: 8px 14px; font-size: 12.5px; font-weight: 600;
  background: var(--accent); color: var(--accent-fg);
  border: 0; border-radius: 6px;
  cursor: pointer; font-family: inherit;
}
.pol-btn-primary.is-disabled, .pol-btn-primary:disabled {
  opacity: 0.45; cursor: not-allowed; background: var(--bg-2); color: var(--text-faint);
}

.pol-editor-summary, .pol-editor-reason {
  width: 100%; box-sizing: border-box;
  padding: 10px 12px;
  font-size: 13px; line-height: 1.5;
  color: var(--text);
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 6px;
  font-family: inherit;
  resize: vertical;
  outline: none;
}
.pol-editor-summary:focus, .pol-editor-reason:focus { border-color: var(--accent); }
.pol-editor-reason { min-height: 70px; }

.pol-section {
  display: flex; flex-direction: column; gap: 10px;
  padding-top: 16px; border-top: 1px solid var(--border-soft);
}
.pol-section:first-of-type { border-top: 0; padding-top: 0; }
.pol-section-inline {
  flex-direction: row; align-items: center; gap: 14px;
}
.pol-section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-dim);
  display: flex; align-items: baseline; gap: 10px;
}
.pol-section-label-inline { text-transform: uppercase; margin-right: 8px; }
.pol-hint {
  font-size: 11px; font-weight: 400;
  color: var(--text-faint);
  text-transform: none; letter-spacing: 0; font-style: italic;
}

/* Effect cards */
.pol-effect-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px;
}
.pol-effect-card {
  padding: 12px;
  background: var(--bg-0);
  border: 1.5px solid var(--border);
  border-radius: 8px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  transition: border-color .1s, background .1s;
}
.pol-effect-card:hover { border-color: var(--text-faint); }
.pol-effect-card.is-selected {
  background: color-mix(in oklab, currentColor 8%, var(--bg-0));
  border-width: 1.5px;
}
.pol-effect-head {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; font-weight: 600; margin-bottom: 4px;
}
.pol-effect-glyph { font-size: 15px; }
.pol-effect-desc {
  font-size: 11.5px; line-height: 1.4; color: var(--text-dim);
}

/* Condition rows */
.pol-cond-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--border-soft);
}
.pol-cond-row:last-child { border-bottom: 0; }
.pol-cond-row-v { align-items: flex-start; }
.pol-cond-k {
  font-size: 12px; color: var(--text-dim); font-weight: 500;
}
.pol-cond-v { display: flex; flex-direction: column; gap: 6px; }
.pol-cond-inline { flex-direction: row; align-items: center; gap: 8px; flex-wrap: wrap; }
.pol-cond-input, .pol-cond-v select {
  padding: 6px 10px;
  font-size: 12.5px;
  background: var(--bg-0);
  border: 1px solid var(--border);
  border-radius: 5px;
  color: var(--text);
  font-family: inherit;
  outline: none;
}
.pol-cond-v select { cursor: pointer; }
.pol-cond-input:focus, .pol-cond-v select:focus { border-color: var(--accent); }
.pol-cond-num { width: 70px; text-align: right; font-family: var(--font-mono); }
.pol-cond-dollar { font-size: 13px; color: var(--text-dim); font-family: var(--font-mono); }
.pol-cond-label { font-size: 12px; color: var(--text-dim); }
.pol-checkbox {
  display: flex; align-items: center; gap: 8px; cursor: pointer;
  font-size: 12.5px; color: var(--text);
}
.pol-checkbox input { margin: 0; }

/* Verb picker */
.pol-verb-picker {
  display: flex; flex-wrap: wrap; gap: 4px;
  padding: 8px; background: var(--bg-0);
  border: 1px solid var(--border); border-radius: 6px;
  max-height: 140px; overflow-y: auto;
}
.pol-verb-chip {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 4px 8px;
  background: var(--bg-2);
  color: var(--text-dim);
  border: 1px solid transparent;
  border-radius: 4px;
  cursor: pointer;
  transition: all .08s;
}
.pol-verb-chip:hover { color: var(--text); }
.pol-verb-chip.is-on {
  background: var(--accent);
  color: var(--accent-fg);
  font-weight: 600;
}

/* Priority slider */
.pol-section-inline input[type="range"] { flex: 1; max-width: 300px; accent-color: var(--accent); }
.pol-priority-val {
  font-family: var(--font-mono); font-size: 13px;
  color: var(--text); min-width: 32px; text-align: right;
}

/* ── RIGHT column — preview ──────────────────────────────── */
.pol-preview-col {
  background: var(--bg-card);
  border: 1px solid var(--border-soft);
  border-radius: var(--radius-lg);
  overflow-y: auto;
}
.pol-preview { padding: 18px 16px; }
.pol-preview-head {
  padding-bottom: 12px; margin-bottom: 12px;
  border-bottom: 1px solid var(--border-soft);
}
.pol-preview-title {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-dim);
}
.pol-preview-sub {
  font-size: 11px; color: var(--text-faint);
  font-style: italic; margin-top: 3px;
}

.pol-preview-stat {
  text-align: center;
  padding: 16px 12px 18px;
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: 8px;
  margin-bottom: 16px;
}
.pol-preview-big {
  font-family: var(--font-display);
  font-size: 38px; font-weight: 500;
  color: var(--accent); line-height: 1;
  letter-spacing: -0.02em;
}
.pol-preview-big-lbl {
  font-size: 11px; color: var(--text-dim);
  text-transform: uppercase; letter-spacing: 0.06em;
  margin-top: 4px;
}

.pol-preview-section-label {
  font-size: 11px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--text-faint);
  margin-bottom: 8px;
}

.pol-preview-empty {
  padding: 20px 12px; text-align: center;
  background: var(--bg-0);
  border: 1px dashed var(--border); border-radius: 6px;
  font-size: 11.5px; color: var(--text-faint);
}
.pol-preview-empty-glyph {
  font-size: 22px; color: var(--border); margin-bottom: 6px;
}

.pol-preview-list {
  display: flex; flex-direction: column; gap: 6px;
}
.pol-preview-item, .pol-preview-eval {
  padding: 8px 10px;
  background: var(--bg-0);
  border: 1px solid var(--border-soft);
  border-radius: 5px;
}
.pol-preview-item-head, .pol-preview-eval-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 3px;
}
.pol-preview-verb, .pol-preview-eval-verb {
  font-family: var(--font-mono); font-size: 11px;
  color: var(--text); font-weight: 500;
}
.pol-preview-eval-verb { margin-bottom: 2px; }
.pol-preview-time {
  font-size: 10px; color: var(--text-faint);
}
.pol-preview-actor {
  font-family: var(--font-mono); font-size: 10.5px;
  color: var(--text-faint);
}
.pol-preview-args {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 5px;
}
.pol-preview-arg {
  font-size: 10px; font-family: var(--font-mono);
  background: var(--bg-2);
  border-radius: 3px; overflow: hidden;
  display: inline-flex;
}
.pol-preview-arg-k {
  padding: 2px 5px; background: var(--border-soft);
  color: var(--text-faint);
}
.pol-preview-arg-v {
  padding: 2px 5px; color: var(--text-dim);
}

.pol-verdict {
  font-size: 10px; font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.05em;
  padding: 2px 6px; border-radius: 3px;
}
.pol-verdict-allow { background: color-mix(in oklab, var(--good) 15%, transparent); color: var(--good); }
.pol-verdict-require_approval { background: color-mix(in oklab, var(--warn) 18%, transparent); color: var(--warn); }
.pol-verdict-block { background: color-mix(in oklab, var(--bad) 18%, transparent); color: var(--bad); }

/* ── Responsive collapse ────────────────────────────────── */
@media (max-width: 1280px) {
  .pol-layout {
    grid-template-columns: 280px 1fr;
  }
  .pol-preview-col { display: none; }
}
