/* 관리자 화면 */
body.admin { background: #f4f6fb; }
.admin-bar { background: #fff; border-bottom: 1px solid var(--border); box-shadow: 0 1px 0 rgba(23, 32, 51, 0.03); }
.admin-bar .brand { color: var(--brand); }
.admin-bar .topnav a, .admin-bar .link-btn { color: var(--muted); }
.admin-bar .topnav a:hover, .admin-bar .link-btn:hover { background: var(--brand-soft); color: var(--brand-dark); }
.admin-bar .topnav a[aria-current="page"] { background: var(--brand-soft); color: var(--brand-dark); }
.admin-tag { display: inline-block; margin-left: 4px; padding: 1px 8px; border-radius: 999px; background: var(--brand-soft); color: var(--brand-dark); font-size: 0.75rem; font-weight: 700; vertical-align: middle; }

.login-card { max-width: 420px; margin: 40px auto; }

.admin-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 16px; }
.admin-head h1 { margin: 0; }
.ai-box { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.ai-status { padding: 6px 12px; border-radius: 999px; background: #fff; font-weight: 700; font-size: 0.9rem; border: 1px solid var(--border); }
.ai-status.bedrock { background: var(--green-soft); border-color: #bfe6cd; color: var(--green); }
.ai-status.basic { background: var(--yellow-soft); border-color: #f2df9c; color: var(--yellow); }

.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 16px; }
.stat { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); padding: 18px; border: 1px solid var(--border); border-top: 4px solid var(--brand); }
.stat.urgent { border-top-color: var(--red); }
.stat.done { border-top-color: var(--green); }
.stat-label { display: block; color: var(--muted); font-weight: 700; font-size: 0.9rem; }
.stat strong { font-size: 2rem; line-height: 1.2; color: var(--text); }

.admin-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
.section-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.section-head h2 { margin: 0; }

.recommend { margin: 0; padding-left: 22px; display: grid; gap: 10px; }
.recommend li { padding-left: 4px; }
.recommend a { display: block; font-weight: 800; color: var(--text); text-decoration: none; }
.recommend a:hover { text-decoration: underline; }
.rec-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 4px; font-size: 0.85rem; color: var(--muted); margin-top: 2px; }
.recommend .rec.risk-4 a { color: var(--red); }
.recommend .empty { margin-left: -22px; }

.weekly-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; margin-bottom: 14px; }
.wcard { padding: 12px; border-radius: 12px; background: var(--brand-soft); display: grid; gap: 2px; }
.wlabel { color: var(--muted); font-size: 0.8rem; font-weight: 700; }
.wcard strong { font-size: 1.1rem; }
.wsub { font-size: 0.8rem; color: var(--muted); }
.weekly-charts { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-bottom: 14px; }
.weekly-charts h3 { font-size: 0.9rem; color: var(--muted); margin-bottom: 6px; }
.bars { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bars li { display: grid; grid-template-columns: 7.5em 1fr 3em; align-items: center; gap: 8px; font-size: 0.85rem; }
.bar-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.bar-track { height: 12px; border-radius: 999px; background: #e6ebf4; overflow: hidden; }
.bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--brand); min-width: 2px; }
.bar-count { text-align: right; font-weight: 700; }
.opinion { padding: 14px 16px; border-radius: 12px; background: var(--brand); color: #fff; }
.opinion b { display: block; color: #ffd166; font-size: 0.9rem; margin-bottom: 4px; }
.opinion p { margin: 0; }

.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters select, .filters input { width: auto; min-width: 140px; min-height: 40px; padding: 6px 10px; }
.table-wrap { overflow-x: auto; position: relative; } /* relative: 표 안의 숨긴 글자도 표 밖으로 나가지 않게 */
table.issues { width: 100%; border-collapse: collapse; min-width: 720px; }
.issues th { text-align: left; font-size: 0.85rem; color: var(--muted); padding: 10px 8px; border-bottom: 2px solid var(--border); white-space: nowrap; }
.issues td { padding: 10px 8px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.issues tr.is-new td { background: #fffbea; }
.issues .num { white-space: nowrap; font-weight: 700; }
.row-title { font-weight: 800; color: var(--text); text-decoration: none; margin-right: 6px; }
.row-title:hover { text-decoration: underline; }
.row-sub { display: block; font-size: 0.8rem; color: var(--muted); margin-top: 2px; }
.status-select { width: auto; min-height: 36px; padding: 4px 8px; font-weight: 700; border-radius: 10px; }
.status-select.status-received { background: var(--red-soft); }
.status-select.status-checking { background: var(--yellow-soft); }
.status-select.status-in_progress { background: var(--blue-soft); }
.status-select.status-resolved { background: var(--green-soft); }

.demo-note { color: var(--muted); font-size: 0.85rem; text-align: center; }

.fu-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 12px 16px;
  margin-bottom: 16px;
  border-radius: 14px;
  border: 1px solid #a9ddd8;
  background: #dff3f1;
  color: #064b48;
  font-weight: 800;
  text-decoration: none;
}
.fu-banner:hover { background: #c9ebe7; }
.fu-banner.alert { border-color: #f2df9c; background: #fff4cc; color: #4d3700; }

/* 관리자 문제 화면 */
.admin-issue-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; align-items: start; }
.admin-issue-grid .col { min-width: 0; }
.segments { border: 0; padding: 0; margin: 0 0 16px; display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; }
.segments legend { padding: 0; }
.seg { position: relative; display: block; cursor: pointer; }
.seg input { position: absolute; opacity: 0; }
.seg span {
  display: block;
  padding: 12px;
  border-radius: 12px;
  border: 2px solid var(--border);
  background: #fff;
  font-weight: 800;
  text-align: center;
}
.seg input:checked + span { border-color: var(--brand); background: var(--brand-soft); }
.seg.status-resolved input:checked + span { border-color: #1f9d55; background: var(--green-soft); }
.seg input:focus-visible + span { outline: 3px solid var(--brand); outline-offset: 2px; }
.reports { list-style: none; margin: 0; padding: 0; }
.report-item { display: flex; gap: 12px; align-items: flex-start; padding: 12px 0; border-top: 1px solid var(--border); }
.report-item:first-child { border-top: 0; }
.report-photo { width: 84px; height: 84px; object-fit: cover; border-radius: 10px; display: block; }
.report-main { flex: 1; min-width: 0; }
.report-text { font-weight: 600; margin-bottom: 4px; }
.report-main .muted { margin: 0; }
.danger-zone { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.photo-actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }

@media (max-width: 900px) {
  .admin-grid, .admin-issue-grid, .weekly-charts { grid-template-columns: 1fr; }
}
@media (max-width: 560px) {
  .stats { grid-template-columns: repeat(2, 1fr); }
  .filters select, .filters input { flex: 1; min-width: 0; }
}
@media (max-width: 480px) {
  /* 휴대폰: 위쪽 관리자 메뉴를 한 줄로, 넘치면 옆으로 밀어서 본다 */
  .admin-bar { flex-wrap: wrap; gap: 6px; padding-top: 8px; padding-bottom: 8px; }
  .admin-bar .topnav { width: 100%; flex-wrap: nowrap; justify-content: flex-start; overflow-x: auto; }
  .admin-bar .topnav a, .admin-bar .link-btn { white-space: nowrap; }
}
