:root {
  --bg: #f4f7fb;
  --panel: #ffffff;
  --text: #172033;
  --muted: #67748a;
  --line: #dbe3ef;
  --blue: #2563eb;
  --blue-soft: #eaf1ff;
  --green: #16a34a;
  --amber: #d97706;
  --red: #dc2626;
  --gray: #64748b;
  --shadow: 0 14px 36px rgba(19, 37, 68, .08);
}

* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}
button, input, select { font: inherit; }
button { cursor: pointer; }

.auth-gate {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 20px;
  background: #f4f7fb;
}
.auth-gate[hidden] {
  display: none;
}
.auth-box {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  box-shadow: var(--shadow);
  padding: 22px;
}
.auth-box strong {
  display: block;
  font-size: 21px;
  color: var(--text);
}
.auth-box p {
  margin: 8px 0 16px;
  color: var(--muted);
  line-height: 1.45;
  font-weight: 650;
}
.auth-box label {
  display: grid;
  gap: 6px;
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}
.auth-box input {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 11px;
}
.auth-box button {
  width: 100%;
  margin-top: 12px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 11px 13px;
  font-weight: 900;
}
.auth-box span {
  display: block;
  min-height: 18px;
  margin-top: 10px;
  color: #be123c;
  font-size: 13px;
  font-weight: 800;
}

.admin-shell {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  min-height: 100vh;
}
.admin-shell[hidden] {
  display: none;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
  background: #111827;
  color: #fff;
  padding: 18px;
  border-right: 1px solid #0f172a;
}

.brand {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 10px;
  align-items: center;
  margin-bottom: 18px;
}
.brand span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--blue);
  font-weight: 950;
}
.brand strong { display: block; font-size: 18px; }
.brand em { display: block; margin-top: 2px; color: #a8b3c7; font-style: normal; font-size: 12px; }

.primary-action,
.top-actions button,
.panel-head button,
.map-empty button,
.modal-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 10px 13px;
  font-weight: 900;
}
.primary-action { width: 100%; margin-bottom: 14px; }

.nav-menu {
  display: grid;
  gap: 4px;
  margin-bottom: 18px;
}
.nav-menu a {
  color: #cbd5e1;
  text-decoration: none;
  border-radius: 8px;
  padding: 11px 12px;
  font-weight: 850;
}
.nav-menu a.active,
.nav-menu a:hover {
  color: #fff;
  background: rgba(255, 255, 255, .1);
}

.side-box {
  border: 1px solid rgba(255, 255, 255, .12);
  background: rgba(255, 255, 255, .06);
  border-radius: 8px;
  padding: 14px;
}
.side-box h2 { margin: 0 0 8px; font-size: 15px; }
.side-box p { margin: 0; color: #cbd5e1; line-height: 1.55; font-size: 13px; }

.main { padding: 22px; min-width: 0; }
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 18px;
  margin-bottom: 16px;
}
.eyebrow {
  margin: 0 0 5px;
  color: var(--blue);
  font-size: 12px;
  font-weight: 950;
  letter-spacing: .08em;
}
h1 { margin: 0; font-size: 28px; letter-spacing: 0; }
.topbar p:not(.eyebrow) {
  margin: 8px 0 0;
  max-width: 820px;
  color: var(--muted);
  line-height: 1.55;
  font-weight: 650;
}
.top-actions { display: flex; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.top-actions .ghost-danger,
.ghost-danger {
  background: #fff1f2;
  color: #be123c;
  border: 1px solid #fecdd3;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 14px;
}
.metric-card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.metric-card { padding: 17px; }
.metric-card[role="button"] {
  cursor: pointer;
  transition: transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.metric-card[role="button"]:hover,
.metric-card[role="button"]:focus-visible {
  border-color: rgba(37, 99, 235, .45);
  box-shadow: 0 16px 42px rgba(19, 37, 68, .12);
  transform: translateY(-1px);
  outline: none;
}
.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
}
.metric-card strong {
  display: block;
  margin-top: 8px;
  font-size: 30px;
  color: #0f3f8f;
}
.metric-card p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.workspace-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(360px, .65fr);
  gap: 14px;
  margin-bottom: 14px;
}
.workspace-grid.lower { grid-template-columns: minmax(0, 1fr) minmax(380px, .72fr); }
.panel { padding: 16px; min-width: 0; }
.panel-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}
.panel-head h2 { margin: 0; font-size: 20px; }
.panel-head p { margin: 6px 0 0; color: var(--muted); line-height: 1.45; font-weight: 650; }
.section-kicker {
  display: block;
  margin-bottom: 5px;
  color: var(--blue);
  font-size: 11px;
  font-weight: 950;
  letter-spacing: .08em;
}
.panel-head select {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 9px 11px;
  font-weight: 850;
}

