:root {
  --bg: #f4f6f7;
  --panel: #ffffff;
  --ink: #151a1e;
  --muted: #69747d;
  --line: #dce2e6;
  --line-strong: #c7d0d6;
  --brand: #0f766e;
  --brand-dark: #0b4f4a;
  --accent: #2563eb;
  --green: #157347;
  --amber: #9a6700;
  --red: #b42318;
  --shadow: 0 10px 28px rgba(20, 31, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  background: var(--bg);
}

body {
  margin: 0;
  background:
    linear-gradient(180deg, #eef3f4 0, #f7f8f9 260px, var(--bg) 100%);
  color: var(--ink);
  font-family: "Segoe UI", Inter, Arial, sans-serif;
  font-size: 14px;
}

header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 30px;
  background: rgba(255, 255, 255, 0.88);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 20;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 22px;
  font-weight: 750;
  letter-spacing: 0;
}

h1::before {
  content: "";
  display: inline-block;
  width: 11px;
  height: 11px;
  margin-right: 10px;
  border-radius: 50%;
  background: var(--brand);
  box-shadow: 0 0 0 4px rgba(15, 118, 110, 0.12);
  vertical-align: 1px;
}

.brand-home {
  display: inline-flex;
  min-height: 0;
  border: 0;
  background: transparent;
  color: inherit;
  padding: 0;
}

.brand-home:hover {
  border: 0;
  background: transparent;
}

h2 {
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 700;
}

p,
small {
  color: var(--muted);
}

header p {
  margin-top: 4px;
  font-size: 13px;
}

nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 7px;
}

a,
button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  cursor: pointer;
  font: inherit;
  font-weight: 600;
  padding: 7px 11px;
  text-decoration: none;
  transition: border-color 120ms ease, background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

a:hover,
button:hover {
  border-color: var(--line-strong);
  background: #f8fafb;
}

nav a {
  min-height: 32px;
  border-color: transparent;
  background: transparent;
  color: #38444c;
  font-size: 13px;
}

nav a:hover {
  border-color: var(--line);
  background: #fff;
}

.primary,
button.primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.18);
}

.primary:hover,
button.primary:hover {
  background: var(--brand-dark);
  border-color: var(--brand-dark);
}

.notice {
  margin: 18px 30px 0;
  padding: 12px 14px;
  border: 1px solid #a6d8d1;
  border-radius: 8px;
  background: #eefbf8;
  color: #174f49;
  font-weight: 600;
}

.login-shell {
  min-height: calc(100vh - 92px);
  display: grid;
  place-items: center;
  padding: 30px;
}

.login-card {
  width: min(100%, 420px);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 24px;
}

.login-card h2 {
  margin-bottom: 6px;
  font-size: 20px;
}

.login-card p {
  margin-bottom: 18px;
}

