:root {
  --bg: #f3f5f7;
  --panel: #ffffff;
  --ink: #4a4a4a;
  --muted: #6f7478;
  --line: #e3e7ea;
  --brand: #18b24b;
  --brand-strong: #109238;
  --sun: #f7bd36;
  --blue: #2e9be6;
  --red: #be3d2f;
  --amber: #b7791f;
  --shadow: 0 16px 40px rgba(23, 33, 29, 0.12);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--bg);
}

button,
textarea,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  min-height: 100vh;
  max-width: 720px;
  margin: 0 auto;
  background:
    linear-gradient(180deg, rgba(24, 178, 75, 0.09), transparent 260px),
    var(--bg);
  position: relative;
  padding-bottom: calc(86px + env(safe-area-inset-bottom));
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 10px;
  padding: calc(12px + env(safe-area-inset-top)) 16px 12px;
  background: rgba(255, 255, 255, 0.94);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(223, 231, 226, 0.8);
}

.eyebrow {
  margin: 0;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 700;
}

.brand-lockup {
  min-width: 0;
  text-align: center;
}

.brand-lockup img {
  display: block;
  width: min(220px, 72vw);
  height: auto;
  margin: 0 auto 20px;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.2;
}

h2 {
  font-size: 20px;
  margin-bottom: 10px;
}

h3 {
  font-size: 17px;
  margin-bottom: 4px;
}

.icon-button,
.avatar-button,
.primary-icon {
  width: 44px;
  height: 44px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  display: grid;
  place-items: center;
}

.avatar-button {
  background: #2f3234;
  color: #fff;
  border: none;
  font-weight: 800;
}

.icon-lines,
.icon-lines::before,
.icon-lines::after {
  width: 20px;
  height: 2px;
  border-radius: 2px;
  background: var(--ink);
  display: block;
}

.icon-lines {
  position: relative;
}

.icon-lines::before,
.icon-lines::after {
  content: "";
  position: absolute;
  left: 0;
}

.icon-lines::before {
  top: -7px;
}

.icon-lines::after {
  top: 7px;
}

main {
  padding: 16px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.status-strip {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 18px;
}

.status-strip div {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px 12px;
  box-shadow: 0 8px 24px rgba(23, 33, 29, 0.06);
}

.status-strip strong {
  display: block;
  font-size: 24px;
}

.status-strip span,
.job-card p,
.timeline-item p,
.check-row p,
.scan-panel p,
.return-item p,
.assistant-panel p {
  color: var(--muted);
}

.section-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin: 10px 0;
}

.section-heading.compact {
  margin-top: 22px;
}

.text-button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font-weight: 700;
}

.job-card,
.attention-row,
.hero-job,
.weather-card,
.scheduler-card,
.map-card,
.job-sheet-card,
.job-status-card,
.photos-card,
.timeline-card,
.check-row,
.return-item,
.assistant-panel,
.voice-note {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.job-card {
  display: grid;
  grid-template-columns: 1fr 44px;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  box-shadow: 0 10px 24px rgba(23, 33, 29, 0.07);
}

.weather-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
  background:
    linear-gradient(135deg, rgba(31, 158, 231, 0.13), rgba(33, 182, 66, 0.12)),
    var(--panel);
}

.scheduler-card {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel);
}

.scheduler-card strong {
  display: block;
  font-size: 24px;
}

.scheduler-card p {
  margin: 0;
  color: var(--muted);
}

.scheduler-card button {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.map-card {
  padding: 14px;
  margin-bottom: 14px;
}

.map-layers {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}

.map-layers label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  font-size: 12px;
  font-weight: 900;
}

.sa-map {
  position: relative;
  min-height: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background:
    radial-gradient(circle at 54% 55%, rgba(24, 178, 75, 0.18), transparent 0 7%, transparent 8%),
    linear-gradient(135deg, rgba(46, 155, 230, 0.18), transparent 45%),
    #eef3f5;
}

.sa-map::before {
  content: "";
  position: absolute;
  inset: 28px 34px 44px 44px;
  background: #ffffff;
  border: 2px solid rgba(74, 74, 74, 0.18);
  clip-path: polygon(36% 7%, 71% 7%, 83% 29%, 75% 49%, 87% 66%, 65% 91%, 32% 82%, 19% 58%, 25% 34%);
}

