:root {
  /* 본문·표 영역 좌우 여백(px) — js/page-table-gutter.js 가 localStorage 와 연동 */
  --page-table-gutter: 28px;
  /* 포인트: 세로 그라데이션(배경·버튼) — 텍스트·테두리는 --color-primary 단색 */
  --gradient-point: linear-gradient(to bottom, #597184 0%, #4a657a 50%, #3b586e 100%);
  --gradient-point-hover: linear-gradient(to bottom, #6b8699 0%, #587489 50%, #466175 100%);
  --sidebar-bg: linear-gradient(
    180deg,
    #405d7d 0%,
    #365171 15%,
    #2a4463 30%,
    #203855 50%,
    #182f49 70%,
    #132840 90%,
    #12263e 100%
  );
  --sidebar-text: rgba(255, 255, 255, 0.92);
  --sidebar-muted: rgba(255, 255, 255, 0.65);
  --sidebar-hover: rgba(255, 255, 255, 0.08);
  --sidebar-active: rgba(255, 255, 255, 0.12);
  --color-primary: #4a657a;
  --color-bg-main: #f4f7f9;
  --color-topbar: #ffffff;
  --color-text: #1a2b33;
  --color-muted: #5c6b73;
  --color-border: #e2e8ec;
  --logout-bg: #e53935;
  --logout-hover: #c62828;
  --sidebar-width: 268px;
  --font: "Noto Sans KR", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body.app {
  margin: 0;
  min-height: 100vh;
  font-family: var(--font);
  font-size: 14px;
  color: var(--color-text);
  background: var(--color-bg-main);
  display: flex;
  -webkit-font-smoothing: antialiased;
  /* 전역 UI 약 90% 축소. 가로 폭은 아래 .main-wrap 규칙으로 콘텐츠 영역 전폭 유지 */
  zoom: 0.9;
}

@media print {
  body.app {
    zoom: 1;
  }
}

.sidebar {
  flex-shrink: 0;
  width: var(--sidebar-width);
  min-height: 100vh;
  background: var(--sidebar-bg);
  color: var(--sidebar-text);
  display: flex;
  flex-direction: column;
  padding: 0 0 16px;
}

.sidebar__brand {
  padding: 24px 20px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__title {
  margin: 0 0 6px;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.3;
}

.sidebar__subtitle {
  margin: 0;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--sidebar-muted);
}

.sidebar__user {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.sidebar__avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  flex-shrink: 0;
}

.sidebar__user-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.sidebar__user-name {
  font-size: 0.95rem;
  font-weight: 600;
}

.sidebar__user-role {
  font-size: 0.78rem;
  color: var(--sidebar-muted);
}

.sidebar__nav {
  flex: 1;
  overflow-y: auto;
  padding: 12px 12px 8px;
}

.sidebar__nav-label {
  margin: 0 0 10px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sidebar-muted);
}

.nav-tree {
  list-style: none;
  margin: 0;
  padding: 0;
}

.nav-tree > li {
  margin-bottom: 2px;
}

.nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 8px;
  color: inherit;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: background 0.15s;
}

/* 최상위 단일 링크(하위 메뉴 없음): 앞에 작은 점 */
.nav-tree > li > .nav-link::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
  opacity: 0.55;
  flex-shrink: 0;
}

.nav-link:hover {
  background: var(--sidebar-hover);
}

.nav-link--active {
  background: var(--sidebar-active);
  font-weight: 600;
}

.nav-group {
  border-radius: 8px;
}

.nav-group__summary {
  list-style: none;
  cursor: pointer;
  padding: 10px 12px;
  font-size: 0.9rem;
  font-weight: 500;
  border-radius: 8px;
  transition: background 0.15s;
  user-select: none;
}

.nav-group__summary::-webkit-details-marker {
  display: none;
}

.nav-group__summary::before {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  margin-right: 0;
}

.nav-group > summary {
  position: relative;
  padding-left: 28px;
}

.nav-group > summary::after {
  content: "";
  position: absolute;
  left: 12px;
  top: 50%;
  width: 6px;
  height: 6px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  opacity: 0.65;
  transition: transform 0.2s;
}

.nav-group[open] > summary::after {
  transform: translateY(-20%) rotate(-135deg);
}

.nav-group > summary:hover {
  background: var(--sidebar-hover);
}

