/* ==========================================================================
   GovScout · Modern dashboard theme
   ========================================================================== */

:root {
  /* Surface — clean off-white body, white cards */
  --bg: #f4f6fa;
  --bg-grad: radial-gradient(1200px 520px at 50% -10%, #e8edf6 0%, transparent 60%),
             #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f1f4f9;
  --surface-3: #e6eaf2;
  --surface-tint: rgba(255, 255, 255, 0.86);

  /* Text */
  --text: #0d1728;
  --text-soft: #34405a;
  --text-muted: #6a7488;
  --text-faint: #9aa3b6;
  --text-inverse: #ffffff;

  /* Line — visible but subtle */
  --border: #d3d8e1;
  --border-strong: #b9bfcd;
  --border-subtle: #e3e7ee;

  /* Header — deep navy */
  --header-bg: #0a1c3e;
  --header-bg-grad: linear-gradient(135deg, #0a1c3e 0%, #0d2350 100%);
  --header-text: #ffffff;
  --header-muted: rgba(255, 255, 255, 0.66);
  --header-border: rgba(255, 255, 255, 0.14);
  --header-chip-bg: rgba(255, 255, 255, 0.08);
  --header-chip-hover: rgba(255, 255, 255, 0.16);

  /* Brand — navy/blue to coordinate with header */
  --accent: #2563eb;
  --accent-2: #3b82f6;
  --accent-hover: #1d4ed8;
  --accent-soft: rgba(37, 99, 235, 0.09);
  --accent-softer: rgba(37, 99, 235, 0.05);
  --accent-ring: rgba(37, 99, 235, 0.24);
  --gradient-brand: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #3b82f6 100%);

  /* Semantic */
  --green: #0f9867;
  --green-soft: #e4f5ed;
  --blue: #2873d6;
  --blue-soft: #e3eefc;
  --gold: #b47a00;
  --gold-soft: #fbefd4;
  --red: #d64b40;
  --red-soft: #fbe3df;
  --teal: #0f95a0;
  --teal-soft: #def1f3;
  --slate-soft: #eef1f6;

  /* Elevation */
  --shadow-xs: 0 1px 2px rgba(13, 23, 40, 0.04);
  --shadow-sm: 0 1px 2px rgba(13, 23, 40, 0.04), 0 2px 6px rgba(13, 23, 40, 0.04);
  --shadow-md: 0 2px 4px rgba(13, 23, 40, 0.04), 0 10px 30px rgba(13, 23, 40, 0.06);
  --shadow-lg: 0 4px 8px rgba(13, 23, 40, 0.05), 0 24px 56px rgba(13, 23, 40, 0.08);
  --shadow-brand: 0 6px 20px rgba(37, 99, 235, 0.28);

  /* Radius */
  --r-xs: 6px;
  --r-sm: 8px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 18px;
  --r-pill: 999px;

  /* Motion */
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  --t-fast: 120ms var(--ease);
  --t-med: 200ms var(--ease);

  --focus: 0 0 0 3px var(--accent-ring);
}

[data-theme="dark"] {
    --bg: #0b0d14;
    --bg-grad: radial-gradient(1200px 600px at 10% -10%, rgba(91, 91, 247, 0.18) 0%, transparent 55%),
               radial-gradient(900px 500px at 110% 0%, rgba(14, 124, 135, 0.14) 0%, transparent 50%),
               #0b0d14;
    --surface: #121521;
    --surface-2: #171b2a;
    --surface-3: #1c2132;
    --surface-tint: rgba(18, 21, 33, 0.72);

    --text: #ecf0ff;
    --text-soft: #cdd3e6;
    --text-muted: #9aa3bd;
    --text-faint: #6b7493;
    --text-inverse: #0b1020;

    --border: #222840;
    --border-strong: #2b3250;
    --border-subtle: #1a1f33;

    --accent: #60a5fa;
    --accent-2: #3b82f6;
    --accent-hover: #7fb3fa;
    --accent-soft: rgba(96, 165, 250, 0.14);
    --accent-softer: rgba(96, 165, 250, 0.08);
    --accent-ring: rgba(96, 165, 250, 0.32);
    --gradient-brand: linear-gradient(135deg, #2563eb 0%, #3b82f6 55%, #60a5fa 100%);

    --green-soft: rgba(11, 138, 90, 0.22);
    --blue-soft: rgba(14, 111, 209, 0.22);
    --gold-soft: rgba(160, 106, 0, 0.25);
    --red-soft: rgba(192, 54, 44, 0.22);
    --teal-soft: rgba(14, 124, 135, 0.22);
    --slate-soft: rgba(148, 160, 190, 0.16);

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3), 0 2px 6px rgba(0, 0, 0, 0.25);
    --shadow-md: 0 2px 4px rgba(0, 0, 0, 0.25), 0 12px 32px rgba(0, 0, 0, 0.35);
    --shadow-lg: 0 4px 8px rgba(0, 0, 0, 0.3), 0 28px 56px rgba(0, 0, 0, 0.45);
    --shadow-brand: 0 6px 22px rgba(96, 165, 250, 0.35);

    --header-bg: #0a0f1f;
    --header-bg-grad: linear-gradient(135deg, #0a0f1f 0%, #121935 100%);
    --header-text: #ecf0ff;
    --header-muted: rgba(236, 240, 255, 0.62);
    --header-border: rgba(255, 255, 255, 0.08);
    --header-chip-bg: rgba(255, 255, 255, 0.05);
    --header-chip-hover: rgba(255, 255, 255, 0.1);
}

/* --------------------------------------------------------------------------
   Base
   -------------------------------------------------------------------------- */

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  background: var(--bg-grad);
  background-attachment: fixed;
  color: var(--text);
  transition: background-color var(--t-med), color var(--t-med);
  font-family:
    "Inter", "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "SF Pro Text", "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", sans-serif;
  font-feature-settings: "cv11", "ss01", "ss02";
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  letter-spacing: -0.005em;
}

button,
input,
select,
textarea {
  font: inherit;
  color: inherit;
}

::selection {
  background: var(--accent-soft);
  color: var(--text);
}

h1, h2, h3, p {
  margin-top: 0;
}

a {
  color: var(--accent);
  text-decoration: none;
  transition: color var(--t-fast);
}

a:hover {
  color: var(--accent-hover);
}

/* --------------------------------------------------------------------------
   Header
   -------------------------------------------------------------------------- */

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 18px 28px;
  background: var(--header-bg-grad);
  color: var(--header-text);
  border-bottom: 1px solid var(--header-border);
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.04), 0 10px 24px rgba(10, 28, 62, 0.12);
}

