:root {
  --bg: #f4f7fd;
  --card: #ffffff;
  --line: #d9e0ee;
  --text: #1d2638;
  --muted: #60708c;
  --primary: #2763ff;
  --primary-strong: #194cd0;
  --danger: #d33a3a;
  --shadow: 0 14px 28px rgba(31, 44, 77, 0.08);
}

* {
  box-sizing: border-box;
}

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
  font-family: "SUIT", "Noto Sans KR", "Apple SD Gothic Neo", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.admin-shell {
  max-width: 1640px;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  gap: 16px;
}

.admin-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 18px 20px;
}

.admin-header h1 {
  margin: 0;
  font-size: 24px;
}

.admin-header p {
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.btn {
  border: none;
  border-radius: 10px;
  height: 40px;
  line-height: 40px;
  padding: 0 14px;
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease;
}

.btn.primary {
  background: var(--primary);
  color: #fff;
}

.btn.primary:hover {
  background: var(--primary-strong);
}

.btn.ghost {
  background: #edf2ff;
  color: var(--primary);
}

.btn.ghost:hover {
  background: #dfe9ff;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.summary-card {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--card);
  box-shadow: var(--shadow);
  padding: 16px;
}

.summary-card .label {
  font-size: 13px;
  color: var(--muted);
}

.summary-card .value {
  margin-top: 6px;
  font-size: 28px;
  font-weight: 800;
}

.summary-card .value.small {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.45;
}

.admin-home-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.home-card {
  display: grid;
  gap: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: 430px 1fr;
  gap: 12px;
}

.review-page-layout {
  display: grid;
  grid-template-columns: 360px 1fr;
  gap: 12px;
}

.review-target-panel,
.review-main-panel {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.filter-box {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  display: grid;
  gap: 10px;
}

.filter-box label {
  display: grid;
  gap: 6px;
}

.filter-box span {
  font-size: 12px;
  color: var(--muted);
}

.filter-box input,
.filter-box select {
  width: 100%;
  height: 36px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 10px;
  font-size: 13px;
}

.target-list {
  padding: 10px;
  display: grid;
  gap: 8px;
  max-height: min(72vh, 860px);
  overflow: auto;
}

.target-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
  text-align: left;
  padding: 9px;
  display: grid;
  gap: 4px;
  cursor: pointer;
}

.target-item.active {
  border-color: #8ba7ef;
  background: #f4f8ff;
}

.target-title {
  font-size: 13px;
  font-weight: 800;
}

.target-sub {
  font-size: 12px;
  color: var(--muted);
}

.form-card,
.table-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: var(--card);
  box-shadow: var(--shadow);
}

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

.form-card h2 {
  margin: 0;
  font-size: 18px;
}

.meta-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.meta-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f4f8ff;
  color: #3156a1;
  font-size: 12px;
  font-weight: 700;
  padding: 0 10px;
}

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

.form-section {
  border: 1px solid #e8edf8;
  border-radius: 12px;
  padding: 10px;
  display: grid;
  gap: 8px;
  background: #fbfcff;
}

.form-section h3 {
  margin: 0;
  font-size: 14px;
}

.station-form label {
  display: grid;
  gap: 6px;
}

.station-form span {
  font-size: 12px;
  color: var(--muted);
}

.station-form input,
.station-form select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
}

.station-form input[readonly] {
  background: #f6f9ff;
  color: #60708c;
}

.station-form input:focus,
.station-form select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(39, 99, 255, 0.15);
}

