/* ============================================================
   Codex — styles.css
   ============================================================ */

/* ── Reset & Base ────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
  font-size: 15px;
  color: #1a2030;
  background: #f4f6fa;
  -webkit-font-smoothing: antialiased;
}

/* ── Layout ──────────────────────────────────────────────── */
#app { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

/* ── Header ──────────────────────────────────────────────── */
#header {
  display: flex;
  align-items: center;
  gap: 16px;
  height: 62px;
  padding: 0 20px;
  background: #162035;
  box-shadow: 0 2px 10px rgba(0,0,0,0.35);
  flex-shrink: 0;
  z-index: 200;
}

#menu-btn {
  display: none;
  background: none;
  border: none;
  color: #a0b8d8;
  font-size: 22px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  line-height: 1;
  flex-shrink: 0;
}
#menu-btn:hover { background: rgba(255,255,255,0.08); color: white; }

#logo {
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  line-height: 1.1;
}
.logo-main {
  font-size: 23px;
  font-weight: 700;
  letter-spacing: 1.5px;
  color: #d4a828;
}
.logo-sub {
  font-size: 12px;
  color: #6a88b0;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

/* ── Mode tabs ───────────────────────────────────────── */
#mode-tabs {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}
.mode-tab {
  padding: 9px 20px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.12);
  background: transparent;
  color: #6a88b0;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  letter-spacing: 1px;
  text-transform: uppercase;
  font-family: inherit;
  white-space: nowrap;
}
.mode-tab:hover { background: rgba(255,255,255,0.07); color: #9ab8d8; }
.mode-tab.active {
  background: #d4a828;
  color: #162035;
  border-color: #d4a828;
}

#search-container {
  flex: 1;
  max-width: 520px;
  position: relative;
  display: flex;
  align-items: center;
}
.search-icon {
  position: absolute;
  left: 12px;
  width: 16px;
  height: 16px;
  color: rgba(255,255,255,0.35);
  pointer-events: none;
}
#search-input {
  width: 100%;
  padding: 9px 36px 9px 36px;
  border-radius: 7px;
  border: 1px solid rgba(255,255,255,0.1);
  background: rgba(255,255,255,0.1);
  color: white;
  font-size: 14px;
  outline: none;
  transition: background 0.2s, border-color 0.2s;
}
#search-input::placeholder { color: rgba(255,255,255,0.35); }
#search-input:focus {
  background: rgba(255,255,255,0.16);
  border-color: rgba(212,168,40,0.5);
}
#clear-btn {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  color: rgba(255,255,255,0.35);
  cursor: pointer;
  font-size: 13px;
  display: none;
  padding: 4px;
  border-radius: 3px;
  line-height: 1;
}
#clear-btn:hover { color: white; background: rgba(255,255,255,0.1); }
#clear-btn.visible { display: block; }

/* ── Main layout ─────────────────────────────────────────── */
#main {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* ── Sidebar ─────────────────────────────────────────────── */
#sidebar {
  width: 295px;
  background: #1c2b3e;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
  overflow: hidden;
  transition: transform 0.25s ease;
}

#sidebar-header {
  padding: 13px 16px 11px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: #4a6888;
  border-bottom: 1px solid rgba(255,255,255,0.06);
  flex-shrink: 0;
}

#topic-tree {
  overflow-y: auto;
  flex: 1;
  padding-bottom: 24px;
}
#topic-tree::-webkit-scrollbar { width: 4px; }
#topic-tree::-webkit-scrollbar-track { background: transparent; }
#topic-tree::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
}

/* Topic groups */
.topic-header {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  cursor: pointer;
  user-select: none;
  transition: background 0.12s;
  border-left: 3px solid transparent;
}
.topic-header:hover { background: rgba(255,255,255,0.05); }

