:root {
  color-scheme: light;
  --bg: #eef3f1;
  --surface: #ffffff;
  --surface-soft: #f7faf9;
  --line: #d9e3df;
  --text: #182521;
  --muted: #65746f;
  --primary: #17694f;
  --primary-dark: #0d4d3a;
  --primary-soft: #dff1ea;
  --blue: #2563eb;
  --amber: #b7791f;
  --red: #b42318;
  --shadow: 0 18px 45px rgba(30, 50, 44, 0.08);
  --radius: 8px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-width: 320px;
  background: var(--bg);
}

body {
  margin: 0;
  color: var(--text);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.75), rgba(238, 243, 241, 0.9) 280px),
    var(--bg);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 18px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 14px 0;
}

.brand {
  display: flex;
  align-items: center;
  min-width: 0;
  gap: 12px;
}

.brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border-radius: var(--radius);
  color: #ffffff;
  background: linear-gradient(135deg, #17694f, #2d7e95);
  font-weight: 800;
  letter-spacing: 0;
}

.brand strong,
.brand span {
  display: block;
}

.brand strong {
  font-size: 1rem;
}

.brand span {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-actions {
  flex: 0 0 auto;
}

.tabs {
  display: flex;
  gap: 6px;
  padding: 6px;
  margin: 6px 0 24px;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.72);
}

.tab {
  min-height: 40px;
  padding: 0 14px;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  white-space: nowrap;
}

.tab.active {
  color: var(--text);
  background: #ffffff;
  box-shadow: 0 1px 2px rgba(20, 30, 27, 0.08);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.screen-title {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: end;
  margin-bottom: 18px;
}

.screen-title.compact {
  align-items: start;
}

.screen-title h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3vw, 2.35rem);
  line-height: 1.08;
  letter-spacing: 0;
}

.screen-title p {
  max-width: 520px;
  margin: 0;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--primary);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

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

.work-grid {
  display: grid;
  grid-template-columns: minmax(330px, 0.86fr) minmax(480px, 1.14fr);
  gap: 18px;
  align-items: stretch;
}

.form-panel,
.detail-panel,
.lookup-panel,
.status-result,
.login-panel,
.public-list-panel,
.list-panel,
.map-panel,
.roadmap-panel {
  padding: 18px;
}

.operator-toolbar {
  display: grid;
  grid-template-columns: minmax(160px, 220px) minmax(240px, 420px);
  gap: 12px;
  align-items: center;
  padding: 14px 18px;
  margin-bottom: 18px;
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.field {
  display: grid;
  gap: 7px;
}

.field.two-columns {
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

label {
  color: #30433d;
  font-size: 0.88rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid #c8d6d1;
  border-radius: 7px;
  color: var(--text);
  background: #ffffff;
  outline: none;
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(23, 105, 79, 0.14);
}

.hint,
.muted {
  color: var(--muted);
}

.hint {
  font-size: 0.78rem;
  text-align: right;
}

.inline-control {
  display: flex;
  gap: 8px;
}

.inline-control input {
  min-width: 0;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 42px;
  padding: 0 14px;
  border: 1px solid transparent;
  border-radius: 7px;
  font-weight: 800;
  text-decoration: none;
  white-space: nowrap;
}

.button.primary {
  color: #ffffff;
  background: var(--primary);
}

.button.primary:hover {
  background: var(--primary-dark);
}

.button.secondary {
  color: var(--primary-dark);
  border-color: #b9d7cc;
  background: var(--primary-soft);
}

.button.ghost {
  color: var(--text);
  border-color: var(--line);
  background: rgba(255, 255, 255, 0.68);
}

.button.wide {
  width: 100%;
}

.notice,
.duplicate-box,
.location-summary {
  border: 1px solid #cce2d9;
  border-radius: var(--radius);
  background: #f0f8f5;
}

.notice.success {
  border-color: #9bd4bd;
  background: #e8f8f0;
  color: #145039;
}

.notice.warning {
  border-color: #efd89d;
  background: #fff9e8;
  color: #624313;
}

.notice.error {
  border-color: #f3b5aa;
  background: #fff0ed;
  color: #7a271a;
}

.notice,
.duplicate-box {
  padding: 11px 12px;
  color: #244a3e;
  font-size: 0.9rem;
  line-height: 1.45;
}

.image-preview,
.detail-photo {
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid #cce2d9;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.image-preview img,
.detail-photo img {
  display: block;
  width: 100%;
  max-height: 260px;
  object-fit: cover;
  border-radius: 6px;
  border: 1px solid #d7e2de;
}

.detail-photo {
  margin-top: 10px;
}

.detail-photo span,
.image-preview span {
  color: var(--muted);
  font-size: 0.84rem;
}

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

.timeline-item {
  display: grid;
  grid-template-columns: 12px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 0 0 4px rgba(23, 105, 79, 0.12);
}

.timeline-body {
  padding-bottom: 10px;
  border-bottom: 1px solid #edf2f0;
}

.timeline-body strong,
.timeline-body span {
  display: block;
}

.timeline-body strong {
  font-size: 0.92rem;
}

.timeline-body span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 0.78rem;
}

.timeline-body p {
  margin: 5px 0 0;
  color: #334741;
  line-height: 1.4;
}

.duplicate-box {
  border-color: #efd89d;
  background: #fff9e8;
  color: #624313;
}

.location-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
}

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

.location-summary span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.location-summary strong {
  margin-top: 3px;
  font-size: 0.95rem;
}

.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.panel-head h2,
.detail-header h2,
.roadmap-panel h2 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.map {
  position: relative;
  height: 560px;
  min-height: 360px;
  overflow: hidden;
  border: 1px solid #c7d6d1;
  border-radius: var(--radius);
  background:
    linear-gradient(115deg, transparent 0 44%, rgba(255, 255, 255, 0.58) 44% 47%, transparent 47%),
    linear-gradient(35deg, transparent 0 48%, rgba(145, 163, 157, 0.26) 48% 50%, transparent 50%),
    linear-gradient(90deg, rgba(65, 91, 83, 0.12) 1px, transparent 1px),
    linear-gradient(0deg, rgba(65, 91, 83, 0.12) 1px, transparent 1px),
    #d9e7e5;
  background-size: 520px 420px, 420px 360px, 96px 96px, 96px 96px, auto;
  user-select: none;
  touch-action: none;
}

.small-map {
  height: 390px;
  min-height: 320px;
}

.map-tile-pane,
.map-marker-pane {
  position: absolute;
  inset: 0;
}

.map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  max-width: none;
}

