:root {
  --bg: #08090c;
  --panel: #12161d;
  --panel-strong: #181d25;
  --panel-soft: #20242d;
  --border: #303743;
  --text: #eef3f8;
  --muted: #9aa8b6;
  --accent: #ffe600;
  --accent-strong: #f4c400;
  --accent-rgb: 255, 230, 0;
  --accent-contrast: #151100;
  --brand-red: #ef1b23;
  --brand-red-rgb: 239, 27, 35;
  --warn: #ffd84a;
  --danger: #ef1b23;
  --info: #ffd84a;
  --shadow: 0 22px 60px rgba(0, 0, 0, 0.35);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

.site-header {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 64px;
  padding: 10px 24px;
  border-bottom: 1px solid var(--border);
  background: rgba(8, 9, 12, 0.96);
  backdrop-filter: blur(12px);
}

.brand,
.header-actions,
.section-toolbar,
.selection-header,
.panel-heading,
.article-title,
.option-row,
.selected-card-header,
.totals-row,
.modal-header,
.modal-actions {
  display: flex;
  align-items: center;
}

.brand {
  gap: 12px;
  min-width: 220px;
  flex: 0 1 390px;
}

.brand > div {
  min-width: 0;
  overflow: hidden;
}

.brand-mark {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 54px;
  height: 38px;
}

.brand-logo {
  display: block;
  width: 100%;
  height: auto;
  max-height: 30px;
  object-fit: contain;
}

h1,
h2,
h3,
h4,
p {
  margin: 0;
}

h1 {
  font-size: 18px;
  line-height: 1.15;
  white-space: nowrap;
}

h2 {
  font-size: 18px;
}

h3 {
  font-size: 15px;
}

.brand p,
.section-toolbar p,
.selection-header p,
.panel-heading span,
.small,
.meta-line {
  color: var(--muted);
  font-size: 12px;
}

.brand p {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.header-actions {
  justify-content: flex-end;
  gap: 14px;
  flex: 1;
  min-width: 0;
}

.main-nav {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.025);
}

.nav-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-decoration: none;
  white-space: nowrap;
}

.nav-link:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.05);
}

.nav-link.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.search-wrap {
  display: grid;
  gap: 0;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  flex: 1 1 260px;
  width: min(390px, 100%);
  min-width: 220px;
  max-width: 390px;
}

.search-wrap span {
  display: none;
}

.search-wrap input,
.reduction-grid input,
.conversion-controls input,
.conversion-controls select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #0f141b;
  color: var(--text);
  outline: none;
}

.search-wrap input {
  padding: 0 14px;
}

.search-wrap input:focus,
.reduction-grid input:focus,
.conversion-controls input:focus,
.conversion-controls select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
}

.button,
.icon-button {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-soft);
  color: var(--text);
  cursor: pointer;
  transition: transform 0.15s ease, border-color 0.15s ease, background 0.15s ease;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  font-weight: 800;
  text-decoration: none;
}

.button:hover,
.icon-button:hover {
  transform: translateY(-1px);
  border-color: #465568;
}

.button.primary {
  border-color: rgba(var(--accent-rgb), 0.75);
  background: var(--accent-strong);
  color: var(--accent-contrast);
}

.button.warning {
  border-color: rgba(242, 184, 75, 0.65);
  background: #493813;
  color: #ffe5a6;
}

.button.danger {
  border-color: rgba(var(--brand-red-rgb), 0.65);
  background: rgba(var(--brand-red-rgb), 0.18);
  color: #ffd6d8;
}

.button.ghost {
  background: transparent;
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.45;
  transform: none;
}

.button.full {
  width: 100%;
}

.button.compact {
  min-height: 36px;
  padding: 0 12px;
  white-space: nowrap;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 38px;
  height: 38px;
  flex: 0 0 38px;
}

.icon-button svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr) 390px;
  gap: 20px;
  padding: 20px 24px 40px;
  align-items: start;
}

.wetboek-page .app-shell {
  grid-template-columns: 260px minmax(0, 1fr);
}

.straf-page .app-shell {
  grid-template-columns: minmax(0, 1080px);
  justify-content: center;
}

