/* ============================================================
   앱 셸 — 사이드바 / 헤더 / 본문
   모바일 우선: 좁은 화면에서는 사이드바가 서랍(drawer)으로 열린다
   ============================================================ */

/* 레이아웃: 사이드바(전체 높이) + 오른쪽 본문(얇은 상단 바 + 내용) */
.app { height: 100dvh; display: flex; overflow: hidden; }
.content { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; flex: none;
  border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: var(--ink-2);
  cursor: pointer; transition: background .12s, color .12s;
}
.icon-btn:hover { background: var(--surface-2); color: var(--ink); }
.icon-btn svg { width: 18px; height: 18px; }

/* ---------- 사이드바 ---------- */
.side {
  width: var(--sidebar-w); flex: none;
  display: flex; flex-direction: column;
  background: var(--side-bg);
  color: var(--side-ink);
  border-right: 1px solid var(--side-line);
  transition: width .18s ease;
}
.side-top {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-2);
  padding: 0 var(--s-2) 0 var(--s-4);
}
.side-brand {
  display: flex; align-items: center; gap: var(--s-3); min-width: 0; flex: 1;
  color: var(--side-ink); white-space: nowrap; overflow: hidden;
  background: none; border: 0; padding: 4px; margin-left: -4px; border-radius: var(--r); cursor: pointer; font: inherit; text-align: left;
}
.side-brand:hover { background: var(--side-hover); }
/* 누끼 엠블럼 — 크림 화면은 흰 선, 다크 화면은 주황 선 */
.side-brand .brand-tile { display: block; flex: none; width: 38px; height: 38px; }
.side-brand .brand-tile.for-dark { display: none; }
:root[data-theme="dark"] .side-brand .brand-tile.for-light { display: none; }
:root[data-theme="dark"] .side-brand .brand-tile.for-dark { display: block; }
/* 상호 글자 — 이미지가 아니라 텍스트 */
.side-brand .brand-name {
  font-size: var(--fs-xs); font-weight: 700; letter-spacing: .06em;
  overflow: hidden; text-overflow: ellipsis;
}
.app.side-collapsed .side-brand .brand-name { display: none; }

.side .icon-btn { color: var(--side-ink-2); }
.side .icon-btn:hover { background: var(--side-hover); color: var(--side-ink); }

/* 메뉴 — 이 부분만 스크롤된다 */
.side-nav { flex: 1; min-height: 0; overflow-y: auto; padding: 0 var(--s-3) var(--s-4);
  /* 로고 줄과 메뉴 사이 20px 를 스크롤 영역 밖에 고정 — 맨 위(대시보드 위)와 내렸을 때 간격이 같다 */
  margin-top: 20px; }
.side-nav > .side-group:first-child { padding-top: 0; }
.side-top { transition: box-shadow .15s; }
.side.is-scrolled .side-top { box-shadow: 0 1px 0 var(--side-line); }

/* 하단 고정 — 관리·화면 밝기·내 계정 */
.side-bottom {
  flex: none;
  padding: var(--s-2) var(--s-3) var(--s-3);
  border-top: 1px solid var(--side-line);
  background: var(--side-bg);
}
.side-bottom .side-group { margin-bottom: 0; }
.side-bottom .side-group > .gh { padding-top: var(--s-2); }

.side-group { margin-bottom: var(--s-2); }
/* 묶음 제목 없는 단독 메뉴(대시보드) — 위에 숨 쉴 틈, 아래에 얇은 구분선으로 다른 묶음과 균형 */
.side-group.is-solo { padding: var(--s-3) 0 var(--s-2); margin-bottom: 0; border-bottom: 1px solid var(--side-line); }
.app.side-collapsed .side-group.is-solo { padding-top: var(--s-2); }
.side-group > .gh {
  padding: var(--s-4) var(--s-3) var(--s-1);
  font-size: var(--fs-2xs); font-weight: 700; letter-spacing: .03em;
  color: var(--side-ink-2); white-space: nowrap; overflow: hidden;
}

