.admin-page {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr);
  transition: grid-template-columns 160ms ease;
}

.admin-page.sidebar-collapsed {
  grid-template-columns: 76px minmax(0, 1fr);
}

.admin-sidebar {
  background: #17202a;
  color: #ffffff;
  padding: 18px 14px;
  display: grid;
  align-content: start;
  gap: 14px;
}

.sidebar-head {
  margin-bottom: 14px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: start;
}

.admin-sidebar .brand {
  min-width: 0;
}

.sidebar-toggle {
  width: 38px;
  height: 38px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  display: grid;
  place-items: center;
  cursor: pointer;
}

.sidebar-toggle:hover {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.nav-button,
.nav-link {
  min-height: 42px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 12px;
  text-decoration: none;
}

.admin-page.sidebar-collapsed .admin-sidebar {
  padding-inline: 12px;
}

.admin-page.sidebar-collapsed .sidebar-head {
  grid-template-columns: 1fr;
  justify-items: center;
}

.admin-page.sidebar-collapsed .brand,
.admin-page.sidebar-collapsed .nav-button,
.admin-page.sidebar-collapsed .nav-link {
  width: 46px;
  justify-content: center;
  padding-inline: 0;
}

.admin-page.sidebar-collapsed .sidebar-toggle {
  width: 46px;
}

.admin-page.sidebar-collapsed .sidebar-text {
  display: none;
}

.nav-link {
  background: transparent;
  color: #cbd5e1;
}

.admin-main {
  width: auto;
  min-width: 0;
  margin: 0;
  padding: 18px;
}

.admin-workspace {
  width: 100%;
}

.login-panel {
  max-width: 1280px;
  margin: 0 auto;
}

.login-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: var(--shadow);
}

.token-form {
  margin-top: 18px;
  display: flex;
  gap: 10px;
}

.token-form input,
.list-toolbar input,
.list-toolbar select,
.editor-panel input,
.editor-panel textarea,
.editor-panel select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--text);
}

.admin-header {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.admin-header p {
  color: var(--muted);
  margin-top: 6px;
}

.header-actions,
.form-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

.primary-button,
.ghost-button,
.danger-button {
  border: 0;
  border-radius: 8px;
  min-height: 42px;
  padding: 0 13px;
  display: inline-flex;
  gap: 8px;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.primary-button {
  background: var(--accent);
  color: #ffffff;
}

.primary-button:disabled,
.ghost-button:disabled {
  cursor: not-allowed;
  opacity: 0.5;
}

.ghost-button {
  background: #eef3f7;
  color: var(--text);
}

.danger-button {
  background: #fee4e2;
  color: #b42318;
}

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 3fr) minmax(0, 3fr) minmax(0, 4fr);
  gap: 12px;
  height: calc(100vh - 128px);
  min-height: 640px;
}

.github-panel,
.project-list-panel,
.editor-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  min-width: 0;
  min-height: 0;
}

.github-panel,
.project-list-panel {
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.import-panel {
  padding: 12px;
  display: flex;
  flex: 1;
  min-height: 0;
  flex-direction: column;
  gap: 8px;
}

.import-panel label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.import-panel input {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 10px;
  background: #ffffff;
  color: var(--text);
}

.import-panel .primary-button {
  width: 100%;
}

.repo-picker-meta {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 12px;
}

.repo-picker-meta .ghost-button {
  min-height: 34px;
  padding: 0 10px;
  font-size: 12px;
}

.repo-results {
  flex: 1;
  min-height: 0;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfcfd;
}

.repo-result {
  position: relative;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  padding: 10px 84px 10px 14px;
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.repo-result:last-child {
  border-bottom: 0;
}

.repo-result:hover,
.repo-result.active {
  background: #eef7f4;
}

.repo-result.active,
.admin-list-item.active {
  background: linear-gradient(90deg, rgba(15, 118, 110, 0.14), rgba(255, 255, 255, 0.96) 72%);
  box-shadow: inset 0 0 0 1px rgba(15, 118, 110, 0.28);
}

.repo-result.active::before,
.admin-list-item.active::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--accent);
}

.repo-result.active::after,
.admin-list-item.active::after {
  content: "Selected";
  position: absolute;
  top: 10px;
  right: 10px;
  border-radius: 999px;
  padding: 3px 7px;
  background: rgba(15, 118, 110, 0.12);
  color: var(--accent);
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
}

.repo-result.active strong,
.admin-list-item.active strong {
  color: #0f5f59;
}

