:root {
  color-scheme: light;
  --bg: #f3f7f4;
  --surface: #ffffff;
  --surface-soft: #f8fbf9;
  --surface-tint: #eaf6f1;
  --ink: #17211d;
  --muted: #66756e;
  --line: #dce5df;
  --line-strong: #b7c9c0;
  --primary: #176b53;
  --primary-strong: #0f4f3d;
  --primary-soft: #e5f4ee;
  --blue: #2f6fe8;
  --blue-soft: #eef4ff;
  --amber: #bf741d;
  --amber-soft: #fff6e9;
  --danger: #b42318;
  --sidebar: #10231d;
  --sidebar-soft: #19342b;
  --shadow: 0 16px 36px rgba(17, 40, 31, 0.09);
  --shadow-soft: 0 8px 18px rgba(17, 40, 31, 0.06);
  font-family: Inter, "PingFang SC", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(180deg, rgba(23, 107, 83, 0.08), transparent 260px),
    linear-gradient(90deg, rgba(47, 111, 232, 0.05), transparent 42%),
    var(--bg);
  color: var(--ink);
  text-rendering: optimizeLegibility;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

.hidden {
  display: none !important;
}

.auth-view {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(135deg, rgba(16, 35, 29, 0.84), rgba(16, 35, 29, 0.58)),
    linear-gradient(90deg, rgba(47, 111, 232, 0.24), transparent 48%),
    var(--bg);
}

.auth-card {
  width: min(440px, 100%);
  display: grid;
  gap: 24px;
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.94);
  box-shadow: var(--shadow);
  padding: 30px;
  backdrop-filter: blur(16px);
}

.auth-brand {
  padding-bottom: 6px;
}

.auth-switch {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 5px;
}

.auth-switch button {
  min-height: 38px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.auth-switch button.active {
  background: #ffffff;
  color: var(--primary-strong);
  box-shadow: var(--shadow-soft);
}

.auth-note {
  margin: -2px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.55;
}

.site-icp {
  margin: 0;
  padding-top: 16px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  text-align: center;
}

.site-icp a {
  color: inherit;
  text-decoration: none;
}

.site-icp a:hover {
  color: var(--primary);
  text-decoration: underline;
}

.app-shell {
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 22px;
  padding: 22px 18px;
  background: var(--sidebar);
  color: #f7fbf8;
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.08);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: #f7fbf8;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.18);
  color: var(--sidebar);
  font-size: 13px;
  font-weight: 850;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 17px;
}

.brand span {
  margin-top: 3px;
  color: rgba(247, 251, 248, 0.66);
  font-size: 12px;
}

.auth-card .brand span {
  color: var(--muted);
}

.auth-card .brand-mark {
  background: var(--ink);
  color: #fff;
}

.nav-tabs {
  display: grid;
  gap: 7px;
}

.nav-tab {
  width: 100%;
  min-height: 46px;
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  align-items: center;
  gap: 10px;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 0 11px;
  background: transparent;
  color: rgba(247, 251, 248, 0.72);
  text-align: left;
  font-weight: 750;
  transition: background 0.16s ease, color 0.16s ease, border-color 0.16s ease;
}

.nav-tab::before {
  content: attr(data-icon);
  width: 30px;
  height: 30px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: rgba(247, 251, 248, 0.88);
  font-size: 12px;
  font-weight: 850;
}

.nav-tab span {
  display: inline-flex;
  align-items: center;
  gap: 9px;
}

.nav-tab span::before {
  display: none;
}

.nav-tab.active,
.nav-tab:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: linear-gradient(90deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.08));
  color: #fff;
}

.nav-tab.active::before,
.nav-tab:hover::before {
  background: #f7fbf8;
  color: var(--primary-strong);
}

.sidebar-summary {
  margin-top: auto;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.sidebar-summary div {
  min-height: 76px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.sidebar-summary span {
  display: block;
  color: rgba(247, 251, 248, 0.62);
  font-size: 12px;
}

.sidebar-summary strong {
  display: block;
  margin-top: 8px;
  font-size: 24px;
}

.account-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  padding: 12px;
}

.account-box span {
  min-width: 0;
  color: rgba(247, 251, 248, 0.7);
  font-size: 13px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.account-box .text-button:hover {
  color: #ffffff;
}

.workspace {
  min-width: 0;
  padding: 30px 34px 40px;
}

.mobile-account-box {
  display: none;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 20px;
  margin: 0 auto 24px;
  max-width: 1320px;
}

.eyebrow,
.section-kicker {
  margin: 0 0 6px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.topbar h1 {
  margin: 0;
  font-size: 33px;
  line-height: 1.18;
  letter-spacing: 0;
}

.topbar p:not(.eyebrow) {
  margin: 8px 0 0;
  color: var(--muted);
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px;
  border: 1px solid rgba(20, 32, 27, 0.07);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.58);
  box-shadow: var(--shadow-soft);
}

.global-search {
  display: grid;
  grid-template-columns: minmax(220px, 360px) auto;
  gap: 8px;
  align-items: center;
}

.global-search input {
  min-height: 42px;
  border-color: transparent;
  background: rgba(255, 255, 255, 0.9);
}

.view {
  display: none;
  margin: 0 auto;
  max-width: 1320px;
}

.view.active {
  display: block;
}

.checkin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.12fr) minmax(340px, 0.88fr);
  gap: 18px;
  align-items: start;
}

