:root {
  color-scheme: light dark;
  --green: #03c75a;
}

/* color-scheme을 명시적으로 고정해야, 브라우저의 "강제 다크모드" 추정 렌더링이
   실제 배경색과 무관하게 페이지를 어둡게 뒤집어버리는 걸 막을 수 있다. */
:root[data-theme="light"] { color-scheme: light; }
:root[data-theme="dark"] { color-scheme: dark; }

:root {

  --bg-page: #f5f6f7;
  --bg-card: #ffffff;
  --bg-row-alt: #fafafa;
  --bg-hover: #f0f9f4;

  --text-primary: #222222;
  --text-secondary: #444444;
  --muted: #777777;

  --border: #dddddd;

  --bg-success-soft: #e6f9ee;
  --text-success: #0a8a3b;
  --bg-danger-soft: #fdecea;
  --text-danger: #c0392b;
  --bg-warn-soft: #fff4d6;
  --text-warn: #a66a00;
  --bg-notice: #fff8e1;
  --border-notice: #f5d76e;
  --bg-info-soft: #f5f9ff;
  --border-info: #d6e6fb;
  --text-info: #1a5fb4;
  --bg-tag-blue-soft: #e3edfd;
  --bg-tag-orange-soft: #fde8d6;
  --text-tag-orange: #b5540a;
}

:root[data-theme="dark"] {
  --bg-page: #16181a;
  --bg-card: #202325;
  --bg-row-alt: #262a2d;
  --bg-hover: #1c2e22;

  --text-primary: #e8e8e6;
  --text-secondary: #b7b7b3;
  --muted: #8f8f8b;

  --border: #35383a;

  --bg-success-soft: #163024;
  --text-success: #4fd08a;
  --bg-danger-soft: #35201f;
  --text-danger: #e5766f;
  --bg-warn-soft: #3a2f14;
  --text-warn: #e0b256;
  --bg-notice: #332c14;
  --border-notice: #6b5a1e;
  --bg-info-soft: #182430;
  --border-info: #2c4a70;
  --text-info: #6fa8dc;
  --bg-tag-blue-soft: #1f2c3d;
  --bg-tag-orange-soft: #3a2412;
  --text-tag-orange: #e0975a;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]):not([data-theme="dark"]) {
    --bg-page: #16181a;
    --bg-card: #202325;
    --bg-row-alt: #262a2d;
    --bg-hover: #1c2e22;

    --text-primary: #e8e8e6;
    --text-secondary: #b7b7b3;
    --muted: #8f8f8b;

    --border: #35383a;

    --bg-success-soft: #163024;
    --text-success: #4fd08a;
    --bg-danger-soft: #35201f;
    --text-danger: #e5766f;
    --bg-warn-soft: #3a2f14;
    --text-warn: #e0b256;
    --bg-notice: #332c14;
    --border-notice: #6b5a1e;
    --bg-info-soft: #182430;
    --border-info: #2c4a70;
    --text-info: #6fa8dc;
    --bg-tag-blue-soft: #1f2c3d;
    --bg-tag-orange-soft: #3a2412;
    --text-tag-orange: #e0975a;
  }
}

* { box-sizing: border-box; }

body {
  font-family: -apple-system, "Segoe UI", "Malgun Gothic", sans-serif;
  margin: 0;
  background: var(--bg-page);
  color: var(--text-primary);
}

.shell { display: flex; min-height: 100vh; align-items: flex-start; }

.sidebar {
  width: 200px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border);
  padding: 20px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar-brand { font-size: 15px; font-weight: 600; color: var(--text-primary); padding: 0 10px 18px; }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; }
.side-link {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13px;
  padding: 9px 10px;
  border-radius: 8px;
}
.side-link svg { flex-shrink: 0; }
.side-link:hover { background: var(--bg-row-alt); color: var(--text-primary); }
.side-link.active { background: var(--bg-success-soft); color: var(--text-success); font-weight: 600; }