.site-footer {
  display: flex;
  justify-content: center;
  padding: 18px 24px 26px;
  border-top: 1px solid var(--border);
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
  text-align: center;
}

.site-footer a {
  color: inherit;
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text);
}

.site-footer span {
  color: var(--accent);
}

.category-panel,
.selection-panel,
.article-panel {
  min-width: 0;
}

.category-panel,
.selection-panel {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 116px);
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.category-panel {
  padding: 14px;
  max-height: none;
  overflow: visible;
}

.selection-panel {
  padding: 16px;
}

.selection-panel.selection-page {
  position: static;
  width: 100%;
  max-height: none;
  overflow: visible;
}

.panel-heading,
.section-toolbar,
.selection-header {
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.selection-header-actions {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

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

.category-button {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  width: 100%;
  min-height: 40px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  text-align: left;
}

.category-button.active,
.category-button:hover {
  border-color: var(--border);
  background: var(--panel-soft);
  color: var(--text);
}

.article-panel {
  display: grid;
  gap: 14px;
}

.status-message {
  min-height: 22px;
  color: var(--muted);
  font-size: 14px;
}

.articles-list,
.selected-list {
  display: grid;
  gap: 14px;
}

.article-card,
.selected-card,
.totals-card,
.total-controls {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.article-card {
  padding: 16px;
}

.article-title {
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 10px;
}

.article-title h3 {
  font-size: 18px;
  line-height: 1.25;
}

.badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.badge.accent {
  border-color: rgba(var(--accent-rgb), 0.55);
  color: #fff06a;
}

.badge.warn {
  border-color: rgba(242, 184, 75, 0.5);
  color: #ffe0a0;
}

.article-notice {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 14px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 850;
}

.hovj-permission-notice {
  border: 1px solid rgba(96, 165, 250, 0.68);
  background: rgba(37, 99, 235, 0.18);
  color: #bfdbfe;
}

.description {
  color: #bfc6cf;
  max-width: 92ch;
}

.description-intro {
  font-size: 15px;
  line-height: 1.65;
  font-weight: 500;
  margin: 12px 0 14px;
}

.description-list {
  display: grid;
  gap: 9px;
  margin: 14px 0 20px;
}

.description-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 7px;
  align-items: start;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.65;
}

.description-number {
  color: #aeb6c0;
  font-weight: 650;
}

.description-text {
  min-width: 0;
}

.description-sublist {
  display: grid;
  gap: 8px;
  margin-top: 10px;
  padding-left: 22px;
}

.description-subitem {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  color: #b8c0ca;
  font-size: 15px;
  line-height: 1.65;
}

.description-subnumber {
  color: #aeb6c0;
  font-weight: 650;
}

.options-list {
  display: grid;
  gap: 18px;
  max-width: 1120px;
}

.option-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 52px;
  padding: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111720;
}

.option-row strong {
  display: block;
  font-size: 14px;
}

.punishment-line {
  color: #dce6ef;
  font-size: 13px;
}

.punishment-table-wrap {
  width: min(100%, 1120px);
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111720;
}

.punishment-table {
  width: 100%;
  min-width: 620px;
  border-collapse: collapse;
}

.punishment-table th,
.punishment-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: #c9d2dc;
  text-align: left;
  vertical-align: middle;
}

.punishment-table tr:last-child th,
.punishment-table tr:last-child td {
  border-bottom: 0;
}

.punishment-table thead th {
  color: var(--muted);
  font-size: 13px;
  font-style: italic;
  font-weight: 900;
  background: rgba(255, 255, 255, 0.02);
}

.punishment-table tbody th {
  width: 34%;
  color: #eef3f8;
  font-size: 14px;
  font-weight: 900;
}