.app-header > div:first-child {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.app-header .eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin: 0;
  color: var(--header-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.app-header .eyebrow::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: var(--r-pill);
  background: var(--gradient-brand);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.35);
}

.app-header h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.15;
  color: var(--header-text);
  background: none;
  -webkit-background-clip: border-box;
  background-clip: border-box;
  -webkit-text-fill-color: var(--header-text);
}

.header-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--header-muted);
  font-size: 13px;
}

#lastUpdated {
  padding: 6px 10px;
  border-radius: var(--r-pill);
  background: var(--header-chip-bg);
  color: var(--header-muted);
  font-size: 12px;
  font-weight: 500;
}

.header-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 0 14px;
  border: 1px solid var(--header-border);
  border-radius: var(--r-md);
  background: var(--header-chip-bg);
  color: var(--header-text);
  font-size: 13px;
  font-weight: 600;
  transition: all var(--t-fast);
}

.header-link:hover {
  background: var(--header-chip-hover);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--header-text);
  transform: translateY(-1px);
}

.icon-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--header-border);
  border-radius: var(--r-md);
  background: var(--header-chip-bg);
  color: var(--header-text);
  cursor: pointer;
  font-size: 15px;
  transition: all var(--t-fast);
}

.icon-button:hover {
  background: var(--header-chip-hover);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--header-text);
  transform: rotate(60deg);
}

.theme-toggle {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: 1px solid var(--header-border);
  border-radius: var(--r-md);
  background: var(--header-chip-bg);
  color: var(--header-text);
  cursor: pointer;
  overflow: hidden;
  transition: border-color var(--t-fast), color var(--t-fast),
    background var(--t-fast);
}

.theme-toggle:hover {
  background: var(--header-chip-hover);
  border-color: rgba(255, 255, 255, 0.28);
  color: var(--header-text);
}

.theme-toggle svg {
  position: absolute;
  width: 16px;
  height: 16px;
  transition: transform var(--t-med), opacity var(--t-med);
}

[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 0;
  transform: rotate(-90deg) scale(0.5);
}

[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 1;
  transform: rotate(0) scale(1);
}

[data-theme="dark"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.5);
}

[data-theme="dark"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0) scale(1);
}

/* --------------------------------------------------------------------------
   Main layout
   -------------------------------------------------------------------------- */

main {
  max-width: 1480px;
  margin: 0 auto;
  padding: 24px 28px 40px;
}

/* --------------------------------------------------------------------------
   Metric cards
   -------------------------------------------------------------------------- */

/* .metrics 는 filters 의 왼쪽 컬럼에 세로 2행 1열로 배치.
   각 카드 높이를 오른쪽 .filters-inputs 한 행(label+input ≈ 55px)과 맞춰
   필터 박스와 시각적 통일성을 준다. */
.metrics {
  display: grid;
  grid-template-columns: 1fr;
  grid-auto-rows: 1fr;
  gap: 10px;
  min-width: 168px;
}

