/* ===========================================================================
   okrace 인트라넷 — 공통 스타일
   원본은 HTML4 프레임셋 + 테이블 레이아웃 + 고정폭(750px) 이었다.
   화면 구성과 업무 흐름은 그대로 두고 표현만 반응형으로 바꾼다.
   =========================================================================== */

:root {
    --bg: #f4f5f7;
    --panel: #ffffff;
    --line: #d7dbe0;
    --line-soft: #e8eaee;
    --text: #1f2328;
    --text-dim: #5b636b;
    --head: #eceef1;
    --accent: #1b5fa8;
    --accent-soft: #e7f0fa;
    --danger: #b3261e;
    --ok: #1a7f37;
    --radius: 6px;
}

* { box-sizing: border-box; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--text);
    font: 14px/1.5 "맑은 고딕", "Malgun Gothic", -apple-system, system-ui, sans-serif;
}

/* ── 상단바 ────────────────────────────────────────────────────────────── */
.topbar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: 48px;
    padding: 0 14px;
    background: var(--accent);
    color: #fff;
    position: sticky;
    top: 0;
    z-index: 20;
}

.topbar .brand { color: #fff; text-decoration: none; font-weight: 600; white-space: nowrap; }
.topbar-right { margin-left: auto; display: flex; align-items: center; gap: 10px; }
.topbar .who { font-size: 13px; opacity: .92; }
.inline { display: inline; margin: 0; }

.menu-toggle {
    display: none;
    background: transparent;
    border: 1px solid rgba(255,255,255,.5);
    color: #fff;
    border-radius: 4px;
    padding: 3px 8px;
    cursor: pointer;
    font-size: 15px;
}

/* ── 뼈대 ──────────────────────────────────────────────────────────────── */
.shell { display: flex; align-items: flex-start; min-height: calc(100vh - 48px); }

.sidemenu {
    width: 190px;
    flex: 0 0 190px;
    background: var(--panel);
    border-right: 1px solid var(--line);
    padding: 14px 0;
    min-height: calc(100vh - 48px);
}

.menu-group { margin-bottom: 6px; }

/* 묶음 제목 = 접기/펼치기 단추. 원본은 GIF 이미지에 jsClickShow() 아코디언이었다. */
.menu-group-title {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 100%;
    background: transparent;
    border: 0;
    border-left: 3px solid transparent;
    padding: 7px 12px 7px 13px;
    font: inherit;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim);
    letter-spacing: .02em;
    text-align: left;
    cursor: pointer;
}
.menu-group-title:hover { background: var(--head); }
.menu-caret {
    flex: 0 0 auto;
    width: 0;
    height: 0;
    border-left: 4px solid currentColor;
    border-top: 4px solid transparent;
    border-bottom: 4px solid transparent;
    transition: transform .12s ease;
}
.menu-group-title[aria-expanded="true"] .menu-caret { transform: rotate(90deg) translateX(-1px); }
.menu-count {
    margin-left: auto;
    font-size: 10px;
    font-weight: 400;
    color: #9aa1a8;
}

