/* Inter is served locally; no third-party font requests. */
@font-face {
  font-family: "Inter";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/fonts/inter-latin-wght-normal.woff2") format("woff2");
}

:root {
  color-scheme: light;
  --bg: #f3f9f9;
  --bg-soft: #f8fcfb;
  --panel: #ffffff;
  --panel-strong: #eaf4f2;
  --panel-hover: #f0f8f7;
  --line: #d3e5e2;
  --line-soft: rgba(30, 89, 88, 0.1);
  --text: #183238;
  --muted: #557077;
  --blue: #0f766e;
  --blue-soft: rgba(15, 118, 110, 0.1);
  --green: #16805d;
  --green-soft: rgba(22, 128, 93, 0.11);
  --red: #c04452;
  --red-soft: rgba(192, 68, 82, 0.1);
  --amber: #a8650a;
  --amber-soft: rgba(168, 101, 10, 0.11);
  --purple: #7659a5;
  --purple-soft: rgba(118, 89, 165, 0.1);
  --shadow: 0 18px 50px rgba(20, 81, 83, 0.12);
  --body-background: #f3f9f9;
  --sidebar-background: #ffffff;
  --topbar-background: rgba(255, 255, 255, 0.96);
  --search-background: #f6fbfa;
  --overlay-background: #ffffff;
  --notification-background: #ffffff;
  --card-background: #ffffff;
  --card-hover-background: #f6fbfa;
  --control-background: #ffffff;
  --input-background: #ffffff;
  --button-background: #ffffff;
  --button-text: #24464a;
  --nav-text: #48666b;
  --nav-hover-background: #eff8f6;
  --nav-active-background: #e0f2ee;
  --nav-active-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.14);
  --subtle-text: #657f82;
  --heading-muted: #608088;
  --label-text: #345158;
  --table-heading: #4e6c71;
  --tab-text: #4e6c71;
  --neutral-badge-background: #edf5f4;
  --neutral-badge-text: #456468;
  --row-hover-background: #f6fbfa;
  --row-active-background: #eaf6f3;
  --blue-text: #0a655e;
  --green-text: #126947;
  --red-text: #a52f40;
  --amber-text: #8b5308;
  --purple-text: #65478f;
  --toast-background: #ffffff;
  --primary-border: #0f766e;
  --primary-background: #0f766e;
  --primary-text: #ffffff;
  --login-background: radial-gradient(ellipse at 50% 0%, rgba(78, 190, 176, 0.22), transparent 63%), linear-gradient(145deg, #f8fcfb, #e8f4f3);
  --login-card-background: #ffffff;
  --focus-ring: rgba(15, 118, 110, 0.32);
  --motion-fast: 140ms;
  --motion-medium: 220ms;
  --motion-slow: 420ms;
  --motion-ease: cubic-bezier(0.2, 0.8, 0.2, 1);
}

html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0e1c22;
  --bg-soft: #14262d;
  --panel: #1a3038;
  --panel-strong: #22404a;
  --panel-hover: #294b53;
  --line: #34555c;
  --line-soft: rgba(183, 228, 222, 0.13);
  --text: #eef9f7;
  --muted: #acc8ca;
  --blue: #67d4c7;
  --blue-soft: rgba(103, 212, 199, 0.15);
  --green: #6bd5a9;
  --green-soft: rgba(107, 213, 169, 0.15);
  --red: #ff8090;
  --red-soft: rgba(255, 128, 144, 0.14);
  --amber: #e9b85e;
  --amber-soft: rgba(233, 184, 94, 0.14);
  --purple: #c2a6ef;
  --purple-soft: rgba(194, 166, 239, 0.14);
  --shadow: 0 18px 50px rgba(0, 10, 14, 0.34);
  --body-background: #14262d;
  --sidebar-background: #102027;
  --topbar-background: rgba(20, 38, 45, 0.96);
  --search-background: #1a3038;
  --overlay-background: #1a3038;
  --notification-background: #1a3038;
  --card-background: #1a3038;
  --card-hover-background: #22404a;
  --control-background: #172b32;
  --input-background: #172b32;
  --button-background: #22404a;
  --button-text: #e5f5f2;
  --nav-text: #b6d3d3;
  --nav-hover-background: rgba(103, 212, 199, 0.1);
  --nav-active-background: rgba(103, 212, 199, 0.18);
  --nav-active-shadow: inset 0 0 0 1px rgba(103, 212, 199, 0.2);
  --subtle-text: #a6c1c4;
  --heading-muted: #a9c6c8;
  --label-text: #d5e9e7;
  --table-heading: #b7d2d2;
  --tab-text: #b7d2d2;
  --neutral-badge-background: rgba(183, 228, 222, 0.11);
  --neutral-badge-text: #d3e9e6;
  --row-hover-background: rgba(103, 212, 199, 0.07);
  --row-active-background: rgba(103, 212, 199, 0.12);
  --blue-text: #8be5d8;
  --green-text: #81e0b8;
  --red-text: #ff9aa5;
  --amber-text: #f2ca7f;
  --purple-text: #d0b7f2;
  --toast-background: #22404a;
  --primary-border: #42b8a9;
  --primary-background: #0f766e;
  --primary-text: #ffffff;
  --login-background: radial-gradient(ellipse at 50% 0%, rgba(48, 142, 137, 0.22), transparent 65%), #102027;
  --login-card-background: #1a3038;
  --focus-ring: rgba(103, 212, 199, 0.4);
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
  margin: 0;
}

body {
  background: var(--body-background);
  color: var(--text);
  font: 14px/1.6 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  transition: background 0.2s ease, color 0.2s ease;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  color: inherit;
  font: inherit;
}

a {
  color: inherit;
  text-decoration: none;
}

button,
a {
  -webkit-tap-highlight-color: transparent;
}

img {
  max-width: 100%;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
}

.nav-link,
.icon-button,
.button,
.tab,
.search,
.search-result,
.notification-item,
.entity-picker-result,
.record-tag-option,
.assignment-card,
.role-list-item,
.access-list-row,
.offense-law-tab,
.catalog-offense-card summary {
  transition:
    background-color var(--motion-fast) var(--motion-ease),
    border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    color var(--motion-fast) var(--motion-ease),
    opacity var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}

.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;
}

.theme-toggle {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--blue-text);
  cursor: pointer;
  transition:
    background 0.18s ease,
    border-color 0.18s ease,
    color 0.18s ease,
    transform 0.18s ease;
}

.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  transform: translateY(-1px);
}

.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 39px;
  padding: 7px 12px;
  border-radius: 8px;
  box-shadow: none;
  font-size: 12px;
  background: var(--panel);
}

.login-theme-toggle [data-theme-icon] {
  font-size: 18px;
  line-height: 1;
}

.app-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  height: 100dvh;
  padding: 28px 16px 20px;
  border-right: 1px solid var(--line);
  background: var(--sidebar-background);
  z-index: 20;
  contain: paint;
}

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(0, 0, 0, 0.58);
  backdrop-filter: blur(2px);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 8px 18px;
}

.seal {
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 2px solid var(--blue);
  border-radius: 50%;
  background:
    radial-gradient(circle, #148b82 0 37%, #0d5963 38% 54%, #8bd9cc 55% 58%, #0b444d 59%);
  box-shadow: inset 0 0 0 2px rgba(255, 255, 255, 0.08);
  color: white;
  font-size: 10px;
  font-weight: 900;
  letter-spacing: 0.08em;
}

.brand-logo {
  width: 48px;
  height: 48px;
  flex: 0 0 auto;
  object-fit: contain;
}

.brand strong {
  display: block;
  font-size: 22px;
  letter-spacing: -0.03em;
  font-weight: 650;
  line-height: 1.2;
}

.brand small,
.department {
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0.01em;
}

.department {
  margin: 0 8px 12px;
  padding: 0 0 20px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 11px;
}

.nav {
  display: grid;
  gap: 3px;
  overflow-y: auto;
  padding-bottom: 20px;
  scrollbar-width: thin;
  scrollbar-color: var(--line) transparent;
}

.nav-link,
.nav-heading {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 9px 11px;
  border-radius: 8px;
  color: var(--nav-text);
  font-size: 13px;
  line-height: 1.4;
}

.nav-link::before {
  position: absolute;
  inset: 9px auto 9px 0;
  width: 3px;
  border-radius: 999px;
  background: currentColor;
  opacity: 0;
  transform: scaleY(0.45);
  transform-origin: center;
  transition:
    opacity var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
  content: "";
}

.nav-link:hover {
  background: var(--nav-hover-background);
  color: var(--text);
  transform: none;
}

.nav-link:hover::before,
.nav-link.active::before {
  opacity: 0.8;
  transform: scaleY(1);
}

.nav-link.active {
  background: var(--nav-active-background);
  box-shadow: var(--nav-active-shadow);
  color: var(--blue-text);
  transform: none;
  font-weight: 600;
}

.nav-icon {
  width: 20px;
  text-align: center;
  font-size: 18px;
  display: inline-grid;
  place-items: center;
  flex: 0 0 20px;
}

.nav-review-count {
  margin-left: auto;
  min-width: 22px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--red-soft);
  color: var(--red-text);
  font-size: 12px;
  font-weight: 700;
}