.role-links {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.role-links a {
  flex: 1;
  min-height: 32px;
  font-size: 13px;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 12px;
  padding: 20px 30px 0;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.metric {
  min-height: 88px;
  padding: 15px;
}

.metric b {
  display: block;
  font-size: 29px;
  font-weight: 760;
  line-height: 1;
}

.metric span {
  display: block;
  margin-top: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
}

main {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  padding: 20px 30px;
}

.panel {
  padding: 18px;
}

.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.grid-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.inline-form {
  display: grid;
  gap: 12px;
}

.stacked-action {
  margin-top: 10px;
}

.inline-row {
  display: flex;
  gap: 8px;
  min-width: 230px;
}

label {
  display: grid;
  gap: 7px;
  color: #4b5963;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.wide {
  grid-column: 1 / -1;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  color: var(--ink);
  font: inherit;
  padding: 10px 11px;
  outline: none;
  transition: border-color 120ms ease, background 120ms ease, box-shadow 120ms ease;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.12);
}

textarea {
  min-height: 84px;
  resize: vertical;
}

.table-panel {
  margin: 20px 30px 30px;
  overflow-x: auto;
}

.route-table-panel {
  padding: 0;
}

.route-table-panel .panel-title {
  position: sticky;
  left: 0;
  padding: 16px 18px 10px;
  background: var(--panel);
  z-index: 3;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.compact {
  margin: 0;
}

table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}

th,
td {
  border-top: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  vertical-align: top;
}

th {
  background: #f8fafb;
  color: #5f6c75;
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

tbody tr:hover td {
  background: #fbfdfd;
}

.route-table {
  min-width: 7600px;
  table-layout: fixed;
}

.route-table th,
.route-table td {
  width: 112px;
  max-width: 112px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.route-table th {
  position: sticky;
  top: 0;
  z-index: 2;
}

.route-table th:first-child,
.route-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 4;
  width: 132px;
  max-width: 132px;
  background: #fff;
  box-shadow: 1px 0 0 var(--line);
}

.route-table th:first-child {
  z-index: 5;
  background: #f8fafb;
}

td small {
  display: block;
  margin-top: 4px;
}

code,
pre {
  font-family: "Cascadia Mono", Consolas, monospace;
  font-size: 12px;
}

pre {
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #111718;
  color: #e8f1ef;
  padding: 14px;
}

.steps {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.steps li {
  margin: 8px 0;
}

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 112px;
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 800;
  text-align: center;
  text-transform: capitalize;
}

.submitted,
.ready_for_pickup {
  background: #eef5ff;
  border-color: #cfe2ff;
  color: var(--accent);
}

.picked_up,
.in_transit_to_warehouse {
  background: #fff8e8;
  border-color: #f3deb0;
  color: var(--amber);
}

.in_warehouse {
  background: #eefbf8;
  border-color: #a6d8d1;
  color: var(--brand-dark);
}

.out_for_delivery {
  background: #edf4ff;
  border-color: #b9d3ff;
  color: #1d4ed8;
}

.delivered,
.open {
  background: #eaf8f0;
  border-color: #bce8cf;
  color: var(--green);
}

.exception,
.cancelled,
.rts {
  background: #fff0ef;
  border-color: #f5c3bf;
  color: var(--red);
}

.closed {
  background: #eef2f4;
  border-color: var(--line);
  color: var(--muted);
}

.empty {
  color: var(--muted);
  text-align: center;
}

.portal-shell {
  max-width: 1080px;
  margin: 24px auto 48px;
  padding: 0 20px;
}

.intake-title {
  margin-bottom: 18px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.intake-title h2 {
  margin-bottom: 4px;
  font-size: 20px;
}

.portal-form {
  display: grid;
  gap: 16px;
}

.scan-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #fff;
  box-shadow: var(--shadow);
}

.scan-card label {
  color: #4b5963;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.scan-row {
  display: flex;
  gap: 20px;
  align-items: center;
  max-width: 540px;
}

.scan-row input {
  min-width: 360px;
}

.portal-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 18px;
  box-shadow: var(--shadow);
}

.portal-section h3 {
  margin: 0 0 16px;
  padding-bottom: 9px;
  border-bottom: 2px solid rgba(15, 118, 110, 0.28);
  color: var(--ink);
  font-size: 17px;
  font-weight: 750;
}

.new-location {
  display: inline-flex;
  border: 0;
  background: transparent;
  color: var(--brand);
  font-weight: 700;
  padding: 0;
}

.lookup-row {
  display: grid;
  grid-template-columns: 1fr;
  gap: 9px;
  margin: 0 5px 8px;
}

.lookup-row label,
.location-grid label,
.service-grid label,
.description-grid label {
  display: grid;
  grid-template-columns: 160px 1fr;
  align-items: center;
  gap: 10px;
  color: #4b5963;
  font-size: 12px;
  font-weight: 750;
  text-transform: uppercase;
}

.lookup-row input,
.location-grid input,
.service-grid input,
.service-grid select,
.description-grid input,
.description-grid select {
  height: 31px;
  border-color: var(--line);
  border-radius: 7px;
  background: #fbfcfd;
  padding: 5px 9px;
}

.new-location {
  margin: 4px 0 18px 230px;
  font-size: 18px;
}

.location-grid {
  display: grid;
  grid-template-columns: 1fr 1.35fr;
  gap: 9px 70px;
  margin: 0 5px;
}

.service-grid,
.description-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 42px;
  margin: 0 5px;
}