.metric {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: center;
  column-gap: 10px;
  row-gap: 0;
  padding: 8px 14px;
  min-height: 55px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
  transition: transform var(--t-med), box-shadow var(--t-med), border-color var(--t-med);
}

.metric::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 2px;
  background: var(--gradient-brand);
  opacity: 0;
  transition: opacity var(--t-med);
}

.metric:hover {
  transform: translateY(-1px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
}

.metric:hover::before {
  opacity: 1;
}

.metric span {
  grid-column: 1;
  grid-row: 1;
  align-self: end;
  margin: 0;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

.metric strong {
  grid-column: 2;
  grid-row: 1 / span 2;
  align-self: center;
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.03em;
  line-height: 1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.metric em {
  grid-column: 1;
  grid-row: 2;
  align-self: start;
  margin: 0;
  color: var(--text-faint);
  font-size: 11px;
  font-style: normal;
  font-weight: 500;
  line-height: 1.2;
}

/* --------------------------------------------------------------------------
   Filters
   -------------------------------------------------------------------------- */

/* filters: 왼쪽 컬럼(.metrics 2x1) + 오른쪽 컬럼(.filters-inputs: 검색+필터 그리드) */
.filters {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 14px;
  margin-bottom: 16px;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
}

.filters-inputs {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(5, minmax(120px, 1fr));
  gap: 10px;
}

.filters label {
  display: block;
  min-width: 0;
}

label span,
.quick-range > span {
  display: block;
  margin-bottom: 6px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

input,
select {
  width: 100%;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), background var(--t-fast);
  appearance: none;
  -webkit-appearance: none;
}

/* 체크박스/라디오는 위 `appearance:none` + full-width + 38px 최소높이가
   덮어서 네이티브 렌더링이 사라지는 사고가 있어 명시적으로 기본값을 복원. */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  min-height: 0;
  padding: 0;
  border: 0;
  background: transparent;
  appearance: auto;
  -webkit-appearance: auto;
}

select {
  padding-right: 32px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%236a7283' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat;
  background-position: right 12px center;
  background-size: 12px;
  cursor: pointer;
}

input[type="date"] {
  cursor: pointer;
}

input:hover,
select:hover {
  border-color: var(--border-strong);
}

input:focus,
select:focus,
button:focus-visible {
  outline: 0;
  border-color: var(--accent);
  box-shadow: var(--focus);
}

input::placeholder {
  color: var(--text-faint);
}

.search-input-wrap {
  position: relative;
}

.search-input-wrap > span {
  position: absolute;
  left: 12px;
  top: 50%;
  color: var(--text-muted);
  font-size: 15px;
  transform: translateY(-50%);
  pointer-events: none;
  transition: color var(--t-fast);
}

.search-input-wrap input {
  padding-left: 36px;
  background: var(--surface);
}

.search-input-wrap input:focus + span,
.search-input-wrap:focus-within > span {
  color: var(--accent);
}

.quick-range {
  min-width: 0;
}

.quick-range > div {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  min-height: 38px;
  padding: 3px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface-2);
}

.quick-range button {
  border: 0;
  border-radius: calc(var(--r-md) - 3px);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--t-fast);
}

.quick-range button:hover {
  color: var(--text);
  background: var(--surface);
}

.quick-range button.is-active,
.quick-range button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
}

/* --------------------------------------------------------------------------
   Content grid (list + detail)
   -------------------------------------------------------------------------- */

.content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 400px;
  gap: 16px;
  align-items: start;
}

.notice-list,
.detail-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.section-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.section-bar h2 {
  margin: 0 0 2px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.section-bar p {
  margin: 0;
  color: var(--text-muted);
  font-size: 12px;
}

.section-bar select {
  min-height: 34px;
  max-width: 180px;
  font-size: 13px;
}

.section-bar > div:last-child {
  display: flex;
  align-items: center;
  gap: 10px;
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  min-width: 1024px;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}

thead th {
  position: sticky;
  top: 0;
  padding: 12px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  text-align: left;
}

tbody td {
  padding: 14px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  vertical-align: middle;
  transition: background var(--t-fast);
}

tbody tr {
  cursor: pointer;
  transition: background var(--t-fast);
}

tbody tr:hover td {
  background: var(--surface-2);
}

tbody tr.is-selected td {
  background: var(--surface-3);
}

tbody tr:last-child td {
  border-bottom: 0;
}

th:nth-child(1), td:nth-child(1) { width: 80px; }   /* 상태 */
th:nth-child(2), td:nth-child(2) { width: 38%; }    /* 공고 (제목) — 가장 넓게 */
th:nth-child(3), td:nth-child(3) { width: 128px; }  /* 기관 */
th:nth-child(4), td:nth-child(4) { width: 96px; }   /* 지역 */
th:nth-child(5), td:nth-child(5) { width: 90px; }   /* 마감 */
th:nth-child(6), td:nth-child(6) { width: 120px; }  /* 예산 */
th:nth-child(7), td:nth-child(7) { width: 140px; }  /* 참가 */
th:nth-child(8), td:nth-child(8) { width: 84px; }   /* 원문 */

.notice-title strong {
  display: block;
  margin-bottom: 4px;
  color: var(--text);
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.4;
  letter-spacing: -0.005em;
}

.notice-title span {
  display: block;
  color: var(--text-muted);
  font-size: 12px;
}

.budget-cell {
  max-width: 220px;
  color: var(--text-soft);
  font-size: 12.5px;
  line-height: 1.4;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Badges
   -------------------------------------------------------------------------- */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  min-height: 22px;
  padding: 3px 9px;
  border-radius: var(--r-pill);
  background: var(--slate-soft);
  color: var(--text-soft);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
  line-height: 1;
}

.badge::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: var(--r-pill);
  background: currentColor;
  opacity: 0.85;
}

