:root {
  --accent: #2f6fed;
  --accent-dark: #2a63d4;
  --ink: #1e2633;
  --muted: #7b8794;
  --line: #e6eaf0;
  --bg: #eef1f6;
  --green: #12a150;
  --red: #e5484d;
  --orange: #e08600;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Malgun Gothic", "맑은 고딕", "Segoe UI", sans-serif;
  font-size: 14px;
  color: var(--ink);
  background: var(--bg);
}

/* ---------- 로그인 ---------- */
body.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}
.login-card {
  width: 360px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 18px;
  padding: 34px 30px 30px;
  text-align: center;
  box-shadow: 0 12px 40px rgba(30, 38, 51, .08);
}
.login-card .logo {
  width: 46px; height: 46px; margin: 0 auto 12px;
  background: var(--accent); color: #fff;
  border-radius: 12px; font-size: 20px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.login-card h1 { margin: 0; font-size: 24px; font-weight: 800; }
.login-card .sub { margin: 4px 0 18px; color: var(--muted); font-size: 13px; }
.login-card input {
  width: 100%; margin-bottom: 10px;
  padding: 11px 13px; font-size: 14px;
  border: 1px solid #dbe1ea; border-radius: 10px; outline: none;
}
.login-card input:focus { border-color: var(--accent); }
.error {
  color: var(--red); font-size: 12.5px; margin: 4px 0 10px;
  text-align: center; line-height: 1.4;
}

/* ---------- 버튼 ---------- */
button, .dl, .dl-excel { font-family: inherit; cursor: pointer; }
.primary {
  background: var(--accent); color: #fff; border: none; border-radius: 10px;
  font-size: 15px; font-weight: 800; padding: 11px 26px;
}
.primary:hover { background: var(--accent-dark); }
.primary:disabled { background: #a9c1f5; cursor: default; }
.login-card .primary { width: 100%; margin-top: 6px; }
.ghost {
  background: #fff; color: var(--muted); border: 1px solid var(--line);
  border-radius: 9px; padding: 7px 14px; font-size: 12.5px;
}
.ghost:hover { color: var(--ink); border-color: #cdd6e2; }

/* ---------- 상단바 ---------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  height: 64px; padding: 0 26px; background: #fff;
  border-bottom: 1px solid var(--line);
}
.topbar .title { font-size: 19px; font-weight: 800; }
.topbar .store { color: var(--ink); }
.topbar .accent { color: var(--accent); }
.topbar .right { display: flex; align-items: center; gap: 12px; }
.topbar .who { color: #5b6572; font-size: 13px; }
.chip {
  background: #eef3ff; color: var(--accent); border-radius: 20px;
  padding: 4px 13px; font-size: 12px; font-weight: 800;
}
.inline { display: inline; }
select {
  font-family: inherit; font-size: 12.5px; font-weight: 800;
  color: var(--accent); background: #eef3ff;
  border: 1px solid #d5e1ff; border-radius: 9px; padding: 6px 10px;
}

/* ---------- 툴바 ---------- */
.toolbar {
  display: flex; align-items: center; gap: 8px;
  padding: 16px 26px; background: #fff;
  border-bottom: 1px solid var(--line);
}
.tool-label { color: #5b6572; font-weight: 700; margin-right: 4px; }
.tilde { color: #98a2b3; }
.spacer { flex: 1; }
input[type=date] {
  font-family: inherit; font-size: 13.5px; color: var(--ink);
  border: 1px solid #dbe1ea; border-radius: 9px; padding: 8px 12px;
  background: #fff; outline: none;
}
input[type=date]:focus { border-color: var(--accent); }

/* ---------- 요약 카드 ---------- */
.summary {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 16px; padding: 22px 26px 8px;
}
.card {
  background: #fff; border: 1px solid var(--line); border-radius: 14px;
}
.card.stat { padding: 16px 18px; }
.card.stat .k { color: var(--muted); font-size: 12.5px; font-weight: 700; }
.card.stat .v { font-size: 30px; font-weight: 800; margin-top: 2px; }

/* ---------- 상태바 ---------- */
.statusbar {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 26px; background: #fff;
  border-top: 1px solid var(--line); border-bottom: 1px solid var(--line);
}
#status { color: var(--muted); font-size: 12.5px; }
.dl-excel {
  display: inline-flex; align-items: center; gap: 8px;
  background: #217346; color: #fff; font-size: 13px; font-weight: 800;
  text-decoration: none; border: none; border-radius: 9px;
  padding: 9px 16px; white-space: nowrap;
  box-shadow: 0 1px 3px rgba(33, 115, 70, .35);
}
.dl-excel:hover { background: #1a5b38; }
.dl-excel .xls-ico { display: block; flex: none; }

/* ---------- 표 ---------- */
.table-wrap { padding: 14px 26px 30px; position: relative; }
table { width: 100%; border-collapse: collapse; background: #fff;
  border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
th {
  background: #f6f8fb; color: #66707d; font-size: 12.5px; font-weight: 800;
  text-align: left; padding: 11px 12px; border-bottom: 1px solid #e9edf3;
  white-space: nowrap;
}
td {
  padding: 11px 12px; border-bottom: 1px solid #e6ebf2; font-size: 13.5px;
  vertical-align: middle; white-space: nowrap;
}
tr:hover td { background: #fafcff; }
tr.group-end td { border-bottom: 2px solid #c8d3e0; }
td.c { text-align: center; }
.grade { font-weight: 800; }
td.reason { color: #5b6572; white-space: normal; word-break: break-word; }
.empty-row td {
  text-align: center; color: #a3adba; font-size: 13.5px;
  padding: 46px 12px; background: #fff;
}
.empty-row:hover td { background: #fff; }

/* ---------- 매장 선택 ---------- */
.center-wrap {
  display: flex; align-items: flex-start; justify-content: center;
  padding: 60px 20px;
}
.card.wide { width: 420px; padding: 26px 24px; }
.card.wide h2 { margin: 0 0 4px; font-size: 18px; }
.muted { color: var(--muted); font-size: 13px; margin: 0 0 14px; }
.store-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px; margin-bottom: 8px;
  border: 1px solid var(--line); border-radius: 10px; cursor: pointer;
}
.store-row:hover { background: #f7faff; border-color: #d5e1ff; }
.store-row input { accent-color: var(--accent); }
.row-end { display: flex; justify-content: flex-end; margin-top: 14px; }

/* ====================================================================
   화면 보강 (2026-10-09) — 위 규칙은 그대로 두고 덮어쓰는 블록
   ==================================================================== */

/* 글자가 세로로 쪼개지지 않게, 좁으면 줄바꿈 */
.topbar { flex-wrap: wrap; gap: 8px; }
.topbar .title, .topbar .who, .tool-label { white-space: nowrap; }
.toolbar { flex-wrap: wrap; }
.primary, .ghost { white-space: nowrap; }

/* 표가 창보다 넓으면 잘리지 않고 좌우로 밀 수 있게 */
.table-wrap { overflow-x: auto; }
td.reason { min-width: 220px; }

/* 큰 모니터: 내용이 1400px 폭 안에 모이도록 좌우 여백을 늘린다 (배경 띠는 그대로 꽉 차게) */
@media (min-width: 1500px) {
  .topbar, .toolbar, .summary, .statusbar, .table-wrap {
    padding-left: calc((100vw - 1400px) / 2);
    padding-right: calc((100vw - 1400px) / 2);
  }
}

@media (max-width: 720px) {
  .topbar { height: auto; padding: 10px 14px; }
  .topbar .title { font-size: 16px; }
  .topbar .right { gap: 8px; flex-wrap: wrap; }
  .toolbar { padding: 12px 14px; gap: 6px; }
  .toolbar .spacer { flex: 1 1 100%; height: 0; }
  .summary { grid-template-columns: repeat(2, 1fr); gap: 10px; padding: 14px 14px 4px; }
  .card.stat .v { font-size: 24px; }
  .statusbar { padding: 10px 14px; }
  .table-wrap { padding: 10px 14px 24px; }
  th, td { padding: 9px 8px; }
}

/* ---- 폰: 결과 표를 한 건씩 카드로 (2026-10-09) ---- */
@media (max-width: 720px) {
  :is(.result-table, #resultTable) { display: block; border: 0; box-shadow: none; background: transparent; border-radius: 0; }
  :is(.result-table, #resultTable) thead { display: none; }
  :is(.result-table, #resultTable) tbody { display: block; }
  :is(.result-table, #resultTable) tbody tr {
    display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; align-items: baseline;
    background: #fff; border: 1px solid var(--line); border-left: 4px solid #cbd5e1;
    border-radius: 12px; padding: 12px 14px; margin: 0 0 10px;
  }
  :is(.result-table, #resultTable) tbody tr:has(.grade[style*="e5484d"]) { border-left-color: #e5484d; }
  :is(.result-table, #resultTable) tbody tr:has(.grade[style*="e08600"]) { border-left-color: #e08600; }
  :is(.result-table, #resultTable) tbody tr:has(.grade[style*="12a150"]) { border-left-color: #12a150; }
  :is(.result-table, #resultTable) tbody tr td {
    display: block; padding: 0; border: 0; background: none; white-space: normal; font-size: 13px; text-align: left;
  }
  :is(.result-table, #resultTable) tbody tr td:nth-child(1) { grid-column: 1; grid-row: 1; font-weight: 800; font-size: 15px; }
  :is(.result-table, #resultTable) tbody tr td:nth-child(5) { grid-column: 2; grid-row: 1; text-align: right; }
  :is(.result-table, #resultTable) tbody tr td:nth-child(2) { grid-column: 1; grid-row: 2; color: #475569; }
  :is(.result-table, #resultTable) tbody tr td:nth-child(3) { grid-column: 2; grid-row: 2; text-align: right; color: #64748b; }
  :is(.result-table, #resultTable) tbody tr td:nth-child(3)::before { content: "개통 "; }
  :is(.result-table, #resultTable) tbody tr td:nth-child(4) { grid-column: 1 / -1; grid-row: 3; color: #64748b; }
  :is(.result-table, #resultTable) tbody tr td.reason {
    grid-column: 1 / -1; grid-row: 4; margin-top: 6px; padding: 8px 10px;
    background: #f6f8fb; border-radius: 8px; color: #334155; min-width: 0;
  }
  :is(.result-table, #resultTable) tbody tr td.reason:empty { display: none; }
  :is(.result-table, #resultTable) tbody tr.empty-row { display: block; border: 0; padding: 0; background: none; }
  :is(.result-table, #resultTable) tbody tr.empty-row td { padding: 36px 10px; text-align: center; }
  .table-wrap { padding-left: 14px; padding-right: 14px; }
}