.nav-heading {
  min-height: auto;
  margin-top: 18px;
  padding-bottom: 7px;
  color: var(--heading-muted);
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.shift-card {
  display: flex;
  align-items: center;
  gap: 11px;
  margin-top: auto;
  padding: 18px 8px 0;
  border-top: 1px solid var(--line-soft);
  flex-shrink: 0;
}

.mini-seal {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel-strong);
  color: var(--blue-text);
  font-size: 11px;
  font-weight: 600;
}

.shift-card strong,
.shift-card small {
  display: block;
}

.shift-card small {
  color: var(--muted);
}

.dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 5px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 34%, transparent);
}

.workspace {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: minmax(180px, 540px) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  min-height: 80px;
  padding: 16px 32px;
  border-bottom: 1px solid var(--line);
  background: var(--topbar-background);
  backdrop-filter: blur(16px);
}

.icon-button {
  display: inline-grid;
  place-items: center;
  width: 39px;
  height: 39px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.icon-button:hover {
  background: var(--panel-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.icon-button:focus-visible {
  background: var(--panel-hover);
  color: var(--text);
}

.icon-button:active {
  transform: translateY(0) scale(0.98);
}

.icon-button.theme-toggle {
  border: 1px solid var(--line);
  background: var(--panel-strong);
  color: var(--blue-text);
}

.icon-button.theme-toggle:hover {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  background: var(--panel-hover);
  color: var(--blue-text);
}

.search {
  position: relative;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  height: 42px;
  padding: 0 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--search-background);
}

.search:focus-within {
  border-color: color-mix(in srgb, var(--blue) 55%, var(--line));
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.search input {
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
}

kbd {
  padding: 2px 7px;
  border: 1px solid var(--line);
  border-radius: 5px;
  color: var(--subtle-text);
  background: var(--panel-strong);
  font-family: inherit;
  font-size: 11px;
  line-height: 1.5;
}

.search-results {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 440px;
  overflow: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--overlay-background);
  box-shadow: var(--shadow);
  z-index: 40;
  contain: layout paint;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.search-group + .search-group {
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line-soft);
}

.search-group-title {
  padding: 5px 10px;
  color: var(--subtle-text);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.search-result {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  padding: 9px 10px;
  border-radius: 7px;
}

.search-result:hover,
.search-result:focus-visible {
  outline: 0;
  background: var(--panel-hover);
}

.search-result strong,
.search-result small {
  display: block;
}

.search-result small,
.search-open {
  color: var(--muted);
}

.search-open {
  align-self: center;
  white-space: nowrap;
  font-size: 12px;
}

.search-state {
  padding: 18px 12px;
  color: var(--muted);
  text-align: center;
}

.search-state.error {
  color: var(--red);
}

.app-context-menu {
  position: fixed;
  z-index: 120;
  display: grid;
  gap: 4px;
  width: min(260px, calc(100vw - 20px));
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--overlay-background);
  box-shadow: var(--shadow);
  contain: layout paint;
}

.app-context-menu-title {
  overflow: hidden;
  padding: 7px 9px 5px;
  color: var(--subtle-text);
  font-size: 11px;
  font-weight: 800;
  text-overflow: ellipsis;
  text-transform: uppercase;
  white-space: nowrap;
}

.app-context-menu button {
  display: grid;
  grid-template-columns: 24px minmax(0, 1fr);
  gap: 9px;
  align-items: center;
  width: 100%;
  min-height: 36px;
  padding: 7px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.app-context-menu button:hover,
.app-context-menu button:focus-visible {
  outline: 0;
  border-color: color-mix(in srgb, var(--blue) 42%, transparent);
  background: var(--panel-hover);
}

.app-context-menu button span {
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--panel-strong);
  color: var(--blue-text);
  line-height: 1;
}

.app-context-menu button strong {
  min-width: 0;
  overflow: hidden;
  font-size: 13px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.top-actions {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.notification-panel {
  position: absolute;
  top: 48px;
  right: 50px;
  width: min(390px, calc(100vw - 24px));
  max-height: 520px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--notification-background);
  box-shadow: var(--shadow);
  contain: layout paint;
  overscroll-behavior: contain;
  scrollbar-gutter: stable;
}

.notification-header {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 14px;
  border-bottom: 1px solid var(--line);
  background: var(--notification-background);
}

.notification-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  width: 100%;
  padding: 13px 14px;
  border: 0;
  border-bottom: 1px solid var(--line-soft);
  background: var(--row-hover-background);
  text-align: left;
  cursor: pointer;
}

.notification-item.read {
  opacity: 0.58;
  background: transparent;
}

.notification-item:hover,
.notification-item:focus-visible {
  outline: 0;
  background: var(--row-active-background);
}

.notification-item strong,
.notification-item small {
  display: block;
}

.notification-item small {
  margin-top: 3px;
  color: var(--muted);
}

.user-pill {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 4px;
  padding-left: 15px;
  border-left: 1px solid var(--line);
}

.user-pill strong,
.user-pill small {
  display: block;
  white-space: nowrap;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.user-pill small {
  width: fit-content;
  margin-top: 2px;
  padding: 0;
  border: 0;
  border-radius: 4px;
  background: transparent;
  color: var(--muted);
  font-size: 11px;
}

.discord-badge {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  object-fit: cover;
  border: 1px solid var(--line);
  background: var(--panel);
}

.content {
  width: min(1440px, calc(100% - 64px));
  margin: 0 auto;
  padding: 32px 0 56px;
}

.page-header,
.section-header,
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.page-header {
  flex-wrap: wrap;
  margin: 0 0 28px;
}

.page-header > div:first-child {
  min-width: 0;
}

.page-header > .toolbar {
  flex-wrap: wrap;
  justify-content: flex-end;
}

.page-header h1,
.section-header h2,
.section-header h3 {
  margin: 0;
}

.page-header h1 {
  font-size: clamp(25px, 2.2vw, 32px);
  line-height: 1.25;
  overflow-wrap: anywhere;
  font-weight: 600;
  letter-spacing: -0.035em;
}

.breadcrumbs,
.muted,
.meta,
.fine-print {
  color: var(--muted);
}

.breadcrumbs {
  margin-bottom: 7px;
  font-size: 12px;
}

.locked-case-notice {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  border-left: 3px solid var(--amber);
}

.locked-case-notice span {
  color: var(--muted);
}

.case-status {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}

.case-lock {
  font-size: 12px;
  line-height: 1;
}

.case-warnings {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.case-warning {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid color-mix(in srgb, var(--amber) 45%, var(--line));
  border-left: 4px solid var(--amber);
  border-radius: 8px;
  background: color-mix(in srgb, var(--amber) 10%, var(--panel));
}

.case-warning.critical {
  border-color: color-mix(in srgb, var(--red) 45%, var(--line));
  border-left-color: var(--red);
  background: color-mix(in srgb, var(--red) 10%, var(--panel));
}

.case-warning-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--amber);
  font-weight: 900;
}

.case-warning.critical .case-warning-icon {
  background: var(--red);
}

.case-warning p {
  margin: 4px 0;
}

.case-warning small {
  color: var(--muted);
}

.case-warning-calculation {
  margin: 8px 0;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--control-background);
  font-size: 13px;
}

.case-history {
  display: grid;
  gap: 12px;
}

.history-entry {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line-soft);
}

.history-entry:last-child {
  padding-bottom: 0;
  border-bottom: 0;
}

.history-icon {
  display: grid;
  width: 30px;
  height: 30px;
  place-items: center;
  border-radius: 50%;
  color: white;
  background: var(--blue);
  font-weight: 900;
}

.history-entry.created .history-icon,
.history-entry.closed .history-icon {
  background: var(--green);
}

.history-entry.shared .history-icon {
  background: var(--purple);
}

.history-entry.archived .history-icon,
.history-entry.revoked .history-icon {
  background: var(--red);
}

.history-title {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 8px 12px;
}

.history-title span {
  color: var(--muted);
  font-size: 12px;
}

.history-entry p {
  margin: 4px 0 0;
  color: var(--muted);
}

.penalty-formula-preview {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.penalty-formula-preview span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
}

.template-offense-select {
  min-height: 190px;
}