.punishment-table tbody th small {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.punishment-table tbody tr.selected th,
.punishment-table tbody tr.selected td {
  background: rgba(71, 85, 105, 0.22);
  box-shadow: inset 3px 0 0 #94a3b8;
}

.selected-marker {
  color: #d8e0ea !important;
}

.table-actions {
  display: inline-flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.table-delete-button {
  width: 36px;
  height: 36px;
  flex: 0 0 36px;
  border-color: rgba(239, 111, 108, 0.5);
  background: rgba(239, 111, 108, 0.12);
  color: #ffb4b2;
}

.table-delete-button:hover {
  border-color: rgba(239, 111, 108, 0.85);
  background: rgba(239, 111, 108, 0.22);
  color: #ffd1d0;
}

.punishment-table td:last-child,
.punishment-table th:last-child {
  width: 160px;
  text-align: right;
}

.variant-label {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 5px;
  background: var(--panel-soft);
  color: #c3ccd8;
  font-style: italic;
}

.selected-card {
  padding: 14px;
}

.selected-card-header {
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.selected-card-title {
  min-width: 0;
}

.selected-card-title h3 {
  font-size: 16px;
  line-height: 1.25;
}

.selected-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.selected-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 6px;
}

.selected-actions .button {
  min-height: 36px;
  font-size: 13px;
}

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

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

.summary-pill {
  display: grid;
  gap: 4px;
  min-height: 58px;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: #0f141b;
}

.summary-pill span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.summary-pill strong {
  color: var(--text);
  font-size: 14px;
  line-height: 1.35;
}

.summary-pill.adjusted {
  border-color: rgba(255, 255, 255, 0.06);
  background: #0f141b;
}

.ammo-control {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.24);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.ammo-control label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ammo-control input {
  min-height: 36px;
  padding: 0 9px;
}

.ammo-control small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.conversion-notes {
  display: grid;
  gap: 6px;
  margin: 0 0 12px;
  padding: 10px;
  border: 1px solid rgba(var(--accent-rgb), 0.22);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.conversion-notes p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.selected-control-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 10px;
  align-items: start;
}

.selected-control-panel {
  min-width: 0;
  padding: 10px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.025);
}

.control-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.control-panel-header h4,
.conversion-panel summary {
  color: #dce6ef;
  font-size: 13px;
  font-weight: 900;
}

.conversion-panel summary {
  display: flex;
  align-items: center;
  min-height: 30px;
  color: #fff06a;
  cursor: pointer;
  list-style-position: inside;
}

.conversion-panel[open] summary {
  margin-bottom: 10px;
}

.reduction-grid,
.conversion-controls {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.conversion-controls {
  grid-template-columns: 1.6fr 1fr auto;
}

.selected-reduction-grid {
  margin: 9px 0 0;
}

.conversion-panel .conversion-controls {
  grid-template-columns: 1fr;
  gap: 10px;
  margin: 0;
}

.conversion-panel {
  border-color: rgba(var(--accent-rgb), 0.24);
}

.conversion-panel .conversion-submit {
  align-self: stretch;
  width: 100%;
  min-width: 0;
  border-color: rgba(var(--accent-rgb), 0.95);
  background: linear-gradient(180deg, #fff06a, #f4c400);
  color: var(--accent-contrast);
  box-shadow: 0 8px 18px rgba(var(--accent-rgb), 0.2);
}

.conversion-panel .conversion-submit:hover {
  border-color: #fff7a8;
  background: linear-gradient(180deg, #fff7a8, #ffd500);
}

.reduction-grid label,
.conversion-controls label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.reduction-grid input,
.conversion-controls input,
.conversion-controls select {
  min-height: 36px;
  padding: 0 9px;
}

.total-controls {
  padding: 14px;
  margin: 16px 0 14px;
}

.total-controls-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.total-controls .button {
  width: 100%;
  margin-top: 8px;
}

.lock-button {
  width: 42px;
  min-width: 42px;
  height: 42px;
  margin-top: 0;
  padding: 0;
  font-size: 20px;
  line-height: 1;
}

.hovj-status,
.policy-warning {
  margin-top: 9px;
  font-size: 13px;
}

.hovj-status.active {
  color: #ffe0a0;
}

.policy-warning {
  color: #ffb4b2;
}

.totals-card {
  padding: 14px;
  margin-bottom: 14px;
}

.totals-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.totals-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
}

.totals-tab {
  min-height: 30px;
  padding: 0 11px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-size: 13px;
  font-weight: 800;
}

.totals-tab.active {
  background: var(--accent);
  color: var(--accent-contrast);
}

.copy-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  margin-bottom: 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel);
}

.copy-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.discord-output {
  width: 100%;
  min-height: 360px;
  max-height: min(52vh, 520px);
  margin: 0;
  padding: 12px;
  overflow: auto;
  border: 1px solid rgba(var(--accent-rgb), 0.2);
  border-radius: 8px;
  background: #0b1118;
  color: var(--text);
  cursor: copy;
  font-family: inherit;
  font-size: 15px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
  user-select: text;
}

.discord-output:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.16);
  outline: none;
}

