body { margin: 0; font-family: -apple-system, "Malgun Gothic", sans-serif; background: #f3f4f6; color: #1f2937; }
a { color: inherit; }
label { display: block; font-size: 13px; color: #555; margin: 14px 0 4px; }
input, select { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 15px;
        border: 1px solid #ccc; border-radius: 8px; font-family: inherit; }
button { padding: 10px 16px; font-size: 14px; font-weight: 600; color: #fff; background: #16a34a;
         border: none; border-radius: 8px; cursor: pointer; }
button.secondary, a.secondary { background: #6b7280; }
button.danger { background: #dc2626; }
.msg { margin-top: 14px; font-size: 14px; }
.msg.error { color: #dc2626; }
.msg.ok { color: #16a34a; }

/* 로그인 */
.loginWrap { display: flex; align-items: center; justify-content: center; min-height: 100vh; }
.card { background: #fff; border-radius: 12px; padding: 32px; width: 100%; max-width: 360px;
        box-shadow: 0 2px 12px rgba(0,0,0,.08); }
.card h1 { font-size: 20px; margin: 0 0 20px; }
.card button { width: 100%; margin-top: 20px; padding: 12px; }

/* 좌측 nav 토글(순수 CSS — 체크박스 트릭, JS 불필요) */
.navToggle { display: none; }

.shell {
  display: grid;
  grid-template-columns: 0 1fr;
  grid-template-rows: auto 1fr;
  grid-template-areas: "topbar topbar" "sidenav main";
  min-height: 100vh;
}
.topbar {
  grid-area: topbar;
  background: #fff; padding: 14px 20px; display: flex; align-items: center; gap: 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06); position: sticky; top: 0; z-index: 30;
}
.hamburger { font-size: 22px; cursor: pointer; line-height: 1; user-select: none; }
.brand { font-size: 16px; font-weight: 700; flex: 1; }
.who { font-size: 13px; color: #666; white-space: nowrap; }

.sidenav {
  grid-area: sidenav;
  background: #fff; border-right: 1px solid #e5e7eb;
  width: 220px; position: fixed; top: 57px; bottom: 0; left: -220px;
  transition: left .2s ease; overflow-y: auto; z-index: 25;
  display: flex; flex-direction: column; gap: 2px; padding: 10px; box-sizing: border-box;
}
.navlink { padding: 10px 12px; border-radius: 8px; text-decoration: none; color: #374151; font-size: 14px; font-weight: 600; }
.navlink.active { background: #16a34a; color: #fff; }
.navlink.disabled { color: #cbd5e1; padding: 10px 12px; font-size: 14px; }
.scrim { display: none; position: fixed; inset: 57px 0 0 0; background: rgba(0,0,0,.3); z-index: 20; }

.navToggle:checked ~ .shell .sidenav { left: 0; }
.navToggle:checked ~ .shell .scrim { display: block; }

.main { grid-area: main; padding: 16px; max-width: 1400px; box-sizing: border-box; }
.panel { background: #fff; border-radius: 12px; padding: 20px; box-shadow: 0 1px 4px rgba(0,0,0,.06); margin-bottom: 16px; }
.panel h2 { margin: 0 0 16px; font-size: 17px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #eee; }
th { color: #666; font-weight: 600; font-size: 12px; text-transform: uppercase; }
td.actions { white-space: nowrap; text-align: right; }
td.actions form { display: inline; }
td.actions button { padding: 6px 10px; font-size: 12px; }
.empty { color: #999; padding: 20px 0; text-align: center; }
.listMeta { font-size: 13px; color: #666; margin-bottom: 6px; }

.formActions { margin-top: 16px; display: flex; gap: 8px; }
.filterRow { display: flex; gap: 8px; align-items: flex-end; margin: 10px 0; }
.filterRow input, .filterRow select { flex: 1; }
.filterRow button { flex: 0 0 auto; }
.linklike { display: inline-block; margin-top: 8px; font-size: 13px; color: #16a34a; }
.buttonlike { display: inline-block; padding: 10px 16px; border-radius: 8px; text-decoration: none; color: #fff; }

/* 동의 절차가 꺼져 있을 때의 상시 경고 — 책임 소재를 화면에 남긴다(로드맵 §04). */
.warnBanner { background: #fef3c7; border: 1px solid #fcd34d; color: #92400e;
              padding: 12px 16px; border-radius: 10px; margin-bottom: 16px; font-size: 14px; }
textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; font-size: 14px;
           border: 1px solid #ccc; border-radius: 8px; font-family: inherit; line-height: 1.5; }
/* 가입 대기 큐의 승인/거절 폼 — 좁은 칸에 셀렉트 2개+버튼이 들어간다. */
.approveBox { display: grid; gap: 6px; min-width: 260px; }
.approveBox form { display: flex; gap: 6px; align-items: center; }
.approveBox select, .approveBox input { font-size: 13px; padding: 6px 8px; }
.approveBox button { padding: 6px 12px; font-size: 13px; white-space: nowrap; }

/* 대시보드 요약 카드 — 숫자를 먼저 읽게 하고, 예외(warn/bad)만 색으로 튄다. */
.cardGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; }
.statCard { display: block; padding: 14px 16px; border: 1px solid #e5e7eb; border-radius: 10px;
            background: #fff; text-decoration: none; color: inherit; }
a.statCard:hover { border-color: #16a34a; }
.cardLabel { font-size: 13px; color: #6b7280; }
.cardValue { font-size: 28px; font-weight: 700; line-height: 1.2; margin-top: 4px; }
.cardValue.warn { color: #b45309; }
.cardValue.bad { color: #b91c1c; }
.cardUnit { font-size: 13px; font-weight: 500; color: #6b7280; margin-left: 4px; }
.cardSub { font-size: 12px; color: #9ca3af; margin-top: 4px; }
.statusRow { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 14px; }

/* 데이터 조회 — 필터가 8개라 한 줄(.filterRow)엔 안 들어가서 자동 줄바꿈 그리드로. */
.filterGrid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0 12px; }
.filterGrid label { margin-top: 10px; }
/* 열이 11개라 좁은 화면에서 표만 가로로 스크롤되게 한다(페이지 전체가 밀리지 않도록). */
.tableScroll { overflow-x: auto; }
.tableScroll table { min-width: 900px; }
.nowrap { white-space: nowrap; }
.muted { color: #9ca3af; }

.splitGrid { display: grid; gap: 16px; }

/* 체크박스 한 줄(응답수단 등) */
.checkRow { display: flex; align-items: center; gap: 8px; margin: 14px 0 4px; }
.checkRow input[type="checkbox"] { width: auto; }
.checkRow label { margin: 0; font-size: 14px; color: #1f2937; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge.on { background: #dcfce7; color: #15803d; }
.badge.off { background: #f3f4f6; color: #9ca3af; }
.badge.silent { background: #e0e7ff; color: #4338ca; }
.badge.miss { background: #fee2e2; color: #b91c1c; }

/* PC(넓은 화면): 사이드바 항상 고정 노출 + 본문 다단 분할 */
@media (min-width: 900px) {
  .shell { grid-template-columns: 220px 1fr; }
  .sidenav { position: sticky; left: 0; top: 57px; height: calc(100vh - 57px); }
  .scrim { display: none !important; }
  .hamburger { display: none; }
  .splitGrid { grid-template-columns: 380px 1fr; align-items: start; }
}