.topic-arrow {
  font-size: 8px;
  color: #3a5878;
  flex-shrink: 0;
  width: 10px;
  text-align: center;
  transition: color 0.15s;
}
.topic-group.open .topic-arrow { color: #7090b0; }
.topic-name {
  flex: 1;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.3px;
  color: #8aaac8;
  text-transform: uppercase;
}
.topic-group.open .topic-name { color: #aac8e8; }
.topic-count {
  font-size: 12px;
  color: #3a5570;
  background: rgba(255,255,255,0.05);
  padding: 1px 6px;
  border-radius: 10px;
  flex-shrink: 0;
}

/* Subtopics */
.subtopic-list { display: none; padding: 2px 0; }

.subtopic-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 14px 7px 30px;
  font-size: 14px;
  color: #6a8aaa;
  cursor: pointer;
  transition: background 0.12s, color 0.12s;
  border-left: 3px solid transparent;
}
.subtopic-item:hover {
  background: rgba(255,255,255,0.05);
  color: #a0c0e0;
}
.subtopic-item.active {
  background: rgba(212,168,40,0.12);
  color: #d4a828;
  border-left-color: #d4a828;
}
.subtopic-item.all-subtopic {
  color: #5a7898;
  font-style: italic;
}
.subtopic-item.all-subtopic:hover { color: #8aaac8; }
.subtopic-item.all-subtopic.active { color: #d4a828; }

.st-count {
  font-size: 12.5px;
  color: #3a5270;
  flex-shrink: 0;
}
.subtopic-item.active .st-count { color: #a07820; }

/* ── Content area ────────────────────────────────────────── */
#content {
  flex: 1;
  overflow-y: auto;
  padding: 24px 28px;
}
#content::-webkit-scrollbar { width: 6px; }
#content::-webkit-scrollbar-track { background: transparent; }
#content::-webkit-scrollbar-thumb {
  background: #c8d0e0;
  border-radius: 3px;
}

/* ── Loading / error ─────────────────────────────────────── */
.loading-state, .error-state {
  text-align: center;
  padding: 80px 20px;
  color: #8090a8;
  font-size: 14px;
}
.error-state { color: #c0392b; }

/* ── Welcome ─────────────────────────────────────────────── */
.welcome {
  max-width: 440px;
  margin: 70px auto;
  text-align: center;
}
.welcome-logo {
  font-size: 44px;
  font-weight: 800;
  color: #162035;
  letter-spacing: 2px;
}
.welcome-tagline {
  font-size: 14px;
  color: #6a7a98;
  margin-top: 6px;
  margin-bottom: 36px;
}
.welcome-stats {
  display: flex;
  gap: 16px;
  justify-content: center;
  margin-bottom: 28px;
}
.stat {
  background: white;
  border-radius: 12px;
  padding: 18px 28px;
  box-shadow: 0 2px 12px rgba(0,0,0,0.07);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 110px;
}
.stat-num {
  font-size: 36px;
  font-weight: 800;
  color: #162035;
  line-height: 1;
}
.stat-label {
  font-size: 11px;
  color: #8090a8;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 6px;
}
.welcome-hint {
  color: #9090a8;
  font-size: 13px;
  line-height: 1.6;
}

/* ── List view ───────────────────────────────────────────── */
.list-header {
  display: flex;
  align-items: baseline;
  gap: 12px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.list-header h2 {
  font-size: 17px;
  font-weight: 700;
  color: #1a2030;
}
.count-badge {
  font-size: 12px;
  color: #6a7a9a;
  background: #e0e4ef;
  padding: 2px 10px;
  border-radius: 10px;
  flex-shrink: 0;
}

.arg-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.arg-card {
  background: white;
  border-radius: 8px;
  padding: 13px 16px;
  cursor: pointer;
  border: 1px solid #dde2ee;
  transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
}
.arg-card:hover {
  box-shadow: -3px 0 0 #d4a828, 0 4px 18px rgba(0,0,0,0.09);
  transform: translateY(-1px);
  border-color: #b8c8e0;
}

.arg-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 5px;
}
.arg-id {
  font-size: 11.5px;
  font-weight: 700;
  color: #a07820;
  background: #fdf5df;
  padding: 2px 8px;
  border-radius: 4px;
}
.arg-date {
  font-size: 11px;
  color: #a0a8b8;
}
.arg-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a2030;
  line-height: 1.4;
  margin-bottom: 4px;
}
.arg-meta {
  font-size: 11.5px;
  color: #7080a0;
  margin-bottom: 5px;
}
.arg-cite-preview {
  font-size: 11.5px;
  color: #8090a8;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #8090a8;
  font-size: 14px;
}

/* ── Detail view ─────────────────────────────────────────── */
.detail-view { max-width: 820px; margin: 0 auto; }

.detail-nav {
  display: flex;
  gap: 8px;
  margin-bottom: 18px;
  align-items: center;
}

.btn {
  padding: 7px 15px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  border: none;
  font-family: inherit;
}
.btn-back {
  background: white;
  color: #3a4a6a;
  border: 1px solid #c8d4e8;
}
.btn-back:hover { background: #eef2f8; }

.btn-copy {
  background: #162035;
  color: white;
}
.btn-copy:hover { background: #243250; }
.btn-copy.copied { background: #1e6e42; }

.btn-print {
  background: white;
  color: #3a4a6a;
  border: 1px solid #c8d4e8;
}
.btn-print:hover { background: #eef2f8; }

.detail-header {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 14px;
  border: 1px solid #dde2ee;
}
.detail-meta-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.detail-id {
  font-size: 12px;
  font-weight: 700;
  color: #a07820;
  background: #fdf5df;
  padding: 3px 10px;
  border-radius: 4px;
}
.detail-topic {
  font-size: 12.5px;
  color: #5a6a88;
}
.detail-date {
  font-size: 11.5px;
  color: #9098b0;
  margin-left: auto;
}
.detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a2030;
  line-height: 1.35;
}

.detail-citations {
  background: #f2f5fb;
  border-radius: 8px;
  padding: 14px 18px;
  margin-bottom: 14px;
  border-left: 3px solid #162035;
}
.detail-citations h3 {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5a6a88;
  margin-bottom: 9px;
  font-weight: 700;
}
.detail-citations ul { list-style: none; }
.detail-citations li {
  font-size: 13px;
  color: #2a3a58;
  line-height: 1.45;
  padding: 2px 0;
  padding-left: 14px;
  position: relative;
}
.detail-citations li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: #d4a828;
  font-weight: 700;
}

.detail-body {
  background: white;
  border-radius: 10px;
  padding: 26px 30px;
  border: 1px solid #dde2ee;
  line-height: 1.8;
}
.detail-body p {
  font-size: 14.5px;
  color: #1a2030;
  margin-bottom: 14px;
}
.detail-body p:last-child { margin-bottom: 0; }

/* ── Mobile overlay ──────────────────────────────────────── */
#overlay {
  display: none;
  position: fixed;
  inset: 62px 0 0 0;
  background: rgba(0,0,0,0.45);
  z-index: 150;
}
#overlay.visible { display: block; }

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 768px) {
  #menu-btn { display: block; }

  /* Header: wrap to two rows — logo row + tabs/search row */
  #header {
    flex-wrap: wrap;
    height: auto;
    padding: 8px 12px;
    row-gap: 6px;
  }
  .logo-sub { display: none; }
  #logo { flex: 1; }
  #mode-tabs {
    order: 3;
    flex-basis: 100%;
    justify-content: center;
    gap: 6px;
  }
  .mode-tab {
    flex: 1;
    text-align: center;
    font-size: 13px;
    padding: 8px 6px;
  }
  #search-container {
    order: 4;
    flex-basis: 100%;
    max-width: 100%;
  }

  #sidebar {
    position: fixed;
    top: 120px;
    left: 0;
    bottom: 0;
    z-index: 190;
    transform: translateX(-100%);
  }
  #sidebar.open { transform: translateX(0); }

  #content { padding: 16px; }

  .detail-view { max-width: 100%; }
  .detail-body { padding: 18px 20px; }
  .detail-title { font-size: 17px; }
  .detail-date { margin-left: 0; }

  .welcome { margin: 40px auto; }
  .welcome-logo { font-size: 36px; }

  /* Modal: scrollable, compact padding */
  .modal-box {
    max-height: 88dvh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 24px 22px;
    border-radius: 14px;
  }
  .modal-logo { font-size: 30px; }
  .modal-subtitle { margin-bottom: 14px; }
  .modal-bullets { gap: 7px; margin-bottom: 18px; }
  .modal-bullets li { font-size: 13px; }
}

