:root {
  --bg: #0f172a;
  --panel: #111827;
  --muted: #94a3b8;
  --text: #e5e7eb;
  --accent: #22c55e;
  --warn: #f59e0b;
  --danger: #ef4444;
  --border: #1f2937;
  --input: #0b1220;
  /* ENISA severity colors */
  --low: #22c55e;
  --med: #f59e0b;
  --high: #f97316;
  --vhigh: #ef4444;
}

/* Base */

*,
*::before,
*::after {
  box-sizing: border-box;
}

/* Reset fieldset defaults */
fieldset {
  margin: 0;
  padding: 0;
  border: 0; /* remove UA border so our custom ones always apply */
}

legend {
  padding: 0;
  margin: 0;
}

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

body {
  padding: 24px;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  font: 14px/1.4 system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial,
    "Apple Color Emoji", "Segoe UI Emoji";
}

/* Typography */

h1 {
  font-size: 20px;
  margin: 0 0 8px;
}

h2 {
  font-size: 18px;
  margin: 0 0 8px;
}

p {
  margin: 0 0 12px;
}

p.desc {
  color: var(--muted);
  margin: 0 0 20px;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Generic layout utilities */

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin: 0 0 16px;
}

.grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(12, 1fr);
}

.col-12 {
  grid-column: span 12;
}
.col-6 {
  grid-column: span 6;
}
.col-4 {
  grid-column: span 4;
}
.col-3 {
  grid-column: span 3;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text);
}

/* Inputs */

input[type="date"],
input[type="text"],
input[type="number"],
input[type="search"],
select,
textarea {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--input);
  color: var(--text);
  font: inherit;
}

input::placeholder,
textarea::placeholder {
  color: var(--muted);
}

textarea {
  min-height: 68px;
  resize: vertical;
}

.row {
  display: flex;
  gap: 8px;
  align-items: center;
}

.row > * {
  flex: 1;
}

/* Buttons */

.btn {
  appearance: none;
  border: 1px solid var(--border);
  color: var(--text);
  background: #0b1220;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.02s;
  font: inherit;
}

.btn:hover {
  border-color: #334155;
  background: #0d1424;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #052e1a;
  border-color: #0f3b23;
  color: #d1fae5;
}

.btn-primary:hover {
  background: #083822;
  border-color: #14532d;
}

.btn-danger {
  background: #2b0b10;
  border-color: #3b0f14;
  color: #fee2e2;
}

/* Helper text */

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

.muted {
  color: var(--muted);
}

.small {
  font-size: 12px;
}

.hidden {
  display: none;
}

/* Result / tags */

.result {
  font-size: 16px;
  padding: 12px;
  border-radius: 10px;
  border: 1px dashed #374151;
  background: #0a101c;
}

.result .final {
  font-size: 20px;
  font-weight: 700;
  color: #bbf7d0;
}

.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 8px;
}

.tag {
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--muted);
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 12px;
}

/* Site layout */

.container {
  width: 100%;
  max-width: 960px;
  margin: 0 auto;
}

/* Header / nav */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
}

.logo {
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: lowercase;
  color: var(--text);
  text-decoration: none;
  transition: color 0.2s ease;
  display: inline-block;
  font-size: 15px;
}

.logo:hover {
  color: var(--accent);
}

.main-nav {
  display: flex;
  align-items: center;
  gap: 8px;
}

.main-nav a {
  font-size: 13px;
  text-decoration: none;
  color: var(--muted);
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid transparent;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
}

.main-nav a:hover {
  background: #020617;
  border-color: var(--border);
  color: var(--text);
}

.main-nav a.active {
  background: #052e1a;
  border-color: #0f3b23;
  color: #bbf7d0;
}

/* Dropdown menu */
.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown > a {
  margin-left: 0;
}

.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 8px;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 8px;
  min-width: 220px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-8px);
  transition: opacity 0.15s ease, visibility 0.15s ease, transform 0.15s ease;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.nav-dropdown-menu a {
  display: block;
  padding: 8px 12px;
  margin: 0;
  border-radius: 8px;
  font-size: 13px;
  color: var(--text);
  text-decoration: none;
  transition: background 0.15s ease;
}

.nav-dropdown-menu a:hover {
  background: #0b1220;
  border-color: transparent;
  color: var(--text);
}

.nav-dropdown-menu a:first-child {
  font-weight: 600;
  color: var(--accent);
  border-bottom: 1px solid var(--border);
  margin-bottom: 4px;
  padding-bottom: 12px;
}

.nav-dropdown-menu a:first-child:hover {
  background: transparent;
  color: var(--accent);
}

/* Main */

.site-main {
  padding-bottom: 32px;
  flex: 1;
}

/* Hero / page headers */

.hero {
  padding: 12px 0 8px;
}