.nav-sub {
  list-style: none;
  margin: 4px 0 8px;
  padding: 0 0 0 12px;
  border-left: 2px solid rgba(255, 255, 255, 0.15);
  margin-left: 16px;
}

.nav-sub__link {
  display: block;
  padding: 8px 10px 8px 8px;
  font-size: 0.85rem;
  color: var(--sidebar-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.nav-sub__link:hover {
  color: #fff;
  background: var(--sidebar-hover);
}

.nav-sub__link--active {
  color: #fff;
  font-weight: 600;
  background: var(--sidebar-active);
}

/* 급여아웃소싱 하위 그룹(일반사항·급여대장 등) */
.nav-outsourcing-nested {
  margin: 0 0 4px;
}

/* 「퇴직금」처럼 접히는 그룹이 아닌 단일 행: 인접 summary와 동일한 글자·여백 */
.nav-outsourcing-nested > .nav-sub__link {
  padding: 7px 10px 7px 26px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
}

.nav-nested {
  border-radius: 6px;
}

.nav-nested__summary {
  list-style: none;
  cursor: pointer;
  padding: 7px 10px 7px 26px;
  font-size: 0.78rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.78);
  border-radius: 6px;
  user-select: none;
  position: relative;
}

.nav-nested__summary::-webkit-details-marker {
  display: none;
}

.nav-nested > summary::after {
  content: "";
  position: absolute;
  left: 10px;
  top: 50%;
  width: 5px;
  height: 5px;
  border-right: 2px solid currentColor;
  border-bottom: 2px solid currentColor;
  transform: translateY(-60%) rotate(45deg);
  opacity: 0.6;
}

.nav-nested[open] > summary::after {
  transform: translateY(-30%) rotate(-135deg);
}

.nav-nested > summary:hover {
  background: var(--sidebar-hover);
}

.nav-nested__list {
  list-style: none;
  margin: 2px 0 8px;
  padding: 0 0 0 10px;
  border-left: 2px solid rgba(255, 255, 255, 0.12);
  margin-left: 14px;
}

.nav-nested__list .nav-sub__link {
  font-size: 0.8rem;
  padding: 6px 8px;
}

.sidebar__footer {
  padding: 12px 16px 0;
  margin-top: auto;
}

.btn-logout {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  color: #fff;
  background: var(--logout-bg);
  border: none;
  border-radius: 8px;
  text-decoration: none;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-logout:hover {
  background: var(--logout-hover);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
  min-height: 52px;
  padding: 0 var(--page-table-gutter, 28px);
  background: var(--color-topbar);
  border-bottom: 1px solid var(--color-border);
}

.topbar__brand {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-primary);
}

a.topbar__brand--link {
  text-decoration: none;
}

a.topbar__brand--link:hover {
  opacity: 0.85;
}

.topbar__company {
  display: flex;
  align-items: center;
  max-width: min(360px, 100%);
}

.topbar__company-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.topbar__company-select {
  flex: 1;
  min-width: 180px;
  max-width: 280px;
  height: 36px;
  padding: 0 32px 0 10px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--color-text);
  background: #f8fafc
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E")
    no-repeat right 8px center;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
}

.topbar__company-select:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 101, 122, 0.15);
}

.topbar__pin {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  color: #64748b;
  background: #f1f5f9;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}

.topbar__pin:hover {
  background: #e2e8f0;
  color: #334155;
}

.topbar__pin--active {
  color: #c2410c;
  background: #ffedd5;
  border-color: #fdba74;
}

.topbar__pin--active:hover {
  background: #fed7aa;
  color: #9a3412;
}

.topbar__pin-icon {
  display: block;
}

.topbar__right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  flex-shrink: 0;
  min-width: 0;
  margin-left: auto;
}

.main {
  flex: 1;
  padding: 28px var(--page-table-gutter, 28px) 40px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  box-sizing: border-box;
}

.main__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.main__head--dashboard {
  justify-content: flex-end;
}

.main__desc {
  margin: 0;
  font-size: 0.95rem;
  color: var(--color-muted);
}

.main__date {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-muted);
  white-space: nowrap;
  padding-top: 4px;
}

.main__body {
  min-height: 120px;
}

/* ── 대시보드 4분할 ─────────────────────────── */
.dash-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: minmax(380px, 1fr) minmax(300px, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

@media (max-width: 1100px) {
  .dash-grid {
    grid-template-columns: 1fr;
    grid-template-rows: auto;
  }
}

.dash-panel {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  box-shadow: 0 1px 3px rgba(26, 43, 51, 0.06);
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.dash-panel__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px 10px;
  border-bottom: 1px solid #eef2f5;
  flex-shrink: 0;
}

.dash-panel__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.dash-panel__title {
  margin: 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-text);
}

