:root {
  color-scheme: light;
  --background: #f4f7fb;
  --surface: #ffffff;
  --text: #172033;
  --muted: #5c667a;
  --line: #d9e0ea;
  --primary: #1859a9;
  --primary-dark: #10437f;
  --danger: #a92727;
  --warning: #8a5a00;
  --success: #176b3a;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--background); color: var(--text); line-height: 1.5; }
a { color: var(--primary); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid #ffbf47;
  outline-offset: 2px;
}
.skip-link { position: absolute; left: -9999px; }
.skip-link:focus { left: 1rem; top: 1rem; z-index: 20; background: #fff; padding: .75rem; }
.site-header { background: #102a43; color: #fff; }
.header-inner { max-width: 1200px; margin: auto; padding: .8rem 1rem; display: flex; gap: 1rem; align-items: center; flex-wrap: wrap; }
.brand { color: #fff; text-decoration: none; font-size: 1.15rem; font-weight: 750; }
.site-nav { display: flex; gap: .35rem; margin-left: auto; align-items: center; flex-wrap: wrap; }
.site-nav a, .link-button { color: #fff; background: transparent; border: 0; padding: .65rem .8rem; font: inherit; cursor: pointer; text-decoration: none; border-radius: .35rem; }
.site-nav a:hover, .link-button:hover { background: rgba(255,255,255,.12); }
.container { max-width: 1200px; margin: auto; padding: 1.25rem 1rem 3rem; }
.breadcrumbs { color: var(--muted); margin-bottom: 1rem; }
.messages { list-style: none; padding: 0; }
.message { background: #e7f5ec; border-left: 5px solid var(--success); padding: .8rem 1rem; margin: .75rem 0; }
.message.error { background: #fff0f0; border-color: var(--danger); }
.toolbar { display: flex; gap: .65rem; flex-wrap: wrap; align-items: end; margin: 1rem 0; }
.button, button { display: inline-block; border: 1px solid var(--primary); background: var(--primary); color: #fff; border-radius: .4rem; padding: .65rem .9rem; text-decoration: none; font: inherit; cursor: pointer; }
.button:hover, button:hover { background: var(--primary-dark); }
.button.secondary { background: #fff; color: var(--primary); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 1rem; }
.spaced { margin-top: 1rem; }
.card, .panel { background: var(--surface); border: 1px solid var(--line); border-radius: .65rem; padding: 1rem; box-shadow: 0 2px 8px rgba(20, 35, 55, .05); }
.card { min-height: 8rem; text-decoration: none; color: var(--text); }
.card:hover { border-color: var(--primary); }
.muted { color: var(--muted); }
.warning { background: #fff7df; color: #5f4300; border-left: 5px solid #d69e00; padding: .8rem 1rem; }
.critical { color: var(--danger); font-weight: 700; }
.status { display: inline-block; border-radius: 999px; padding: .15rem .55rem; background: #edf1f6; font-size: .9rem; }
.status.active, .status.allow { color: var(--success); background: #e7f5ec; }
.status.inactive, .status.deny { color: var(--danger); background: #fff0f0; }
.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--line); border-radius: .55rem; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; vertical-align: top; padding: .75rem; border-bottom: 1px solid var(--line); }
th { background: #eef3f8; }
tr:last-child td { border-bottom: 0; }
form p { margin: 0 0 1rem; }
label { display: block; font-weight: 650; margin-bottom: .25rem; }
input, select, textarea { width: 100%; max-width: 42rem; border: 1px solid #9ba8b8; border-radius: .35rem; padding: .65rem; background: #fff; color: var(--text); font: inherit; }
input[type="checkbox"] { width: auto; margin-right: .5rem; }
.errorlist { color: var(--danger); }
.helptext { display: block; color: var(--muted); font-size: .9rem; }
.actions { display: flex; flex-wrap: wrap; gap: .5rem; }
.permission-row form { display: grid; grid-template-columns: minmax(9rem, 12rem) minmax(11rem, 1fr) auto auto; gap: .5rem; align-items: end; }
.permission-row input, .permission-row select { width: 100%; }
.empty { padding: 2rem; text-align: center; color: var(--muted); }
details { margin: .75rem 0; }

@media (max-width: 700px) {
  .site-nav { width: 100%; margin-left: 0; }
  .site-nav a, .link-button { min-height: 44px; }
  .container { padding: 1rem .75rem 5rem; }
  .button, button { min-height: 44px; }
  .permission-row form { grid-template-columns: 1fr; }
  th, td { padding: .6rem; }
}