.hero-inner {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.hero h1 {
  font-size: 20px;
}

.hero p {
  color: var(--muted);
  max-width: 640px;
}

.section-header {
  margin-bottom: 12px;
}

.section-header h2 {
  margin: 0 0 4px;
  font-size: 16px;
}

.section-header p {
  margin: 0;
  color: var(--muted);
}

.page-header {
  padding: 16px 0 8px;
}

.page-header h1 {
  margin: 0 0 4px;
  font-size: 18px;
}

.page-header p {
  margin: 0;
  color: var(--muted);
}

/* Tools section */

.tools-section {
  padding-bottom: 20px;
}

.tools-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}

#toolSearch {
  flex: 1 1 220px;
}

.filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  appearance: none;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--muted);
  padding: 6px 10px;
  cursor: pointer;
  font-size: 12px;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease,
    transform 0.02s;
}

.filter-btn:hover {
  border-color: #334155;
  background: #0d1424;
  color: var(--text);
}

.filter-btn:active {
  transform: translateY(1px);
}

.filter-btn.active {
  background: #052e1a;
  border-color: #0f3b23;
  color: #d1fae5;
}

/* Cards */

.tools-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 12px;
}

.tool-card,
.post-card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.post-card:hover {
  border-color: #334155;
  transform: translateY(-2px);
}

.tool-card h3,
.post-card h3 {
  margin: 0 0 6px;
  font-size: 15px;
}

.tool-card h3 a,
.post-card h3 a {
  color: var(--text);
  text-decoration: none;
}

.post-card h3 a:hover {
  color: var(--accent);
}

.tool-card p,
.post-card p {
  margin: 0 0 6px;
  font-size: 13px;
  color: var(--muted);
}

.tool-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
  margin-top: 2px;
}

.badge {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-outline {
  background: transparent;
}

.tool-status {
  font-size: 11px;
  margin-left: auto;
  color: var(--muted);
}

.tool-status-soon {
  color: var(--warn);
}

/* Blog teasers */

.blog-teaser {
  padding-bottom: 20px;
}

.blog-teaser-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}

.post-meta {
  font-size: 12px;
  color: var(--muted);
}

.text-link {
  display: inline-block;
  margin-top: 6px;
  font-size: 13px;
}

/* Blog page */

.blog-post {
  margin-bottom: 20px;
}

.blog-post h1 {
  margin-bottom: 12px;
  font-size: 24px;
}

.blog-post h2 {
  margin-bottom: 4px;
}

/* Tool layouts / forms */

.tool-layout {
  display: grid;
  grid-template-columns: minmax(0, 2.2fr) minmax(0, 1.5fr);
  gap: 12px;
}

.tool-panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.tool-sidebar {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
  font-size: 13px;
}

/* Primary button alias */

.primary-btn {
  appearance: none;
  border-radius: 8px;
  border: 1px solid #0f3b23;
  background: #052e1a;
  color: #d1fae5;
  padding: 10px 14px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.02s;
}

.primary-btn:hover {
  background: #083822;
  border-color: #14532d;
}

.primary-btn:active {
  transform: translateY(1px);
}

.tool-disclaimer {
  margin-top: 8px;
  font-size: 12px;
  color: var(--muted);
}

/* Prose blocks */

.prose {
  line-height: 1.6;
  font-size: 14px;
  color: var(--text);
}

.prose p {
  margin-bottom: 10px;
}

.prose h2 {
  margin-top: 16px;
  margin-bottom: 6px;
  font-size: 16px;
}

.prose ul {
  padding-left: 18px;
  margin: 0 0 10px;
}

.prose img,
.blog-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  border-radius: 12px;
  margin: 24px 0;
  border: 1px solid var(--border);
  display: block;
}

/* Footer */

.site-footer {
  border-top: 1px solid var(--border);
  padding: 12px 0 16px;
  margin-top: auto;
}

.footer-inner {
  text-align: center;
}

.footer-small {
  margin-top: 4px;
  font-size: 12px;
  color: var(--muted);
}

/* Card header row */

.card-header-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

/* Pause footer */

.pause-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Responsive: global mobile tweaks */