.dash-panel__body {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 12px 14px;
}

.dash-panel__body--flush {
  padding: 0;
}

.dash-subhead {
  margin: 12px 0 8px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-muted);
}

.dash-news-list {
  list-style: none;
  margin: 0 0 10px;
  padding: 0;
}

.dash-news-item {
  padding: 8px 0;
  border-bottom: 1px solid #eef2f5;
  font-size: 0.84rem;
}

.dash-news-item:last-child {
  border-bottom: none;
}

.dash-news-item a {
  color: var(--color-text);
  text-decoration: none;
  font-weight: 500;
}

.dash-news-item a:hover {
  color: var(--color-primary);
  text-decoration: underline;
}

.dash-news-item--loading,
.dash-news-item--empty {
  color: var(--color-muted);
  font-weight: 400;
}

.dash-panel__inline-more {
  display: inline-block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
}

.dash-panel__inline-more:hover {
  text-decoration: underline;
}

/* 패널 안 위젯: 외곽 카드 제거·높이 채움 */
.dash-panel .cal-widget--in-panel,
.dash-panel .memo-widget--in-panel {
  border: none;
  border-radius: 0;
  box-shadow: none;
  height: 100%;
  min-height: 360px;
}

.dash-panel .cal-widget--in-panel .cal-widget__title-wrap {
  display: none;
}

.dash-panel .memo-widget--in-panel .memo-widget__title-wrap {
  display: none;
}

.dash-panel .cal-widget--in-panel .cal-widget__body {
  min-height: 300px;
}

.dash-panel .osreq-widget--in-panel {
  margin-top: 0;
  border: none;
  border-radius: 0;
  box-shadow: none;
}

.dash-panel .payalert-widget--in-panel {
  display: block;
  margin: 0;
  border: none;
  border-left: none;
  border-radius: 0;
  box-shadow: none;
  padding: 0;
}

.dash-panel .payalert-widget--in-panel:not(.has-items) .payalert-widget__list {
  display: block;
}

.dash-panel .payalert-item--empty-msg {
  background: #f4f7f9;
  border-color: var(--color-border);
  color: var(--color-muted);
  font-weight: 400;
  border-radius: 8px;
  padding: 10px 14px;
}

.dashboard-footer {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .dashboard-footer {
    grid-template-columns: 1fr;
  }
}

.links-widget--footer {
  margin-top: 0;
}

.est-widget--footer {
  margin-top: 0;
}

.cust-panel__num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 6px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

/* ── 급여지급 알림 위젯 ──────────────────────── */
.payalert-widget {
  background: #fff;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--color-primary);
  border-radius: 12px;
  box-shadow: 0 2px 10px rgba(74, 101, 122, 0.07);
  padding: 14px 20px;
  margin-bottom: 20px;
  display: none; /* JS에서 항목 있을 때 show */
}
.payalert-widget.has-items {
  display: block;
}

.payalert-widget__header {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  color: var(--color-primary);
}

.payalert-widget__label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-text);
}

.payalert-widget__list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payalert-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 14px;
  border-radius: 20px;
  font-size: 0.83rem;
  font-weight: 600;
  background: #fff8e1;
  border: 1px solid #ffe082;
  color: #7a5800;
}

.payalert-item--today {
  background: #fbe9e7;
  border-color: #ef9a9a;
  color: #b71c1c;
}

.payalert-item--loading {
  background: #f4f7f9;
  border-color: var(--color-border);
  color: var(--color-muted);
  font-weight: 400;
}

.payalert-item__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  font-size: 0.75rem;
  font-weight: 700;
  background: #f59e0b;
  color: #fff;
}

.payalert-item--today .payalert-item__badge {
  background: #e53935;
}

/* ── 위젯 그리드 ─────────────────────────────── */
.widget-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  align-items: start;
}

@media (max-width: 1100px) {
  .widget-grid { grid-template-columns: 1fr; }
}