.repo-result strong {
  min-width: 0;
  color: var(--text);
  font-size: 13px;
  overflow-wrap: anywhere;
}

.repo-result span,
.repo-result small,
.repo-empty {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.repo-result small {
  overflow-wrap: anywhere;
}

.repo-empty {
  padding: 14px 12px;
}

.panel-header {
  padding: 12px 12px 8px;
  border-bottom: 1px solid var(--line);
}

.panel-header h2 {
  font-size: 15px;
  line-height: 1.25;
  margin: 0;
}

.panel-header span {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
}

.list-toolbar {
  padding: 10px 12px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 104px;
  gap: 8px;
  border-bottom: 1px solid var(--line);
}

.admin-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
}

.admin-list-item {
  position: relative;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: #ffffff;
  width: 100%;
  padding: 13px 84px 13px 16px;
  display: grid;
  gap: 5px;
  text-align: left;
  cursor: pointer;
}

.admin-list-item:hover {
  background: #f3f8f7;
}

.admin-list-item.flash {
  animation: deployment-pulse 1100ms ease;
}

@keyframes deployment-pulse {
  0% {
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0);
  }
  28% {
    background: #dcf7ee;
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0.85);
  }
  100% {
    box-shadow: inset 0 0 0 2px rgba(15, 118, 110, 0);
  }
}

.admin-list-item strong {
  color: var(--text);
}

.admin-list-item span {
  color: var(--muted);
  font-size: 12px;
}

.editor-panel {
  padding: 16px;
  overflow: auto;
}

.editor-panel form {
  min-height: 100%;
  display: flex;
  flex-direction: column;
}

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

.form-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.form-grid .full {
  grid-column: 1 / -1;
}

.editor-panel textarea {
  resize: vertical;
}

.editor-panel textarea[name="summary"] {
  height: 64px;
}

.editor-panel textarea[name="description"] {
  height: 88px;
}

.checkbox-label {
  align-content: end;
  grid-template-columns: auto 1fr;
  display: flex !important;
  align-items: center;
  gap: 8px !important;
}

.checkbox-label input {
  width: auto;
  min-height: auto;
}

.form-actions {
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 12px;
  position: sticky;
  bottom: 0;
  z-index: 2;
  background: linear-gradient(to bottom, rgba(255, 255, 255, 0.84), #ffffff 32%);
  border-top: 1px solid transparent;
}

.form-message {
  min-height: 22px;
  margin-top: 10px;
  color: var(--muted);
}

.modal-layer {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(23, 32, 42, 0.44);
}

.modal-layer[hidden] {
  display: none;
}

.modal-card {
  width: min(980px, calc(100vw - 48px));
  max-height: calc(100vh - 48px);
  overflow: auto;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 28px 70px rgba(15, 23, 42, 0.22);
}

.modal-header {
  padding: 16px 18px 12px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.modal-header h2 {
  font-size: 18px;
  line-height: 1.25;
  margin: 0;
}

.modal-header p {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.modal-card form {
  padding: 16px 18px 18px;
}

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

.modal-grid label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
}

.modal-grid input,
.modal-grid textarea,
.modal-grid select {
  width: 100%;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--text);
}

.modal-grid .full {
  grid-column: 1 / -1;
}

.modal-actions {
  margin-top: 12px;
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ── 썸네일 프리뷰 ──────────────────────────────── */
.thumb-input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.thumb-input-row input {
  flex: 1;
  min-width: 0;
}

.thumb-input-row .ghost-button {
  min-height: 42px;
  padding: 0 14px;
  font-size: 13px;
  white-space: nowrap;
  flex-shrink: 0;
}

.thumb-preview {
  margin-top: 8px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--line);
  height: 150px;
  background: #f4f5f7;
}

.thumb-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

@media (max-width: 1400px) {
  .admin-page {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .admin-page.sidebar-collapsed {
    grid-template-columns: 76px minmax(0, 1fr);
  }

  .admin-layout {
    grid-template-columns: minmax(320px, 3fr) minmax(0, 7fr);
  }

  .github-panel {
    grid-row: span 2;
  }

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

@media (max-width: 980px) {
  .admin-page,
  .admin-layout {
    grid-template-columns: 1fr;
  }

  .admin-page.sidebar-collapsed {
    grid-template-columns: 1fr;
  }

  .admin-layout {
    height: auto;
    min-height: 0;
  }

  .repo-results,
  .admin-list {
    max-height: 360px;
  }

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