@media (max-width: 720px) {
  body {
    padding: 12px;
  }

  .header-inner {
    flex-wrap: wrap;
    gap: 6px;
  }

  .main-nav {
    flex-wrap: wrap;
  }

  .main-nav a {
    font-size: 12px;
    padding: 4px 8px;
  }

  .nav-dropdown-menu {
    position: fixed;
    left: 12px;
    right: 12px;
    width: auto;
    min-width: auto;
  }

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

  /* Make all grid columns full-width on mobile */
  .col-12,
  .col-6,
  .col-4,
  .col-3 {
    grid-column: span 12;
  }

  /* Stack buttons vertically on mobile */
  .row {
    flex-direction: column;
    align-items: stretch;
  }

  .row > * {
    flex: none;
  }

  /* Adjust card padding for mobile */
  .card {
    padding: 12px;
  }

  /* Better spacing for result output on mobile */
  .result {
    font-size: 14px;
    padding: 10px;
  }

  .result .final {
    font-size: 18px;
  }

  /* Adjust pause row layout for mobile */
  [data-pause-row] .grid {
    gap: 10px;
  }

  [data-pause-row] .col-12.row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  [data-pause-row] .col-12.row > * {
    flex: none;
  }

  /* Better button spacing on mobile */
  .btn {
    width: 100%;
  }

  /* Adjust header spacing */
  h1 {
    font-size: 18px;
  }

  p.desc {
    font-size: 13px;
  }

  /* Make "Add pause" button section stack on mobile */
  .card-header-row {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .card-header-row > button {
    width: 100%;
  }

  /* Stack pause row footer on mobile */
  .pause-footer {
    flex-direction: column;
    align-items: stretch;
    gap: 8px;
  }

  .pause-footer > button {
    width: 100%;
  }

  /* Ensure radio button labels don't break on mobile */
  label.row {
    flex-wrap: nowrap;
  }
}

/* === ENISA Tool Specific Styles === */

.subtitle {
  color: var(--muted);
  margin-bottom: 24px;
}

/* ENISA-specific grid layout */

.enisa-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 16px;
}

/* Desktop: 1 on left, 2 & 3 stacked on right, result full-width below */
@media (min-width: 900px) {
  .enisa-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    grid-auto-rows: minmax(0, auto);
  }

  .enisa-grid > fieldset:nth-child(1) {
    grid-column: 1;
    grid-row: 1 / span 2;
  }

  .enisa-grid > fieldset:nth-child(2) {
    grid-column: 2;
    grid-row: 1;
  }

  .enisa-grid > fieldset:nth-child(3) {
    grid-column: 2;
    grid-row: 2;
  }

  .enisa-grid > .enisa-result {
    grid-column: 1 / -1;
    grid-row: 3;
  }
}

/* ENISA fieldsets - clean section styling */

.enisa-tool fieldset {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 20px;
  margin: 0 0 20px 0;
}

.enisa-tool legend {
  padding: 0 10px;
  color: var(--text);
  font-weight: 600;
  font-size: 15px;
  margin: 0 0 4px 0;
  border: none;
  background: var(--panel);
  display: block;
  width: auto;
}

/* ENISA-specific row layout */

.enisa-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  align-items: start;
  margin: 12px 0;
}

@media (min-width: 600px) {
  .enisa-row {
    grid-template-columns: 190px 1fr;
  }
}

.enisa-row label {
  color: var(--muted);
}

/* Radio/checkbox choice groups */

.choices {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.choices label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: #0b1220;
  border: 1px solid var(--border);
  padding: 8px 10px;
  border-radius: 8px;
  cursor: pointer;
}

input[type="radio"],
input[type="checkbox"] {
  accent-color: var(--accent);
}

/* Help text (different from .note) */

.help {
  color: var(--muted);
  font-size: 0.92rem;
  margin-top: 6px;
}

.inline-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  border: 1px solid var(--border);
  background: #0b1220;
  color: var(--muted);
}

/* ENISA result panel */

.enisa-result {
  background: linear-gradient(180deg, #0b1220, #0a101c);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px;
  margin-top: 16px;
}

.score-line {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-bottom: 1px dashed var(--border);
  padding-bottom: 10px;
  margin-bottom: 10px;
}

.score {
  font-size: 2rem;
  font-weight: 700;
}

.badge.low {
  background: var(--low);
  color: #0b1220;
  border: none;
}

.badge.med {
  background: var(--med);
  color: #0b1220;
  border: none;
}

.badge.high {
  background: var(--high);
  color: #0b1220;
  border: none;
}

.badge.vhigh {
  background: var(--vhigh);
  color: #0b1220;
  border: none;
}

.formula {
  color: var(--muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

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

.flag {
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 6px 8px;
  color: var(--muted);
}

/* ENISA actions (button group) */

.actions {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.actions button {
  background: #0b1220;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font: inherit;
  transition: border-color 0.15s ease, background 0.15s ease, transform 0.02s;
}

.actions button:hover {
  border-color: #334155;
  background: #0d1424;
}

.actions button:active {
  transform: translateY(1px);
}

.actions button.primary {
  background: var(--accent);
  color: #0b1220;
  font-weight: 700;
  border: none;
}

.actions button.primary:hover {
  background: #3b82f6;
}

/* ENISA footnote */

.footnote {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: 10px;
}

/* Help-box blocks */

details.helpbox {
  margin-top: 10px;
  background: #0b1220;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}

details.helpbox summary {
  cursor: pointer;
  color: var(--text);
  font-weight: 600;
  list-style: none;
}

details.helpbox summary::-webkit-details-marker {
  display: none;
}

.help-list {
  margin: 8px 0 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.help-list li {
  margin: 6px 0;
}

.mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}