:root {
  --ink: #17211d;
  --muted: #647069;
  --line: #dfe5e1;
  --canvas: #f3f6f4;
  --panel: #ffffff;
  --green: #0b6b4f;
  --green-dark: #064d39;
  --green-soft: #e4f2ec;
  --blue: #1559a6;
  --amber: #b86800;
  --red: #b53a31;
  --apple-red: #ff3b30;
  --apple-orange: #ff9500;
  --apple-yellow: #ffcc00;
  --apple-green: #34c759;
  --apple-mint: #00c7be;
  --apple-teal: #30b0c7;
  --apple-blue: #007aff;
  --apple-purple: #af52de;
  --apple-pink: #ff2d55;
  --apple-brown: #a2845e;
  --apple-gray: #8e8e93;
  --shadow: 0 12px 28px rgba(23, 33, 29, .08);
  --radius: 14px;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body { background: var(--canvas); font-size: 14px; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button:focus-visible, a:focus-visible, input:focus-visible, select:focus-visible { outline: 3px solid rgba(21, 89, 166, .28); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; clip: rect(0,0,0,0); overflow: hidden; white-space: nowrap; border: 0; }
.app-header { height: 68px; padding: 0 24px; display: flex; align-items: center; gap: 32px; background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 30; }
.brand { display: flex; align-items: center; gap: 11px; min-width: 250px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 38px; height: 38px; display: inline-grid; place-items: center; border-radius: 10px; color: #fff; background: var(--green); font-size: 12px; font-weight: 850; letter-spacing: .06em; box-shadow: inset 0 0 0 1px rgba(255,255,255,.2); }
.brand-mark.large { width: 54px; height: 54px; border-radius: 14px; font-size: 15px; }
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); margin-top: 2px; font-size: 11px; letter-spacing: .04em; text-transform: uppercase; }
.primary-nav { display: flex; height: 100%; gap: 6px; align-items: stretch; }
.primary-nav a { display: grid; place-items: center; padding: 0 13px; color: #536059; font-weight: 650; border-bottom: 3px solid transparent; }
.primary-nav a:hover { color: var(--ink); text-decoration: none; background: #f8faf9; }
.primary-nav a.active { color: var(--green); border-bottom-color: var(--green); }
.user-menu { margin-left: auto; display: flex; align-items: center; gap: 12px; color: var(--muted); }
.user-menu form { margin: 0; }
.page-shell { max-width: 1420px; margin: 0 auto; padding: 34px 36px 64px; }
.page-heading { margin-bottom: 26px; }
.split-heading { display: flex; align-items: flex-end; justify-content: space-between; gap: 24px; }
.page-heading h1 { margin: 3px 0 7px; font-size: clamp(30px, 4vw, 44px); letter-spacing: -.035em; line-height: 1; }
.eyebrow { margin: 0; color: var(--green); text-transform: uppercase; letter-spacing: .11em; font-size: 11px; font-weight: 800; }
.lede { margin: 0; color: var(--muted); font-size: 16px; }
.back-link { display: inline-block; margin-bottom: 22px; font-weight: 700; }
.button-row { display: flex; gap: 10px; }
.button-group { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 10px; }
.primary-button, .secondary-button, .quiet-button, .icon-button, .map-tool { border: 0; cursor: pointer; font-weight: 750; border-radius: 9px; display: inline-flex; align-items: center; justify-content: center; min-height: 40px; padding: 0 16px; }
.primary-button { background: var(--green); color: white; box-shadow: 0 5px 12px rgba(11,107,79,.2); }
.primary-button:hover { background: var(--green-dark); text-decoration: none; }
.secondary-button { color: var(--green); background: #fff; border: 1px solid #b8c9c1; }
.secondary-button:hover { border-color: var(--green); text-decoration: none; }
.secondary-button.compact { min-height: 34px; padding: 0 12px; }
.quiet-button { background: transparent; color: var(--muted); padding: 0 8px; }
.quiet-button:hover { color: var(--ink); background: #eef2ef; }
.icon-button { width: 40px; padding: 0; border-radius: 50%; color: #fff; background: var(--green); font-size: 24px; }
.kpi-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
.kpi-card { min-height: 148px; background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; display: flex; flex-direction: column; position: relative; overflow: hidden; }
.kpi-card::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: #87948d; }
.kpi-card.success::before { background: var(--green); }
.kpi-card.warning::before { background: var(--amber); }
.kpi-card.danger::before { background: var(--red); }
.kpi-card span { color: var(--muted); font-weight: 700; }
.kpi-card strong { font-size: 40px; line-height: 1; letter-spacing: -.04em; margin: 18px 0 10px; }
.kpi-card small { color: var(--muted); margin-top: auto; }
.dashboard-grid { display: grid; grid-template-columns: 1.45fr .8fr; gap: 18px; margin-bottom: 18px; }
.dashboard-grid.three-up { grid-template-columns: repeat(3, 1fr); }
.compact-metrics { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.compact-metrics > div { display: flex; justify-content: space-between; gap: 8px; padding: 9px 10px; border-radius: 8px; background: #f7faf8; color: var(--muted); }
.compact-metrics strong { color: var(--ink); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 0 rgba(23,33,29,.02); padding: 22px; }
.panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 18px; margin-bottom: 20px; }
.panel-heading h2 { margin: 4px 0 0; font-size: 19px; letter-spacing: -.015em; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 150px 1fr 35px; gap: 12px; align-items: center; font-size: 12px; }
.bar-row span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: #435048; font-weight: 650; }
.bar-track { height: 8px; border-radius: 9px; background: #edf1ee; overflow: hidden; }
.bar-track i { display: block; height: 100%; background: var(--green); min-width: 3px; border-radius: inherit; }
.bar-track i[data-status="SUB FOR INSPECT"] { background: var(--apple-yellow); }
.bar-track i[data-status="INSPECTED"] { background: var(--apple-green); }
.bar-track i[data-status="READY TO NOTIFY"] { background: var(--apple-blue); }
.bar-track i[data-status="NOTIF SENT"] { background: var(--apple-orange); }
.bar-track i[data-status="READY TO TRANSMIT"] { background: var(--apple-purple); }
.bar-track i[data-status="SUB FOR INSTALL"] { background: var(--apple-teal); }
.bar-track i[data-status="INSTALLED"] { background: #30d158; }
.bar-track i[data-status="ON HOLD"] { background: var(--apple-brown); }
.bar-track i[data-status="DENIED"] { background: var(--apple-red); }
.bar-track i[data-status="ARCHIVED"] { background: var(--apple-gray); }
.bar-track i[data-status="SUB FOR REMOVAL"] { background: var(--apple-pink); }
.bar-track i[data-status="REMOVED"] { background: #636366; }
.bar-row strong { text-align: right; }
.borough-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 10px; }
.borough-grid > div { display: flex; align-items: center; gap: 12px; border: 1px solid var(--line); background: #f9fbfa; border-radius: 10px; padding: 12px; }
.borough-grid strong { font-size: 20px; }
.borough-code { display: inline-grid; place-items: center; flex: 0 0 auto; min-width: 38px; height: 32px; padding: 0 8px; background: var(--green-soft); color: var(--green); border-radius: 8px; font-weight: 850; }
.table-panel { padding: 0; overflow: hidden; }
.table-panel > .panel-heading { padding: 22px 22px 0; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th { text-align: left; color: var(--muted); background: #f8faf9; text-transform: uppercase; letter-spacing: .06em; font-size: 10px; }
th, td { border-top: 1px solid var(--line); padding: 13px 18px; vertical-align: middle; }
td small { display: block; color: var(--muted); margin-top: 3px; }
tbody tr:hover { background: #fbfcfb; }
.status-pill { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; background: #eef2ef; color: #4e5b54; padding: 0 9px; font-size: 10px; font-weight: 850; letter-spacing: .025em; white-space: nowrap; }
.status-pill.large { min-height: 34px; padding: 0 14px; font-size: 12px; }
.status-pill[data-status="SUB FOR INSPECT"] { color: #7a5b00; background: #fff4bf; }
.status-pill[data-status="INSPECTED"] { color: #176b32; background: #dcf8e4; }
.status-pill[data-status="READY TO NOTIFY"] { color: #005bb5; background: #dceeff; }
.status-pill[data-status="NOTIF SENT"] { color: #9a4b00; background: #ffead1; }
.status-pill[data-status="READY TO TRANSMIT"] { color: #71308f; background: #f2dcfb; }
.status-pill[data-status="SUB FOR INSTALL"] { color: #086d78; background: #d5f5f5; }
.status-pill[data-status="INSTALLED"] { color: #176b32; background: #d8f7df; }
.status-pill[data-status="ON HOLD"] { color: #72532f; background: #f3e8d8; }
.status-pill[data-status="DENIED"] { color: #a51d16; background: #ffe0de; }
.status-pill[data-status="ARCHIVED"] { color: #545459; background: #e9e9ed; }
.status-pill[data-status="SUB FOR REMOVAL"] { color: #b3133c; background: #ffe0e7; }
.status-pill[data-status="REMOVED"] { color: #545459; background: #e9e9ed; }
.empty-state { color: var(--muted); text-align: center; padding: 26px; }
.alert { border-radius: 10px; padding: 13px 15px; margin: 12px 0; display: grid; gap: 4px; }
.alert.error { color: #852d27; background: #fce8e6; border: 1px solid #f0c3be; }
.alert.warning { color: #664700; background: #fff5d9; border: 1px solid #f2dfa9; }
.alert.success { color: var(--green-dark); background: #e1f2e9; border: 1px solid #bcdcca; }
.login-body { min-height: 100vh; display: grid; place-items: center; background: var(--canvas); padding: 24px; }
.login-card { width: min(430px, 100%); background: #fff; border: 1px solid var(--line); border-radius: 20px; box-shadow: var(--shadow); padding: 36px; }
.login-card h1 { font-size: 32px; letter-spacing: -.03em; margin: 8px 0; }
.login-card .brand-mark { margin-bottom: 25px; }
.muted, .privacy-note { color: var(--muted); }
.privacy-note { font-size: 11px; margin: 24px 0 0; padding-top: 18px; border-top: 1px solid var(--line); }
.stacked-form { display: grid; gap: 15px; margin-top: 25px; }
.stacked-form label, .filter-form label { display: grid; gap: 6px; font-size: 11px; font-weight: 800; color: #536059; text-transform: uppercase; letter-spacing: .04em; }
input, select, textarea { width: 100%; min-height: 40px; border: 1px solid #cbd4cf; border-radius: 8px; background: #fff; color: var(--ink); padding: 0 11px; }
input::placeholder { color: #96a19b; }
.map-shell { height: calc(100vh - 68px); display: grid; grid-template-columns: 350px 1fr auto; overflow: hidden; }
.map-sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; z-index: 5; }
.map-sidebar-header { display: flex; justify-content: space-between; align-items: center; padding: 22px 20px 14px; }
.map-sidebar-header h1 { margin: 4px 0 0; font-size: 24px; letter-spacing: -.03em; }
.filter-form { padding: 0 20px 15px; border-bottom: 1px solid var(--line); display: grid; gap: 11px; }
.filter-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.filter-form details { border-top: 1px solid var(--line); padding-top: 10px; }
.filter-form summary { color: var(--green); font-size: 12px; font-weight: 750; cursor: pointer; margin-bottom: 10px; }
.check-row { display: flex; gap: 15px; margin-top: 10px; }
.check-row label { display: flex; flex-direction: row; align-items: center; gap: 6px; text-transform: none; }
.check-row input { min-height: 0; width: auto; }
.overlay-controls { display: grid; gap: 8px; }
.overlay-controls label { display: flex; flex-direction: row; align-items: center; gap: 7px; text-transform: none; }
.overlay-controls input { width: auto; min-height: 0; }
.result-heading { padding: 14px 20px 10px; display: flex; justify-content: space-between; gap: 10px; align-items: end; }
.result-heading span { color: var(--muted); font-size: 10px; }
.zone-results { min-height: 0; overflow-y: auto; padding: 0 9px 16px; }
.zone-result { display: grid; gap: 5px; width: 100%; padding: 12px; border: 1px solid transparent; border-bottom-color: var(--line); background: #fff; text-align: left; cursor: pointer; border-radius: 8px; }
.zone-result:hover { background: #f6faf8; border-color: #cfe2d9; }
.zone-result > div { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.zone-result p { margin: 0; font-weight: 700; }
.zone-result small { color: var(--muted); }
.map-stage { position: relative; min-width: 0; background: #e8ece9; }
#map { position: absolute; inset: 0; }
.map-tools { position: absolute; top: 14px; left: 14px; right: 14px; z-index: 3; display: flex; gap: 7px; align-items: flex-start; flex-wrap: wrap; }
.map-tool { background: rgba(255,255,255,.96); color: var(--ink); box-shadow: 0 2px 10px rgba(23,33,29,.14); }
.map-tool input { min-height: 0; width: auto; margin-right: 6px; }
.map-legend { display: flex; flex: 1 1 520px; gap: 8px 12px; align-items: center; flex-wrap: wrap; padding: 9px 13px; border-radius: 9px; background: rgba(255,255,255,.96); box-shadow: 0 2px 10px rgba(23,33,29,.14); color: var(--muted); font-size: 11px; font-weight: 700; }
.map-legend span { display: inline-flex; align-items: center; gap: 5px; white-space: nowrap; }
.map-legend i { display: inline-block; width: 18px; height: 0; border-top: 4px solid var(--apple-gray); }
.map-legend span[data-status="SUB FOR INSPECT"] i { border-top-color: var(--apple-yellow); }
.map-legend span[data-status="INSPECTED"] i { border-top-color: var(--apple-green); }
.map-legend span[data-status="READY TO NOTIFY"] i { border-top-color: var(--apple-blue); }
.map-legend span[data-status="NOTIF SENT"] i { border-top-color: var(--apple-orange); }
.map-legend span[data-status="READY TO TRANSMIT"] i { border-top-color: var(--apple-purple); }
.map-legend span[data-status="SUB FOR INSTALL"] i { border-top-color: var(--apple-teal); }
.map-legend span[data-status="INSTALLED"] i { border-top-color: #30d158; }
.map-legend span[data-status="ON HOLD"] i { border-top-color: var(--apple-brown); }
.map-legend span[data-status="DENIED"] i { border-top-color: var(--apple-red); }
.map-legend span[data-status="ARCHIVED"] i { border-top-color: var(--apple-gray); }
.map-legend span[data-status="SUB FOR REMOVAL"] i { border-top-color: var(--apple-pink); }
.map-legend span[data-status="REMOVED"] i { border-top-color: #636366; }
.map-legend .pending-key i { border-top-color: #d97706; border-top-style: dashed; }
.map-notice { position: absolute; bottom: 25px; left: 50%; transform: translateX(-50%); background: rgba(23,33,29,.88); color: white; padding: 8px 12px; border-radius: 8px; font-size: 11px; pointer-events: none; }
.detail-drawer { width: 355px; background: #fff; border-left: 1px solid var(--line); overflow-y: auto; padding: 22px; }
.detail-drawer h2 { margin: 6px 0; font-size: 26px; }
.drawer-section { border-top: 1px solid var(--line); margin-top: 18px; padding-top: 16px; }
.drawer-section h3 { font-size: 12px; text-transform: uppercase; color: var(--muted); letter-spacing: .07em; }
.drawer-list { display: grid; gap: 8px; }
.drawer-list div { display: flex; justify-content: space-between; gap: 12px; }
.drawer-approve { width: 100%; margin-top: 14px; }
.drawer-form { display: grid; gap: 12px; margin-top: 20px; }
.drawer-form label, .record-grid label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: .04em; }
.drawer-form textarea, .record-grid textarea { padding: 10px 11px; min-height: 92px; resize: vertical; text-transform: none; }
.review-summary { display: flex; gap: 10px; margin-bottom: 18px; overflow-x: auto; }
.review-summary div { min-width: 125px; background: #fff; border: 1px solid var(--line); padding: 14px; border-radius: 11px; display: grid; gap: 4px; }
.review-summary strong { font-size: 22px; }
.review-summary span { color: var(--muted); font-size: 10px; text-transform: uppercase; }
.review-reason { color: #784f00; background: #fff3d0; padding: 6px 8px; border-radius: 7px; font-weight: 700; }
.code-cell { max-width: 380px; color: var(--muted); font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; }
.detail-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 18px; }
.workflow-panel { margin-bottom: 18px; }
.workflow-panel form { display: grid; grid-template-columns: minmax(220px, 1fr) auto minmax(220px, 1fr) auto 1fr; gap: 12px; align-items: end; }
.workflow-panel label { display: grid; gap: 6px; color: var(--muted); font-size: 11px; font-weight: 800; text-transform: uppercase; }
.full-span { grid-column: 1 / -1; }
.segment-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.segment-list li { display: grid; grid-template-columns: 30px 90px 1fr auto; gap: 9px; align-items: center; padding: 10px; background: #f8faf9; border-radius: 9px; }
.segment-list li > span { width: 26px; height: 26px; display: grid; place-items: center; background: var(--green-soft); color: var(--green); border-radius: 50%; font-weight: 800; }
.segment-list small { color: var(--muted); }
.segment-list em { font-style: normal; font-size: 10px; font-weight: 800; color: var(--green); }
.notification-list { display: grid; gap: 10px; }
.notification-list > div { display: flex; gap: 11px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.notification-list p { margin: 0; }
.notification-list strong, .notification-list small { display: block; }
.notification-list small { color: var(--muted); margin-top: 3px; }
.notification-form { margin-left: auto; display: grid; grid-template-columns: 135px 1fr 150px auto; gap: 7px; align-items: center; }
.notification-form input { min-width: 0; }
.notification-result { color: var(--green); font-size: 11px; font-weight: 700; }
.record-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; margin: 0; }
.record-grid div { padding: 12px 0; border-bottom: 1px solid var(--line); }
.record-grid dt { color: var(--muted); font-size: 10px; text-transform: uppercase; letter-spacing: .06em; font-weight: 750; }
.record-grid dd { margin: 6px 0 0; font-weight: 700; }
.notes-block { margin-top: 16px; padding: 15px; border-radius: 10px; background: #f8faf9; }
.notes-block p { margin-bottom: 0; color: #47534c; }
.sync-drop { text-align: center; padding: 38px; margin-bottom: 18px; border-style: dashed; }
.upload-icon { display: grid; place-items: center; margin: 0 auto 12px; width: 46px; height: 46px; border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: 22px; }
.sync-drop h2 { margin: 6px 0; }
.sync-drop p { color: var(--muted); }
.sync-drop form { display: flex; justify-content: center; gap: 10px; margin-top: 18px; }
.sync-drop input { width: auto; padding: 8px; }
@media (max-width: 1050px) {
  .primary-nav { display: none; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .dashboard-grid, .detail-grid { grid-template-columns: 1fr; }
  .full-span { grid-column: auto; }
  .map-shell { grid-template-columns: 320px 1fr; }
  .detail-drawer { position: absolute; right: 0; top: 68px; bottom: 0; z-index: 20; box-shadow: var(--shadow); }
}
@media (max-width: 720px) {
  .app-header { padding: 0 14px; }
  .brand { min-width: 0; }
  .brand small, .user-menu > span { display: none; }
  .page-shell { padding: 24px 16px 50px; }
  .split-heading { align-items: flex-start; flex-direction: column; }
  .kpi-grid { grid-template-columns: 1fr; }
  .map-shell { height: auto; min-height: calc(100vh - 68px); display: block; overflow: visible; }
  .map-sidebar { min-height: 520px; }
  .map-stage { height: 70vh; }
  .detail-drawer { position: fixed; left: 12px; right: 12px; bottom: 12px; top: 100px; width: auto; border-radius: 15px; }
  .record-grid { grid-template-columns: repeat(2, 1fr); }
}