.settings-save-bar {
  display: flex;
  justify-content: flex-end;
  border-top: 1px solid var(--line);
}

.role-stats {
  margin-bottom: 15px;
}

.role-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr);
  gap: 15px;
  align-items: start;
}

.role-list-panel {
  display: grid;
  gap: 13px;
}

.access-tabs {
  margin-bottom: 14px;
}

.access-list {
  display: grid;
  gap: 14px;
}

.access-workspace {
  display: grid;
  grid-template-columns: minmax(260px, 0.34fr) minmax(0, 1fr);
  gap: 14px;
  align-items: start;
}

.access-list-panel,
.access-editor-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-background);
}

.access-list-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.access-editor-panel {
  padding: 16px;
}

.access-list-rows {
  display: grid;
  gap: 7px;
  max-height: min(640px, calc(100vh - 310px));
  overflow: auto;
}

.access-list-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.access-list-row:hover,
.access-list-row.active {
  border-color: var(--line);
  background: var(--row-active-background);
}

.access-list-row strong,
.access-list-row small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.access-list-row small {
  color: var(--muted);
}

.access-list-row em {
  min-width: 24px;
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  text-align: center;
}

.access-editor-form {
  display: grid;
  gap: 16px;
}

.access-permissions {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: var(--control-background);
}

.access-permissions summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 14px;
  cursor: pointer;
  font-weight: 800;
}

.access-permissions summary span {
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--muted);
  font-size: 11px;
}

.compact-permissions {
  padding: 0 14px 14px;
}

.access-list .section-header h3 {
  display: flex;
  align-items: center;
  gap: 9px;
}

.role-list {
  display: grid;
  gap: 13px;
  max-height: min(720px, calc(100vh - 330px));
  overflow: auto;
  padding-right: 3px;
}

.role-list-section {
  display: grid;
  gap: 7px;
}

.role-list-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.role-list-heading span {
  min-width: 23px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  text-align: center;
}

.role-list-empty {
  margin: 0;
  padding: 8px 2px;
  font-size: 12px;
}

.role-list-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--text);
  text-align: left;
  cursor: pointer;
}

.role-list-item:hover,
.role-list-item:focus-visible {
  outline: 0;
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: var(--row-hover-background);
}

.role-list-item.active {
  border-color: var(--blue);
  background: var(--row-active-background);
}

.role-color-dot {
  display: inline-block;
  width: 13px;
  height: 34px;
  border: 1px solid color-mix(in srgb, var(--role-color, #64748b) 70%, var(--line));
  border-radius: 4px;
  background: var(--role-color, #64748b);
}

.role-list-main {
  min-width: 0;
}

.role-list-main strong,
.role-list-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.role-list-main small,
.role-list-meta small {
  color: var(--muted);
}

.role-list-meta {
  display: grid;
  min-width: 34px;
  justify-items: end;
  font-size: 12px;
}

.role-detail-panel {
  min-height: 420px;
}

.role-detail-head {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 13px;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 1px solid var(--line);
}

.role-detail-head .role-color-dot {
  height: 46px;
}

.role-detail-head h2 {
  margin: 0 0 4px;
  overflow-wrap: anywhere;
}

.compact-form {
  margin-bottom: 15px;
}

.role-permission-summary {
  display: grid;
  gap: 12px;
  margin-bottom: 15px;
}

.permission-group {
  display: grid;
  gap: 8px;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.permission-group-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.permission-group-title span {
  min-width: 24px;
  padding: 1px 7px;
  border-radius: 10px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  text-align: center;
}

.permission-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.permission-chip {
  display: inline-flex;
  align-items: center;
  min-height: 25px;
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  font-size: 12px;
}

.permission-editor {
  display: grid;
  gap: 13px;
}

.permission-editor-group {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.permission-editor-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.permission-editor-title span {
  min-width: 35px;
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  text-align: center;
}

.permission-editor-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.permission-toggle {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 8px 9px;
  align-items: start;
  padding: 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--control-background);
  color: var(--label-text);
}

.permission-toggle input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin-top: 2px;
  accent-color: var(--blue);
}

.permission-toggle span,
.permission-toggle code {
  min-width: 0;
}

.permission-toggle span {
  font-weight: 700;
}

.permission-toggle code {
  grid-column: 2;
  color: var(--muted);
  font-size: 11px;
  overflow-wrap: anywhere;
}

.case-relations-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-top: 14px;
}

.case-activity-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  margin-top: 14px;
}

.grid {
  display: grid;
  gap: 20px;
}

.grid > * {
  min-width: 0;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 24px;
}

.two-column {
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.34fr);
}

.record-main {
  min-width: 0;
}

.three-column {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-background);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.025);
  contain: paint;
}

.card-pad {
  padding: 22px;
}

.stat-card {
  display: flex;
  min-height: 116px;
  align-items: center;
  gap: 17px;
  padding: 22px;
}

.interactive-card {
  cursor: pointer;
  transition:
    transform 0.16s ease,
    border-color 0.16s ease,
    background 0.16s ease;
}

.interactive-card:hover,
.interactive-card:focus-visible {
  outline: 0;
  transform: translateY(-2px);
  border-color: color-mix(in srgb, var(--blue) 45%, var(--line));
  background: var(--card-hover-background);
}

.stat-icon {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 12px;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-size: 20px;
  transition:
    box-shadow var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
  flex-shrink: 0;
}

.stat-card:hover .stat-icon,
.dashboard-info-item:hover .stat-icon {
  transform: none;
  box-shadow: none;
}

.stat-card strong {
  display: block;
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.04em;
  font-variant-numeric: tabular-nums;
}

.stat-card small {
  color: var(--muted);
}

.dashboard-info-band {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.dashboard-field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
  margin-bottom: 32px;
}

.dashboard-field {
  min-height: 180px;
}

.dashboard-field h2 {
  margin: 0;
  font-size: 18px;
}

.dashboard-field p {
  margin: 12px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.dashboard-field-content {
  white-space: pre-wrap;
}

.dashboard-user-data {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 20px;
  margin: 16px 0 0;
}

.dashboard-user-data dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

.dashboard-user-data dd {
  margin: 4px 0 0;
  font-weight: 600;
}

.agency-status-list {
  display: grid;
  gap: 12px;
  margin: 16px 0 0;
  padding: 0;
  list-style: none;
}

.agency-status-list li {
  display: flex;
  align-items: center;
  gap: 9px;
}

.agency-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #dc2626;
  box-shadow: 0 0 0 3px color-mix(in srgb, #dc2626 16%, transparent);
}

.agency-status-dot.active {
  background: #16a34a;
  box-shadow: 0 0 0 3px color-mix(in srgb, #16a34a 16%, transparent);
}

.dashboard-info-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 14px;
  align-items: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-background);
}

.dashboard-info-item strong,
.news-card h2,
.news-empty h2 {
  display: block;
  margin: 0;
}

.dashboard-info-item p {
  margin: 5px 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.dashboard-news-header {
  margin: 28px 0 16px;
}

.dashboard-news-header p,
.news-card-header p {
  margin: 5px 0 0;
  color: var(--muted);
}

.news-feed {
  display: grid;
  gap: 20px;
}

.news-feed > .news-card,
.metro-family-card,
.catalog-offense-card,
.suggestion-feature-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 220px;
}

.news-card,
.news-empty {
  padding: 26px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--card-background);
}

.news-card.pinned {
  border-color: var(--line);
  box-shadow: inset 3px 0 0 var(--amber);
}

.news-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.news-card-header h2 {
  margin-top: 10px;
  font-size: 20px;
  line-height: 1.4;
  font-weight: 600;
  letter-spacing: -0.025em;
}

.news-body {
  color: var(--text);
  line-height: 1.8;
  overflow-wrap: anywhere;
  max-width: 85ch;
}

.news-body > :first-child {
  margin-top: 0;
}

.news-body > :last-child {
  margin-bottom: 0;
}

.news-body h2,
.news-body h3 {
  margin: 18px 0 8px;
  line-height: 1.25;
}

.news-body p,
.news-body ul,
.news-body ol,
.news-body blockquote,
.news-body pre {
  margin: 0 0 12px;
}

.news-body blockquote {
  padding: 10px 14px;
  border-left: 3px solid var(--blue);
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  color: var(--muted);
}

.news-body pre {
  overflow-x: auto;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.news-empty {
  text-align: center;
}

.news-empty p {
  margin: 7px 0 0;
  color: var(--muted);
}

.news-form {
  gap: 16px;
}

.news-editor-shell {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--input-background);
}

.news-editor-shell .ql-toolbar.ql-snow {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  padding: 9px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: color-mix(in srgb, var(--panel) 82%, transparent);
  font-family: inherit;
}