.map-region-label {
  position: absolute;
  left: 18px;
  top: 16px;
  z-index: 1;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.map-pin {
  position: absolute;
  left: var(--x);
  top: var(--y);
  z-index: 2;
  width: 36px;
  height: 36px;
  border: 0;
  background: transparent;
  transform: translate(-50%, -100%);
}

.map-pin > span {
  width: 24px;
  height: 24px;
  display: block;
  margin: 0 auto;
  border: 3px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 8px 18px rgba(74, 74, 74, 0.28);
}

.map-pin > span::after {
  content: "";
  width: 8px;
  height: 8px;
  position: absolute;
  left: 5px;
  top: 5px;
  border-radius: 50%;
  background: #fff;
}

.map-pin.booked > span,
.map-legend .booked {
  background: var(--brand);
}

.map-pin.ready > span,
.map-legend .ready {
  background: var(--blue);
}

.map-pin.scoping-required > span,
.map-legend .scoping-required {
  background: #8a5cf6;
}

.map-pin.service-required > span,
.map-legend .service-required {
  background: var(--red);
}

.map-pin.service-booked > span,
.map-legend .service-booked {
  background: var(--amber);
}

.pin-card {
  position: absolute;
  left: 28px;
  bottom: 24px;
  width: min(240px, 70vw);
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transform: translateY(6px);
  transition: 140ms ease;
}

.map-pin:hover .pin-card,
.map-pin:focus-visible .pin-card {
  opacity: 1;
  transform: translateY(0);
}

.pin-card p {
  margin: 4px 0;
  color: var(--muted);
}

.pin-card small {
  color: var(--brand-strong);
  font-weight: 900;
}

.map-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.map-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 900;
}

.map-legend i {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

@media (min-width: 760px) {
  .map-layers {
    grid-template-columns: repeat(5, minmax(0, 1fr));
  }

  .sa-map {
    min-height: 520px;
  }
}

.weather-card strong {
  display: block;
  font-size: 24px;
  margin: 2px 0;
}

.weather-card p {
  margin-bottom: 0;
  color: var(--muted);
}

.weather-label {
  display: block;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.weather-days {
  display: grid;
  grid-template-columns: repeat(3, minmax(42px, 1fr));
  gap: 6px;
}

.weather-days span {
  min-height: 48px;
  padding: 6px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.72);
  color: var(--muted);
  font-size: 11px;
  text-align: center;
}

.weather-days b {
  color: var(--ink);
}

.job-weather button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font-weight: 900;
}

.section-heading.inline {
  margin-top: 0;
}

.job-sheet-card {
  padding: 14px;
  margin-bottom: 14px;
}

.sync-summary {
  display: grid;
  grid-template-columns: 1fr;
  gap: 8px;
  margin-bottom: 10px;
}

.prototype-toggle {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  padding: 8px;
  border: 1px dashed rgba(111, 116, 120, 0.35);
  border-radius: 8px;
  background: #f8faf8;
}

.prototype-toggle span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.prototype-toggle button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
}

.prototype-toggle button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

body.system-solar-only .battery-section {
  display: none;
}

body.system-battery-only .pv-field {
  display: none;
}

.sync-summary div {
  padding: 10px;
  border-radius: 8px;
  background: #f8faf8;
  border: 1px solid var(--line);
}

.sync-summary strong,
.sync-summary span {
  display: block;
}

.sync-summary strong {
  font-size: 12px;
  color: var(--muted);
}

.sync-summary span {
  margin-top: 3px;
  font-weight: 900;
}

.zoho-sync-panel {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px;
  margin-bottom: 10px;
  border: 1px solid rgba(24, 178, 75, 0.28);
  border-radius: 8px;
  background: #e8f3ee;
}

.zoho-sync-panel span {
  display: block;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.zoho-sync-panel strong {
  display: block;
  margin-top: 3px;
}

.zoho-sync-panel p {
  margin: 3px 0 0;
  color: var(--muted);
}

.zoho-sync-panel button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--brand);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font-weight: 900;
}

.job-notification,
.stock-delivery {
  display: grid;
  gap: 8px;
  margin-bottom: 10px;
}

.job-notification {
  grid-template-columns: 1fr 1fr;
}

.job-notification.customer-only {
  grid-template-columns: 1fr;
}

.stock-delivery {
  grid-template-columns: 1fr 1fr;
}

