:root {
  --bg: #f5f7f6; --card: #fff; --line: #e2e8e5; --text: #1d2b25; --muted: #6b7b74;
  --pri: #1f7a4d; --pri-d: #17603c; --red: #c0392b; --radius: 8px;
  font: 14px/1.5 system-ui, -apple-system, "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  color: var(--text); background: var(--bg);
}
* { box-sizing: border-box; }
body { margin: 0; }
a { color: var(--pri); }
h1 { font-size: 22px; margin: 0; }
h2 { font-size: 16px; margin: 0 0 12px; }
code { background: #eef2f0; padding: 1px 6px; border-radius: 4px; font-size: 12px; }
.muted { color: var(--muted); }
.sm { font-size: 12px; }
.sp { flex: 1; }

/* 레이아웃 */
.top { height: 52px; display: flex; align-items: center; gap: 12px; padding: 0 20px; background: #14432d; color: #fff; position: sticky; top: 0; z-index: 5; }
.wrap { display: flex; min-height: calc(100vh - 52px); }
.side { width: 200px; flex-shrink: 0; background: #fff; border-right: 1px solid var(--line); padding: 12px 8px; }
.side a { display: block; padding: 9px 12px; border-radius: 6px; color: var(--text); text-decoration: none; }
.side a:hover { background: #eef4f1; }
.side a.on { background: #e3f0e9; color: var(--pri); font-weight: 600; }
main { flex: 1; min-width: 0; max-width: 100vw; padding: 24px 28px; }
.head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px; margin-bottom: 16px; }

/* 폼 */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 16px; }
.f { display: flex; flex-direction: column; gap: 4px; }
.f.wide { grid-column: 1 / -1; }
.f > span { font-size: 12px; font-weight: 600; color: var(--muted); }
.f small { font-size: 12px; color: var(--muted); }
input, select, textarea { width: 100%; font: inherit; color: inherit; padding: 8px 10px; border: 1px solid #cfd8d3; border-radius: 6px; background: #fff; }
input:focus, select:focus, textarea:focus { outline: 2px solid #9fd0b6; border-color: var(--pri); }
:disabled { background: #f0f2f1; color: #8a958f; }
.chk { display: flex; align-items: center; gap: 8px; align-self: end; padding: 8px 0; }
.chk input { width: auto; }
.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 13px; }
.static { padding: 8px 0; }
.row { display: flex; gap: 8px; align-items: end; flex-wrap: wrap; }
.actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px; }
.logo { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.logo img { max-height: 64px; max-width: 160px; border: 1px solid var(--line); border-radius: 4px; }
.logo input[type=file] { width: auto; }

/* 버튼 */
.btn { display: inline-flex; align-items: center; gap: 4px; padding: 8px 14px; border: 1px solid #cfd8d3; border-radius: 6px; background: #fff; color: var(--text); font: inherit; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { background: #f2f5f3; }
.btn:disabled { opacity: .5; cursor: default; }
.btn.pri { background: var(--pri); border-color: var(--pri); color: #fff; }
.btn.pri:hover { background: var(--pri-d); }
.btn.danger { color: var(--red); border-color: #e9b9b3; }
.btn.sm { padding: 4px 10px; font-size: 12px; }
.btn.block { width: 100%; justify-content: center; }
.top .btn { background: transparent; color: #fff; border-color: #ffffff55; }

/* 표 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 12px; }
.filters > * { width: auto; min-width: 160px; }
.filters label { display: flex; align-items: center; gap: 6px; min-width: 0; }
.filters label input { width: auto; }
.filters > .btn { min-width: 0; }
.tbl { overflow-x: auto; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { background: #f7f9f8; font-size: 12px; color: var(--muted); }
tbody tr:last-child td { border-bottom: 0; }
tr[data-href] { cursor: pointer; }
tr[data-href]:hover td { background: #f4f9f6; }
.empty { padding: 32px; text-align: center; color: var(--muted); background: #fff; border: 1px dashed var(--line); border-radius: var(--radius); }

/* 배지·칩 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; background: #eceff0; color: #555; }
.badge.green { background: #dcf3e6; color: #17603c; }
.badge.red { background: #fbe3e0; color: #a5281b; }
.badge.blue { background: #e0eaff; color: #1e4fc2; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 14px; background: #eef4f1; font-size: 13px; }
.chip button { border: 0; background: none; padding: 0; cursor: pointer; color: var(--muted); font-size: 14px; }

/* 기타 블록 */
.alert { padding: 12px 14px; border-radius: 6px; background: #fbe3e0; color: #7d2016; margin-bottom: 16px; }
.alert.warn { background: #fff4d6; color: #7a5a00; }
.summary { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; margin-bottom: 16px; color: var(--muted); }
.summary b { color: var(--text); }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 12px; margin: 16px 0 24px; }
.stat { display: block; padding: 16px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius); color: inherit; text-decoration: none; }
.stat b { display: block; font-size: 28px; color: var(--pri); }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 8px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.tree, .tree ul { list-style: none; margin: 0; padding: 0; }
.tree { background: #fff; border: 1px solid var(--line); border-radius: var(--radius); padding: 8px; }
.tree ul { margin-left: 22px; padding-left: 10px; border-left: 1px dashed #cfd8d3; }
.node { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; }
.node:hover { background: #f4f9f6; }
.login { max-width: 360px; margin: 12vh auto; display: flex; flex-direction: column; gap: 12px; }

/* 토스트·다이얼로그 */
#toast { position: fixed; right: 20px; bottom: 20px; z-index: 100; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 10px 16px; border-radius: 6px; background: #14432d; color: #fff; box-shadow: 0 4px 12px #0003; animation: in .2s; }
.toast.err { background: var(--red); }
.toast.warn { background: #a8740b; }
@keyframes in { from { opacity: 0; transform: translateY(8px); } }
dialog { width: min(420px, 92vw); border: 0; border-radius: 10px; padding: 20px; box-shadow: 0 12px 40px #0004; }
dialog::backdrop { background: #0006; }
dialog h3 { margin: 0 0 14px; }
.dbody { display: flex; flex-direction: column; gap: 12px; }

/* 대회 상세 탭 · 결과/상금 */
.tabs { display: flex; gap: 2px; border-bottom: 2px solid var(--line); margin-bottom: 16px; overflow-x: auto; }
.tabs a { padding: 9px 16px; color: var(--muted); text-decoration: none; border-bottom: 2px solid transparent; margin-bottom: -2px; white-space: nowrap; }
.tabs a:hover { color: var(--text); }
.tabs a.on { color: var(--pri); border-bottom-color: var(--pri); font-weight: 600; }
.bar { display: flex; align-items: center; justify-content: space-between; gap: 12px 20px; flex-wrap: wrap; }
fieldset, fieldset:disabled { border: 0; padding: 0; margin: 0; min-width: 0; background: none; }
tr.voided td { background: #fafafa; color: #9aa39f; }
td.memo { white-space: normal; min-width: 140px; max-width: 260px; }
td .btn + .btn { margin-left: 4px; }
.pager { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 12px; color: var(--muted); }
.pager:empty { display: none; }
pre.json { margin: 0; padding: 12px; background: #f4f6f5; border-radius: 6px; font-size: 12px; overflow: auto; max-height: 320px; }
dialog.wide { width: min(900px, 94vw); }
dialog h4 { margin: 8px 0 0; font-size: 14px; }

@media (max-width: 760px) {
  .wrap { flex-direction: column; }
  .side { width: auto; display: flex; overflow-x: auto; padding: 6px; border-right: 0; border-bottom: 1px solid var(--line); }
  .side a { white-space: nowrap; }
  main { padding: 16px; }
}