.badge.new,
.badge.eligible { background: var(--green-soft); color: var(--green); }

.badge.updated,
.badge.ai { background: var(--blue-soft); color: var(--blue); }

.badge.closing_soon,
.badge.conditional { background: var(--gold-soft); color: var(--gold); }

.badge.closed,
.badge.institution_only { background: var(--red-soft); color: var(--red); }

.badge.unknown { background: var(--slate-soft); color: var(--text-muted); }

.badge.marine { background: var(--teal-soft); color: var(--teal); }

/* 공고 목록 "원문" 링크 셀 — 좁아진 컬럼에서도 정확히 가운데 오도록
   flex 중앙정렬 + 일정한 버튼 너비를 강제한다. */
.source-cell {
  text-align: center;
  white-space: nowrap;
}

.source-go {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 56px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: var(--r-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: 11.5px;
  font-weight: 600;
  text-decoration: none;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.source-go:hover {
  background: var(--surface);
  border-color: var(--border-strong);
}

.badge.defense { background: var(--slate-soft); color: var(--text-soft); }
.badge.energy { background: var(--gold-soft); color: var(--gold); }
.badge.water { background: var(--blue-soft); color: var(--blue); }
.badge.geospatial { background: var(--green-soft); color: var(--green); }
.badge.security { background: var(--red-soft); color: var(--red); }

.category-stack {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
}

/* --------------------------------------------------------------------------
   List messaging + pagination
   -------------------------------------------------------------------------- */

.list-message {
  padding: 28px 18px;
  color: var(--text-muted);
  font-size: 13px;
  text-align: center;
}

.pagination-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 18px;
  border-top: 1px solid var(--border-subtle);
  background: var(--surface-2);
}

.pagination-bar label {
  display: flex;
  align-items: center;
  gap: 10px;
}

.pagination-bar label span {
  margin: 0;
  white-space: nowrap;
  font-size: 11px;
}

.pagination-bar select {
  width: 104px;
  min-height: 34px;
  background-color: var(--surface);
}

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-controls button {
  min-width: 72px;
  min-height: 34px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-soft);
  cursor: pointer;
  font-size: 12.5px;
  font-weight: 600;
  transition: all var(--t-fast);
}

.pagination-controls button:not(:disabled):hover {
  border-color: var(--accent);
  color: var(--accent);
}

.pagination-controls button:disabled {
  cursor: default;
  opacity: 0.4;
}

.pagination-controls span {
  min-width: 64px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------------------
   Detail panel
   -------------------------------------------------------------------------- */

.detail-panel {
  position: sticky;
  top: 88px;
  min-height: 620px;
  max-height: calc(100vh - 110px);
  overflow: auto;
}

.empty-state,
.detail-content {
  padding: 28px 24px;
}

.empty-state {
  color: var(--text-muted);
  text-align: center;
}

.empty-state h2 {
  margin: 0 0 8px;
  color: var(--text);
  font-size: 16px;
  font-weight: 700;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.6;
}

.hidden {
  display: none !important;
}

.detail-content h2 {
  margin: 0 0 12px;
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.015em;
  line-height: 1.35;
  color: var(--text);
}

.detail-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.detail-block {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--border-subtle);
}

.detail-block h3 {
  margin: 0 0 8px;
  color: var(--text-muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-block p,
.detail-block li {
  margin: 0;
  color: var(--text-soft);
  font-size: 13px;
  line-height: 1.65;
}

.detail-block ul {
  margin: 0;
  padding-left: 18px;
  display: grid;
  gap: 4px;
}

.attachment-list {
  display: grid;
  gap: 6px;
}

.attachment-list a {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 38px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  color: var(--text-soft);
  font-size: 12.5px;
  font-weight: 500;
  transition: all var(--t-fast);
}

.attachment-list a::before {
  content: "↗";
  color: var(--accent);
  font-weight: 700;
}

.attachment-list a:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-softer);
}

