@font-face {
  font-family: "Pretendard Variable";
  src: url("./assets/PretendardVariable.woff2") format("woff2-variations");
  font-weight: 45 920;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #eef2f5;
  --panel: #ffffff;
  --panel-soft: #f4f7f9;
  --soft: #f6f8fa;
  --ink: #17212b;
  --muted: #687684;
  --line: #dde5eb;
  --accent: #0f766e;
  --accent-dark: #0b5f59;
  --accent-strong: #0b5f59;
  --accent-soft: #e8f5f3;
  --danger: #b42318;
  --warn: #9a6700;
  --radius: 8px;
  --shadow: 0 18px 48px rgba(23, 33, 43, 0.1);
  --font-sans: "Pretendard Variable", "Pretendard", "Noto Sans KR", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

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

button {
  border: 0;
  border-radius: var(--radius);
  cursor: pointer;
  font-weight: 800;
}

button:disabled {
  cursor: progress;
  opacity: 0.65;
}

a {
  color: inherit;
  text-decoration: none;
}

.hidden {
  display: none !important;
}

.maintenance-shell {
  width: min(1560px, 100%);
  margin: 0 auto;
  padding: 18px;
}

.topbar,
.toolbar,
.table-panel,
.queue-panel,
.summary-grid article {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--panel);
  box-shadow: var(--shadow);
}

.topbar {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
}

.eyebrow {
  margin: 0 0 3px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 900;
}

h1,
h2,
p {
  margin: 0;
}

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

h2 {
  font-size: 16px;
  letter-spacing: 0;
}

.topbar-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.server-monitor {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #f8fafb;
}

.server-monitor span {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #fff;
  color: #465769;
  font-size: 12px;
  font-weight: 900;
}

.server-monitor .status-dot::before {
  content: "";
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 999px;
  background: var(--accent);
}

.server-monitor .status-dot.warning::before,
.server-monitor .status-dot.offline::before {
  background: var(--danger);
}

.primary-button,
.secondary-button,
.ghost-link,
.danger-button {
  min-height: 40px;
  padding: 0 14px;
  border-radius: var(--radius);
}

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

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

.secondary-button,
.ghost-link {
  display: inline-grid;
  place-items: center;
  border: 1px solid var(--line);
  background: #fff;
  color: #344557;
}

.secondary-button:hover,
.ghost-link:hover {
  border-color: rgba(15, 118, 110, 0.5);
  color: var(--accent-strong);
}

