/* 동작CALL버스 운행현황 화면 스타일: 무채색 바탕에 파랑 강조 1색, 모바일 360px 우선 */
:root {
  --bg: #ffffff;
  --bg-soft: #f6f7f8;
  --text: #14191e;
  --text-sub: #5f6670;
  --line: #e3e5e8;
  --accent: #0066ff;
  --accent-soft: #eaf1ff;
  --gutter: 16px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Pretendard", -apple-system, BlinkMacSystemFont, "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  overflow-x: hidden;
  padding-bottom: calc(24px + env(safe-area-inset-bottom));
}
button, select, input { font: inherit; color: inherit; }
.top { padding: 20px var(--gutter) 12px; position: relative; }
.top h1 { margin: 0; font-size: 20px; line-height: 1.3; font-weight: 700; letter-spacing: -0.02em; }
.sub { margin: 4px 0 0; font-size: 13px; color: var(--text-sub); }

/* 필터 */
.filters { margin: 0 var(--gutter) 12px; border: 1px solid var(--line); border-radius: 12px; }
.filters summary { list-style: none; padding: 12px 14px; font-size: 14px; font-weight: 600; cursor: pointer; display: flex; justify-content: space-between; gap: 8px; }
.filters summary::-webkit-details-marker { display: none; }
.filters summary::after { content: "바꾸기"; color: var(--accent); font-weight: 500; font-size: 13px; flex: none; }
.filters[open] summary::after { content: "접기"; }
.filters summary span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.filter-body { padding: 4px 14px 14px; border-top: 1px solid var(--line); }
.f-row { margin-top: 12px; }
.f-label { display: block; font-size: 12px; color: var(--text-sub); margin-bottom: 6px; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.seg button { flex: 1 1 0; min-width: 0; padding: 9px 2px; background: var(--bg); border: 0; border-left: 1px solid var(--line); font-size: 13px; cursor: pointer; white-space: nowrap; }
.seg button:first-child { border-left: 0; }
.seg.wrap { flex-wrap: wrap; gap: 6px; border: 0; border-radius: 0; overflow: visible; }
.seg.wrap button { flex: 0 0 auto; padding: 9px 14px; border: 1px solid var(--line); border-radius: 999px; }
.seg button[aria-pressed="true"] { background: var(--accent); color: #fff; font-weight: 600; }
.f-dates { display: flex; gap: 8px; align-items: center; margin-top: 8px; }
.f-dates input { flex: 1 1 0; min-width: 0; padding: 8px; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); }
.f-dates span { color: var(--text-sub); }

/* 본문 */
main { padding: 0 var(--gutter); min-height: 40vh; }
.h2 { font-size: 16px; font-weight: 700; margin: 24px 0 10px; }
.note { font-size: 12px; color: var(--text-sub); margin: 8px 0 0; }
.state { padding: 48px 8px; text-align: center; color: var(--text-sub); }
.state strong { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.state.err strong { color: var(--accent); }
.state button { margin-top: 14px; padding: 9px 16px; border-radius: 10px; border: 1px solid var(--accent); background: var(--bg); color: var(--accent); font-weight: 600; cursor: pointer; }
.spinner { width: 22px; height: 22px; margin: 0 auto 12px; border: 3px solid var(--line); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation: none; } }

.stats { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--bg-soft); border-radius: 14px; padding: 14px; }
.stat .k { font-size: 12px; color: var(--text-sub); }
.stat .v { font-size: 24px; white-space: nowrap; font-weight: 700; letter-spacing: -0.02em; margin-top: 2px; }
.stat .v small { font-size: 13px; font-weight: 500; color: var(--text-sub); margin-left: 2px; }
.stat.main { background: var(--accent-soft); }
.stat.main .v { color: var(--accent); }

.cells { display: grid; grid-template-columns: 1fr; gap: 10px; }
.cell { border: 1px solid var(--line); border-radius: 14px; padding: 12px; min-width: 0; }
.cell.dim { opacity: 0.4; }
.cell h3 { margin: 0 0 8px; font-size: 15px; font-weight: 700; display: flex; align-items: baseline; flex-wrap: wrap; row-gap: 2px; }
.cell h3 span { color: var(--text-sub); font-weight: 500; margin-left: 4px; }
.cell h3 em { margin-left: auto; text-align: right; font-style: normal; font-size: 12px; font-weight: 500; color: var(--text-sub); }
.cell dl { margin: 0; display: grid; grid-template-columns: 1fr auto auto; gap: 5px 14px; font-size: 13px; }
.cell dt { color: var(--text-sub); }
.cell dd { margin: 0; text-align: right; font-weight: 600; }
.cell dd.th { font-size: 11px; font-weight: 500; color: var(--text-sub); }
.offbox { margin-top: 10px; padding: 12px; border-radius: 14px; background: var(--bg-soft); font-size: 13px; color: var(--text-sub); }