/* ── 메모장 위젯 ─────────────────────────────── */
.memo-widget {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(74, 101, 122, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.memo-widget__header {
  display: flex;
  align-items: stretch;
  flex-wrap: wrap;
  gap: 0;
  padding: 0;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.memo-widget__title-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  flex-shrink: 0;
  color: var(--color-primary);
}

.memo-widget__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
}

.memo-widget__tabs {
  flex: 1 1 140px;
  display: flex;
  align-items: stretch;
  overflow-x: auto;
  min-width: 0;
  border-left: 1px solid var(--color-border);
  border-right: 1px solid var(--color-border);
  background: #fff;
  scrollbar-width: thin;
}

.memo-widget__tab {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  margin: 0;
  border: none;
  border-right: 1px solid #e8eef3;
  background: transparent;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-muted);
  cursor: pointer;
  transition: color 0.12s, background 0.12s;
  white-space: nowrap;
}

.memo-widget__tab:hover {
  color: var(--color-text);
  background: #f8fafc;
}

.memo-widget__tab.is-active {
  color: var(--color-text);
  box-shadow: inset 0 -3px 0 #f5c400;
}

.memo-widget__tab--add {
  justify-content: center;
  min-width: 44px;
  padding-left: 12px;
  padding-right: 12px;
  font-size: 1.15rem;
  line-height: 1;
  color: var(--color-primary);
}

.memo-widget__tab--add:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.memo-widget__tab-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin: 0 0 0 2px;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: #94a3b8;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
}

.memo-widget__tab-close:hover {
  background: #fdecea;
  color: #c62828;
}

.memo-widget__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  flex-shrink: 0;
  margin-left: auto;
}

.memo-widget__saved {
  font-size: 0.75rem;
  color: var(--color-muted);
  white-space: nowrap;
}

.memo-widget__btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 13px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 7px;
  border: none;
  cursor: pointer;
  transition: filter 0.15s, color 0.15s;
}

.memo-widget__btn--save {
  background: var(--gradient-point);
  color: #fff;
}
.memo-widget__btn--save:hover {
  background: var(--gradient-point-hover);
}

.memo-widget__btn--clear {
  background: #fff;
  color: var(--color-text);
  border: 1px solid #cfd8dc;
}
.memo-widget__btn--clear:hover {
  background: #f8fafc;
  border-color: #b0bec5;
}

.memo-widget__textarea {
  width: 100%;
  min-height: 300px;
  height: 300px;
  padding: 18px 20px;
  font-family: var(--font);
  font-size: 0.92rem;
  line-height: 1.7;
  color: var(--color-text);
  background: #fff;
  border: none;
  resize: none;
  outline: none;
  box-sizing: border-box;
}

.memo-widget__textarea::placeholder {
  color: #b0bec5;
}

/* ── 할 일 달력 위젯 ─────────────────────────── */
.cal-widget {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(74, 101, 122, 0.07);
  overflow: hidden;
}

.cal-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 14px 18px 13px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.cal-widget__title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--color-primary);
}

.cal-widget__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
}

.cal-widget__nav {
  display: flex;
  align-items: center;
  gap: 6px;
}

.cal-widget__nav-btn {
  width: 32px;
  height: 32px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
  font-weight: 700;
  color: var(--color-text);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.cal-widget__nav-btn:hover {
  background: #eef4f7;
  border-color: var(--color-primary);
}

.cal-widget__month-label {
  min-width: 8.5em;
  text-align: center;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--color-text);
}

.cal-widget__today-btn {
  margin-left: 4px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  cursor: pointer;
}
.cal-widget__today-btn:hover {
  background: #eef4f7;
}

.cal-widget__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 380px);
  gap: 0;
  align-items: stretch;
}

@media (max-width: 900px) {
  .cal-widget__body {
    grid-template-columns: 1fr;
  }
}

.cal-widget__calendar-wrap {
  padding: 14px 16px 18px;
  border-right: 1px solid var(--color-border);
  min-height: 0;
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
}

@media (max-width: 900px) {
  .cal-widget__calendar-wrap {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
  }
}

.cal-widget__dow {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  text-align: center;
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-muted);
}