.row-2 {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.row-3 {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.row-4 {
  display: grid;
  gap: 8px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.form-actions {
  display: flex;
  gap: 8px;
  margin-top: 4px;
}

.form-actions .btn {
  flex: 1;
}

.form-status {
  margin: 2px 0 0;
  font-size: 13px;
  color: var(--muted);
}

.station-inspector {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  background: #fdfefe;
  display: grid;
  gap: 10px;
}

.station-inspector.hidden {
  display: none;
}

.inspector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.inspector-head h3 {
  margin: 0;
  font-size: 15px;
}

.station-inspector dl {
  margin: 0;
  display: grid;
  gap: 6px;
}

.station-inspector dl > div {
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 8px;
  font-size: 12px;
}

.station-inspector dt {
  color: var(--muted);
  font-weight: 700;
}

.station-inspector dd {
  margin: 0;
  color: var(--text);
  word-break: break-word;
}

.review-admin-card {
  border-top: 1px solid var(--line);
  margin-top: 8px;
  padding: 14px 0 0;
  display: grid;
  gap: 10px;
}

.review-admin-head h3 {
  margin: 0;
  font-size: 16px;
}

.review-admin-head p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 13px;
}

.review-target-row {
  display: flex;
  gap: 8px;
  align-items: end;
}

.review-target-row label {
  display: grid;
  gap: 6px;
  flex: 1;
}

.review-target-row span {
  font-size: 12px;
  color: var(--muted);
}

.review-target-row select {
  width: 100%;
  height: 38px;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0 10px;
  font-size: 14px;
}

.review-target-row .btn {
  flex: 0 0 auto;
}

.review-edit-mode {
  border: 1px solid #d8e3ff;
  border-radius: 10px;
  padding: 8px 10px;
  background: #f0f5ff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.review-edit-mode.hidden {
  display: none;
}

.station-review-form {
  display: grid;
  gap: 8px;
}

.station-review-form label {
  display: grid;
  gap: 6px;
}

.station-review-form span {
  font-size: 12px;
  color: var(--muted);
}

.station-review-form input,
.station-review-form select,
.station-review-form textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 13px;
  font-family: inherit;
}

.station-review-form textarea {
  resize: vertical;
  min-height: 88px;
}

.compact-row {
  align-items: center;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.checkbox-row input {
  width: 16px;
  height: 16px;
}

.station-review-list {
  display: grid;
  gap: 8px;
  max-height: 330px;
  overflow: auto;
}

.review-item {
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 8px;
  display: grid;
  gap: 6px;
}

.review-item.is-hidden {
  opacity: 0.78;
  background: #fafafa;
}

.review-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.review-item-meta {
  font-size: 12px;
  color: var(--muted);
}

.review-hidden-badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  background: #fff0f0;
  color: #b22f2f;
  border: 1px solid #f2cccc;
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
}

.review-item-text {
  font-size: 13px;
  color: var(--text);
  white-space: pre-wrap;
}

.review-item img {
  width: 100%;
  max-height: 170px;
  object-fit: cover;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: #f3f6fc;
}

.review-item-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.table-card {
  display: flex;
  flex-direction: column;
  min-width: 0;
  padding-bottom: 10px;
}

.table-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
}

.table-head h2 {
  margin: 0;
  font-size: 18px;
}

.table-head.compact {
  padding: 12px;
}

.table-head.compact h2 {
  font-size: 16px;
}

.table-head p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.table-tools {
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-tools select {
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 8px;
  font-size: 13px;
}

.table-tools input {
  width: 260px;
  max-width: 48vw;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 9px;
  padding: 0 10px;
  font-size: 13px;
}

.table-tools input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(39, 99, 255, 0.15);
}

.table-wrap {
  overflow: auto;
  max-height: min(72vh, 860px);
  margin: 10px 12px 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.pagination-bar {
  margin: 8px 12px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.pagination-bar.compact {
  margin: 8px 10px;
}

.pagination-bar .btn {
  height: 32px;
  line-height: 32px;
  padding: 0 12px;
  font-size: 13px;
}

.pagination-bar .btn[disabled] {
  opacity: 0.45;
  cursor: not-allowed;
}

#pageInfoText,
#targetPageInfo,
#reviewPageInfo {
  min-width: 86px;
  text-align: center;
  font-size: 13px;
  color: #3d4f74;
  font-weight: 700;
}

.review-editor-box {
  margin: 10px 12px 0;
  border: 1px solid #dce5f7;
  border-radius: 12px;
  padding: 10px;
  background: #fbfdff;
  display: grid;
  gap: 8px;
}

.review-list-large {
  margin: 10px 12px 0;
  max-height: min(58vh, 640px);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1160px;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  vertical-align: top;
}

th {
  position: sticky;
  top: 0;
  background: #f9fbff;
  z-index: 1;
}

.tiny {
  color: var(--muted);
  font-size: 12px;
}

.cell-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cell-btn {
  border: none;
  border-radius: 7px;
  padding: 5px 9px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
}

.cell-btn.detail {
  background: #eafaf5;
  color: #177f57;
}

.cell-btn.edit {
  background: #e7efff;
  color: #1a53df;
}

.cell-btn.review {
  background: #f4ecff;
  color: #6b3ad3;
}

.cell-btn.delete {
  background: #ffecec;
  color: var(--danger);
}

.cell-btn.ghost {
  background: #eef3fb;
  color: #4b5e88;
}

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

  .review-page-layout {
    grid-template-columns: 1fr;
  }

  .form-card {
    max-height: none;
    position: static;
  }
}

@media (max-width: 900px) {
  .admin-header {
    flex-direction: column;
  }

  .table-head {
    flex-direction: column;
    align-items: stretch;
  }

  .table-tools {
    width: 100%;
    justify-content: space-between;
  }

  .table-tools input {
    width: 100%;
    max-width: none;
  }

  .table-wrap {
    margin: 8px 8px 0;
    max-height: min(64vh, 640px);
  }

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

  .admin-home-grid {
    grid-template-columns: 1fr;
  }

  .row-2,
  .row-3,
  .row-4 {
    grid-template-columns: 1fr;
  }

  .review-target-row {
    flex-direction: column;
    align-items: stretch;
  }

  .station-inspector dl > div {
    grid-template-columns: 1fr;
    gap: 2px;
  }

  .target-list {
    max-height: 320px;
  }

  .review-list-large {
    max-height: 420px;
  }
}

@media (min-width: 1381px) {
  .form-card {
    position: sticky;
    top: 12px;
    max-height: calc(100vh - 28px);
    overflow: auto;
  }
}