.map-stage {
  position: relative;
  min-height: 450px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5ff;
  background-size: 42px 42px;
}
.fallback-map,
.naver-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.fallback-map {
  z-index: 1;
  overflow: hidden;
  background: #e5edf8;
  cursor: grab;
}
.fallback-map.is-dragging {
  cursor: grabbing;
}
.fallback-tile-layer,
.fallback-marker-layer {
  position: absolute;
  inset: 0;
}
.fallback-map-tile {
  position: absolute;
  width: 256px;
  height: 256px;
  user-select: none;
}
.fallback-map-controls {
  position: absolute;
  right: 12px;
  top: 12px;
  z-index: 6;
  display: grid;
  overflow: hidden;
  border: 1px solid rgba(203, 213, 225, .95);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 18px rgba(15, 23, 42, .16);
}
.fallback-map-controls button {
  width: 36px;
  height: 34px;
  border: 0;
  background: #fff;
  color: #0f172a;
  font-size: 20px;
  font-weight: 900;
  cursor: pointer;
}
.fallback-map-controls button + button {
  border-top: 1px solid rgba(203, 213, 225, .95);
}
.fallback-map-controls button:hover,
.fallback-map-controls button:focus-visible {
  background: #f1f5f9;
}
.fallback-marker-hit {
  position: absolute;
  z-index: 4;
  width: 30px;
  height: 30px;
  border: 0;
  padding: 0;
  border-radius: 999px 999px 999px 4px;
  background: #dc2626;
  box-shadow: 0 8px 18px rgba(127, 29, 29, .3);
  cursor: pointer;
  transform: translate(-50%, -100%) rotate(-45deg);
}
.fallback-marker-hit::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: #fff;
  transform: translate(-50%, -50%);
}
.fallback-marker-hit:focus-visible {
  outline: 3px solid rgba(37, 99, 235, .65);
  outline-offset: 3px;
}
.fallback-site-card {
  position: absolute;
  right: 16px;
  top: 16px;
  z-index: 5;
  width: min(430px, calc(100% - 32px));
  max-height: calc(100% - 96px);
  overflow: auto;
  padding: 14px;
  border: 1px solid rgba(203, 213, 225, .95);
  border-radius: 8px;
  background: rgba(255, 255, 255, .97);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .18);
}
.fallback-site-card-close {
  position: absolute;
  right: 10px;
  top: 10px;
  border: 1px solid rgba(203, 213, 225, .95);
  border-radius: 6px;
  background: #fff;
  color: #334155;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
}
.fallback-site-card-close:hover,
.fallback-site-card-close:focus-visible {
  color: #0f172a;
  border-color: #94a3b8;
}
.fallback-site-card strong {
  display: block;
  padding-right: 54px;
  color: #14213d;
  font-size: 16px;
  line-height: 1.25;
}
.fallback-site-card p {
  margin: 5px 0 12px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.35;
}
.fallback-site-card > div {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.fallback-site-card > div > div {
  min-width: 0;
  padding: 9px 10px;
  border: 1px solid rgba(226, 232, 240, .95);
  border-radius: 8px;
  background: #f8fafc;
}
.fallback-site-card span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.fallback-site-card b {
  display: block;
  margin-top: 4px;
  overflow-wrap: anywhere;
  color: #111827;
  font-size: 13px;
  line-height: 1.25;
}
.naver-map {
  z-index: 2;
  background: #edf4ff;
  opacity: 0;
  pointer-events: none;
}
.map-stage.has-naver-map .naver-map {
  opacity: 1;
  pointer-events: auto;
}
.map-stage.has-naver-map .fallback-map {
  display: none;
}
.map-grid {
  position: absolute;
  inset: 0;
  z-index: 2;
  background:
    radial-gradient(circle at 28% 28%, rgba(22, 163, 74, .12), transparent 24%),
    radial-gradient(circle at 72% 68%, rgba(37, 99, 235, .12), transparent 26%);
}
.map-stage.has-fallback-map .map-grid,
.map-stage.has-naver-map .map-grid {
  display: none;
}
.map-stage.has-naver-map {
  background: #edf4ff;
}
.map-status {
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 14px;
  z-index: 5;
  border: 1px solid #fecdd3;
  border-radius: 8px;
  background: #fff1f2;
  color: #9f1239;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 850;
  text-align: center;
  box-shadow: 0 10px 24px rgba(15, 23, 42, .12);
}
.map-status[hidden] {
  display: none;
}
.map-empty {
  position: absolute;
  left: 50%;
  top: 50%;
  width: min(360px, calc(100% - 32px));
  transform: translate(-50%, -50%);
  z-index: 4;
  display: grid;
  place-content: center;
  justify-items: center;
  text-align: center;
  padding: 24px;
  border: 1px solid rgba(219, 227, 239, .9);
  border-radius: 8px;
  background: rgba(255, 255, 255, .92);
  box-shadow: 0 14px 34px rgba(15, 23, 42, .12);
}
.map-empty strong { font-size: 20px; }
.map-empty p { margin: 8px 0 14px; color: var(--muted); font-weight: 650; }
.map-marker {
  position: absolute;
  z-index: 6;
  transform: translate(14px, -50%);
  min-width: 148px;
  max-width: 210px;
  border: 1px solid rgba(203, 213, 225, .95);
  border-radius: 10px;
  background: rgba(255, 255, 255, .96);
  box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
  padding: 9px 12px;
  text-align: left;
  cursor: pointer;
}
.map-marker.is-left {
  transform: translate(calc(-100% - 14px), -50%);
}
.map-marker::after {
  display: none;
}
.map-marker b {
  display: block;
  font-size: 14px;
  line-height: 1.2;
  color: #14213d;
}
.map-marker span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  line-height: 1.25;
}
.map-marker i {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-right: 6px;
  vertical-align: 1px;
}
.map-marker.naver-info-marker {
  position: relative;
  transform: none;
  min-width: 150px;
  box-shadow: 0 8px 22px rgba(15, 23, 42, .12);
}
.map-marker.normal i, .legend .normal { background: var(--green); }
.map-marker.due i, .legend .due { background: var(--amber); }
.map-marker.late i, .legend .late { background: var(--red); }
.map-marker.report_missing i, .legend .report_missing { background: var(--gray); }
.legend {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 10px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.legend i {
  display: inline-block;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  margin-right: 5px;
}
.site-name-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: #14213d;
  font: inherit;
  font-weight: 850;
  text-align: left;
  cursor: pointer;
}
.site-name-link:hover,
.site-name-link:focus-visible {
  color: var(--primary);
  text-decoration: underline;
}