.ghost-link.active {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.ghost-link.active:hover {
  color: #fff;
}

.danger-button {
  background: #fff1f0;
  color: var(--danger);
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-top: 14px;
}

.summary-grid article {
  padding: 16px;
}

.summary-grid span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.summary-grid strong {
  display: block;
  margin-top: 7px;
  font-size: 30px;
  letter-spacing: 0;
}

.summary-grid small {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 7px;
  border-radius: 999px;
  background: #eef2f5;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.toolbar {
  display: grid;
  grid-template-columns: minmax(280px, 1fr) auto;
  gap: 10px;
  align-items: end;
  margin-top: 14px;
  padding: 14px;
  box-shadow: none;
}

.advanced-filters {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 10px;
  align-items: end;
}

.active-filter-summary {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 28px;
  align-items: center;
}

.filter-chip {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 9px;
  border-radius: 999px;
  background: #e7f4f2;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 800;
}

.toolbar-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.filter-toggle {
  display: none;
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

label {
  display: grid;
  gap: 6px;
  color: #3b4c5d;
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--ink);
  outline: none;
}

input,
select {
  min-height: 40px;
  padding: 0 11px;
}

textarea {
  padding: 10px 11px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

.content-split {
  display: grid;
  grid-template-columns: 320px minmax(0, 1fr);
  gap: 14px;
  margin-top: 14px;
}

.queue-panel,
.table-panel {
  min-width: 0;
  overflow: hidden;
  box-shadow: none;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  border-bottom: 1px solid var(--line);
}

.panel-header p,
.panel-header span {
  margin-top: 3px;
  color: var(--muted);
  font-size: 13px;
}

.queue-list {
  display: grid;
  gap: 8px;
  max-height: calc(100vh - 290px);
  overflow: auto;
  padding: 12px;
}

.queue-item {
  display: grid;
  gap: 7px;
  width: 100%;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--soft);
  text-align: left;
}

.queue-item strong,
.client-cell strong {
  display: block;
  font-size: 14px;
}

.client-cell {
  cursor: pointer;
}

.client-cell .record-number {
  display: block;
  margin-top: 3px;
  color: #83909b;
  font-size: 11px;
  font-weight: 700;
  line-height: 1.2;
}

.status-cell {
  vertical-align: middle;
}

.status-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  min-width: 68px;
  min-height: 28px;
  padding: 4px 7px;
  border: 1px solid transparent;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.status-mark b {
  display: inline-grid;
  width: 17px;
  height: 17px;
  place-items: center;
  border-radius: 50%;
  font-size: 11px;
}

.status-mark.done {
  border-color: #9bd5c5;
  background: #eaf8f3;
  color: #0a6b5e;
}

.status-mark.done b {
  background: #149477;
  color: #fff;
}

.status-mark.todo {
  border-color: #f4c86b;
  background: #fff8e6;
  color: #8a5a00;
}

.status-mark.todo b {
  background: #d97706;
  color: #fff;
}

.status-mark.excluded {
  border-color: #cbd5df;
  background: #f1f4f6;
  color: #64748b;
}

.status-mark.excluded b {
  background: #94a3b8;
  color: #fff;
}

.status-mark.daily {
  border-color: #b9c8ef;
  background: #eef2ff;
  color: #4056a1;
}

.status-mark.daily b {
  background: #5b6fc7;
  color: #fff;
  font-size: 10px;
}

.client-cell strong {
  color: #12384f;
}

.client-cell:hover strong {
  color: var(--accent-dark);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.queue-item span,
.client-cell span {
  color: var(--muted);
  font-size: 12px;
}

.client-cell span {
  display: -webkit-box;
  max-width: 420px;
  overflow: hidden;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.table-scroll {
  overflow: auto;
  max-height: calc(100vh - 300px);
}

table {
  width: 100%;
  min-width: 980px;
  border-collapse: collapse;
  table-layout: fixed;
}

th:nth-child(1),
td:nth-child(1) {
  width: 88px;
}

th:nth-child(2),
td:nth-child(2) {
  width: auto;
}

th:nth-child(3),
td:nth-child(3) {
  width: 120px;
}

th:nth-child(4),
td:nth-child(4) {
  width: 74px;
}

th:nth-child(5),
td:nth-child(5),
th:nth-child(6),
td:nth-child(6) {
  width: 84px;
}

th:nth-child(7),
td:nth-child(7) {
  width: 130px;
}

th:nth-child(8),
td:nth-child(8) {
  width: 148px;
}

th:nth-child(9),
td:nth-child(9) {
  width: 112px;
}

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

th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f8fafb;
  color: #405264;
  font-size: 12px;
}

td {
  font-size: 13px;
}

.owner-cell {
  white-space: nowrap;
  color: #2f4051;
  font-weight: 800;
}

tbody tr[data-view-id] {
  cursor: pointer;
}

tbody tr[data-view-id]:focus-visible,
tbody tr:hover {
  background: #fbfcfd;
  outline: 2px solid rgba(15, 118, 110, 0.18);
  outline-offset: -2px;
}

tbody tr.record-focus-highlight,
.record-card.record-focus-highlight {
  background: #fff7df;
  outline: 3px solid rgba(217, 119, 6, 0.52);
  outline-offset: -3px;
  box-shadow: inset 4px 0 0 #d97706;
}

.method-remote {
  background: #f7fcfa;
}

.method-visit {
  background: #f7faff;
}

.method-badge {
  display: inline-grid;
  min-width: 52px;
  place-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.cycle-badge {
  display: inline-grid;
  min-width: 62px;
  place-items: center;
  padding: 5px 9px;
  border-radius: 999px;
  background: #eef2f5;
  color: #405264;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.cell-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.exclude-badge {
  display: inline-grid;
  min-height: 22px;
  place-items: center;
  padding: 0 7px;
  border-radius: 999px;
  background: #eef2f5;
  color: #64748b;
  font-size: 11px;
  font-weight: 900;
}

.record-excluded {
  opacity: 0.72;
}

.record-excluded .client-cell strong {
  color: #64748b;
}

.cycle-badge.monthly {
  background: #e7f4f2;
  color: #0a5d57;
}

.cycle-badge.daily {
  border: 1px solid #f9a8d4;
  background: #fce7f3;
  color: #9d174d;
}

.cycle-daily {
  box-shadow: inset 4px 0 0 #db2777;
}

.cycle-badge.overdue {
  border: 1px solid #ef4444;
  background: #fff1f2;
  color: #b91c1c;
}

.cycle-badge.early {
  background: #e8f7ed;
  color: #16713b;
}

.cycle-badge.middle {
  background: #fff5db;
  color: #8a5a00;
}

.cycle-badge.late {
  background: #ffecef;
  color: #a43b4a;
}

.cycle-badge.quarterly {
  background: #eaf1ff;
  color: #1d4ed8;
}

.cycle-badge.semiannual {
  background: #f0eafe;
  color: #6d3ac4;
}

.cycle-badge.annual {
  background: #eaf7ff;
  color: #0f628d;
}

.cycle-badge.adhoc {
  background: #fef0e8;
  color: #a34d12;
}

.method-badge.remote {
  background: var(--accent-soft);
  color: var(--accent-dark);
}

.method-badge.visit {
  background: #eaf1ff;
  color: #1d4ed8;
}

.inline-status,
.inline-date {
  min-width: 118px;
  min-height: 34px;
  padding: 0 9px;
  font-size: 13px;
}

.inline-date {
  min-width: 136px;
}

.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
}

.row-save-status {
  min-width: 42px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  white-space: nowrap;
}

.row-save-status.saving {
  color: #9a6700;
}

.row-save-status.saved {
  color: var(--accent-dark);
}

.row-save-status.error {
  color: var(--danger);
}

.save-status-banner {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 34px;
  margin-top: 8px;
  padding: 6px 12px;
  border: 1px solid #f4c86b;
  border-radius: 6px;
  background: #fff8e6;
  color: #8a5a00;
  font-size: 13px;
  font-weight: 900;
}

.save-status-banner.saving,
.save-status-banner.pending {
  border-color: #f4c86b;
  background: #fff8e6;
  color: #8a5a00;
}

.save-status-banner.saved {
  border-color: #9bd5c5;
  background: #eaf8f3;
  color: #0a6b5e;
}

.save-status-banner.error {
  border-color: #f2a6a0;
  background: #fff1f0;
  color: #b42318;
}

.row-actions button {
  min-height: 32px;
  padding: 0 9px;
  border: 1px solid var(--line);
  background: #fff;
  color: #314353;
  white-space: nowrap;
}

.row-save-button {
  min-width: 62px;
}

.row-save-button.dirty {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
}

.row-save-button.dirty:hover {
  background: #0b5f59;
}

.queue-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.queue-date-badge {
  display: inline-grid;
  min-height: 24px;
  place-items: center;
  padding: 4px 8px;
  border-radius: 999px;
  background: #eef6ff;
  color: #0f5f91;
  font-size: 12px;
  font-weight: 900;
  white-space: nowrap;
}

.queue-date-badge.empty {
  background: #f1f4f7;
  color: #6b7785;
}

.card-list {
  display: none;
}

.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 52px;
  padding: 8px 12px;
  border-top: 1px solid var(--line);
}

.pagination button {
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

.pagination span {
  min-width: 120px;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.pagination.hidden {
  display: none;
}

.card-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

dialog {
  width: min(760px, calc(100% - 28px));
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.28);
}

.detail-dialog {
  width: min(680px, calc(100% - 28px));
}

dialog::backdrop {
  background: rgba(13, 24, 35, 0.45);
}

.dialog-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.dialog-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.dialog-header button {
  width: 34px;
  height: 34px;
  background: #f1f4f6;
  color: #344557;
  font-size: 22px;
  line-height: 1;
}

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

.detail-body {
  display: grid;
  gap: 14px;
  padding: 18px;
}

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

.status-pill,
.date-pill {
  display: inline-grid;
  min-height: 28px;
  place-items: center;
  padding: 0 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 900;
}

.status-pill.done {
  background: #e7f4f2;
  color: var(--accent-dark);
}

.status-pill.todo {
  background: #fff1f0;
  color: var(--danger);
}

.status-pill.excluded {
  background: #eef2f5;
  color: #64748b;
}

.date-pill {
  background: #f1f5f9;
  color: #405264;
}

.detail-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin: 0;
}

.detail-grid div,
.detail-note {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.detail-grid dt,
.detail-note h3 {
  margin: 0 0 5px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

.detail-grid dd,
.detail-note p {
  margin: 0;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
  white-space: pre-wrap;
}

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

.inspection-month-field {
  display: grid;
  gap: 10px;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.inspection-month-field legend {
  padding: 0 5px;
  color: #3b4c5d;
  font-size: 13px;
  font-weight: 900;
}

.inspection-month-presets,
.inspection-month-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.inspection-month-presets button {
  min-height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
  font-size: 12px;
}

.inspection-month-presets button:hover {
  border-color: var(--accent);
  color: var(--accent-dark);
}

.inspection-month-presets button[aria-pressed="true"] {
  border-color: var(--accent);
  background: var(--accent);
  color: #fff;
}

.inspection-month-grid label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-width: 54px;
  padding: 6px 8px;
  border-radius: 6px;
  background: #f5f8fa;
  font-size: 12px;
}

.inspection-month-grid input {
  width: 16px;
  min-height: 16px;
  margin: 0;
}

.inspection-month-field small {
  color: var(--muted);
  font-size: 12px;
}

.dialog-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
  background: #f8fafb;
}

.dialog-actions > span {
  margin-right: auto;
  color: var(--muted);
  font-size: 13px;
}

.auth-field {
  padding: 18px;
}

.toast-stack {
  position: fixed;
  right: 18px;
  bottom: 18px;
  display: grid;
  gap: 8px;
  width: min(360px, calc(100% - 36px));
  z-index: 10;
}

.toast {
  padding: 12px 13px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--accent);
  border-radius: var(--radius);
  background: #fff;
  box-shadow: var(--shadow);
  font-size: 13px;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.warning {
  border-left-color: #d97706;
}

@media (max-width: 1080px) {
  .content-split {
    grid-template-columns: 1fr;
  }

  .advanced-filters {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .queue-list {
    max-height: 260px;
  }
}

@media (max-width: 720px) {
  .maintenance-shell {
    padding: 10px;
  }

  .topbar {
    align-items: flex-start;
    grid-template-columns: 1fr;
  }

  .topbar-actions {
    justify-content: flex-start;
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 3px;
    scrollbar-width: none;
  }

  .topbar-actions::-webkit-scrollbar {
    display: none;
  }

  .topbar-actions > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .topbar-actions .compact-link {
    display: none;
  }

  .server-monitor {
    width: 100%;
  }

  .summary-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .toolbar {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .filter-toggle {
    display: inline-grid;
    place-items: center;
  }

  .advanced-filters {
    display: none;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .advanced-filters.mobile-expanded {
    display: grid;
  }

  .advanced-filters > :last-child {
    grid-column: 1 / -1;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions .primary-button {
    grid-column: 1 / -1;
  }

  .table-scroll {
    display: none;
  }

  .card-list {
    display: grid;
    gap: 10px;
    padding: 12px;
  }

.record-card {
    display: grid;
    gap: 9px;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
    background: #fff;
    cursor: pointer;
  }

  .record-card footer {
    display: flex;
    gap: 8px;
  }

  .card-controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    align-items: center;
  }

  .card-controls .inline-status,
  .card-controls .inline-date {
    min-width: 0;
  }

  .record-card footer {
    align-items: center;
    justify-content: flex-end;
  }

  .record-card button {
    min-height: 34px;
    padding: 0 10px;
    border: 1px solid var(--line);
    background: #fff;
  }

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

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

.record-card .client-cell > div {
  display: flex;
  align-items: center;
  gap: 8px;
}

.record-card .client-cell strong {
  display: inline;
}