.nav-item {
  position: relative;
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 40px;
  padding: 0 var(--s-3);
  border: 0; border-radius: var(--r);
  background: transparent; color: var(--side-ink);
  font: inherit; font-size: var(--fs-base); font-weight: 600;
  text-align: left; cursor: pointer;
  transition: background .12s, color .12s;
}
.nav-item:hover { background: var(--side-hover); }
.nav-item[aria-current="page"] { background: var(--side-active); color: #FFFFFF; }
.nav-item:focus-visible { outline-color: var(--side-ink); }
.nav-item .ico { width: 19px; height: 19px; flex: none; opacity: .75; display: inline-flex; }
.nav-item .ico svg { width: 19px; height: 19px; }
.nav-item[aria-current="page"] .ico { opacity: 1; }
.nav-item .lb { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* 사이드바 배지 — 확인할 항목 수 */
.nav-badge {
  flex: none; min-width: 19px; height: 19px;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0 5px;
  border-radius: var(--r-full);
  /* 오류가 아니라 "확인해 볼 개수"라서 빨강 대신 차분한 회색 */
  background: var(--side-badge); color: var(--side-ink);
  font-size: var(--fs-2xs); font-weight: 600;
  font-variant-numeric: tabular-nums;
  line-height: 1;
}

/* 일반 직원처럼 하단 메뉴가 없으면 하단 영역을 감춘다 */
.side-bottom:has(.side-bottom-menu:empty) { display: none; }

/* 맨 아래 접기 버튼 줄 — 펼치면 오른쪽 끝, 접으면 가운데 */
.side-foot { flex: none; display: flex; justify-content: flex-end; padding: var(--s-2) var(--s-3); border-top: 1px solid var(--side-line); background: var(--side-bg); }
.app.side-collapsed .side-foot { justify-content: center; padding-left: 0; padding-right: 0; }

/* ---------- 접힌 사이드바 — 아이콘만 ---------- */
.app.side-collapsed .side { width: 72px; }
/* 접혔을 때 스크롤 막대 자리를 양쪽에 똑같이 비워 둔다 — 막대가 생겨도 아이콘이 한쪽으로 밀리지 않고 가운데 */
.app.side-collapsed .side-nav { scrollbar-gutter: stable both-edges; }
.app.side-collapsed .side-top { justify-content: center; padding: 0; }
.app.side-collapsed .side-brand { flex: none; margin-left: 0; }
.app.side-collapsed .side-nav,
.app.side-collapsed .side-bottom { padding-left: var(--s-2); padding-right: var(--s-2); }
.app.side-collapsed .side-group > .gh { font-size: 0; padding: var(--s-2) 0; }
.app.side-collapsed .side-group > .gh::before {
  content: ''; display: block; height: 1px; margin: 0 var(--s-2); background: var(--side-line);
}
.app.side-collapsed .nav-item { justify-content: center; padding: 0; min-height: 38px; }
.app.side-collapsed .nav-item .lb { display: none; }
.nav-item[aria-current="page"] .nav-badge { background: var(--side-ink); color: var(--side-bg); }
.app.side-collapsed .nav-badge {
  position: absolute; top: 4px; right: 6px;
  box-shadow: 0 0 0 2px var(--side-bg);
  min-width: 16px; height: 16px; padding: 0 4px; font-size: var(--fs-2xs);
}

/* ---------- 본문 위 얇은 바 ---------- */
.topbar {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: var(--s-3);
  padding: 0 var(--s-5);
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}
.tb-spacer { flex: 1; }
.crumb { display: flex; align-items: center; gap: var(--s-1); min-width: 0; font-size: var(--fs-sm); white-space: nowrap; }
.crumb .c-p { color: var(--ink-3); }
.crumb .c-s { display: inline-flex; color: var(--ink-3); }
.crumb .c-n { color: var(--ink); font-weight: 700; overflow: hidden; text-overflow: ellipsis; }
.ai-btn { gap: 6px; white-space: nowrap; }

/* 내 계정 — "○○님 ▾" */
.tb-user {
  display: inline-flex; align-items: center; gap: var(--s-2);
  height: 34px; padding: 0 var(--s-2) 0 4px;
  border: 1px solid transparent; border-radius: var(--r);
  background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-sm); font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.tb-user:hover, .tb-user[aria-expanded="true"] { background: var(--surface-2); border-color: var(--line); }
.tb-user .av {
  width: 26px; height: 26px; flex: none; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--point-soft); color: var(--point);
  font-size: var(--fs-2xs); font-weight: 800;
}
.tb-user svg { color: var(--ink-3); transition: transform .15s; }
.tb-user[aria-expanded="true"] svg { transform: rotate(180deg); }
.ai-btn svg { color: var(--point); }

/* 통합 검색 */
.gs { position: relative; width: min(420px, 42vw); }
.gs-ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); color: var(--ink-3); display: inline-flex; pointer-events: none; }
.gs-input {
  width: 100%; min-height: 34px !important;
  padding: 0 60px 0 34px !important;
  border-radius: var(--r) !important;
  background: var(--surface) !important;
  font-size: var(--fs-sm) !important;
}
.gs-input::-webkit-search-cancel-button { display: none; }
.gs-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  padding: 1px 6px; border: 1px solid var(--line-2); border-radius: 5px;
  font: 600 11px var(--font-num, inherit); color: var(--ink-3); background: var(--surface-2);
  pointer-events: none;
}
.gs.open .gs-kbd { display: none; }
.gs-list {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0; z-index: 90;
  max-height: min(440px, 70vh); overflow-y: auto;
  padding: var(--s-2);
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r-lg, 12px);
  box-shadow: var(--shadow-3);
}
.gs-gt { padding: var(--s-2) var(--s-3) var(--s-1); font-size: var(--fs-2xs); font-weight: 700; color: var(--ink-3); }
.gs-item {
  display: flex; align-items: center; gap: var(--s-3);
  width: 100%; min-height: 36px; padding: 0 var(--s-3);
  border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--ink);
  font: inherit; font-size: var(--fs-sm); text-align: left; cursor: pointer;
}
.gs-item.on { background: var(--point-soft); color: var(--point); }
.gs-item .gs-i { display: inline-flex; color: var(--ink-3); }
.gs-item.on .gs-i, .gs-item.ai .gs-i { color: var(--point); }
.gs-item .gs-l { flex: 1; min-width: 0; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gs-item .gs-s { flex: none; font-size: var(--fs-xs); color: var(--ink-3); }
.gs-empty { padding: var(--s-4) var(--s-3); font-size: var(--fs-sm); color: var(--ink-3); }

/* ---------- AI 비서 패널 (오른쪽) ---------- */
.ai-panel {
  display: none;
  width: 400px; flex: none;
  flex-direction: column;
  background: var(--surface);
  border-left: 1px solid var(--line);
  min-height: 0;
}
.app.ai-open .ai-panel { display: flex; }
.ai-head {
  height: var(--header-h); flex: none;
  display: flex; align-items: center; gap: var(--s-2);
  padding: 0 var(--s-3) 0 var(--s-4);
  border-bottom: 1px solid var(--line);
}
.ai-title { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: var(--fs-sm); }
.ai-title svg { color: var(--point); }
.ai-list { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.ai-empty { padding: var(--s-4) var(--s-2); }
.ai-empty p { margin: var(--s-2) 0 var(--s-4); line-height: 1.6; }
.ai-examples { display: flex; flex-direction: column; gap: var(--s-2); align-items: flex-start; }
.ai-examples .btn { text-align: left; white-space: normal; height: auto; min-height: 32px; padding: 6px var(--s-3); }
.ai-msg { max-width: 92%; padding: var(--s-3) var(--s-4); border-radius: 14px; font-size: var(--fs-sm); line-height: 1.6; word-break: keep-all; overflow-wrap: anywhere; }
.ai-msg.me { align-self: flex-end; background: var(--point); color: var(--ink-on-point); border-bottom-right-radius: 4px; white-space: pre-wrap; }
.ai-msg.bot { align-self: flex-start; background: var(--surface-2); color: var(--ink); border-bottom-left-radius: 4px; }
.ai-msg.typing .ai-dots { color: var(--ink-3); font-size: var(--fs-xs); }
.ai-md p { margin: 0 0 var(--s-2); }
.ai-md p:last-child { margin-bottom: 0; }
.ai-md ul, .ai-md ol { margin: 0 0 var(--s-2); padding-left: 1.2em; }
.ai-md .table-wrap { margin: var(--s-2) 0; background: var(--surface); border-radius: var(--r-sm); }
.ai-md table.tbl { font-size: var(--fs-xs); min-width: 0 !important; }
.ai-foot { display: flex; gap: var(--s-2); align-items: flex-end; padding: var(--s-3); border-top: 1px solid var(--line); }
.ai-input { flex: 1; resize: none; min-height: 40px; max-height: 160px; font: inherit; font-size: var(--fs-sm); line-height: 1.5; padding: 9px var(--s-3); }
.ai-send { width: 40px; height: 40px; padding: 0; flex: none; }
.ai-note { padding: 0 var(--s-4) var(--s-3); font-size: var(--fs-2xs); color: var(--ink-3); line-height: 1.5; }
.app.ai-open .ai-btn { background: var(--point-soft); color: var(--point); border-color: var(--point); }

/* ---------- 본문 ---------- */
.main { flex: 1; min-height: 0; overflow-y: auto; }
.page {
  max-width: var(--content-max);
  margin: 0 auto;
  padding: var(--s-5) var(--s-5) var(--s-16);
}
.page-h { margin-bottom: var(--s-5); }
.page-h h1 { font-size: var(--fs-lg); letter-spacing: -.015em; }
.page-h .desc { margin-top: var(--s-2); color: var(--ink-2); font-size: var(--fs-sm); }
.page-h .row { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-4); flex-wrap: wrap; }

.stack   { display: flex; flex-direction: column; gap: var(--s-5); }
.stack-4 { display: flex; flex-direction: column; gap: var(--s-4); }
.row-4   { display: flex; gap: var(--s-4); flex-wrap: wrap; align-items: center; }
.grid    { display: grid; gap: var(--s-4); }
.grid.c2 { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.grid.c3 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.grid.cards { grid-template-columns: repeat(auto-fill, minmax(268px, 1fr)); }

/* ---------- 서랍 열기 버튼(좁은 화면 전용) ---------- */
.side-toggle { display: none; }
.scrim { display: none; }

/* ============================================================
   좁은 화면 — 사이드바를 서랍으로
   ============================================================ */
@media (max-width: 900px) {
  .side-toggle { display: inline-flex; }
  .side-foot { display: none; }   /* 휴대폰은 서랍 메뉴라 접기 없음 */

  .side,
  .app.side-collapsed .side {
    position: fixed; top: 0; bottom: 0; left: 0;
    z-index: 80;
    width: min(300px, 84vw);
    transform: translateX(-100%);
    transition: transform .2s ease;
    box-shadow: var(--shadow-3);
  }
  /* 서랍에서는 접힘 상태를 무시하고 글자까지 보인다 */
  .app.side-collapsed .side-top { justify-content: space-between; padding: 0 var(--s-3) 0 var(--s-5); }
  .app.side-collapsed .side-brand { flex: 1; margin-left: -4px; }
  .app.side-collapsed .nav-item { justify-content: flex-start; padding: 0 var(--s-3); }
  .app.side-collapsed .nav-item .lb { display: block; }
  .app.side-collapsed .side-brand .brand-name { display: inline; }
  .app.side-collapsed .side-group > .gh { font-size: var(--fs-2xs); padding: var(--s-4) var(--s-3) var(--s-1); }
  .app.side-collapsed .side-group > .gh::before { display: none; }
  .app.side-collapsed .nav-badge { position: static; }

  .app.side-open .side { transform: translateX(0); }

  .scrim {
    display: block; position: fixed; inset: 0;
    z-index: 70; background: rgba(20,18,17,.4);
    opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .app.side-open .scrim { opacity: 1; pointer-events: auto; }

  .topbar { padding: 0 var(--s-3); gap: var(--s-2); }
  .crumb .c-p, .crumb .c-s { display: none; }
  .gs { width: auto; flex: 1; }
  .gs-kbd { display: none; }
  .ai-btn span { display: none; }
  .ai-panel { position: fixed; inset: 0; z-index: 90; width: auto; border-left: 0; }
  .ai-head { padding-top: env(safe-area-inset-top, 0px); }
  .tb-user .nm { display: none; }

  .page { padding: var(--s-5) var(--s-4) var(--s-16); }
  .page-h h1 { font-size: var(--fs-lg); }

  /* 표는 칸이 눌리지 않게 최소 폭을 두고 가로로 밀어 본다 */
  .table-wrap > table.tbl { min-width: 640px; }
}

/* ============================================================
   로그인 화면
   ============================================================ */
.auth-wrap {
  min-height: 100dvh;
  display: grid; place-items: center;
  padding: var(--s-6);
  background: var(--bg);
}
.auth-box { width: min(420px, 100%); }   /* 안내 글자 길이와 상관없이 로그인 상자 폭을 늘 같게 */
.auth-card {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-2);
  padding: var(--s-10) var(--s-8) var(--s-8);
}
.auth-card .brand {
  text-align: center; margin-bottom: var(--s-8);
  font-size: var(--fs-lg); font-weight: 800; letter-spacing: .06em;
}
.auth-notice {   /* 비밀번호 변경 뒤 로그인 화면 안내 */
  margin-bottom: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r);
  background: var(--good-bg); color: var(--good);
  font-size: var(--fs-sm); font-weight: 600;
}
.auth-err {
  margin-bottom: var(--s-5);
  padding: var(--s-4);
  border-radius: var(--r);
  background: var(--bad-bg); color: var(--bad);
  font-size: var(--fs-sm); font-weight: 600;
}
.auth-note {
  margin-top: var(--s-6); text-align: center;
  font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.6;
}

/* 초기 비밀번호 1회 표시용 */
.pw-reveal {
  display: flex; align-items: center; justify-content: space-between; gap: var(--s-4);
  margin: var(--s-4) 0;
  padding: var(--s-5);
  border: 1px dashed var(--point);
  border-radius: var(--r);
  background: var(--point-soft);
}
.pw-reveal code {
  font-family: var(--font-num); font-size: var(--fs-lg); font-weight: 700;
  color: var(--ink); letter-spacing: .04em; user-select: all;
}

/* 대시보드 — 왼쪽 차트, 오른쪽 확인 필요 (좁으면 위아래) */
.dash-main { display: grid; grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr); gap: var(--s-5); align-items: start; }
@media (max-width: 1100px) { .dash-main { grid-template-columns: 1fr; } .dash-main > :last-child { order: -1; } }