.sidemenu a, .sidemenu .menu-disabled {
    display: block;
    padding: 6px 16px 6px 30px;
    color: var(--text);
    text-decoration: none;
    border-left: 3px solid transparent;
}
.sidemenu a:hover { background: var(--accent-soft); border-left-color: var(--accent); }
.sidemenu a.current { background: var(--accent-soft); border-left-color: var(--accent); font-weight: 600; }
.sidemenu .menu-disabled { color: #a6acb3; cursor: not-allowed; }
/* 원본이 회색으로 칠해 둔 항목. 누르기는 된다 — 원본도 그렇다. */
.sidemenu a.menu-dim { color: #8b9299; }
.sidemenu a.menu-external::after { content: " ↗"; color: #9aa1a8; font-size: 11px; }

.content { flex: 1 1 auto; padding: 18px; min-width: 0; }
.content-plain { padding: 0; }

/* ── 패널 ──────────────────────────────────────────────────────────────── */
.panel {
    background: var(--panel);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    margin-bottom: 16px;
}
.panel > h2 {
    margin: 0;
    padding: 11px 14px;
    font-size: 15px;
    border-bottom: 1px solid var(--line);
    background: var(--head);
    border-radius: var(--radius) var(--radius) 0 0;
}
.panel-body { padding: 14px; }
.panel-foot {
    padding: 11px 14px;
    border-top: 1px solid var(--line-soft);
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}

/* ── 표 ────────────────────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
table.grid th, table.grid td {
    border: 1px solid var(--line-soft);
    padding: 6px 8px;
    text-align: left;
    vertical-align: middle;
}
table.grid thead th { background: var(--head); font-weight: 600; white-space: nowrap; }
table.grid tbody tr:hover { background: #f8fafc; }
table.grid td.num, table.grid th.num { text-align: center; width: 56px; }

/* ── 두 단 머리글 (출마표의 총전적·1년전적) ────────────────────────────────
   원본 bas_1200_l.jsp:137-160 은 「총전적」 아래에 1착·2착·계를 둔다.
   묶음 머리글은 아래 테두리를 지워 **하나로 묶여 보이게** 한다 - 선이 남으면
   묶음과 하위 칸이 따로 노는 표처럼 보인다. */
table.grid thead th.grp { border-bottom-color: var(--head); }
table.grid thead th.sub { font-weight: 500; font-size: 12px; }
/* 전적은 한두 자리 숫자다. 오른쪽에 붙여 자릿수가 눈에 들어오게 한다(원본도 align=right). */
table.grid td.rec-n, table.grid th.rec-n { text-align: right; width: 44px; }
table.grid td.ctr, table.grid th.ctr { text-align: center; }
table.grid tr.row-click { cursor: pointer; }
.empty { text-align: center; color: var(--text-dim); padding: 22px 0; }

/* ── 폼 ────────────────────────────────────────────────────────────────── */
fieldset {
    border: 1px solid var(--line);
    border-radius: var(--radius);
    padding: 12px 14px;
    margin: 0 0 14px;
}
legend { font-weight: 600; padding: 0 6px; font-size: 13px; }

.field { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.field > label { flex: 0 0 120px; color: var(--text-dim); cursor: help; }
.field .hint { font-size: 12px; color: var(--text-dim); }

input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
    border: 1px solid var(--line);
    border-radius: 4px;
    padding: 6px 8px;
    font: inherit;
    background: #fff;
    color: var(--text);
    max-width: 100%;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
input[readonly] { background: #f1f2f4; color: var(--text-dim); }
textarea { width: 100%; min-height: 72px; resize: vertical; }
.w-sm { width: 90px; }
.w-md { width: 170px; }
.w-lg { width: 280px; }

.mobile-set { display: flex; align-items: center; gap: 4px; }

/* 권한 체크박스 격자 */
.perm-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
    gap: 4px 12px;
}
.perm-grid label { display: flex; align-items: center; gap: 6px; cursor: help; font-size: 13px; }
.perm-grid .mark { color: var(--accent); font-weight: 600; }

/* ── 버튼 ──────────────────────────────────────────────────────────────── */
.btn {
    border: 1px solid var(--line);
    background: #fff;
    color: var(--text);
    border-radius: 4px;
    padding: 6px 13px;
    cursor: pointer;
    font: inherit;
}
.btn:hover { background: #f2f4f7; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: #17538f; }
.btn-danger { background: #fff; border-color: var(--danger); color: var(--danger); }
.btn-danger:hover { background: #fdecea; }
.btn-ghost { background: transparent; border-color: rgba(255,255,255,.55); color: #fff; }
.btn-ghost:hover { background: rgba(255,255,255,.14); }
.btn-sm { padding: 3px 9px; font-size: 12px; }
/* 목록 종류 고르기 (로그관리의 접속성공/실패/전체) */
.tabs { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.btn-on { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-on:hover { background: #17538f; }


/* ── 알림 ──────────────────────────────────────────────────────────────── */
.msg { padding: 9px 12px; border-radius: 4px; margin-bottom: 14px; border: 1px solid; }
.msg-ok { background: #e9f6ec; border-color: #b7dfc2; color: var(--ok); }
.msg-err { background: #fdecea; border-color: #f3c2bd; color: var(--danger); }

/* ── 페이지 이동 ───────────────────────────────────────────────────────── */
.pager { display: flex; gap: 4px; justify-content: center; align-items: center; padding: 12px 0 2px; flex-wrap: wrap; }
.pager a, .pager span {
    min-width: 30px;
    text-align: center;
    padding: 4px 7px;
    border: 1px solid var(--line);
    border-radius: 4px;
    text-decoration: none;
    color: var(--text);
    background: #fff;
}
.pager .cur { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 600; }
.pager .off { color: #b7bcc2; background: #f6f7f9; }

/* ── 로그인 ────────────────────────────────────────────────────────────── */
.login-wrap {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    background: linear-gradient(160deg, #1b5fa8 0%, #123f70 100%);
}
.login-card {
    width: 100%;
    max-width: 380px;
    background: #fff;
    border-radius: 10px;
    padding: 28px 26px;
    box-shadow: 0 10px 30px rgba(0,0,0,.22);
}
.login-card h1 { margin: 0 0 4px; font-size: 18px; }
.login-card .sub { margin: 0 0 20px; color: var(--text-dim); font-size: 13px; }
.login-card .field > label { flex: 0 0 74px; }
.login-card input[type=text], .login-card input[type=password] { flex: 1 1 auto; min-width: 0; }
.login-card .btn { width: 100%; margin-top: 8px; padding: 9px; }

/* ── 좁은 화면 ─────────────────────────────────────────────────────────── */
@media (max-width: 860px) {
    .menu-toggle { display: inline-block; }
    .sidemenu {
        position: fixed;
        top: 48px;
        left: 0;
        bottom: 0;
        z-index: 15;
        transform: translateX(-100%);
        transition: transform .18s ease;
        box-shadow: 2px 0 10px rgba(0,0,0,.12);
    }
    .sidemenu.open { transform: translateX(0); }
    .content { padding: 12px; }
    .topbar .who { display: none; }
    .field > label { flex: 0 0 100%; }
}

/* ── 출마표 (그리드 입력) ───────────────────────────────────────────────── */
.sub-note { font-weight: 400; font-size: 12px; color: var(--text-dim); }
.note { color: var(--text-dim); font-size: 12px; margin: 10px 0 0; }
.note.ctr { text-align: center; }
.unit { color: var(--text-dim); font-size: 12px; }

.searchbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.searchbar > label { color: var(--text-dim); cursor: help; }
fieldset.inline-set { display: inline-flex; align-items: center; gap: 10px; margin: 0; padding: 4px 10px; }
fieldset.inline-set legend { font-size: 12px; }
fieldset.inline-set label { display: inline-flex; align-items: center; gap: 4px; cursor: help; }

.race-card > h2 { display: flex; align-items: center; gap: 10px; }
.race-card > h2 .btn { margin-left: auto; }

/* ── 경주 머리표 (출마표 1200) ─────────────────────────────────────────────
   원본 bas_1200_l.jsp 의 머리표를 그대로 옮긴 것이다. 라벨 칸을 옅게 깔아
   "무엇을 말하는 칸인지"가 한눈에 갈리게 한다 - 원본도 #DDDDDD 로 그렇게 했다.

   ★ 앞서 이 자리를 <dl> + grid 로 깔았다가 **라벨과 값의 짝이 어긋났다.**
     격자에서는 dt 와 dd 가 각각 한 칸을 차지해 줄이 바뀌면 따로 논다.
     표로 두면 그 어긋남이 구조적으로 생기지 않는다. */
table.race-meta {
    border-collapse: collapse;
    table-layout: fixed;          /* colgroup 의 너비를 그대로 지키게 한다 */
    width: 100%;
    margin: 0 0 12px;
    font-size: 13px;
}
table.race-meta col.lab { width: 84px; }
table.race-meta col.lab.wide { width: 96px; }   /* 「레이팅조건」이 다섯 글자다 */
table.race-meta th, table.race-meta td {
    border: 1px solid var(--line-soft);
    padding: 5px 8px;
    text-align: left;
    vertical-align: middle;
}
table.race-meta > tbody > tr > th {
    background: var(--head);
    color: var(--text-dim);
    font-weight: 600;
    white-space: nowrap;
    cursor: help;
}
table.race-meta > tbody > tr > td { background: var(--panel); white-space: nowrap; }
/* 상금배율은 안쪽 표를 통째로 안는다. 바깥 칸의 여백을 없애 겹줄이 안 생기게 한다. */
table.race-meta td.prize-cell { padding: 0; }

table.race-prize {
    border-collapse: collapse;
    table-layout: fixed;
    width: 100%;
}
table.race-prize th, table.race-prize td {
    border: 1px solid var(--line-soft);
    padding: 5px 8px;
    text-align: left;
    white-space: nowrap;
}
table.race-prize th {
    background: var(--head);
    color: var(--text-dim);
    font-weight: 600;
}
/* 원본은 금액을 왼쪽에 붙여 그린다. 칸이 넓어 오른쪽으로 밀면 라벨과 멀어져 읽기 나쁘다. */
table.race-prize td { text-align: left; }
table.race-prize col.lab { width: 56px; }

/* ── 경주 목록의 제목 띠 (원본 bas_1100_l.jsp:56-60 의 회색 띠) ──────────────
   원본은 경주마다 회색 띠에 제목 한 줄과 [수정] 단추를 둔다. 머리글 줄은 없다.
   앞서 헤더 칸을 표 줄로 그렸더니 이름 없는 칸이 `ADD_1착 상금` 처럼
   DB 칸 이름 그대로 보였다 — 원본에 없는 줄이라 가져올 이름도 없었다. */
table.race-list { border-collapse: collapse; width: 100%; }
table.race-list > tbody > tr > td { border: 1px solid var(--line-soft); padding: 0; }
td.race-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    background: var(--head);
    padding: 6px 10px !important;
    font-weight: 600;
}
.race-title-text { cursor: help; }
/* 펼친 내용은 띠 아래에 여백을 두고 놓인다. */
tr.race-det-wrap > td { padding: 8px 10px !important; }

/* 그리드 입력 표 */
table.grid-input { min-width: 1180px; }
table.grid-input td { padding: 2px 3px; }
table.grid-input input[type=text] { padding: 3px 4px; font-size: 12px; width: 100%; }
table.grid-input input[readonly] { background: #eef0f2; border-color: var(--line-soft); }
table.grid-input td.rec { white-space: nowrap; font-size: 12px; color: var(--text-dim); }
table.grid-input .w-sm { width: 78px; }
table.grid-input .w-md { width: 120px; }

tr.row-cancel { background: #fbf0ef; }
tr.row-cancel td { color: #9b6a66; text-decoration: line-through; }
tr.row-cancel input { text-decoration: none; }

/* 경고 패널 */
.panel-warn { border-color: #e3b7b3; }
.panel-warn > h2 { background: #fdecea; color: var(--danger); border-bottom-color: #e3b7b3; }
.warn-text { color: var(--danger); font-weight: 600; }
.del-list { margin: 8px 0; padding-left: 20px; }
.del-list li { line-height: 1.9; }

.panel-edit { border-color: var(--accent); }
.panel-edit > h2 { background: var(--accent-soft); }

/* ── 모달 (출마표 선택 팝업 등) ─────────────────────────────────────────── */
.modal-back {
    position: fixed;
    inset: 0;
    background: rgba(20, 24, 28, .45);
    display: flex;
    align-items: flex-start;
    justify-content: center;
    padding: 40px 16px;
    z-index: 50;
    overflow: auto;
}
.modal {
    background: var(--panel);
    border-radius: var(--radius);
    width: 100%;
    max-width: 720px;
    box-shadow: 0 14px 40px rgba(0,0,0,.28);
}
.modal-head {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 11px 14px;
    border-bottom: 1px solid var(--line);
    background: var(--head);
    border-radius: var(--radius) var(--radius) 0 0;
}
.modal-head .modal-close { margin-left: auto; }
.modal-body { padding: 14px; }

.picker-head {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    margin-bottom: 10px;
}
.picker-rounds { display: flex; gap: 4px; flex-wrap: wrap; margin-left: auto; }
table.picker-grid { min-width: 520px; }
table.picker-grid tbody tr { cursor: pointer; }

/* ── 전문가 예상 (경주 회차 칩) ─────────────────────────────────────────── */
.rnd-list { display: flex; gap: 6px; flex-wrap: wrap; }
.rnd-chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 6px 12px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    color: var(--text);
    text-decoration: none;
    font-size: 13px;
}
.rnd-chip:hover { background: var(--accent-soft); border-color: var(--accent); }
.rnd-chip.done { background: #eef6ef; border-color: #b7dfc2; }
.rnd-chip.cur { background: var(--accent); border-color: var(--accent); color: #fff; }
.rnd-chip .mark-done { color: var(--ok); font-size: 9px; }
.rnd-chip.cur .mark-done { color: #d9f0de; }
.w-xs { width: 52px; }
.menu-note {
    display: block;
    padding: 6px 16px;
    font-size: 11px;
    color: #8b9299;
    line-height: 1.5;
    cursor: help;
}

/* 적중률 2100 — 경주별 예상 대조 */
.race-block { margin-bottom: 18px; }
.race-block h3 { font-size: 13px; margin: 0 0 6px; }
.grid td.hit { background: #fff6d8; }

/* 주행심사 성적 — 단평 칸은 길어서 폭을 묶고 넘치면 줄인다 */
.grid td.cmmt { max-width: 260px; white-space: normal; word-break: break-all; }
.grid.narrow th { background: #eef1f4; text-align: left; width: 90px; }

/* 테두리 없는 fieldset — 폼 전체를 잠글 때만 쓴다(전문위원 조회 전용 화면) */
.plain-set { border: 0; margin: 0; padding: 0; min-width: 0; }
.plain-set[disabled] { opacity: .85; }

/* 원본이 한 화면을 제목 다른 표 여럿으로 가르는 자리 (SplitTables.g.cs)
   — 1500 관심마/신마 · 3800 전개 유리/불리 마필.
   원본은 회색 제목 상자를 쓰는데, 여기서는 같은 뜻이 서게만 한다. */
.split-title {
    font-size: 13px;
    margin: 14px 0 6px;
    padding-left: 8px;
    border-left: 3px solid var(--accent, #3f6ea8);
}
.split-title:first-child { margin-top: 0; }
.grid td.empty { color: var(--text-dim); padding: 14px 0; }

/* 경주 목록에 출전마를 펼쳐 그린다 (원본 bas_1100_l.jsp 짜임).
   경주 줄이 눌리는 줄이고, 그 아래 표는 그 경주의 명세다. */
.grid tr.race-head > td { background: #eef2f7; font-weight: 600; }
.grid tr.race-det-wrap > td { padding: 0 0 10px 18px; background: #fff; }
.grid table.grid.inner { width: auto; min-width: 60%; }
.grid table.grid.inner th { background: #f6f7f9; font-weight: 400; }
.grid tr.race-det-wrap .empty { margin: 6px 0; color: var(--text-dim); }

/* ── 조교상태(expert/training_new/4000) 판 ──────────────────────────────────
   원본은 조교량 부호를 단위마다 다른 색으로 그린다
   (exp_4000_l.jsp:7-36 getTraining — blue·darkcyan·red·brown).
   그 색을 그대로 쓴다. 「어느 것이 속이고 어느 것이 구인지」를 색으로 읽는
   사람이 있어, 색을 통일하면 원본을 보던 눈에는 정보가 사라진다. */
.train-board td { padding: 2px 4px; white-space: nowrap; }
.train-board .hors-nm { font-weight: 600; color: mediumblue; }
.train-board .tr-fast  { color: blue; }
.train-board .tr-round { color: darkcyan; }
.train-board .tr-hard  { color: red; }
.train-board .tr-drill { color: brown; }