.two-column {
  display: grid;
  grid-template-columns: minmax(0, 1.08fr) minmax(340px, 0.92fr);
  gap: 18px;
  align-items: start;
}

.search-layout,
.report-dashboard,
.ai-workbench {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.42fr);
  gap: 18px;
  align-items: start;
}

.right-rail {
  display: grid;
  gap: 18px;
}

.forms-stack {
  display: grid;
  gap: 18px;
}

.panel,
.map-panel {
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: var(--shadow-soft);
  backdrop-filter: blur(10px);
}

.panel {
  padding: 22px;
}

.checkin-panel {
  position: relative;
  overflow: hidden;
}

.checkin-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--primary), var(--blue), var(--amber));
}

.ai-form-panel,
.search-panel,
.ai-chat-panel {
  position: relative;
  overflow: hidden;
}

.ai-form-panel::before,
.search-panel::before,
.ai-chat-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 3px;
  background: linear-gradient(90deg, var(--blue), var(--primary));
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 20px;
}

.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.25;
}

.panel-actions {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 11px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 13px;
  font-weight: 750;
  white-space: nowrap;
}

.stack {
  display: grid;
  gap: 16px;
}

.field {
  display: grid;
  gap: 8px;
}

.field > span,
.inline-filter span,
.location-copy > span {
  color: #34433c;
  font-size: 14px;
  font-weight: 750;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fcfefd;
  padding: 12px 13px;
  outline: none;
  transition: border-color 0.16s ease, box-shadow 0.16s ease, background 0.16s ease;
}

textarea {
  min-height: 104px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(23, 107, 85, 0.13);
}

.primary-button,
.secondary-button,
.ghost-button,
.text-button,
.danger-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 10px 15px;
  font-weight: 800;
  transition: transform 0.14s ease, box-shadow 0.14s ease, background 0.14s ease, border-color 0.14s ease;
}

.primary-button[data-icon],
.secondary-button[data-icon],
.ghost-button[data-icon] {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.primary-button[data-icon]::before,
.secondary-button[data-icon]::before,
.ghost-button[data-icon]::before {
  content: attr(data-icon);
  min-width: 18px;
  height: 18px;
  display: inline-grid;
  place-items: center;
  font-size: 11px;
  font-weight: 900;
}

.primary-button {
  background: var(--primary);
  color: #ffffff;
  box-shadow: 0 12px 22px rgba(23, 107, 83, 0.18);
}

.primary-button:hover {
  background: var(--primary-strong);
  transform: translateY(-1px);
}

.primary-button:disabled,
.secondary-button:disabled,
.ghost-button:disabled,
.danger-button:disabled {
  transform: none;
  box-shadow: none;
}

.secondary-button {
  background: var(--primary-soft);
  color: var(--primary-strong);
  border-color: #c8ded3;
}

.secondary-button:hover,
.ghost-button:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-soft);
}

.ghost-button {
  background: rgba(255, 255, 255, 0.9);
  border-color: var(--line);
  color: var(--ink);
}

.text-button {
  min-height: auto;
  padding: 0;
  background: transparent;
  color: #7fb3ff;
}

.panel .text-button,
.map-panel .text-button {
  color: var(--blue);
}

.danger-button {
  background: #fff2ef;
  color: var(--danger);
  border-color: #ffd2ca;
}

.danger-button:hover {
  background: #ffe7e1;
}

.upload-box {
  min-height: 140px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  display: grid;
  place-items: center;
  gap: 5px;
  padding: 20px;
  text-align: center;
  background:
    linear-gradient(135deg, rgba(47, 111, 237, 0.08), transparent 46%),
    #f8fbff;
  transition: border-color 0.16s ease, background 0.16s ease;
}

.upload-box:hover {
  border-color: var(--blue);
  background: var(--blue-soft);
}

.upload-box input {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  opacity: 0;
}

.upload-box strong {
  font-size: 16px;
}

.upload-box small {
  color: var(--muted);
}

.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(86px, 1fr));
  gap: 10px;
}

.photo-grid img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  box-shadow: 0 6px 14px rgba(17, 40, 31, 0.08);
}