.service-grid label {
  grid-template-columns: 180px 1fr;
}

.portal-note {
  margin: 12px 5px 0;
  color: var(--muted);
  font-size: 13px;
}

.options-list {
  display: grid;
  gap: 8px;
  margin: 0 5px;
}

.options-list label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #4b5963;
  font-size: 14px;
  font-weight: 650;
  text-transform: none;
}

.options-list input {
  width: 18px;
  height: 18px;
}

.description-grid .wide {
  grid-column: 1 / -1;
  grid-template-columns: 160px 1fr;
  align-items: start;
}

.description-grid textarea {
  min-height: 170px;
  border-radius: 2px;
  background: #fff;
}

.submit-section {
  display: grid;
  gap: 18px;
}

.submit-section button {
  width: 380px;
  min-height: 44px;
  border-color: var(--line);
  border-radius: 7px;
  background: #fff;
  color: var(--ink);
  font-size: 14px;
  font-weight: 700;
  box-shadow: none;
}

.pharmacy-compact {
  max-width: 1320px;
  margin-top: 14px;
  margin-bottom: 32px;
}

.pharmacy-compact .intake-title {
  margin-bottom: 10px;
  padding: 13px 16px;
}

.pharmacy-compact .intake-title p {
  display: none;
}

.pharmacy-compact .portal-form {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 10px;
}

.pharmacy-compact .scan-card,
.pharmacy-compact .description-section,
.pharmacy-compact .submit-section {
  grid-column: 1 / -1;
}

.pharmacy-compact .scan-card,
.pharmacy-compact .portal-section {
  padding: 12px;
}

.pharmacy-compact .scan-card label {
  display: flex;
  align-items: center;
  gap: 14px;
}

.pharmacy-compact .scan-row {
  flex: 1;
  max-width: none;
}

.pharmacy-compact .scan-row input {
  flex: 1;
  min-width: 0;
}

.pharmacy-compact .portal-section h3 {
  margin-bottom: 10px;
  padding-bottom: 6px;
  font-size: 15px;
}

.pharmacy-compact .lookup-row,
.pharmacy-compact .new-location,
.pharmacy-compact .portal-note {
  display: none;
}

.pharmacy-compact .location-grid,
.pharmacy-compact .service-grid,
.pharmacy-compact .description-grid {
  gap: 8px 14px;
  margin: 0;
}

.pharmacy-compact .location-grid {
  grid-template-columns: 1fr;
}

.pharmacy-compact .location-grid label,
.pharmacy-compact .service-grid label,
.pharmacy-compact .description-grid label {
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px;
  font-size: 11px;
}

.pharmacy-compact .service-grid label {
  grid-template-columns: 142px minmax(0, 1fr);
}

.pharmacy-compact .location-grid input,
.pharmacy-compact .service-grid input,
.pharmacy-compact .service-grid select,
.pharmacy-compact .description-grid input,
.pharmacy-compact .description-grid select {
  height: 29px;
  padding: 4px 8px;
}

.pharmacy-compact .options-list {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px 12px;
  margin: 0;
}

.pharmacy-compact .options-list label {
  font-size: 13px;
}

.pharmacy-compact .description-grid textarea {
  min-height: 82px;
}

.pharmacy-compact .submit-section {
  align-items: center;
  grid-template-columns: 1fr auto;
}

.pharmacy-compact .submit-section h3 {
  margin: 0;
  padding: 0;
  border: 0;
}

.pharmacy-compact .submit-section button {
  width: auto;
  min-width: 240px;
}

.pharmacy-compact .submit-section button.primary {
  border-color: transparent;
  background: var(--brand);
  color: #fff;
}

.role-pharmacy {
  background: #f3f4f6;
}

.role-pharmacy header {
  min-height: 48px;
  padding: 8px 14px;
  border-bottom-color: #d6d9de;
}