.news-editor-shell .ql-toolbar.ql-snow .ql-formats {
  display: inline-flex;
  gap: 2px;
  margin-right: 6px;
}

.news-editor-shell .ql-toolbar.ql-snow button,
.news-editor-shell .ql-toolbar.ql-snow .ql-picker-label {
  border-radius: 7px;
  color: var(--text);
}

.news-editor-shell .ql-toolbar.ql-snow button {
  width: 32px;
  height: 32px;
  padding: 5px;
}

.news-editor-shell .ql-toolbar.ql-snow .ql-picker {
  color: var(--text);
  height: 32px;
}

.news-editor-shell .ql-toolbar.ql-snow .ql-picker-label {
  min-height: 32px;
  display: inline-flex;
  align-items: center;
}

.news-editor-shell .ql-toolbar.ql-snow button:hover,
.news-editor-shell .ql-toolbar.ql-snow button:focus,
.news-editor-shell .ql-toolbar.ql-snow .ql-picker-label:hover,
.news-editor-shell .ql-toolbar.ql-snow .ql-picker-label.ql-active,
.news-editor-shell .ql-toolbar.ql-snow .ql-picker-item:hover,
.news-editor-shell .ql-toolbar.ql-snow .ql-picker-item.ql-selected {
  background: color-mix(in srgb, var(--blue) 16%, transparent);
  color: var(--blue);
}

.news-editor-shell .ql-toolbar.ql-snow .ql-stroke {
  stroke: currentColor;
}

.news-editor-shell .ql-toolbar.ql-snow .ql-fill {
  fill: currentColor;
}

.news-editor-shell .ql-toolbar.ql-snow .ql-picker-options {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
  padding: 4px;
}

.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-label::before,
.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-item::before {
  content: "Absatz";
}

.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="2"]::before,
.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="2"]::before {
  content: "Überschrift";
}

.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-label[data-value="3"]::before,
.news-editor-shell .ql-snow .ql-picker.ql-header .ql-picker-item[data-value="3"]::before {
  content: "Zwischenüberschrift";
}

.news-editor-shell .ql-snow .ql-tooltip {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  color: var(--text);
}

.news-editor-shell .ql-snow .ql-tooltip input[type="text"] {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--input-background);
  color: var(--text);
  outline: 0;
}

.news-editor-shell .ql-snow .ql-tooltip a {
  color: var(--blue);
}

.news-editor-shell .ql-container.ql-snow {
  border: 0;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
}

.news-editor-shell .ql-editor {
  min-height: 330px;
  padding: 16px;
  line-height: 1.65;
}

.news-editor-shell .ql-editor.ql-blank::before {
  left: 16px;
  right: 16px;
  color: var(--muted);
  font-style: normal;
}

.news-editor-shell:focus-within {
  box-shadow: 0 0 0 1px var(--blue);
}

.news-editor.fallback-editor {
  min-height: 330px;
  padding: 16px;
  line-height: 1.65;
  outline: 0;
}

.news-editor h2,
.news-editor h3,
.news-editor p,
.news-editor ul,
.news-editor ol,
.news-editor blockquote,
.news-body h2,
.news-body h3,
.news-body p,
.news-body ul,
.news-body ol,
.news-body blockquote {
  margin-top: 0;
}

.knowledge-filter-card {
  margin-bottom: 14px;
}

.knowledge-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(170px, 260px) auto;
  gap: 10px;
  padding: 14px;
  align-items: center;
}

.knowledge-card h2 a {
  color: inherit;
  text-decoration: none;
}

.knowledge-card h2 a:hover,
.knowledge-card h2 a:focus {
  color: var(--blue);
}

.knowledge-article {
  padding: 20px;
}

.knowledge-article-meta {
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
}

.knowledge-article-summary {
  margin: 0 0 18px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.6;
}

.knowledge-article-body {
  max-width: 920px;
}

.knowledge-pagination {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding: 12px 2px;
  color: var(--muted);
}

.knowledge-pagination > span:last-child {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  justify-content: flex-end;
}

.knowledge-pin-toggle {
  min-height: 40px;
  align-items: center;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-background);
}

.suggestions-summary-card,
.suggestions-score-grid,
.suggestions-layout {
  margin-bottom: 15px;
}

.suggestions-summary {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 0.36fr);
  gap: 20px;
  align-items: start;
}

.suggestions-summary h2 {
  margin: 0 0 8px;
}

.suggestions-summary p {
  max-width: 920px;
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
}

.suggestions-scope {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: color-mix(in srgb, var(--panel) 76%, transparent);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.suggestions-section-title {
  margin: 22px 0 12px;
}

.suggestion-title-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.suggestion-title-row > span {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.suggestion-item p {
  margin: 7px 0 8px;
  color: var(--muted);
  line-height: 1.5;
}

.suggestion-bullet-list {
  display: grid;
  gap: 8px;
  margin: 12px 0 0;
  padding-left: 18px;
  color: var(--muted);
  line-height: 1.5;
}

.suggestion-feature-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 15px;
}

.suggestion-feature-card {
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: color-mix(in srgb, var(--panel) 78%, transparent);
}

.suggestion-feature-card p {
  margin: 10px 0 0;
  color: var(--muted);
  line-height: 1.55;
}

.blue { color: var(--blue-text); }
.red { color: var(--red); }
.green { color: var(--green); }
.amber { color: var(--amber); }
.purple { color: var(--purple-text); }

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 40px;
  padding: 9px 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--button-background);
  color: var(--button-text);
  cursor: pointer;
  font-size: 13px;
  font-weight: 550;
  line-height: 1.4;
  text-align: center;
}

.button:hover:not(:disabled):not(.disabled) {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.06);
  transform: none;
}

.button:active:not(:disabled):not(.disabled) {
  transform: translateY(0);
}

.button.disabled {
  cursor: default;
  opacity: 0.68;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.button.primary {
  border-color: var(--primary-border);
  background: var(--primary-background);
  color: var(--primary-text);
}

.button.danger {
  border-color: rgba(251, 79, 104, 0.4);
  background: var(--red-soft);
  color: var(--red-text);
}

.button.success {
  border-color: rgba(34, 197, 94, 0.35);
  background: var(--green-soft);
  color: var(--green-text);
}

.button.ghost {
  background: transparent;
}

.button.small {
  min-height: 32px;
  padding: 5px 10px;
  font-size: 12px;
}

.button.wide {
  width: 100%;
}

.department-admin {
  display: grid;
  gap: 14px;
}

.department-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.department-summary > div,
.department-panel {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--card-background);
}

.department-summary > div {
  padding: 14px 16px;
}

.department-summary small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.department-summary strong {
  display: block;
  margin-top: 5px;
  font-size: 24px;
}

.department-panel {
  padding: 16px;
}

.department-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) 96px auto;
  gap: 12px;
  align-items: end;
}

.department-table input:not([type="color"]),
.compact-input {
  width: 100%;
  min-height: 34px;
  padding: 7px 9px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-background);
  color: var(--text);
}

.department-table th:first-child,
.department-table td:first-child {
  width: 82px;
}

.color-field input,
.color-control {
  width: 44px;
  height: 34px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: var(--control-background);
}

.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.table-wrap {
  overflow-x: auto;
  overscroll-behavior-inline: contain;
  -webkit-overflow-scrolling: touch;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-variant-numeric: tabular-nums;
}

th,
td {
  padding: 15px 18px;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: middle;
}

th {
  color: var(--table-heading);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.055em;
  background: var(--bg-soft);
}

tbody tr:hover {
  background: var(--row-hover-background);
}

.click-row {
  cursor: pointer;
  transition:
    background-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease);
}

.click-row:hover,
.click-row:focus-visible {
  outline: 0;
  background: var(--row-active-background);
  box-shadow: inset 3px 0 0 color-mix(in srgb, var(--blue) 70%, transparent);
}

.restricted-row {
  cursor: not-allowed;
}

.restricted-row:hover {
  background: color-mix(in srgb, var(--red) 5%, transparent);
}

