/* ════════════════════════════════════════════════════════
   더큰그룹 공통 테마 (theme.css)
   https://service.thebigger.co.kr/shared/theme.css
   모든 사이트에서 이 파일을 링크하여 통일된 UI 유지
   ════════════════════════════════════════════════════════ */

/* ── Theme variables ── */
:root {
  --bg-main: #f0f2f5;
  --bg-surface: #ffffff;
  --bg-sidebar: #ffffff;
  --bg-hover: #f5f6f8;
  --bg-active: #eef1ff;
  --text-primary: #1a1a2e;
  --text-secondary: #6b7280;
  --text-tertiary: #9ca3af;
  --border-color: #e5e7eb;
  --accent: #4f6ef7;
  --accent-hover: #3b5de7;
  --accent-light: #eef1ff;
  --success: #22c55e;
  --warning: #f59e0b;
  --danger: #ef4444;
  --purple: #8b5cf6;
  --cyan: #06b6d4;
  --radius: 14px;
  --radius-sm: 8px;
  --radius-xs: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 24px rgba(0,0,0,0.08);
  --font-mono: 'SF Mono', Menlo, monospace;
  --font-scale: 1;
  --sidebar-width: 240px;
}

/* ── Apple HIG Dark Mode ── */
[data-theme="dark"] {
  --bg-main: #000000;
  --bg-surface: #1c1c1e;
  --bg-sidebar: #1c1c1e;
  --bg-hover: #2c2c2e;
  --bg-active: #1a2a3a;
  --text-primary: #ffffff;
  --text-secondary: #ebebf5cc;
  --text-tertiary: #ebebf54d;
  --border-color: rgba(60,60,67,0.3);
  --accent: #0a84ff;
  --accent-hover: #409cff;
  --accent-light: #1a2a3a;
  --success: #30d158;
  --warning: #ff9f0a;
  --danger: #ff453a;
  --purple: #bf5af2;
  --cyan: #64d2ff;
  --shadow-sm: none;
  --shadow-md: none;
  --shadow-lg: none;
}