.cal-widget__dow span {
  padding: 4px 2px;
  min-height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cal-widget__dow span:first-child { color: #c62828; }
.cal-widget__dow span:last-child { color: #1565c0; }

.cal-widget__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
}

.cal-widget__cell {
  width: 100%;
  box-sizing: border-box;
  /* 요일 열 너비에 맞춰 가로로 긴 칸 (정사각형 대비) */
  aspect-ratio: 5 / 3;
  min-height: 38px;
  max-height: none;
  display: flex;
  flex-direction: row;
  align-items: flex-start;
  justify-content: flex-start;
  align-content: flex-start;
  flex-wrap: wrap;
  gap: 4px 6px;
  padding: 5px 8px 6px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
  background: #f8fafc;
  border: 1px solid transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s, border-color 0.12s;
}

.cal-widget__cell:hover:not(.cal-widget__cell--muted) {
  background: #e8f4fb;
  border-color: #b8d4e3;
}

.cal-widget__cell--muted {
  color: #b0bec5;
  background: #fafbfc;
  cursor: default;
}

.cal-widget__cell--today {
  box-shadow: inset 0 0 0 2px var(--color-primary);
}

.cal-widget__cell--selected {
  background: #e3f2fd;
  border-color: var(--color-primary);
}

.cal-widget__cell-num {
  line-height: 1.2;
  flex-shrink: 0;
}

.cal-widget__cell--sun .cal-widget__cell-num {
  color: #c62828;
}

.cal-widget__cell--sat .cal-widget__cell-num {
  color: #1565c0;
}

.cal-widget__cell-badges {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  gap: 4px;
  margin-left: auto;
  flex-shrink: 0;
  flex-wrap: nowrap;
}

.cal-widget__cell-badge {
  margin-top: 0;
  margin-left: 0;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  border-radius: 9px;
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 18px;
  text-align: center;
  flex-shrink: 0;
}

/* 왼쪽: 미완료(빨강), 오른쪽: 완료(파랑) */
.cal-widget__cell-badge--pending {
  background: #c62828;
  color: #fff;
}

.cal-widget__cell-badge--done {
  background: #1565c0;
  color: #fff;
}

.cal-widget__panel {
  padding: 16px 18px 18px;
  background: #fff;
  display: flex;
  flex-direction: column;
  min-height: 0;
  align-self: stretch;
  gap: 12px;
}

.cal-widget__panel-date {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--color-text);
}

.cal-widget__task-list {
  list-style: none;
  margin: 0;
  padding: 0;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
}

.cal-widget__task-item {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 8px 10px;
  margin-bottom: 6px;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  font-size: 0.85rem;
  line-height: 1.45;
  cursor: pointer;
}

.cal-widget__task-item--todo {
  background: #f0f7ff;
  border-color: #90caf9;
}

.cal-widget__task-item--todo .cal-widget__task-text {
  color: var(--color-text);
}

.cal-widget__task-item--done {
  background: #e8f5e9;
  border-color: #81c784;
}

.cal-widget__task-item--done .cal-widget__task-text {
  text-decoration: line-through;
  color: #2e7d32;
}

.cal-widget__task-text {
  flex: 1;
  min-width: 0;
  word-break: break-word;
}

.cal-widget__task-actions {
  display: flex;
  gap: 4px;
  flex-shrink: 0;
}

.cal-widget__task-act {
  padding: 4px 8px;
  font-family: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: #fff;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}
.cal-widget__task-act:hover {
  background: #eef4f7;
  color: var(--color-text);
}
.cal-widget__task-act--danger:hover {
  background: #fdecea;
  color: #c62828;
  border-color: #ef9a9a;
}

.cal-widget__form {
  margin-top: 0;
  flex-shrink: 0;
}

.cal-widget__input {
  width: 100%;
  box-sizing: border-box;
  padding: 10px 12px;
  margin-bottom: 8px;
  font-family: inherit;
  font-size: 0.88rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
}
.cal-widget__input:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 101, 122, 0.12);
}

.cal-widget__input:disabled {
  background: #f1f5f8;
  color: var(--color-muted);
  cursor: not-allowed;
}

.cal-widget__btn--primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}

.cal-widget__form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.cal-widget__btn {
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
}

.cal-widget__btn--primary {
  background: var(--gradient-point);
  color: #fff;
}
.cal-widget__btn--primary:hover {
  filter: brightness(1.05);
}

.cal-widget__btn--ghost {
  background: #f0f4f7;
  color: var(--color-muted);
  border: 1px solid var(--color-border);
}
.cal-widget__btn--ghost:hover {
  background: #e2e8f0;
}

.cal-widget__hint {
  margin: 0;
  flex-shrink: 0;
  font-size: 0.75rem;
  color: var(--color-muted);
  line-height: 1.45;
}