.pending-checkin-box {
  display: grid;
  gap: 10px;
  border: 1px solid #f1d7a7;
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.pending-checkin-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.pending-checkin-head strong,
.pending-checkin-head span {
  display: block;
}

.pending-checkin-head span {
  margin-top: 3px;
  color: #8a6a18;
  font-size: 12px;
  font-weight: 800;
}

.pending-checkin-list {
  display: grid;
  gap: 8px;
}

.pending-checkin-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 6px 10px;
  align-items: center;
  border: 1px solid rgba(138, 106, 24, 0.16);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.pending-checkin-card.is-editing {
  border-color: rgba(23, 107, 83, 0.34);
  background: #f7fcf9;
}

.pending-checkin-card strong,
.pending-checkin-card span,
.pending-checkin-card small {
  display: block;
}

.pending-checkin-card span,
.pending-checkin-card small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.pending-checkin-card small {
  grid-column: 1 / -1;
}

.pending-checkin-actions {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.pending-checkin-actions .text-button {
  justify-self: end;
  white-space: nowrap;
}

.location-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #cce1d7;
  border-radius: 8px;
  background: linear-gradient(180deg, #f4fbf7, #ffffff);
  padding: 14px;
}

.location-box p {
  margin: 5px 0 4px;
  color: var(--muted);
}

.location-box a,
.record-card a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.location-actions,
.manual-location-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.manual-location {
  display: grid;
  gap: 12px;
  border: 1px solid #d7e6de;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 107, 83, 0.06), transparent 44%),
    #ffffff;
  padding: 14px;
}

.manual-location-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.place-search {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.place-chips {
  margin-top: -4px;
}

.place-results {
  display: grid;
  gap: 8px;
  max-height: 280px;
  overflow: auto;
  overscroll-behavior: contain;
}

.task-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.78fr) minmax(0, 1.22fr);
  gap: 18px;
  align-items: start;
}

.task-import-panel,
.task-list-panel {
  min-width: 0;
}

.task-upload-box {
  min-height: 132px;
}

.task-file-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.task-file-hint {
  min-width: 0;
  min-height: 42px;
  display: flex;
  align-items: center;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 9px 11px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.task-import-summary {
  display: grid;
  gap: 4px;
  border: 1px solid #c9d9ff;
  border-radius: 8px;
  background: #f4f7ff;
  padding: 12px;
  color: var(--ink);
  line-height: 1.5;
}

.task-import-summary.is-error {
  border-color: #efb2ac;
  background: #fff4f2;
}

.task-import-summary span {
  color: var(--muted);
  font-size: 13px;
}

.task-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.task-stats div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.task-stats span,
.task-card dt {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.task-stats strong {
  display: block;
  margin-top: 4px;
  font-size: 24px;
  line-height: 1;
}

.task-toolbar {
  display: grid;
  grid-template-columns: minmax(0, 1fr) repeat(3, minmax(118px, 150px));
  gap: 10px;
  margin-bottom: 14px;
}

.task-list {
  display: grid;
  gap: 10px;
}

.task-card {
  border: 1px solid var(--line);
  border-left: 4px solid var(--line-strong);
  border-radius: 8px;
  background: #ffffff;
  padding: 14px;
  box-shadow: var(--shadow-soft);
}

.task-card.status-in_progress {
  border-left-color: var(--blue);
}

.task-card.status-done {
  border-left-color: var(--primary);
}

.task-card.status-abnormal {
  border-left-color: var(--danger);
}

.task-card header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: start;
}

.task-card h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.35;
}

.task-title-row {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.task-title-row h3 {
  min-width: 0;
  overflow-wrap: anywhere;
}

.task-status-badge {
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-soft);
  padding: 3px 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 850;
  line-height: 1.2;
  white-space: nowrap;
}

.task-status-badge.status-in_progress {
  border-color: #c8d7ff;
  background: var(--blue-soft);
  color: var(--blue);
}

.task-status-badge.status-done {
  border-color: #b7d2c6;
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.task-status-badge.status-abnormal {
  border-color: #efb2ac;
  background: #fff4f2;
  color: var(--danger);
}

.task-card p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.task-card select {
  min-width: 0;
  min-height: 38px;
}

.selected-task-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #b7d2c6;
  border-radius: 8px;
  background: #f0faf5;
  padding: 12px;
}

.selected-task-box span,
.selected-task-box small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.selected-task-box strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selected-task-box small {
  margin-top: 3px;
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.selected-remediation-box {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  border: 1px solid #f1d7a7;
  border-radius: 8px;
  background: #fffaf0;
  padding: 12px;
}

.selected-remediation-box span,
.selected-remediation-box small {
  display: block;
  color: #8a6a18;
  font-size: 12px;
  font-weight: 750;
}

.selected-remediation-box strong {
  display: block;
  margin-top: 3px;
  color: var(--ink);
  font-size: 15px;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.selected-remediation-box small {
  margin-top: 3px;
  color: var(--muted);
  font-weight: 600;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.task-card-actions {
  display: grid;
  gap: 8px;
}

.task-start-button {
  min-height: 38px;
  justify-content: center;
  white-space: nowrap;
}

.task-card dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px 14px;
  margin: 12px 0 0;
}

.task-card dd {
  min-width: 0;
  margin: 3px 0 0;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.place-result {
  width: 100%;
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 11px 12px;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.place-result:hover,
.place-result:focus-visible {
  border-color: #b7d8ca;
  background: #f7fcf9;
  outline: none;
  transform: translateY(-1px);
}

.place-result strong,
.place-result span,
.place-result small {
  min-width: 0;
}

.place-result strong {
  font-size: 14px;
}

.place-result span {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.place-result small {
  justify-self: end;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 800;
}

.map-panel {
  overflow: hidden;
  background: #fff;
}

.map-visual {
  position: relative;
  min-height: 220px;
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 107, 85, 0.24) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 107, 85, 0.18) 1px, transparent 1px),
    linear-gradient(135deg, #dcefe7, #f5faf7 55%, #e9f1ff);
  background-size: 34px 34px, 34px 34px, auto;
}

.map-visual.has-image {
  background-size: cover;
  background-position: center;
}

.map-visual.has-map {
  min-height: 260px;
  background: #f6faf8;
}

.map-visual.has-image .map-grid {
  background: linear-gradient(180deg, rgba(0, 0, 0, 0), rgba(20, 32, 27, 0.18));
}

.map-grid {
  position: absolute;
  inset: 0;
}

.amap-canvas {
  position: absolute;
  inset: 0;
}

.map-pin {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 20px;
  height: 20px;
  border: 4px solid #ffffff;
  border-radius: 999px 999px 999px 0;
  background: var(--primary);
  box-shadow: 0 12px 22px rgba(14, 78, 61, 0.28);
  transform: translate(-50%, -70%) rotate(-45deg);
}

.map-visual span {
  position: absolute;
  left: 14px;
  bottom: 14px;
  border-radius: 8px;
  padding: 6px 9px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}

.map-info {
  display: grid;
  gap: 4px;
  padding: 15px 17px 17px;
}

.map-info p {
  margin: 0;
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
  letter-spacing: 0;
}

.map-info strong {
  font-size: 15px;
}

.field-builder {
  display: grid;
  gap: 12px;
}

.ai-form-draft {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  border: 1px solid #d5e4ff;
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(47, 111, 232, 0.08), transparent 38%),
    #fbfdff;
  padding: 14px;
}

.ai-form-draft h3,
.ai-form-draft p {
  margin: 0;
}

.ai-form-draft p {
  color: var(--muted);
  line-height: 1.55;
}

.draft-field-list {
  display: grid;
  gap: 8px;
}

.draft-field-list div {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px 10px;
  border: 1px solid #dbe8ff;
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.draft-field-list strong,
.draft-field-list span,
.draft-field-list small {
  display: block;
}

.draft-field-list span,
.draft-field-list small {
  grid-column: 1 / -1;
}

.draft-field-list span {
  justify-self: end;
  border-radius: 999px;
  background: var(--blue-soft);
  color: #265cbd;
  padding: 3px 8px;
  font-weight: 750;
}

.draft-field-list small {
  color: var(--muted);
  font-size: 12px;
}

.builder-row {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 130px 92px 92px;
  gap: 10px;
  align-items: end;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(180deg, #ffffff, var(--surface-soft));
  box-shadow: 0 6px 14px rgba(17, 40, 31, 0.04);
}

.builder-row .options-input {
  grid-column: 1 / -1;
}

.builder-row label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.required-toggle {
  display: flex;
  min-height: 42px;
  align-items: center;
  gap: 7px;
  color: #34433c;
  font-weight: 750;
}

.required-toggle input {
  width: 16px;
  height: 16px;
}

.form-list,
.record-list,
.remediation-list,
.records-layout {
  display: grid;
  gap: 12px;
}

.search-controls {
  display: grid;
  grid-template-columns: minmax(220px, 1.35fr) repeat(4, minmax(118px, 0.7fr));
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.search-controls input,
.search-controls select,
.search-controls button {
  width: 100%;
}

.search-results {
  display: grid;
  gap: 12px;
}

.search-card {
  display: grid;
  gap: 9px;
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  padding: 16px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 40, 31, 0.05);
}

.search-card.form {
  border-left: 4px solid var(--blue);
}

.search-card.checkin {
  border-left: 4px solid var(--primary);
}

.search-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
}

.search-card time {
  color: var(--muted);
  font-size: 12px;
}

.search-card h3,
.search-card p {
  margin: 0;
}

.search-card h3 {
  font-size: 17px;
}

.search-card p,
.search-snippet {
  color: var(--muted);
  line-height: 1.55;
}

.search-card a {
  width: fit-content;
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

.search-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.search-actions .ghost-button {
  min-height: 36px;
  padding: 8px 12px;
}

.search-snippet {
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px 12px;
}

.search-hit {
  border-radius: 4px;
  background: #fff1a8;
  box-decoration-break: clone;
  color: #3b3212;
  padding: 0 2px;
}

.insight-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.insight-list div {
  min-height: 76px;
  border: 1px solid rgba(20, 32, 27, 0.07);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 107, 83, 0.07), transparent 48%),
    #ffffff;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(17, 40, 31, 0.04);
}

.insight-list strong,
.insight-list span {
  display: block;
}

.insight-list strong {
  font-size: 24px;
}

.insight-list span {
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
}

.search-side {
  display: grid;
  gap: 14px;
}

.section-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.section-row h3 {
  margin: 0;
  font-size: 16px;
  line-height: 1.25;
}

.saved-search-section {
  display: grid;
  gap: 10px;
  border-top: 1px solid rgba(20, 32, 27, 0.08);
  padding-top: 14px;
}

.saved-search-form,
.saved-search-list {
  display: grid;
  gap: 8px;
}

.saved-search-form input {
  min-width: 0;
}

.saved-search-scope {
  min-width: 0;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
}

.saved-search-scope input {
  width: 16px;
  height: 16px;
  accent-color: var(--primary);
}

.saved-search-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 8px;
  align-items: stretch;
}

.saved-search-item.readonly {
  grid-template-columns: minmax(0, 1fr);
}

.saved-search-apply,
.saved-search-delete {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.saved-search-apply {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 11px;
  text-align: left;
}

.saved-search-title-line {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 6px;
}

.saved-search-badge {
  flex: 0 0 auto;
  border-radius: 999px;
  background: #e9f6f0;
  color: var(--primary-strong);
  padding: 2px 7px;
  font-size: 11px;
  font-weight: 850;
  line-height: 1.35;
}

.saved-search-apply strong,
.saved-search-description,
.saved-search-apply small {
  min-width: 0;
  overflow-wrap: anywhere;
}

.saved-search-apply strong {
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.saved-search-description,
.saved-search-apply small {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.saved-search-apply small {
  font-weight: 750;
}

.saved-search-apply:hover {
  border-color: #bdd6cb;
  background: #f8fcfa;
}

.saved-search-delete {
  min-height: 38px;
  color: var(--danger);
  font-size: 18px;
  font-weight: 900;
}

.empty.compact {
  min-height: auto;
  padding: 10px;
  font-size: 12px;
}

.form-card,
.record-card,
.remediation-card {
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  padding: 15px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(17, 40, 31, 0.05);
}

.record-card {
  position: relative;
  overflow: hidden;
}

.form-card.is-focused,
.record-card.is-focused {
  border-color: rgba(47, 111, 237, 0.48);
  box-shadow: 0 0 0 3px rgba(47, 111, 237, 0.12), var(--shadow-soft);
  scroll-margin-block: 88px;
}

.remediation-card {
  display: grid;
  gap: 12px;
}

.record-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: var(--primary);
}

.record-card.risk-abnormal::before {
  background: var(--danger);
}

.form-card header,
.record-card header,
.remediation-card header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}

.record-card-badges {
  display: flex;
  justify-content: flex-end;
  gap: 6px;
  flex-wrap: wrap;
}

.risk-pill.risk-normal {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.risk-pill.risk-abnormal {
  background: #fff4f2;
  color: var(--danger);
}

.form-card h3,
.record-card h3,
.remediation-card h3 {
  margin: 0;
  font-size: 16px;
}

.form-card p,
.record-card p,
.remediation-card p {
  color: var(--muted);
  margin: 6px 0 0;
}

.remediation-card.status-open {
  border-left: 4px solid var(--danger);
}

.remediation-card.status-overdue {
  border-left: 4px solid #b42318;
  background: #fffafa;
}

.remediation-card.status-resolved {
  border-left: 4px solid var(--primary);
}

.remediation-status.open {
  background: #fff4f2;
  color: var(--danger);
}

.remediation-status.overdue {
  background: #ffe7e1;
  color: #b42318;
}

.remediation-status.resolved {
  background: var(--primary-soft);
  color: var(--primary-strong);
}

.remediation-desc {
  line-height: 1.55;
}

.remediation-meta {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.remediation-meta span {
  border-radius: 999px;
  background: var(--surface-soft);
  color: var(--muted);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 750;
}

.remediation-meta span.is-overdue {
  background: #ffe7e1;
  color: #b42318;
}

.remediation-action {
  justify-self: start;
}

.remediation-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.field-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 12px;
}

.field-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 750;
}

.field-tags span.is-search-match {
  outline: 2px solid rgba(47, 111, 237, 0.18);
  background: #eaf2ff;
  color: #1e4fa8;
}

.record-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 14px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 13px;
}

.record-location-preview {
  position: relative;
  display: block;
  overflow: hidden;
  margin-top: 10px;
  border: 1px solid #cfe1d8;
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  text-decoration: none;
}

details.record-location-preview {
  padding: 0;
}

.record-location-preview:not(details) {
  padding: 10px;
}

.record-location-preview.is-empty {
  min-height: auto;
  display: block;
  border-style: dashed;
}

.record-location-grid {
  display: none;
}

.record-location-pin {
  display: none;
}

.record-location-summary {
  display: grid;
  grid-template-columns: 9px minmax(0, 1fr) auto;
  gap: 9px;
  align-items: center;
  min-height: 44px;
  list-style: none;
  padding: 10px 12px;
  cursor: pointer;
}

.record-location-summary::-webkit-details-marker {
  display: none;
}

.record-location-summary strong {
  overflow: hidden;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.record-location-dot {
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--primary);
}

.record-location-expand {
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 850;
}

.record-location-detail {
  display: grid;
  gap: 8px;
  border-top: 1px solid #eef3f0;
  padding: 10px 12px 12px;
}

.record-mini-map {
  position: relative;
  height: 84px;
  z-index: 1;
  display: grid;
  place-items: center;
  overflow: hidden;
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(247, 251, 249, 0.75), rgba(224, 239, 232, 0.82));
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
  opacity: 1;
  transition: opacity 0.18s ease;
}

.record-mini-map.is-loading,
.record-mini-map.is-error,
.record-mini-map.is-rendered {
  opacity: 1;
}

.record-mini-map-canvas {
  width: 100%;
  height: 100%;
}

.record-mini-map-marker {
  width: 18px;
  height: 18px;
  border: 3px solid #fff;
  border-radius: 999px 999px 999px 0;
  background: #e94b35;
  box-shadow: 0 10px 22px rgba(21, 32, 28, 0.28);
  transform: rotate(-45deg);
}

.record-location-overlay {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 6px;
  align-items: center;
  align-content: center;
  border-radius: 8px;
  background: transparent;
  padding: 2px;
  box-shadow: none;
}

.record-location-copy {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.record-location-detail span,
.record-location-overlay span {
  color: var(--primary);
  font-size: 10px;
  font-weight: 850;
}

.record-location-detail strong,
.record-location-overlay strong {
  display: -webkit-box;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.35;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.record-location-detail small,
.record-location-overlay small {
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.record-location-detail .record-location-nav,
.record-location-overlay .record-location-nav {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 28px;
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
  white-space: nowrap;
  justify-self: start;
}

.record-location-preview:not(.has-coordinates) .record-location-nav {
  background: var(--blue);
}

.record-values {
  display: grid;
  gap: 7px;
  margin: 12px 0 0;
  color: #34433c;
}

.record-values div {
  display: grid;
  grid-template-columns: 110px minmax(0, 1fr);
  gap: 10px;
  border-top: 1px solid #eef3f0;
  padding-top: 7px;
}

.record-values div.is-search-match {
  border: 1px solid rgba(47, 111, 237, 0.22);
  border-radius: 8px;
  background: #f5f9ff;
  padding: 9px 10px;
}

.record-values dt {
  color: var(--muted);
}

.record-values dd {
  margin: 0;
}

.record-photos {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.record-photos img {
  width: 100%;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
}

.map-dashboard {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 380px);
  gap: 16px;
  align-items: stretch;
}

.map-summary-panel {
  overflow: hidden;
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
}

.summary-map-canvas {
  position: relative;
  min-height: calc(100vh - 160px);
  overflow: hidden;
  background:
    linear-gradient(90deg, rgba(23, 107, 85, 0.22) 1px, transparent 1px),
    linear-gradient(0deg, rgba(23, 107, 85, 0.16) 1px, transparent 1px),
    linear-gradient(135deg, #dcefe7, #f5faf7 55%, #e9f1ff);
  background-size: 36px 36px, 36px 36px, auto;
}

.summary-amap-canvas {
  position: absolute;
  inset: 0;
}

.summary-marker {
  position: relative;
  display: block;
  width: 120px;
  max-width: 120px;
  border: 1px solid rgba(20, 32, 27, 0.12);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.96);
  box-shadow: 0 12px 28px rgba(21, 32, 28, 0.2);
  padding: 7px 10px;
  color: var(--ink);
  text-align: center;
  transform: translateY(-6px);
  transition: border-color 0.14s ease, box-shadow 0.14s ease, transform 0.14s ease;
}

.summary-marker::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -7px;
  width: 12px;
  height: 12px;
  border-right: 1px solid rgba(20, 32, 27, 0.12);
  border-bottom: 1px solid rgba(20, 32, 27, 0.12);
  background: rgba(255, 255, 255, 0.96);
  transform: translateX(-50%) rotate(45deg);
}

.summary-marker.is-active {
  border-color: rgba(28, 117, 91, 0.46);
  box-shadow: 0 16px 34px rgba(18, 96, 72, 0.26);
  transform: translateY(-10px);
}

.summary-marker strong {
  display: block;
  overflow: hidden;
  color: var(--ink);
  font-size: 13px;
  line-height: 1.25;
  text-overflow: ellipsis;
  white-space: nowrap;
  word-break: keep-all;
}

.summary-map-canvas > span {
  position: absolute;
  left: 16px;
  bottom: 16px;
  border-radius: 8px;
  padding: 7px 10px;
  background: rgba(255, 255, 255, 0.86);
  color: var(--primary-strong);
  font-size: 12px;
  font-weight: 850;
  box-shadow: var(--shadow-soft);
}

.map-side-panel {
  align-self: stretch;
  max-height: calc(100vh - 160px);
  overflow: auto;
}

.map-location-list {
  display: grid;
  gap: 9px;
}

.map-location-item {
  width: 100%;
  display: grid;
  gap: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  color: var(--ink);
  text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease, transform 0.14s ease;
}

.map-location-item:hover,
.map-location-item:focus-visible,
.map-location-item.is-active {
  border-color: #b7d8ca;
  background: #f7fcf9;
  outline: none;
  transform: translateY(-1px);
}

.map-location-item.is-active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.map-location-item strong {
  font-size: 14px;
  line-height: 1.35;
}

.map-location-item span {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.map-location-item small {
  justify-self: start;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary-strong);
  padding: 4px 8px;
  font-size: 12px;
  font-weight: 800;
}

.report-main-panel,
.report-side-panel {
  display: grid;
  gap: 16px;
}

.report-section {
  display: grid;
  gap: 10px;
}

.report-timeline {
  display: grid;
  gap: 9px;
}

.report-day {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr) 58px;
  gap: 10px;
  align-items: center;
  border: 1px solid rgba(20, 32, 27, 0.07);
  border-radius: 8px;
  background: #ffffff;
  padding: 10px;
}

.report-day span,
.report-day strong {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.report-day strong {
  color: var(--ink);
  text-align: right;
}

.report-day-bars {
  position: relative;
  min-width: 0;
  height: 10px;
  border-radius: 999px;
  background: #edf4f0;
  overflow: hidden;
}

.report-day-bars i,
.report-day-bars b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.report-day-bars i {
  background: rgba(23, 107, 83, 0.28);
}

.report-day-bars b {
  background: rgba(212, 76, 58, 0.58);
}

.report-finding-list,
.report-risk-list,
.report-dimension-list,
.report-breakdown {
  display: grid;
  gap: 9px;
}

.report-finding,
.report-risk-item,
.report-dimension-item,
.report-breakdown div {
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: #ffffff;
  padding: 12px;
}

.report-finding {
  border-left: 4px solid var(--blue);
}

.report-finding.warning {
  border-left-color: var(--danger);
}

.report-finding.normal {
  border-left-color: var(--primary);
}

.report-finding strong,
.report-risk-item strong,
.report-dimension-item strong,
.report-breakdown strong {
  display: block;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.35;
}

.report-finding p,
.report-risk-item span,
.report-dimension-item span,
.report-breakdown span {
  display: block;
  margin-top: 5px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.report-progress {
  position: relative;
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #edf3ef;
  margin-top: 9px;
}

.report-progress i,
.report-progress b {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: 999px;
}

.report-progress i {
  background: rgba(23, 107, 83, 0.34);
}

.report-progress b {
  background: rgba(212, 76, 58, 0.58);
}

.report-breakdown {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.report-breakdown div {
  min-width: 0;
}

.report-breakdown strong {
  margin-top: 6px;
  font-size: 24px;
}

.summary-info-window {
  display: grid;
  gap: 5px;
  min-width: 210px;
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 10px 12px;
}

.summary-info-window strong,
.summary-info-window span,
.summary-info-window a {
  display: block;
}

.summary-info-window strong {
  color: var(--ink);
  font-size: 13px;
  line-height: 1.4;
}

.summary-info-window span {
  color: var(--muted);
  font-size: 12px;
}

.summary-info-window a {
  color: var(--blue);
  font-size: 12px;
  font-weight: 850;
  text-decoration: none;
}

.compact .record-card:nth-child(n + 4) {
  display: none;
}

.empty {
  padding: 18px;
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(23, 107, 83, 0.06), transparent 45%),
    var(--surface-soft);
  color: var(--muted);
  text-align: center;
}

.ai-answer {
  min-height: 250px;
  white-space: pre-wrap;
  line-height: 1.7;
}

.ai-chat-panel,
.ai-context-panel {
  min-height: 620px;
}

.ai-chat-panel {
  display: grid;
  grid-template-rows: auto minmax(280px, 1fr) auto auto;
  gap: 14px;
}

.ai-conversation {
  min-height: 330px;
  max-height: 58vh;
  display: grid;
  align-content: start;
  gap: 12px;
  overflow: auto;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(47, 111, 237, 0.05), transparent 34%),
    #fbfdfc;
}

.ai-message {
  max-width: 82%;
  display: grid;
  gap: 5px;
}

.ai-message span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.ai-message div {
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  padding: 12px 13px;
  background: #fff;
  line-height: 1.68;
  white-space: pre-wrap;
  box-shadow: 0 6px 14px rgba(17, 40, 31, 0.04);
}

.ai-message.user {
  justify-self: end;
}

.ai-message.user div {
  border-color: #c3d8ff;
  background: linear-gradient(180deg, #f7faff, #eef5ff);
}

.ai-message small {
  color: var(--muted);
  font-size: 11px;
}

.prompt-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.prompt-chips button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: #34433c;
  padding: 6px 11px;
  font-size: 13px;
  font-weight: 750;
  transition: background 0.14s ease, border-color 0.14s ease, transform 0.14s ease;
}

.prompt-chips button:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  transform: translateY(-1px);
}

.ai-composer {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: end;
}

.ai-composer textarea {
  min-height: 76px;
}

.context-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.context-list article {
  border: 1px solid rgba(20, 32, 27, 0.08);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
  box-shadow: 0 6px 14px rgba(17, 40, 31, 0.04);
}

.context-list span {
  color: var(--primary);
  font-size: 11px;
  font-weight: 850;
}

.context-list strong {
  display: block;
  margin-top: 5px;
  font-size: 14px;
}

.context-list p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.inline-filter {
  display: grid;
  grid-template-columns: auto minmax(160px, 240px);
  align-items: center;
  gap: 8px;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 22px;
  transform: translateX(-50%) translateY(20px);
  max-width: min(520px, calc(100vw - 32px));
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  padding: 12px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
  box-shadow: 0 12px 28px rgba(17, 40, 31, 0.24);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

@media (max-width: 980px) {
  html {
    scroll-padding-bottom: calc(128px + env(safe-area-inset-bottom));
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 5;
    height: auto;
    padding: 8px max(10px, env(safe-area-inset-left)) calc(8px + env(safe-area-inset-bottom)) max(10px, env(safe-area-inset-right));
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    gap: 0;
  }

  .sidebar .brand,
  .sidebar-summary,
  .sidebar .account-box {
    display: none;
  }

  .nav-tabs {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }

  .nav-tabs::-webkit-scrollbar {
    display: none;
  }

  .nav-tab {
    flex: 1 0 58px;
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 3px;
    min-height: 50px;
    padding: 5px 4px;
    text-align: center;
    font-size: 12px;
  }

  .nav-tab::before {
    width: 25px;
    height: 25px;
  }

  .nav-tab span::before {
    display: none;
  }

  .workspace {
    padding: 14px 14px calc(132px + env(safe-area-inset-bottom));
  }

  .toast {
    bottom: calc(100px + env(safe-area-inset-bottom));
  }

  .mobile-account-box {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    margin: 0 0 12px;
    border: 1px solid rgba(20, 32, 27, 0.08);
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.82);
    box-shadow: var(--shadow-soft);
    padding: 10px 12px;
  }

  .mobile-account-box span {
    min-width: 0;
    color: var(--muted);
    font-size: 13px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar,
  .view {
    max-width: none;
  }

  .checkin-layout,
  .two-column,
  .task-layout,
  .search-layout,
  .report-dashboard,
  .map-dashboard,
  .ai-workbench {
    grid-template-columns: 1fr;
  }

  .right-rail {
    order: 0;
  }

  .summary-map-canvas {
    min-height: 520px;
  }

  .map-side-panel {
    max-height: none;
  }
}

@media (max-width: 640px) {
  input,
  select,
  textarea,
  button {
    font-size: 16px;
  }

  body {
    background:
      linear-gradient(180deg, rgba(23, 107, 83, 0.06), transparent 190px),
      var(--bg);
  }

  .topbar {
    align-items: stretch;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 14px;
  }

  .top-actions,
  .global-search,
  .search-controls,
  .ai-composer {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .topbar h1 {
    font-size: 24px;
  }

  .panel {
    padding: 13px;
  }

  .map-visual {
    min-height: 190px;
  }

  .summary-map-canvas {
    min-height: 430px;
  }

  .panel-heading {
    align-items: flex-start;
    flex-direction: column;
  }

  .panel-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    justify-content: stretch;
  }

  .panel-actions .ghost-button,
  .panel-actions .status-pill {
    width: 100%;
    justify-content: center;
  }

  .task-toolbar,
  .task-file-row,
  .task-card header,
  .task-card dl,
  .selected-task-box,
  .selected-remediation-box,
  .pending-checkin-head {
    grid-template-columns: 1fr;
  }

  .task-file-row .ghost-button {
    width: 100%;
  }

  .task-title-row {
    flex-wrap: wrap;
  }

  .task-card {
    padding: 12px;
  }

  .record-card header,
  .remediation-card header {
    flex-direction: column;
  }

  .record-card-badges {
    justify-content: flex-start;
  }

  .remediation-action {
    width: 100%;
  }

  .remediation-actions {
    width: 100%;
  }

  .task-card-actions,
  .task-card select,
  .task-start-button,
  .selected-task-box .ghost-button,
  .selected-remediation-box .ghost-button,
  .pending-checkin-head button {
    width: 100%;
  }

  .pending-checkin-card {
    grid-template-columns: 1fr;
  }

  .pending-checkin-actions {
    justify-self: start;
    justify-content: flex-start;
  }

  .task-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .builder-row {
    grid-template-columns: 1fr;
  }

  .builder-row .options-input {
    grid-column: auto;
  }

  .location-box {
    grid-template-columns: 1fr;
    gap: 14px;
    padding: 13px;
  }

  .location-actions,
  .manual-location-actions {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .manual-location-grid {
    grid-template-columns: 1fr;
  }

  .place-search {
    grid-template-columns: 1fr;
  }

  .place-results {
    max-height: 320px;
  }

  .place-result {
    min-height: 76px;
    padding: 13px;
  }

  .place-result small {
    grid-column: 1 / -1;
    justify-self: start;
  }

  .photo-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .record-location-preview {
    min-height: 0;
  }

  .record-location-summary {
    min-height: 42px;
    padding: 9px 10px;
  }

  .record-location-overlay {
    grid-template-columns: 1fr;
  }

  .record-mini-map {
    height: 76px;
  }

  .record-location-nav {
    width: auto;
  }

  .summary-marker {
    width: 112px;
    max-width: 112px;
    padding: 6px 9px;
  }

  .inline-filter {
    width: 100%;
    grid-template-columns: 1fr;
  }

  .insight-list {
    grid-template-columns: 1fr;
  }

  .ai-message {
    max-width: 100%;
  }

  .ai-chat-panel,
  .ai-context-panel {
    min-height: auto;
  }

  .ai-conversation {
    min-height: 240px;
    max-height: none;
  }

  .draft-field-list div {
    grid-template-columns: 1fr;
  }

  .draft-field-list span {
    justify-self: start;
  }

  .record-values div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
