:root {
  --bg: #ffffff; --panel: #f7f8fa; --line: #e3e6ea; --text: #23272e; --muted: #7a828e;
  --accent: #2f9e44; --accent-soft: #e3f4e1; --accent-dark: #237a34;
  --danger: #d9363e; --warn: #e8890c; --info: #1c7ed6; --today: #fff3d6;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font: 16px/1.7 "Malgun Gothic", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif; color: var(--text); background: var(--bg); }
a { color: inherit; text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select, textarea { font: inherit; color: inherit; }
input, select, textarea { border: 1px solid #c9ced6; border-radius: 4px; padding: 6px 8px; background: #fff; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--accent-soft); border-color: var(--accent); }
textarea { width: 100%; resize: vertical; }
.btn { display: inline-block; border: 1px solid #c9ced6; background: #fff; border-radius: 6px; padding: 8px 16px; cursor: pointer; white-space: nowrap; }
.btn:hover { background: var(--panel); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); }
.btn.danger { color: var(--danger); border-color: #efb4b7; }
.btn.small { padding: 4px 12px; font-size: 14px; }
.muted { color: var(--muted); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.spacer { flex: 1; }
.error { color: var(--danger); margin: 8px 0; }

/* 상단 */
header.top { display: flex; align-items: center; gap: 16px; padding: 10px 20px; border-bottom: 1px solid var(--line); }
.brand { white-space: nowrap; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; color: #1d3f8f; }
.brand span { color: var(--danger); }
.who { font-size: 12px; color: var(--muted); }
nav.menu { display: flex; gap: 4px; padding: 0 20px; border-bottom: 1px solid var(--line); overflow-x: auto; }
nav.menu a { padding: 12px 14px; white-space: nowrap; border-bottom: 2px solid transparent; }
nav.menu a:hover { text-decoration: none; color: var(--accent); }
nav.menu a.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 700; }
nav.menu a.soon { color: #a9afb8; }

/* 본문 레이아웃 */
.layout { display: flex; min-height: calc(100vh - 100px); }
aside.side { width: 250px; flex: none; border-right: 1px solid var(--line); padding: 20px 16px; }
aside.side h2 { font-size: 18px; margin: 0 0 14px; }
aside.side h3 { font-size: 14px; margin: 18px 0 4px; padding-bottom: 6px; border-bottom: 1px solid var(--line); font-weight: 600; }
aside.side a.item { display: flex; align-items: center; gap: 6px; padding: 5px 10px; border-radius: 4px; }
aside.side a.item:hover { background: var(--panel); text-decoration: none; }
aside.side a.item.on { background: var(--accent-soft); font-weight: 700; }
.badge { font-size: 12px; background: var(--accent); color: #fff; border-radius: 3px; padding: 0 5px; }
.badge.gray { background: none; color: var(--muted); padding: 0; }
.shortcuts { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 8px; }
main.content { flex: 1; min-width: 0; padding: 20px 24px 60px; }
main.content h1 { font-size: 17px; margin: 0 0 14px; }

/* 홈: 오늘 할 일 */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; margin-bottom: 20px; }
.tile { display: block; border: 2px solid var(--line); border-radius: 10px; padding: 18px 20px; }
.tile:hover { text-decoration: none; border-color: var(--accent); }
.tile .num { font-size: 30px; font-weight: 800; line-height: 1.3; word-break: keep-all; }
.tile.hot { border-color: var(--accent); background: var(--accent-soft); }
.tile.warn { border-color: var(--warn); background: #fdf0dc; }
.summary { font-size: 18px; font-weight: 700; padding: 12px 16px; background: var(--panel); border-left: 5px solid var(--accent); border-radius: 4px; margin-bottom: 14px; }
.warn-box { padding: 12px 16px; background: #fde8e9; border-left: 5px solid var(--danger); border-radius: 4px; margin-bottom: 14px; }
.warn-box ul { margin: 6px 0 0; padding-left: 20px; }
.sub { font-size: 14px; }
table.list.grid td { border: 1px solid var(--line); padding: 4px 6px; }
table.list.grid th { border: 1px solid var(--line); }
.day-sum { font-size: 12px; font-weight: 700; padding: 0 3px; }

/* 표 */
.table-wrap { overflow-x: auto; }
table.list { width: 100%; border-collapse: collapse; }
table.list th { background: var(--accent-soft); border-top: 2px solid var(--accent); font-weight: 600; font-size: 14px; padding: 8px 10px; white-space: nowrap; }
table.list td { padding: 10px 10px; border-bottom: 1px solid var(--line); text-align: center; white-space: nowrap; }
table.list td.title { text-align: left; white-space: normal; width: 100%; min-width: 200px; }
table.list tr:hover td { background: #fafbfc; }
table.list td.title a.unread { font-weight: 700; }
table.info { width: 100%; border-collapse: collapse; margin-bottom: 16px; }
table.info th { background: var(--panel); width: 140px; text-align: left; font-weight: 600; }
table.info th, table.info td { border: 1px solid var(--line); padding: 8px 10px; }
.empty { padding: 40px; text-align: center; color: var(--muted); }
.pager { display: flex; gap: 6px; justify-content: center; margin: 14px 0; align-items: center; }
.status { font-size: 13px; padding: 1px 6px; border-radius: 3px; background: var(--panel); }
.status.in_progress, .status.pending { background: #e7f1fd; color: var(--info); }
.status.approved, .status.read { background: var(--accent-soft); color: var(--accent-dark); }
.status.rejected { background: #fde8e9; color: var(--danger); }
.status.held, .status.unread { background: #fdf0dc; color: var(--warn); }
.body-text { white-space: pre-wrap; word-break: break-word; min-height: 80px; padding: 14px; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 16px; }
.section { margin: 22px 0 8px; font-weight: 700; }
.card { border: 1px solid var(--line); border-radius: 6px; padding: 14px 16px; margin-bottom: 16px; }
.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; }
.card ul { margin: 0; padding: 0; list-style: none; }
.card li { padding: 5px 0; border-bottom: 1px dashed var(--line); display: flex; gap: 8px; }
.card li:last-child { border: 0; }
.card li a { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 폼 */
.form-grid { display: grid; grid-template-columns: 170px 1fr; gap: 10px 12px; align-items: center; margin-bottom: 16px; max-width: 860px; }
.form-grid label { font-weight: 600; }
.form-grid input[type=text], .form-grid input[type=password], .form-grid input[type=number] { width: 100%; }
.line-list { list-style: none; margin: 8px 0; padding: 0; max-width: 520px; }
.line-list li { display: flex; gap: 8px; align-items: center; padding: 6px 10px; border: 1px solid var(--line); border-radius: 4px; margin-bottom: 4px; }

/* 이름 자동완성 */
.ac { position: relative; flex: 1; min-width: 240px; max-width: 520px; }
.ac-input { width: 100%; }
.ac-list { position: absolute; z-index: 20; left: 0; right: 0; top: 100%; background: #fff; border: 1px solid #c9ced6; border-radius: 6px; box-shadow: 0 6px 18px rgba(0,0,0,.12); max-height: 320px; overflow-y: auto; }
.ac-item { display: flex; gap: 8px; align-items: center; padding: 8px 12px; cursor: pointer; }
.ac-item.on, .ac-item:hover { background: var(--accent-soft); }

/* 달력 */
.cal-head { display: flex; align-items: center; gap: 8px; margin: 10px 0; }
.cal-head strong { font-size: 18px; }
table.cal { width: 100%; border-collapse: collapse; table-layout: fixed; }
table.cal th { background: var(--accent-soft); border-top: 2px solid var(--accent); padding: 5px; font-size: 13px; }
table.cal th:first-child { color: var(--danger); } table.cal th:last-child { color: var(--info); }
table.cal td { border: 1px solid var(--line); vertical-align: top; height: 104px; padding: 3px; }
table.cal td.other { background: #fafafa; }
table.cal td.today { background: var(--today); }
table.cal .day { font-size: 12px; color: var(--muted); display: flex; justify-content: space-between; padding: 0 3px; }
table.cal .day button { border: 0; background: none; color: #b5bac2; cursor: pointer; padding: 0 2px; }
table.cal .day button:hover { color: var(--accent); }
.ev { display: block; font-size: 13px; padding: 1px 4px; margin-top: 2px; border-radius: 3px; border-left: 4px solid var(--c, #999); background: #f4f6f8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.ev:hover { background: #e9edf1; text-decoration: none; }
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 2px; background: var(--c, #999); flex: none; }

/* 로그인, 대화상자 */
.login { max-width: 340px; margin: 12vh auto; padding: 28px; border: 1px solid var(--line); border-radius: 8px; }
.login .brand { display: block; text-align: center; font-size: 26px; margin-bottom: 20px; }
.login input { width: 100%; margin-bottom: 10px; padding: 9px; }
.login .btn { width: 100%; padding: 9px; }
dialog { border: 1px solid var(--line); border-radius: 8px; padding: 0; width: min(520px, 94vw); }
dialog::backdrop { background: rgba(0, 0, 0, .35); }
dialog .dlg-head { display: flex; align-items: center; padding: 12px 16px; border-bottom: 1px solid var(--line); font-weight: 700; }
dialog .dlg-body { padding: 16px; }
dialog .form-grid { grid-template-columns: 110px 1fr; }
code.token { display: block; padding: 10px; background: var(--panel); border: 1px solid var(--line); border-radius: 4px; word-break: break-all; margin: 8px 0; }

@media (max-width: 760px) {
  .layout { flex-direction: column; }
  aside.side { width: auto; border-right: 0; border-bottom: 1px solid var(--line); padding: 12px 16px; }
  main.content { padding: 16px; }
  header.top { padding: 10px 16px; gap: 8px; }
  .who { display: none; }
  .form-grid, dialog .form-grid { grid-template-columns: 1fr; gap: 4px; }
  table.cal td { height: 76px; }
}
