/* 국민 마음날씨 — 목업 공통 스타일
 * 개발계획서 VII장(웹 서비스)의 화면 설계를 구현한다.
 * 색상은 아크릴 CI 블루를 기준으로 온도(주황)·습도(청록)를 대비색으로 둔다.
 */
:root {
  --brand: #1b57d6;
  --brand-dark: #123f9e;
  --brand-light: #eaf1ff;
  --warm: #e8663c;
  --warm-dark: #a8401d;
  --cool: #2f97b8;
  --cool-dark: #1c6a86;
  --ink: #1a2233;
  --muted: #6b7688;
  --line: #dde3ec;
  --bg: #f4f7fb;
  --card: #ffffff;
  --good: #0a7d3f;
  --warn: #d9a441;
  --bad: #c94f4f;
  --radius: 14px;
  --shadow: 0 1px 3px rgba(20, 35, 70, .06), 0 8px 24px rgba(20, 35, 70, .05);
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Pretendard, -apple-system, BlinkMacSystemFont, "Segoe UI",
    "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--brand); }

/* 키보드 접근성 — 모든 조작 요소에 뚜렷한 포커스 표시 */
:focus-visible {
  outline: 3px solid var(--brand);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--brand);
  color: #fff;
  padding: 10px 16px;
  z-index: 100;
  border-radius: 0 0 8px 0;
}
.skip:focus { left: 0; }