/* O/S + 바로가기: 한 줄에 각각 약 절반 폭 */
.dashboard-row-split {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-top: 20px;
  align-items: start;
}

.dashboard-row-split--alerts {
  grid-template-columns: 1fr 1fr;
}

.dashboard-row-split--links,
.dashboard-row-split--single {
  grid-template-columns: 1fr;
}

/* 자문사 질의 응답 — 관리자 대시보드 최상단 전체 폭 */
.dashboard-crreq-hero {
  width: 100%;
  margin: 0 0 20px;
  box-sizing: border-box;
}

.dashboard-crreq-hero .crreq-widget,
.dashboard-crreq-hero .osreq-widget {
  width: 100%;
  margin-top: 0;
  max-width: none;
}

.dashboard-crreq-hero .osreq-item__title {
  white-space: nowrap;
  -webkit-line-clamp: unset;
  display: block;
}

.dashboard-bottom-tools {
  margin-top: 24px;
}

@media (max-width: 900px) {
  .dashboard-row-split,
  .dashboard-row-split--alerts {
    grid-template-columns: 1fr;
  }
}

.dashboard-row-split .osreq-widget,
.dashboard-row-split .links-widget,
.dashboard-row-split .crreq-widget {
  margin-top: 0;
  min-width: 0;
}

.crreq-widget--has-alert {
  box-shadow: 0 0 0 2px #f59e0b, 0 2px 12px rgba(245, 158, 11, 0.2);
}

.crreq-widget--has-alert .osreq-widget__header {
  background: #fffbeb;
}

.osreq-item__badge--draft {
  background: #fef3c7;
  color: #92400e;
}

.links-chip--internal {
  background: #e8eef5;
  border-color: #1e3a5f;
}

.links-chip--internal .links-chip__name {
  color: #1e3a5f;
  font-weight: 700;
}

.dashboard-row-split .osreq-item__title {
  white-space: normal;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── 최근 O/S 요청사항 위젯 ─────────────────── */
.osreq-widget {
  margin-top: 20px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(74, 101, 122, 0.07);
  overflow: hidden;
}

.osreq-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px 13px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.osreq-widget__title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--color-primary);
}

.osreq-widget__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
}

.osreq-widget__sub {
  font-size: 0.75rem;
  color: var(--color-muted);
  font-weight: 400;
}

.osreq-widget__more {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--color-primary);
  text-decoration: none;
  white-space: nowrap;
  padding: 4px 10px;
  border-radius: 6px;
  transition: background 0.15s;
}
.osreq-widget__more:hover { background: #eef4f7; }

.osreq-widget__list {
  list-style: none;
  margin: 0;
  padding: 8px 0;
}

.osreq-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 18px;
  border-bottom: 1px solid #f0f4f7;
  transition: background 0.12s;
}
.osreq-item:last-child { border-bottom: none; }
.osreq-item:hover { background: #f7fafc; }

.osreq-item--loading,
.osreq-item--empty {
  justify-content: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--color-muted);
}

.osreq-item__badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: #e53935;
  color: #fff;
  flex-shrink: 0;
  animation: osreq-pulse 1.8s ease-in-out infinite;
}
@keyframes osreq-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.65; }
}

.osreq-item__title {
  flex: 1;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.osreq-item__meta {
  font-size: 0.78rem;
  color: var(--color-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── 바로가기 위젯 ───────────────────────────── */
.links-widget {
  margin-top: 20px;
  padding: 14px 18px 18px;
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(74, 101, 122, 0.07);
}

.links-widget__label {
  margin: 0 0 12px;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.links-widget__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.links-chip {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  width: 88px;
  padding: 14px 8px 12px;
  border: 1px solid var(--color-border);
  border-radius: 12px;
  background: #f8fafc;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
  cursor: pointer;
}
.links-chip:hover {
  background: #e8f4fb;
  border-color: var(--color-primary);
  box-shadow: 0 2px 8px rgba(74, 101, 122, 0.12);
}

.links-chip__icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: #fff;
  border: 1px solid var(--color-border);
  color: var(--color-primary);
  flex-shrink: 0;
  transition: background 0.15s;
}
.links-chip:hover .links-chip__icon {
  background: var(--gradient-point);
  color: #fff;
  border-color: #3b586e;
}

.links-chip__name {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--color-text);
  text-align: center;
  line-height: 1.4;
}

/* ── 쪽지 견적 위젯 ───────────────────────────── */
.est-widget {
  background: #fff;
  border: 1px solid var(--color-border);
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(74, 101, 122, 0.07);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 100%;
  box-sizing: border-box;
}

.est-widget__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 12px;
  padding: 14px 18px 13px;
  border-bottom: 1px solid var(--color-border);
  background: #f8fafc;
}

.est-widget__title-wrap {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--color-primary);
}