/* 기본 설정 — 상호 미리보기 (사이드바와 같은 바탕) */
.set-brand-pv { display: inline-flex; padding: var(--s-4) var(--s-5); border-radius: var(--r-lg); background: var(--side-bg); }

/* 로그인 화면 엠블럼 — 밝은 바탕이라 주황 선 */
.auth-emblem { display: block; width: 64px; height: 64px; margin: 0 auto var(--s-3); color: #4A3426;   /* 메인·베이커리와 같은 짙은 갈색 */
  background: currentColor; -webkit-mask: url(/img/logo-emblem-orange.png) center / contain no-repeat; mask: url(/img/logo-emblem-orange.png) center / contain no-repeat; }

/* 사이드바 스크롤바 — 바탕은 사이드바 색, 막대는 은은한 밝은 회색 */
.side-nav {
  scrollbar-width: thin;
  scrollbar-color: rgba(255,255,255,.18) var(--side-bg);
}
.side-nav::-webkit-scrollbar { width: 8px; }
.side-nav::-webkit-scrollbar-track { background: var(--side-bg); }
.side-nav::-webkit-scrollbar-thumb {
  background: rgba(255,255,255,.18);
  border-radius: 8px;
  border: 2px solid var(--side-bg);
}
.side-nav::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.32); }