.top-secret {
  color: var(--red-text);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.audit-preset-tabs {
  margin-bottom: 14px;
}

.audit-filter-form {
  align-items: end;
}

.audit-warning-list {
  display: grid;
  gap: 10px;
}

.audit-warning-row {
  display: grid;
  grid-template-columns: max-content minmax(0, 1fr);
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-left: 4px solid var(--blue);
  border-radius: 7px;
  background: var(--bg-soft);
}

.audit-warning-row.high {
  border-left-color: var(--red);
}

.audit-warning-row.medium {
  border-left-color: var(--amber);
}

.audit-warning-row.low {
  border-left-color: var(--blue);
}

.audit-warning-row p {
  margin: 3px 0 6px;
}

.audit-json {
  max-width: 520px;
  max-height: 240px;
  overflow: auto;
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  background: var(--control-background);
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}

.audit-metadata {
  max-width: none;
  margin-top: 14px;
}

.audit-pagination {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 25px;
  padding: 3px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  font-size: 11px;
  white-space: nowrap;
  transition:
    border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
  font-weight: 550;
  line-height: 1.4;
}

.badge:hover {
  box-shadow: none;
  transform: none;
}

.badge.green,
.badge.valid,
.badge.active,
.badge.alive,
.badge.closed,
.badge.approved,
.badge.registered {
  border-color: rgba(34, 197, 94, 0.34);
  background: var(--green-soft);
  color: var(--green-text);
}

.badge.red,
.badge.revoked,
.badge.open,
.badge.critical,
.badge.wanted,
.badge.stolen {
  border-color: rgba(251, 79, 104, 0.35);
  background: var(--red-soft);
  color: var(--red-text);
}

.badge.amber,
.badge.high,
.badge.in_review,
.badge.impounded {
  border-color: rgba(245, 158, 11, 0.35);
  background: var(--amber-soft);
  color: var(--amber-text);
}

.badge.purple,
.badge.shared_doj,
.badge.doj_review {
  border-color: rgba(168, 85, 247, 0.38);
  background: var(--purple-soft);
  color: var(--purple-text);
}

.badge.blue,
.badge.protected,
.badge.decided,
.badge.doj_decided,
.badge.service {
  border-color: color-mix(in srgb, var(--blue) 38%, transparent);
  background: var(--blue-soft);
  color: var(--blue-text);
}

.record-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

.record-tag {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  padding: 2px 8px;
  border: 1px solid color-mix(in srgb, var(--tag-color, #64748b) 42%, var(--line));
  border-radius: 5px;
  background: color-mix(in srgb, var(--tag-color, #64748b) 14%, transparent);
  color: var(--text);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
  transition:
    border-color var(--motion-fast) var(--motion-ease),
    box-shadow var(--motion-fast) var(--motion-ease),
    transform var(--motion-fast) var(--motion-ease);
}

.record-tag:hover {
  box-shadow: 0 6px 16px color-mix(in srgb, var(--tag-color, #64748b) 14%, transparent);
  transform: translateY(-1px);
}

.record-tag::before {
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--tag-color, #64748b);
  content: "";
}

.record-tag-classification {
  margin-right: 6px;
  padding-right: 6px;
  border-right: 1px solid color-mix(in srgb, var(--tag-color, #64748b) 36%, var(--line));
  color: var(--muted);
  font-weight: 700;
}

.record-tag.inactive {
  opacity: 0.62;
}

.profile-card {
  display: grid;
  grid-template-columns: 190px 1fr;
  gap: 25px;
  padding: 16px;
}

.mugshot {
  position: relative;
  display: grid;
  place-items: end center;
  min-height: 190px;
  overflow: hidden;
  border: 1px solid #384b60;
  border-radius: 8px;
  background:
    repeating-linear-gradient(0deg, transparent 0 27px, rgba(14, 27, 40, 0.18) 28px 29px),
    linear-gradient(145deg, #d7dde2, #9aa4ad);
  color: #152334;
}

.mugshot-image {
  width: 190px;
  height: 190px;
  border: 1px solid #384b60;
  border-radius: 8px;
  object-fit: cover;
  background: #0a1724;
}

.mugshot::before {
  content: "";
  position: absolute;
  width: 82px;
  height: 104px;
  bottom: 28px;
  border-radius: 45% 45% 35% 35%;
  background: linear-gradient(#263646 0 44%, #121d28 45%);
  box-shadow: 0 56px 0 40px #1b2732;
}

.mugshot span {
  position: relative;
  z-index: 1;
  margin-bottom: 8px;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.65);
  font-size: 11px;
  font-weight: 800;
}

.profile-title {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
  padding: 4px 0 12px;
  border-bottom: 1px solid var(--line-soft);
}

.profile-title h2 {
  min-width: 0;
  margin: 0;
  font-size: 27px;
  overflow-wrap: anywhere;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0;
  margin-top: 15px;
}

.detail-item {
  min-width: 0;
  padding: 0 16px 13px 0;
}

.detail-item + .detail-item {
  padding-left: 16px;
  border-left: 1px solid var(--line-soft);
}

.detail-item:nth-child(3n + 1) {
  padding-left: 0;
  border-left: 0;
}

.detail-item small,
.detail-item strong {
  display: block;
}

.detail-item small {
  margin-bottom: 4px;
  color: var(--muted);
}

.tabs {
  display: flex;
  gap: 5px;
  margin-top: 12px;
  border-bottom: 1px solid var(--line);
  overflow-x: auto;
}

.tab {
  display: inline-flex;
  flex: 0 0 auto;
  align-items: center;
  gap: 8px;
  padding: 14px 18px;
  border: 0;
  border-bottom: 2px solid transparent;
  background: transparent;
  color: var(--tab-text);
  cursor: pointer;
  white-space: nowrap;
  font-size: 13px;
  font-weight: 550;
}

.tab:hover,
.tab:focus-visible {
  outline: 0;
  color: var(--text);
}

.tab.active {
  border-color: var(--blue);
  color: var(--blue-text);
}

.tab span {
  min-width: 21px;
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--neutral-badge-background);
  color: var(--muted);
  font-size: 10px;
  text-align: center;
}

.tab.active span {
  background: var(--blue-soft);
  color: var(--blue-text);
}

.tab-panel {
  margin-top: 14px;
}

.activity-list,
.stack-list {
  display: grid;
}

.activity-item,
.stack-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 11px;
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}

.activity-item > :last-child,
.stack-item > :last-child {
  min-width: 0;
  overflow-wrap: anywhere;
}

.activity-mark {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: var(--blue-text);
  background: var(--blue-soft);
}

.activity-item strong,
.activity-item small {
  display: block;
}

.activity-item small {
  margin-top: 3px;
  color: var(--muted);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}

.field {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--label-text);
  font-size: 12px;
  font-weight: 550;
}

.field input,
.field select,
.field textarea,
.filter-input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  outline: 0;
  background: var(--control-background);
}

.field textarea {
  min-height: 115px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.filter-input:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px var(--focus-ring);
}

.checkbox-row {
  display: flex;
  flex-wrap: wrap;
  gap: 11px 18px;
}

.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--label-text);
}

.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  flex: 0 0 auto;
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border-radius: 3px;
  box-shadow: none;
  accent-color: var(--blue);
}

.user-detail-tabs {
  margin-bottom: 14px;
}

.user-role-editor,
.user-permission-panel,
.user-activity-panel {
  display: grid;
  gap: 16px;
}

.assignment-section {
  display: grid;
  gap: 10px;
}

.assignment-section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.assignment-section-title h3 {
  margin: 0;
  font-size: 15px;
}

.assignment-section-title span {
  min-width: 36px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  font-size: 11px;
  text-align: center;
}

.assignment-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 9px;
}

.assignment-card {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  min-height: 64px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-background);
  cursor: pointer;
}

.assignment-card:hover {
  border-color: color-mix(in srgb, var(--blue) 38%, var(--line));
  background: var(--row-hover-background);
}

.assignment-card.selected {
  border-color: color-mix(in srgb, var(--blue) 70%, var(--line));
  background: var(--row-active-background);
}

.assignment-card input {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  accent-color: var(--blue);
}

.assignment-card .role-color-dot {
  height: 36px;
}

.assignment-card-main {
  min-width: 0;
}

.assignment-card-main strong,
.assignment-card-main small {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.assignment-card-main small {
  color: var(--muted);
}

.assignment-card-meta {
  justify-self: end;
}

.user-role-save {
  margin-top: 2px;
  padding-top: 14px;
}

.user-log-filter {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) repeat(5, minmax(130px, 1fr)) auto;
}

.user-log-summary {
  margin-bottom: 2px;
}

.user-log-pagination {
  padding-top: 2px;
}

.account-access-panel {
  display: grid;
  gap: 15px;
}

.account-access-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  align-items: center;
}

.account-access-state {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-background);
}

.account-access-state.active {
  border-color: color-mix(in srgb, var(--green) 38%, var(--line));
  background: color-mix(in srgb, var(--green) 7%, var(--control-background));
}

.account-access-state.suspended {
  border-color: color-mix(in srgb, var(--amber) 45%, var(--line));
  background: color-mix(in srgb, var(--amber) 9%, var(--control-background));
}

.account-access-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  font-weight: 900;
}

.account-access-state.active .account-access-mark {
  background: var(--green-soft);
  color: var(--green-text);
}

.account-access-state.suspended .account-access-mark {
  background: var(--amber-soft);
  color: var(--amber-text);
}