.est-widget__title {
  font-size: 0.92rem;
  font-weight: 700;
  color: var(--color-text);
}

.est-widget__hint {
  font-size: 0.75rem;
  color: var(--color-muted);
}

/* 메모장 입력란(300px)과 동일한 세로로 맞춤 — 그리드 셀 안에서 스크롤로 잘리지 않게 */
.est-widget__body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr);
  gap: 0;
  min-height: 300px;
  height: 300px;
  max-height: 300px;
  overflow: hidden;
}

.est-widget__body > * {
  min-height: 0;
}

@media (max-width: 900px) {
  .est-widget__body {
    grid-template-columns: 1fr;
    min-height: 0;
    max-height: none;
  }
}

.est-widget__list-panel {
  border-right: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

@media (max-width: 900px) {
  .est-widget__list-panel {
    border-right: none;
    border-bottom: 1px solid var(--color-border);
    max-height: 220px;
  }
}

.est-widget__new-btn {
  margin: 12px 14px 8px;
  padding: 8px 14px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border: 1px dashed var(--color-border);
  border-radius: 8px;
  background: #f8fafc;
  color: var(--color-primary);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.est-widget__new-btn:hover {
  background: #eef4f7;
  border-color: var(--color-primary);
}

.est-widget__list {
  list-style: none;
  margin: 0;
  padding: 4px 8px 12px;
  overflow-y: auto;
  flex: 1;
}

.est-item {
  padding: 10px 12px;
  margin-bottom: 4px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.12s;
  border: 1px solid transparent;
}

.est-item:hover {
  background: #f4f7f9;
}

.est-item--active {
  background: #e8f2f6;
  border-color: rgba(74, 101, 122, 0.2);
}

.est-item--empty {
  cursor: default;
  text-align: center;
  font-size: 0.85rem;
  color: #b0bec5;
  padding: 24px 16px;
}

.est-item--empty:hover {
  background: transparent;
}

.est-item__title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--color-text);
  line-height: 1.35;
  margin-bottom: 4px;
  word-break: break-word;
}

.est-item__preview {
  font-size: 0.78rem;
  color: var(--color-muted);
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.est-widget__editor-panel {
  padding: 14px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
  max-height: 100%;
  overflow: hidden;
}

.est-widget__label {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--color-muted);
  flex-shrink: 0;
}

.est-widget__title-input {
  flex-shrink: 0;
  width: 100%;
  padding: 9px 12px;
  font-family: inherit;
  font-size: 0.9rem;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
}

.est-widget__title-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 101, 122, 0.12);
}

.est-widget__body-input {
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  padding: 12px 14px;
  font-family: inherit;
  font-size: 0.88rem;
  line-height: 1.6;
  border: 1px solid var(--color-border);
  border-radius: 8px;
  resize: none;
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
  box-sizing: border-box;
  overflow-y: auto;
}

.est-widget__body-input:focus {
  border-color: var(--color-primary);
  box-shadow: 0 0 0 3px rgba(74, 101, 122, 0.12);
}

.est-widget__editor-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  flex-shrink: 0;
}

.est-widget__btn {
  padding: 8px 18px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: opacity 0.15s, filter 0.15s;
}

.est-widget__btn--primary {
  background: var(--gradient-point);
  color: #fff;
}

.est-widget__btn--primary:hover {
  background: var(--gradient-point-hover);
}

.est-widget__btn--danger {
  background: #f0f4f7;
  color: #c62828;
}

.est-widget__btn--danger:hover:not(:disabled) {
  background: #fdecea;
}

.est-widget__btn--danger:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}


@media (max-width: 900px) {
  body.app {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    min-height: auto;
  }

  .sidebar__footer {
    margin-top: 0;
  }
}

/* 사이드바 옆 메인 영역 가로 전폭 (페이지별 max-width·Tailwind max-w-* 로 인한 좌우 여백 제거) */
body.app .main-wrap .main {
  max-width: none !important;
  width: 100%;
  padding-left: var(--page-table-gutter, 28px) !important;
  padding-right: var(--page-table-gutter, 28px) !important;
}