/* 사이드바 묶음 접기 — 묶음 제목을 누르면 아래 메뉴가 접힌다 */
button.gh {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  border: 0; background: none; cursor: pointer; font: inherit; text-align: left;
  border-radius: var(--r-sm);
}
button.gh:hover { color: var(--side-ink); }
button.gh svg { width: 14px; height: 14px; opacity: .7; transition: transform .15s; }
.side-group.is-folded > button.gh svg { transform: rotate(-90deg); }
.side-group.is-folded > .side-children { display: none; }
/* 아이콘만 남긴 사이드바에서는 접기를 쓰지 않는다 (제목이 안 보이므로) */
.app.side-collapsed .side-group.is-folded > .side-children { display: block; }
.app.side-collapsed button.gh svg { display: none; }

/* 권한 설정 표 */
.perm-tbl td { vertical-align: middle; }
.perm-tbl tr.perm-group td { background: var(--surface-2); font-size: var(--fs-xs); font-weight: 700; color: var(--ink-2); padding-top: var(--s-3); }
.perm-seg .seg-b { min-height: 32px; padding: 0 var(--s-3); font-size: var(--fs-sm); }

/* 사이트 계정 */
.sa-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto auto auto; gap: var(--s-4); align-items: center; padding: var(--s-4) var(--s-5); border-bottom: 1px solid var(--line); }
.sa-row.row-click { cursor: pointer; }
.sa-row.row-click:hover { background: var(--surface-2); }
.sa-main { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.sa-name { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; font-size: var(--fs-md); }
.sa-link { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-cred { display: flex; flex-direction: column; gap: var(--s-2); }
.sa-line { display: flex; align-items: center; gap: var(--s-2); }
.sa-line code { font-family: var(--font-num); font-size: var(--fs-sm); background: var(--surface-2); padding: 2px 8px; border-radius: var(--r-sm); min-width: 120px; }
.sa-k { width: 64px; flex: none; font-size: var(--fs-xs); color: var(--ink-3); }
@media (max-width: 760px) { .sa-row { grid-template-columns: 1fr; } }

/* 시스템 안내 */
.si-sec { margin-bottom: var(--s-5); scroll-margin-top: var(--s-4); }
.si-tbl td.si-c { text-align: center; font-size: var(--fs-xs); color: var(--ink-3); white-space: nowrap; }
.si-tbl td.si-c.w { color: #2E7A4F; font-weight: 700; }   /* 편집자 초록 */
.si-tbl td.si-c.r { color: #2F5D9E; font-weight: 700; }   /* 뷰어 파랑 */
:root[data-theme="dark"] .si-tbl td.si-c.w { color: #7CCB9C; }
:root[data-theme="dark"] .si-tbl td.si-c.r { color: #8DB4EC; }
.si-tbl tr.si-group td { background: var(--surface-2); font-weight: 700; font-size: var(--fs-sm); }
.si-dl { display: grid; grid-template-columns: 140px 1fr; gap: var(--s-2) var(--s-4); margin: 0 0 var(--s-3); }
.si-dl dt { font-weight: 700; }
.si-dl dd { margin: 0; color: var(--ink-2); }
.si-rules { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s-5); }
.si-rules h3 { margin-bottom: var(--s-2); }
.si-rules ul { margin: 0; padding-left: 1.2em; color: var(--ink-2); display: flex; flex-direction: column; gap: 4px; }
.si-erd-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); }
.si-erd { display: block; min-width: 900px; width: 100%; height: auto; }
.si-erd-box { fill: var(--surface); stroke: var(--line-2); }
.si-erd-t { font-size: var(--fs-xs); font-weight: 700; fill: var(--ink); }
.si-erd-k { font-size: var(--fs-2xs); fill: var(--ink-3); font-family: var(--font-num); }
.si-erd-col { font-size: var(--fs-xs); font-weight: 800; fill: var(--ink-2); }
.si-erd-line { fill: none; stroke: var(--ink-3); stroke-width: 1.3; }
.si-erd-card { font-size: var(--fs-2xs); fill: var(--ink-3); }
@media (max-width: 560px) { .si-dl { grid-template-columns: 1fr; } }

/* 사이드바 태그 — 아직 쓰기 전인 메뉴 (예: 준비 중) */
.gh-l { display: inline-flex; align-items: center; gap: 6px; }
.side-tag {
  flex: none; padding: 0 6px; border-radius: 4px;
  border: 1px solid rgba(255,255,255,.22); color: #E0904A;   /* 주황 갈색 글씨, 테두리는 다른 표시와 같게 */
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0; line-height: 1.6;
}
.app.side-collapsed .side-tag { display: none; }
.set-hours { display: flex; flex-direction: column; gap: var(--s-3); max-width: 520px; }
.set-hours-row { display: grid; grid-template-columns: 110px 1fr auto 1fr; gap: var(--s-3); align-items: center; }

/* 휴대폰 아래 탭 — 앱처럼 */
.mtabs { display: none; }
@media (max-width: 900px) {
  .mtabs {
    display: flex; flex: none;
    border-top: 1px solid var(--line); background: var(--surface);
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .mtab {
    flex: 1; min-height: 58px; border: 0; background: none; cursor: pointer;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    color: var(--ink-3); font: inherit; font-size: var(--fs-2xs); font-weight: 600;
  }
  .mtab svg { width: 22px; height: 22px; }
  .mtab[aria-current="page"] { color: var(--ink); }
  .mtab[aria-current="page"] svg { stroke-width: 2.2; }
}

/* 화면 맨 위 "확인 필요" 안내 — 사이드바 숫자의 뜻 */
.badge-note {
  display: flex; align-items: center; gap: var(--s-2);
  padding: var(--s-2) var(--s-4); margin-bottom: var(--s-4);
  border-radius: var(--r); background: var(--warn-bg); color: var(--warn);
  font-size: var(--fs-sm); font-weight: 600;
}
.badge-note-n { flex: none; padding: 1px 9px; border-radius: 999px; background: var(--warn); color: #fff; font-size: var(--fs-xs); font-weight: 700; white-space: nowrap; }

/* 누가 보는 화면인지 — 대표·매니저 / 관리자 (직원도 보는 화면은 표시 없음) */
.side-role {
  flex: none; padding: 0 6px; border-radius: 4px; line-height: 1.6;
  font-size: var(--fs-2xs); font-weight: 600; letter-spacing: 0; white-space: nowrap;
}
.side-role.role-mgr   { border: 1px solid rgba(255,255,255,.22); color: var(--side-ink-2); }
.side-role.role-admin { border: 1px solid color-mix(in srgb, var(--side-admin) 60%, transparent); background: color-mix(in srgb, var(--side-admin) 12%, transparent); color: var(--side-admin); }
.app.side-collapsed .side-role { display: none; }
.nav-item .side-role { margin-left: auto; }
.nav-item .side-role + .nav-badge { margin-left: 4px; }

/* ---------- 대시보드 — 운영 첫 화면 ---------- */
.dash-col { display: flex; flex-direction: column; gap: var(--s-5); min-width: 0; }
.dash-h { display: flex; align-items: center; gap: var(--s-2); }
.dash-h svg { color: var(--ink-3); }
.dash-list { display: flex; flex-direction: column; }
.dash-row {
  display: flex; align-items: center; gap: var(--s-3); padding: var(--s-3) 0;
  border-bottom: 1px solid var(--line); min-height: 48px;
}
.dash-list > .dash-row:last-child { border-bottom: 0; }
.dash-row.is-link { width: 100%; background: none; border-left: 0; border-right: 0; border-top: 0; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.dash-row.is-link:hover { background: var(--surface-2); }
.dash-row.is-link > svg { color: var(--ink-3); flex: none; }
.dash-row.is-today .strong { color: var(--good); }
.dash-row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.dash-ico { width: 30px; height: 30px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); }
.dash-empty { color: var(--ink-3); padding: var(--s-2) 0; }
.dash-empty.is-ok { display: flex; align-items: center; gap: var(--s-2); color: var(--good); font-weight: 700; }
.dash-stats { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s-4); margin-bottom: var(--s-3); }
.dash-num { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; }
.dash-link { margin-top: var(--s-3); }

/* 오른쪽 위 알림 종 */
.tb-bell { position: relative; }
.bell-dot { position: absolute; top: 6px; right: 6px; width: 8px; height: 8px; border-radius: 50%; background: var(--bad); box-shadow: 0 0 0 2px var(--surface); }
/* 알림 목록 — 읽지 않은 것은 굵게 + 왼쪽 점 */
.bell-head { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); }
.dropdown-item.unread { font-weight: 700; }
.dropdown-item.unread::before { content: ''; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--bad); margin-right: 2px; }
.dropdown:has(.bell-head) .dropdown-item:not(.unread) { color: var(--ink-2); }   /* 알림 목록에서만 */

/* ---------- 관리 → 테스트 (파이프라인) ---------- */
.ts-pipe { display: flex; flex-direction: column; gap: var(--s-2); margin-bottom: var(--s-5); }
.ts-stage { border: 1px solid var(--line); border-left: 4px solid var(--line-2); border-radius: var(--r-lg); background: var(--surface); overflow: hidden; }
.ts-stage.is-ok { border-left-color: var(--good); }
.ts-stage.is-fail { border-left-color: var(--bad); }
.ts-stage.is-run { border-left-color: var(--warn); }
.ts-head { display: flex; align-items: center; gap: var(--s-3); width: 100%; padding: var(--s-3) var(--s-4); border: 0; background: none; font: inherit; color: var(--ink); text-align: left; cursor: pointer; }
.ts-head:disabled { cursor: default; }
.ts-head > svg { color: var(--ink-3); transition: transform .15s; }
.ts-head[aria-expanded="true"] > svg { transform: rotate(180deg); }
.ts-no { width: 24px; height: 24px; flex: none; border-radius: 50%; display: grid; place-items: center; background: var(--surface-2); font-size: var(--fs-xs); font-weight: 700; }
.ts-title { flex: 1; min-width: 0; }
.ts-bar { width: 120px; height: 6px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.ts-bar > span { display: block; height: 100%; background: var(--warn); transition: width .1s; }
.ts-list { border-top: 1px solid var(--line); max-height: 420px; overflow: auto; }
.ts-case { display: flex; gap: var(--s-2); align-items: flex-start; padding: var(--s-2) var(--s-4); font-size: var(--fs-sm); border-bottom: 1px solid var(--line); }
.ts-mark { flex: none; color: var(--good); margin-top: 2px; }
.ts-case.is-bad { background: var(--bad-bg); }
.ts-case.is-bad .ts-mark { color: var(--bad); }
.ts-cell { text-align: center; font-size: var(--fs-sm); color: var(--ink-3); }
.ts-cell.is-open { color: var(--ink); font-weight: 600; }
.ts-cell.is-bad { background: var(--bad-bg); color: var(--bad); font-weight: 700; }

/* ---------- 대시보드 그림 ---------- */
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-5); }
.dash-kpi { display: flex; flex-direction: column; gap: 4px; padding: var(--s-4); border: 1px solid var(--line); border-radius: var(--r-lg); background: var(--surface); text-align: left; font: inherit; color: var(--ink); }
.dash-kpi.is-link { cursor: pointer; }
.dash-kpi.is-link:hover { background: var(--surface-2); }
.dash-kpi-l { display: flex; align-items: center; gap: 6px; font-size: var(--fs-xs); color: var(--ink-3); font-weight: 600; }
.dash-kpi-v { font-size: var(--fs-xl); font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.dash-kpi-s { font-size: var(--fs-xs); color: var(--ink-3); }
.dash-kpi.t-good .dash-kpi-v { color: var(--good); }
.dash-kpi.t-warn .dash-kpi-v { color: var(--warn); }
.dash-kpi.t-bad .dash-kpi-v { color: var(--bad); }
.dash-card .card-h { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); }
.dash-loading { height: 80px; border-radius: var(--r); background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2)); background-size: 200% 100%; animation: dash-shimmer 1.2s linear infinite; }
@keyframes dash-shimmer { to { background-position: -200% 0; } }
.dash-more { width: 100%; justify-content: center; margin-top: var(--s-2); }

