/* MainFrame 포털 — CSP style-src 'self' : 인라인 style 속성을 쓰지 않는다 */
:root {
  --bg: #f4f6f9;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --text: #1c2330;
  --muted: #667085;
  --border: #dfe3ea;
  --primary: #2f6fed;
  --primary-ink: #ffffff;
  --primary-soft: #e8f0ff;
  --danger: #c4352b;
  --danger-soft: #fdecea;
  --ok: #1f9d55;
  --warn: #d98a00;
  --topbar: #111a2b;
  --topbar-ink: #e6ebf5;
  --topbar-muted: #93a0b8;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(16, 24, 40, .06), 0 4px 16px rgba(16, 24, 40, .06);
  --topbar-h: 48px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f141c;
    --surface: #171e29;
    --surface-2: #1c2431;
    --text: #e6ebf3;
    --muted: #94a0b4;
    --border: #2a3444;
    --primary: #5b8ef5;
    --primary-soft: #1d2a44;
    --danger: #f06a5e;
    --danger-soft: #3a1f1d;
    --topbar: #0a0f17;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 16px rgba(0, 0, 0, .3);
    color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 "Pretendard", "Segoe UI", "Malgun Gothic", "Apple SD Gothic Neo", system-ui, -apple-system, "Segoe UI", sans-serif;
}
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0 0 .4em; line-height: 1.25; }
h2 { font-size: 20px; }
h3 { font-size: 16px; }
p { margin: 0 0 .8em; }
a { color: var(--primary); }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.center { text-align: center; }
.right { text-align: right; }

.boot { display: grid; place-items: center; height: 100%; color: var(--muted); }