.empty-detail {
  min-height: 360px;
  display: grid;
  place-content: center;
  text-align: center;
  color: var(--muted);
}
.empty-detail strong { color: var(--text); font-size: 18px; }
.empty-detail p { max-width: 320px; line-height: 1.5; }
.detail-card { display: grid; gap: 12px; }
.detail-title {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--blue-soft);
  padding: 14px;
}
.detail-title strong { display: block; font-size: 21px; color: #123a7a; }
.detail-title span { display: block; margin-top: 5px; color: var(--muted); font-weight: 750; }
.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.detail-grid div,
.inspection-item,
.report-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 11px;
}
.detail-grid span,
.inspection-item span,
.report-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.detail-grid b,
.inspection-item b,
.report-item b {
  display: block;
  margin-top: 5px;
  color: var(--text);
}

.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 760px; }
th, td {
  border-bottom: 1px solid var(--line);
  padding: 11px 10px;
  text-align: left;
  font-size: 14px;
}
th {
  color: #334155;
  background: #f8fafc;
  font-size: 12px;
  font-weight: 950;
}
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f8fbff; }
.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 4px 9px;
  font-size: 12px;
  font-weight: 900;
}
.badge.normal { background: #dcfce7; color: #166534; }
.badge.due { background: #fef3c7; color: #92400e; }
.badge.today { background: #dbeafe; color: #1d4ed8; }
.badge.late { background: #fee2e2; color: #991b1b; }
.badge.scheduled { background: #e0f2fe; color: #075985; }
.badge.missing { background: #f1f5f9; color: #64748b; }
.badge.report_missing { background: #e2e8f0; color: #334155; }
.list-empty {
  display: none;
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 24px;
  text-align: center;
  color: var(--muted);
}
.list-empty strong { color: var(--text); }

.inspection-list,
.report-list {
  display: grid;
  gap: 8px;
}
.report-context {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  margin: 8px 0 14px;
}
.report-context label {
  display: grid;
  gap: 5px;
  min-width: min(420px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.report-context select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #fff;
}
.report-context span {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.report-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0 0 14px;
}
.report-tabs button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: #475569;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 900;
  cursor: pointer;
}
.report-tabs button.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}
.report-tab-panel {
  display: none;
}
.report-tab-panel.active {
  display: block;
}
#reports > .panel-head {
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 14px;
  margin-bottom: 14px;
}
#reports > .panel-head p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}
#reports .panel-actions {
  align-items: center;
}
#reports .report-context {
  align-items: center;
  background: #f8fbff;
  border-color: #bfdbfe;
  box-shadow: inset 4px 0 0 #2563eb;
  padding: 14px 16px;
}
#reports .report-context label {
  color: #1e3a8a;
  font-size: 12px;
  letter-spacing: 0;
}
#reports .report-context select {
  min-height: 42px;
  border-color: #bfdbfe;
  color: #0f172a;
  font-weight: 850;
}
#reports .report-context span {
  max-width: 560px;
  border: 1px solid #dbeafe;
  border-radius: 8px;
  background: #fff;
  padding: 10px 12px;
  color: #1e3a8a;
  font-weight: 800;
}
#reports .report-tabs {
  width: max-content;
  max-width: 100%;
  gap: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f1f5f9;
  padding: 4px;
  margin-bottom: 16px;
}
#reports .report-tabs button {
  min-width: 116px;
  border: 0;
  background: transparent;
  color: #475569;
  padding: 10px 14px;
}
#reports .report-tabs button.active {
  background: #fff;
  color: #1d4ed8;
  box-shadow: 0 1px 5px rgba(15, 23, 42, .12);
}
#reports .report-tab-panel.active {
  animation: reportFade .12s ease-out;
}
@keyframes reportFade {
  from { opacity: .65; transform: translateY(2px); }
  to { opacity: 1; transform: translateY(0); }
}
.inspection-item,
.report-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
}
.maintenance-summary {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 8px 0 16px;
}
.maintenance-summary article {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
}
.maintenance-summary span,
.maintenance-summary em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.maintenance-summary strong {
  display: block;
  margin: 6px 0 4px;
  color: var(--text);
  font-size: 24px;
}
.maintenance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.6fr) minmax(320px, .8fr);
  gap: 14px;
}
.maintenance-calendar-wrap,
.maintenance-agenda {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
.maintenance-calendar-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.maintenance-calendar-head strong {
  color: var(--text);
  font-size: 20px;
}
.maintenance-calendar-head span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.maintenance-calendar {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.maintenance-weekday {
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
  text-align: center;
  padding: 6px 0;
}
.maintenance-day {
  min-height: 104px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 8px;
}
.maintenance-day.is-empty {
  background: #f8fafc;
  opacity: .45;
}
.maintenance-day.is-today {
  border-color: #2563eb;
  box-shadow: inset 0 0 0 1px #2563eb;
}
.maintenance-day.has-alert {
  background: #fffbeb;
}
.maintenance-day.has-late {
  background: #fff1f2;
}
.maintenance-day > span {
  display: block;
  color: var(--text);
  font-size: 12px;
  font-weight: 900;
  margin-bottom: 6px;
}
.maintenance-day > div {
  display: grid;
  gap: 5px;
}
.maintenance-site-chip {
  width: 100%;
  min-width: 0;
  border: 0;
  border-radius: 6px;
  background: #e2e8f0;
  color: #334155;
  padding: 5px 6px;
  text-align: left;
  font-size: 12px;
  font-weight: 850;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.maintenance-site-chip.due {
  background: #fef3c7;
  color: #92400e;
}
.maintenance-site-chip.today {
  background: #dbeafe;
  color: #1d4ed8;
}
.maintenance-site-chip.late {
  background: #fee2e2;
  color: #991b1b;
}
.maintenance-site-chip.scheduled {
  background: #e0f2fe;
  color: #075985;
}
.maintenance-day em {
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.maintenance-alert-list {
  display: grid;
  gap: 8px;
}
.maintenance-alert-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}
.maintenance-alert-item span,
.maintenance-alert-item em {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 800;
}
.maintenance-alert-item b {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 15px;
}
.empty-list {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 22px;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}
.option-list { display: grid; gap: 10px; }
.option-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
  font-weight: 850;
}

.modal {
  border: 0;
  padding: 0;
  background: transparent;
}
.modal::backdrop { background: rgba(15, 23, 42, .45); }
.modal-box {
  width: min(860px, calc(100vw - 28px));
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, .28);
  padding: 18px;
}
.modal-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 12px;
  margin-bottom: 14px;
}
.modal-head h2 { margin: 0; }
.icon-btn,
.modal-actions .secondary {
  background: #f1f5f9;
  color: #334155;
}
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
}
.form-grid label {
  color: #475569;
  font-size: 13px;
  font-weight: 900;
}
.form-grid .checkbox-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  background: #f8fafc;
}
.form-grid .checkbox-field input {
  width: auto;
  margin-top: 0;
}
.form-grid input,
.form-grid select,
.form-grid textarea {
  width: 100%;
  margin-top: 5px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #fff;
}
.form-grid .checkbox-field input {
  width: auto;
  margin-top: 0;
}
.form-grid .full { grid-column: 1 / -1; }
.coordinate-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: -2px;
}
.coordinate-actions button {
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 9px 12px;
  font-size: 13px;
  font-weight: 900;
  white-space: nowrap;
}
.coordinate-actions button:disabled {
  cursor: wait;
  opacity: .65;
}
.coordinate-actions span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.coordinate-actions span.error {
  color: #be123c;
}
.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 10;
  background: #111827;
  color: #fff;
  border-radius: 8px;
  padding: 12px 15px;
  box-shadow: var(--shadow);
  font-weight: 850;
}