.role-pharmacy header h1 {
  font-size: 17px;
}

.role-pharmacy header h1::before {
  background: #111;
  box-shadow: 0 0 0 4px rgba(17, 17, 17, 0.1);
}

.role-pharmacy header p,
.role-pharmacy header nav {
  display: none;
}

.pharmacy-order-window {
  width: min(560px, calc(100vw - 24px));
  margin: 12px auto;
  box-sizing: border-box;
}

.pharmacy-mini-tabs {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 6px;
  margin-bottom: 8px;
}

.pharmacy-mini-tabs a {
  min-height: 30px;
  border-color: #d8dde3;
  background: #fff;
  color: #111;
  font-size: 12px;
  font-weight: 800;
  padding: 5px 8px;
}

.compact-order-form {
  border: 1px solid #d8dde3;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 10px 28px rgba(15, 23, 42, 0.08);
  padding: 12px;
}

.compact-brand-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.compact-brand-row img {
  width: 42px;
  height: 42px;
  object-fit: contain;
}

.compact-brand-row h2 {
  margin: 0;
  color: #111;
  font-size: 18px;
  line-height: 1.1;
}

.compact-brand-row p {
  margin-top: 2px;
  font-size: 12px;
}

.compact-panel {
  min-width: 0;
  border: 1px solid #e1e5ea;
  border-radius: 7px;
  background: #fbfcfd;
  padding: 10px;
}

.compact-panel h3 {
  margin: 0 0 8px;
  padding-bottom: 5px;
  border-bottom: 1px solid #e1e5ea;
  color: #111;
  font-size: 13px;
  font-weight: 900;
  letter-spacing: 0;
}

.compact-receipt {
  margin-bottom: 10px;
}

.compact-receipt > label,
.compact-field {
  display: grid;
  min-width: 0;
  gap: 3px;
  color: #4b5563;
  font-size: 11px;
  font-weight: 800;
}

.compact-scan-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 7px;
}

.compact-order-form input,
.compact-order-form select,
.compact-order-form textarea,
.compact-order-form button {
  box-sizing: border-box;
  min-width: 0;
}

.compact-order-form input,
.compact-order-form select {
  width: 100%;
  min-height: 32px;
  border: 1px solid #d8dde3;
  border-radius: 6px;
  background: #fff;
  padding: 5px 8px;
  font-size: 13px;
}

.compact-order-form textarea {
  width: 100%;
  min-height: 70px;
  border: 1px solid #d8dde3;
  border-radius: 6px;
  background: #fff;
  padding: 6px 8px;
  resize: vertical;
  font-size: 13px;
}

.order-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(180px, 0.75fr);
  gap: 10px;
}

.compact-column {
  display: grid;
  min-width: 0;
  align-content: start;
  gap: 10px;
}

.form-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.city-row {
  grid-template-columns: minmax(0, 1.3fr) minmax(54px, 0.55fr) minmax(72px, 0.7fr);
}

.compact-checks {
  display: grid;
  gap: 6px;
  margin-top: 8px;
}

.compact-checks label {
  display: flex;
  align-items: center;
  gap: 7px;
  color: #111;
  font-size: 12px;
  font-weight: 750;
}

.compact-checks input {
  width: 16px;
  height: 16px;
  min-height: 16px;
}

.pickup-summary {
  color: #111;
  line-height: 1.35;
}

.pickup-summary strong,
.pickup-summary span {
  display: block;
  min-height: 16px;
  font-size: 13px;
}

.pickup-summary strong {
  font-size: 14px;
  font-weight: 900;
}

.compact-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.compact-actions button {
  min-height: 34px;
  border-radius: 6px;
  padding: 6px 13px;
}

.compact-actions .primary {
  border-color: #111;
  background: #111;
  color: #fff;
  box-shadow: none;
}

.compact-order-form .lookup-status {
  margin-top: 6px;
  min-height: 18px;
  font-size: 11px;
}