.source-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  min-height: 44px;
  margin-top: 22px;
  border-radius: var(--r-md);
  background: var(--gradient-brand);
  color: var(--text-inverse);
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: -0.005em;
  box-shadow: var(--shadow-brand);
  transition: transform var(--t-fast), box-shadow var(--t-fast), filter var(--t-fast);
}

.source-link::after {
  content: "→";
  transition: transform var(--t-fast);
}

.source-link:hover {
  color: var(--text-inverse);
  transform: translateY(-1px);
  filter: brightness(1.05);
}

.source-link:hover::after {
  transform: translateX(3px);
}

.notice-footnote {
  margin-top: 14px;
  padding: 12px 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-muted);
  font-size: 11.5px;
  line-height: 1.55;
}

/* --------------------------------------------------------------------------
   Admin
   -------------------------------------------------------------------------- */

.admin-main {
  max-width: 1200px;
  margin: 0 auto;
}

.keywords-intro {
  margin: 0 0 16px;
  padding: 12px 16px;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: var(--surface-2);
  color: var(--text-soft);
  font-size: 14px;
  line-height: 1.6;
}

.keywords-intro strong {
  color: var(--text);
}

.scheduler-hint {
  margin: 6px 16px 12px;
  color: var(--text-muted);
  font-size: 12px;
  line-height: 1.6;
}

.scheduler-hint code {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--surface-2);
  color: var(--text-soft);
}

/* 사용자 생성 폼은 .keyword-form 의 2열 그리드(1fr 110px)를 물려받으면
   비밀번호가 110px 칸에 끼어 좁아진다. 아래 규칙들은 `.keyword-form.user-
   create-form` 로 specificity(0,2,0) 을 올려 파일 뒷쪽의 `.keyword-form`
   (0,1,0) 을 이겨서, display 가 flex 로 강제되도록 한다. 지난 패치에서
   single-class 규칙으로 작성해 선언 순서에 밀려 적용되지 않았음. */
.keyword-form.user-create-form {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding: 18px;
  align-items: end;
  grid-template-columns: none;
}

.keyword-form.user-create-form > label:not(.user-create-admin) {
  flex: 1 1 200px;
  min-width: 0;
}

.user-create-admin {
  display: flex;
  flex-direction: row !important;
  align-items: center;
  gap: 6px;
  color: var(--text-soft);
  font-size: 13px;
  flex: 0 0 auto;
  padding-bottom: 10px;
  cursor: pointer;
}

.user-create-admin input[type="checkbox"] {
  width: 16px;
  height: 16px;
  margin: 0;
  cursor: pointer;
}

.keyword-form.user-create-form > .primary-button {
  flex: 0 0 auto;
  min-width: 120px;
}

.keyword-form.user-create-form > .user-pw-status {
  flex: 1 1 100%;
}

.user-self {
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
}

.user-delete.danger-button-inline {
  color: var(--red);
  border-color: var(--red-soft);
}

.user-delete.danger-button-inline:hover {
  background: var(--red-soft);
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(380px, 0.75fr);
  gap: 16px;
}

.admin-panel {
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  background: var(--surface);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}

.keyword-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 110px;
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.primary-button {
  min-height: 38px;
  padding: 0 18px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--gradient-brand);
  color: var(--text-inverse);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-brand);
  transition: transform var(--t-fast), filter var(--t-fast);
}

.primary-button:not(:disabled):hover {
  transform: translateY(-1px);
  filter: brightness(1.06);
}

.primary-button:disabled {
  cursor: wait;
  opacity: 0.55;
  filter: grayscale(0.2);
  box-shadow: none;
}

.ghost-button {
  min-height: 38px;
  padding: 0 16px;
  border-radius: var(--r-md);
  background: transparent;
  color: var(--text-strong, var(--text-muted));
  border: 1px solid var(--border-subtle);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}

.ghost-button:not(:disabled):hover {
  background: var(--surface-subtle, rgba(0, 0, 0, 0.04));
  border-color: var(--text-muted);
}