@media (max-width: 1180px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  .metric-grid,
  .workspace-grid,
  .workspace-grid.lower { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .main { padding: 14px; }
  .topbar { display: block; }
  .top-actions { justify-content: flex-start; margin-top: 12px; }
  .metric-grid,
  .detail-grid,
  .form-grid { grid-template-columns: 1fr; }
  .map-stage { min-height: 360px; }
  .fallback-site-card {
    left: 12px;
    right: 12px;
    top: 12px;
    width: auto;
  }
  .fallback-site-card > div { grid-template-columns: 1fr; }
  .panel-head { display: block; }
  .panel-head select,
  .panel-head button { margin-top: 10px; width: 100%; }
  .coordinate-actions {
    align-items: stretch;
    flex-direction: column;
  }
}

.evidence-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}
.evidence-card ul {
  margin: 8px 0 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.65;
  font-weight: 750;
}
.panel-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.secondary-inline {
  background: #eef2ff !important;
  color: #1d4ed8 !important;
  border: 1px solid #c7d2fe !important;
}
.actions-cell {
  white-space: nowrap;
}
.mini-btn {
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 7px 9px;
  font-size: 12px;
  font-weight: 900;
}
.mini-btn + .mini-btn {
  margin-left: 5px;
}
.mini-btn.danger {
  background: #fff1f2;
  color: #be123c;
  border-color: #fecdd3;
}
.workspace-grid.lower.single {
  grid-template-columns: 1fr;
}
.trash-list {
  display: grid;
  gap: 8px;
}
.trash-item {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 12px;
}
.trash-item span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}
.trash-item b {
  display: block;
  margin-top: 4px;
  color: var(--text);
}
.trash-item p {
  margin: 5px 0 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}