[data-theme="dark"] .stat-card,
[data-theme="dark"] .card { background: #1c1c1e; border-color: rgba(60,60,67,0.3); }
[data-theme="dark"] .issue-row { background: #2c2c2e !important; }
[data-theme="dark"] .transit-block,
[data-theme="dark"] .day-card,
[data-theme="dark"] .person-card { background: #2c2c2e; }
[data-theme="dark"] .stat-icon { background: #2c2c2e !important; }

[data-theme="dark"] .tag-warn { background: #3a2e00; color: #ff9f0a; }
[data-theme="dark"] .tag-err { background: #3a1515; color: #ff453a; }
[data-theme="dark"] .tag-blue { background: #0a1e3a; color: #0a84ff; }
[data-theme="dark"] .tag-orange { background: #3a1e05; color: #ff9f0a; }
[data-theme="dark"] .badge-green { background: #0a2a15; color: #30d158; }
[data-theme="dark"] .badge-purple { background: #200a38; color: #bf5af2; }
[data-theme="dark"] .badge-red { background: #3a1515; color: #ff453a; }
[data-theme="dark"] .badge-yellow { background: #3a2e00; color: #ff9f0a; }
[data-theme="dark"] .badge-indigo { background: #0a0f3a; color: #5e5ce6; }
[data-theme="dark"] .badge-cyan { background: #042a30; color: #64d2ff; }
[data-theme="dark"] .badge-gray { background: #2c2c2e; color: #8e8e93; }
[data-theme="dark"] .chip-in { background: #0a1e3a; color: #0a84ff; }
[data-theme="dark"] .chip-out { background: #3a1e05; color: #ff9f0a; }

/* ── 계약서 배지 다크모드 ── */
[data-theme="dark"] .badge-draft   { background: #2c2c2e; color: #8e8e93; }
[data-theme="dark"] .badge-pending { background: #3a2e00; color: #ff9f0a; }
[data-theme="dark"] .badge-signed  { background: #0a2a15; color: #30d158; }
[data-theme="dark"] .badge-expired { background: #3a1515; color: #ff453a; }
[data-theme="dark"] .badge-locked  { background: #0a1e3a; color: #0a84ff; }

/* ── 인라인 스타일 다크모드 오버라이드 (전체 서비스 공통) ── */
[data-theme="dark"] [style*="background: #F5F5F7"],
[data-theme="dark"] [style*="background: #f5f5f7"],
[data-theme="dark"] [style*="background:#F5F5F7"] { background: var(--bg-hover) !important; }

[data-theme="dark"] [style*="background: #fff"],
[data-theme="dark"] [style*="background: #FFF"],
[data-theme="dark"] [style*="background:#fff"],
[data-theme="dark"] [style*="background: white"] { background: var(--bg-surface) !important; }

[data-theme="dark"] [style*="background: #F2F2F7"],
[data-theme="dark"] [style*="background: #f2f2f7"],
[data-theme="dark"] [style*="background:#F2F2F7"] { background: #2c2c2e !important; }

[data-theme="dark"] [style*="background: #FFF9F0"],
[data-theme="dark"] [style*="background:#FFF9F0"] { background: #2a2418 !important; }

[data-theme="dark"] [style*="background: #E8F8ED"] { background: #0a2a15 !important; }
[data-theme="dark"] [style*="background: #FFF0EE"] { background: #3a1515 !important; }
[data-theme="dark"] [style*="background: #EAF2FF"] { background: #0a1e3a !important; }
[data-theme="dark"] [style*="background: #FFF4E0"] { background: #3a2e00 !important; }

[data-theme="dark"] [style*="background: rgba(255,255,255"],
[data-theme="dark"] [style*="background: rgba(255, 255, 255"] { background: rgba(28,28,30,0.85) !important; }

[data-theme="dark"] [style*="color: #1D1D1F"],
[data-theme="dark"] [style*="color: #1d1d1f"],
[data-theme="dark"] [style*="color:#1D1D1F"] { color: var(--text-primary) !important; }

[data-theme="dark"] [style*="color: #3A3A3C"],
[data-theme="dark"] [style*="color: #3a3a3c"],
[data-theme="dark"] [style*="color:#3A3A3C"] { color: var(--text-secondary) !important; }

[data-theme="dark"] [style*="color: #6E6E73"],
[data-theme="dark"] [style*="color: #6e6e73"] { color: var(--text-secondary) !important; }

[data-theme="dark"] [style*="color: #8E8E93"],
[data-theme="dark"] [style*="color: #8e8e93"] { color: var(--text-tertiary) !important; }

[data-theme="dark"] [style*="color: #AEAEB2"],
[data-theme="dark"] [style*="color: #aeaeb2"] { color: rgba(235,235,245,0.18) !important; }

[data-theme="dark"] [style*="color: #A05A00"],
[data-theme="dark"] [style*="color: #a05a00"],
[data-theme="dark"] [style*="color: #7D4000"],
[data-theme="dark"] [style*="color: #CC7A00"],
[data-theme="dark"] [style*="color: #cc7a00"] { color: #ffb340 !important; }

[data-theme="dark"] [style*="color: #856404"] { color: #ffb340 !important; }
[data-theme="dark"] [style*="color: #155724"] { color: #30d158 !important; }
[data-theme="dark"] [style*="color: #1A7F3C"] { color: #30d158 !important; }

[data-theme="dark"] [style*="border: 1px solid #D2D2D7"],
[data-theme="dark"] [style*="border: 1px solid #d2d2d7"],
[data-theme="dark"] [style*="border: 1px solid #C7C7CC"],
[data-theme="dark"] [style*="border: 1.5px solid #D2D2D7"],
[data-theme="dark"] [style*="border: 1.5px solid #C7C7CC"],
[data-theme="dark"] [style*="border: 1px solid #e8e8e8"] { border-color: var(--border-color) !important; }

[data-theme="dark"] [style*="border: 2px solid #1D1D1F"] { border-color: var(--text-primary) !important; }
[data-theme="dark"] [style*="border: 1px solid #FFBBB8"] { border-color: #8B3A35 !important; }
[data-theme="dark"] [style*="border: 1.5px solid #3A3A3C"],
[data-theme="dark"] [style*="borderBottom: 1.5px solid #3A3A3C"] { border-color: #636366 !important; }

[data-theme="dark"] [style*="border-bottom: 1px solid #D2D2D7"],
[data-theme="dark"] [style*="border-bottom: 1px solid #e5e7eb"] { border-bottom-color: var(--border-color) !important; }

[data-theme="dark"] canvas { background: var(--bg-surface) !important; }

[data-theme="dark"] select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23A1A1A6' d='M6 8L1 3h10z'/%3E%3C/svg%3E") !important;
}

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

body {
  font-family: 'Pretendard Variable', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  background: var(--bg-main);
  color: var(--text-primary);
  font-size: calc(14px * var(--font-scale));
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background 0.3s, color 0.3s;
  margin: 0;
}

a { color: inherit; text-decoration: none; }

/* ── Form Elements ── */
input, select, textarea, button {
  font-family: inherit;
  font-size: 14px;
}

input, select, textarea {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--border-color);
  border-radius: 10px;
  background: var(--bg-surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
  -webkit-appearance: none;
}

input::placeholder, textarea::placeholder {
  color: var(--text-secondary);
}

input:focus, select:focus, textarea:focus {
  border-color: #0071E3;
  box-shadow: 0 0 0 3px rgba(0, 113, 227, 0.12);
}

textarea {
  resize: vertical;
  min-height: 72px;
  line-height: 1.6;
}

select {
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%233A3A3C' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
}

/* ── Buttons ── */
button {
  cursor: pointer;
  border: 1px solid var(--border-color);
  border-radius: 980px;
  padding: 8px 18px;
  background: var(--bg-surface);
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 500;
  transition: background 0.2s ease, opacity 0.2s ease, transform 0.1s ease;
  white-space: nowrap;
}

button:hover { background: var(--bg-hover); }
button:active { transform: scale(0.97); }

.btn-primary {
  background: #0071E3 !important;
  color: #fff !important;
  border-color: transparent !important;
  font-weight: 600 !important;
}
.btn-primary:hover { background: #0077ED !important; opacity: 1; }
.btn-primary:active { background: #006AD6 !important; }
.btn-primary:disabled { opacity: 0.4; cursor: not-allowed; transform: none; }

.btn-danger {
  background: #FF3B30 !important;
  color: #fff !important;
  border-color: transparent !important;
}
.btn-danger:hover { background: #FF453A !important; opacity: 1; }

/* ── Section Label ── */
.sec-label {
  font-size: 11px;
  color: var(--text-secondary);
  letter-spacing: 0.04em;
  font-weight: 500;
  text-transform: uppercase;
  margin: 20px 0 6px;
}

/* ── Grid Helpers ── */
.row1 { margin-bottom: 10px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.row3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; margin-bottom: 10px; }

/* ── Spinner ── */
@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}
.spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}

/* ── Sidebar ── */
.sidebar {
  position: fixed; top: 0; left: 0; bottom: 0;
  width: var(--sidebar-width);
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-color);
  display: flex; flex-direction: column;
  padding: 20px 14px;
  overflow-y: auto;
  z-index: 100;
  transition: transform 0.3s, background 0.3s;
}

.sidebar-profile {
  display: flex; align-items: center; gap: 12px;
  padding: 8px 10px; margin-bottom: 24px;
}
.sidebar-avatar {
  width: 38px; height: 38px; border-radius: 10px;
  background: var(--accent); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 15px; flex-shrink: 0;
}
.sidebar-user-name { font-weight: 700; font-size: 14px; }
.sidebar-user-role { font-size: 11px; color: var(--text-tertiary); margin-top: 1px; }

.sidebar-nav { flex: 1; }
.sidebar-nav-label {
  font-size: 10px; font-weight: 700; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--text-tertiary);
  padding: 0 10px; margin-bottom: 6px;
}
.sidebar-nav-item {
  display: flex; align-items: center; justify-content: space-between;
  padding: 9px 12px; border-radius: var(--radius-sm);
  font-size: calc(13px * var(--font-scale)); font-weight: 500;
  color: var(--text-secondary); cursor: pointer;
  transition: all 0.15s; margin-bottom: 1px;
  text-decoration: none; background: transparent;
}
.sidebar-nav-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-nav-item.active-site { background: var(--accent-light); color: var(--accent); font-weight: 600; }
.sidebar-chevron { font-size: 16px; transition: transform 0.2s; color: var(--text-tertiary); }
.sidebar-chevron.open { transform: rotate(90deg); }
/* ── Sub-nav: Style B (dotted line + circular nodes) ── */
.sidebar-sub-nav { padding: 2px 0 6px 0; margin-left: 20px; }
.sidebar-sub-item {
  display: block; width: 100%; text-align: left;
  padding: 7px 12px 7px 18px; border: none; background: transparent;
  text-decoration: none;
  font-size: calc(13px * var(--font-scale)); font-weight: 400;
  color: var(--text-secondary); cursor: pointer;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  transition: all 0.15s;
  font-family: inherit;
  position: relative;
  border-left: 1px dashed var(--border-color);
}
/* Circular node dot */
.sidebar-sub-item::before {
  content: '';
  position: absolute;
  left: -3.5px;
  top: 50%;
  transform: translateY(-50%);
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--border-color);
  transition: background 0.15s, box-shadow 0.15s;
  z-index: 1;
}
/* Last item: cut vertical line at center */
.sidebar-sub-item:last-child {
  border-color: transparent;
}
.sidebar-sub-item:last-child::after {
  content: '';
  position: absolute;
  left: -1px;
  top: 0;
  height: 50%;
  border-left: 1px dashed var(--border-color);
}
.sidebar-sub-item:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-sub-item:hover::before { background: var(--text-secondary); }
.sidebar-sub-item.active {
  color: var(--accent); font-weight: 600; background: var(--accent-light);
}
.sidebar-sub-item.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
/* ── Sub-nav 3rd level: group label + nested items ── */
.sidebar-group { margin: 2px 0; }
.sidebar-group-label {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; text-align: left;
  padding: 7px 12px 7px 18px; border: none; background: transparent;
  font-size: calc(12px * var(--font-scale)); font-weight: 600;
  color: var(--text-secondary); cursor: pointer;
  border-radius: var(--radius-xs);
  transition: all 0.15s; font-family: inherit;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.sidebar-group-label:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-group-label.has-active { color: var(--accent); }
.sidebar-sub-nav-3rd { padding: 1px 0 4px 0; margin-left: 14px; }
.sidebar-sub-item-3rd {
  display: block; width: 100%; text-align: left;
  padding: 6px 12px 6px 16px; border: none; background: transparent;
  font-size: calc(12.5px * var(--font-scale)); font-weight: 400;
  color: var(--text-secondary); cursor: pointer;
  border-radius: 0 var(--radius-xs) var(--radius-xs) 0;
  transition: all 0.15s; font-family: inherit;
  position: relative;
  border-left: 1px dashed var(--border-color);
}
.sidebar-sub-item-3rd::before {
  content: '';
  position: absolute; left: -3px; top: 50%; transform: translateY(-50%);
  width: 5px; height: 5px; border-radius: 50%;
  background: var(--border-color);
  transition: background 0.15s, box-shadow 0.15s; z-index: 1;
}
.sidebar-sub-item-3rd:last-child { border-color: transparent; }
.sidebar-sub-item-3rd:last-child::after {
  content: ''; position: absolute; left: -1px; top: 0;
  height: 50%; border-left: 1px dashed var(--border-color);
}
.sidebar-sub-item-3rd:hover { background: var(--bg-hover); color: var(--text-primary); }
.sidebar-sub-item-3rd:hover::before { background: var(--text-secondary); }
.sidebar-sub-item-3rd.active {
  color: var(--accent); font-weight: 600; background: var(--accent-light);
}
.sidebar-sub-item-3rd.active::before {
  background: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* ── Settings ── */
.sidebar-settings { border-top: 1px solid var(--border-color); padding-top: 8px; margin-top: 8px; }
.sidebar-settings-panel { padding: 8px 10px; }
.setting-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px; font-size: 12px; color: var(--text-secondary);
}
.setting-row:last-child { margin-bottom: 0; }
/* Toggle switch (공통 — 사이드바 설정 + 다크모드 토글) */
.setting-toggle,
.sidebar-theme-toggle,
.topnav-theme-toggle {
  position: relative; width: 36px; height: 20px;
  background: var(--border-color); border-radius: 10px;
  border: none; cursor: pointer; transition: background 0.2s;
  flex-shrink: 0; padding: 0;
}
.setting-toggle::after,
.sidebar-theme-toggle::after,
.topnav-theme-toggle::after {
  content: ''; position: absolute; top: 2px; left: 2px;
  width: 16px; height: 16px; background: white;
  border-radius: 50%; transition: transform 0.2s;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
.setting-toggle.on,
.sidebar-theme-toggle.on,
.topnav-theme-toggle.on { background: var(--accent); }
.setting-toggle.on::after,
.sidebar-theme-toggle.on::after,
.topnav-theme-toggle.on::after { transform: translateX(16px); }
.setting-font-btns { display: flex; gap: 3px; }
.setting-font-btns button {
  padding: 3px 8px; border: 1px solid var(--border-color);
  border-radius: 4px; background: var(--bg-surface);
  font-size: 11px; cursor: pointer; color: var(--text-secondary);
  font-family: inherit; transition: all 0.15s;
}
.setting-font-btns button:hover,
.setting-font-btns button.active { border-color: var(--accent); color: var(--accent); }
.setting-color-picker {
  width: 32px; height: 24px; border: 1px solid var(--border-color);
  border-radius: 4px; cursor: pointer; padding: 0; background: none;
}
.setting-color-picker::-webkit-color-swatch-wrapper { padding: 2px; }
.setting-color-picker::-webkit-color-swatch { border-radius: 2px; border: none; }

.sidebar-footer { padding-top: 8px; border-top: 1px solid var(--border-color); margin-top: 8px; }
.sidebar-logout {
  width: 100%; padding: 8px; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); background: transparent;
  font-size: 12px; color: var(--text-secondary); cursor: pointer;
  font-family: inherit; transition: all 0.15s;
}
.sidebar-logout:hover { border-color: var(--danger); color: var(--danger); }

/* ── Mobile ── */
.sidebar-mobile-toggle {
  display: none; position: fixed; top: 14px; left: 14px; z-index: 200;
  width: 36px; height: 36px; border-radius: var(--radius-sm);
  background: var(--bg-surface); border: 1px solid var(--border-color);
  box-shadow: var(--shadow-md); font-size: 18px; cursor: pointer;
  align-items: center; justify-content: center; color: var(--text-primary);
}
.sidebar-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.3); z-index: 99;
}

/* ── Main content ── */
.main-content {
  margin-left: var(--sidebar-width);
  padding: 28px 32px;
  min-height: 100vh;
  max-width: calc(1100px + var(--sidebar-width));
}
.main-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.main-title {
  font-size: calc(22px * var(--font-scale));
  font-weight: 800; letter-spacing: -0.03em;
}
.main-header-right { display: flex; align-items: center; gap: 10px; }
.main-meta { font-size: 12px; color: var(--text-tertiary); }

/* ── Common components ── */
.refresh-btn {
  padding: 8px 16px; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); background: var(--bg-surface);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-primary); transition: all 0.15s; font-family: inherit;
}
.refresh-btn:hover { border-color: var(--accent); color: var(--accent); }

.card {
  background: var(--bg-surface); border-radius: var(--radius);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-sm); padding: 20px 24px;
  margin-bottom: 16px; transition: background 0.3s;
}

/* ── Table base ── */
table { width: 100%; border-collapse: collapse; }
th {
  text-align: left; padding: 10px 12px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  border-bottom: 1px solid var(--border-color); background: var(--bg-hover);
  white-space: nowrap;
}
td {
  padding: 10px 12px; border-bottom: 1px solid var(--border-color);
  color: var(--text-primary); vertical-align: middle;
}
tr:hover td { background: var(--bg-hover); }
.card-title {
  font-size: calc(15px * var(--font-scale)); font-weight: 700;
  margin-bottom: 16px; display: flex; align-items: center; gap: 8px;
}
.card-count { font-size: 12px; font-weight: 500; color: var(--text-secondary); }

.stat-card {
  background: var(--bg-surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, background 0.3s; cursor: default;
}
.stat-card:hover { box-shadow: var(--shadow-md); }
.stat-card-clickable { cursor: pointer; }
.stat-icon {
  width: 40px; height: 40px; border-radius: 10px;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; margin-bottom: 14px;
}
.stat-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.stat-value { font-size: calc(24px * var(--font-scale)); font-weight: 800; letter-spacing: -0.02em; }
.stat-value-unit { font-size: 14px; font-weight: 400; color: var(--text-secondary); }
.stat-sub { font-size: 11px; color: var(--text-secondary); margin-top: 4px; }
.stats-grid {
  display: grid; grid-template-columns: repeat(4, 1fr);
  gap: 14px; margin-bottom: 24px;
}

/* Tags & Badges */
.issue-tag {
  font-size: 11px; font-weight: 700; padding: 3px 10px;
  border-radius: var(--radius-xs); min-width: 72px;
  text-align: center; flex-shrink: 0;
}
.tag-warn { background: #fef3c7; color: #a16207; }
.tag-err { background: #fee2e2; color: #dc2626; }
.tag-blue { background: #dbeafe; color: #1d4ed8; }
.tag-orange { background: #ffedd5; color: #c2410c; }

.mini-badge { padding: 2px 7px; border-radius: 4px; font-size: 10px; font-weight: 700; }
.badge-green { background: #d1fae5; color: #059669; }
.badge-purple { background: #ede9fe; color: #7c3aed; }
.badge-red { background: #fee2e2; color: #dc2626; }
.badge-indigo { background: #e0e7ff; color: #4338ca; }
.badge-cyan { background: #cffafe; color: #0e7490; }
.badge-gray { background: #f3f4f6; color: #6b7280; }
.badge-yellow { background: #fef3c7; color: #a16207; }

/* Chips */
.flow { display: flex; align-items: center; gap: 5px; flex-wrap: wrap; }
.flow-chip { padding: 4px 10px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; }
.chip-in { background: #dbeafe; color: #1d4ed8; }
.chip-out { background: #ffedd5; color: #c2410c; }
.flow-arrow { color: var(--text-tertiary); font-size: 12px; }

/* Issue rows */
.issue-row {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px; border-radius: var(--radius-sm);
  margin-bottom: 6px; font-size: calc(13px * var(--font-scale));
  transition: opacity 0.1s;
}
.issue-row:last-child { margin-bottom: 0; }
.issue-row:hover { opacity: 0.85; }
.issue-name { font-weight: 700; min-width: 48px; }
.issue-branch { color: var(--text-secondary); font-size: 12px; flex: 1; }
.issue-time {
  font-family: var(--font-mono); font-size: 12px;
  color: var(--text-secondary); margin-left: auto; white-space: nowrap;
}
.issue-notif { color: var(--purple); margin-left: 6px; }

/* Transit */
.transit-block {
  padding: 14px 16px; border-radius: var(--radius-sm);
  margin-bottom: 8px; background: var(--bg-main); transition: background 0.3s;
}
.transit-name { font-weight: 700; font-size: 14px; color: var(--cyan); margin-bottom: 8px; }

/* Day card */
.day-card {
  background: var(--bg-main); border-radius: var(--radius-sm);
  padding: 14px 16px; margin-bottom: 8px; transition: background 0.3s;
}
.day-head { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 8px; }
.day-date { font-weight: 700; font-size: 14px; }
.day-weekday { font-weight: 400; color: var(--text-secondary); }
.day-hours { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); }

/* Date row */
.date-row { display: flex; gap: 6px; margin-bottom: 24px; align-items: center; flex-wrap: wrap; }
.date-btn {
  padding: 7px 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-color); background: var(--bg-surface);
  font-size: 13px; font-weight: 500; cursor: pointer;
  color: var(--text-secondary); transition: all 0.15s; font-family: inherit;
}
.date-btn:hover { border-color: var(--accent); color: var(--accent); }
.date-btn.active { background: var(--accent); color: white; border-color: var(--accent); }
.date-input {
  padding: 7px 12px; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--bg-surface); color: var(--text-primary); font-family: inherit;
}

/* Search */
.search-row { display: flex; gap: 12px; align-items: flex-end; flex-wrap: wrap; margin-bottom: 16px; }
.search-field label { display: block; font-size: 11px; color: var(--text-secondary); margin-bottom: 4px; font-weight: 500; }
.search-field input {
  padding: 8px 14px; border: 1px solid var(--border-color);
  border-radius: var(--radius-sm); font-size: 13px;
  background: var(--bg-surface); color: var(--text-primary);
  transition: border 0.15s; font-family: inherit;
}
.search-field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(79,110,247,0.1); }
.search-btn {
  padding: 8px 22px; background: var(--accent); color: white;
  border: none; border-radius: var(--radius-sm);
  font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.15s; font-family: inherit;
}
.search-btn:hover { opacity: 0.9; }
.search-btn:disabled { opacity: 0.5; cursor: not-allowed; }

/* Table */
.data-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.data-table th { text-align: left; padding: 8px 12px; font-weight: 600; color: var(--text-secondary); border-bottom: 1px solid var(--border-color); font-size: 12px; }
.data-table td { padding: 10px 12px; border-bottom: 1px solid var(--bg-main); }
.data-table tr:hover td { background: var(--bg-hover); }
.data-table .clickable { cursor: pointer; }

/* Person card */
.person-card { background: var(--bg-main); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 8px; transition: background 0.3s; }
.person-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.person-name { font-weight: 700; }
.person-hours { font-family: var(--font-mono); font-size: 13px; color: var(--text-secondary); }

/* Branch grid */
.branch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px; margin-bottom: 16px; }
.branch-card { padding: 12px 14px; border-radius: var(--radius-sm); background: var(--bg-main); cursor: pointer; transition: all 0.15s; text-align: left; border: none; font-family: inherit; color: var(--text-primary); }
.branch-card:hover { background: var(--bg-hover); }
.branch-card.active { background: var(--accent); color: white; }
.branch-name { font-weight: 600; font-size: 13px; margin-bottom: 2px; }
.branch-sub { font-size: 11px; opacity: 0.7; }

/* Feed */
.feed-item { display: flex; align-items: center; gap: 12px; padding: 8px 4px; border-bottom: 1px solid var(--bg-main); font-size: 13px; }
.feed-time { font-family: var(--font-mono); font-size: 12px; color: var(--text-secondary); width: 48px; flex-shrink: 0; }
.feed-type { display: inline-block; padding: 2px 8px; border-radius: var(--radius-xs); font-size: 11px; font-weight: 600; width: 44px; text-align: center; flex-shrink: 0; }
.feed-name { font-weight: 600; min-width: 48px; flex-shrink: 0; }
.feed-branch { color: var(--text-secondary); font-size: 12px; flex: 1; }

/* Failure */
.failure-item { border-radius: var(--radius-sm); padding: 12px 14px; margin-bottom: 8px; font-size: 13px; border: 1px solid var(--border-color); }

/* Misc */
.info-box { padding: 12px 14px; background: var(--bg-main); border-radius: var(--radius-sm); font-size: 12px; color: var(--text-secondary); margin-top: 16px; }
.alert-border { border-color: #fed7aa !important; }
.empty-state { text-align: center; padding: 40px 0; font-size: 13px; color: var(--text-secondary); }

/* ── Responsive ── */
@media (max-width: 1024px) {
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .main-content { padding: 24px 20px; }
}
@media (max-width: 768px) {
  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .sidebar-mobile-toggle { display: flex; }
  .main-content { margin-left: 0; padding: 60px 16px 16px; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .main-title { font-size: calc(18px * var(--font-scale)); }
  .issue-row { flex-wrap: wrap; }
  .issue-time { margin-left: 0; width: 100%; margin-top: 4px; }
  .search-row { flex-direction: column; align-items: stretch; }
  .search-field input { width: 100%; }
  .branch-grid { grid-template-columns: 1fr 1fr; }
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 6px; }
}
@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .stat-card { padding: 14px; }
  .stat-value { font-size: calc(20px * var(--font-scale)); }
  .branch-grid { grid-template-columns: 1fr; }
  .main-header { flex-direction: column; align-items: flex-start; gap: 8px; }
}