/* 오늘 근무 시간 막대 */
.tl { display: flex; flex-direction: column; gap: 6px; }
.tl-row { display: grid; grid-template-columns: 110px 1fr 56px; align-items: center; gap: var(--s-3); }
.tl-name { display: flex; flex-direction: column; min-width: 0; line-height: 1.3; }
.tl-name .strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-track { position: relative; height: 22px; border-radius: 6px; background: var(--surface-2); }
.tl-plan { position: absolute; top: 3px; bottom: 3px; border-radius: 4px; background: var(--point-soft); border: 1px dashed var(--point); }
.tl-act { position: absolute; top: 6px; bottom: 6px; border-radius: 3px; background: var(--ink-3); }
.tl-act.is-on { background: var(--good); }
.tl-act.is-done { background: var(--ink-2); }
.tl-now { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--bad); border-radius: 1px; }
.tl-state { font-size: var(--fs-2xs); font-weight: 700; text-align: right; color: var(--ink-3); }
.tl-state.is-on { color: var(--good); }
.tl-axis { height: 16px; }
.tl-ticks { position: relative; height: 16px; }
.tl-ticks span { position: absolute; transform: translateX(-50%); font-size: var(--fs-2xs); color: var(--ink-3); font-variant-numeric: tabular-nums; }
.tl-legend { display: flex; flex-wrap: wrap; gap: var(--s-4); margin-top: var(--s-3); font-size: var(--fs-2xs); color: var(--ink-3); }
.tl-legend span { display: inline-flex; align-items: center; gap: 6px; }
.tl-legend i { display: inline-block; width: 14px; height: 8px; border-radius: 2px; }
.tl-k-plan { background: var(--point-soft); border: 1px dashed var(--point); }
.tl-k-act { background: var(--good); }
.tl-k-now { width: 2px !important; height: 12px !important; background: var(--bad); }
@media (max-width: 560px) { .tl-row { grid-template-columns: 76px 1fr 44px; gap: var(--s-2); } }