.trash-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

@media (max-width: 1180px) {
  .evidence-grid { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .panel-actions,
  .trash-item,
  .trash-actions {
    display: grid;
    justify-content: stretch;
  }
  .mini-btn + .mini-btn {
    margin-left: 0;
    margin-top: 6px;
  }
}

/* 페이지 분리: 대시보드, 리포트, 임시 보관함, 옵션을 한 화면에 모두 펼치지 않음 */
.page-section {
  display: none;
}
.page-section.is-active {
  display: block;
}

.report-section-intro,
.report-section-subhead {
  display: grid;
  gap: 4px;
  margin: 4px 0 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbff;
  border-left: 4px solid #94a3b8;
}
.report-section-intro b,
.report-section-subhead b {
  color: var(--text);
  font-size: 15px;
}
.report-section-intro span,
.report-section-subhead span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}
.report-upload-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.report-publish-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(240px, 1fr));
  gap: 14px;
  margin-bottom: 16px;
}
.publish-card {
  position: relative;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 16px 16px 16px 18px;
  overflow: hidden;
}
.publish-card::before,
.report-upload-grid .evidence-card::before {
  content: "";
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 4px;
  background: #2563eb;
}
.publish-card:nth-child(2)::before {
  background: #7c3aed;
}
.publish-card:nth-child(3)::before,
#testEvidence::before {
  background: #b45309;
}
#installationEvidence::before {
  background: #0f766e;
}
.publish-card h3 {
  margin: 0;
  color: var(--text);
  font-size: 18px;
}
.publish-card p {
  min-height: 0;
  margin: 0 0 8px;
  color: var(--muted);
  line-height: 1.5;
  font-size: 13px;
  font-weight: 750;
}
.publish-card button {
  width: 100%;
  min-height: 40px;
  border: 0;
  border-radius: 8px;
  background: var(--blue);
  color: #fff;
  padding: 10px 12px;
  font-weight: 900;
  cursor: pointer;
}
.report-upload-grid .evidence-card {
  position: relative;
  overflow: hidden;
  box-shadow: none;
  background: #fff;
  padding-left: 18px;
}
.report-upload-grid .evidence-card .panel-head {
  display: grid;
  align-items: start;
  gap: 12px;
}
.report-upload-grid .evidence-card h2 {
  font-size: 18px;
}
.report-upload-grid .evidence-card p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}
.report-upload-grid .evidence-card button {
  width: 100%;
  min-height: 40px;
}
.report-upload-grid .evidence-card ul {
  margin-top: 12px;
  padding-left: 18px;
  color: #475569;
  font-size: 13px;
  font-weight: 750;
  line-height: 1.55;
}

