:root {
  --bg: #F5F6F8; --surface: #fff; --line: #E3E6EB; --line2: #F0F2F5; --text: #1B1F24; --text2: #3B4350; --muted: #5B6472;
  --accent: #1F4FD1; --accent-dark: #163A9C; --accent-bg: #E8EEFC;
  --green: #1F5F3D; --green-bg: #E6F4EC; --amber: #8A4B08; --amber-bg: #FEF3E2; --red: #9B1C1C; --red-bg: #FDECEC;
}
* { box-sizing: border-box; }
html, body { word-break: keep-all; margin: 0; background: var(--bg); color: var(--text); font-family: 'Noto Sans KR', 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif; font-size: 14px; }
a { color: var(--accent); } a:hover { color: var(--accent-dark); }
h1 { font-size: 24px; margin: 0; } h2 { font-size: 16px; margin: 0; } h3 { font-size: 17px; margin: 0; }
.hidden { display: none !important; }
.muted { color: var(--muted); } .small { font-size: 12px; } .boot { padding: 40px; color: var(--muted); }
.sp { flex: 1; }

/* 레이아웃 */
.layout { display: flex; flex-wrap: wrap; min-height: 100vh; }
.side { flex: 1 1 200px; max-width: 230px; background: var(--surface); border-right: 1px solid var(--line); padding: 20px 12px; display: flex; flex-direction: column; gap: 4px; }
.side .brand { padding: 4px 12px 20px; display: flex; flex-direction: column; gap: 6px; }
.side .brand img { width: 170px; height: auto; display: block; }
.side .brand span { font-size: 12px; color: var(--muted); letter-spacing: .04em; }
.nav { display: flex; align-items: center; justify-content: space-between; gap: 8px; padding: 10px 12px; border-radius: 8px; color: var(--text2); text-decoration: none; min-height: 24px; }
.nav:hover { background: #EEF1F6; color: var(--text); }
.nav.on { background: var(--accent-bg); color: var(--accent); font-weight: 500; }
.badge { background: var(--accent); color: #fff; border-radius: 10px; font-size: 12px; padding: 1px 8px; }
.side .me { margin-top: auto; padding: 12px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); display: flex; gap: 8px; flex-wrap: wrap; }
.side .me a { color: var(--text2); }
.main { flex: 999 1 560px; min-width: 0; }
.page { padding: 28px 32px; display: flex; flex-direction: column; gap: 16px; }
.page-head { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.page-head .tools { margin-left: auto; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.crumb { font-size: 13px; color: var(--muted); }
@media (max-width: 760px) { .side { max-width: none; flex-basis: 100%; flex-direction: row; flex-wrap: wrap; padding: 10px; } .side .brand { padding: 4px 8px; } .side .brand img { width: 120px; } .side .me { margin-top: 0; border: 0; } .page { padding: 16px; } }

/* 카드·버튼 */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.card.pad { padding: 20px; }
.card-head { display: flex; align-items: center; gap: 8px; padding: 16px 16px 8px; }
.card-head a, .card-head .right { margin-left: auto; font-size: 13px; }
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; }
.stat { padding: 18px 20px; }
.stat .lbl { font-size: 13px; color: var(--muted); }
.stat .num { font-size: 28px; font-weight: 700; margin-top: 6px; }
.stat .num small { font-size: 15px; font-weight: 400; }
.stat .hint { font-size: 13px; color: var(--muted); margin-top: 4px; }
.stat .hint.warn { color: #B45309; }
.row { display: flex; flex-wrap: wrap; gap: 16px; align-items: flex-start; }
.row > * { flex: 1 1 420px; min-width: 0; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 40px; padding: 0 16px; border-radius: 8px; border: 1px solid #D4D8DF; background: #fff; color: var(--text); font: inherit; font-size: 14px; cursor: pointer; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: #B9BFC9; color: var(--text); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; font-weight: 500; }
.btn.primary:hover { background: var(--accent-dark); color: #fff; }
.btn.danger { color: var(--red); border-color: #E7A3A3; }
.btn.sm { min-height: 32px; padding: 0 10px; font-size: 13px; }
.btn:disabled { opacity: .5; cursor: default; }
.icon-btn { border: 0; background: transparent; font-size: 18px; cursor: pointer; color: var(--muted); min-width: 36px; min-height: 36px; border-radius: 8px; }
.icon-btn:hover { background: var(--line2); }
.chip { min-height: 34px; padding: 0 14px; border-radius: 17px; border: 1px solid #D4D8DF; background: #fff; font: inherit; font-size: 13px; cursor: pointer; }
.chip.on { border-color: var(--accent); background: var(--accent-bg); color: var(--accent-dark); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.tabs button { min-height: 44px; padding: 0 16px; border: 0; border-bottom: 2px solid transparent; background: transparent; font: inherit; color: var(--text2); cursor: pointer; }
.tabs button.on { border-bottom-color: var(--accent); color: var(--accent); font-weight: 500; }
.seg { display: inline-flex; gap: 4px; background: #E9ECF1; border-radius: 10px; padding: 4px; flex-wrap: wrap; }
.seg button { min-height: 34px; padding: 0 14px; border-radius: 8px; border: 0; background: transparent; font: inherit; color: var(--text2); cursor: pointer; }
.seg button.on { background: #fff; color: var(--text); font-weight: 500; }

/* 필터·폼 */
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.filters label { font-size: 13px; color: var(--muted); display: flex; align-items: center; gap: 6px; }
input, select, textarea { font: inherit; font-size: 14px; color: var(--text); border: 1px solid #D4D8DF; border-radius: 8px; background: #fff; }
input:not([type=checkbox]):not([type=radio]), select { min-height: 38px; padding: 0 10px; }
textarea { padding: 8px 10px; width: 100%; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #BFD0F7; border-color: var(--accent); }
input:disabled, select:disabled { background: var(--bg); color: var(--muted); }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px 16px; }
.form-grid .full { grid-column: 1 / -1; }
.field { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--muted); }
.field input:not([type=checkbox]):not([type=radio]), .field select { width: 100%; min-height: 40px; }
.field small { font-size: 12px; color: var(--muted); }
.checks { display: flex; flex-wrap: wrap; gap: 8px 14px; color: var(--text); font-size: 14px; padding-top: 4px; }
.actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 4px; }
fieldset.card { margin: 0; padding: 20px; }
fieldset.card legend { font-size: 16px; font-weight: 700; padding: 0 4px; color: var(--text); }
@media (max-width: 640px) { .form-grid { grid-template-columns: minmax(0, 1fr); } }

/* 표 */
.tbl-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl th { text-align: left; color: var(--muted); font-weight: 500; font-size: 13px; padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { word-break: keep-all; padding: 11px 14px; border-bottom: 1px solid var(--line2); vertical-align: middle; }
.tbl tr.click { cursor: pointer; } .tbl tr.click:hover td { background: #F8F9FB; }
.tbl tr.sel td { background: #F3F6FE; }
.tbl tr.bad td { background: #FFF7F7; }
.tbl .num { text-align: right; white-space: nowrap; } .tbl .c { text-align: center; } .tbl .nw { white-space: nowrap; }
.tbl select { min-height: 32px; font-size: 13px; }
.empty { padding: 28px; text-align: center; color: var(--muted); margin: 0; }
.pill { display: inline-block; font-size: 12px; padding: 2px 10px; border-radius: 10px; white-space: nowrap; }
.pill.gray { background: var(--line2); color: var(--text2); } .pill.green { background: var(--green-bg); color: var(--green); }
.pill.amber { background: var(--amber-bg); color: var(--amber); } .pill.red { background: var(--red-bg); color: var(--red); }
.pill.blue { background: var(--accent-bg); color: var(--accent-dark); }
.bar { width: 90px; height: 6px; background: var(--line); border-radius: 3px; display: inline-block; vertical-align: middle; margin-right: 8px; }
.bar i { display: block; height: 6px; background: var(--accent); border-radius: 3px; }
.note { border-radius: 8px; padding: 10px 12px; font-size: 13px; line-height: 1.6; }
.note.blue { background: var(--accent-bg); color: var(--accent-dark); } .note.amber { background: var(--amber-bg); color: #6B3A06; } .note.gray { background: var(--bg); color: var(--text2); }
dl.info { display: grid; grid-template-columns: 110px minmax(0, 1fr); gap: 10px 12px; margin: 0; }
dl.info dt { color: var(--muted); } dl.info dd { margin: 0; }
.sum-bar { display: flex; flex-wrap: wrap; gap: 24px; padding: 14px 18px; }
.sum-bar b { font-size: 18px; }

/* 자료 */
.thumb { width: 48px; height: 48px; border-radius: 6px; background: var(--line); display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--muted); overflow: hidden; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.preview { min-height: 320px; background: var(--line2); border-radius: 8px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.preview img { max-width: 100%; max-height: 520px; display: block; }
.preview iframe { width: 100%; height: 520px; border: 0; }
.drop { border: 2px dashed #C9CED6; border-radius: 12px; padding: 28px; text-align: center; color: var(--muted); }
.drop.over { border-color: var(--accent); background: var(--accent-bg); }
.msg-preview { background: #B2C7DA; border-radius: 16px; padding: 14px; }
.msg-preview .bubble { background: #fff; border-radius: 10px; padding: 12px; white-space: pre-wrap; line-height: 1.7; font-size: 13px; }
.msg-preview .bubble .h { background: #FEE500; margin: -12px -12px 10px; padding: 8px 12px; border-radius: 10px 10px 0 0; font-weight: 700; color: #3C1E1E; }

/* 로그인 */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 28px; padding: 40px 20px; }
.auth .logo { display: flex; flex-direction: column; align-items: center; gap: 8px; color: var(--muted); }
.auth .logo img { width: 240px; }
.auth .card { width: 100%; max-width: 400px; padding: 28px; display: flex; flex-direction: column; gap: 14px; }
.auth .btn.primary { min-height: 48px; font-size: 15px; }
.auth .links { display: flex; justify-content: space-between; font-size: 13px; }
.auth .links button { border: 0; background: none; color: var(--accent); font: inherit; cursor: pointer; padding: 0; }

/* 모달·토스트 */
.modal { position: fixed; inset: 0; background: rgba(20, 24, 31, .45); display: flex; align-items: flex-start; justify-content: center; padding: 6vh 16px; z-index: 50; overflow-y: auto; }
.modal-box { background: #fff; border-radius: 14px; width: 100%; max-width: 640px; }
.modal-box.wide { max-width: 980px; }
.modal-head { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid var(--line); }
.modal-head h3 { flex: 1; }
.modal-body { padding: 20px; display: flex; flex-direction: column; gap: 14px; }
#toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(20px); background: #1B1F24; color: #fff; padding: 12px 18px; border-radius: 10px; opacity: 0; pointer-events: none; transition: .2s; z-index: 60; max-width: 90vw; }
#toast.show { opacity: 1; transform: translateX(-50%); }
#toast.err { background: var(--red); }