/* 세로 막대 (요일별 인원 · 마진율 분포) */
.wb { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: var(--s-2); align-items: end; height: 150px; }
.wb-col { display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%; }
.wb-n { font-size: var(--fs-xs); font-weight: 700; min-height: 1.2em; }
.wb-bar { flex: 1; width: 100%; max-width: 40px; display: flex; align-items: flex-end; border-radius: 6px; background: var(--surface-2); overflow: hidden; }
.wb-bar > span { display: block; width: 100%; background: var(--point); border-radius: 6px 6px 0 0; transition: height .3s; }
.wb-col.is-today .wb-bar > span { background: var(--ink); }
.wb-col.is-today .wb-d { color: var(--ink); font-weight: 800; }
.wb-d { font-size: var(--fs-2xs); color: var(--ink-3); white-space: nowrap; }
.wb-d.is-sun { color: var(--bad); }
.wb-d.is-sat { color: #2F5D9E; }
.dist .wb-bar > span { background: var(--chart-below); }
.dist .wb-col.is-ok .wb-bar > span { background: var(--chart-ok); }
.dist { height: 120px; }

/* 가로 막대 (사람별 근무 시간) */
.hb { display: flex; flex-direction: column; gap: var(--s-2); }
.hb-row { display: grid; grid-template-columns: 90px 1fr 84px; align-items: center; gap: var(--s-3); font-size: var(--fs-sm); }
.hb-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hb-track { height: 12px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.hb-track > span { display: block; height: 100%; border-radius: 999px; background: var(--point); }
.hb-v { text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); font-size: var(--fs-xs); }

/* 원가 도넛 */
.cost-top { display: flex; align-items: center; gap: var(--s-5); flex-wrap: wrap; }
.donut-wrap { position: relative; width: 140px; height: 140px; flex: none; }
.donut { width: 100%; height: 100%; }
.donut-c { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
.donut-legend { display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-sm); flex: 1; min-width: 140px; }
.donut-legend div { display: flex; align-items: center; gap: var(--s-2); }
.donut-legend i { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.donut-legend strong { margin-left: auto; font-variant-numeric: tabular-nums; }

/* 권한 미리보기 띠 (관리자) */
.preview-bar { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap;
  padding: var(--s-2) var(--s-4); background: var(--warn-bg); color: var(--warn); font-size: var(--fs-sm); border-bottom: 1px solid var(--line); }
.ts-roles { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: var(--s-3); margin-bottom: var(--s-5); }
.ts-role { display: flex; flex-direction: column; gap: var(--s-3); padding: var(--s-4); }
.ts-role-h { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--s-2); }
.ts-side { flex: 1; padding: var(--s-2) var(--s-3); border-radius: var(--r); background: var(--side-bg); color: var(--side-ink); font-size: var(--fs-xs); max-height: 260px; overflow: auto; }
.ts-side-g { margin-top: var(--s-2); font-size: var(--fs-2xs); font-weight: 700; color: var(--side-ink-2); }
.ts-side-i { padding: 2px 0 2px var(--s-2); }

/* 사이트 계정: 긴 아이디는 줄임표, 버튼 글자는 한 줄 */
.sa-line { min-width: 0; }
.sa-line code { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-line .btn, .sa-del { white-space: nowrap; flex: none; }

/* 사이트 계정 — 값 칸(아이디·비밀번호 같은 길이) 안 오른쪽에 아이콘. 복사는 늘 맨 오른쪽 */
.sa-line { display: grid; grid-template-columns: 56px 260px; align-items: center; gap: var(--s-2); }
.sa-field { display: flex; align-items: center; min-width: 0; height: 34px; padding: 0 2px 0 var(--s-3); border-radius: var(--r); background: var(--surface-2); }
.sa-field .sa-v { flex: 1; min-width: 0; padding: 0; background: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sa-ib { width: 30px; height: 30px; flex: none; display: grid; place-items: center; border: 0; border-radius: var(--r-sm); background: none; color: var(--ink-3); cursor: pointer; }
.sa-ib:hover { background: var(--surface-3); color: var(--ink); }
@media (pointer: coarse) { .sa-field { height: 42px; } .sa-ib { width: 38px; height: 38px; } }
@media (max-width: 560px) { .sa-line { grid-template-columns: 52px minmax(0, 1fr); } }
.sa-field .sa-empty { color: var(--ink-3); font-size: var(--fs-sm); }
.sa-contact { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); color: var(--ink-2); }
.sa-contact svg { color: var(--ink-3); }
.sa-contact a { color: var(--ink); font-variant-numeric: tabular-nums; text-decoration: underline; text-underline-offset: 2px; }

/* ---------- 제품 QR (tools/product-qr) ---------- */
.pq-sum { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.pq-row { display: grid; grid-template-columns: minmax(0, 1fr) auto auto auto; gap: var(--s-3); align-items: center; padding: var(--s-3) var(--s-5); border-bottom: 1px solid var(--line); }
.pq-row:last-child { border-bottom: 0; }
.pq-name { display: flex; align-items: center; gap: var(--s-2); flex-wrap: wrap; }
.pq-edit { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: var(--s-5); align-items: start; }
.pq-side { display: flex; flex-direction: column; align-items: center; gap: var(--s-2); text-align: center; }
.pq-side a { word-break: break-all; }
.pq-qr { width: 160px; min-height: 160px; display: flex; align-items: center; justify-content: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r-sm); }
.pq-check { list-style: none; padding: 0; margin: var(--s-3) 0 0; display: grid; gap: var(--s-1); font-size: var(--fs-sm); }
.pq-check li::before { content: '✓ '; font-weight: 700; color: var(--good); }
.pq-check li.bad { color: var(--bad); }
.pq-check li.bad::before { content: '! '; color: var(--bad); }
@media (max-width: 640px) { .pq-edit { grid-template-columns: 1fr; } .pq-row { padding: var(--s-3) var(--s-4); } }
.pq-store { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 0 var(--s-4); }
.pq-url { display: flex; align-items: center; gap: var(--s-1); min-width: 0; }
.pq-url a, .pq-url span { word-break: break-all; }
/* 아이콘만 있는 작은 복사 버튼 (사이트 계정과 같은 모양) */
.copy-ib { flex: none; width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--ink-3); cursor: pointer; }
.copy-ib:hover { background: var(--surface-2); color: var(--ink); }

/* ---------- 기본 설정 → 사이트별 로고 색 (베이커리 사이트·홈페이지와 같은 로고 모양) ---------- */
.brand-site { display: grid; grid-template-columns: 9em minmax(0, 1fr) auto; gap: var(--s-3); align-items: center; padding: var(--s-2) 0; border-bottom: 1px solid var(--line); }
.brand-site-pv { display: flex; align-items: center; min-height: 52px; padding: 0 var(--s-4); border-radius: var(--r-sm); border: 1px solid var(--line); }
.brand-mark { display: inline-flex; align-items: center; gap: 10px; }
.brand-emblem { display: block; width: 24px; aspect-ratio: 1; background: currentColor;
  -webkit-mask: url(/img/logo-emblem-orange.png) center / contain no-repeat; mask: url(/img/logo-emblem-orange.png) center / contain no-repeat; }
.brand-mark .mark-name { font-weight: 700; font-size: 14px; letter-spacing: .14em; }
.brand-swatches { display: flex; align-items: center; gap: 6px; }
.brand-swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--line-2); cursor: pointer; }
.brand-swatch[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--point); }
.brand-swatches input[type="color"] { width: 36px; height: 30px; padding: 0; border: 1px solid var(--line-2); border-radius: var(--r-sm); background: none; cursor: pointer; }
@media (max-width: 640px) { .brand-site { grid-template-columns: 1fr; } }

.pq-switch { min-width: 92px; justify-content: flex-end; }
.pq-switch span:last-child { font-size: var(--fs-sm); min-width: 3em; }
