/* crime.css
   Styles for the Hamilton Counted Crime dashboard (CrimeDashboard.razor).
   Reference this ONCE from the host page (wwwroot/index.html, App.razor or _Host.cshtml) as a
   GLOBAL stylesheet. Do not convert it to Blazor scoped CSS (CrimeDashboard.razor.css): the charts,
   tables, legends and findings are injected into the DOM by JavaScript at runtime, and scoped-CSS
   attributes would not reach them. */

  :root{
    --green:#386858; --green-d:#2b4f43; --orange:#c9772f; --dorange:#8a4f1e;
    --grey:#a9b7b1; --grey-d:#6f7f78; --tint:#fbeee1; --teal:#2f6f7a;
    --ink:#233029; --line:#d9e0dc; --bg:#f4f6f5; --card:#ffffff;
  }
  *{box-sizing:border-box}
  body{
    margin:0; background:var(--bg); color:var(--ink);
    font-family:Arial,Helvetica,sans-serif;
    line-height:1.5;
  }
  .topbar{position:sticky;top:0;z-index:50;box-shadow:0 2px 6px rgba(0,0,0,.12)}   /* header + view tabs stay fixed at the top while scrolling */
  header{background:var(--green);color:#fff;padding:10px 28px;line-height:1.45;display:flex;align-items:center;justify-content:space-between;gap:16px}
  .viewTabs{line-height:1.45}
  header h1{margin:0;font-size:26px;font-weight:700}
  @media (max-width:560px){ header h1{font-size:22px} }
  header .wordmark{display:block; height:20px; width:auto; margin:0}
  @media (max-width:420px){ header{padding:10px 16px} header .wordmark{height:15px} }
  /* narrow screens: one scrollable row of view tabs so the fixed bar stays short */
  @media (max-width:760px){ .viewTabs{flex-wrap:nowrap!important;overflow-x:auto;padding:0 8px!important;scrollbar-width:thin} .viewTabs button{white-space:nowrap;flex:0 0 auto} }
  .viewTabs{display:flex;flex-wrap:wrap;gap:4px;background:var(--green-d);padding:0 28px}
  .viewTabs button{appearance:none;background:transparent;border:0;color:#dfeae6;padding:13px 18px;font-size:16px;font-weight:600;
    font-family:inherit;cursor:pointer;border-bottom:3px solid transparent}
  .viewTabs button:hover{color:#fff}
  .viewTabs button.active{color:#fff;border-bottom-color:#fff;background:rgba(255,255,255,.08)}
  .viewTabs button:focus-visible{outline:3px solid var(--orange); outline-offset:-3px}
  .wrap{max-width:1080px; margin:0 auto; padding:22px 28px 60px}
  .card{background:var(--card); border:1px solid var(--line); border-radius:10px; padding:20px 22px; margin-bottom:20px}
  .controls{display:flex; align-items:flex-end; gap:16px; flex-wrap:wrap; margin-bottom:6px}
  .controls>.foot{padding-bottom:9px}
  .seg{display:inline-flex; border:1px solid var(--green); border-radius:8px; overflow:hidden}
  .seg button{
    appearance:none; border:0; background:#fff; color:var(--green);
    font-size:15.5px; font-weight:600; padding:10px 17px; cursor:pointer;
  }
  .seg button+button{border-left:1px solid var(--green)}
  .seg button.active{background:var(--green); color:#fff}
  .seg button:focus-visible{outline:3px solid var(--orange); outline-offset:2px}
  .field{display:flex; flex-direction:column; gap:4px}
  .field label{font-size:12.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey-d); font-weight:700}
  select{
    appearance:none; border:1px solid var(--line); border-radius:8px; background:#fff;
    color:var(--ink); font-size:15.5px; font-weight:600; padding:9px 32px 9px 12px; cursor:pointer;
    background-image:url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'><path fill='%23386858' d='M5.5 7.5l4.5 4.5 4.5-4.5z'/></svg>");
    background-repeat:no-repeat; background-position:right 10px center; background-size:14px;
  }
  select:focus-visible{outline:3px solid var(--orange); outline-offset:1px}
  .muniPicker{display:flex; flex-direction:column; gap:8px; margin:14px 0 4px}
  .muniPicker .label{font-size:12.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey-d); font-weight:700}
  .chips{display:flex; flex-wrap:wrap; gap:8px; align-items:center}
  .chip{
    display:inline-flex; align-items:center; gap:8px; background:var(--tint); color:var(--dorange);
    border:1px solid #ecc7a2; border-radius:999px; padding:7px 9px 7px 15px; font-size:14.5px; font-weight:700;
  }
  .chip button{
    appearance:none; border:0; background:#fff; color:var(--dorange); border-radius:50%;
    width:20px; height:20px; line-height:1; cursor:pointer; font-size:13px; font-weight:700;
    display:inline-flex; align-items:center; justify-content:center;
  }
  .chip button:disabled{opacity:.35; cursor:not-allowed}
  .chip button:focus-visible{outline:3px solid var(--orange); outline-offset:2px}
  .addRow{display:flex; align-items:center; gap:8px; flex-wrap:wrap}
  .addRow select{max-width:280px}
  .addBtn{
    appearance:none; border:1px solid var(--green); background:var(--green); color:#fff; border-radius:8px;
    font-size:14.5px; font-weight:700; padding:9px 15px; cursor:pointer;
  }
  .addBtn:disabled{opacity:.4; cursor:not-allowed; border-color:var(--grey)}
  .toggleBtn[aria-pressed="true"]{background:var(--green-d); border-color:var(--green-d); color:#fff}
  .addBtn:focus-visible{outline:3px solid var(--orange); outline-offset:2px}
  .capNote{font-size:13.5px; color:#7a857e}
  .legend{display:flex; gap:18px; flex-wrap:wrap; align-items:center; margin:14px 0 4px; font-size:14.5px}
  .legend .item{display:inline-flex; align-items:center; gap:7px; color:#3a4a42}
  .swatch{width:16px; height:16px; border-radius:3px; display:inline-block}
  .chartbox{position:relative}
  svg{display:block; width:100%; height:auto}
  .axis-title{font-size:15px; fill:#5a675f; font-weight:700}
  .tick text{font-size:14px; fill:#6a766e; font-weight:700}
  .tick line{stroke:var(--line)}
  .bar{opacity:1; transition:opacity .12s}
  .bar.dim{opacity:.28}
  .barlabel{font-size:13px; fill:#33473d; font-weight:700}
  .muni{font-size:14px; fill:#4a564e; font-weight:700}
  .popline{font-size:12px; fill:#7a8781; font-weight:600}
  .axisline{stroke:var(--ink); stroke-width:2}
  .hit{fill:transparent; cursor:pointer}
  .hit.hl{fill:#000; opacity:.035}
  .tooltip{
    position:absolute; pointer-events:none; z-index:5; background:#fff;
    border:1px solid var(--green); border-radius:8px; padding:9px 11px;
    font-size:13.5px; color:var(--ink); box-shadow:0 6px 18px rgba(0,0,0,.12);
    min-width:150px; opacity:0; transition:opacity .1s;
  }
  .tooltip h4{margin:0 0 6px; font-size:14.5px; color:var(--green-d)}
  .tooltip .row{display:flex; justify-content:space-between; gap:14px}
  .tooltip .row span:first-child{color:#5a675f}
  .tooltip .row b{font-variant-numeric:tabular-nums}
  table{border-collapse:collapse; width:100%; font-size:14.5px; font-variant-numeric:tabular-nums}
  caption{text-align:left; font-size:13.5px; color:#5a675f; padding:0 0 8px}
  th,td{padding:7px 10px; text-align:right; border-bottom:1px solid var(--line)}
  th:first-child,td:first-child{text-align:left}
  thead th{background:#eef3f0; color:var(--green-d); font-weight:700; border-bottom:2px solid var(--green)}
  tbody tr:last-child td{border-bottom:1px solid var(--line)}
  td .pct{color:#7a857e; font-size:12.5px; margin-left:9px}
  h2.sec{font-size:18px; color:var(--green-d); margin:2px 0 10px}
  h2.sec.bigHeading{font-size:24px}
  .resGroup{margin-top:22px}
  .resGroup:first-of-type{margin-top:6px}
  .resGroup h3{
    font-size:13.5px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey-d);
    font-weight:700; margin:0 0 10px;
  }
  .resList{display:flex; flex-direction:column; gap:10px}
  .resItem{
    display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:6px 20px;
    border:1px solid var(--line); border-left:4px solid var(--green); border-radius:8px;
    padding:12px 16px; background:#fff;
  }
  .resItem .name{font-weight:700; font-size:16.5px; color:var(--ink)}
  .resItem .when{display:block; font-size:14px; font-weight:400; color:#6f7f78; margin-top:3px}
  .resItem .tel{
    font-size:20px; font-weight:700; color:var(--green-d); text-decoration:none; white-space:nowrap;
  }
  .resItem .tel:hover{text-decoration:underline}
  .resItem .tel:focus-visible{outline:3px solid var(--orange); outline-offset:2px}
  .resNote{font-size:14.5px; color:#3a4a42; margin:10px 0 0}
  .notes{font-size:14.5px; color:#3a4a42}
  .notes ul{margin:6px 0 0; padding-left:18px}
  .notes li{margin:5px 0}
  .foot{font-size:13.5px; color:#7a857e; margin-top:8px}
  code{background:#eef3f0; padding:1px 5px; border-radius:4px; font-size:13px}
  /* ---- Key Findings view ---- */
  .alertF{
    display:flex; gap:10px; align-items:flex-start;
    background:var(--tint); border:1px solid #ecc7a2; border-left:5px solid var(--orange);
    border-radius:8px; padding:11px 14px; margin:14px 0 4px; font-size:14px; color:#5c3d1c;
  }
  .alertF b{color:var(--dorange)}
  .kpis{display:grid; grid-template-columns:repeat(4,1fr); gap:12px; margin:16px 0 6px}
  .kpi{background:#f7faf8; border:1px solid var(--line); border-top:4px solid var(--green); border-radius:9px; padding:12px 14px}
  .kpi .k{font-size:12px; letter-spacing:.06em; text-transform:uppercase; color:var(--grey-d); font-weight:700; line-height:1.35}
  .kpi .v{font-size:29px; font-weight:800; letter-spacing:-.02em; margin-top:5px; font-variant-numeric:tabular-nums; color:var(--green-d)}
  .kpi .s{font-size:13px; color:#6a766e; margin-top:2px}
  .kpi.down{border-top-color:var(--green)} .kpi.down .v{color:var(--green-d)}
  .kpi.up{border-top-color:var(--orange)} .kpi.up .v{color:var(--dorange)}
  .kpi.flat{border-top-color:var(--grey)} .kpi.flat .v{color:var(--grey-d)}
  .findings{margin-top:18px; display:flex; flex-direction:column; gap:12px}
  .finding{border-left:4px solid var(--green); background:#f7faf8; border-radius:0 8px 8px 0; padding:11px 15px}
  .finding h3{margin:0 0 4px; font-size:16px; color:var(--green-d); font-weight:700}
  .finding p{margin:0; font-size:14.5px; color:#3a4a42}
  .finding.watch{border-left-color:var(--orange); background:var(--tint)}
  .finding.watch h3{color:var(--dorange)}
  .topicSeg{flex-wrap:wrap}
  td.neg{color:var(--green-d); font-weight:700}
  td.pos{color:var(--dorange); font-weight:700}
  td.sub{padding-left:32px; color:#4a564e}   /* subset rows (non-fatal shootings under aggravated assault) */
  @media (max-width:820px){ .kpis{grid-template-columns:repeat(2,1fr)} }
  @media (max-width:560px){
    .wrap{padding:16px 12px 48px}
    .card{padding:16px 14px}
    th,td{padding:6px 6px; font-size:13px}
  }