.compact-order-form .delivery-zone-status {
  margin-top: 7px;
  padding: 7px 8px;
  font-size: 11px;
}

.submitted-orders-section {
  margin-top: 18px;
}

.submitted-orders-section .panel-title {
  align-items: flex-start;
  margin-bottom: 14px;
}

.submitted-orders-section .panel-title h3 {
  margin-bottom: 4px;
  padding-bottom: 0;
  border-bottom: 0;
}

.submitted-orders-section .panel-title p {
  font-size: 13px;
}

.submitted-orders-table {
  overflow-x: auto;
}

.submitted-orders-table table {
  min-width: 880px;
}

.submitted-orders-table td,
.submitted-orders-table th {
  white-space: nowrap;
}

.cancel-form {
  margin: 0;
}

.cancel-form button {
  min-height: 30px;
  border-color: #f5c3bf;
  background: #fff0ef;
  color: var(--red);
  font-size: 12px;
}

.muted-action {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.sort-scan-panel form {
  margin-bottom: 16px;
}

.sort-route-card {
  display: grid;
  place-items: center;
  min-height: 170px;
  border: 2px solid #111;
  border-radius: 8px;
  background: #f8fffd;
  text-align: center;
}

.sort-route-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
}

.sort-route-card b {
  display: block;
  margin: 4px 0;
  color: #111;
  font-size: 72px;
  line-height: 0.95;
}

.sort-route-card p {
  color: #111;
  font-size: 18px;
  font-weight: 700;
}

.sort-route-card.denied {
  border-color: var(--red);
  background: #fff5f5;
}

.sort-route-card.denied b {
  color: var(--red);
  font-size: 58px;
}

.route-badges {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
}

.route-badges span {
  display: grid;
  place-items: center;
  min-height: 72px;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  color: #111;
  font-size: 28px;
  font-weight: 850;
}

.map-zone-panel {
  overflow: hidden;
}

.map-zone-form {
  display: grid;
  gap: 14px;
}

.live-map-frame {
  margin: 14px 0 16px;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
}

.live-map-canvas {
  position: relative;
  height: 430px;
}

.live-map-frame iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}

.live-map-overlay {
  position: absolute;
  inset: 0;
  z-index: 2;
  width: 100%;
  height: 100%;
  cursor: crosshair;
  touch-action: none;
}

.map-zoom-controls {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 4;
  display: grid;
  grid-template-columns: 38px 38px auto;
  gap: 6px;
  pointer-events: auto;
}

.map-zoom-controls button {
  min-width: 38px;
  min-height: 38px;
  border: 1px solid rgba(15, 23, 42, 0.24);
  background: rgba(255, 255, 255, 0.95);
  box-shadow: 0 10px 24px rgba(15, 23, 42, 0.12);
  color: #111827;
  font-size: 16px;
  font-weight: 900;
}

.map-zoom-controls button:last-child {
  padding: 0 12px;
  font-size: 12px;
  text-transform: uppercase;
}

.live-map-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  border-top: 1px solid var(--line);
  padding: 10px 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.live-map-footer a {
  white-space: nowrap;
}

.map-zone-controls {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr 0.5fr 1.2fr auto auto auto;
  gap: 10px;
  align-items: end;
}

.map-zone-controls input[type="color"] {
  min-height: 42px;
  padding: 5px;
}

.zone-map-label {
  fill: #111827;
  font-size: 4px;
  font-weight: 900;
  paint-order: stroke;
  stroke: rgba(255, 255, 255, 0.9);
  stroke-width: 0.8px;
}

.zone-swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  margin-right: 8px;
  border: 1px solid rgba(17, 24, 39, 0.18);
  border-radius: 4px;
  vertical-align: -2px;
}

.small-link {
  margin-top: 6px;
  min-height: 28px;
  font-size: 12px;
}

.label-toolbar {
  display: flex;
  justify-content: center;
  gap: 10px;
  padding: 20px 30px 0;
}