.account-access-state strong,
.account-access-state small {
  display: block;
  min-width: 0;
}

.account-access-state small {
  margin-top: 3px;
  color: var(--muted);
}

.account-access-body {
  display: grid;
  grid-template-columns: minmax(220px, 0.55fr) minmax(0, 1fr);
  gap: 14px;
  align-items: end;
}

.suspension-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.account-access-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 9px;
  padding-top: 13px;
  border-top: 1px solid var(--line);
}

.department-assignment-list {
  display: grid;
  gap: 9px;
}

.department-assignment {
  display: grid;
  grid-template-columns: minmax(190px, 0.8fr) minmax(240px, 1.2fr);
  gap: 12px;
  align-items: center;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-background);
}

.department-assignment-membership {
  min-width: 0;
  font-weight: 600;
}

.department-assignment select {
  min-height: 38px;
}

.department-assignment select:disabled {
  cursor: not-allowed;
  opacity: 0.62;
}

.entity-picker {
  position: relative;
}

.entity-picker-results,
.selection-list,
.catalog-list {
  display: grid;
  gap: 8px;
}

.entity-picker-results {
  max-height: 430px;
  overflow-y: auto;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--control-background);
}

.multi-picker-results {
  position: absolute;
  z-index: 20;
  top: 70px;
  right: 0;
  left: 0;
  max-height: 300px;
  box-shadow: var(--shadow);
}

.offense-picker-layout {
  display: grid;
  grid-template-columns: minmax(112px, 150px) minmax(0, 1fr);
  gap: 10px;
  margin-top: 8px;
  align-items: start;
}

.offense-law-tabs {
  display: grid;
  gap: 6px;
  max-height: min(520px, 58vh);
  overflow-y: auto;
}

.offense-law-tab {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  min-height: 32px;
  padding: 6px 9px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--text);
  background: var(--bg-soft);
  font-weight: 700;
  cursor: pointer;
}

.offense-law-tab span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
}