.map-marker {
  position: absolute;
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border: 3px solid #ffffff;
  border-radius: 999px;
  background: var(--primary);
  box-shadow: 0 3px 10px rgba(15, 23, 42, 0.3);
  transform: translate(-50%, -50%);
}

.map-marker.selected {
  width: 28px;
  height: 28px;
  outline: 3px solid rgba(37, 99, 235, 0.28);
}

.map-marker-button {
  border: 0;
  padding: 0;
}

.map-controls {
  position: absolute;
  top: 10px;
  right: 10px;
  display: grid;
  gap: 6px;
  z-index: 4;
}

.map-controls button {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(40, 59, 54, 0.18);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.94);
  font-size: 1.2rem;
  font-weight: 900;
}

.map-attribution {
  position: absolute;
  right: 8px;
  bottom: 8px;
  z-index: 4;
  padding: 3px 6px;
  border-radius: 5px;
  color: #22312d;
  background: rgba(255, 255, 255, 0.88);
  font-size: 0.72rem;
}

.map-attribution a {
  color: #123f80;
}

.map-hint {
  position: absolute;
  left: 10px;
  top: 10px;
  z-index: 4;
  max-width: min(310px, calc(100% - 72px));
  padding: 8px 10px;
  border-radius: 7px;
  color: #28423a;
  background: rgba(255, 255, 255, 0.92);
  font-size: 0.82rem;
  box-shadow: 0 2px 8px rgba(20, 30, 27, 0.1);
}

.status-layout {
  display: grid;
  grid-template-columns: minmax(300px, 460px) 1fr;
  gap: 18px;
  align-items: start;
}

.login-panel {
  display: grid;
  gap: 14px;
  width: min(440px, 100%);
}

.public-map-layout {
  display: grid;
  grid-template-columns: minmax(520px, 1fr) minmax(320px, 420px);
  gap: 18px;
  align-items: start;
}

.public-map {
  height: 620px;
}

.filters.vertical {
  grid-template-columns: 1fr;
}

.public-list-panel {
  display: grid;
  gap: 12px;
}

.public-selected {
  min-height: 110px;
  padding: 12px;
  border: 1px solid #d7e2de;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.public-selected h2 {
  margin: 0 0 8px;
  font-size: 1rem;
}

.public-selected p {
  margin: 5px 0;
  color: #334741;
  line-height: 1.4;
}

.public-report-list {
  max-height: 410px;
}

.status-card {
  display: grid;
  gap: 14px;
}

.status-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 9px;
  border-radius: 999px;
  color: #0f2f25;
  background: #e4f2ec;
  font-size: 0.8rem;
  font-weight: 800;
}

.badge.status-new {
  color: #17406b;
  background: #e4effa;
}

.badge.status-triage {
  color: #624313;
  background: #fff0c8;
}