.sensor-option-panel,
.sensor-dashboard-panel,
.customer-report-panel {
  margin-top: 18px;
  border-top: 1px solid var(--line);
  padding-top: 18px;
}
#reports .customer-report-panel {
  border: 1px solid #dbe3ef;
  border-radius: 8px;
  background: #fff;
  padding: 14px;
}
#reports .customer-report-panel .report-section-intro {
  margin-top: 0;
  background: #f8fafc;
  border-left-color: #0f766e;
}
#reports .sensor-report-controls {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
  padding: 12px;
  margin-bottom: 12px;
}
#reports .sensor-report-controls label {
  display: grid;
  gap: 5px;
  min-width: min(420px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
#reports .sensor-report-controls select {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
  color: var(--text);
  font-weight: 850;
}
#reports .sensor-report-controls button {
  min-height: 42px;
}
.report-final-action {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: #f8fafc;
  padding: 14px;
  margin-top: 16px;
}
.report-final-action div {
  display: grid;
  gap: 4px;
}
.report-final-action b {
  color: var(--text);
  font-size: 15px;
}
.report-final-action span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  line-height: 1.45;
}
.report-final-action button {
  min-height: 42px;
  white-space: nowrap;
}
.sensor-option-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}
.sensor-option-head h3 {
  margin: 0;
  font-size: 18px;
  color: var(--text);
}
.sensor-option-head p {
  margin: 6px 0 0;
  color: var(--muted);
  line-height: 1.45;
}
.sensor-summary {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 14px 0;
}
.sensor-summary span,
.sensor-state {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  padding: 4px 10px;
  background: #eef2f7;
  color: #334155;
  font-size: 12px;
  font-weight: 800;
}
.sensor-state.online { background: #dcfce7; color: #166534; }
.sensor-state.delayed,
.sensor-state.caution { background: #fef3c7; color: #92400e; }
.sensor-state.offline,
.sensor-state.danger { background: #fee2e2; color: #991b1b; }
.sensor-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 12px;
}
.sensor-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}
.sensor-card-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: flex-start;
}
.sensor-card-head strong {
  display: block;
  color: var(--text);
  font-size: 15px;
}
.sensor-card-head span,
.sensor-updated,
.sensor-alert {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.sensor-values {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.sensor-live-block {
  margin-top: 12px;
}
.sensor-live-title {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
}
.sensor-live-title strong {
  color: var(--text);
  font-size: 14px;
}
.sensor-live-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.sensor-install-info {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.sensor-values div,
.sensor-install-info div {
  min-width: 0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 9px 10px;
}
.sensor-values span,
.sensor-install-info span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
}
.sensor-values strong,
.sensor-install-info strong {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 14px;
  overflow-wrap: anywhere;
}
.sensor-updated {
  margin: 10px 0 0;
}
.sensor-alert {
  margin: 8px 0 0;
  color: #92400e;
}
.customer-report-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 14px 0 18px;
}
.sensor-report-controls {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  margin: 12px 0 14px;
}
.sensor-report-controls label {
  display: grid;
  gap: 5px;
  min-width: min(360px, 100%);
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}
.sensor-report-controls select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  color: var(--text);
  background: #fff;
}
.customer-report-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfdff;
  padding: 14px;
}
.customer-report-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: flex-start;
}
.customer-report-head h3 {
  margin: 0;
  color: var(--text);
  font-size: 17px;
}
.customer-report-head span,
.customer-report-card p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.customer-report-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}
.customer-report-metrics div {
  min-width: 0;
  border-radius: 8px;
  background: #f8fafc;
  padding: 10px;
}
.customer-report-metrics span,
.customer-report-metrics em {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-style: normal;
  font-weight: 800;
}
.customer-report-metrics strong {
  display: block;
  margin: 4px 0;
  color: var(--text);
  font-size: 16px;
}

@media (max-width: 1180px) {
  .maintenance-summary,
  .maintenance-layout {
    grid-template-columns: 1fr;
  }
  .maintenance-calendar {
    grid-template-columns: repeat(7, minmax(86px, 1fr));
    overflow-x: auto;
  }
  .maintenance-calendar-wrap {
    overflow-x: auto;
  }
  .report-upload-grid,
  .report-publish-grid { grid-template-columns: 1fr; }
  .report-context,
  #reports .report-context,
  #reports .sensor-report-controls,
  .sensor-report-controls {
    display: grid;
    align-items: stretch;
  }
  .report-final-action {
    display: grid;
    align-items: stretch;
  }
  .report-final-action button {
    width: 100%;
  }
  .report-tabs button {
    flex: 1 1 auto;
  }
  .customer-report-grid {
    grid-template-columns: 1fr;
  }
}
