* {
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #f9fafb;
  margin: 0;
  color: #111;
}

body.drawer-open {
  overflow: hidden;
}

body.not-found {
  padding: 40px;
}

a {
  color: #2563eb;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

input[type="checkbox"]:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.container {
  min-height: 100vh;
  min-height: 100dvh;
}

.drawer-toggle {
  position: fixed;
  top: 14px;
  left: 14px;
  z-index: 900;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #111;
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .08);
}

.drawer-toggle:hover {
  background: #f9fafb;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(17, 24, 39, .35);
  opacity: 0;
  pointer-events: none;
  transition: opacity .18s ease;
}

.drawer-backdrop.visible {
  opacity: 1;
  pointer-events: auto;
}

.sidebar {
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 1001;
  width: min(320px, 86vw);
  background: #fff;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px 30px rgba(0, 0, 0, .18);
  transform: translateX(-100%);
  transition: transform .2s ease;
}

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

.sidebar-header {
  padding: 16px;
  border-bottom: 1px solid #e5e7eb;
}

.sidebar-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.sidebar-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0 0 8px 0;
}

.sidebar-count {
  font-size: 12px;
  color: #9ca3af;
  margin: 0;
}

.drawer-close {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  background: #fff;
  color: #374151;
  padding: 6px 9px;
  font-size: 12px;
  cursor: pointer;
}

.drawer-close:hover {
  background: #f3f4f6;
}

.sidebar-search {
  padding: 12px;
}

.sidebar-search input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  outline: none;
}

.sidebar-list {
  flex: 1;
  overflow-y: auto;
}

.risk-item {
  padding: 10px 12px;
  border-bottom: 1px solid #e5e7eb;
  cursor: pointer;
  color: #374151;
  font-size: 13px;
  user-select: none;
}

.risk-item a {
  color: inherit;
  text-decoration: none;
}

.risk-item a:hover {
  text-decoration: underline;
}

.risk-item:hover {
  background: #f3f4f6;
}

.risk-item.active {
  background: #dbeafe;
  color: #1e40af;
  font-weight: 600;
}

.pane {
  min-width: 0;
  padding: 68px 24px 24px;
}

.pane-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 240px;
  color: #9ca3af;
  font-size: 14px;
}

.pane-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.pane-title {
  font-size: 22px;
  font-weight: 700;
  margin: 0;
  overflow-wrap: anywhere;
}

.pane-count {
  font-size: 13px;
  color: #6b7280;
}

.wrap {
  max-width: 1040px;
  margin: 0 auto;
  padding: 28px;
}

.top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 20px;
}

.back {
  font-size: 13px;
  color: #2563eb;
}

h1 {
  font-size: 26px;
  line-height: 1.2;
  margin: 6px 0 0 0;
  overflow-wrap: anywhere;
}

h2 {
  font-size: 18px;
  line-height: 1.25;
  margin: 2px 0 0 0;
  overflow-wrap: anywhere;
}

h3 {
  font-size: 14px;
  line-height: 1.35;
  margin: 0 0 6px 0;
  overflow-wrap: anywhere;
}

.subtitle {
  margin: 6px 0 0 0;
  color: #6b7280;
  font-size: 13px;
}

.card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 20px;
  margin-bottom: 18px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

.meta-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.component {
  color: #374151;
  font-size: 13px;
  background: #f3f4f6;
  border-radius: 6px;
  padding: 5px 8px;
  overflow-wrap: anywhere;
}

.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 14px;
  margin-top: 16px;
}

.trace-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.trace-card {
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  background: #f9fafb;
  min-width: 0;
}

.section {
  margin-top: 16px;
}

.label {
  color: #6b7280;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .05em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

p {
  margin: 0;
  line-height: 1.6;
  font-size: 14px;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}

.source {
  margin-top: 16px;
  color: #9ca3af;
  font-size: 11px;
  overflow-wrap: anywhere;
}

@media (max-width: 760px) {
  .drawer-toggle {
    top: 10px;
    left: 10px;
  }

  .sidebar-header {
    padding: 14px 16px 10px;
  }

  .sidebar-search {
    padding: 10px 12px;
  }

  .sidebar-list {
    border-top: 1px solid #f3f4f6;
  }

  .risk-item {
    padding: 12px 14px;
  }

  .pane {
    padding: 58px 16px 16px;
  }

  .pane-header {
    gap: 6px 10px;
  }

  .pane-title {
    width: 100%;
    font-size: 20px;
  }

  .pane-empty {
    min-height: 180px;
  }

  .wrap {
    padding: 18px 14px;
  }

  .top {
    display: block;
    margin-bottom: 14px;
  }

  h1 {
    font-size: 22px;
  }

  .card {
    padding: 16px;
    border-radius: 8px;
    margin-bottom: 14px;
  }

  .meta-row {
    display: block;
    margin-bottom: 12px;
  }

  .component {
    display: inline-block;
    margin-top: 10px;
  }

  .grid {
    grid-template-columns: 1fr;
    gap: 12px;
    margin-top: 14px;
  }

  .trace-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-top: 14px;
  }
}

@media (max-width: 420px) {
  .pane {
    padding: 56px 12px 12px;
  }

  .wrap {
    padding: 14px 10px;
  }

  .card {
    padding: 14px;
  }
}