.badge.status-assigned {
  color: #233876;
  background: #e4e9ff;
}

.badge.status-in_progress {
  color: #315b23;
  background: #e8f6df;
}

.badge.status-done {
  color: #145039;
  background: #dbf4e8;
}

.badge.status-field_done {
  color: #315b23;
  background: #e8f6df;
}

.badge.status-needs_more {
  color: #7a3e08;
  background: #fff0c8;
}

.badge.status-rejected {
  color: #7a271a;
  background: #fde8e4;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(130px, 1fr));
  gap: 10px;
  margin-bottom: 18px;
}

.stat {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
}

.stat strong {
  display: block;
  font-size: 1.55rem;
}

.stat span {
  color: var(--muted);
  font-size: 0.82rem;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(360px, 1fr) minmax(330px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.field-layout {
  display: grid;
  grid-template-columns: minmax(330px, 0.9fr) minmax(360px, 1fr) minmax(330px, 0.9fr);
  gap: 18px;
  align-items: start;
}

.filters {
  display: grid;
  grid-template-columns: 1fr 155px 155px;
  gap: 8px;
  margin-bottom: 12px;
}

.report-list {
  display: grid;
  gap: 9px;
  max-height: 590px;
  overflow: auto;
  padding-right: 3px;
}

.report-card {
  display: grid;
  gap: 9px;
  width: 100%;
  padding: 12px;
  border: 1px solid #d7e2de;
  border-radius: var(--radius);
  background: #ffffff;
  text-align: left;
}

.report-card:hover,
.report-card.active {
  border-color: #83bba7;
  box-shadow: 0 0 0 3px rgba(23, 105, 79, 0.1);
}

.report-card-top,
.report-card-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.report-card-top strong {
  font-size: 0.96rem;
}

.report-card p {
  display: -webkit-box;
  margin: 0;
  overflow: hidden;
  color: #3a4d47;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  line-height: 1.38;
}

.report-card-meta {
  color: var(--muted);
  font-size: 0.82rem;
}

.detail-panel {
  min-height: 390px;
}

.detail-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.detail-meta {
  display: grid;
  gap: 8px;
  margin-bottom: 14px;
  padding: 12px;
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: #334741;
  line-height: 1.45;
}

.empty-state {
  display: grid;
  min-height: 330px;
  place-items: center;
  color: var(--muted);
  text-align: center;
}

.operator-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(250px, 1fr));
  gap: 18px;
  margin-bottom: 18px;
}

.municipality-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.municipality-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.municipality-mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: var(--radius);
  color: #ffffff;
  background: #2d7e95;
  font-weight: 900;
}

.municipality-card h2 {
  margin: 0;
  font-size: 1rem;
}

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

.settings-list {
  display: grid;
  gap: 7px;
  color: #334741;
  font-size: 0.9rem;
}

.settings-list div,
.roadmap div {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  border-top: 1px solid #edf2f0;
  padding-top: 8px;
}

.settings-list span {
  color: var(--muted);
}

.roadmap {
  display: grid;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  gap: 10px;
  margin-top: 12px;
}

.operator-report-list {
  max-height: 520px;
  margin-top: 12px;
}

.roadmap div {
  display: grid;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.roadmap span {
  margin-top: 5px;
  color: var(--muted);
  line-height: 1.42;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 20;
  display: none;
  max-width: min(420px, calc(100vw - 36px));
  padding: 12px 14px;
  border-radius: var(--radius);
  color: #ffffff;
  background: #18362d;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.22);
  line-height: 1.4;
}

.toast.visible {
  display: block;
}

.hidden {
  display: none !important;
}

@media (max-width: 1180px) {
  .work-grid,
  .admin-layout,
  .field-layout,
  .status-layout,
  .public-map-layout {
    grid-template-columns: 1fr;
  }

  .stats-grid,
  .operator-grid,
  .roadmap {
    grid-template-columns: repeat(2, minmax(180px, 1fr));
  }

  .admin-map-panel {
    order: 3;
  }
}

@media (max-width: 720px) {
  .app-shell {
    width: min(100vw - 20px, 1480px);
    padding-top: 8px;
  }

  .topbar,
  .screen-title,
  .location-summary,
  .detail-header {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .top-actions .button,
  .location-summary .button,
  .detail-header .button {
    width: 100%;
  }

  .screen-title h1 {
    font-size: 1.55rem;
  }

  .field.two-columns,
  .filters,
  .operator-toolbar,
  .stats-grid,
  .operator-grid,
  .roadmap {
    grid-template-columns: 1fr;
  }

  .inline-control {
    flex-direction: column;
  }

  .map {
    height: 430px;
  }

  .small-map {
    height: 360px;
  }

  .public-map {
    height: 430px;
  }
}
