/* ===== 베이스 ===== */
* { box-sizing: border-box; }
body {
  font-family: "Noto Sans KR", "Pretendard", -apple-system, BlinkMacSystemFont,
               "Segoe UI", "Apple SD Gothic Neo", "Malgun Gothic", sans-serif;
  margin: 0; background: #f5f7fb; color: #1e293b;
  font-size: 15px; line-height: 1.7;
  letter-spacing: 0;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}
a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }
h1,h2,h3 { margin: 0; }

/* ===== 로그인 ===== */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a8a 0%, #6366f1 100%);
}
.login-card {
  background: #fff; padding: 48px 40px; border-radius: 16px;
  width: 100%; max-width: 420px; box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.login-card .brand { font-size: 26px; font-weight: 800; color: #1e3a8a; }
.login-card .subtitle { color: #64748b; margin: 8px 0 28px; font-size: 14px; }
.login-card label { display: block; font-size: 13px; font-weight: 600; margin: 14px 0 6px; color: #334155; }
.login-card input {
  width: 100%; padding: 11px 14px; border: 1.5px solid #e2e8f0; border-radius: 10px;
  font-size: 14px; outline: none;
}
.login-card input:focus { border-color: #6366f1; }
.login-card button {
  width: 100%; margin-top: 24px; padding: 13px; border: 0; border-radius: 10px;
  background: #1e3a8a; color: #fff; font-size: 15px; font-weight: 700; cursor: pointer;
}
.login-card button:hover { background: #1e40af; }
.login-card .error { background: #fef2f2; color: #dc2626; padding: 10px 14px; border-radius: 8px; font-size: 13px; }
.login-card .hint { color: #94a3b8; font-size: 12px; margin-top: 18px; }
.login-card label .opt { color: #94a3b8; font-weight: 400; font-size: 12px; }

/* ===== 관리자 콘솔 (전체 대학) ===== */
.console { padding: 28px; max-width: 1280px; margin: 0 auto; }
.console-head h1 { font-size: 24px; font-weight: 800; color: #1e293b; }
.console-sub { color: #64748b; font-size: 14px; margin-top: 6px; }
.console-search {
  display: flex; align-items: center; gap: 14px; margin: 22px 0 20px;
}
.console-search input {
  flex: 1; max-width: 520px; padding: 13px 16px; font-size: 15px;
  border: 1.5px solid #e2e8f0; border-radius: 12px; outline: none; background: #fff;
}
.console-search input:focus { border-color: #6366f1; }
.console-search .search-count { color: #94a3b8; font-size: 13px; font-weight: 600; }

.univ-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 16px;
}
.univ-card {
  display: block; background: #fff; border-radius: 14px; padding: 18px 20px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06); border: 1.5px solid transparent;
  transition: transform .12s ease, box-shadow .12s ease, border-color .12s ease;
}
.univ-card:hover {
  text-decoration: none; transform: translateY(-2px);
  box-shadow: 0 8px 22px rgba(30,58,138,.12); border-color: #c7d2fe;
}
.uc-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.uc-name { font-size: 17px; font-weight: 800; color: #1e293b; line-height: 1.35; }
.uc-risk {
  flex-shrink: 0; color: #fff; font-size: 11px; font-weight: 700;
  padding: 3px 9px; border-radius: 999px;
}
.uc-domain { color: #94a3b8; font-size: 12px; margin-top: 3px; }
.uc-stats {
  display: flex; gap: 10px; margin: 14px 0 12px;
}
.uc-stat {
  flex: 1; background: #f8fafc; border-radius: 10px; padding: 10px; text-align: center;
}
.uc-stat-v { font-size: 19px; font-weight: 800; color: #1e3a8a; }
.uc-stat-l { font-size: 11px; color: #64748b; margin-top: 2px; }
.uc-last { font-size: 12px; color: #94a3b8; }

.console .loading, .console .empty {
  grid-column: 1 / -1; color: #94a3b8; font-size: 14px; padding: 40px 0; text-align: center;
}

/* ===== 콘솔: 키워드 승인 대기 ===== */
.kw-approve {
  background: #fffbeb; border: 1.5px solid #fcd34d; border-radius: 14px;
  padding: 18px 20px; margin: 8px 0 24px;
}
.kw-approve-head h2 { font-size: 16px; font-weight: 800; color: #92400e; }
.kw-approve-count {
  background: #f59e0b; color: #fff; font-size: 12px; font-weight: 700;
  padding: 1px 9px; border-radius: 999px; margin-left: 4px;
}
.kw-approve-head p { font-size: 12.5px; color: #b45309; margin: 4px 0 12px; }
.kw-prow {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  background: #fff; border: 1px solid #fde68a; border-radius: 10px;
  padding: 12px 14px; margin-bottom: 8px;
}
.kw-prow-info { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.kw-prow-univ { font-weight: 700; color: #1e293b; font-size: 14px; }
.kw-prow-kw {
  background: #eff6ff; color: #1e3a8a; font-weight: 700; font-size: 13px;
  padding: 3px 10px; border-radius: 6px;
}
.kw-prow-date { color: #94a3b8; font-size: 12px; }
.kw-prow-btns { display: flex; gap: 8px; flex-shrink: 0; }
.kw-btn-ok, .kw-btn-no {
  border: 0; border-radius: 8px; font-size: 13px; font-weight: 700;
  padding: 7px 16px; cursor: pointer;
}
.kw-btn-ok { background: #16a34a; color: #fff; }
.kw-btn-ok:hover { background: #15803d; }
.kw-btn-no { background: #f1f5f9; color: #64748b; }
.kw-btn-no:hover { background: #e2e8f0; }

/* ===== 콘솔: 키워드 전체 내역 ===== */
.kw-ledger {
  background: #fff; border: 1px solid #e2e8f0; border-radius: 14px;
  padding: 18px 20px; margin: 0 0 24px;
}
.kw-ledger-head h2 { font-size: 16px; font-weight: 800; color: #1e293b; }
.kw-ledger-count { color: #64748b; font-size: 13px; font-weight: 700; margin-left: 4px; }
.kw-ledger-head p { font-size: 12.5px; color: #94a3b8; margin: 4px 0 12px; }
.cost-forecast-table { width: 100%; border-collapse: collapse; font-size: 13px; margin-bottom: 10px; }
.cost-forecast-table th, .cost-forecast-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #f1f5f9; }
.cost-forecast-table th { color: #94a3b8; font-weight: 700; font-size: 11.5px; text-transform: uppercase; }
.cost-forecast-table tr.now td { background: #eef4ff; font-weight: 700; color: #1e3a8a; }
.cost-forecast-note { font-size: 11.5px; color: #94a3b8; margin: 0; line-height: 1.6; }
.kw-lrow {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-bottom: 1px solid #f1f5f9;
}
.kw-lrow:last-child { border-bottom: 0; }
.kw-lrow-univ { font-weight: 700; color: #1e293b; font-size: 13.5px; min-width: 120px; }
.kw-lrow-kw {
  flex: 1; min-width: 0; background: #eff6ff; color: #1e3a8a; font-weight: 700;
  font-size: 13px; padding: 3px 10px; border-radius: 6px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.kw-badge { font-size: 11.5px; font-weight: 800; padding: 3px 10px; border-radius: 999px; flex-shrink: 0; }
.kw-badge.st-approved { background: #dcfce7; color: #16a34a; }
.kw-badge.st-pending  { background: #fef3c7; color: #b45309; }
.kw-badge.st-rejected { background: #f1f5f9; color: #94a3b8; }
.kw-lrow-date { font-size: 12px; color: #94a3b8; flex-shrink: 0; }
.kw-del {
  flex-shrink: 0; background: #fee2e2; color: #dc2626; border: 0;
  font-size: 12px; font-weight: 700; padding: 6px 12px; border-radius: 8px; cursor: pointer;
}
.kw-del:hover { background: #fecaca; }
/* 통합 내역 줄: 인라인 승인/거절 버튼 컴팩트화 + 신청대학→대상 화살표 */
.kw-lrow .kw-btn-ok, .kw-lrow .kw-btn-no { flex-shrink: 0; padding: 6px 12px; font-size: 12px; }
.comp-arrow { flex-shrink: 0; color: #94a3b8; font-weight: 800; }
/* 묶음 줄: 대상 여러 곳을 한 줄에 나열(줄바꿈 허용, 말줄임 해제) */
.kw-lrow-kw.comp-multi { white-space: normal; line-height: 1.6; }
/* 완료 내역 접기/펼치기 — 대기중 건은 항상 노출, 완료된 건만 기본 숨김 */
.kw-more-btn {
  display: block; width: 100%; margin-top: 4px;
  background: #f1f5f9; border: 1px dashed #cbd5e1;
  padding: 9px 12px; border-radius: 8px;
  font-size: 12.5px; font-weight: 700; color: #475569;
  cursor: pointer; transition: background 0.15s;
}
.kw-more-btn:hover { background: #e2e8f0; }
/* AI 사용량 — 기능별 비용 요약 칩 */
.ai-usage-feature-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.ai-usage-fchip { background: #eff6ff; color: #1e3a8a; border: 1px solid #bfdbfe;
  border-radius: 999px; padding: 6px 14px; font-size: 12.5px; font-weight: 700; }
.ai-usage-fchip b { color: #1d4ed8; margin-left: 3px; }

/* ===== 대시보드 ===== */
.topbar {
  display: flex; align-items: center; gap: 24px; padding: 14px 28px;
  background: #fff; border-bottom: 1px solid #e2e8f0;
}
.brand-mini { font-weight: 800; color: #1e3a8a; }
.univ { font-weight: 700; }
.univ .dim { color: #94a3b8; font-weight: 400; font-size: 13px; }
.topbar .logout { margin-left: auto; color: #64748b; font-size: 13px; }
.topbar .topnav { display: flex; gap: 18px; margin-left: 28px; }
.topbar .topnav a { color: #64748b; font-size: 13px; font-weight: 600; padding: 6px 4px; border-bottom: 2px solid transparent; }
.topbar .topnav a.active { color: #1e3a8a; border-bottom-color: #1e3a8a; }
.topbar .topnav a:hover { color: #1e3a8a; text-decoration: none; }

.dash { padding: 24px 28px; max-width: 1400px; margin: 0 auto; }

.summary {
  display: grid; grid-template-columns: 1.4fr repeat(5, 1fr); gap: 14px; margin-bottom: 24px;
}
.card {
  background: #fff; border-radius: 12px; padding: 18px; box-shadow: 0 1px 3px rgba(0,0,0,.05);
}
.card .label { font-size: 12px; color: #64748b; font-weight: 600; }
.card .value { font-size: 28px; font-weight: 800; margin-top: 6px; }
.card .unit { font-size: 12px; color: #94a3b8; }
.card.score { background: linear-gradient(135deg, #1e3a8a, #6366f1); color: #fff; }
.card.score .label { color: rgba(255,255,255,.85); }
.card.score .value { color: #fff; font-size: 36px; }
.card.pos .value { color: #22c55e; }
.card.neu .value { color: #94a3b8; }
.card.neg .value { color: #ef4444; }
.card.alert .value { color: #f59e0b; }

.charts { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; margin-bottom: 28px; }
.chart-box { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); }
.chart-box h3 { font-size: 14px; color: #334155; margin-bottom: 14px; }
.chart-box canvas { max-height: 260px; }

.sec-title { font-size: 15px; color: #334155; margin: 16px 0 12px; }

.channels { display: grid; grid-template-columns: repeat(6, 1fr); gap: 12px; margin-bottom: 28px; }
.ch-card { background: #fff; padding: 14px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.04); }
.ch-name { font-size: 12px; color: #64748b; font-weight: 700; }
.ch-total { font-size: 22px; font-weight: 800; margin: 4px 0 10px; }
.ch-bars { display: flex; height: 6px; border-radius: 3px; overflow: hidden; background: #f1f5f9; }
.ch-bars .bar.pos { background: #22c55e; }
.ch-bars .bar.neu { background: #cbd5e1; }
.ch-bars .bar.neg { background: #ef4444; }
.ch-legend { display: flex; justify-content: space-between; font-size: 11px; margin-top: 6px; }
.ch-legend .pos { color: #16a34a; } .ch-legend .neu { color: #64748b; } .ch-legend .neg { color: #dc2626; }

.serp { background: #fff; padding: 20px; border-radius: 12px; box-shadow: 0 1px 3px rgba(0,0,0,.05); margin-bottom: 28px; }
.serp-tabs { display: flex; gap: 8px; margin-bottom: 12px; }
.serp-tabs button {
  border: 1.5px solid #e2e8f0; background: #fff; padding: 8px 18px; border-radius: 8px;
  font-size: 13px; font-weight: 600; cursor: pointer; color: #64748b;
}
.serp-tabs button.active { background: #1e3a8a; color: #fff; border-color: #1e3a8a; }
.serp-meta { font-size: 12px; color: #94a3b8; margin-bottom: 12px; }
.serp-list { list-style: none; padding: 0; margin: 0; }
.serp-item { display: flex; gap: 14px; padding: 12px; border-radius: 8px; margin-bottom: 6px; background: #f8fafc; }
.serp-item.sent-positive { border-left: 4px solid #22c55e; }
.serp-item.sent-neutral { border-left: 4px solid #cbd5e1; }
.serp-item.sent-negative { border-left: 4px solid #ef4444; background: #fef2f2; }
.serp-rank { font-size: 22px; font-weight: 800; color: #1e3a8a; min-width: 32px; }
.serp-title { font-size: 14px; font-weight: 700; }
.serp-snippet { font-size: 12px; color: #64748b; margin-top: 4px; }
.serp-tag { font-size: 11px; color: #94a3b8; margin-top: 4px; font-weight: 600; }

.neg-table { width: 100%; background: #fff; border-radius: 12px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.05); border-collapse: collapse; }
.neg-table th, .neg-table td { padding: 12px 14px; text-align: left; font-size: 13px; border-bottom: 1px solid #f1f5f9; }
.neg-table th { background: #f8fafc; color: #475569; font-weight: 700; font-size: 12px; }
.neg-table td.neg { color: #ef4444; font-weight: 700; }
.neg-table td.dim { color: #94a3b8; font-size: 11px; }
.neg-table td.reason { color: #64748b; font-size: 12px; max-width: 360px; }

.dim { color: #94a3b8; }