.ghost-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.danger-button {
  min-height: 38px;
  min-width: 140px;
  padding: 0 18px;
  border: 1px solid var(--red, #dc2626);
  border-radius: var(--r-md);
  background: var(--red-soft, rgba(220, 38, 38, 0.08));
  color: var(--red, #dc2626);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--t-fast), color var(--t-fast);
}

.danger-button:not(:disabled):hover {
  background: var(--red, #dc2626);
  color: var(--text-inverse, #fff);
}

.danger-button:disabled {
  cursor: wait;
  opacity: 0.55;
}

.admin-panel--danger {
  border-color: var(--red, #dc2626);
}

.admin-panel--danger h2 {
  color: var(--red, #dc2626);
}

.keyword-list {
  display: grid;
  gap: 8px;
  padding: 18px;
}

.keyword-list--compact {
  gap: 6px;
  padding: 10px 12px;
  margin: 0 14px 14px;
  max-height: 180px;
  overflow-y: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--r-md);
  background: var(--surface-2, rgba(0, 0, 0, 0.02));
}

.keyword-list--compact .keyword-item {
  min-height: 32px;
  padding: 0 10px;
}

.keyword-list--compact .keyword-item span {
  font-size: 12px;
}

.keyword-list--compact .keyword-item button {
  min-height: 24px;
  padding: 0 8px;
  font-size: 11px;
}

.keyword-list--compact::-webkit-scrollbar {
  width: 8px;
}

.keyword-list--compact::-webkit-scrollbar-thumb {
  background: var(--border-strong, rgba(0, 0, 0, 0.2));
  border-radius: 4px;
}

.keyword-list--compact::-webkit-scrollbar-track {
  background: transparent;
}

.keyword-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 44px;
  padding: 0 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: all var(--t-fast);
}

.keyword-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.keyword-item span {
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
}

.keyword-item button {
  min-height: 30px;
  padding: 0 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  background: var(--surface);
  color: var(--red);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  transition: all var(--t-fast);
}

.keyword-item button:hover {
  border-color: var(--red);
  background: var(--red-soft);
}

.collect-period {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.collect-actions {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--border-subtle);
}

.collect-actions .primary-button {
  min-width: 140px;
}

.collect-actions span,
.admin-empty {
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 500;
}

.admin-empty {
  padding: 20px 4px;
  text-align: center;
}

.collect-result {
  padding: 18px;
}

.collect-summary {
  display: grid;
  gap: 6px;
  margin-bottom: 14px;
  padding: 14px;
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: 13px;
}

.collect-summary span {
  color: var(--text-muted);
}

.admin-table {
  min-width: 0;
}

.admin-table tr.is-failed td {
  background: var(--red-soft);
  color: var(--red);
}

/* Sources panel (registered crawling/API targets) */

.sources-panel {
  margin-top: 16px;
}

.source-legend {
  display: flex;
  align-items: center;
  gap: 14px;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 500;
}

.source-legend span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--r-pill);
  background: var(--text-faint);
  flex-shrink: 0;
}

.dot-on {
  background: var(--green);
  box-shadow: 0 0 0 3px var(--green-soft);
}

.dot-off {
  background: var(--text-faint);
  box-shadow: 0 0 0 3px var(--slate-soft);
}

.sources-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  padding: 18px;
}

.source-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast), box-shadow var(--t-fast), transform var(--t-fast);
}

.source-card:hover {
  border-color: var(--border-strong);
  box-shadow: var(--shadow-sm);
  transform: translateY(-1px);
}

.source-card.is-disabled {
  opacity: 0.72;
  background: var(--surface-2);
}

.source-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.source-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.source-name strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.source-type-chip {
  padding: 3px 8px;
  border-radius: var(--r-pill);
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: -0.005em;
  white-space: nowrap;
}

.source-url {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  color: var(--text-muted);
  font-size: 12.5px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  transition: color var(--t-fast);
}

.source-url::after {
  content: "↗";
  font-size: 11px;
  color: var(--text-faint);
  transition: transform var(--t-fast), color var(--t-fast);
}

.source-url:hover {
  color: var(--accent);
}

.source-url:hover::after {
  color: var(--accent);
  transform: translate(1px, -1px);
}

.source-meta {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px 14px;
  margin: 0;
  padding-top: 10px;
  border-top: 1px solid var(--border-subtle);
  font-size: 11.5px;
}

.source-meta > div {
  display: flex;
  gap: 6px;
  align-items: baseline;
  min-width: 0;
}

.source-meta dt {
  color: var(--text-faint);
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  font-size: 10px;
  flex-shrink: 0;
}