.job-notification div,
.stock-delivery div {
  padding: 12px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f8faf8;
}

.job-notification span,
.stock-delivery span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.job-notification strong,
.stock-delivery strong {
  display: block;
}

.job-notification p {
  margin: 4px 0 0;
  color: var(--muted);
}

.job-status-card {
  padding: 14px;
  margin-bottom: 14px;
}

.photos-card {
  padding: 14px;
  margin-bottom: 14px;
}

.photo-actions {
  display: grid;
  grid-template-columns: 1fr 112px;
  gap: 8px;
}

.photo-upload {
  min-height: 48px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.photo-upload input {
  position: absolute;
  width: 1px;
  min-height: 1px;
  opacity: 0;
  pointer-events: none;
}

.photo-actions button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font-weight: 900;
}

.photo-list {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.photo-list p {
  margin: 0;
  color: var(--muted);
}

.photo-item {
  min-height: 44px;
  display: grid;
  grid-template-columns: 32px 1fr;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.photo-thumb {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--blue), var(--brand));
}

.photo-item strong {
  display: block;
  font-size: 13px;
}

.photo-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
}

.job-sheet-grid {
  display: grid;
  gap: 10px;
}

.job-sheet-grid div {
  padding: 12px;
  border-radius: 8px;
  background: #f8faf8;
  border: 1px solid var(--line);
}

.job-sheet-grid span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 4px;
}

.job-sheet-grid strong {
  display: block;
  margin-bottom: 4px;
}

.job-sheet-grid p {
  margin: 0;
  color: var(--muted);
}