.offense-law-tab:hover,
.offense-law-tab:focus-visible,
.offense-law-tab.active {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.offense-picker-results {
  max-height: min(520px, 58vh);
  gap: 6px;
}

.offense-group {
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

.offense-group summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 11px 12px;
  font-weight: 700;
  cursor: pointer;
}

.offense-group summary span:last-child {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.offense-group-list {
  display: grid;
  gap: 7px;
  padding: 0 8px 8px;
}

.offense-reference {
  color: var(--blue);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.entity-picker-result {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 7px;
  color: var(--text);
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.entity-picker-result:hover,
.entity-picker-result:focus-visible {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.multi-select-actions {
  position: sticky;
  z-index: 1;
  top: -8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0 8px;
  background: var(--control-background);
}

.multi-select-actions > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.multi-select-result {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  justify-content: start;
}

.multi-select-result input {
  width: 16px;
  height: 16px;
}

.multi-select-result > span {
  display: grid;
  gap: 3px;
}

.entity-picker-result span:first-child,
.selection-item div {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.entity-picker-result span {
  min-width: 0;
  overflow-wrap: anywhere;
}

.offense-result {
  display: grid;
  grid-template-columns: minmax(72px, 104px) minmax(0, 1fr) minmax(160px, auto) minmax(0, auto);
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
}

.offense-result-reference {
  display: block;
  color: var(--blue);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.offense-result-main {
  display: block;
}

.offense-result-penalty {
  color: var(--text);
  font-size: 13px;
  font-weight: 800;
  white-space: nowrap;
}

.offense-result-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.entity-picker-result small,
.selection-item small {
  color: var(--muted);
}

.selection-list {
  margin-top: 4px;
}

.record-tag-picker {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px;
}

.record-tag-option {
  display: grid;
  grid-template-columns: auto auto minmax(0, 1fr);
  align-items: center;
  gap: 9px;
  min-height: 46px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
  cursor: pointer;
}

.record-tag-option:hover,
.record-tag-option:focus-within,
.record-tag-option.selected,
.record-tag-option:has(input:checked) {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.record-tag-option.inactive {
  opacity: 0.68;
}

.record-tag-option input {
  width: 16px;
  height: 16px;
}

.record-tag-option > span:last-child {
  display: grid;
  min-width: 0;
  gap: 3px;
}

.record-tag-option small {
  color: var(--muted);
}

.record-tag-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--tag-color, #64748b);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--tag-color, #64748b) 16%, transparent);
}

.metro-overview-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 15px;
}

.metro-stat {
  min-height: 96px;
  padding: 15px;
}

.metro-stat strong,
.metro-stat small {
  overflow-wrap: anywhere;
}

.metro-family-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 480px), 1fr));
  align-items: start;
  gap: 14px;
}

.metro-family-card {
  display: grid;
  gap: 14px;
  box-shadow: inset 3px 0 0 var(--metro-color, #64748b);
}

.metro-family-card.is-empty {
  opacity: 0.82;
}

.metro-family-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.metro-family-title {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
  min-width: 0;
  gap: 11px;
}

.metro-family-title h2 {
  margin: 0;
  overflow-wrap: anywhere;
}

.metro-family-swatch {
  width: 13px;
  height: 44px;
  border: 1px solid color-mix(in srgb, var(--metro-color, #64748b) 56%, var(--line));
  border-radius: 5px;
  background: var(--metro-color, #64748b);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--metro-color, #64748b) 13%, transparent);
}

.metro-family-count {
  display: grid;
  place-items: center;
  min-width: 78px;
  min-height: 50px;
  padding: 7px 10px;
  border: 1px solid color-mix(in srgb, var(--metro-color, #64748b) 32%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--metro-color, #64748b) 10%, var(--panel));
}

.metro-family-count strong {
  font-size: 22px;
  line-height: 1;
}

.metro-family-count span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
}

.metro-member-list {
  display: grid;
  gap: 8px;
}

.metro-add-member-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--panel);
}

.metro-add-member-form select {
  min-width: 0;
}

.metro-grouping-create-form {
  grid-template-columns: minmax(220px, 1fr) auto auto;
}

.metro-member-row {
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 10px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--metro-color, #64748b) 8%, transparent), transparent 54%),
    var(--bg-soft);
}

.metro-member-row.has-actions {
  grid-template-columns: 38px minmax(0, 1fr) auto;
}

.metro-rank {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border: 1px solid color-mix(in srgb, var(--metro-color, #64748b) 28%, var(--line));
  border-radius: 8px;
  background: color-mix(in srgb, var(--metro-color, #64748b) 9%, var(--panel));
  color: var(--muted);
  font-weight: 900;
}

.metro-member-main {
  display: grid;
  min-width: 0;
  gap: 7px;
}

.metro-member-name {
  min-width: 0;
  color: var(--text);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.metro-member-name a {
  color: var(--text);
}

.metro-member-name a:hover {
  color: var(--blue-text);
}

.metro-member-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.metro-member-meta span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  min-width: 0;
  padding: 2px 7px;
  border: 1px solid var(--line-soft);
  border-radius: 5px;
  background: var(--panel);
  color: var(--muted);
  font-size: 12px;
}

.metro-member-meta b {
  color: var(--subtle-text);
  font-size: 10px;
  text-transform: uppercase;
}

.metro-member-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.tag-catalog-list {
  display: grid;
  gap: 10px;
}

.tag-catalog-row {
  display: grid;
  grid-template-columns: minmax(150px, 1fr) minmax(130px, 170px) minmax(140px, 180px) minmax(92px, 110px) auto minmax(92px, auto) auto minmax(120px, auto);
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

.tag-catalog-preview {
  align-self: center;
}

.selection-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(160px, 220px) auto;
  align-items: center;
  gap: 12px;
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

#selected-case-offenses .selection-item {
  grid-template-columns: minmax(0, 1fr) auto;
}

.selection-item.compact-selection {
  grid-template-columns: minmax(0, 1fr) auto;
}

.penalty-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.penalty-summary > div {
  display: grid;
  gap: 5px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.penalty-summary small {
  color: var(--muted);
}

.penalty-summary strong {
  font-size: 22px;
}

.case-manual-fields {
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

.case-form > .field {
  min-width: 0;
}

.case-form {
  grid-template-columns: repeat(2, minmax(280px, 1fr));
  align-items: start;
}

.case-form .case-compact-field input,
.case-form .case-compact-field select,
.case-form .case-compact-field textarea {
  max-width: 100%;
}

.case-form textarea {
  min-height: 112px;
}

.case-template-picker {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.case-template-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 10px;
}

.required-marker {
  color: var(--red);
  font-weight: 800;
}

.required-case-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--bg-soft);
}

.catalog-list {
  margin-top: 20px;
}

.catalog-stats {
  margin-bottom: 15px;
}

.catalog-inline-form {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}

.company-list {
  display: grid;
  gap: 8px;
}

.company-row {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto auto;
  gap: 11px;
  align-items: end;
  padding: 11px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

.company-status {
  align-self: center;
  width: 10px;
  height: 36px;
  border-radius: 999px;
  background: var(--green);
}

.company-status.inactive {
  background: var(--muted);
}

.offense-catalog-shell {
  display: grid;
  gap: 15px;
}

.catalog-tools {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) minmax(180px, 260px);
  gap: 10px;
}

.offense-catalog-list {
  display: grid;
  gap: 16px;
}

.offense-law-group {
  display: grid;
  gap: 8px;
}

.offense-law-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px;
}

.offense-law-heading h3 {
  margin: 0;
}

.offense-law-heading span {
  min-width: 28px;
  padding: 2px 8px;
  border-radius: 999px;
  background: var(--neutral-badge-background);
  color: var(--neutral-badge-text);
  font-size: 12px;
  text-align: center;
}

.catalog-offense-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.catalog-offense-card summary {
  display: grid;
  grid-template-columns: minmax(95px, 0.42fr) minmax(180px, 1fr) minmax(140px, auto) minmax(110px, auto);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  cursor: pointer;
  list-style: none;
}

.catalog-offense-card summary::-webkit-details-marker {
  display: none;
}

.catalog-offense-card[open] summary {
  border-bottom: 1px solid var(--line);
  background: var(--row-active-background);
}

.offense-reference {
  color: var(--muted);
  font-size: 12px;
}

.offense-title {
  min-width: 0;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.offense-penalty {
  color: var(--text);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.offense-flags {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  justify-content: flex-end;
}

.catalog-offense-card .offense-edit-form {
  padding: 14px;
}

.catalog-entry {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line-soft);
  border-radius: 8px;
  background: var(--bg-soft);
}

.catalog-entry .full {
  grid-column: 1 / -1;
}

.bar-chart {
  display: grid;
  gap: 13px;
  margin-top: 16px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(100px, 0.8fr) minmax(120px, 2fr) 35px;
  gap: 10px;
  align-items: center;
}

.bar-track {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--neutral-badge-background);
}

.bar-track span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--blue), var(--blue-text));
}

.empty-state,
.loading,
.error-state {
  display: grid;
  gap: 12px;
  min-height: 220px;
  place-items: center;
  padding: 25px;
  text-align: center;
  color: var(--muted);
}

.loading {
  overflow: hidden;
}

.loading::before {
  content: "";
  width: 28px;
  height: 28px;
  border: 3px solid var(--line);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.loading::after {
  content: "";
  width: min(360px, 72vw);
  height: 8px;
  border-radius: 999px;
  background:
    linear-gradient(90deg, transparent, color-mix(in srgb, var(--blue) 28%, transparent), transparent),
    var(--neutral-badge-background);
  background-size: 220% 100%;
  animation: shimmer 1.35s var(--motion-ease) infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

@keyframes shimmer {
  from { background-position: 160% 0; }
  to { background-position: -60% 0; }
}

@keyframes content-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes surface-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes bar-grow {
  from { transform: scaleX(0); }
  to { transform: scaleX(1); }
}

@keyframes pulse-dot {
  0%,
  100% {
    box-shadow: 0 0 0 0 color-mix(in srgb, var(--green) 28%, transparent);
  }
  50% {
    box-shadow: 0 0 0 5px transparent;
  }
}

@keyframes soft-pop {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes toast-life {
  from { transform: scaleX(1); }
  to { transform: scaleX(0); }
}

@media (prefers-reduced-motion: no-preference) {
  .dot {
    animation: pulse-dot 2.4s var(--motion-ease) infinite;
  }

  .login-card {
    animation: soft-pop var(--motion-slow) var(--motion-ease) both;
  }

  .content.content-enter > * {
    animation: content-in var(--motion-medium) var(--motion-ease) both;
  }

  .content.content-enter > *:nth-child(2) {
    animation-delay: 35ms;
  }

  .content.content-enter > *:nth-child(3) {
    animation-delay: 70ms;
  }

  .content.content-enter .bar-track span {
    animation: bar-grow var(--motion-slow) var(--motion-ease) both;
    transform-origin: left center;
  }

  .search-results,
  .notification-panel,
  .app-context-menu {
    animation: surface-in var(--motion-fast) var(--motion-ease) both;
  }

  .sidebar-backdrop {
    animation: fade-in var(--motion-fast) var(--motion-ease) both;
  }

  .toast {
    animation: toast-in var(--motion-medium) var(--motion-ease) both;
  }

  .toast::after {
    animation: toast-life 4.2s linear forwards;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

.toast-region {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 100;
  display: grid;
  gap: 8px;
}

.toast {
  position: relative;
  overflow: hidden;
  min-width: 280px;
  max-width: 420px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--toast-background);
  box-shadow: var(--shadow);
  contain: paint;
}

.toast::after {
  position: absolute;
  right: 0;
  bottom: 0;
  left: 0;
  height: 3px;
  border-radius: 999px;
  background: var(--green);
  transform-origin: left center;
  content: "";
}

.toast.error {
  border-color: rgba(251, 79, 104, 0.45);
}

.toast.error::after {
  background: var(--red);
}

.hidden {
  display: none !important;
}

.login-body {
  display: grid;
  min-height: 100dvh;
  place-items: center;
  padding: 88px 24px 40px;
  background: var(--login-background);
}

.login-shell {
  width: min(440px, 100%);
}

.login-card {
  padding: 36px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--login-card-background);
  box-shadow: var(--shadow);
  text-align: left;
}

.seal {
  width: 92px;
  height: 92px;
  margin: 0 auto 20px;
  font-size: 14px;
}

.login-logo {
  display: block;
  width: 52px;
  height: 52px;
  margin: 0;
  object-fit: contain;
  flex: 0 0 auto;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--blue-text);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
}

.login-card h1 {
  margin: 0 0 10px;
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.25;
}

.login-actions {
  display: grid;
  gap: 10px;
  margin-top: 25px;
}

.login-form {
  display: grid;
  gap: 20px;
  margin-top: 28px;
  text-align: left;
}

.login-error {
  margin-top: 18px;
  padding: 11px 12px;
  border: 1px solid rgba(251, 79, 104, 0.45);
  border-radius: 8px;
  color: var(--red-text);
  background: var(--red-soft);
  text-align: left;
}

.fine-print {
  margin: 24px 0 0;
  font-size: 12px;
  line-height: 1.6;
}

/* Shared hierarchy and interaction details. */
h2, h3, h4 {
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.02em;
}
strong, b {
  font-weight: 600;
}
.section-header h2 {
  font-size: 18px;
}
.section-header h3 {
  font-size: 16px;
}
.meta {
  font-size: 12px;
  line-height: 1.6;
}
input::placeholder, textarea::placeholder {
  color: var(--subtle-text);
  opacity: 1;
}
input, select, textarea {
  accent-color: var(--blue);
}
::selection {
  background: var(--blue-soft);
  color: var(--text);
}
.ui-icon {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  vertical-align: middle;
}
.nav-icon .ui-icon {
  width: 18px;
  height: 18px;
}
#menu-button {
  display: none;
}
.top-actions .theme-toggle {
  border-color: transparent;
  background: transparent;
}
.search > .ui-icon {
  color: var(--muted);
  width: 18px;
  height: 18px;
}
.search input {
  font-size: 13px;
}
.user-pill strong {
  font-size: 12px;
}
.shift-card strong {
  font-size: 12px;
}
.shift-card small {
  font-size: 11px;
  margin-top: 3px;
}
.button.primary:hover:not(:disabled):not(.disabled) {
  background: color-mix(in srgb, var(--primary-background) 88%, black);
  border-color: var(--primary-border);
}
.button:focus-visible, .icon-button:focus-visible, .nav-link:focus-visible, .tab:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 3px;
}
.table-wrap tbody tr:last-child td {
  border-bottom: 0;
}
.pagination,
.pagination-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px;
}
.pagination {
  justify-content: space-between;
  border-top: 1px solid var(--line-soft);
}
.pagination-actions {
  gap: 8px;
}
.create-panel:has(> .hidden) {
  display: none;
}
.create-panel:has(> :not(.hidden)) {
  margin-bottom: 20px;
}
.toolbar > .button {
  flex-shrink: 0;
}
.toolbar > select.filter-input {
  flex: 0 1 220px;
}
.login-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  margin-bottom: 30px;
}
.login-brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: -0.03em;
}
.login-brand small {
  display: block;
  margin-top: 2px;
  color: var(--muted);
  font-size: 11px;
}
.login-card > .eyebrow {
  margin-bottom: 16px;
}
.login-card > .muted {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}
.login-form .button {
  min-height: 46px;
  margin-top: 4px;
}
.login-footer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  margin: 24px 0 0;
  color: var(--muted);
  font-size: 11px;
}
.login-footer .ui-icon {
  width: 14px;
  height: 14px;
}
.skip-link {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 150;
  padding: 10px 16px;
  border-radius: 8px;
  background: var(--primary-background);
  color: white;
  transform: translateY(-180%);
}
.skip-link:focus {
  transform: translateY(0);
}
.news-empty {
  padding-block: 48px;
  text-align: center;
}

@media (max-width: 1300px) {
  .case-relations-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 1100px) {
  .stats-grid,
  .metro-overview-summary {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .role-workspace {
    grid-template-columns: 1fr;
  }

  .access-workspace {
    grid-template-columns: 1fr;
  }

  .role-list {
    max-height: 360px;
  }

  .access-list-rows {
    max-height: 360px;
  }

  .department-form {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .two-column,
  .three-column {
    grid-template-columns: 1fr;
  }

  .suggestions-summary {
    grid-template-columns: 1fr;
  }

  .dashboard-info-band,
  .dashboard-field-grid {
    grid-template-columns: 1fr;
  }

  .suggestion-feature-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .user-pill div {
    display: none;
  }

  .catalog-offense-card summary {
    grid-template-columns: minmax(90px, 0.4fr) minmax(180px, 1fr) minmax(120px, auto);
  }

  .offense-flags {
    grid-column: 1 / -1;
    justify-content: flex-start;
  }
}

@media (max-width: 900px) {
  .case-activity-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 800px) {
  #menu-button { display: inline-grid; }
  .content { padding-top: 24px; }
  .notification-panel { right: 0; }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    left: 0;
    width: 264px;
    height: 100dvh;
    padding-top: calc(20px + env(safe-area-inset-top, 0px));
    padding-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
    transform: translateX(calc(-100% - 24px));
    transition: transform var(--motion-medium) var(--motion-ease);
    box-shadow: var(--shadow);
    will-change: transform;
  }

  body.menu-open {
    overflow: hidden;
  }

  body.menu-open .sidebar {
    transform: translateX(0);
  }

  .topbar {
    grid-template-columns: auto 1fr auto;
    padding: 10px 12px;
  }

  .top-actions > .icon-button,
  .top-actions > a,
  .top-actions > form .icon-button,
  .top-actions > .theme-toggle {
    display: inline-grid;
  }

  .user-pill {
    display: none;
  }

  .content {
    width: min(calc(100% - 22px), 1510px);
  }

  .profile-card {
    grid-template-columns: 1fr;
  }

  .mugshot {
    width: 190px;
  }
}

@media (max-width: 560px) {
  .login-body { padding: 80px 16px 28px; }
  .login-card { padding: 28px 24px; }
  .login-brand { margin-bottom: 24px; }
  .login-theme-toggle { top: 16px; right: 16px; }
  .login-brand small { font-size: 10px; }
  .content { width: calc(100% - 32px); }
  .page-header { gap: 18px; margin-bottom: 24px; }
  .card-pad, .news-card, .news-empty, .dashboard-info-item { padding: 20px; }
  .toolbar > select.filter-input { flex: auto; }
  .field input, .field select, .field textarea, .filter-input { font-size: 16px; }
  .topbar { min-height: 68px; }
  .topbar .icon-button { width: 34px; height: 40px; }
  .search { padding-inline: 9px; gap: 7px; }
  .search-results { position: fixed; top: 68px; left: 12px; right: 12px; max-height: min(440px, 65dvh); }
  .notification-panel { max-height: min(520px, 75dvh); }
  .table-wrap { border-radius: 0 0 12px 12px; }

  .stats-grid,
  .metro-overview-summary,
  .department-summary,
  .department-form,
  .form-grid,
  .detail-grid,
  .penalty-summary,
  .catalog-inline-form,
  .catalog-tools,
  .catalog-entry,
  .tag-catalog-row,
  .metro-add-member-form,
  .metro-member-row,
  .knowledge-filter {
    grid-template-columns: 1fr;
  }

  .company-row,
  .permission-editor-options,
  .catalog-offense-card summary {
    grid-template-columns: 1fr;
  }

  .company-status {
    width: 100%;
    height: 5px;
  }

  .offense-penalty {
    white-space: normal;
  }

  .selection-item {
    grid-template-columns: 1fr auto;
  }

  .selection-item select {
    grid-column: 1 / -1;
    grid-row: 2;
  }

  .department-assignment {
    grid-template-columns: 1fr;
  }

  .entity-picker-result {
    align-items: flex-start;
    flex-direction: column;
    gap: 7px;
  }

  .multi-select-actions {
    align-items: flex-start;
    flex-direction: column;
  }

  .multi-select-actions .toolbar,
  .multi-select-actions .button {
    width: 100%;
  }

  .offense-picker-layout {
    grid-template-columns: 1fr;
  }

  .offense-law-tabs {
    display: flex;
    max-height: none;
    overflow-x: auto;
    overflow-y: hidden;
    padding-bottom: 2px;
  }

  .offense-law-tab {
    flex: 0 0 auto;
  }

  .offense-result {
    display: grid;
    grid-template-columns: minmax(54px, auto) minmax(0, 1fr);
  }

  .offense-result-main,
  .offense-result-penalty,
  .offense-result-flags {
    grid-column: 1 / -1;
  }

  .offense-result-flags {
    justify-content: flex-start;
  }

  .case-relations-grid,
  .locked-case-notice {
    grid-template-columns: 1fr;
  }

  .suggestion-feature-grid {
    grid-template-columns: 1fr;
  }

  .suggestion-title-row {
    flex-direction: column;
  }

  .news-card-header {
    flex-direction: column;
  }

  .news-card-header .toolbar {
    width: 100%;
  }

  .news-editor-shell .ql-toolbar.ql-snow {
    align-items: stretch;
  }

  .news-editor-shell .ql-toolbar.ql-snow .ql-formats {
    margin-right: 0;
  }

  .knowledge-pagination {
    align-items: flex-start;
    flex-direction: column;
  }

  .knowledge-pagination > span:last-child {
    justify-content: flex-start;
  }

  .suggestion-title-row > span {
    justify-content: flex-start;
  }

  .page-header > .toolbar,
  .page-header > .toolbar .button {
    width: 100%;
  }

  .detail-item + .detail-item {
    padding-left: 0;
    border-left: 0;
  }

  .search kbd,
  .discord-badge {
    display: none;
  }

  .top-actions {
    gap: 0;
  }

  .topbar {
    grid-template-columns: auto minmax(0, 1fr) auto;
    gap: 8px;
  }

  .search {
    min-width: 0;
  }

  .toast-region {
    right: 10px;
    bottom: calc(10px + env(safe-area-inset-bottom, 0px));
    left: 10px;
  }

  .toast {
    min-width: 0;
    max-width: none;
  }

  .page-header,
  .section-header,
  .metro-family-head,
  .toolbar {
    align-items: flex-start;
    flex-direction: column;
  }

  .metro-family-count,
  .metro-member-actions {
    justify-content: flex-start;
  }

  .assignment-grid,
  .user-log-filter,
  .account-access-head,
  .account-access-body {
    grid-template-columns: 1fr;
  }

  .assignment-card {
    grid-template-columns: auto auto minmax(0, 1fr);
  }

  .assignment-card-meta {
    grid-column: 2 / -1;
    justify-self: start;
  }

  .account-access-head > .button,
  .account-access-actions .button {
    width: 100%;
  }

  .suspension-presets {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* Circular department seal, shared by the SAHP branding and system profile. */
.brand-logo,
.login-logo,
.discord-badge[src="/sahp_logo.png"] {
  clip-path: circle(49%);
}
dialog.credential-modal {
  width: min(32rem, calc(100vw - 2rem));
  border: 1px solid var(--border, #334155);
  border-radius: 14px;
  padding: 0;
  color: inherit;
  background: var(--surface, #172033);
}

dialog.credential-modal::backdrop { background: rgba(2, 6, 23, .72); }
.credential-modal-content { padding: 1.5rem; }
.credential-modal-content h2 { margin-top: 0; }
.credential-modal-content dl { margin: 1.25rem 0; }
.credential-modal-content dl div { display: grid; grid-template-columns: 8rem 1fr; gap: .75rem; padding: .5rem 0; border-top: 1px solid var(--border, #334155); }
.credential-modal-content dt { color: var(--muted, #94a3b8); }
.credential-modal-content dd { margin: 0; overflow-wrap: anywhere; }
.credential-modal-content code { user-select: all; }
.credential-modal-actions { display: flex; justify-content: flex-end; gap: .75rem; flex-wrap: wrap; }