.discord-output::-webkit-scrollbar {
  width: 10px;
}

.discord-output::-webkit-scrollbar-thumb {
  border: 2px solid #0b1118;
  border-radius: 999px;
  background: rgba(154, 168, 182, 0.65);
}

.discord-output.compact-output {
  min-height: 74px;
  max-height: 220px;
}

.totals-row {
  justify-content: space-between;
  gap: 12px;
  min-height: 32px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

.totals-row:last-child {
  border-bottom: 0;
}

.conversion-note {
  margin-top: 8px;
  color: var(--info);
  font-size: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 80;
  background: rgba(0, 0, 0, 0.68);
}

.modal {
  position: fixed;
  top: 50%;
  left: 50%;
  z-index: 90;
  width: min(720px, calc(100vw - 28px));
  max-height: min(820px, calc(100vh - 28px));
  overflow: auto;
  transform: translate(-50%, -50%);
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--panel-strong);
  box-shadow: var(--shadow);
}

.modal.compact {
  width: min(520px, calc(100vw - 28px));
}

.modal-header {
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border-bottom: 1px solid var(--border);
}

.modal-body {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.modal-body textarea {
  resize: vertical;
  min-height: 360px;
  padding: 12px;
  line-height: 1.5;
}

.modal-body .discord-output {
  min-height: 360px;
}

.edit-option {
  display: grid;
  gap: 6px;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #111720;
}

.modal-actions {
  justify-content: flex-end;
  gap: 10px;
}

.empty-state {
  padding: 18px;
  border: 1px dashed var(--border);
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

@media (max-width: 1180px) {
  .app-shell,
  .wetboek-page .app-shell {
    grid-template-columns: 230px minmax(0, 1fr);
  }

  .selection-panel:not(.selection-page) {
    position: fixed;
    top: 86px;
    right: 16px;
    bottom: 16px;
    z-index: 50;
    width: min(420px, calc(100vw - 32px));
    max-height: none;
    transform: translateX(calc(100% + 32px));
    transition: transform 0.2s ease;
  }

  .selection-panel:not(.selection-page).open {
    transform: translateX(0);
  }
}

@media (max-width: 820px) {
  .site-header,
  .header-actions {
    align-items: stretch;
    flex-direction: column;
  }

  .site-header {
    position: static;
    padding: 14px;
    max-width: 100vw;
  }

  .brand {
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr);
    width: 100%;
    min-width: 0;
    align-items: flex-start;
  }

  .brand p {
    max-width: calc(100vw - 86px);
    line-height: 1.35;
    overflow-wrap: anywhere;
  }

  .header-actions,
  .main-nav,
  .search-wrap {
    width: 100%;
    min-width: 0;
  }

  .main-nav {
    justify-content: stretch;
  }

  .nav-link {
    flex: 1;
  }

  .app-shell,
  .wetboek-page .app-shell,
  .straf-page .app-shell {
    grid-template-columns: 1fr;
    padding: 14px;
    max-width: 100vw;
  }

  .category-panel {
    position: static;
    max-height: none;
  }

  .category-list {
    grid-template-columns: 1fr;
  }

  .category-button {
    min-width: 0;
  }

  .category-button span {
    min-width: 0;
    overflow-wrap: anywhere;
  }

  .section-toolbar,
  .option-row,
  .conversion-controls {
    align-items: stretch;
    flex-direction: column;
    grid-template-columns: 1fr;
  }

  .selected-summary,
  .selected-control-grid,
  .reduction-grid {
    grid-template-columns: 1fr;
  }

  .control-panel-header,
  .selected-actions {
    align-items: stretch;
    flex-direction: column;
  }
}