.shipping-label {
  width: min(100%, 3.82in);
  height: 5.62in;
  margin: 16px auto 30px;
  border: 1.5px solid #111;
  border-radius: 0;
  background: #fff;
  color: #111;
  padding: 0;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 1.05in 1.35in 0.95in 1fr;
  overflow: hidden;
}

.sb-address-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border-bottom: 1.5px solid #111;
}

.sb-address-box {
  min-height: 0;
  padding: 5px 7px;
  border-right: 1.5px solid #111;
  overflow: hidden;
}

.sb-address-box:last-child {
  border-right: 0;
}

.sb-address-box span,
.label-description span {
  display: block;
  margin-bottom: 3px;
  font-size: 9px;
  font-weight: 900;
  text-transform: uppercase;
}

.sb-ship-to span {
  font-size: 12px;
}

.sb-address-box h3 {
  margin: 0 0 3px;
  font-size: 10px;
  font-weight: 600;
}

.sb-address-box p {
  color: #111;
  font-size: 8.5px;
  line-height: 1.08;
  overflow-wrap: anywhere;
}

.sb-tracking-zone {
  border-bottom: 1.5px solid #111;
  padding: 5px 7px 6px;
  text-align: center;
}

.sb-service-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  align-items: baseline;
  gap: 6px;
  margin-bottom: 3px;
}

.sb-service-row strong {
  font-size: 13px;
  font-weight: 900;
}

.sb-service-row span {
  font-size: 8.5px;
}

.barcode-bars {
  width: 100%;
  height: 0.72in;
  margin: 0 auto 3px;
}

.barcode-svg {
  display: block;
  width: 96%;
  height: 100%;
  margin: 0 auto;
}

.sb-tracking-zone b {
  display: block;
  font-size: 10px;
  font-weight: 500;
}

.sb-brand-zone {
  display: grid;
  grid-template-columns: 1.6fr 0.8fr;
  border-bottom: 1.5px solid #111;
}

.sb-message {
  min-height: 0;
  padding: 4px;
  border-right: 1.5px solid #111;
  text-align: center;
}

.sb-message h2 {
  display: inline-block;
  margin: 0 0 3px;
  border-bottom: 1px solid #111;
  font-family: Georgia, "Times New Roman", serif;
  font-size: 9.5px;
  font-style: italic;
  font-weight: 900;
}

.sb-message p {
  color: #111;
  font-size: 7px;
}

.label-options {
  display: flex;
  justify-content: center;
  gap: 12px;
  margin-top: 3px;
}

.label-options label {
  display: flex;
  align-items: center;
  gap: 5px;
  color: #111;
  font-size: 8.5px;
  font-weight: 500;
  text-transform: none;
}

.print-checkbox {
  display: inline-grid;
  place-items: center;
  width: 9px;
  height: 9px;
  border: 1.5px solid #111;
  background: #fff;
  color: #111;
  font-size: 7px;
  font-weight: 900;
  line-height: 1;
}

.print-checkbox.is-checked::before {
  content: "X";
}

.sb-mark {
  display: grid;
  place-items: center;
  min-height: 0;
}

.sb-mark img {
  display: block;
  width: min(75%, 0.68in);
  max-height: 0.42in;
  object-fit: contain;
}

.sb-bottom-zone {
  display: grid;
  grid-template-columns: 1.05in 1fr;
  min-height: 0;
  overflow: hidden;
}

.qr-block {
  width: 0.78in;
  height: 0.78in;
  margin: 0.1in auto;
  padding: 0;
}

.qr-svg {
  display: block;
  width: 100%;
  height: 100%;
}

.label-description {
  padding: 4px 6px;
  border-left: 1.5px solid #111;
}

.label-description span {
  margin-bottom: 3px;
  font-size: 9px;
  text-transform: none;
}

.label-description p,
.label-description small {
  color: #111;
  font-size: 7px;
}

.label-description p {
  min-height: 1.1in;
}

