:root {
  color-scheme: light;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f5f6f8;
  color: #16181d;
}
* { box-sizing: border-box; }
body { margin: 0; min-height: 100vh; background: #f5f6f8; }
button, input, select, textarea { font: inherit; }
button { border: 0; border-radius: 8px; padding: 9px 13px; background: #1f2937; color: #fff; cursor: pointer; }
button:hover { filter: brightness(.95); }
button.secondary { background: #e7e9ee; color: #20242b; }
button.ghost { background: transparent; color: #49515c; border: 1px solid #d8dbe2; }
button.danger { background: #a33b3b; }
button.small { padding: 7px 10px; font-size: 13px; }
.hidden { display: none !important; }
.muted { color: #6b7280; font-size: 13px; margin: 4px 0 0; }
.error { color: #a33b3b; min-height: 20px; }
.eyebrow { margin: 0 0 6px; font-size: 11px; letter-spacing: .12em; font-weight: 700; color: #737b87; }
.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 24px; }
.login-card { width: min(420px, 100%); background: #fff; border: 1px solid #e2e4e9; border-radius: 14px; padding: 28px; box-shadow: 0 10px 32px rgba(20,24,32,.06); }
.login-card h1 { margin: 0; font-size: 25px; }
label { display: grid; gap: 7px; margin: 20px 0; font-size: 13px; font-weight: 600; }
input, select, textarea { border: 1px solid #d8dbe2; border-radius: 8px; background: #fff; padding: 9px 10px; color: #16181d; }
.topbar { min-height: 74px; display: flex; align-items: center; justify-content: space-between; padding: 14px 22px; border-bottom: 1px solid #dcdee4; background: #fff; position: sticky; top: 0; z-index: 5; }
.topbar h1 { margin: 0; font-size: 19px; }
.top-actions { display: flex; align-items: center; gap: 8px; }
.status-pill { border-radius: 999px; background: #eef0f4; padding: 6px 10px; font-size: 12px; }
.workspace { display: grid; grid-template-columns: minmax(340px, 1.2fr) minmax(230px, .75fr) minmax(360px, 1.25fr); gap: 12px; padding: 12px; min-height: calc(100vh - 240px); }
.panel, .audit-strip { background: #fff; border: 1px solid #e0e2e8; border-radius: 12px; min-width: 0; }
.panel { padding: 14px; max-height: calc(100vh - 104px); overflow: auto; }
.panel-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.panel h2, .audit-strip h2 { font-size: 15px; margin: 0; }
.filters { display: grid; grid-template-columns: 1fr 130px 130px; gap: 7px; margin: 14px 0 8px; }
.bulk-row { display: flex; gap: 7px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }
.host-block { border-top: 1px solid #eceef2; padding: 12px 0 4px; }
.host-title { display: flex; gap: 7px; align-items: center; flex-wrap: wrap; font-weight: 700; font-size: 13px; }
.host-meta { color: #777f8b; font-size: 12px; margin: 3px 0 7px; }
.tag { background: #f0f1f4; border-radius: 999px; padding: 2px 7px; font-size: 11px; font-weight: 500; }
.resource-row { display: grid; grid-template-columns: 22px 78px minmax(0,1fr) auto; align-items: center; gap: 7px; padding: 7px 5px; border-radius: 7px; }
.resource-row:hover { background: #f7f8fa; }
.resource-kind { font-size: 11px; text-transform: uppercase; color: #747c87; }
.resource-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.resource-state { font-size: 11px; color: #5e6672; }
.client-card { border: 1px solid #e3e5ea; border-radius: 9px; padding: 11px; margin-top: 9px; cursor: pointer; }
.client-card.active { border-color: #2f3744; box-shadow: inset 3px 0 0 #2f3744; }
.client-card.revoked { opacity: .55; }
.client-name { font-size: 13px; font-weight: 700; }
.client-id { color: #7a818c; font-size: 10px; word-break: break-all; margin-top: 4px; }
.policy-toolbar { display: grid; gap: 7px; grid-template-columns: 1fr auto auto; margin: 14px 0 10px; }
.capability-help { background: #f7f8fa; border-radius: 8px; padding: 9px; color: #555e69; font-size: 12px; min-height: 38px; }
.policy-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 12px; }
.policy-columns h3 { margin: 0 0 6px; font-size: 12px; color: #666f7b; }
.scope-list { border: 1px solid #e4e6eb; border-radius: 8px; min-height: 150px; max-height: 330px; overflow: auto; padding: 6px; }
.scope-item { font-size: 11px; padding: 5px; border-bottom: 1px solid #f0f1f4; word-break: break-all; }
.scope-empty, .empty-state { color: #8a919b; font-size: 13px; padding: 18px 4px; }
.save-row { display: flex; align-items: center; justify-content: flex-end; gap: 12px; margin-top: 12px; }
.client-actions { display: flex; gap: 7px; justify-content: flex-end; margin-top: 8px; }
.audit-strip { margin: 0 12px 12px; padding: 13px; }
.audit-list { display: grid; gap: 6px; margin-top: 9px; max-height: 150px; overflow: auto; }
.audit-row { display: grid; grid-template-columns: 155px 90px 150px 1fr 80px; gap: 8px; font-size: 11px; color: #4f5864; }
.audit-result.allowed { color: #18794e; }
.audit-result.denied { color: #a33b3b; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; }
dialog { border: 1px solid #dfe2e7; border-radius: 12px; padding: 0; width: min(520px, calc(100% - 32px)); }
dialog::backdrop { background: rgba(25,30,38,.25); }
dialog form { padding: 22px; }
dialog h2 { margin: 0; }
dialog textarea { width: 100%; min-height: 90px; resize: vertical; margin-top: 12px; font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 15px; }
.toast { position: fixed; right: 18px; bottom: 18px; max-width: 420px; background: #20242b; color: #fff; border-radius: 9px; padding: 11px 14px; font-size: 13px; box-shadow: 0 8px 28px rgba(0,0,0,.18); z-index: 20; }
@media (max-width: 1050px) {
  .workspace { grid-template-columns: 1fr; }
  .panel { max-height: none; }
  .filters, .policy-toolbar, .policy-columns { grid-template-columns: 1fr; }
  .audit-row { grid-template-columns: 1fr 1fr; }
}
