* { box-sizing: border-box; }
body { margin: 0; font-family: "Malgun Gothic", "맑은 고딕", sans-serif; font-size: 14px; color: #1f2937; background: #f3f5f8; }
.app { display: flex; min-height: 100vh; }
.side { width: 200px; background: #17324d; color: #dbe4ee; display: flex; flex-direction: column; position: sticky; top: 0; height: 100vh; }
.brand { font-size: 17px; font-weight: bold; padding: 18px 16px; color: #fff; border-bottom: 1px solid #24476a; }
nav a { display: block; padding: 10px 16px; color: #dbe4ee; text-decoration: none; }
nav a:hover { background: #20415f; }
nav a.on { background: #2b5a85; color: #fff; font-weight: bold; }
nav .sub { padding-left: 30px; font-size: 13px; }
.side-foot { margin-top: auto; padding: 12px 16px; font-size: 12px; color: #8aa2ba; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.top { display: flex; justify-content: space-between; align-items: center; padding: 12px 24px; background: #fff; border-bottom: 1px solid #e3e7ed; position: sticky; top: 0; z-index: 5; }
.top-title { font-size: 18px; font-weight: bold; }
.top-right { display: flex; gap: 8px; align-items: center; }
main { padding: 20px 24px; }
.muted { color: #6b7280; font-size: 13px; }
.btn { border: 1px solid #c9d1db; background: #fff; padding: 6px 12px; border-radius: 6px; cursor: pointer; font: inherit; }
.btn:hover { background: #f0f3f7; }
.btn.primary { background: #2b5a85; border-color: #2b5a85; color: #fff; }
.btn.primary:hover { background: #234b70; }
.btn.danger { color: #b91c1c; border-color: #f0b4b4; }
.btn.sm { padding: 3px 8px; font-size: 12px; }
.btn.big { padding: 14px 28px; font-size: 17px; }
select, input, textarea { font: inherit; padding: 5px 8px; border: 1px solid #c9d1db; border-radius: 6px; background: #fff; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1; }
.tabs { display: flex; gap: 4px; margin-bottom: 14px; border-bottom: 1px solid #dfe4ea; flex-wrap: wrap; }
.tabs a { padding: 8px 14px; cursor: pointer; color: #4b5563; border-bottom: 2px solid transparent; }
.tabs a.on { color: #17324d; border-color: #2b5a85; font-weight: bold; }
.tabs .cnt { font-size: 12px; color: #6b7280; margin-left: 4px; }
.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.card { background: #fff; border: 1px solid #e3e7ed; border-radius: 10px; padding: 16px; }
.card h4 { margin: 0 0 12px; font-size: 15px; display: flex; justify-content: space-between; align-items: center; }
.stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 6px; text-align: center; }
.stat { cursor: pointer; padding: 8px 0; border-radius: 8px; }
.stat:hover { background: #f3f6fa; }
.stat b { display: block; font-size: 26px; }
.c-blue { color: #2563eb; } .c-red { color: #dc2626; } .c-orange { color: #d97706; } .c-gray { color: #6b7280; } .c-green { color: #059669; }
table { border-collapse: collapse; width: 100%; background: #fff; }
th, td { border-bottom: 1px solid #edf0f4; padding: 7px 8px; text-align: left; white-space: nowrap; }
th { background: #f6f8fb; font-weight: bold; color: #374151; position: sticky; top: 0; }
.table-wrap { overflow: auto; max-height: calc(100vh - 220px); border: 1px solid #e3e7ed; border-radius: 8px; }
td.num, th.num { text-align: right; }
tr.warn td { background: #fff4f4; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; background: #eef2f7; color: #374151; margin-right: 3px; }
.b-ok { background: #e6f6ef; color: #047857; } .b-late { background: #fff1e0; color: #b45309; } .b-miss { background: #fde8e8; color: #b91c1c; }
.b-leave { background: #ede9fe; color: #6d28d9; } .b-work { background: #e0ecff; color: #1d4ed8; }
.list { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.list li { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid #f0f2f5; gap: 8px; }
.empty { color: #9ca3af; padding: 12px 0; text-align: center; }
.sched { border-collapse: separate; border-spacing: 0; }
.sched td, .sched th { border-right: 1px solid #edf0f4; vertical-align: top; min-width: 120px; }
.sched td:first-child, .sched th:first-child { min-width: 150px; position: sticky; left: 0; background: #fff; z-index: 1; }
.sched th.hol { color: #dc2626; }
.sched td.cell { cursor: pointer; height: 46px; }
.sched td.cell:hover { background: #f6f9fd; }
.chip { display: block; padding: 3px 6px; border-radius: 5px; color: #fff; font-size: 12px; margin-bottom: 2px; }
.chip.leave { background: #ede9fe; color: #6d28d9; }
.modal-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .4); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal { background: #fff; border-radius: 12px; width: 520px; max-width: 94vw; max-height: 90vh; overflow: auto; padding: 18px 20px; }
.modal-head { display: flex; justify-content: space-between; align-items: center; }
.modal-head h3 { margin: 0; }
.x { border: 0; background: none; font-size: 22px; cursor: pointer; }
.form { display: grid; grid-template-columns: 120px 1fr; gap: 10px 12px; align-items: center; margin: 16px 0; }
.form label { color: #4b5563; }
.form .help { grid-column: 2; font-size: 12px; color: #6b7280; margin-top: -6px; }
.actions { display: flex; justify-content: flex-end; gap: 8px; }
.hidden { display: none !important; }
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: #111827; color: #fff; padding: 10px 18px; border-radius: 8px; z-index: 30; }
.note { background: #f6f8fb; border: 1px solid #e3e7ed; border-radius: 8px; padding: 10px 14px; font-size: 13px; color: #4b5563; margin-bottom: 14px; line-height: 1.6; }
.clock { font-size: 44px; font-weight: bold; margin: 6px 0 4px; }
.me-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.who { font-size: 13px; color: #374151; margin-right: 4px; }
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: #17324d; padding: 16px; }
.login-box { background: #fff; border-radius: 14px; padding: 28px 26px; width: 360px; max-width: 100%; display: flex; flex-direction: column; gap: 12px; }
.login-box h2 { margin: 0; }
.login-box label { display: flex; flex-direction: column; gap: 4px; color: #4b5563; font-size: 13px; margin-bottom: 8px; }
.login-box input { padding: 10px; font-size: 15px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.pw-list td { font-family: Consolas, monospace; }

/* 태블릿·휴대폰 화면 */
@media (max-width: 900px) { .me-grid { grid-template-columns: 1fr; } }
@media (max-width: 760px) {
  .app { flex-direction: column; }
  .side { width: 100%; height: auto; position: static; flex-direction: row; align-items: center; overflow-x: auto; }
  .brand { border: 0; padding: 10px 12px; font-size: 14px; white-space: nowrap; }
  nav { display: flex; }
  nav a { padding: 12px 10px; white-space: nowrap; }
  .side-foot { display: none; }
  .top { padding: 10px 12px; flex-wrap: wrap; gap: 8px; position: static; }
  .top-title { font-size: 16px; }
  .top-right { flex-wrap: wrap; }
  main { padding: 12px; }
  .grid { grid-template-columns: 1fr; }
  .stats { grid-template-columns: repeat(3, 1fr); }
  .clock { font-size: 38px; }
  .btn.big { width: 100%; margin-bottom: 8px; padding: 16px; }
  .form { grid-template-columns: 1fr; }
  .form .help { grid-column: 1; }
  .table-wrap { max-height: none; }
}

/* 이번 주 근로시간 막대(채움 색 = 상태, 바탕 = 같은 계열의 옅은 색) */
.meter-box { margin-top: 14px; }
.meter-head { display: flex; justify-content: space-between; font-size: 13px; color: #374151; margin-bottom: 6px; }
.meter { position: relative; height: 12px; background: #dbe4ee; border-radius: 4px; }
.meter-fill { height: 100%; border-radius: 4px; }
.m-normal { background: #2b5a85; } .m-warning { background: #fab219; } .m-critical { background: #d03b3b; }
.meter-mark { position: absolute; top: -3px; bottom: -3px; width: 2px; background: #52514e; }
.meter-scale { position: relative; height: 16px; font-size: 11px; color: #6b7280; }
.meter-scale span { position: absolute; transform: translateX(-50%); top: 2px; white-space: nowrap; }
.meter-status { font-size: 12px; color: #374151; display: flex; align-items: center; gap: 6px; }
.meter-status::before { content: ""; width: 10px; height: 10px; border-radius: 2px; }
.m-normal-text::before { background: #2b5a85; } .m-warning-text::before { background: #fab219; } .m-critical-text::before { background: #d03b3b; }
.m-critical-text { font-weight: bold; }

/* 출퇴근 위치 미리 보기 */
.preview { display: flex; flex-direction: column; align-items: center; gap: 10px; margin: 12px 0; }
.preview svg { width: 220px; height: 220px; background: #f6f8fb; border: 1px solid #e3e7ed; border-radius: 12px; }
.pv-label { font-size: 9px; fill: #374151; }
.pv-text { text-align: center; line-height: 1.7; font-size: 14px; }

/* 홈 화면 앱 설치 안내 */
.steps { margin: 8px 0; padding-left: 20px; line-height: 1.8; }
/* 알림 메일 미리 보기 */
.mail-view { margin: 10px 0; padding: 10px 12px; border: 1px solid #e3e7ed; border-radius: 8px; background: #fafbfc; font-size: 13px; }
.mail-view pre { white-space: pre-wrap; font-family: inherit; margin: 8px 0 0; line-height: 1.6; }
.card h4 { gap: 8px; }
.card h4 .btn { white-space: nowrap; flex-shrink: 0; }
.stats { grid-template-columns: repeat(6, 1fr); }
.stat-total { border-right: 1px solid #e3e7ed; border-radius: 8px 0 0 8px; }
.row-total td { font-weight: bold; background: #f6f8fb; }
/* 홈 화면 칸별 기준 바꾸기 */
.h4-btns { display: flex; gap: 4px; align-items: center; flex-shrink: 0; }
.opt-form { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; font-size: 13px; padding: 8px 10px; margin: -4px 0 10px; background: #f6f8fb; border: 1px solid #e3e7ed; border-radius: 8px; }
.opt-form input[type=number] { width: 60px; padding: 3px 6px; }
.opt-form input[type=date], .opt-form select { padding: 3px 6px; }
.seg { display: inline-flex; }
.seg .btn { border-radius: 0; }
.seg .btn:first-child { border-radius: 6px 0 0 6px; }
.seg .btn:last-child { border-radius: 0 6px 6px 0; margin-left: -1px; }
.seg .btn.on { background: #17324d; color: #fff; border-color: #17324d; }
/* 본부별 평균 근무시간 가로 막대그래프 */
.hbar { position: relative; padding: 18px 0 4px; }
.hbar-plot { position: relative; margin-left: 96px; }
.hbar-grid { position: absolute; top: -18px; bottom: 0; border-left: 1px solid #eef1f5; }
.hbar-grid span { position: absolute; top: 0; left: 3px; font-size: 11px; color: #9ca3af; }
.hbar-ref { position: absolute; top: -18px; bottom: 0; border-left: 2px dashed #6b7280; z-index: 1; }
.hbar-ref span { position: absolute; bottom: -16px; left: 4px; font-size: 11px; color: #374151; white-space: nowrap; }
.hbar-row { position: relative; display: flex; align-items: center; height: 30px; margin-bottom: 2px; }
.hbar-label { position: absolute; left: -96px; width: 90px; font-size: 13px; color: #374151; text-align: right; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hbar-track { position: relative; flex: 1; height: 100%; display: flex; align-items: center; gap: 6px; }
.hbar-bar { height: 18px; background: #3b6ea5; border-radius: 0 4px 4px 0; }
.hbar-val { font-size: 12px; color: #374151; white-space: nowrap; }
.hbar-row:hover .hbar-bar { background: #2b5a85; }
.hbar-tip { position: absolute; z-index: 5; background: #17324d; color: #fff; font-size: 12px; padding: 5px 8px; border-radius: 6px; pointer-events: none; white-space: nowrap; }
.hbar-tip.hidden { display: none; }
.opt-form.hidden { display: none; }
.hbar-legend { display: flex; align-items: center; gap: 6px; margin: 6px 0 0 96px; font-size: 12px; color: #374151; }
.hbar-legend-line { width: 18px; border-top: 2px dashed #6b7280; }