.job-sheet-sections {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.job-sheet-sections details {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  overflow: hidden;
}

.job-sheet-sections summary {
  min-height: 46px;
  display: flex;
  align-items: center;
  padding: 0 12px;
  color: var(--ink);
  font-weight: 900;
  cursor: pointer;
}

.job-sheet-sections dl {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0 12px 12px;
}

.job-sheet-sections dl div {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.job-sheet-sections dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.job-sheet-sections dd {
  margin: 0;
  font-weight: 700;
}

.detail-groups {
  display: grid;
  gap: 10px;
  padding: 0 12px 12px;
}

.detail-group {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.detail-group.highlight {
  background: #e8f3ee;
  border-color: rgba(24, 178, 75, 0.28);
}

.detail-group.note {
  background: #fff8e6;
  border-color: rgba(183, 121, 31, 0.24);
}

.detail-group h3 {
  margin-bottom: 10px;
  color: var(--brand-strong);
  font-size: 14px;
}

.detail-pair {
  display: grid;
  grid-template-columns: minmax(112px, 42%) 1fr;
  gap: 10px;
  padding: 8px 0;
  border-top: 1px solid rgba(111, 116, 120, 0.18);
}

.detail-pair:first-of-type {
  border-top: 0;
  padding-top: 0;
}

.detail-pair span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-pair strong {
  color: var(--ink);
  font-size: 13px;
}

.install-detail-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  padding: 0 12px 12px;
}

.install-detail-table div {
  min-height: 56px;
  padding: 8px;
  border-top: 1px solid var(--line);
}

.install-detail-table div:nth-child(4n + 1),
.install-detail-table div:nth-child(4n + 2) {
  background: #dff0d8;
}

.install-detail-table span,
.stock-list-table span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.install-detail-table strong {
  display: block;
  margin-top: 4px;
  font-size: 13px;
}

.stock-list-table {
  padding: 0 12px 12px;
}

.stock-verification {
  display: grid;
  gap: 8px;
  padding: 0 12px 12px;
}

.stock-verification label {
  display: grid;
  gap: 6px;
  font-weight: 900;
}

.stock-verification label:first-child {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.stock-verification span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stock-list-head,
.stock-list-table > div:not(.stock-list-head) {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) 48px;
  gap: 8px;
  align-items: center;
}

.stock-list-head {
  min-height: 40px;
  align-items: center;
  padding: 0 10px;
  background: var(--brand);
}

.stock-list-head span {
  color: #fff;
}

.stock-list-table > div:not(.stock-list-head) {
  padding: 10px;
  border-bottom: 1px solid var(--line);
  background: #dff0d8;
}

.stock-item-info,
.stock-list-table strong,
.stock-list-table p {
  min-width: 0;
}

.stock-item-info {
  display: block;
}

.stock-list-table p {
  margin: 4px 0 0;
  color: var(--muted);
}

.stock-list-table b {
  min-height: 34px;
  min-width: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #fff;
  justify-self: center;
  font-size: 14px;
}

.stock-line-check {
  display: grid;
  place-items: center;
}

.stock-line-check input {
  margin: 0;
}

.stock-list-head span:last-child {
  text-align: center;
}

.terms-note {
  padding: 0 12px 12px;
  margin: 0;
  color: var(--muted);
  font-size: 12px;
}

.status-pill {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.scheduled {
  background: #e8f3ee;
  color: var(--brand-strong);
}

.status-pill.completed {
  background: var(--brand);
  color: #fff;
}

.status-pill.not-completed {
  background: #ffecea;
  color: var(--red);
}

.status-pill.stock-return-required {
  background: #fff8e6;
  color: var(--amber);
}

.status-actions {
  display: grid;
  gap: 8px;
}

.status-actions button {
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
}

.status-actions button[data-job-status="completed"] {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.status-actions button[data-job-status="not-completed"] {
  border-color: rgba(190, 61, 47, 0.42);
  color: var(--red);
}

.status-actions button[data-job-status="stock-return-required"] {
  border-color: rgba(183, 121, 31, 0.42);
  color: var(--amber);
}

.completion-flow {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #f8faf8;
  border: 1px dashed rgba(102, 115, 110, 0.4);
}

.completion-flow p {
  margin: 4px 0 0;
  color: var(--muted);
}

.completion-details {
  display: grid;
  gap: 10px;
  margin-top: 10px;
}

.completion-details span {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.stock-decision-panel {
  display: none;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(183, 121, 31, 0.28);
  border-radius: 8px;
  background: #fff8e6;
}

.stock-decision-panel.visible,
.stock-return-choice.visible,
.completion-stock-list.visible,
.onsite-stock-note.visible {
  display: grid;
}

.stock-decision-options,
.stock-return-choice > div {
  display: grid;
  gap: 8px;
}

.stock-decision-options label,
.stock-return-choice label {
  min-height: 40px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 900;
}

.stock-return-choice,
.completion-stock-list,
.onsite-stock-note {
  display: none;
}

.completion-stock-list {
  gap: 8px;
}

.completion-stock-list > div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  align-items: center;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.completion-stock-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 900;
}

.completion-stock-list input[type="number"] {
  min-height: 40px;
  text-align: center;
  font-weight: 900;
}

.completion-checks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.completion-checks label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  font-size: 13px;
  font-weight: 800;
}

.completion-pack {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: #eef8ff;
  border: 1px solid rgba(31, 158, 231, 0.28);
}

.pack-grid {
  display: grid;
  grid-template-columns: 94px 1fr;
  gap: 8px 10px;
  margin-top: 8px;
}

.pack-grid span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.pack-grid b {
  font-size: 13px;
}

.automation-log {
  margin-top: 10px;
  padding: 12px;
  border-radius: 8px;
  background: var(--panel);
  border: 1px solid var(--line);
}

.automation-log ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
}

.automation-log li + li {
  margin-top: 6px;
}

.job-card.selected {
  border-color: rgba(15, 122, 95, 0.45);
}

.job-card-main p {
  margin-bottom: 10px;
}

.job-type {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 9px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  margin-bottom: 8px;
}

.job-type.install {
  background: var(--brand);
}

.job-type.service {
  background: var(--blue);
}

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

.job-meta span {
  min-height: 26px;
  padding: 4px 8px;
  background: #eef4f1;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
}

.primary-icon {
  align-self: center;
  background: var(--ink);
  color: #fff;
  border: 0;
  font-size: 28px;
  line-height: 1;
}

.attention-row {
  width: 100%;
  min-height: 58px;
  display: grid;
  grid-template-columns: 10px 1fr 20px;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 10px;
  text-align: left;
}

.dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot.warning {
  background: var(--amber);
}

.dot.alert {
  background: var(--red);
}

.chevron {
  color: var(--muted);
  font-size: 22px;
}

.hero-job {
  padding: 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: start;
  box-shadow: var(--shadow);
}

.hero-phone {
  margin-bottom: 0;
  color: var(--ink);
  font-weight: 900;
}

.hero-contact {
  margin-bottom: 4px;
  color: var(--ink);
  font-weight: 900;
}

.hero-email {
  margin: 4px 0 0;
  color: var(--muted);
  font-weight: 800;
}

.hero-system-snapshot {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.hero-system-snapshot span {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  padding: 4px 8px;
  border-radius: 8px;
  background: #e8f3ee;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.hero-contact-actions {
  display: grid;
  gap: 8px;
}

.call-button,
.sms-button,
.map-button,
.primary-button {
  min-height: 44px;
  padding: 0 16px;
  border: none;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 800;
}

.sms-button {
  background: var(--blue);
}

.map-button {
  background: #2f3234;
}

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin: 14px 0;
}

.quick-actions button,
.segmented button {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 800;
}

.timeline-card {
  padding: 14px;
  margin-bottom: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  padding: 2px 0 18px;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item > span {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  margin-top: 3px;
  border: 2px solid var(--line);
}

.timeline-item.done > span {
  background: var(--brand);
  border-color: var(--brand);
}

.timeline-item.active > span {
  background: var(--sun);
  border-color: var(--sun);
}

.voice-note {
  display: block;
  padding: 14px;
}

.voice-note span {
  display: block;
  font-weight: 800;
  margin-bottom: 8px;
}

textarea {
  width: 100%;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  min-height: 96px;
  color: var(--ink);
}

input {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
  font: inherit;
}

input[type="checkbox"] {
  width: 18px;
  min-height: 18px;
  accent-color: var(--brand);
}

select {
  width: 100%;
  min-height: 48px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  color: var(--ink);
  background: var(--panel);
}

.mic-button {
  width: 100%;
  min-height: 48px;
  margin-top: 10px;
  border: 0;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.mic-shape {
  width: 14px;
  height: 20px;
  border-radius: 8px;
  border: 2px solid currentColor;
  position: relative;
}

.mic-shape::after {
  content: "";
  position: absolute;
  left: 3px;
  bottom: -7px;
  width: 6px;
  height: 5px;
  border-bottom: 2px solid currentColor;
}

.segmented {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 14px;
}

.segmented button.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.stock-return-types {
  margin-bottom: 12px;
}

.role-switch {
  display: grid;
  gap: 8px;
  margin-bottom: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.role-switch > span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.role-switch div {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.role-switch button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  font-weight: 900;
}

.role-switch button.active {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.calendar-grid {
  display: grid;
  gap: 12px;
}

.calendar-row {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: stretch;
}

.calendar-person {
  min-height: 62px;
  display: grid;
  place-items: center;
  background: #e9f1ed;
  border-radius: 8px;
  font-weight: 800;
}

.calendar-track {
  position: relative;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(90deg, rgba(102, 115, 110, 0.12) 1px, transparent 1px),
    var(--panel);
  background-size: calc(100% / 10) 100%;
  overflow: hidden;
}

.booking,
.block {
  position: absolute;
  top: 10px;
  left: calc((var(--start) - 7) * 10%);
  width: calc(var(--span) * 10%);
  min-width: 74px;
  height: 42px;
  border: 0;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  overflow: hidden;
  text-overflow: ellipsis;
}

.booking.install {
  background: var(--brand);
}

.booking.service {
  background: var(--blue);
}

.block.training {
  background: var(--amber);
}

.block.leave {
  background: var(--red);
}

.checklist {
  display: grid;
  gap: 10px;
}

.check-row {
  width: 100%;
  min-height: 82px;
  padding: 14px;
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 12px;
  text-align: left;
}

.check-row > span {
  width: 26px;
  height: 26px;
  border-radius: 8px;
  border: 2px solid var(--line);
}

.check-row.complete > span {
  background: var(--brand);
  border-color: var(--brand);
}

.scan-panel {
  padding: 18px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  text-align: center;
  margin-bottom: 14px;
}

.scan-panel p {
  color: rgba(255, 255, 255, 0.72);
}

.scan-frame {
  width: 150px;
  height: 96px;
  border: 2px solid rgba(255, 255, 255, 0.7);
  border-radius: 8px;
  margin: 0 auto 16px;
  position: relative;
}

.scan-frame::before {
  content: "";
  position: absolute;
  left: 16px;
  right: 16px;
  top: 46px;
  height: 2px;
  background: var(--sun);
}

.return-list {
  display: grid;
  gap: 10px;
}

.return-summary {
  min-height: 64px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.admin-only-panel {
  min-height: 66px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  margin-bottom: 12px;
  border: 1px dashed rgba(102, 115, 110, 0.45);
  border-radius: 8px;
  background: #f8faf8;
}

.admin-only-panel span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.admin-only-panel button {
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--muted);
  font-weight: 900;
}

.manager-controls {
  display: none;
  gap: 10px;
  padding: 14px;
  margin-bottom: 12px;
  background: var(--panel);
  border: 1px solid rgba(15, 122, 95, 0.35);
  border-radius: 8px;
}

.manager-controls label,
.manager-controls span {
  display: block;
}

.manager-controls span {
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

body.role-manager .manager-controls,
body.role-admin .manager-controls {
  display: grid;
}

body.role-manager .admin-only-panel button,
body.role-admin .admin-only-panel button {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}

.return-summary span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.return-summary button {
  min-height: 38px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.return-item {
  padding: 14px;
}

.return-item.returned {
  border-color: rgba(15, 122, 95, 0.4);
}

.assigned-user {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 44px;
  margin-top: 10px;
  padding: 8px 10px;
  border-radius: 8px;
  background: #fff8e6;
}

.assigned-user.complete {
  background: #e8f3ee;
}

.assigned-user span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.assigned-user button {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  color: var(--ink);
  font-weight: 900;
}

.item-code {
  display: inline-block;
  min-height: 24px;
  padding: 3px 8px;
  margin-bottom: 8px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
}

.return-type {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  color: #fff;
  font-size: 12px;
  font-weight: 900;
  margin: 0 6px 8px 0;
}

.return-type.partial {
  background: var(--amber);
}

.return-type.whole {
  background: var(--blue);
}

.assistant-panel {
  padding: 18px;
  margin-bottom: 14px;
}

.kb-search,
.source-status,
.kb-item {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
}

.kb-search {
  padding: 14px;
  margin-bottom: 12px;
}

.kb-search label {
  display: block;
  font-weight: 900;
  margin-bottom: 10px;
}

.kb-search p {
  color: var(--muted);
  margin: 10px 0 0;
}

.search-row {
  display: grid;
  grid-template-columns: 1fr 48px;
  gap: 8px;
}

.search-icon {
  width: 18px;
  height: 18px;
  border: 2px solid currentColor;
  border-radius: 50%;
  position: relative;
}

.search-icon::after {
  content: "";
  position: absolute;
  right: -7px;
  bottom: -5px;
  width: 8px;
  border-top: 2px solid currentColor;
  transform: rotate(45deg);
}

.source-status {
  min-height: 66px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.source-status span {
  display: block;
  color: var(--muted);
}

.sync-pill {
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 8px;
  background: #e8f3ee;
  color: var(--brand-strong) !important;
  font-size: 12px;
  font-weight: 900;
}

.kb-list {
  display: grid;
  gap: 10px;
}

.kb-item {
  width: 100%;
  min-height: 114px;
  padding: 14px;
  text-align: left;
}

.kb-item p {
  color: var(--muted);
  margin-bottom: 8px;
}

.kb-item small {
  color: var(--brand-strong);
  font-weight: 800;
}

.kb-type {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: #eef4f1;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 8px;
}

.assistant-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
  margin-bottom: 12px;
}

.assistant-answer {
  border-left: 4px solid var(--sun);
  background: #fff8e6;
  padding: 12px;
  border-radius: 0 8px 8px 0;
}

.source-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 10px;
}

.source-chips span {
  min-height: 26px;
  padding: 5px 8px;
  border-radius: 8px;
  background: var(--panel);
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 800;
}

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

.admin-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border-color: rgba(24, 178, 75, 0.28);
  background: linear-gradient(135deg, #ffffff 0%, #edf8f2 100%);
}

.admin-eyebrow {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 8px;
  background: #e8f3ee;
  color: var(--brand-strong);
  font-size: 12px;
  font-weight: 900;
}

.admin-hero h2,
.admin-hero p {
  margin: 8px 0 0;
}

.admin-hero p,
.admin-panel p {
  color: var(--muted);
}

.admin-hero button,
.admin-panel button {
  border-radius: 8px;
}

.admin-hero > button {
  min-height: 42px;
  padding: 0 12px;
  border: 0;
  background: var(--brand);
  color: #fff;
  font-weight: 900;
}

.admin-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}

.admin-stats div,
.admin-return-grid div,
.admin-users div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.admin-stats span,
.admin-return-grid span,
.admin-users span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.admin-stats strong,
.admin-return-grid strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
}

.report-kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.report-kpi-grid div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
}

.report-kpi-grid span,
.report-kpi-grid small {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 900;
}

.report-kpi-grid strong {
  display: block;
  margin: 5px 0 3px;
  color: var(--ink);
  font-size: 25px;
}

.matrix-grid {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.matrix-card {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.matrix-card h3 {
  margin: 0 0 10px;
  font-size: 14px;
}

.matrix-row {
  display: grid;
  grid-template-columns: minmax(88px, 1fr) minmax(72px, 1.2fr) 34px;
  gap: 8px;
  align-items: center;
  min-height: 30px;
}

.matrix-row span,
.matrix-row b {
  font-size: 12px;
}

.matrix-row span {
  color: var(--muted);
  font-weight: 800;
}

.matrix-row b {
  text-align: right;
}

.matrix-bar {
  height: 8px;
  overflow: hidden;
  border-radius: 8px;
  background: #e8edf0;
}

.matrix-bar i {
  display: block;
  width: var(--value);
  height: 100%;
  border-radius: inherit;
  background: var(--brand);
}

.matrix-bar.warning i {
  background: var(--sun);
}

.installer-scoreboard {
  margin-top: 10px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.installer-scoreboard > div {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) 52px 76px;
  gap: 8px;
  align-items: center;
  padding: 9px 10px;
  border-bottom: 1px solid var(--line);
}

.installer-scoreboard > div:first-child {
  background: #e8f3ee;
  color: var(--brand-strong);
  font-size: 11px;
  font-weight: 900;
}

.installer-scoreboard > div:last-child {
  border-bottom: 0;
}

.installer-scoreboard strong,
.installer-scoreboard span,
.installer-scoreboard b {
  min-width: 0;
  font-size: 12px;
}

.admin-status-list,
.admin-work-queue,
.admin-users,
.knowledge-source-list,
.admin-automation-list {
  display: grid;
  gap: 8px;
}

.admin-status-list button,
.knowledge-source-list > div,
.admin-work-queue button {
  min-height: 58px;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
  padding: 10px;
  border: 1px solid var(--line);
  background: #f8faf8;
  text-align: left;
}

.admin-status-list p,
.knowledge-source-list p,
.admin-work-queue span {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.admin-status-list b,
.knowledge-source-list b {
  color: var(--brand-strong);
  font-size: 12px;
}

.web-admin-only {
  border-color: rgba(46, 155, 230, 0.32);
}

.admin-automation-list.compact {
  margin-top: 10px;
}

.status-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--brand);
}

.status-dot.review {
  background: var(--sun);
}

.status-dot.warn {
  background: var(--blue);
}

.admin-work-queue button {
  grid-template-columns: minmax(0, 1fr);
}

#admin-map-slot {
  display: grid;
}

#admin-map-slot .map-card {
  margin: 0;
}

.admin-return-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.admin-users {
  grid-template-columns: 1fr;
}

.admin-automation-list label {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8faf8;
  font-weight: 900;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(720px, 100%);
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.96);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(16px);
}

.bottom-nav button {
  min-height: 58px;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  display: grid;
  place-items: center;
  gap: 4px;
}

.bottom-nav button.active {
  background: #e8f3ee;
  color: var(--brand-strong);
}

.nav-icon {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.bottom-nav button.active .nav-icon {
  fill: var(--brand);
  stroke: var(--brand);
}

.bottom-nav button.active .nav-icon .icon-accent {
  stroke: #fff;
}

.bottom-nav button:not(.active) .nav-icon .icon-accent {
  stroke: currentColor;
}

.toast {
  position: fixed;
  left: 16px;
  right: 16px;
  bottom: calc(92px + env(safe-area-inset-bottom));
  max-width: 688px;
  margin: 0 auto;
  padding: 12px 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: 160ms ease;
}

.toast.visible {
  opacity: 1;
  transform: translateY(0);
}

@media (min-width: 760px) {
  .app-shell {
    border-left: 1px solid var(--line);
    border-right: 1px solid var(--line);
  }
}