/* ── Highlighted matches ─────────────────────────────────── */
mark {
  background: #fff3c0;
  color: inherit;
  border-radius: 2px;
  padding: 0 1px;
  font-style: normal;
}

/* ── Search history dropdown ─────────────────────────────── */
#search-container { position: relative; }

#search-dropdown {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  background: white;
  border-radius: 9px;
  box-shadow: 0 8px 28px rgba(0,0,0,0.22);
  overflow: hidden;
  z-index: 400;
}
#search-dropdown.visible { display: block; }

.dd-header {
  padding: 8px 14px 6px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1.3px;
  color: #8090a8;
  border-bottom: 1px solid #eef0f6;
}
.dd-item {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 14px;
  cursor: pointer;
  transition: background 0.1s;
}
.dd-item:hover { background: #f5f7fc; }
.dd-icon { font-size: 12px; flex-shrink: 0; color: #a0b0c8; }
.dd-text { flex: 1; font-size: 13.5px; color: #2a3a5a; }
.dd-remove {
  background: none;
  border: none;
  color: #b8c0d0;
  cursor: pointer;
  font-size: 11px;
  padding: 3px 5px;
  border-radius: 3px;
  opacity: 0;
  transition: opacity 0.15s, color 0.15s, background 0.15s;
  line-height: 1;
  font-family: inherit;
}
.dd-item:hover .dd-remove { opacity: 1; }
.dd-remove:hover { color: #c0392b; background: #fdecea; }

/* ── Welcome modal ───────────────────────────────────────── */
#welcome-modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
}
.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(12,20,38,0.7);
  transition: opacity 0.25s;
}
.modal-box {
  position: relative;
  background: white;
  border-radius: 14px;
  padding: 36px 40px;
  max-width: 500px;
  width: 92%;
  box-shadow: 0 24px 64px rgba(0,0,0,0.35);
  transition: transform 0.25s, opacity 0.25s;
}
#welcome-modal.closing .modal-backdrop { opacity: 0; }
#welcome-modal.closing .modal-box { transform: scale(0.94); opacity: 0; }

.modal-logo {
  font-size: 38px;
  font-weight: 800;
  color: #162035;
  letter-spacing: 2px;
  margin-bottom: 3px;
}
.modal-subtitle {
  font-size: 12.5px;
  color: #7080a0;
  margin-bottom: 22px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.modal-bullets {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 26px;
}
.modal-bullets li {
  font-size: 14px;
  color: #2a3a5a;
  line-height: 1.45;
  padding-left: 18px;
  position: relative;
}
.modal-bullets li::before {
  content: "›";
  position: absolute;
  left: 0;
  color: #d4a828;
  font-weight: 700;
  font-size: 16px;
  line-height: 1.3;
}
.modal-disclaimer {
  font-size: 12px;
  color: #8090b0;
  line-height: 1.5;
  margin-bottom: 20px;
  font-style: italic;
}

.modal-btn {
  width: 100%;
  padding: 12px;
  background: #162035;
  color: white;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s;
  font-family: inherit;
  letter-spacing: 0.3px;
}
.modal-btn:hover { background: #243250; }

/* ── CALCRIM instruction cards ───────────────────────── */
.calcrim-card {
  background: white;
  border-radius: 8px;
  padding: 13px 16px;
  cursor: pointer;
  border: 1px solid #dde2ee;
  transition: box-shadow 0.15s, transform 0.1s, border-color 0.15s;
  margin-bottom: 8px;
}
.calcrim-card:hover {
  box-shadow: -3px 0 0 #2a6096, 0 4px 18px rgba(0,0,0,0.09);
  transform: translateY(-1px);
  border-color: #b8c8e0;
}
.calcrim-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 5px;
  flex-wrap: wrap;
}
.calcrim-num {
  font-size: 11.5px;
  font-weight: 700;
  color: #2a6096;
  background: #e8f0fa;
  padding: 2px 8px;
  border-radius: 4px;
}
.calcrim-pc {
  font-size: 11px;
  color: #7a8aa8;
  background: #f0f2f8;
  padding: 2px 7px;
  border-radius: 4px;
}
.calcrim-series-badge {
  font-size: 11px;
  color: #7a8aa8;
  margin-left: auto;
}
.calcrim-card-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #1a2030;
  line-height: 1.4;
  margin-bottom: 5px;
}
.calcrim-preview-el {
  font-size: 12px;
  color: #6a7a98;
  font-style: italic;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ── CALCRIM detail view ─────────────────────────────── */
.calcrim-detail { max-width: 820px; margin: 0 auto; }

.calcrim-detail-header {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 14px;
  border: 1px solid #dde2ee;
}
.calcrim-detail-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.calcrim-detail-num {
  font-size: 13px;
  font-weight: 700;
  color: #2a6096;
  background: #e8f0fa;
  padding: 3px 10px;
  border-radius: 4px;
}
.calcrim-detail-series {
  font-size: 12.5px;
  color: #5a6a88;
}
.calcrim-detail-date {
  font-size: 11.5px;
  color: #9098b0;
  margin-left: auto;
}
.calcrim-detail-title {
  font-size: 20px;
  font-weight: 700;
  color: #1a2030;
  line-height: 1.35;
}
.calcrim-pc-row {
  margin-top: 8px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.calcrim-pc-tag {
  font-size: 11.5px;
  color: #3a5a88;
  background: #eef3fc;
  border: 1px solid #c8d8f0;
  padding: 2px 9px;
  border-radius: 12px;
}
.calcrim-section {
  background: white;
  border-radius: 10px;
  padding: 20px 24px;
  margin-bottom: 14px;
  border: 1px solid #dde2ee;
}
.calcrim-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: #5a6a88;
  font-weight: 700;
  margin-bottom: 14px;
}
.calcrim-elements {
  list-style: none;
  counter-reset: el-counter;
}
.calcrim-elements li {
  counter-increment: el-counter;
  font-size: 14.5px;
  color: #1a2030;
  line-height: 1.65;
  margin-bottom: 12px;
  padding-left: 30px;
  position: relative;
}
.calcrim-elements li:last-child { margin-bottom: 0; }
.calcrim-elements li::before {
  content: counter(el-counter);
  position: absolute;
  left: 0;
  top: 2px;
  width: 20px;
  height: 20px;
  background: #2a6096;
  color: white;
  border-radius: 50%;
  font-size: 10px;
  font-weight: 700;
  text-align: center;
  line-height: 20px;
}
.calcrim-defs { list-style: none; }
.calcrim-defs li {
  font-size: 13.5px;
  color: #1a2030;
  line-height: 1.55;
  padding: 8px 0;
  border-bottom: 1px solid #eef0f6;
}
.calcrim-defs li:last-child { border-bottom: none; padding-bottom: 0; }
.calcrim-defs .def-term {
  font-weight: 700;
  color: #2a4a78;
}
.calcrim-related {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.calcrim-related-btn {
  padding: 4px 12px;
  border-radius: 5px;
  border: 1px solid #c8d8f0;
  background: #eef3fc;
  color: #2a6096;
  font-size: 12.5px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.12s, border-color 0.12s;
}
.calcrim-related-btn:hover { background: #d8e8f8; border-color: #a8c0e8; }

/* ── Sentencing Calculator ───────────────────────────────── */

/* Full-width mode — hide sidebar */
#main.sentencing-mode #sidebar  { display: none !important; }
#main.sentencing-mode #content  { padding: 28px 32px; }

/* v2 calculator container */
.sent-calc-v2 { max-width: 740px; margin: 0 auto; }

/* Section hint inline label */
.sent-section-hint {
  font-size: 10px; font-weight: 400; text-transform: none;
  letter-spacing: 0; color: #8090b0; margin-left: 8px;
}

/* Crime select dropdown */
.sent-select-row {
  display: flex; align-items: center; gap: 12px;
}
.sent-crime-select {
  flex: 1;
  padding: 10px 14px;
  border: 1px solid #c8d8ec;
  border-radius: 8px;
  font-size: 14px;
  font-family: inherit;
  color: #1a2030;
  background: white;
  outline: none;
  cursor: pointer;
  min-width: 0;
}
.sent-crime-select:focus  { border-color: #2a6096; box-shadow: 0 0 0 3px rgba(42,96,150,0.1); }
.sent-crime-select:disabled { background: #f0f4f8; color: #8090a8; cursor: default; }

/* Base term badge next to select */
.sent-base-term {
  font-size: 14px; font-weight: 700; color: #2a6096;
  white-space: nowrap; flex-shrink: 0;
  background: #edf3fb; padding: 7px 14px;
  border-radius: 7px; border: 1px solid #b8d0ec;
}

/* Notes line under base select */
.sent-base-note {
  margin-top: 8px;
  font-size: 12px; color: #7080a0; font-style: italic;
  line-height: 1.45;
}

/* Subordinate count rows */
.sent-sub-rows { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.sent-sub-row {
  display: flex; align-items: center; gap: 10px;
  background: #f5f8fc; border: 1px solid #dde6f0;
  border-radius: 8px; padding: 10px 14px;
}
.sent-sub-name { flex: 1; font-size: 13.5px; font-weight: 600; color: #1a2a40; }
.sent-sub-pc   { font-size: 12px; color: #6a88b0; flex-shrink: 0; }
.sent-sub-term { font-size: 13px; font-weight: 600; color: #2a6096; flex-shrink: 0; }

/* Add subordinate select row */
.sent-add-sub-row { margin-top: 2px; }

/* Welcome screen */
.sent-welcome { max-width: 480px; margin: 60px auto; text-align: center; padding: 0 20px; }
.sent-welcome-logo { font-size: 42px; font-weight: 800; color: #162035; letter-spacing: 2px; margin-bottom: 6px; }
.sent-welcome-sub { font-size: 13px; color: #7080a0; text-transform: uppercase; letter-spacing: 0.5px; margin-bottom: 28px; }
.sent-welcome-rule { background: #f0f4f8; border-radius: 10px; padding: 18px 22px; margin-bottom: 24px; text-align: left; }
.sent-welcome-rule h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #4a6888; margin: 0 0 10px; }
.sent-welcome-rule ul { margin: 0; padding: 0 0 0 16px; }
.sent-welcome-rule li { font-size: 13.5px; color: #2a3a5a; margin-bottom: 5px; line-height: 1.4; }
.sent-welcome-hint { font-size: 13px; color: #8090b0; }

/* Calculator layout */
.sent-calc { max-width: 860px; margin: 0 auto; padding: 24px 24px 40px; }

/* Section headers */
.sent-section { margin-bottom: 22px; }
.sent-section-title {
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 1.5px; color: #4a6888;
  border-left: 3px solid #d4a828; padding-left: 10px; margin-bottom: 12px;
}

/* Count rows */
.sent-counts { display: flex; flex-direction: column; gap: 8px; margin-bottom: 10px; }
.sent-count-row {
  display: flex; align-items: center; gap: 10px;
  background: #f5f8fc; border: 1px solid #dde6f0;
  border-radius: 8px; padding: 10px 14px;
}
.sent-count-row.base-count { border-color: #b8ccec; background: #edf3fb; }
.sent-count-badge {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.8px; padding: 3px 7px; border-radius: 4px; flex-shrink: 0;
}
.sent-count-badge.base { background: #162035; color: #d4a828; }
.sent-count-badge.sub  { background: #e0e8f0; color: #4a6888; }
.sent-count-name { flex: 1; font-size: 14px; font-weight: 600; color: #1a2a40; }
.sent-count-pc   { font-size: 12px; color: #6a88b0; flex-shrink: 0; }
.sent-count-term { font-size: 13px; font-weight: 600; color: #2a6096; flex-shrink: 0; min-width: 80px; text-align: right; }
.sent-count-remove {
  background: none; border: none; color: #b0bcd0; cursor: pointer;
  font-size: 16px; padding: 2px 4px; border-radius: 4px; flex-shrink: 0;
  transition: color 0.15s;
}
.sent-count-remove:hover { color: #c0392b; }
.sent-add-count {
  font-size: 13px; color: #2a6096; background: none; border: 1px dashed #a8c0e0;
  border-radius: 7px; padding: 7px 14px; cursor: pointer; width: 100%;
  transition: background 0.15s, border-color 0.15s; font-family: inherit;
}
.sent-add-count:hover { background: #edf3fb; border-color: #7090c0; }

/* Crime picker modal */
.sent-picker-backdrop {
  position: fixed; inset: 0; background: rgba(12,20,38,0.55);
  z-index: 800; display: flex; align-items: center; justify-content: center;
}
.sent-picker-box {
  background: white; border-radius: 12px; padding: 24px;
  width: 92%; max-width: 500px; max-height: 80vh;
  display: flex; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.sent-picker-title { font-size: 15px; font-weight: 700; color: #162035; margin-bottom: 12px; }
.sent-picker-search {
  width: 100%; padding: 9px 14px; border: 1px solid #c8d8ec;
  border-radius: 7px; font-size: 14px; outline: none; margin-bottom: 12px;
  font-family: inherit; box-sizing: border-box;
}
.sent-picker-search:focus { border-color: #2a6096; }
.sent-picker-list { overflow-y: auto; flex: 1; }
.sent-picker-category { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #8090b0; padding: 10px 4px 4px; }
.sent-picker-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 9px 8px; border-radius: 6px; cursor: pointer;
  transition: background 0.12s;
}
.sent-picker-item:hover { background: #f0f5fb; }
.sent-picker-item-name { font-size: 13.5px; color: #1a2a40; }
.sent-picker-item-pc   { font-size: 12px; color: #6a88b0; }
.sent-picker-item-term { font-size: 12px; color: #2a6096; font-weight: 600; min-width: 70px; text-align: right; }
.sent-picker-cancel { margin-top: 12px; width: 100%; padding: 9px; background: #f0f4f8; border: none; border-radius: 7px; font-size: 14px; cursor: pointer; font-family: inherit; color: #4a6888; }
.sent-picker-cancel:hover { background: #e0e8f0; }

/* Strikes */
.sent-strikes { display: flex; gap: 8px; }
.sent-strike-btn {
  flex: 1; padding: 9px 6px; border-radius: 7px;
  border: 1px solid #dde6f0; background: #f5f8fc;
  font-size: 13px; font-weight: 600; color: #4a6888;
  cursor: pointer; transition: all 0.15s; font-family: inherit; text-align: center;
}
.sent-strike-btn:hover { background: #edf3fb; border-color: #a8c0e0; }
.sent-strike-btn.active { background: #162035; color: #d4a828; border-color: #162035; }

/* Enhancements */
.sent-enhancements { display: flex; flex-direction: column; gap: 6px; }
.sent-enhancement-row {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 12px; border-radius: 7px; border: 1px solid #e8f0f8;
  cursor: pointer; transition: background 0.12s;
}
.sent-enhancement-row:hover { background: #f5f9ff; }
.sent-enhancement-row.checked { background: #edf3fb; border-color: #b8ccec; }
.sent-enhancement-cb { width: 16px; height: 16px; accent-color: #2a6096; flex-shrink: 0; cursor: pointer; }
.sent-enhancement-label { flex: 1; font-size: 13.5px; color: #2a3a5a; }
.sent-enhancement-value { font-size: 13px; font-weight: 600; color: #2a6096; flex-shrink: 0; }
.sent-enhancement-count { font-size: 12px; color: #6a88b0; display: flex; align-items: center; gap: 4px; }
.sent-enhancement-count input { width: 36px; padding: 2px 4px; border: 1px solid #c8d8ec; border-radius: 4px; font-size: 12px; text-align: center; font-family: inherit; }
.sent-no-enhancements { font-size: 13px; color: #8090b0; font-style: italic; padding: 6px 0; }

/* Total panel */
.sent-total-panel {
  background: #162035; border-radius: 10px; padding: 20px 22px; margin-top: 24px;
  border-top: 3px solid #d4a828;
  box-shadow: inset 0 1px 0 rgba(212,168,40,0.12), 0 4px 20px rgba(0,0,0,0.15);
}
.sent-total-rows { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.sent-total-row { display: flex; justify-content: space-between; font-size: 14px; color: #7090b8; }
.sent-total-row.base-row { color: #c8e0f8; font-weight: 700; font-size: 16px; }
.sent-total-row.enhancement-row { color: #8090b0; font-size: 13.5px; }
.sent-total-divider { border: none; border-top: 1px solid rgba(255,255,255,0.1); margin: 10px 0; }
.sent-total-result { display: flex; justify-content: space-between; align-items: baseline; }
.sent-total-label { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: #5a7898; }
.sent-total-value { font-size: 26px; font-weight: 800; color: #d4a828; }
.sent-total-value.indeterminate { font-size: 20px; }

/* Disclaimer */
.sent-disclaimer {
  font-size: 11.5px; color: #5a7898; font-style: italic;
  margin-top: 16px; line-height: 1.5; text-align: center;
  padding: 0 10px;
}
.sent-page-disclaimer {
  margin-top: 32px;
  padding: 14px 18px;
  background: #f5f7fa;
  border: 1px solid #dde4ee;
  border-radius: 8px;
  font-size: 11.5px;
  color: #5a6a80;
  line-height: 1.6;
  font-style: italic;
}

/* Responsive */
@media (max-width: 768px) {
  .sent-calc { padding: 16px; }
  .sent-count-pc { display: none; }
  .sent-strikes { gap: 6px; }
  .sent-total-value { font-size: 18px; }

  /* Sentencing — mobile layout */
  #main.sentencing-mode #content { padding: 16px 14px; }
  .sent-calc-v2 { max-width: 100%; }

  /* Base select row: stack badge below dropdown */
  .sent-select-row { flex-wrap: wrap; }
  .sent-crime-select { width: 100%; min-width: 0; }
  .sent-base-term { margin-top: 4px; }

  /* Subordinate rows: stack name/term, hide pc code */
  .sent-sub-row { flex-wrap: wrap; gap: 6px; }
  .sent-sub-pc { display: none; }
  .sent-sub-name { flex-basis: 100%; }
  .sent-sub-term { font-size: 12px; }

  /* Strikes: full-width buttons, larger tap target */
  .sent-strikes { flex-direction: column; gap: 6px; }
  .sent-strike-btn { padding: 12px 10px; font-size: 14px; }

  /* Enhancements */
  .sent-enhancement-label { font-size: 13px; }
  .sent-enhancement-value { font-size: 12px; }

  /* Total panel */
  .sent-total-panel { padding: 16px; }
  .sent-total-value { font-size: 20px; }

  /* Page disclaimer */
  .sent-page-disclaimer { font-size: 11px; padding: 12px 14px; }
}

/* ── Version tag ─────────────────────────────────────────── */
#version-tag {
  position: fixed;
  top: 20px;
  right: 16px;
  font-size: 10px;
  color: rgba(255,255,255,0.28);
  letter-spacing: 0.5px;
  pointer-events: none;
  z-index: 250;
  font-family: inherit;
}

/* ── Print ───────────────────────────────────────────────── */
@media print {
  #header, #sidebar, .detail-nav, #overlay { display: none !important; }
  #main { display: block; }
  #content { padding: 0; overflow: visible; }
  .detail-view { max-width: 100%; }
  .detail-header,
  .detail-citations,
  .detail-body {
    border: none;
    box-shadow: none;
    border-radius: 0;
    background: none;
    padding-left: 0;
    padding-right: 0;
    border-left: none;
  }
  .detail-body p { font-size: 11pt; line-height: 1.65; }
  .detail-title { font-size: 14pt; }
  .detail-citations li { font-size: 10pt; }
}

/* ── Paywall ──────────────────────────────────────────────── */
#paywall {
  position: fixed; inset: 0; z-index: 9999;
  background: #162035;
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.paywall-box {
  text-align: center; max-width: 340px; width: 100%;
}
.paywall-logo {
  font-size: 2.4rem; font-weight: 700; color: #d4a828; letter-spacing: 2px;
  margin-bottom: 4px;
}
.paywall-tagline {
  font-size: 0.85rem; color: rgba(255,255,255,0.5); text-transform: uppercase;
  letter-spacing: 1.5px; margin-bottom: 32px;
}
.paywall-desc {
  color: rgba(255,255,255,0.8); font-size: 0.95rem; line-height: 1.6;
  margin-bottom: 32px;
}
.paywall-price {
  font-size: 3rem; font-weight: 700; color: #fff; margin-bottom: 24px;
}
.paywall-price span { font-size: 1.1rem; color: rgba(255,255,255,0.5); }
#subscribe-btn {
  width: 100%; padding: 16px; background: #d4a828; color: #162035;
  border: none; border-radius: 8px; font-size: 1rem; font-weight: 700;
  cursor: pointer; margin-bottom: 16px; letter-spacing: 0.3px;
}
#subscribe-btn:active { opacity: 0.85; }
.paywall-footer {
  font-size: 0.78rem; color: rgba(255,255,255,0.35);
}
