/* ============================================================
   Admin · Google Material 3 / Workspace 스타일
   ============================================================ */

@import url('/fonts/fonts.css');   /* 아이콘·Pretendard 내장 (폐쇄망 대응) */
@import url('/tokens.css');        /* 공통 디자인 토큰 (글꼴·간격·모서리·상태 색) */

:root {
  /* 대표 색 — 회사 브랜딩 색(--brand)이 있으면 그것을, 없으면 기본 파랑 */
  --gg-primary: var(--brand, #1A73E8);
  --gg-primary-2: color-mix(in srgb, var(--gg-primary) 78%, black);
  --gg-primary-soft: color-mix(in srgb, var(--gg-primary) 12%, white);
  --gg-primary-ink: var(--gg-primary);   /* 대표 색을 '글자'로 쓸 때 (링크·글자 버튼) — 어두운 테마에서 밝게 */
  --gg-danger-fill: #C5221F;             /* 흰 글자를 올리는 위험 버튼 배경 */
  --gg-text: #202124;
  --gg-text-2: #5F6368;
  --gg-text-3: #6B7075;                  /* 흰 배경 4.9:1 · 회색 배경 4.5:1 이상 */
  --gg-bg: #fff;
  --gg-bg-2: #F5F6F8;
  --gg-bg-3: #ECEEF1;
  --gg-border: #DFE2E6;
  --gg-border-2: #ECEEF1;
  --gg-success: #137333;
  --gg-success-soft: #E6F4EA;
  --gg-warning: #B06000;
  --gg-warning-soft: #FEF7E0;
  --gg-error: #C5221F;
  --gg-error-soft: #FCE8E6;

  --gg-r-sm: 4px;
  --gg-r-md: 8px;
  --gg-r-lg: 12px;
  --gg-r-pill: 100px;

  --gg-shadow-1: 0 1px 2px rgba(60,64,67,0.08), 0 1px 3px rgba(60,64,67,0.04);
  --gg-shadow-2: 0 1px 3px rgba(60,64,67,0.10), 0 4px 8px rgba(60,64,67,0.06);

  /* 관리자 화면은 Pretendard 하나로 — 숫자(시각·번호)는 같은 글꼴의 고정 폭 숫자(tabular-nums) */
  --gg-font: Pretendard, -apple-system, BlinkMacSystemFont, 'Apple SD Gothic Neo', 'Malgun Gothic', sans-serif;
  --gg-font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;   /* 권한 코드처럼 '입력하는 값'에만 */
}

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

/* === Dark theme === */
html[data-admin-theme="dark"] {
  --gg-text: #E8EAED;
  --gg-text-2: #BDC1C6;
  --gg-text-3: #9AA0A6;
  --gg-bg: #202124;
  --gg-bg-2: #2D2E31;
  --gg-bg-3: #3C4043;
  --gg-border: #3C4043;
  --gg-border-2: #5F6368;
  --gg-primary-soft: color-mix(in srgb, var(--gg-primary) 22%, #202124);
  --gg-primary-ink: color-mix(in srgb, var(--gg-primary) 45%, white);
  /* 상태 글자 색 — 어두운 배경에서 4.5:1 이상 */
  --gg-success: #81C995;
  --gg-warning: #FDD663;
  --gg-error: #F28B82;
  --gg-success-soft: #1E3D2A;
  --gg-warning-soft: #4A3A1F;
  --gg-error-soft: #4A2426;
}
html[data-admin-theme="dark"] body { background: #1A1B1E; }
html[data-admin-theme="dark"] .g-topbar { background: #202124; border-color: #3C4043; }
html[data-admin-theme="dark"] .g-sidenav { background: #202124; border-color: #3C4043; }
html[data-admin-theme="dark"] .g-card,
html[data-admin-theme="dark"] .g-kpi { background: #2D2E31; border-color: #3C4043; }
html[data-admin-theme="dark"] .g-table th { background: #28292C; }
html[data-admin-theme="dark"] .g-table tbody tr:hover { background: #28292C; }
html[data-admin-theme="dark"] .g-input,
html[data-admin-theme="dark"] .g-select,
html[data-admin-theme="dark"] .g-textarea { background: #1A1B1E; color: #E8EAED; border-color: #5F6368; }
html[data-admin-theme="dark"] .g-dialog { background: #2D2E31; }
html[data-admin-theme="dark"] .g-topbar-search { background: #3C4043; }

/* === Hanji (Korean traditional) theme === */
html[data-admin-theme="hanji"] {
  --gg-primary: #4F6E62;
  --gg-primary-2: #3A5448;
  --gg-primary-soft: #D9E3DD;
  --gg-text: #14110D;
  --gg-text-2: #4A4438;
  --gg-text-3: #8C857C;
  --gg-bg: #FBF9F4;
  --gg-bg-2: #F1ECDF;
  --gg-bg-3: #E5DECD;
  --gg-border: #DDD6C5;
  --gg-border-2: #E8E1CE;
}
html[data-admin-theme="hanji"] body { background: #F4EFE3; background-image: radial-gradient(rgba(20,17,13,0.04) 1px, transparent 1px); background-size: 22px 22px; }
html[data-admin-theme="hanji"] .g-topbar { background: rgba(251,249,244,0.9); backdrop-filter: blur(8px); border-color: var(--gg-border); }
html[data-admin-theme="hanji"] .g-logo { background: #B85742; transform: rotate(-3deg); border-radius: 6px; }
html[data-admin-theme="hanji"] .g-page-title,
html[data-admin-theme="hanji"] .g-card-title { font-family: 'Gowun Batang', serif; font-weight: 600; }

/* === Color-blind friendly (Wong palette) — high contrast, deuteranopia-safe === */
html[data-admin-theme="cb"] {
  --gg-primary: #0072B2;        /* blue */
  --gg-primary-2: #005A8C;
  --gg-primary-soft: #CFE5F2;
  --gg-success: #009E73;        /* bluish green */
  --gg-warning: #E69F00;        /* orange */
  --gg-error:   #D55E00;        /* vermilion */
  --gg-text: #000;
  --gg-text-2: #2A2A2A;
  --gg-text-3: #555;
  --gg-bg: #FFFFFF;
  --gg-bg-2: #F2F2F2;
  --gg-bg-3: #E5E5E5;
  --gg-border: #999;
  --gg-border-2: #CCC;
}
html[data-admin-theme="cb"] .g-chip-success { background:#009E73; color:#fff; }
html[data-admin-theme="cb"] .g-chip-warning { background:#E69F00; color:#000; }
html[data-admin-theme="cb"] .g-chip-error   { background:#D55E00; color:#fff; }
html[data-admin-theme="cb"] .g-chip { font-weight:600; }
html[data-admin-theme="cb"] .g-btn-primary { background:#0072B2; }
html[data-admin-theme="cb"] body { background: #FFFFFF; }
body {
  font-family: var(--gg-font);
  font-size: 14px;
  line-height: 1.5;
  color: var(--gg-text);
  background: var(--gg-bg-2);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  font-feature-settings: 'tnum' 1;   /* 숫자 폭 고정 — 표의 시각·건수가 세로로 맞음 */
  letter-spacing: -0.005em;
}

.material-symbols-outlined {
  font-variation-settings: 'FILL' 0, 'wght' 400, 'GRAD' 0, 'opsz' 24;
  font-size: 20px;
}

a { color: var(--gg-primary-ink); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ============== TOP APP BAR ============== */
.g-topbar {
  height: 64px;
  background: var(--gg-bg);
  border-bottom: 1px solid var(--gg-border);
  display: flex;
  align-items: center;
  padding: 0 16px;
  gap: 12px;
  position: sticky; top: 0; z-index: 10;
}
.g-topbar-left { display: flex; align-items: center; gap: 8px; min-width: 240px; }
.g-brand { display: flex; align-items: center; gap: 12px; color: var(--gg-text); text-decoration: none; }
.g-brand:hover { text-decoration: none; }
.g-logo {
  width: 36px; height: 36px;
  background: var(--gg-primary);
  color: #fff;
  font-weight: 700; font-size: 17px;
  border-radius: 9px; overflow: hidden;
  display: flex; align-items: center; justify-content: center;
}
.g-brand { min-width: 0; flex-shrink: 1; }
.g-brand .label { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; min-width: 0; max-width: 26ch; overflow: hidden; text-overflow: ellipsis; }
.g-brand .label small { font-weight: 400; color: var(--gg-text-3); margin-left: 6px; font-size: 13px; }

.g-topbar-search {
  flex: 1; max-width: 720px;
  display: flex; align-items: center; gap: 12px;
  background: var(--gg-bg-3);
  height: 48px; padding: 0 16px;
  border-radius: 8px;
  margin: 0 16px;
}
.g-topbar-search input {
  flex: 1; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 15px; color: var(--gg-text);
}
.g-topbar-search:focus-within { background: var(--gg-bg); box-shadow: var(--gg-shadow-2); }

.g-topbar-right { display: flex; align-items: center; gap: 4px; }
.g-icon-btn {
  width: 40px; height: 40px;
  border: 0; background: transparent;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; color: var(--gg-text-2);
  position: relative;
}
.g-icon-btn:hover { background: var(--gg-bg-3); }
.g-icon-btn .dot { position: absolute; top: 8px; right: 8px; width: 8px; height: 8px; background: var(--gg-error); border-radius: 50%; border: 2px solid #fff; }

.g-avatar {
  width: 32px; height: 32px;
  background: var(--gg-primary);
  color: #fff;
  font-weight: 500; font-size: 14px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin-left: 8px; cursor: pointer;
}

/* ============== LAYOUT ============== */
.g-layout { display: flex; min-height: calc(100vh - 64px); }

.g-sidenav {
  width: 256px;
  background: var(--gg-bg);
  border-right: 1px solid var(--gg-border);
  padding: 12px 0;
  flex-shrink: 0;
}
.g-sidenav-section {
  padding: 18px 24px 6px;
  font-size: 12px; font-weight: 600;
  color: var(--gg-text-3);
}
.g-sidenav ul { list-style: none; padding: 0; margin: 0; }
.g-sidenav a {
  display: flex; align-items: center; gap: 16px;
  padding: 10px 24px;
  color: var(--gg-text);
  text-decoration: none;
  font-size: 14px; font-weight: 500;
  position: relative;
  border-radius: 8px;
  margin: 1px 10px;
  padding: 9px 14px;
}
.g-sidenav a:hover { background: var(--gg-bg-3); text-decoration: none; }
.g-sidenav a.active {
  background: var(--gg-primary-soft);
  color: var(--gg-primary-ink);
  font-weight: 600;
}
.g-sidenav a.active::before { content: ''; position: absolute; left: -10px; top: 8px; bottom: 8px; width: 3px; border-radius: 0 3px 3px 0; background: var(--gg-primary); }
.g-sidenav a.active .material-symbols-outlined { color: var(--gg-primary-ink); }
.g-sidenav a .material-symbols-outlined { font-size: 22px; color: var(--gg-text-2); }
.g-sidenav a .badge {
  margin-left: auto;
  background: var(--gg-danger-fill);
  color: #fff;
  font-size: 11px; font-weight: 500;
  padding: 2px 8px; border-radius: 100px;
  min-width: 18px; text-align: center;
}

.g-content {
  flex: 1; min-width: 0;
  padding: 28px 40px 56px;
}

/* ============== PAGE HEADER ============== */
/* 모든 화면 공통 머리말: 제목 + 한 줄 설명 (왼쪽) / 주요 버튼 (오른쪽, 주 버튼은 맨 끝) */
.g-page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: 20px; gap: 12px 24px; flex-wrap: wrap;
}
.g-page-head > div:first-child { min-width: 0; flex: 1 1 320px; }
.g-page-title {
  font-family: var(--gg-font);
  font-size: 24px; font-weight: 700;
  letter-spacing: -0.025em; line-height: 1.25;
  margin: 0;
}
.g-page-sub { font-size: 14px; color: var(--gg-text-2); margin-top: 6px; max-width: 72ch; }
.g-page-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }

/* ============== CARD ============== */
.g-card {
  background: var(--gg-bg);
  border: 1px solid var(--gg-border-2);
  border-radius: var(--gg-r-lg);
  padding: 20px 22px;
}
.g-card-tight { padding: 16px; }
.g-card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 16px; gap: 12px;
}
.g-card-title { font-size: 15px; font-weight: 700; margin: 0; letter-spacing: -0.015em; }
.g-card-sub { font-size: 13px; color: var(--gg-text-2); margin-top: 2px; }

/* ============== BUTTONS ============== */
.g-btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 16px;
  border-radius: 9px;
  font-family: inherit; font-size: 14px; font-weight: 600;
  white-space: nowrap;
  cursor: pointer; border: 1px solid transparent;
  transition: background .12s, box-shadow .12s;
  text-decoration: none;
  height: 36px;
}
.g-btn-primary { background: var(--gg-primary); color: #fff; }
.g-btn-primary:hover { background: var(--gg-primary-2); box-shadow: var(--gg-shadow-1); text-decoration: none; }
.g-btn-outline { background: var(--gg-bg); color: var(--gg-text); border-color: var(--gg-border); }
.g-btn-outline:hover { background: var(--gg-bg-2); border-color: var(--gg-text-3); text-decoration: none; }
.g-btn-outline .material-symbols-outlined { color: var(--gg-text-2); }
.g-btn:focus-visible, .g-icon-btn:focus-visible, .g-sidenav a:focus-visible { outline: 2px solid var(--gg-primary); outline-offset: 2px; }
.g-btn[disabled] { opacity: .5; cursor: default; }
.g-btn-text { background: transparent; color: var(--gg-primary-ink); padding: 9px 12px; }
.g-btn-text:hover { background: var(--gg-primary-soft); text-decoration: none; }
.g-btn-danger { background: var(--gg-danger-fill); color: #fff; }
.g-btn-icon { padding: 0; width: 36px; height: 36px; justify-content: center; }
.g-btn .material-symbols-outlined { font-size: 18px; }

/* ============== CHIPS ============== */
.g-chip {
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; flex-shrink: 0;
  padding: 3px 9px;
  border-radius: 6px;
  font-size: 12px; font-weight: 600;
  background: var(--gg-bg-3); color: var(--gg-text-2);
}
.g-chip-primary { background: var(--gg-primary-soft); color: var(--gg-primary-ink); }
.g-chip-success { background: var(--gg-success-soft); color: var(--gg-success); }
.g-chip-warning { background: var(--gg-warning-soft); color: var(--gg-warning); }
.g-chip-error   { background: var(--gg-error-soft); color: var(--gg-error); }
.g-chip .dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; }

/* ============== TABLE ============== */
.g-table { width: 100%; border-collapse: collapse; }
.g-table th, .g-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid var(--gg-border-2);
  font-size: 14px;
  vertical-align: middle;
}
.g-table th {
  font-size: 12px; font-weight: 600;
  color: var(--gg-text-3);
  background: transparent;
  border-bottom-color: var(--gg-border);
  white-space: nowrap;
}
.g-table tbody tr:last-child td { border-bottom: 0; }
.g-table tbody tr { transition: background .1s; }
.g-table tbody tr:hover { background: var(--gg-bg-2); }
.g-table .mono { font-size: 13px; color: var(--gg-text-2); }   /* 번호·시각 — 고정 폭 숫자 */

/* ============== SWITCH ============== */
.g-switch {
  width: 36px; height: 20px;
  background: var(--gg-text-3);
  border-radius: 100px;
  position: relative; cursor: pointer;
  transition: background .15s;
  flex-shrink: 0; border: 0; padding: 0;
}
.g-switch::after {
  content: ''; position: absolute;
  top: 2px; left: 2px; width: 16px; height: 16px;
  background: #fff; border-radius: 50%;
  transition: left .15s;
}
.g-switch.on { background: var(--gg-primary); }
.g-switch:focus-visible { outline: 2px solid var(--gg-primary); outline-offset: 2px; }
.g-switch.on::after { left: 18px; }

/* ============== INPUT ============== */
.g-input, .g-select, .g-textarea {
  width: 100%;
  padding: 10px 14px;
  font-family: inherit; font-size: 14px;
  color: var(--gg-text);
  background: var(--gg-bg);
  border: 1px solid var(--gg-border);
  border-radius: var(--gg-r-md);
  outline: none;
}
.g-input:focus, .g-select:focus, .g-textarea:focus {
  border-color: var(--gg-primary-ink);
  box-shadow: 0 0 0 1px var(--gg-primary);
}
.g-label {
  font-size: 12px; font-weight: 500;
  color: var(--gg-text-2);
  margin-bottom: 6px;
  display: block;
}

/* ============== KPI ============== */
.g-kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; }
.g-kpi {
  background: var(--gg-bg);
  border: 1px solid var(--gg-border-2);
  border-radius: var(--gg-r-lg);
  padding: 20px 22px;
}
.g-kpi-label { font-size: 13px; color: var(--gg-text-2); margin-bottom: 8px; display: flex; justify-content: space-between; }
.g-kpi-value { font-size: 30px; font-weight: 700; line-height: 1.1; letter-spacing: -0.03em; color: var(--gg-text); }
.g-kpi-value small { font-size: 14px; color: var(--gg-text-2); margin-left: 4px; font-weight: 400; }
.g-kpi-delta { font-size: 12px; color: var(--gg-success); margin-top: 4px; display: flex; align-items: center; gap: 2px; }
.g-kpi-delta.down { color: var(--gg-error); }

/* ============== DIALOG ============== */
.g-dialog-overlay {
  position: fixed; inset: 0;
  background: rgba(32,33,36,0.5);
  backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px);
  display: none; align-items: center; justify-content: center;
  z-index: 100; padding: 24px;
  animation: overlay-fade .18s ease-out;
}
.g-dialog-overlay.on { display: flex; }
@keyframes overlay-fade { from { opacity: 0; } to { opacity: 1; } }
.g-dialog {
  background: #fff;
  border-radius: var(--gg-r-lg);
  padding: 28px;
  max-width: 540px; width: 100%;
  box-shadow: 0 24px 60px -10px rgba(0,0,0,0.3), 0 6px 16px rgba(0,0,0,0.12);
}
.g-dialog h2 { font-size: 22px; font-weight: 500; margin: 0 0 8px; letter-spacing: -0.01em; }
.g-dialog .actions { display: flex; gap: 8px; justify-content: flex-end; margin-top: 24px; }

/* Modal animations + icon */
@keyframes modal-pop { 0% { transform: scale(0.94); opacity: 0; } 100% { transform: scale(1); opacity: 1; } }
@keyframes modal-pop-out { to { transform: scale(0.95); opacity: 0; } }
.modal-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--gg-primary-soft); color: var(--gg-primary-ink);
}
.modal-icon.success { background: var(--gg-success-soft); color: var(--gg-success); }
.modal-icon.warning { background: var(--gg-warning-soft); color: var(--gg-warning); }
.modal-icon.error { background: var(--gg-error-soft); color: var(--gg-error); }
.modal-icon.info { background: var(--gg-primary-soft); color: var(--gg-primary-ink); }
.modal-icon .material-symbols-outlined { font-size: 24px; }
.admin-modal-overlay { z-index: 2000 !important; }
.admin-modal { animation: modal-pop .22s cubic-bezier(.2,.85,.2,1); }

/* ============== RESPONSIVE ============== */
@media (max-width: 1024px) {
  .g-content { padding: 24px 24px; }
}
/* ===== 업무 모드 선택 ===== */
.g-ws { padding: 6px 8px 12px; margin-bottom: 6px; border-bottom: 1px solid var(--gg-border); }
.g-ws-label { display: flex; align-items: center; gap: 6px; font-size: 11px; color: var(--gg-text-3); margin: 2px 4px 6px; letter-spacing: .02em; }
.g-ws-label .material-symbols-outlined { font-size: 16px; color: var(--gg-primary-ink); }
.g-ws-select { width: 100%; height: 38px; padding: 0 10px; border: 1px solid var(--gg-border); border-radius: 8px; background: var(--gg-bg); color: var(--gg-text); font: inherit; font-size: 14px; font-weight: 500; cursor: pointer; }
.g-ws-fixed { height: 38px; display: flex; align-items: center; padding: 0 12px; border-radius: 8px; background: var(--gg-primary-soft); color: var(--gg-primary-ink); font-weight: 600; font-size: 14px; }
.g-ws-desc { font-size: 11px; color: var(--gg-text-3); margin: 6px 4px 0; line-height: 1.4; }
.g-sidenav a .g-ext { font-size: 14px !important; margin-left: auto; color: var(--gg-text-3); }
.g-menu-btn { display: none; }
.g-scrim { display: none; }

/* ===== 태블릿 ===== */
@media (max-width: 1024px) {
  .g-content [style*="grid-template-columns:repeat(4"], .g-content [style*="grid-template-columns: repeat(4"] { grid-template-columns: repeat(2, 1fr) !important; }
}

/* ===== 모바일 (≤768px) ===== */
@media (max-width: 768px) {
  .g-topbar { padding: 0 6px; gap: 2px; }
  .g-topbar-left { min-width: auto; gap: 2px; }
  .g-brand .label { display: none; }
  .g-topbar-search { display: none; }
  .g-topbar .hide-sm { display: none; }
  .g-menu-btn { display: inline-flex; }
  .g-icon-btn { min-width: 44px; min-height: 44px; }

  /* 사이드바 → 햄버거 드로어 */
  .g-sidenav {
    position: fixed; top: 64px; bottom: 0; left: 0; z-index: 1200;
    width: min(300px, 86vw); padding: 8px; overflow-y: auto;
    background: var(--gg-bg); box-shadow: 0 0 40px rgba(0,0,0,.25);
    transform: translateX(-105%); transition: transform .22s ease;
  }
  body.nav-open .g-sidenav { transform: none; }
  body.nav-open .g-scrim { display: block; position: fixed; inset: 64px 0 0 0; background: rgba(0,0,0,.35); z-index: 1100; }
  body.nav-open { overflow: hidden; }
  .g-sidenav a { min-height: 44px; }

  /* 가로 스크롤 방지: 인라인 다단 그리드 → 1단, 그리드 자식 축소 허용 */
  .g-content { padding: 14px 12px 32px; max-width: 100vw; overflow-x: hidden; }
  .g-content [style*="grid-template-columns"]:not(.keep-grid) { grid-template-columns: 1fr !important; }
  .g-content [style*="display:grid"] > *, .g-content [style*="display: grid"] > *, .g-content .g-card { min-width: 0; }
  .g-content [style*="min-width:"]:not(input):not(select) { min-width: 0 !important; }
  .g-content [style*="width:"][style*="px"]:not(img):not(canvas):not(svg):not(input):not(.g-switch):not(span) { max-width: 100%; }
  .g-content pre, .g-content code { white-space: pre-wrap; word-break: break-all; }
  .g-content img, .g-content canvas, .g-content video, .g-content iframe { max-width: 100%; }
  /* 표: 카드 안에서 가로 스크롤 */
  .g-content table { display: block; max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .g-table { font-size: 13px; }
  .g-table th, .g-table td { padding: 10px 8px; white-space: nowrap; }

  .g-page-head { flex-wrap: wrap; gap: 10px; }
  .g-page-actions { flex-wrap: wrap; width: 100%; }
  .g-page-actions > * { flex: 1 1 auto; }
  .g-page-title { font-size: 22px; }
  .g-card-head { flex-wrap: wrap; gap: 8px; }
  .g-kpi-grid { grid-template-columns: 1fr 1fr; }

  /* 터치 영역 최소 40px */
  .g-content button, .g-content .g-btn, .g-content select { min-height: 40px; }
  .g-content .g-switch { min-height: 0; position: relative; }
  /* 스위치는 보이는 크기 유지, 터치 영역만 44px 로 확장 */
  .g-switch::before { content: ''; position: absolute; inset: -12px -8px; }   /* 손가락 닿는 범위만 넓힘 — ::after 는 손잡이라 건드리지 않음 */
  .g-dialog { width: calc(100vw - 24px) !important; max-width: none !important; max-height: calc(100vh - 32px); overflow-y: auto; }
  .g-dialog .actions { flex-wrap: wrap; }
}
@media (max-width: 480px) {
  .g-kpi-grid, .g-kpi-grid-8 { grid-template-columns: 1fr 1fr !important; }
  .g-kpi-value { font-size: 22px !important; }
}

/* hide app.css's sitemap fab on admin (we have proper nav) */
.sitemap-fab { display: none !important; }

/* 좁은 화면: flex 안의 입력란이 내용 폭 때문에 넘치지 않고 줄어들 수 있게 */
.g-content input:not([type=checkbox]):not([type=radio]), .g-content select, .g-content textarea { min-width: 0; max-width: 100%; }


/* ============================================================
   공통 화면 틀 — 도구줄 · 구분 필터 · 상태 표시 · 빈 상태 · 선택 막대 · 휴대폰 표
   ============================================================ */
/* 도구줄: 검색 + 구분 필터 + 선택 상자. 표 바로 위에 붙음 */
.g-toolbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-bottom: 12px; }
.g-search { flex: 1 1 240px; min-width: 0; display: flex; align-items: center; gap: 8px; height: 38px; padding: 0 12px;
  background: var(--gg-bg); border: 1px solid var(--gg-border); border-radius: 9px; }
.g-search:focus-within { border-color: var(--gg-primary-ink); box-shadow: 0 0 0 1px var(--gg-primary); }
.g-search .material-symbols-outlined { font-size: 18px; color: var(--gg-text-3); }
.g-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; font: inherit; color: var(--gg-text); }
.g-toolbar .g-select { width: auto; height: 38px; padding: 0 30px 0 12px; }
/* 구분 필터 — 한 번에 하나만 고르는 탭. 개수는 오른쪽 작은 숫자 */
.g-seg { display: inline-flex; padding: 3px; gap: 2px; background: var(--gg-bg-3); border-radius: 10px; max-width: 100%; overflow-x: auto; }
.g-seg button { border: 0; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: var(--gg-text-2);
  padding: 6px 12px; border-radius: 8px; cursor: pointer; white-space: nowrap; display: inline-flex; gap: 6px; align-items: center; }
.g-seg button .n { font-weight: 500; color: var(--gg-text-3); }
.g-seg button.on { background: var(--gg-bg); color: var(--gg-text); box-shadow: var(--gg-shadow-1); }
.g-seg button.on .n { color: var(--gg-primary-ink); }
.g-seg button:focus-visible { outline: 2px solid var(--gg-primary); outline-offset: 1px; }
/* 상태 표시 — 글자 앞 점 하나 (색만으로 구분하지 않도록 글자 포함) */
.g-status { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; white-space: nowrap; }
.g-status::before { content: ''; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.g-status.ok { color: var(--gg-success); } .g-status.warn { color: var(--gg-warning); } .g-status.err { color: var(--gg-error); } .g-status.mute { color: var(--gg-text-3); }
/* 표를 담는 카드 */
.g-table-card { background: var(--gg-bg); border: 1px solid var(--gg-border-2); border-radius: var(--gg-r-lg); overflow: hidden; }
.g-table-card .g-table th:first-child, .g-table-card .g-table td:first-child { padding-left: 20px; }
.g-table-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 16px 10px 20px; border-top: 1px solid var(--gg-border-2); font-size: 13px; color: var(--gg-text-2); }
/* 사람 표시: 머리글자 원 + 이름 + 보조 줄 */
.g-person { display: flex; align-items: center; gap: 10px; min-width: 0; }
.g-person .av { width: 32px; height: 32px; border-radius: 50%; background: var(--gg-primary-soft); color: var(--gg-primary-ink); font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.g-person b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-person small { display: block; color: var(--gg-text-3); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.g-table td.mono { white-space: nowrap; }
.g-code { font-family: var(--gg-font-mono); font-size: 12px; background: var(--gg-bg-3); color: var(--gg-text-2); padding: 1px 6px; border-radius: 4px; white-space: nowrap; display: inline-block; margin: 1px 2px 1px 0; }
/* 빈 상태 — 무엇이 없는지 + 다음에 할 일 */
.g-empty { text-align: center; padding: 48px 20px; color: var(--gg-text-2); }
.g-empty .material-symbols-outlined { font-size: 32px; color: var(--gg-text-3); display: block; margin: 0 auto 10px; }
.g-empty b { display: block; color: var(--gg-text); font-size: 15px; margin-bottom: 4px; }
.g-empty .g-btn { margin-top: 14px; }
/* 여러 개 선택했을 때 나타나는 작업 막대 */
.g-selbar { display: none; align-items: center; gap: 8px; flex-wrap: wrap; padding: 10px 14px; margin-bottom: 12px;
  background: var(--gg-text); color: var(--gg-bg); border-radius: 12px; }
.g-selbar.on { display: flex; }
.g-selbar .count { font-weight: 700; margin-right: auto; }
.g-selbar button { border: 0; font: inherit; font-size: 13px; font-weight: 600; padding: 7px 12px; border-radius: 8px; cursor: pointer;
  background: color-mix(in srgb, var(--gg-bg) 16%, transparent); color: inherit; }
.g-selbar button.danger { background: var(--gg-danger-fill); color: #fff; }
.g-selbar button.ghost { background: transparent; opacity: .8; }

/* 휴대폰: 표(g-table.stack)는 한 줄 카드 목록으로 — 각 칸의 data-label 이 칸 이름으로 보임 */
@media (max-width: 760px) {
  .g-content { padding: 18px 16px 48px; }
  .g-page-title { font-size: 21px; }
  .g-page-actions { width: 100%; }
  .g-page-actions .g-btn-primary { margin-left: auto; }
  .g-table.stack thead { display: none; }
  .g-table.stack, .g-table.stack tbody, .g-table.stack tr, .g-table.stack td { display: block; width: 100%; }
  .g-table.stack tr { padding: 12px 16px; border-bottom: 1px solid var(--gg-border-2); position: relative; display: flex; flex-direction: column; }
  .g-table.stack td.main { order: -1; }   /* 이름(주 정보)을 맨 위로 */
  .g-table.stack tbody tr:last-child { border-bottom: 0; }
  .g-table.stack td { border: 0; padding: 3px 0 !important; display: flex; gap: 12px; align-items: baseline; }
  .g-table.stack td[data-label]::before { content: attr(data-label); flex: 0 0 72px; font-size: 12px; color: var(--gg-text-3); }
  .g-table.stack td.main { padding-bottom: 6px !important; }
  .g-table.stack td.sel { position: absolute; top: 14px; right: 16px; width: auto; }
  .g-table.stack td.acts { padding-top: 8px !important; flex-wrap: wrap; }
  .g-table.stack td:empty { display: none; }
  .g-table.stack td { white-space: normal; min-width: 0; }
  .g-table.stack td[colspan] { display: block; }   /* 빈 상태 안내 칸은 줄바꿈되게 */
  .g-table.stack td > :not(.g-status):not(.g-code) { min-width: 0; }
}

/* 설정 화면 섹션 끝 저장 줄, 표 안 작은 버튼 줄 (여러 화면 공통) */
.sec-foot { display: flex; justify-content: flex-end; align-items: center; gap: 8px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gg-border-2); flex-wrap: wrap; }
.acts-row { display: flex; gap: 6px; justify-content: flex-end; flex-wrap: wrap; }