/* ---------------------------------------------------------------- 공통 부품 */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); padding: 20px; }
.card.flush { padding: 0; overflow: hidden; }
.narrow { max-width: 560px; margin-left: auto; margin-right: auto; }
.row { display: flex; align-items: center; }
.row.gap { gap: 8px; }
.row.between { justify-content: space-between; }
.row.end { justify-content: flex-end; }
.row.center { justify-content: center; }
.row.wrap { flex-wrap: wrap; gap: 12px; }
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; font-weight: 600; font-size: 13px; }
.field .row { font-weight: normal; }
.field .row input { flex: 1; }
input, select {
  font: inherit; color: var(--text); background: var(--surface);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 10px; min-height: 36px; font-weight: normal;
}
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
input[type="search"] { min-width: 220px; }
.check { display: flex; gap: 8px; align-items: center; margin: -4px 0 14px; font-size: 13px; }
.check input { min-height: 0; }
.perms { border: 1px solid var(--border); border-radius: 8px; padding: 10px 12px 4px; margin: 0 0 14px; }
.perms legend { font-weight: 600; font-size: 13px; padding: 0 4px; }
.perms .check { margin: 0 0 8px; align-items: flex-start; }
.perms .check small { display: block; color: var(--muted); font-weight: normal; }
.badge.perm { background: var(--surface-2); color: var(--text); margin-left: 4px; }
.badge.grp { background: var(--primary-soft, #e8efff); color: var(--primary, #2f6fed); border-color: transparent; margin: 2px 4px 0 0; }
/* 그룹 (사용자 관리) */
.group-box { margin-top: 16px; }
.group-box h3 { margin: 0 0 4px; }
.dialog.wide { width: min(760px, calc(100vw - 32px)); }
.member-pick { max-height: 260px; overflow-y: auto; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 2px 12px; margin: 8px 0; }
.member-pick .check { margin: 0; }
.grow { flex: 1; }
.btn {
  font: inherit; font-weight: 600; cursor: pointer; border-radius: 8px; padding: 7px 14px; min-height: 36px;
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
}
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { border-color: transparent; background: transparent; color: var(--muted); }
.btn.danger { color: var(--danger); }
.btn.small { min-height: 28px; padding: 3px 10px; font-size: 12px; }
.btn.block { width: 100%; margin-top: 4px; }
.btn[disabled] { opacity: .6; cursor: default; }
.notice { background: var(--primary-soft); color: var(--text); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.auth-links { margin: 14px 0 0; font-size: 13px; }
.auth-links a { color: var(--muted); text-decoration: none; }
.auth-links a:hover { color: var(--primary); text-decoration: underline; }
.reset-mail { padding: 12px; border: 1px solid var(--border); border-radius: 8px; margin-bottom: 12px; }
.reset-mail p { margin-bottom: 10px; }
.divider-text { text-align: center; margin: 4px 0 10px; }
#u-invite-block .notice, #u-invite-block .alert { margin-bottom: 14px; }
.dialog.wide { width: min(620px, calc(100vw - 32px)); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 14px; }
.grid-check { align-self: end; margin: 0 0 22px; }
.mail-test { margin: 4px 0 16px; padding-top: 12px; border-top: 1px solid var(--border); }
.mail-test input { flex: 1; min-width: 200px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } .grid-check { margin: -4px 0 14px; } }
.alert { background: var(--danger-soft); color: var(--danger); border-radius: 8px; padding: 9px 12px; font-size: 13px; }
.badge { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; background: var(--surface-2); border: 1px solid var(--border); color: var(--muted); }
.badge.admin { background: var(--primary-soft); color: var(--primary); border-color: transparent; }
.badge.off { background: var(--danger-soft); color: var(--danger); border-color: transparent; }
.badge.warn { color: var(--warn); }

/* ---------------------------------------------------------------- 로그인 */
.auth { min-height: 100%; display: grid; place-items: center; padding: 24px 16px; background:
  radial-gradient(1200px 600px at 10% -10%, rgba(47, 111, 237, .14), transparent 60%),
  radial-gradient(900px 500px at 110% 110%, rgba(47, 111, 237, .10), transparent 60%), var(--bg); }
.auth-card { width: 100%; max-width: 380px; padding: 28px; }
.auth-brand { display: flex; gap: 12px; align-items: center; margin-bottom: 20px; }
.auth-brand p { margin: 0; }
.logo { width: 30px; height: 30px; flex: none; background: url("/assets/logo.svg") center / contain no-repeat;
  filter: drop-shadow(0 2px 6px rgba(79, 70, 229, .35)); }
.brand-title { font-size: 20px; font-weight: 800; letter-spacing: .08em; margin: 0; }

/* ---------------------------------------------------------------- 셸 */
.shell { display: flex; flex-direction: column; height: 100%; }
.topbar {
  height: var(--topbar-h); flex: none; display: flex; align-items: center; gap: 18px; padding: 0 14px;
  background: var(--topbar); color: var(--topbar-ink);
}
.brand { display: flex; align-items: center; gap: 9px; color: inherit; text-decoration: none; }
.brand .logo { width: 26px; height: 26px; }
.brand .brand-title { font-size: 16px; }
.tabs { display: flex; gap: 2px; height: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab {
  position: relative; display: flex; align-items: center; gap: 6px; padding: 0 13px; height: 100%; white-space: nowrap; flex: none;
  color: var(--topbar-muted); text-decoration: none; font-weight: 700; letter-spacing: .02em; font-size: 13px;
  border-bottom: 2px solid transparent;
}
.tab:hover { color: var(--topbar-ink); }
/* 좁은 창: 들어가지 않는 탭은 '더보기' 메뉴로 (app.js fitTabs) */
.tab.tab-overflow { display: none; }
.tab-more { height: 100%; flex: none; }
.tab-more-btn { background: transparent; border: 0; border-bottom: 2px solid transparent; cursor: pointer; font-family: inherit; }
.tab-more-btn.has-current { color: #fff; border-bottom-color: #5b8ef5; }
.caret-s { font-size: 10px; }
.menu-list.tab-menu { left: 0; right: auto; min-width: 200px; max-height: calc(100vh - var(--topbar-h) - 16px); overflow-y: auto; }
.menu-list.tab-menu a { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.menu-list.tab-menu a[aria-current="page"] { font-weight: 700; color: var(--primary); }
.tab[aria-current="page"] { color: #fff; border-bottom-color: #5b8ef5; }
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--danger); }
.dot.ok { background: var(--ok); }
.spacer { flex: 1; }
.idjump input { width: clamp(150px, 20vw, 290px); min-height: 30px; padding: 4px 10px; font-size: 13px; border-radius: 8px; background: rgba(255, 255, 255, .07); border: 1px solid rgba(255, 255, 255, .12); color: var(--topbar-ink); }
.idjump input::placeholder { color: var(--topbar-muted); }
.idjump input:focus { background: rgba(255, 255, 255, .12); outline: 2px solid #5b8ef5; outline-offset: 0; }
.icon-btn { background: transparent; border: 0; color: var(--topbar-muted); font-size: 16px; cursor: pointer; padding: 6px 8px; border-radius: 6px; }
.icon-btn:hover { color: #fff; background: rgba(255, 255, 255, .08); }
.menu { position: relative; }
.user-btn { display: flex; align-items: center; gap: 8px; white-space: nowrap; background: transparent; border: 0; color: var(--topbar-ink); font: inherit; cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.user-btn:hover { background: rgba(255, 255, 255, .08); }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: #2f6fed; color: #fff; font-weight: 700; font-size: 12px; }
.caret { color: var(--topbar-muted); font-size: 11px; }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 6px); min-width: 220px; z-index: 20; padding: 6px;
  background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow);
}
.menu-head { display: flex; flex-direction: column; padding: 8px 10px 10px; border-bottom: 1px solid var(--border); margin-bottom: 4px; }
.menu-list a, .menu-list button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px; border: 0; background: transparent;
  color: inherit; font: inherit; text-decoration: none; cursor: pointer;
}
.menu-list a:hover, .menu-list button:hover { background: var(--surface-2); }

/* ---------------------------------------------------------------- 알림 (종) */
.bell { position: relative; display: grid; place-items: center; }
.bell .badge {
  position: absolute; top: 0; right: 0; min-width: 16px; height: 16px; padding: 0 4px; border-radius: 8px;
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700; line-height: 16px; text-align: center;
}
.notes-panel { width: min(380px, calc(100vw - 16px)); padding: 0; max-height: min(70vh, 560px); display: flex; flex-direction: column; }
.notes-panel[hidden] { display: none; }
.notes-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.menu-list .link-btn { display: inline; width: auto; padding: 2px 4px; color: var(--primary); font-size: 12px; }
.notes-list { list-style: none; margin: 0; padding: 4px; overflow-y: auto; flex: 1; }
.notes-list li + li { border-top: 1px solid var(--border); }
.menu-list .note { display: grid; grid-template-columns: 8px 1fr; gap: 0 8px; padding: 8px; }
.note .unread-dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 6px; background: transparent; }
.note.unread .unread-dot { background: var(--primary); }
.note .n-title { font-size: 13px; line-height: 1.4; overflow-wrap: anywhere; }
.note.unread .n-title { font-weight: 600; }
.note .n-text { grid-column: 2; font-size: 12px; color: var(--muted); white-space: pre-line; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.note .n-meta { grid-column: 2; font-size: 11px; color: var(--muted); margin-top: 2px; }
.notes-empty { padding: 20px; text-align: center; margin: 0; }
.menu-list .notes-more { text-align: center; border-top: 1px solid var(--border); border-radius: 0 0 var(--radius) var(--radius); color: var(--primary); font-size: 12px; }
#form-notify { margin-bottom: 16px; }

.stage { position: relative; flex: 1; min-height: 0; }
.pane { position: absolute; inset: 0; }
.app-pane iframe { display: block; width: 100%; height: 100%; border: 0; background: var(--surface); }
.page { overflow: auto; }
.page-inner { padding: 24px; max-width: 1200px; margin: 0 auto; }
.page-inner.narrow { max-width: 620px; }
/* 그룹웨어 설정 › 출근 알림 규칙 (2026-11-11) */
.gw-rules-title { margin: 14px 0 8px; font-size: 14px; }
.gw-rule { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; padding: 8px 10px; margin-bottom: 8px; border: 1px solid var(--border); border-radius: 8px; font-size: 13px; }
.gw-rule input[type="number"] { width: 4.6em; min-height: 30px; padding: 4px 6px; }
.gw-rule select { min-height: 30px; padding: 4px 6px; }
.gw-rule .check { margin: 0; }
.gw-rule .grow { flex: 1; }
.gw-rules-preview { margin: 8px 0 4px; color: var(--text); }
/* 휴대폰 알림 (2026-11-11): 기기 목록 · Home 안내 띠 */
.gw-push-devices { list-style: none; margin: 8px 0 0; padding: 0; font-size: 13px; }
.gw-push-devices li { display: flex; align-items: center; gap: 8px; padding: 4px 0; border-bottom: 1px solid var(--border); }
.gw-push-devices li .grow { flex: 1; }
.push-banner { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 0 0 14px; padding: 12px 14px; border: 1px solid var(--primary); border-radius: var(--radius); background: var(--surface); font-size: 14px; }
.push-banner .grow { flex: 1 1 200px; }
.push-banner input[type="time"] { min-height: 32px; padding: 4px 8px; }
/* 내 계정·그룹웨어 설정: 카드 사이 띄우기 (2026-11-11) */
.page-inner.narrow > .card + .card { margin-top: 16px; }
.pane-msg { position: absolute; inset: 0; display: grid; place-items: center; background: var(--bg); z-index: 5; padding: 16px; }
.kv { display: grid; grid-template-columns: 120px 1fr; gap: 6px 12px; margin: 0 0 20px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }

/* ---------------------------------------------------------------- 표 */
.table-wrap { margin-top: 16px; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; white-space: nowrap; }
.table th { font-size: 12px; color: var(--muted); font-weight: 700; background: var(--surface-2); }
.table tr:last-child td { border-bottom: 0; }
.table td.actions, .table th.right { text-align: right; }
.table td.actions .btn { margin-left: 4px; }
.table tr.inactive td { color: var(--muted); }
.empty { padding: 24px; text-align: center; margin: 0; }

/* ---------------------------------------------------------------- 대화상자·알림 */
.dialog { border: 1px solid var(--border); border-radius: 12px; padding: 22px; width: min(440px, calc(100vw - 32px)); background: var(--surface); color: var(--text); box-shadow: var(--shadow); }
.dialog::backdrop { background: rgba(10, 15, 25, .45); }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 50; padding: 10px 16px; border-radius: 8px;
  background: #1c2330; color: #fff; box-shadow: var(--shadow); font-size: 13px; max-width: calc(100vw - 32px);
}
.toast.error { background: var(--danger); }
body.plain { display: grid; place-items: center; min-height: 100%; padding: 16px; }

/* 좁아지면 윗줄을 먼저 줄인다 (그래도 안 들어가는 탭은 '더보기') */
@media (max-width: 1100px) {
  .topbar { gap: 10px; }
  .brand .brand-title { display: none; }
  .idjump input { width: clamp(120px, 16vw, 220px); min-width: 0; }
  .tab { padding: 0 10px; }
  #user-name, .caret { display: none; }
}
@media (max-width: 640px) {
  .notes-panel { position: fixed; left: 8px; right: 8px; top: calc(var(--topbar-h) + 4px); width: auto; }
  .topbar { gap: 8px; padding: 0 8px; }
  .brand .brand-title, #user-name, .caret { display: none; }
  .idjump input { width: 120px; }
  .tab { padding: 0 10px; }
  .page-inner { padding: 16px; }
  input[type="search"] { min-width: 0; width: 100%; }
}

/* 내 계정 > 코드 색 테마 미리보기 (색은 ims-code.css) */
.code-preview { margin: 4px 0 0; padding: 12px 14px; border: 1px solid var(--imc-border); border-radius: 8px; font: 13px/1.5 Consolas, "D2Coding", ui-monospace, monospace; white-space: pre; overflow-x: auto; tab-size: 4; }

/* ---------------------------------------------------------------- 통합 검색 */
.search-bar { display: flex; gap: 8px; margin-bottom: 6px; }
.search-bar input { flex: 1; min-width: 0; min-height: 38px; font-size: 15px; }
.search-results { display: grid; grid-template-columns: repeat(auto-fit, minmax(420px, 1fr)); gap: 14px; margin-top: 12px; align-items: start; }
.search-group { padding: 14px 16px; }
.search-group h3 { margin: 0; font-size: 15px; }
.search-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 10px; }
.search-item { border-top: 1px solid var(--border); padding-top: 9px; min-width: 0; }
.search-item:first-child { border-top: 0; padding-top: 0; }
.search-item.done .search-title { color: var(--muted); }
.search-top { display: flex; gap: 8px; align-items: baseline; min-width: 0; }
.search-title { font-weight: 700; color: var(--text); text-decoration: none; overflow-wrap: anywhere; }
.search-title:hover { color: var(--primary); text-decoration: underline; }
.search-snip { font-size: 12.5px; color: var(--muted); margin-top: 3px; overflow-wrap: anywhere; }
.search-also a { margin-right: 8px; }
.search-results mark { background: #fff2a8; color: inherit; padding: 0 1px; border-radius: 2px; }
.search-group .chip { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
@media (prefers-color-scheme: dark) { .search-results mark { background: #5c4d00; } }
@media (max-width: 720px) { .search-results { grid-template-columns: 1fr; } }

/* 홈 '내 할 일' */
.tab-home { font-weight: 700; }
.page-inner.home { max-width: 1280px; }
.home-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; flex-wrap: wrap; margin-bottom: 10px; }
.home-head h2 { margin: 0; }
.home-head p { margin: 2px 0 0; }
.home-stats { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 14px; min-height: 8px; }
.home-stats .stat { display: inline-flex; align-items: baseline; gap: 6px; padding: 6px 12px; border-radius: 999px; background: var(--surface); border: 1px solid var(--border); color: var(--text); text-decoration: none; font-size: 13px; }
.home-stats a.stat:hover { border-color: var(--primary); }
.home-stats .stat strong { font-size: 16px; }
.home-stats .stat.bad strong { color: var(--danger); }
.home-stats .stat.warn strong { color: #b26b00; }
.home-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 14px; align-items: start; }
.home-card { padding: 14px 16px; min-width: 0; }
.home-card.wide { grid-column: 1 / -1; }
.home-card h3 { margin: 0; font-size: 15px; }
.home-empty { margin: 10px 0 0; }
.home-list { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 9px; }
.home-item { border-top: 1px solid var(--border); padding-top: 8px; min-width: 0; }
.home-item:first-child { border-top: 0; padding-top: 0; }
.home-card .chip { flex: none; font-size: 11px; font-weight: 700; padding: 1px 7px; border-radius: 999px; background: var(--primary-soft); color: var(--primary); }
.home-card .chip.bad { background: #fdecea; color: var(--danger); }
.home-item.active .chip { background: #e6f6ec; color: #1f9d55; }
/* 이번 주 막대 */
.wk { margin-top: 10px; display: grid; gap: 4px; }
.wk-row { display: grid; grid-template-columns: minmax(160px, 30%) 1fr; gap: 10px; align-items: center; min-height: 26px; }
.wk-label { font-size: 13px; color: var(--text); text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a.wk-label:hover { color: var(--primary); text-decoration: underline; }
.wk-row.late .wk-label { color: var(--danger); }
.wk-row.done .wk-label { color: var(--muted); text-decoration: line-through; }
.wk-cols { display: grid; grid-template-columns: repeat(7, 1fr); position: relative; }
.wk-day { display: flex; gap: 4px; justify-content: center; font-size: 12px; font-weight: 600; padding: 2px 0; border-radius: 6px; }
.wk-day.today { background: var(--primary-soft); color: var(--primary); }
.wk-day.off span:first-child { color: var(--danger); }
.wk-track { height: 24px; }
.wk-nodate { position: absolute; left: 6px; top: 50%; transform: translateY(-50%); white-space: nowrap; }
.wk-cell { border-left: 1px dashed var(--border); }
.wk-cell.off { background: rgba(127, 127, 127, .06); }
.wk-cell.today { background: rgba(47, 111, 237, .08); }
.wk-bar { position: absolute; top: 3px; height: 18px; border-radius: 5px; background: #8fb0f5; overflow: hidden; display: flex; align-items: center; text-decoration: none; font-size: 11px; color: #0b2a66; }
.wk-bar:hover { filter: brightness(1.05); outline: 2px solid var(--primary); }
.wk-fill { position: absolute; left: 0; top: 0; bottom: 0; background: #2f6fed; opacity: .55; }
.wk-pct { position: relative; padding: 0 6px; font-weight: 700; }
.wk-bar.late { background: #f3a29b; color: #5a0f09; }
.wk-bar.late .wk-fill { background: #c4352b; }
.wk-bar.done { background: #b9e5c9; color: #0d4d27; }
.wk-bar.done .wk-fill { background: #1f9d55; }
.wk-bar.past { padding: 0 6px; font-weight: 700; }
.wk-bar.cut-left { border-top-left-radius: 0; border-bottom-left-radius: 0; }
.wk-bar.cut-right { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.wk-bar.ms { width: 16px; height: 16px; top: 4px; border-radius: 2px; transform: rotate(45deg); background: #7a4fd6; }
.wk-bar.ms.late { background: var(--danger); }
@media (prefers-color-scheme: dark) {
  .home-card .chip.bad { background: #3a1f1d; }
  .home-item.active .chip { background: #13301f; color: #3ecf8e; }
  .wk-bar { background: #34508f; color: #e6ebf3; }
  .wk-bar.late { background: #7a2d27; color: #ffe3df; }
  .wk-bar.done { background: #1f5236; color: #d8f5e4; }
}
@media (max-width: 720px) {
  .home-grid { grid-template-columns: 1fr; }
  .wk-row { grid-template-columns: 110px 1fr; }
}

/* ---------------------------------------------------------------- 배포용 / 개발용 (2026-10-30) */
:root { --dev: #f59e0b; --dev-ink: #1f1300; --dev-soft: #fff4dc; }
@media (prefers-color-scheme: dark) { :root { --dev-soft: #3a2a08; } }
/* 개발용 IMS: 위쪽에 주황 띠 + '개발용' 배지 — 배포용과 한눈에 구별 */
body.env-dev .topbar { box-shadow: inset 0 3px 0 var(--dev); }
.env-badge { flex: none; margin-left: -8px; padding: 2px 8px; border-radius: 999px; background: var(--dev); color: var(--dev-ink); font-size: 11px; font-weight: 800; letter-spacing: .02em; cursor: default; }
/* 개발용에서 아직 '개발 중' 인 탭 */
.tab.tab-dev::after { content: "개발"; padding: 1px 5px; border-radius: 6px; background: rgba(245, 158, 11, .18); color: #fbbf5a; font-size: 10px; font-weight: 800; letter-spacing: 0; }
.menu-list.tab-menu a.tab-dev::after { content: "개발"; font-size: 10px; color: var(--dev); font-weight: 800; }
/* 사용자 관리 › 탭 공개 */
.tab-publish { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 8px; margin-top: 10px; }
.tab-pub-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.tab-pub-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.seg { display: inline-flex; flex: none; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.seg-btn { padding: 4px 10px; border: 0; background: var(--surface); color: var(--muted); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }
.seg-btn + .seg-btn { border-left: 1px solid var(--border); }
.seg-btn[aria-checked="true"] { background: var(--primary); color: var(--primary-ink); }
.seg-btn.dev[aria-checked="true"] { background: var(--dev); color: var(--dev-ink); }
.seg-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

/* ---------------------------------------------------------------- 좁은 화면의 표 (2026-11-02)
   표가 화면보다 넓으면 가로 스크롤하고, 맨 오른쪽 '관리' 칸(버튼)은 오른쪽에 붙여 항상 보이게 한다.
   (예전에는 .card.flush 의 overflow:hidden 이 .table-wrap 의 가로 스크롤을 덮어 버튼이 잘려 사라졌다) */
.table-wrap.card.flush { overflow-x: auto; }
.table td.actions, .table th.right:last-child { position: sticky; right: 0; z-index: 1; background: var(--surface); box-shadow: -12px 0 10px -12px rgba(0, 0, 0, .35); }
.table th.right:last-child { background: var(--surface-2); }
/* 사용자 관리 윗줄(검색·메일 설정·사용자 추가): 좁으면 줄을 바꾼다 */
#pane-admin .page-inner > .row.between > .row.gap { flex-wrap: wrap; justify-content: flex-end; }
@media (max-width: 640px) {
  #pane-admin .page-inner > .row.between > .row.gap { width: 100%; justify-content: flex-start; }
  #pane-admin .page-inner > .row.between > .row.gap input[type="search"] { flex: 1 1 100%; }
}

/* 내 Job 캘린더 (Home, 2026-11-06) */
.hcal { margin-top: 10px; }
.hcal-bar { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-bottom: 8px; }
.hcal-bar strong { font-size: 15px; min-width: 100px; text-align: center; }
.hcal-check { display: inline-flex; align-items: center; gap: 4px; margin-left: 8px; cursor: pointer; }
.hcal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border-top: 1px solid var(--border); border-left: 1px solid var(--border); border-radius: 6px; overflow: hidden; }
.hcal-wd { font-size: 12px; font-weight: 600; text-align: center; padding: 4px 0; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); background: var(--surface-2); }
.hcal-wd.sun { color: var(--danger); }
.hcal-day { min-height: 96px; padding: 3px 4px 4px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.hcal-day.out { background: var(--surface-2); }
.hcal-day.out .hcal-num { opacity: .6; }
.hcal-day.today { box-shadow: inset 0 0 0 2px var(--primary); }
.hcal-num { font-size: 12px; font-weight: 600; color: var(--muted); }
.hcal-day.off .hcal-num { color: var(--danger); }
.hcal-day.today .hcal-num { color: var(--primary); }
.hcal-ev { display: block; font-size: 11.5px; line-height: 1.4; padding: 1px 5px; border-radius: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; text-decoration: none; color: var(--text); background: var(--surface-2); border-left: 3px solid var(--muted); }
.hcal-ev:hover { text-decoration: underline; }
.hcal-ev.c-IN_PROGRESS { background: var(--primary-soft); border-left-color: var(--primary); }
.hcal-ev.c-DONE { border-left-color: #1f9d55; color: var(--muted); text-decoration: line-through; }
.hcal-ev.late { background: var(--danger-soft, #fdecea); border-left-color: var(--danger); }
.hcal-more { font-size: 11px; color: var(--muted); padding-left: 4px; cursor: default; }
.hcal-nodate { margin-top: 8px; display: flex; flex-wrap: wrap; gap: 4px; align-items: center; }
.hcal-nodate .hcal-ev { display: inline-block; max-width: 280px; }
@media (max-width: 700px) {
  .hcal-day { min-height: 64px; padding: 2px; }
  .hcal-ev { font-size: 10.5px; padding: 0 3px; }
}
.hcal-ev.sch { border-left-style: dashed; }
.hcal-ev.ms { font-weight: 600; }
.hcal-legend { margin: 6px 0 0; }
/* 홈 화면 설정 (2026-11-06) */
.home-set-list { list-style: none; margin: 10px 0 14px; padding: 0; display: grid; gap: 4px; }
.home-set-row { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 8px; background: var(--surface-2); }
.home-set-row label { cursor: pointer; }
.home-set-row .grow { flex: 1; }
/* 그룹웨어 근태 (2026-11-06) */
.hcal-ev.leave { background: rgba(139, 92, 246, .14); border-left-color: #8b5cf6; font-weight: 600; cursor: default; }
.hcal-ev.leave:hover { text-decoration: none; }

/* 등록 기기 (2026-11-19) */
.device-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 12px; }
.device-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 10px; border: 1px solid var(--border, #ddd); border-radius: 8px; }
.device-info { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.device-info .muted { flex-basis: 100%; }
.device-row > .row { flex: none; }
.device-row .btn { white-space: nowrap; }
