/* ═══════════════════════════════════════════════════════════
   Packet Ready Consulting — Interactive Tools (v3)
   ───────────────────────────────────────────────────────────
   Loaded only on tool pages on top of styles.css (Design System v10).
   Uses Color Option 5 (Cool Steel Gunmetal, Pearl White & Executive Crimson).
   ═══════════════════════════════════════════════════════════ */

.tool-panel {
  background: var(--white);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-xs);
  padding: 28px 30px;
  margin-bottom: 24px;
}

.tool-panel-head {
  margin-bottom: 18px;
}

.tool-panel-head h2 {
  font-size: 1.32rem;
  margin-bottom: 6px;
  color: var(--heading);
}

.tool-panel-head p {
  font-size: 0.92rem;
  color: var(--body);
  line-height: 1.65;
}

.tool-form {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.tool-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: end;
}

@media (max-width: 640px) {
  .tool-row {
    grid-template-columns: 1fr;
  }
}

.tool-hint {
  font-size: 0.8rem;
  color: var(--muted);
  line-height: 1.6;
}

/* Status line */
.tool-status {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--muted);
  padding: 12px 0;
}

.tool-status[data-state="error"] {
  color: var(--warn-fg);
}

.spinner {
  width: 14px;
  height: 14px;
  flex: none;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--cta);
  animation: spin 0.7s linear infinite;
}

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

@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 2s; }
}

/* Verdict */
.verdict {
  border: 1px solid var(--line);
  border-left-width: 4px;
  border-radius: var(--radius);
  background: var(--white);
  padding: 22px 24px;
  margin-bottom: 24px;
}

.verdict-over {
  border-left-color: var(--warn-fg);
  background: var(--warn-bg);
}

.verdict-caution {
  border-left-color: #B45309;
  background: #FFFBEB;
}

.verdict-clear {
  border-left-color: var(--good-fg);
  background: var(--good-bg);
}

.verdict-badge {
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 6px;
  display: block;
}

.verdict-over .verdict-badge {
  color: var(--warn-fg);
}

.verdict-caution .verdict-badge {
  color: #92400E;
}

.verdict-clear .verdict-badge {
  color: var(--good-fg);
}

.verdict h3 {
  font-family: var(--font-display);
  font-size: 1.28rem;
  margin-bottom: 8px;
  line-height: 1.26;
  color: var(--heading);
}

.verdict p {
  font-size: 0.93rem;
  line-height: 1.68;
  color: var(--body);
}

.verdict-meta {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 0.76rem;
  color: var(--muted);
  line-height: 1.85;
}

.verdict-meta strong {
  color: var(--heading);
  font-weight: 600;
}

.measure {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
}

/* Map */
.tool-map {
  height: 440px;
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--paper-2);
  margin-bottom: 12px;
  z-index: 0;
}

@media (max-width: 640px) {
  .tool-map { height: 320px; }
}

.leaflet-container {
  font-family: var(--font-body);
}

.map-pop {
  font-size: 0.82rem;
  line-height: 1.6;
}

.map-pop strong {
  display: block;
  color: var(--heading);
  font-size: 0.88rem;
  margin-bottom: 2px;
}

.map-pop .map-pop-dist {
  font-family: var(--font-mono);
  font-weight: 600;
}

.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  font-size: 0.8rem;
  color: var(--muted);
  margin-bottom: 8px;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  flex: none;
  border: 1.5px solid var(--white);
  box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.25);
}

.dot-counts { background: var(--warn-fg); }
.dot-exempt { background: var(--gray-400); }
.dot-other { background: var(--gray-300); }
.dot-unclear { background: #B45309; }
.dot-site { background: var(--band-bg); }

/* Results table */
.fac-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius);
  background: var(--white);
}

.fac-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.86rem;
  min-width: 660px;
}

.fac-table th {
  text-align: left;
  font-family: var(--font-display);
  font-size: 0.76rem;
  font-weight: 700;
  color: #FFFFFF;
  padding: 12px 14px;
  border-bottom: 1px solid var(--rail-border);
  background: var(--band-bg);
  white-space: nowrap;
}

.fac-table td {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
  color: var(--body);
}

.fac-table tr:last-child td {
  border-bottom: none;
}

.fac-table tr[data-kind="counts"] {
  background: var(--warn-bg);
}

.fac-table .fac-name {
  color: var(--heading);
  font-weight: 600;
}

.fac-table .fac-addr {
  font-size: 0.78rem;
  color: var(--muted);
  margin-top: 2px;
}

.fac-dist {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--heading);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.tag {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}

.tag-counts {
  background: var(--warn-bg);
  color: var(--warn-fg);
  border-color: var(--brass-200);
}

.tag-exempt {
  background: var(--paper-2);
  color: var(--muted);
  border-color: var(--line);
}

.tag-other {
  background: var(--stone-50);
  color: var(--subtle);
  border-color: var(--line);
}

.tag-unclear {
  background: #FFFBEB;
  color: #92400E;
  border-color: #FDE68A;
}

.fac-empty {
  padding: 28px;
  text-align: center;
  color: var(--muted);
  font-size: 0.9rem;
}

/* Caveats & Statutory Extracts */
.caveat-list {
  list-style: none;
  display: grid;
  gap: 14px;
  margin-top: 20px;
}

.caveat-list li {
  padding-left: 22px;
  position: relative;
  font-size: 0.93rem;
  line-height: 1.7;
  color: var(--body);
}

.caveat-list li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.68em;
  width: 12px;
  height: 2px;
  background: var(--cta);
}

.caveat-list strong {
  color: var(--heading);
}

.statute {
  background: var(--white);
  border: 1px solid var(--line);
  border-left: 3px solid var(--cta);
  padding: 20px 24px;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin-top: 20px;
}

.statute p {
  font-size: 0.9rem;
  line-height: 1.74;
  color: var(--body);
  margin-bottom: 12px;
}

.statute p:last-child {
  margin-bottom: 0;
}

.statute .cite {
  font-family: var(--font-mono);
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--cta);
  display: block;
  margin-bottom: 10px;
}

/* Tools index */
.tool-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 18px;
  margin-top: 28px;
}

.tool-card {
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  padding: 26px;
  display: flex;
  flex-direction: column;
  transition: border-color 0.16s var(--ease);
}

.tool-card:hover {
  border-color: var(--strong-border);
}

.tool-card h3 {
  font-size: 1.16rem;
  margin-bottom: 8px;
  line-height: 1.3;
  color: var(--heading);
}

.tool-card h3 a {
  color: var(--heading);
}

.tool-card h3 a:hover {
  color: var(--cta);
}

.tool-card p {
  font-size: 0.9rem;
  color: var(--body);
  line-height: 1.65;
  flex: 1;
  margin-bottom: 16px;
}

.tool-card .tool-state {
  font-family: var(--font-display);
  font-size: 0.72rem;
  font-weight: 700;
  margin-bottom: 10px;
  display: inline-block;
  align-self: flex-start;
  padding: 3px 9px;
  border-radius: 4px;
  border: 1px solid var(--line);
  background: var(--canvas-bg);
}

.tool-card[data-state="live"] .tool-state {
  color: var(--good-fg);
  background: var(--good-bg);
  border-color: var(--green-100);
}

.tool-card[data-state="planned"] .tool-state {
  color: var(--muted);
}

.tool-card[data-state="planned"] {
  background: var(--stone-50);
  border-style: dashed;
}

.tool-card[data-state="planned"] h3 {
  color: var(--muted);
}
