:root {
  --bg: #f5f6f8; --panel: #fff; --text: #1d2330; --muted: #6b7280; --line: #e3e6eb;
  --navy: #1f3a5f; --navy-2: #2d5288; --accent: #2563eb;
  --red: #dc2626; --red-bg: #fde8e8; --orange: #c2410c; --orange-bg: #ffedd5;
  --yellow: #a16207; --yellow-bg: #fef9c3; --green: #15803d; --green-bg: #dcfce7;
}
* { box-sizing: border-box; }
body { margin: 0; font-family: "Pretendard", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, sans-serif;
  background: var(--bg); color: var(--text); font-size: 14px; line-height: 1.5; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1 { font-size: 22px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 20px 0 10px; }
.muted { color: var(--muted); }
.right { text-align: right; }
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.nowrap { white-space: nowrap; }

/* 상단바·레이아웃 */
.topbar { height: 52px; background: var(--navy); color: #fff; display: flex; align-items: center; padding: 0 16px; gap: 12px;
  position: sticky; top: 0; z-index: 10; }
.topbar a { color: #fff; }
.brand { font-weight: 700; font-size: 16px; }
.topbar-right { margin-left: auto; display: flex; gap: 14px; align-items: center; }
.topbar-right form { margin: 0; }
.menu-btn { display: none; background: none; border: 0; color: #fff; font-size: 20px; cursor: pointer; }
button.link { background: none; border: 0; color: #cbd5e1; cursor: pointer; font: inherit; padding: 0; }
.layout { display: flex; min-height: calc(100vh - 52px); }
.sidebar { width: 200px; background: var(--panel); border-right: 1px solid var(--line); padding: 12px 0; flex-shrink: 0; }
.sidebar a { display: block; padding: 7px 20px; color: var(--text); }
.sidebar a:hover { background: #f0f3f8; text-decoration: none; }
.sidebar a.active { background: #e8eef8; color: var(--navy); font-weight: 700; border-left: 3px solid var(--navy); padding-left: 17px; }
.nav-group { padding: 14px 20px 4px; font-size: 12px; color: var(--muted); font-weight: 700; }
.content { flex: 1; padding: 24px; min-width: 0; }

/* 카드·그리드 */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 16px 18px; margin-bottom: 16px; }
.card h2 { margin-top: 0; }
.card.narrow { max-width: 520px; }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.stat { display: flex; justify-content: space-between; padding: 5px 0; border-bottom: 1px dashed var(--line); }
.stat:last-child { border-bottom: 0; }
.stat b { font-variant-numeric: tabular-nums; }
.page-head { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.page-head h1 { margin: 0; margin-right: auto; }

/* 표 */
.table-wrap { overflow-x: auto; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 8px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { background: #f8f9fb; font-size: 12px; color: var(--muted); font-weight: 700; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #fafbfd; }
tfoot td { background: #f8f9fb; font-weight: 700; }
tr.cancelled td { color: var(--muted); text-decoration: line-through; }

/* 상태 표시 */
.badge { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; background: #eef1f5; color: #374151; white-space: nowrap; }
.badge.red, tr.red td:first-child { }
.badge.red { background: var(--red-bg); color: var(--red); }
.badge.orange { background: var(--orange-bg); color: var(--orange); }
.badge.yellow { background: var(--yellow-bg); color: var(--yellow); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.blue { background: #dbeafe; color: #1d4ed8; }
.row-red { border-left: 4px solid var(--red); }
.row-orange { border-left: 4px solid #f97316; }
.row-yellow { border-left: 4px solid #eab308; }

/* 폼 */
.form { display: grid; gap: 12px; }
.form.cols { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.form .full { grid-column: 1 / -1; }
label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: #374151; }
label.check { flex-direction: row; align-items: center; gap: 6px; }
input, select, textarea { font: inherit; padding: 7px 9px; border: 1px solid #cfd4dc; border-radius: 6px; background: #fff; color: var(--text); }
textarea { min-height: 70px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: 2px solid #bfd3f6; border-color: var(--accent); }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: end; margin-bottom: 12px; }
.filters label { min-width: 120px; }
.btn { display: inline-block; padding: 7px 14px; border-radius: 6px; border: 1px solid #cfd4dc; background: #fff; color: var(--text);
  cursor: pointer; font: inherit; white-space: nowrap; }
.btn:hover { background: #f3f4f6; text-decoration: none; }
.btn.primary { background: var(--navy); border-color: var(--navy); color: #fff; }
.btn.primary:hover { background: var(--navy-2); }
.btn.danger { color: var(--red); border-color: #f3c4c4; }
.btn.small { padding: 3px 9px; font-size: 12px; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline { display: inline; margin: 0; }

.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: var(--green-bg); color: var(--green); }
.flash.error { background: var(--red-bg); color: var(--red); }
.flash.warn { background: var(--orange-bg); color: var(--orange); }

/* 로그인 */
.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: linear-gradient(160deg, var(--navy), #0f2340); padding: 16px; }
.login-card { background: #fff; padding: 32px; border-radius: 14px; width: 100%; max-width: 360px; display: grid; gap: 14px; box-shadow: 0 10px 30px rgba(0,0,0,.25); }
.login-card h1 { margin: 0; text-align: center; color: var(--navy); }
.login-card p { margin: 0; text-align: center; }

/* 달력 */
.cal { width: 100%; table-layout: fixed; }
.cal th { text-align: center; }
.cal td { height: 104px; padding: 4px; vertical-align: top; }
.cal td.other { background: #fafafa; color: #bbb; }
.cal td.today { background: #eef4ff; }
.cal td.holiday .daynum, .cal td.sun .daynum { color: var(--red); }
.cal td.sat .daynum { color: #2563eb; }
.daynum { font-size: 12px; font-weight: 700; }
.holiday-name { font-size: 11px; color: var(--red); margin-left: 4px; }
.cal-item { display: block; font-size: 11.5px; padding: 1px 5px; margin-top: 2px; border-radius: 4px; background: #eef1f5; color: var(--text);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-item.t-재무팀 { background: #e0ecff; }
.cal-item.t-법무팀 { background: #f3e8ff; }
.cal-item.t-사업부 { background: #dcfce7; }
.cal-item.t-연구소 { background: #fff1d6; }
.cal-item.done { text-decoration: line-through; opacity: .55; }
.cal-item.late { background: var(--red-bg); color: var(--red); }

details summary { cursor: pointer; color: var(--accent); }

@media (max-width: 800px) {
  .menu-btn { display: block; }
  .sidebar { position: fixed; top: 52px; bottom: 0; left: -220px; z-index: 9; transition: left .2s; overflow-y: auto; }
  body.nav-open .sidebar { left: 0; box-shadow: 4px 0 16px rgba(0,0,0,.15); }
  .content { padding: 16px; }
  .cal td { height: 70px; }
  .cal-item { font-size: 10px; }
}
