:root {
  --bg: #f5f6f8; --card: #fff; --line: #e2e5ea; --ink: #1d2430; --muted: #5f6774;
  --navy: #1f3a5f; --blue: #2f6fd6; --red: #c8362f; --yellow: #f4c542; --green: #2e8b57; --gray: #9aa1ab;
}
* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink);
  font: 14px/1.5 "Pretendard", "Apple SD Gothic Neo", "Malgun Gothic", system-ui, sans-serif; }
.hidden { display: none !important; }
h1 { font-size: 22px; margin: 0 0 4px; } h2 { font-size: 16px; margin: 0 0 8px; }
.muted { color: var(--muted); font-size: 13px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 10px; padding: 16px; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); margin: 8px 0; }
input, select, textarea { font: inherit; color: var(--ink); padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #c9dcfb; border-color: var(--blue); }
button { font: inherit; padding: 8px 14px; border-radius: 7px; border: 1px solid var(--line); background: #fff; cursor: pointer; }
button.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
button.primary:disabled { background: var(--gray); border-color: var(--gray); cursor: not-allowed; }
button.ghost { border: none; background: transparent; color: #dfe6f0; }
button.ghost.dark { color: var(--muted); }
.msg { min-height: 1.2em; color: var(--red); font-size: 13px; }

.login { min-height: 100vh; display: grid; place-items: center; }
.login-card { width: 340px; }
.login-card button { width: 100%; margin-top: 8px; }

.demo { padding: 8px 20px; background: #ffe08a; color: #4a3500; font-weight: 600; text-align: center; }
.top { display: flex; align-items: center; gap: 20px; padding: 10px 20px; background: var(--navy); color: #fff; }
.brand { font-weight: 700; font-size: 17px; }
.stats { display: flex; gap: 14px; font-size: 13px; color: #c9d4e3; flex: 1; }
.stats b { color: #fff; }
.who { display: flex; align-items: center; gap: 6px; font-size: 13px; }
.tabs { display: flex; gap: 2px; padding: 0 20px; background: #fff; border-bottom: 1px solid var(--line); }
.tabs button { border: none; border-bottom: 3px solid transparent; border-radius: 0; padding: 12px 16px; color: var(--muted); background: none; }
.tabs button.on { color: var(--navy); border-bottom-color: var(--navy); font-weight: 600; }
.tab { padding: 16px 20px; }

.bar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.bar input#q { flex: 1; min-width: 260px; font-size: 15px; }
.split { display: grid; grid-template-columns: 1fr; gap: 12px; margin-top: 8px; }
.split.with-detail { grid-template-columns: minmax(0, 1fr) 440px; }
.tablewrap { overflow: auto; background: #fff; border: 1px solid var(--line); border-radius: 10px; max-height: calc(100vh - 230px); }
#list { max-height: none; }   /* 높이는 app.js fit() */
#list:focus { outline: none; }
#results { table-layout: fixed; width: auto; border-collapse: separate; border-spacing: 0; }
#results td { height: 34px; padding: 0 8px; border-right: 1px solid #f0f2f5; max-width: none; }
#results th { padding: 0; border-right: 1px solid var(--line); z-index: 2; }
#results th:first-child, #results tbody tr:not(.gap):not(.wait) td:first-child { position: sticky; left: 0; background: #fff; border-right: 1px solid var(--line); font-weight: 600; }
#results th:first-child { z-index: 3; background: #eef1f5; }
#results tbody tr:not(.gap):hover td { background: #f4f8ff !important; }
#results tbody tr.sel:not(.gap) td { background: #e4eeff !important; }
#results .gap td { padding: 0; border: none; } #results .gap td.none { padding: 28px 16px; color: var(--muted); }
#results .gap, #results .wait { cursor: default; } #results .wait td { color: var(--muted); }
.hd { display: flex; align-items: stretch; height: 36px; }
.hd .sort { flex: 1; min-width: 0; border: none; background: none; border-radius: 0; padding: 8px 4px 8px 8px; text-align: left; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hd .sort.on { color: var(--blue); } .hd button.sort:hover, .hd .flt:hover { background: #dfe6ef; }
.hd .flt { border: none; background: none; border-radius: 0; padding: 0 8px; color: var(--muted); }
.hd .flt.on { background: var(--blue); color: #fff; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; } .chips:empty { display: none; }
.chip { padding: 4px 10px; border-radius: 14px; border-color: #b9cff3; background: #eaf2ff; color: var(--navy); font-size: 13px; }
#findInfo { margin: 8px 0 0; }
.pop { position: fixed; z-index: 30; width: 270px; max-height: calc(100vh - 16px); overflow: auto; padding: 12px; display: flex; flex-direction: column; gap: 8px; box-shadow: 0 8px 28px rgba(20, 30, 50, .22); }
.pop-head { display: flex; justify-content: space-between; align-items: center; } .pop-head button { padding: 2px 6px; }
.pop .row { display: flex; gap: 6px; align-items: center; } .pop .row.wrap { flex-wrap: wrap; } .pop .row > button { flex: 1 1 auto; padding: 6px 8px; } .pop .row input { flex: 1; min-width: 0; padding: 6px; }
.pop p { margin: 0; }
.vals { max-height: 260px; overflow: auto; border: 1px solid var(--line); border-radius: 7px; padding: 4px 8px; }
.vals label { flex-direction: row; align-items: center; gap: 8px; margin: 0; padding: 5px 0; color: var(--ink); }
.vals span { flex: 1; overflow-wrap: anywhere; } .vals i { font-style: normal; color: var(--muted); }
table { border-collapse: collapse; width: 100%; font-size: 13px; }
th { position: sticky; top: 0; background: #eef1f5; text-align: left; font-weight: 600; padding: 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 7px 8px; border-bottom: 1px solid #f0f2f5; white-space: nowrap; max-width: 260px; overflow: hidden; text-overflow: ellipsis; }
tbody tr { cursor: pointer; }
tbody tr:hover { background: #f4f8ff; }
tbody tr.sel { background: #e4eeff; }
.tag { display: inline-block; padding: 1px 7px; border-radius: 10px; font-size: 12px; background: #eef1f5; color: var(--ink); }
.tag.warn { background: #fff4d1; color: #7a5a00; }
#results tr.cur td { box-shadow: inset 0 2px 0 var(--blue), inset 0 -2px 0 var(--blue); }
.idle { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); z-index: 50; width: min(520px, calc(100vw - 24px)); display: flex; gap: 12px; align-items: center; justify-content: space-between; border: 2px solid var(--yellow); box-shadow: 0 8px 30px rgba(20, 30, 50, .3); }
.idle.hidden { display: none; } .idle button { white-space: nowrap; }
.tag.out { background: #eceef1; color: var(--muted); }

.detail { max-height: calc(100vh - 230px); overflow: auto; }
.detail .head { display: flex; justify-content: space-between; align-items: baseline; }
.detail .grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 10px; }
.detail .grid label.wide { grid-column: 1 / -1; }
.detail h3 { font-size: 13px; margin: 14px 0 6px; color: var(--navy); }
.detail table { font-size: 12px; }
.savebar { position: sticky; bottom: -16px; z-index: 2; margin: 10px -16px 0; padding: 8px 16px 12px; background: var(--card); border-top: 1px solid var(--line); }   /* 저장 줄은 늘 보이게(-16px은 카드 안쪽 여백) */
.savebar .msg { min-height: 0; margin: 0 0 6px; } .savebar .msg:empty { display: none; }
.detail .actions { display: flex; gap: 8px; align-items: flex-end; }
.detail .actions label { flex: 1; margin: 0; }


.two { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; max-width: 1100px; }
.radios { border: none; padding: 0; margin: 0; }
.radios label { flex-direction: row; align-items: center; gap: 8px; color: var(--ink); }
.radios input[type=text], .radios input:not([type]) { flex: 1; padding: 5px 8px; }

.result { margin-top: 14px; max-width: 1100px; }
.result .cards { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 12px; }
.result .cards div { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; min-width: 120px; }
.result .cards b { display: block; font-size: 22px; }
.result .cards .bad { border-color: var(--red); color: var(--red); }
.result .cards .good { border-color: var(--green); color: var(--green); }
.result details { background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; margin-bottom: 8px; }
.result summary { cursor: pointer; font-weight: 600; }
.verdict { padding: 12px 14px; border-radius: 10px; border: 1px solid var(--line); background: #fff; }
.verdict.new { border-left: 5px solid var(--green); }
.verdict.rejoin { border-left: 5px solid var(--yellow); }
.verdict.bad { border-left: 5px solid var(--red); }
.scroll { overflow: auto; max-height: 420px; }
td.wrap { white-space: normal; max-width: 520px; }
.mapbox { margin: 10px 0 12px; }
.mapbox details { border: none; padding: 0; }
.mapbox td { max-width: 180px; }
.mapbox .radios { margin-top: 8px; }
.mapbox .radios input { flex: none; width: auto; }
.mapbox .actions { margin-top: 10px; }
.admin-only { }
body:not(.admin) .admin-only { display: none !important; }
@media (max-width: 1000px) {
  .split.with-detail, .two { grid-template-columns: minmax(0, 1fr); }
  .split.with-detail .detail { position: fixed; inset: 0; z-index: 20; max-height: none; border-radius: 0; }   /* 좁은 화면은 상세를 전체 화면으로 */
}
@media (max-width: 640px) {   /* 휴대폰 */
  input, select, textarea { font-size: 16px; }   /* 아이폰이 입력할 때 화면을 확대하지 않게 */
  .top { flex-wrap: wrap; gap: 6px 12px; padding: 8px 12px; }
  .stats { order: 3; flex-basis: 100%; flex-wrap: wrap; gap: 4px 10px; font-size: 12px; }
  .tabs { padding: 0 8px; overflow-x: auto; }
  .tabs button { padding: 10px 10px; white-space: nowrap; }
  .tab { padding: 12px; }
  .bar input#q { min-width: 0; flex-basis: 100%; }
  .tablewrap { max-height: none; }
  .bar button { flex: 1; }
  .detail .grid { grid-template-columns: 1fr; }
  .login-card { width: calc(100vw - 32px); }
  .result .cards div { min-width: 0; flex: 1 1 40%; }
}
.login .chk { display: flex; flex-direction: row; align-items: center; justify-content: flex-start; gap: 8px; margin: 12px 0; }
.login .chk input { width: 18px; height: 18px; margin: 0; flex: none; }
.dev { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 0; border-bottom: 1px solid #e3e7ee; }
.dev .tag { margin-left: 8px; }
.dev p { margin: 4px 0 0; overflow-wrap: anywhere; }
.cut { background: #fff; color: #b3261e; border: 1px solid #d9a5a1; white-space: nowrap; }
.cut:disabled { color: #9aa3b2; border-color: #d5dbe5; }
#devOthers { margin-top: 14px; }