@media print {
  @page {
    size: 4in 6in;
    margin: 0;
  }

  * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  html,
  body {
    width: 4in;
    height: 6in;
    background: #fff;
    margin: 0;
    padding: 0;
    overflow: hidden;
  }

  header,
  .notice,
  .label-toolbar {
    display: none;
  }

  .shipping-label {
    width: 3.82in;
    height: 5.62in;
    min-height: 0;
    margin: 0.17in auto 0;
    border-radius: 0;
    box-shadow: none;
    border: 1.5px solid #111;
    page-break-inside: avoid;
  }

  .sb-address-box {
    min-height: 0;
    padding: 0.05in 0.07in;
  }

  .sb-address-box h3,
  .sb-address-box p {
    font-size: 6.2pt;
  }

  .sb-ship-to span {
    font-size: 7.5pt;
  }

  .sb-service-row strong {
    font-size: 8.8pt;
  }

  .sb-service-row span {
    font-size: 6.2pt;
  }

  .barcode-bars {
    height: 0.72in;
  }

  .barcode-svg,
  .qr-svg {
    color: #000;
    fill: #000;
  }

  .sb-tracking-zone b,
  .label-options label {
    font-size: 6.6pt;
  }

  .sb-message h2 {
    font-size: 7pt;
  }

  .sb-message p {
    font-size: 5.8pt;
  }

  .sb-mark {
    min-height: 0;
  }

  .sb-mark img {
    display: block;
    max-height: 0.42in;
    max-width: 0.68in;
  }

  .sb-bottom-zone {
    min-height: 0;
    grid-template-columns: 1.05in 1fr;
  }

  .qr-block {
    width: 0.78in;
    height: 0.78in;
  }

  .label-description p,
  .label-description small {
    font-size: 5.8pt;
  }
}

@media (max-width: 500px) {
  .order-grid,
  .form-row,
  .city-row {
    grid-template-columns: 1fr;
  }

  .pharmacy-order-window {
    width: min(100%, calc(100vw - 16px));
    margin: 8px auto;
  }

  .compact-order-form {
    padding: 10px;
  }

  .pharmacy-mini-tabs {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 20px;
  }

  nav {
    justify-content: flex-start;
  }

  main {
    display: block;
    padding: 16px 20px;
  }

  main .panel + .panel {
    margin-top: 14px;
  }

  .metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    padding: 16px 20px 0;
  }

  .table-panel {
    margin: 16px 20px 24px;
  }

  .grid-form {
    grid-template-columns: 1fr;
  }

  .map-zone-controls {
    grid-template-columns: 1fr;
  }

  .live-map-canvas {
    height: 320px;
  }

  .live-map-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  .customer-grid,
  .location-grid,
  .service-grid,
  .description-grid {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .lookup-row label,
  .location-grid label,
  .service-grid label,
  .description-grid label,
  .description-grid .wide {
    grid-template-columns: 1fr;
  }

  .scan-row {
    align-items: stretch;
    flex-direction: column;
  }

.scan-row input,
.submit-section button {
  width: 100%;
  min-width: 0;
}

.lookup-status {
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.delivery-zone-status {
  margin-top: 10px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #f8fafb;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.delivery-zone-status.approved {
  border-color: #9bd8b7;
  background: #effbf3;
  color: var(--green);
}

.delivery-zone-status.out_of_zone,
.delivery-zone-status.not_approved,
.delivery-zone-status.missing_zip {
  border-color: #f5c3bf;
  background: #fff0ef;
  color: var(--red);
}

.submit-section button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
  box-shadow: none;
}

.new-location {
    margin-left: 0;
  }

  .pharmacy-compact .portal-form,
  .pharmacy-compact .submit-section {
    grid-template-columns: 1fr;
  }

  .pharmacy-compact .scan-card label {
    align-items: stretch;
    flex-direction: column;
  }

  .pharmacy-compact .location-grid label,
  .pharmacy-compact .service-grid label,
  .pharmacy-compact .description-grid label,
  .pharmacy-compact .description-grid .wide {
    grid-template-columns: 1fr;
  }

  .pharmacy-compact .options-list {
    grid-template-columns: 1fr;
  }

  .pharmacy-compact .submit-section button {
    width: 100%;
  }
}
