:root {
  --sidebar-width: 260px;
  --sidebar-bg: #fffdf5;
  --sidebar-border: #f0ead6;
  --sidebar-hover: #fef9e7;
  --sidebar-active: #fff3cd;
  --text-primary: #2d3436;
  --text-secondary: #636e72;
  --text-muted: #b2bec3;
  --accent: #e8b100;
  --accent-light: #fff9e6;
  --card-shadow: 0 1px 3px rgba(0,0,0,0.08);
  --bg-main: #f8f9fa;
  --green: #00b894;
  --blue: #0984e3;
  --pink: #e84393;
  --orange: #e17055;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: 'Pretendard', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  font-size: 14px;
  line-height: 1.5;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  border-right: 1px solid var(--sidebar-border);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  z-index: 100;
  overflow-y: auto;
}

.sidebar-logo {
  padding: 22px 20px;
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
  border-bottom: 1px solid var(--sidebar-border);
  display: flex;
  align-items: center;
  gap: 10px;
}

.sidebar-logo span {
  background: var(--accent);
  color: #fff;
  padding: 5px 10px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
}

.sidebar-section {
  padding: 20px 16px 6px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.sidebar-menu {
  list-style: none;
  padding: 0 10px;
}

.sidebar-menu li a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  color: var(--text-secondary);
  text-decoration: none;
  border-radius: 8px;
  font-size: 15px;
  transition: all 0.15s;
}

.sidebar-menu li a:hover {
  background: var(--sidebar-hover);
  color: var(--text-primary);
}

.sidebar-menu li a.active {
  background: var(--sidebar-active);
  color: var(--text-primary);
  font-weight: 600;
}

.sidebar-menu li a i {
  width: 20px;
  font-size: 17px;
  opacity: 0.65;
}

.sidebar-menu li a.active i {
  opacity: 1;
}

/* 서브메뉴 */
.sidebar-sub {
  list-style: none;
  max-height: 0;
  overflow: hidden;
  transition: max-height .3s ease;
  padding: 0;
  margin: 0;
}
li.open > .sidebar-sub {
  max-height: 280px;
}
.sidebar-sub > li > a {
  padding: 7px 14px 7px 44px !important;
  font-size: 14px !important;
  gap: 0 !important;
}
.sidebar-sub > li > a::before {
  content: "●";
  font-size: 5px;
  margin-right: 8px;
  opacity: .35;
  vertical-align: middle;
}

/* 토글 화살표 */
.toggle-arrow {
  margin-left: auto;
  font-size: 10px;
  opacity: .4;
  display: inline-block;
  transition: transform .3s ease;
  transform: rotate(0deg);
}
li.open > a > .toggle-arrow {
  transform: rotate(90deg);
}
.sidebar-toggle::before {
  content: none !important;
}

/* Main Content */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
}

.topbar {
  background: #fff;
  padding: 16px 32px;
  border-bottom: 1px solid #eee;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.topbar h1 {
  font-size: 22px;
  font-weight: 700;
}