body.app .main-wrap .main .main__body {
  max-width: none !important;
  width: 100%;
}

body.app .main-wrap .main.max-w-xs,
body.app .main-wrap .main.max-w-sm,
body.app .main-wrap .main.max-w-md,
body.app .main-wrap .main.max-w-lg,
body.app .main-wrap .main.max-w-xl,
body.app .main-wrap .main.max-w-2xl,
body.app .main-wrap .main.max-w-3xl,
body.app .main-wrap .main.max-w-4xl,
body.app .main-wrap .main.max-w-5xl,
body.app .main-wrap .main.max-w-6xl,
body.app .main-wrap .main.max-w-7xl {
  max-width: none !important;
}

/* ── 페이지·표 영역 (전역, js/page-table-gutter.js) ───────── */
body.app .main-wrap .main table:not(.pd-table):not([data-table-width="natural"]) {
  max-width: 100%;
}

body.app .main-wrap .main .pd-table-wrap {
  width: 100%;
  box-sizing: border-box;
}

/* 상단바: 표 좌우 여백 슬라이더 */
.topbar__table-gutter {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  margin-right: 12px;
  padding: 4px 10px;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: #f8fafc;
}

.topbar__table-gutter label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin: 0;
  font-size: 0.68rem;
  font-weight: 600;
  color: var(--color-muted);
  white-space: nowrap;
  line-height: 1.2;
}

.topbar__table-gutter__range {
  width: 88px;
  min-width: 72px;
  max-width: 120px;
  cursor: pointer;
  accent-color: var(--color-primary);
}

.topbar__table-gutter__value {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--color-text);
  min-width: 2.5em;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.topbar__table-gutter__reset {
  padding: 2px 6px;
  font-size: 0.65rem;
  font-weight: 600;
  color: var(--color-muted);
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-family: inherit;
}

.topbar__table-gutter__reset:hover {
  color: var(--color-primary);
  background: rgba(74, 101, 122, 0.08);
}

@media (max-width: 1100px) {
  .topbar__table-gutter label span:first-child {
    display: none;
  }
  .topbar__table-gutter {
    gap: 6px;
    padding: 4px 8px;
    margin-right: 8px;
  }
}

@media (max-width: 720px) {
  .topbar__table-gutter .topbar__table-gutter__reset {
    display: none;
  }
}

/* ── 통합 허브(직원 정보·근태): 탭 + iframe ── */
.page-hub-main {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  padding: 16px 24px 20px;
  max-width: 100%;
}

.page-hub-head {
  flex-shrink: 0;
  margin-bottom: 12px;
}

.page-hub-title {
  margin: 0 0 6px;
  font-size: 1.35rem;
  font-weight: 700;
  color: var(--color-text);
}

.page-hub-desc {
  margin: 0 0 14px;
  font-size: 0.875rem;
  color: var(--color-muted);
  line-height: 1.45;
}

.page-hub-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0;
  border-bottom: 2px solid var(--color-border);
}

.page-hub-tab {
  padding: 10px 18px;
  margin: 0 4px -2px 0;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--color-muted);
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 8px 8px 0 0;
  cursor: pointer;
}

.page-hub-tab:hover {
  color: var(--color-text);
  background: rgba(74, 101, 122, 0.06);
}

.page-hub-tab--active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
  background: #fff;
}

/* [hidden] 패널은 display:none 유지 — .page-hub-panel 의 flex 가 hidden 을 덮어쓰면 두 탭이 동시에 보임 */
.page-hub-panel[hidden] {
  display: none !important;
}

.page-hub-panel:not([hidden]) {
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.page-hub-frame {
  flex: 1;
  width: 100%;
  min-height: calc(100vh - 200px);
  border: 1px solid var(--color-border);
  border-radius: 0 10px 10px 10px;
  background: #fff;
}

/* iframe 임베드: 사이드바·상단바 없음 — dashboard-shell.js 가 main-wrap--embed 만 삽입 */
html.app-embed body.app {
  display: flex;
  flex-direction: column;
  margin: 0;
  min-height: 100vh;
  min-width: 0;
}

html.app-embed body.app > .main-wrap--embed {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  min-width: 0;
  width: 100%;
}

html.app-embed body.app > .main-wrap--embed > .main {
  flex: 1;
  min-height: 0;
  min-width: 0;
  width: 100%;
  max-width: 100%;
}