/* 표 */
.tablewrap { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; -webkit-overflow-scrolling: touch; }
table { border-collapse: collapse; width: 100%; font-size: 12px; }
th, td { padding: 9px 4px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
th { background: var(--bg-soft); font-weight: 600; font-size: 12px; color: var(--text-sub); }
th:first-child, td:first-child { text-align: left; position: sticky; left: 0; background: var(--bg); z-index: 1; }
th:first-child { background: var(--bg-soft); }
tr:last-child td { border-bottom: 0; }
td .tag { display: block; width: fit-content; font-size: 11px; padding: 0 6px; border-radius: 999px; background: var(--bg-soft); color: var(--text-sub); margin-top: 2px; }
/* 시간 계산 안내 */
.guide { margin-top: 14px; padding: 14px; border-radius: 14px; background: var(--bg-soft); font-size: 13px; }
.guide h2 { margin: 0 0 6px; font-size: 14px; font-weight: 700; }
.guide ul { margin: 0; padding-left: 16px; }
.guide li { margin: 3px 0; }
.guide details { margin-top: 8px; }
.guide summary { cursor: pointer; color: var(--accent); font-weight: 600; font-size: 13px; padding: 4px 0; }
.guide details ul { margin-top: 6px; color: var(--text-sub); }

/* 차량별 */
.listhead { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: 24px; }
.listhead .h2 { margin: 0; }
.toggle { flex: none; padding: 7px 12px; border: 1px solid var(--line); border-radius: 999px; background: var(--bg); font-size: 13px; cursor: pointer; }
.toggle[aria-pressed="true"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.item.empty .r { color: #9aa0a8; font-weight: 500; font-size: 13px; }
.none { color: #9aa0a8; }

/* 목록 */
.list { list-style: none; margin: 0; padding: 0; }
.item { padding: 12px 0; border-bottom: 1px solid var(--line); display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; }
.item .l1 { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.item .l2 { font-size: 12px; color: var(--text-sub); grid-column: 1; }
.item .r { grid-row: 1 / span 2; grid-column: 2; text-align: right; font-weight: 700; align-self: center; }
.item.hot .r { color: var(--accent); }
.item.hot { border-left: 3px solid var(--accent); padding-left: 10px; }
.nodep { margin-left: 6px; padding: 0 5px; border-radius: 6px; background: var(--bg-soft); color: #8a9099; font-size: 11px; }
.badge { display: inline-block; font-size: 11px; font-weight: 600; padding: 0 6px; border-radius: 6px; background: var(--bg-soft); color: var(--text-sub); margin-left: 6px; vertical-align: 1px; }
.more { display: block; width: 100%; margin-top: 12px; padding: 11px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); cursor: pointer; font-weight: 600; }

/* 상단 탭 (두 개라 하단 바 대신 위에 붙여 두고 스크롤해도 보이게 한다) */
.tabs { position: sticky; top: 0; z-index: 10; display: flex; gap: 6px; padding: 8px var(--gutter); background: var(--bg); border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { flex: 1 1 0; min-width: 0; padding: 11px 2px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 15px; color: var(--text-sub); cursor: pointer; }
.tabs button[aria-current="page"] { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 700; }

button:focus-visible, summary:focus-visible, select:focus-visible, input:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

@media (min-width: 720px) {
  .top, main, .filters, .tabs { max-width: 720px; margin-left: auto; margin-right: auto; }
  .top, main { padding-left: var(--gutter); padding-right: var(--gutter); }
  .filters { margin-bottom: 12px; }
}

/* 비밀번호 화면과 로그아웃 */
.logout { position: absolute; top: 22px; right: var(--gutter); padding: 4px 2px; border: 0; background: none; color: var(--text-sub); font-size: 12px; text-decoration: underline; cursor: pointer; }
/* 비밀번호 화면 */
.locked .filters, .locked .tabs, .locked .logout { display: none; }
.login { padding: 32px 4px 8px; max-width: 360px; margin: 0 auto; }
.login-title { display: block; font-size: 18px; margin-bottom: 6px; }
.login input { display: block; width: 100%; padding: 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--bg); font-size: 22px; line-height: 1.2; letter-spacing: 0.4em; text-align: center; }
.login-msg { min-height: 22px; margin: 8px 0 12px; font-size: 13px; color: var(--accent); }
.login .primary { width: 100%; padding: 13px; border: 0; border-radius: 10px; background: var(--accent); color: #fff; font-size: 15px; font-weight: 600; cursor: pointer; }
.login .primary:disabled { opacity: 0.5; cursor: default; }