/* ── 헤더 ── */
.hd {
  background: linear-gradient(100deg, var(--brand-dark), var(--brand) 60%, #2d76f7);
  color: #fff;
  padding: 0 20px;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 2px 12px rgba(18, 63, 158, .18);
}
.hd-in {
  max-width: 1180px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  gap: 18px;
  min-height: 58px;
  flex-wrap: wrap;
}
.hd h1 {
  font-size: 18px;
  margin: 0;
  font-weight: 800;
  letter-spacing: -.02em;
  white-space: nowrap;
}
.hd .tag {
  font-size: 11px;
  background: rgba(255, 255, 255, .18);
  border: 1px solid rgba(255, 255, 255, .3);
  padding: 2px 9px;
  border-radius: 20px;
  white-space: nowrap;
}
.nav { display: flex; gap: 4px; margin-left: auto; flex-wrap: wrap; }
.nav a {
  color: rgba(255, 255, 255, .85);
  text-decoration: none;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
}
.nav a:hover { background: rgba(255, 255, 255, .14); color: #fff; }
.nav a[aria-current="page"] { background: rgba(255, 255, 255, .22); color: #fff; }

/* ── 레이아웃 ── */
main { max-width: 1180px; margin: 0 auto; padding: 20px 16px 60px; }
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px 22px;
  margin-bottom: 18px;
}
.card h2 {
  font-size: 17px;
  margin: 0 0 4px;
  font-weight: 700;
}
.card .sub { color: var(--muted); font-size: 12.5px; margin: 0 0 16px; }
.row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.spread { justify-content: space-between; }

/* ── 오늘의 날씨 ── */
.today { display: grid; grid-template-columns: auto 1fr 1fr; gap: 24px; align-items: center; }
.icon-lg { width: 108px; height: 108px; flex: none; }
.metric .val {
  font-size: 46px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.03em;
}
.metric .unit { font-size: 20px; font-weight: 700; margin-left: 4px; }
.metric.temp .val, .metric.temp .unit { color: var(--warm); }
.metric.humi .val, .metric.humi .unit { color: var(--cool); }
.metric .state { font-size: 17px; font-weight: 700; margin-top: 8px; }
.metric .delta { font-size: 13px; color: var(--muted); margin-left: 8px; font-weight: 500; }
.metric .cap { font-size: 12px; color: var(--muted); margin-top: 14px; }

/* 고정 축 게이지 — 값에 따라 축을 조정하지 않는다 */
.gauge { margin-top: 6px; }
.gauge .track {
  height: 12px;
  background: #eef1f6;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
}
.gauge .fill { height: 100%; border-radius: 8px; transition: width .6s ease; }
.gauge.temp .fill { background: linear-gradient(90deg, #f0a98c, var(--warm)); }
.gauge.humi .fill { background: linear-gradient(90deg, #8ccbdf, var(--cool)); }
.gauge .ticks {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}

.badge {
  display: inline-block;
  font-size: 11.5px;
  font-weight: 700;
  padding: 3px 11px;
  border-radius: 20px;
  white-space: nowrap;
}
.badge.prov { background: #fff4e5; color: #8a6414; border: 1px solid #e3c98c; }
.badge.final { background: #e6f4ec; color: var(--good); border: 1px solid #9fd3b6; }

/* ── 7일 ── */
.week { display: grid; grid-template-columns: repeat(7, 1fr); gap: 8px; }
.day {
  text-align: center;
  padding: 12px 4px;
  border-radius: 12px;
  border: 1px solid transparent;
}
.day.on { background: var(--brand-light); border-color: var(--brand); }
.day .d { font-size: 12px; color: var(--muted); font-weight: 600; }
.day.on .d { color: var(--brand-dark); }
.day svg { width: 40px; height: 40px; margin: 4px 0; }
.day .t { font-size: 13px; color: var(--warm); font-weight: 700; }
.day .h { font-size: 12px; color: var(--cool); }

/* ── 이슈 격자 ── */
.issues { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; }
.issue {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafbfd;
  cursor: pointer;
  text-align: left;
  width: 100%;
  font: inherit;
  color: inherit;
}
.issue:hover { border-color: var(--brand); background: var(--brand-light); }
.issue svg { width: 38px; height: 38px; flex: none; }
.issue .nm { font-weight: 700; font-size: 14.5px; }
.issue .vv { font-size: 12.5px; color: var(--muted); }

/* ── 표 ── */
table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
caption { text-align: left; font-size: 12.5px; color: var(--muted); padding-bottom: 8px; }
th {
  background: #f2f5fa;
  text-align: left;
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--muted);
  font-weight: 700;
  white-space: nowrap;
}
td { padding: 10px 12px; border-top: 1px solid var(--line); }
tbody tr:nth-child(even) { background: #fafbfd; }
.up { color: var(--warm); font-weight: 600; }
.down { color: var(--cool); font-weight: 600; }
.tbl-wrap { overflow-x: auto; }

/* ── 고지 ── */
.notice {
  background: #fff8ec;
  border: 1px solid #e3c98c;
  border-radius: var(--radius);
  padding: 16px 20px;
}
.notice h3 { margin: 0 0 8px; font-size: 14.5px; color: #8a6414; }
.notice p { margin: 0 0 6px; font-size: 13px; color: #6b5520; }
.alert {
  background: #fdecea;
  border: 1px solid var(--bad);
  border-radius: 12px;
  padding: 14px 16px;
}
.alert h3 { margin: 0 0 8px; font-size: 14px; color: #a3312b; }
.alert li { font-size: 12.5px; color: #8a3a34; }

/* ── 대시보드 ── */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 12px; }
.tile {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 16px;
}
.tile .lb { font-size: 12px; color: var(--muted); }
.tile .v { font-size: 26px; font-weight: 800; line-height: 1.2; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; }
.filters select {
  font: inherit;
  font-size: 13px;
  padding: 7px 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fafbfd;
  color: var(--ink);
}
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.bar-list { display: grid; gap: 10px; }
.bar-row { display: grid; grid-template-columns: 60px 1fr 60px; align-items: center; gap: 10px; }
.bar-row .bar { height: 20px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.bar-row .bar i { display: block; height: 100%; background: var(--warm); border-radius: 6px; }
.bar-row .lb { font-size: 13px; color: var(--muted); }
.bar-row .vv { font-size: 13px; font-weight: 700; text-align: right; }

/* ── 관리자 ── */
.console { display: grid; grid-template-columns: 190px 1fr; gap: 18px; align-items: start; }
.side { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px; }
.side button {
  display: block;
  width: 100%;
  text-align: left;
  background: none;
  border: 0;
  padding: 10px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  color: var(--muted);
  cursor: pointer;
}
.side button:hover { background: #f2f5fa; }
.side button[aria-current="true"] {
  background: var(--brand-light);
  color: var(--brand-dark);
  font-weight: 700;
}
.pipe { display: grid; gap: 12px; }
.pipe-row { display: grid; grid-template-columns: 160px 1fr 60px 70px; align-items: center; gap: 12px; }
.pipe-row .bar { height: 10px; background: #eef1f6; border-radius: 6px; overflow: hidden; }
.pipe-row .bar i { display: block; height: 100%; border-radius: 6px; }
.pill { font-size: 12px; padding: 3px 10px; border-radius: 20px; text-align: center; font-weight: 700; }
.pill.ok { background: #e6f4ec; color: var(--good); }
.pill.warn { background: #fff4e5; color: #8a6414; }

/* ── 탭 ── */
.tabs { display: flex; gap: 6px; border-bottom: 1px solid var(--line); margin-bottom: 16px; flex-wrap: wrap; }
.tabs button {
  background: none;
  border: 0;
  border-bottom: 3px solid transparent;
  padding: 10px 16px;
  font: inherit;
  font-size: 14.5px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.tabs button[aria-selected="true"] { color: var(--brand-dark); border-bottom-color: var(--brand); }

/* ── 푸터 ── */
footer {
  border-top: 1px solid var(--line);
  background: #fff;
  padding: 24px 16px 40px;
  margin-top: 30px;
}
.ft-in { max-width: 1180px; margin: 0 auto; font-size: 12.5px; color: var(--muted); }
.ft-in strong { color: var(--ink); }

.hide { display: none !important; }
.sr {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0;
}

/* 색상만으로 정보를 전달하지 않기 위한 기호 병기 */
.sym { font-weight: 700; }

@media (max-width: 860px) {
  .today { grid-template-columns: 1fr; gap: 16px; text-align: center; }
  .icon-lg { margin: 0 auto; }
  .grid2 { grid-template-columns: 1fr; }
  .console { grid-template-columns: 1fr; }
  .week { grid-template-columns: repeat(4, 1fr); }
  .pipe-row { grid-template-columns: 120px 1fr 50px 60px; }
}
@media (max-width: 520px) {
  main { padding: 14px 10px 40px; }
  .card { padding: 16px 14px; }
  .metric .val { font-size: 38px; }
  .week { grid-template-columns: repeat(3, 1fr); }
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #10151f; --card: #1a2130; --ink: #e8ecf3; --muted: #9aa6b8;
    --line: #2a3547; --brand-light: #1c2b47;
  }
  .issue { background: #1e2636; }
  th { background: #212b3d; }
  tbody tr:nth-child(even) { background: #1d2534; }
  .gauge .track, .bar-row .bar, .pipe-row .bar { background: #262f42; }
  footer { background: var(--card); }
  .notice { background: #2a2416; border-color: #5c4d22; }
  .notice h3 { color: #e8c877; }
  .notice p { color: #c9b070; }
  .side button:hover { background: #212b3d; }
  .filters select { background: #212b3d; color: var(--ink); }
}