.sidebar-footer { margin-top: auto; display: flex; flex-direction: column; gap: 4px; padding-top: 12px; border-top: 1px solid var(--border); }
.sidebar-user { font-size: 11px; color: var(--text-secondary); padding: 4px 10px 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.shell-main { flex: 1; min-width: 0; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 14px;
  padding: 14px 24px;
  border-bottom: 1px solid var(--border);
}

.theme-toggle { background: transparent; border: 1px solid var(--border); color: var(--text-primary); }
.theme-toggle:hover { background: var(--bg-row-alt); }

.status-bar { font-size: 13px; color: var(--text-secondary); }
.status-bar .ok { color: var(--green); font-weight: 600; }
.status-bar .warn { color: #f5a623; font-weight: 600; }

main {
  max-width: 1000px;
  margin: 24px auto;
  padding: 0 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.table-scroll table { min-width: 640px; }

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 20px;
}

.card h2 { margin-top: 0; font-size: 16px; color: var(--text-primary); }

form { display: flex; flex-direction: column; gap: 12px; }

label { display: flex; flex-direction: column; gap: 4px; font-size: 13px; color: var(--text-secondary); }

input, textarea, select {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
  background: var(--bg-card);
  color: var(--text-primary);
}

button {
  align-self: flex-start;
  background: var(--green);
  color: white;
  border: none;
  padding: 10px 18px;
  border-radius: 6px;
  font-size: 14px;
  cursor: pointer;
}

button:disabled { opacity: 0.5; cursor: default; }
button.secondary { background: #666; padding: 4px 10px; font-size: 12px; }
button.danger { background: #c0392b; padding: 4px 10px; font-size: 12px; }
.live-actions { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; flex-wrap: wrap; }
.live-actions[hidden] { display: none; }
summary { cursor: pointer; padding: 4px 0; }
summary::marker { font-size: 14px; }
summary h2.inline-heading { display: inline; font-size: 16px; margin: 0; }
.type-explain { font-size: 13px; color: var(--muted); line-height: 1.5; padding-left: 18px; margin: 6px 0 12px; }
.type-explain li { margin-bottom: 4px; }

.toggle-switch { position: relative; display: inline-block; width: 38px; height: 21px; vertical-align: middle; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #999; transition: .15s; border-radius: 21px; cursor: pointer; }
.toggle-slider::before { position: absolute; content: ""; height: 15px; width: 15px; left: 3px; bottom: 3px; background: white; transition: .15s; border-radius: 50%; }
.toggle-switch input:checked + .toggle-slider { background: var(--green); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(17px); }
.toggle-switch input:disabled + .toggle-slider { opacity: .5; cursor: default; }
.inline-bid-edit { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; }
.inline-bid-edit input { width: 70px; padding: 4px 6px; border: 1px solid var(--border); border-radius: 4px; font-size: 12px; }

.inline-status { font-size: 12px; color: var(--muted); }
.confirm-inline {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--text-danger);
  background: var(--bg-danger-soft);
  padding: 4px 8px;
  border-radius: 6px;
  flex-wrap: wrap;
}
.confirm-inline button { padding: 3px 8px; font-size: 11px; }
.confirm-inline[hidden] { display: none; }

.error { color: var(--text-danger); font-size: 13px; }
.notice {
  background: var(--bg-notice);
  border: 1px solid var(--border-notice);
  color: var(--text-primary);
  padding: 10px 12px;
  border-radius: 6px;
  font-size: 13px;
}

table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { border-bottom: 1px solid var(--border); padding: 8px; text-align: left; color: var(--text-primary); }
th { background: var(--bg-row-alt); color: var(--muted); font-weight: 600; }
.th-hint { display: block; font-weight: 400; font-size: 10px; color: var(--muted); white-space: nowrap; }
.th-tip { border-bottom: 1px dotted var(--muted); cursor: help; }
.col-toggle-btn {
  background: none;
  border: 1px solid var(--border);
  color: var(--text-secondary);
  font-size: 12px;
  padding: 0px 6px;
  border-radius: 4px;
  cursor: pointer;
  margin-left: 4px;
  font-weight: 400;
}
.col-toggle-btn:hover { background: var(--bg-row-alt); }

.tag { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.tag.yes { background: var(--bg-success-soft); color: var(--text-success); }
.tag.no { background: var(--bg-danger-soft); color: var(--text-danger); }

.icon-badge { font-size: 13px; }
.icon-badge.muted { color: var(--muted); }

/* 우선순위: 관련성 종합 점수 — 높을수록 초록 */
.priority-badge { display: inline-block; min-width: 28px; text-align: center; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.priority-badge.high { background: var(--bg-success-soft); color: var(--text-success); }
.priority-badge.mid { background: var(--bg-warn-soft); color: var(--text-warn); }
.priority-badge.low { background: var(--bg-danger-soft); color: var(--text-danger); }

/* 입찰등급: 비용 강도 — 우선순위와 다른 색 체계(파랑/보라 계열)로 구분 */
.bidtier-badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 700; }
.bidtier-badge.aggressive { background: var(--bg-tag-orange-soft); color: var(--text-tag-orange); }
.bidtier-badge.moderate { background: var(--bg-tag-blue-soft); color: var(--text-info); }
.bidtier-badge.low { background: var(--bg-row-alt); color: var(--muted); }

#historyList, #issueHistoryList { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 6px; }
#historyList[hidden], #issueHistoryList[hidden] { display: none; }
#historyList li, #issueHistoryList li {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  color: var(--text-primary);
}
#historyList li:hover, #issueHistoryList li:hover { background: var(--bg-hover); }

.filter-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin: 10px 0; }

.filter-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 10px 0; flex-wrap: wrap; }
.filter-row .filter-tabs { margin: 0; }
.page-size-label { display: flex; flex-direction: row; align-items: center; gap: 6px; font-size: 13px; color: var(--text-secondary); white-space: nowrap; }
.page-size-label select { padding: 5px 8px; border: 1px solid var(--border); border-radius: 5px; font-size: 13px; }
.pagination { display: flex; align-items: center; justify-content: center; gap: 10px; font-size: 13px; margin-top: 10px; }
.pagination button:disabled { opacity: 0.4; cursor: default; }
.filter-tab {
  background: var(--bg-row-alt);
  color: var(--text-secondary);
  padding: 5px 12px;
  font-size: 12px;
  border-radius: 14px;
}
.filter-tab.active { background: var(--green); color: white; }

.ad-group-info {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  background: var(--bg-row-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 10px;
  font-size: 13px;
  color: var(--text-primary);
}
.ad-group-info span b { color: var(--text-primary); }
.status-badge { padding: 2px 8px; border-radius: 10px; font-size: 12px; }
.status-badge.eligible { background: var(--bg-success-soft); color: var(--text-success); }
.status-badge.paused { background: var(--bg-danger-soft); color: var(--text-danger); }

.diagnosis-header { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.verdict-badge { padding: 3px 10px; border-radius: 12px; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.verdict-badge.good { background: var(--bg-success-soft); color: var(--text-success); }
.verdict-badge.ok { background: var(--bg-warn-soft); color: var(--text-warn); }
.verdict-badge.bad { background: var(--bg-danger-soft); color: var(--text-danger); }
.verdict-badge.unknown { background: var(--bg-row-alt); color: var(--muted); }
.diagnosis-reason { font-size: 13px; color: var(--text-primary); }
.diagnosis-bid-box {
  margin-top: 10px;
  padding: 8px 12px;
  background: var(--bg-info-soft);
  border: 1px solid var(--border-info);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
}

.glossary {
  background: var(--bg-info-soft);
  border: 1px solid var(--border-info);
  border-radius: 6px;
  padding: 10px 14px;
  margin-bottom: 12px;
  font-size: 13px;
}
.glossary summary { cursor: pointer; font-weight: 600; color: var(--text-info); }
.glossary ul { margin: 10px 0 2px; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.glossary li { line-height: 1.5; color: var(--text-primary); }

.detail-row td { background: var(--bg-row-alt); padding: 16px; }
.manage-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(140px, 1fr));
  gap: 10px 16px;
  margin-bottom: 10px;
}
.manage-grid label { font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 3px; }
.manage-grid .span2 { grid-column: span 2; }
.manage-grid input, .manage-grid select {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}
.checkbox-label { flex-direction: row !important; align-items: center; gap: 6px !important; }

.rank-bid-box, .spend-box, .apply-box {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px dashed var(--border);
}
.rank-bid-box h4, .spend-box h4, .apply-box h4 { margin: 0 0 8px; font-size: 13px; color: var(--text-primary); }
.applied-status { font-size: 13px; margin: 0 0 8px; color: var(--text-secondary); }
.apply-preview {
  margin: 10px 0;
  padding: 10px 12px;
  background: var(--bg-notice);
  border: 1px solid var(--border-notice);
  border-radius: 6px;
  font-size: 13px;
  color: var(--text-primary);
}
.apply-preview ul { margin: 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.confirm-apply { background: #c0392b; margin-left: 8px; }
.apply-result { margin-left: 10px; font-size: 13px; }
.notice-inline { color: var(--muted); font-weight: 400; font-size: 12px; }
.estimate-result { margin-left: 10px; font-size: 13px; }

.spend-form { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.spend-form input[type="date"], .spend-form input[type="number"] {
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 5px;
  font-size: 13px;
}
.spend-log { list-style: none; margin: 0; padding: 0; font-size: 12px; color: var(--text-secondary); display: flex; flex-direction: column; gap: 2px; }

.save-status { margin-left: 8px; color: var(--green); font-size: 12px; }

.section-desc { font-size: 13px; color: var(--muted); margin-top: -6px; }

.sparkline { display: inline-flex; align-items: flex-end; gap: 1px; height: 16px; }
.spark-bar { width: 4px; background: var(--green); border-radius: 1px; display: inline-block; }

.ad-direction-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-success-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
}
.ad-direction-box h4 { margin: 0 0 6px; font-size: 13px; color: var(--text-primary); }
.ad-direction-box p { margin: 0; font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--text-primary); }

#adDirectionLegacy { font-size: 13px; line-height: 1.6; white-space: pre-wrap; color: var(--text-primary); }

.ad-direction-box .ad-summary { font-size: 14px; font-weight: 600; margin: 0 0 10px; color: var(--text-primary); }
.ad-direction-box .ad-sub-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; margin: 12px 0 6px; }
.ad-direction-box .ad-sub-label:first-of-type { margin-top: 0; }

.ad-budget-row { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; font-size: 12px; }
.ad-budget-row .name { width: 110px; flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ad-budget-row .track { flex: 1; height: 8px; background: var(--bg-card); border-radius: 4px; overflow: hidden; }
.ad-budget-row .fill { height: 100%; background: var(--green); }
.ad-budget-row .pct { width: 36px; text-align: right; color: var(--text-primary); font-weight: 600; }

.ad-keyword-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.ad-keyword-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  color: var(--text-primary);
  font-size: 12px;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 12px;
}

.ad-actions-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.ad-actions-list li { font-size: 13px; color: var(--text-primary); display: flex; align-items: baseline; gap: 8px; }
.ad-cat-badge { flex-shrink: 0; font-size: 11px; font-weight: 700; padding: 2px 7px; border-radius: 4px; }
.ad-cat-badge.cat-keyword { background: var(--bg-tag-blue-soft); color: var(--text-info); }
.ad-cat-badge.cat-page { background: var(--bg-tag-orange-soft); color: var(--text-tag-orange); }
.ad-cat-badge.cat-target { background: var(--bg-success-soft); color: var(--text-success); }
.ad-cat-badge.cat-budget { background: var(--bg-warn-soft); color: var(--text-warn); }
.ad-cat-badge.cat-etc { background: var(--bg-row-alt); color: var(--muted); }

.ai-chat-box {
  margin-top: 16px;
  padding: 14px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.ai-chat-box h4 { margin: 0 0 4px; font-size: 13px; color: var(--text-primary); }

.chat-messages {
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-height: 420px;
  overflow-y: auto;
  margin: 12px 0;
  padding: 4px 4px 4px 0;
}
.chat-empty {
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  padding: 24px 12px;
}

.chat-row { display: flex; align-items: flex-end; gap: 8px; }
.chat-row.user { flex-direction: row-reverse; }

.chat-avatar {
  flex-shrink: 0;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: white;
}
.chat-avatar.ai { background: var(--green); }
.chat-avatar.user { background: var(--muted); }

.chat-col { display: flex; flex-direction: column; max-width: 78%; }
.chat-row.user .chat-col { align-items: flex-end; }
.chat-row.ai .chat-col { align-items: flex-start; max-width: 88%; }

.chat-bubble {
  padding: 9px 13px;
  font-size: 13px;
  line-height: 1.55;
  white-space: pre-wrap;
  max-width: 100%;
}
.chat-bubble.user { background: var(--green); color: white; border-radius: 14px 4px 14px 14px; }
.chat-bubble.ai { background: var(--bg-row-alt); color: var(--text-primary); border-radius: 4px 14px 14px 14px; }
.chat-bubble.error { background: var(--bg-danger-soft); color: var(--text-danger); }
.chat-bubble p { margin: 0 0 6px; }
.chat-bubble p:last-child { margin-bottom: 0; }
.chat-bubble ul, .chat-bubble ol { margin: 4px 0; padding-left: 18px; }
.chat-bubble li { margin-bottom: 2px; }

.chat-time { font-size: 10px; color: var(--muted); margin-top: 3px; padding: 0 2px; }

.typing-dots { display: inline-flex; gap: 3px; padding: 2px 0; }
.typing-dots span {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted);
  animation: typing-bounce 1.2s infinite ease-in-out;
}
.typing-dots span:nth-child(2) { animation-delay: 0.15s; }
.typing-dots span:nth-child(3) { animation-delay: 0.3s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.5; }
  30% { transform: translateY(-4px); opacity: 1; }
}

.chat-table { width: 100%; border-collapse: collapse; font-size: 12px; margin: 4px 0; background: var(--bg-card); border-radius: 6px; overflow: hidden; }
.chat-table th, .chat-table td { padding: 6px 8px; border-bottom: 1px solid var(--border); text-align: left; }
.chat-table th { background: var(--bg-page); color: var(--muted); font-weight: 600; }
.chat-table tr:last-child td { border-bottom: none; }

.chat-cell-bar { display: flex; align-items: center; gap: 6px; min-width: 90px; }
.chat-cell-bar .bar-track { flex: 1; height: 6px; background: var(--bg-page); border-radius: 3px; overflow: hidden; min-width: 40px; }
.chat-cell-bar .bar-fill { display: block; height: 100%; background: var(--green); }
.chat-cell-bar .bar-label { font-size: 11px; color: var(--text-primary); white-space: nowrap; }

.chat-input-row { display: flex; gap: 8px; align-items: center; }
.chat-input-row input {
  flex: 1;
  padding: 10px 16px;
  border: 1px solid var(--border);
  border-radius: 20px;
  font-size: 13px;
  background: var(--bg-page);
  color: var(--text-primary);
}
.chat-input-row input:focus { outline: none; border-color: var(--green); }
.chat-send-btn {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  align-self: center;
}

.dash-cards { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.dash-card { background: var(--bg-row-alt); border-radius: 8px; padding: 12px 14px; display: block; text-decoration: none; border: 1px solid transparent; }
a.dash-card:hover { border-color: var(--border); background: var(--bg-hover); }
.dash-lbl { font-size: 12px; color: var(--text-secondary); margin: 0 0 6px; }
.dash-val { font-size: 20px; font-weight: 600; margin: 0; color: var(--text-primary); }

.dash-panel-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 4px; }
.dash-detail-link { font-size: 12px; color: var(--text-info); text-decoration: none; }
.dash-detail-link:hover { text-decoration: underline; }

.dash-grid { display: grid; grid-template-columns: 1.3fr 1fr; gap: 16px; }

.dash-empty { font-size: 13px; color: var(--muted); padding: 20px 0; text-align: center; }

.dash-bars { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; font-size: 12px; }
.dash-bars .name { width: 60px; flex-shrink: 0; color: var(--text-secondary); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-bars .track { flex: 1; height: 8px; background: var(--surface-2, var(--bg-page)); border-radius: 4px; overflow: hidden; }
.dash-bars .fill { height: 100%; background: var(--green); }
.dash-bars .pct { width: 42px; text-align: right; color: var(--text-primary); }

.dash-donut-legend { font-size: 12px; color: var(--text-secondary); }
.dash-donut-legend div { margin-top: 6px; }
.dash-donut-legend i { width: 8px; height: 8px; border-radius: 2px; display: inline-block; margin-right: 4px; }

.dash-weekbars { display: flex; align-items: flex-end; gap: 8px; height: 70px; }
.dash-weekbars .bar { flex: 1; background: var(--text-warn); border-radius: 3px 3px 0 0; min-height: 2px; }
.dash-weekdays { display: flex; gap: 8px; margin-top: 4px; }
.dash-weekdays span { flex: 1; font-size: 11px; color: var(--muted); text-align: center; }

@media (max-width: 640px) {
  .dash-cards { grid-template-columns: repeat(2, 1fr); }
  .dash-grid { grid-template-columns: 1fr; }
}

/* ------------------------------------------------------------------ */
/* 모바일 대응                                                          */
/* ------------------------------------------------------------------ */
@media (max-width: 640px) {
  .shell { flex-direction: column; }
  .sidebar {
    width: 100%;
    height: auto;
    position: static;
    flex-direction: row;
    align-items: center;
    overflow-x: auto;
    padding: 10px 12px;
    border-right: none;
    border-bottom: 1px solid var(--border);
  }
  .sidebar-brand { display: none; }
  .sidebar-nav { flex-direction: row; gap: 4px; }
  .sidebar-footer { margin-top: 0; border-top: 0; padding-top: 0; flex-direction: row; }
  .sidebar-user { display: none; }
  .side-link { white-space: nowrap; padding: 8px 10px; font-size: 12px; }

  .topbar { padding: 10px 14px; }
  .status-bar { font-size: 11px; }

  main { margin: 12px auto; padding: 0 8px; gap: 14px; }
  .card { padding: 14px; }
  .card h2 { font-size: 15px; }

  .manage-grid { grid-template-columns: 1fr; }
  .manage-grid .span2 { grid-column: span 1; }

  .filter-row { flex-direction: column; align-items: flex-start; }
  .live-actions { flex-wrap: wrap; }

  button { padding: 9px 14px; }

  /* 좁은 화면에서는 셀 줄바꿈 대신 가로 스크롤로 보게 한다 */
  .table-scroll th, .table-scroll td { white-space: nowrap; }
}