.source-meta dd {
  margin: 0;
  color: var(--text-soft);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.source-meta code {
  font-family: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  font-size: 11px;
  color: var(--text);
}

.source-meta .is-error dd {
  color: var(--red);
}

/* --------------------------------------------------------------------------
   Reduced motion
   -------------------------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */

@media (max-width: 1180px) {
  .filters {
    grid-template-columns: 1fr;
  }

  .metrics {
    grid-template-columns: repeat(2, 1fr);
  }

  .filters-inputs {
    grid-template-columns: repeat(3, 1fr);
  }

  .search-field,
  .quick-range {
    grid-column: 1 / -1;
  }

  .content-grid {
    grid-template-columns: 1fr;
  }

  .detail-panel {
    position: static;
    min-height: auto;
    max-height: none;
  }
}

@media (max-width: 900px) {
  .admin-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 720px) {
  .app-header {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px 18px;
  }

  main {
    padding: 18px 18px 32px;
  }

  .metrics,
  .filters {
    grid-template-columns: 1fr;
  }

  .section-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .section-bar select,
  .section-bar > div:last-child {
    max-width: none;
  }

  .section-bar > div:last-child,
  .pagination-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .pagination-bar label,
  .pagination-controls {
    justify-content: space-between;
  }

  .keyword-form {
    grid-template-columns: 1fr;
  }

  .collect-period {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   Login screen — 라이트/다크 테마와 무관하게 항상 짙은 네이비 + 글로우.
   대시보드 헤더와 같은 브랜드 톤을 유지하면서 카드는 글래스(반투명+blur).
   ========================================================================== */
.login-body {
  position: relative;
  min-height: 100vh;
  margin: 0;
  padding: 24px;
  display: grid;
  place-items: center;
  color: #ecf0ff;
  background:
    radial-gradient(900px 520px at 15% 10%, rgba(96, 165, 250, 0.22) 0%, transparent 60%),
    radial-gradient(820px 500px at 85% 88%, rgba(45, 212, 191, 0.18) 0%, transparent 60%),
    radial-gradient(1200px 700px at 50% -10%, rgba(30, 58, 138, 0.55) 0%, transparent 70%),
    linear-gradient(135deg, #050b1c 0%, #0a1c3e 55%, #0d2350 100%);
  background-attachment: fixed;
  overflow: hidden;
  font-family:
    "Inter", "Pretendard", "Pretendard Variable", -apple-system, BlinkMacSystemFont,
    "Segoe UI", "Apple SD Gothic Neo", "Noto Sans KR", "Malgun Gothic", sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* 부유 글로우(상단 좌, 하단 우) */
.login-body::before,
.login-body::after {
  content: "";
  position: fixed;
  border-radius: 50%;
  filter: blur(70px);
  opacity: 0.55;
  pointer-events: none;
  z-index: 0;
}
.login-body::before {
  width: 360px; height: 360px;
  top: -120px; left: -90px;
  background: radial-gradient(circle, #4f8cff 0%, transparent 70%);
}
.login-body::after {
  width: 440px; height: 440px;
  bottom: -140px; right: -110px;
  background: radial-gradient(circle, #2dd4bf 0%, transparent 70%);
}

.login-card {
  position: relative;
  z-index: 1;
  width: 100%;
  max-width: 380px;
  padding: 30px 30px 26px;
  background: rgba(13, 22, 45, 0.62);
  backdrop-filter: blur(20px) saturate(150%);
  -webkit-backdrop-filter: blur(20px) saturate(150%);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  box-shadow:
    0 24px 70px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.04) inset;
  color: #ecf0ff;
}

/* 카드 상단 브랜드 라인 */
.login-card::before {
  content: "GOVERNMENT OPPORTUNITY DASHBOARD";
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  color: rgba(96, 165, 250, 0.72);
  margin-bottom: 10px;
}

.login-card h1 {
  margin: 0 0 6px;
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.025em;
  background: linear-gradient(135deg, #ffffff 0%, #93c5fd 100%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.login-sub {
  margin: 0 0 22px;
  color: rgba(236, 240, 255, 0.6);
  font-size: 13px;
  letter-spacing: -0.005em;
}

.login-card form {
  display: grid;
  gap: 10px;
}

.login-card label {
  font-size: 12px;
  font-weight: 600;
  color: rgba(236, 240, 255, 0.72);
  letter-spacing: 0.02em;
  margin-bottom: 2px;
}

.login-card input[type="text"],
.login-card input[type="password"] {
  width: 100%;
  min-height: 0;
  padding: 11px 13px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.14);
  background: rgba(0, 0, 0, 0.32);
  color: #ecf0ff;
  font-size: 14.5px;
  box-sizing: border-box;
  transition: border-color 150ms ease, background 150ms ease, box-shadow 150ms ease;
}
.login-card input[type="text"]::placeholder,
.login-card input[type="password"]::placeholder {
  color: rgba(236, 240, 255, 0.32);
}
.login-card input[type="text"]:hover,
.login-card input[type="password"]:hover {
  border-color: rgba(255, 255, 255, 0.22);
}
.login-card input[type="text"]:focus,
.login-card input[type="password"]:focus {
  outline: none;
  border-color: rgba(96, 165, 250, 0.55);
  background: rgba(0, 0, 0, 0.42);
  box-shadow: 0 0 0 3px rgba(96, 165, 250, 0.2);
}

.login-card button[type="submit"] {
  margin-top: 12px;
  padding: 12px 14px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, #1e3a8a 0%, #2563eb 50%, #3b82f6 100%);
  color: #fff;
  font-size: 14.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  cursor: pointer;
  box-shadow: 0 8px 22px rgba(59, 130, 246, 0.4);
  transition: transform 120ms ease, filter 120ms ease, box-shadow 120ms ease;
}
.login-card button[type="submit"]:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
  box-shadow: 0 10px 28px rgba(59, 130, 246, 0.5);
}
.login-card button[type="submit"]:disabled {
  opacity: 0.55;
  cursor: progress;
  filter: grayscale(0.2);
  box-shadow: none;
}

.login-error {
  margin: 6px 0 0;
  padding: 8px 12px;
  border-radius: 8px;
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid rgba(255, 107, 107, 0.32);
  color: #ffb4b4;
  font-size: 12.5px;
  line-height: 1.4;
}
.login-remember {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 6px;
  padding: 4px 0;
  color: rgba(236, 240, 255, 0.8);
  font-size: 13px;
  cursor: pointer;
  user-select: none;
}
/* 전역 input { width:100%; min-height:38px; appearance:none } 가 체크박스에도
   먹어서 직사각형 + 체크표시 사라지는 문제가 있다. 네이티브 모양·크기를
   명시적으로 복원해 시각 피드백을 살린다. */
.login-remember input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: 0;
  margin: 0;
  padding: 0;
  flex: 0 0 auto;
  appearance: auto;
  -webkit-appearance: auto;
  -moz-appearance: auto;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 3px;
  background: transparent;
  accent-color: var(--accent, #4f8cff);
  cursor: pointer;
  box-sizing: content-box;
}
.login-remember input[type="checkbox"]:focus {
  outline: 2px solid var(--accent, #4f8cff);
  outline-offset: 1px;
}
.login-remember span {
  margin: 0;
  color: rgba(236, 240, 255, 0.78);
  font-size: 13px;
  font-weight: 500;
  letter-spacing: -0.005em;
  text-transform: none;
}

/* ===== Scheduler card ===== */
.scheduler-meta {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin: 6px 0 12px;
}
.scheduler-meta div {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  padding: 8px 10px;
}
.scheduler-meta dt {
  font-size: 11px;
  color: var(--muted, #8a93b3);
  margin: 0 0 2px;
}
.scheduler-meta dd {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
@media (max-width: 600px) {
  .scheduler-meta { grid-template-columns: 1fr 1fr; }
}

/* ===== Users panel (admin board) ===== */
.users-panel { margin-top: 16px; }

.users-list {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.user-item {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr);
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--surface);
  transition: border-color var(--t-fast), background var(--t-fast);
}
.user-item:hover {
  border-color: var(--border-strong);
  background: var(--surface-2);
}

.user-meta {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.user-meta strong {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.005em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-role {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
}
.user-role.is-admin {
  background: var(--accent-soft);
  color: var(--accent);
}
.user-role.is-user {
  background: var(--slate-soft);
  color: var(--text-muted);
}

.user-pw-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
}
.user-pw-input {
  min-height: 36px;
  padding: 0 12px;
}
.user-pw-save {
  min-height: 36px;
  white-space: nowrap;
}
.user-pw-status {
  font-size: 12px;
  color: var(--text-muted);
  white-space: nowrap;
}
.user-pw-status[data-tone="ok"]    { color: var(--green); }
.user-pw-status[data-tone="error"] { color: var(--red); }

@media (max-width: 720px) {
  .user-item { grid-template-columns: 1fr; }
  .user-pw-form { grid-template-columns: 1fr; }
  .user-pw-status { white-space: normal; }
}

/* ===== Exclude keyword chip ===== */
.keyword-item.is-exclude {
  border-color: rgba(255, 107, 107, 0.45);
  background: rgba(255, 107, 107, 0.08);
}
.keyword-item.is-exclude span::before {
  content: "✕ ";
  color: #ff6b6b;
  font-weight: 700;
  margin-right: 2px;
}

/* ===== Source card status & toggle ===== */
.source-card.has-error {
  border-color: rgba(255, 107, 107, 0.55);
  box-shadow: inset 0 0 0 1px rgba(255, 107, 107, 0.15);
}
.source-head-right {
  display: inline-flex;
  gap: 6px;
  align-items: center;
}
.source-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.3px;
}
.source-status.status-ok    { background: rgba( 79, 200, 120, 0.18); color: #4fc878; }
.source-status.status-off   { background: rgba(138, 147, 179, 0.18); color: #8a93b3; }
.source-status.status-error { background: rgba(255, 107, 107, 0.20); color: #ff6b6b; }
.dot.dot-error { background: #ff6b6b; box-shadow: 0 0 0 3px rgba(255,107,107,.15); }
.source-actions { margin-top: 10px; display: flex; justify-content: flex-end; }
.source-toggle {
  border: 1px solid rgba(255, 255, 255, 0.18);
  background: transparent;
  color: var(--fg, #e6ecff);
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.source-toggle.is-on  { border-color: rgba(255, 107, 107, 0.4); color: #ff6b6b; }
.source-toggle.is-off { border-color: rgba( 79, 200, 120, 0.4); color: #4fc878; }
.source-toggle:disabled { opacity: 0.5; cursor: progress; }