.topbar-subtitle {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

/* Buttons */
.btn {
  padding: 14px 28px;
  border: 1px solid #ddd;
  border-radius: 10px;
  background: #fff;
  cursor: pointer;
  font-size: 16px;
  font-family: inherit;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s;
  text-decoration: none;
  color: var(--text-primary);
  white-space: nowrap;
}

.btn:hover { background: #f5f5f5; }

.btn-primary {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.btn-primary:hover { opacity: 0.9; background: var(--green); }

.btn-sm {
  padding: 10px 20px;
  font-size: 14px;
}

.btn-danger {
  color: var(--orange);
  border-color: var(--orange);
}

.btn-danger:hover { background: #fff3e6; }

.btn-excel {
  background: #217346;
  color: #fff;
  border-color: #217346;
}

.btn-excel:hover { opacity: 0.9; background: #217346; }

.content {
  padding: 24px 32px;
}

/* Alerts: icon + soft card, closable (base/layout.html) */
.alert {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 14px 12px 16px;
  border-radius: 12px;
  font-size: 14px; line-height: 1.5;
  margin-bottom: 8px;
  background: #fff; border: 1px solid #eee; border-left-width: 4px;
  box-shadow: var(--card-shadow);
  animation: modalIn 0.2s ease;
}
.alert > i { font-size: 18px; flex: none; }
.alert__text { flex: 1; }
.alert__close { border: 0; background: none; cursor: pointer; color: var(--text-muted); font-size: 16px; padding: 2px; }
.alert__close:hover { color: var(--text-primary); }
.alert-success { border-left-color: var(--green); }
.alert-success > i { color: var(--green); }
.alert-error { border-left-color: #e74c3c; }
.alert-error > i { color: #e74c3c; }
.alert-warning { border-left-color: var(--orange); }
.alert-warning > i { color: var(--orange); }
.alert-info { border-left-color: var(--blue); }
.alert-info > i { color: var(--blue); }

/* 안내 메시지: 어느 화면이든 위쪽 가운데에 떠 있음. 완료는 5초 뒤 사라지고 오류는 닫을 때까지 (confirm.js) */
.flash-stack {
  position: fixed; top: 16px; z-index: 300;
  left: calc(var(--sidebar-width) + (100vw - var(--sidebar-width)) / 2); transform: translateX(-50%);
  width: min(560px, calc(100vw - var(--sidebar-width) - 32px));
  display: grid; gap: 8px;
}
.flash-stack .alert { margin: 0; box-shadow: 0 8px 24px rgba(0,0,0,0.12); transition: opacity .3s, transform .3s; }
.flash-stack .alert.leaving { opacity: 0; transform: translateY(-8px); }
@media (max-width: 768px) {
  .flash-stack { left: 50%; width: calc(100vw - 32px); }
}

/* 확인 창 (static/js/confirm.js) */
.ask-dialog {
  margin: auto; border: 0; border-radius: 16px; padding: 28px 28px 22px;
  width: min(400px, calc(100vw - 32px)); text-align: center;
  box-shadow: 0 20px 60px rgba(0,0,0,0.18); animation: modalIn 0.2s ease;
}
.ask-dialog::backdrop { background: rgba(0,0,0,0.4); backdrop-filter: blur(4px); }
.ask-dialog__icon {
  width: 48px; height: 48px; margin: 0 auto 14px; border-radius: 50%;
  display: grid; place-items: center; font-size: 22px;
  background: var(--accent-light); color: var(--accent);
}
.ask-dialog.danger .ask-dialog__icon { background: #ffeceb; color: #e74c3c; }
.ask-dialog__title { font-size: 17px; font-weight: 700; margin-bottom: 8px; }
.ask-dialog__msg { font-size: 14px; color: var(--text-secondary); line-height: 1.6; white-space: pre-line; }
.ask-dialog__btns { display: flex; gap: 8px; margin-top: 22px; }
.ask-dialog__btns .btn { flex: 1; justify-content: center; padding: 10px; }
.ask-dialog.danger .btn-primary { background: #e74c3c; border-color: #e74c3c; color: #fff; }

/* KPI Cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-bottom: 28px;
}

.kpi-card {
  background: #fff;
  border-radius: 12px;
  padding: 20px;
  box-shadow: var(--card-shadow);
  border: 1px solid #f0f0f0;
}

.kpi-card.highlight { border-left: 4px solid var(--green); }
.kpi-card.warning { border-left: 4px solid var(--orange); }
.kpi-card.info { border-left: 4px solid var(--blue); }
.kpi-card.accent { border-left: 4px solid var(--accent); }

.kpi-label {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.kpi-value {
  font-size: 26px;
  font-weight: 700;
  letter-spacing: -0.5px;
}

.kpi-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Chart Section */
.chart-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 28px;
}

.chart-card {
  background: #fff;
  border-radius: 12px;
  padding: 24px;
  box-shadow: var(--card-shadow);
  border: 1px solid #f0f0f0;
}

.chart-card h3 {
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 4px;
}

.chart-card .chart-desc {
  font-size: 12px;
  color: var(--text-secondary);
  margin-bottom: 20px;
}

/* Table */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: var(--card-shadow);
}

.data-table th {
  background: #fafafa;
  padding: 12px 16px;
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
  border-bottom: 1px solid #eee;
}

.data-table td {
  padding: 12px 16px;
  font-size: 13px;
  border-bottom: 1px solid #f5f5f5;
}

.data-table tr:hover td {
  background: #fafafa;
}

.data-table tr[onclick] { cursor: pointer; }

/* Badges */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #e6f9f0; color: #00b894; }
.badge-blue { background: #e6f0ff; color: #0984e3; }
.badge-orange { background: #fff3e6; color: #e17055; }
.badge-gray { background: #f0f0f0; color: #636e72; }
.badge-pink { background: #ffe6f0; color: #e84393; }

/* Section Title */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 18px;
  font-weight: 600;
}

/* Pagination */
.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 4px;
  margin-top: 20px;
  padding: 12px 0;
}

.pagination a, .pagination span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: 13px;
  text-decoration: none;
  color: var(--text-secondary);
  background: #fff;
  transition: all 0.15s;
}

.pagination a:hover {
  background: var(--sidebar-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

.pagination .current {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 600;
}

.pagination .disabled {
  opacity: 0.4;
  pointer-events: none;
}

.pagination .ellipsis {
  border: none;
  background: none;
}

/* Filter bar */
.filter-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
  align-items: center;
}

.filter-bar .filter-right {
  margin-left: auto;
  display: flex;
  gap: 8px;
}

/* Forms */
.form-input {
  width: 100%;
  padding: 12px 16px;
  border: 1px solid #ddd;
  border-radius: 10px;
  font-size: 16px;
  font-family: inherit;
  transition: border-color 0.15s;
}

.form-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(232, 177, 0, 0.1);
}

.form-label {
  font-size: 13px;
  font-weight: 600;
  display: block;
  margin-bottom: 4px;
  color: var(--text-primary);
}

.form-group {
  margin-bottom: 14px;
}

/* Modals */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.4);
  backdrop-filter: blur(4px);
  z-index: 200;
  justify-content: center;
  align-items: center;
}
.modal-overlay.show {
  display: flex;
}
.modal-box {
  background: #fff;
  border-radius: 16px;
  padding: 28px;
  width: 440px;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.15);
  animation: modalIn 0.2s ease;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(10px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.modal-box h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f0f0f0;
}

/* Responsive */
@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .sidebar { display: none; }
  .main-content { margin-left: 0; }
  .kpi-row { grid-template-columns: 1fr; }
  .chart-row { grid-template-columns: 1fr; }
  .content { padding: 16px; }
}

/* Unread count next to 메신저 in the sidebar */
.nav-badge { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 99px; background: #e53935; color: #fff; font-size: 11px; font-weight: 700; line-height: 20px; text-align: center; }
.nav-badge[hidden] { display: none; }

/* 출근/퇴근 in the top bar, and status tags in the attendance tables */
.att-bar { display: inline-flex; align-items: center; gap: 8px; margin-left: 8px; }
.att-bar form { margin: 0; }
.att-bar__time { font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.att-tag { display: inline-block; white-space: nowrap; padding: 1px 8px; border-radius: 99px; font-size: 12px; font-weight: 600; background: #eef0f3; color: #4b5563; }
.att-tag.warn { background: #fdecea; color: #c62828; }
.att-tag.off { background: #e8f4fd; color: #1565c0; }
.att-today { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 28px; margin-bottom: 16px; background: #fff; border: 1px solid #f0ede4; border-radius: 16px; }
.att-clock { font-size: 40px; font-weight: 700; letter-spacing: 1px; margin: 2px 0 6px; }
.att-line { font-size: 15px; font-weight: 600; }
.att-muted { font-size: 13px; color: var(--text-secondary); margin-top: 2px; }
.att-big { width: 120px; height: 120px; border-radius: 50%; border: 0; background: var(--accent); color: #3d2f00; font-size: 18px; font-weight: 700; cursor: pointer; }
.att-big.out { background: #2d3748; color: #fff; }
.att-big:hover { filter: brightness(0.95); }
.att-stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 12px; margin-bottom: 16px; }
.att-stats div { display: grid; gap: 4px; padding: 14px 16px; background: #fff; border: 1px solid #f0ede4; border-radius: 12px; }
.att-stats span { font-size: 12px; color: var(--text-secondary); }
.att-stats b { font-size: 20px; }
.att-month { padding: 16px; margin-bottom: 16px; background: #fff; border: 1px solid #f0ede4; border-radius: 12px; }
.att-month__head { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.att-month__head input { margin-right: auto; }
.att-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 6px; }
.att-cal__w { text-align: center; font-size: 12px; color: var(--text-muted); }
.att-cal__d { height: 46px; border-radius: 8px; display: grid; place-content: center; justify-items: center; font-size: 13px; line-height: 1.2; }
.att-cal__d small { font-size: 10px; font-weight: 400; opacity: 0.85; }
.att-cal__d.ok { background: #eef0f3; color: #4b5563; }
.att-cal__d.warn { background: #fdecea; color: #c62828; font-weight: 600; }
.att-cal__d.off { background: #e8f4fd; color: #1565c0; }
.att-cal__d.rest, .att-cal__d.none, .att-cal__d.future { color: #c0c4ca; }
/* Calendar and the day list side by side on wide screens, stacked on narrow ones. */
.att-split { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 16px; align-items: start; }
.att-split .att-month, .att-split .att-list { margin-bottom: 0; }
.att-split .att-list { max-height: 460px; overflow-y: auto; }
.att-split .att-list thead th { position: sticky; top: 0; background: #fff; }

/* '아직 출근 전이에요' pop-up */
.checkin-prompt { margin: auto; border: 0; border-radius: 18px; padding: 28px 30px; width: min(360px, 90vw); text-align: center; box-shadow: 0 12px 40px rgba(0,0,0,.2); }
.checkin-prompt::backdrop { background: rgba(0,0,0,.35); }
.checkin-prompt h3 { margin: 10px 0 6px; font-size: 19px; }
.checkin-prompt p { margin: 0 0 20px; color: var(--text-secondary); font-size: 14px; line-height: 1.6; }
.checkin-prompt__icon { width: 56px; height: 56px; margin: 0 auto; border-radius: 50%; display: grid; place-items: center; background: var(--accent-light); color: var(--accent); font-size: 26px; }
.checkin-prompt__actions { display: flex; gap: 8px; justify-content: center; }

textarea { resize: none; }  /* no drag-to-resize corner on any text box */
.mail-todo { display: block; margin-top: 6px; font-size: 12px; color: #b45309; }
.menu-perm { overflow-x: auto; }
.menu-perm td, .menu-perm th { text-align: center; }
.menu-perm .menu-perm__name { text-align: left; font-weight: 600; white-space: nowrap; }
.menu-perm__band { background: #f6f7f9; }
.menu-perm__group td { text-align: left; background: #fafbfc; font-weight: 800; color: #555; }
.menu-perm input[type=checkbox] { width: 18px; height: 18px; cursor: pointer; }
.mail-at { display: flex; align-items: center; gap: 6px; }
.mail-at input { flex: 1; min-width: 0; }
.mail-at span { color: #666; font-size: 14px; white-space: nowrap; }

/* 연차 규칙 안내 (hr/_leave_rules.html) */
.leave-rules { background: #f6faf8; border: 1px solid #dcefe6; border-radius: 10px; padding: 10px 14px; margin-bottom: 16px; font-size: 13px; }
.leave-rules summary { cursor: pointer; font-weight: 600; color: #0f6e56; display: flex; align-items: center; gap: 6px; }
.leave-rules ul { margin: 10px 0 2px 18px; line-height: 1.8; color: var(--text-secondary); }

/* 미사용 연차 정산 (직원 상세) */
.leave-settle h3 { margin-bottom: 12px; }
.leave-settle__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.leave-settle__row div { background: #f8f9fa; border-radius: 10px; padding: 12px 14px; display: flex; flex-direction: column; gap: 4px; }
.leave-settle__row span { font-size: 12px; color: var(--text-muted); }
.leave-settle__row strong { font-size: 18px; }
.leave-settle__row .total { background: #f0fff4; }
.leave-settle__row .total strong { color: var(--green); }
.leave-settle__row .plan-late { background: #fff5f5; }
.leave-settle__row .plan-late strong { color: var(--orange); }
.plan-dates { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; }
