:root {
  color-scheme: light;
  --bg: #f6f7f4;
  --surface: #ffffff;
  --surface-strong: #f0f5f3;
  --ink: #17201c;
  --muted: #607069;
  --line: #d8e0dc;
  --teal: #0f766e;
  --teal-dark: #0b5f59;
  --amber: #b7791f;
  --blue: #2563eb;
  --rose: #be123c;
  --shadow: 0 16px 40px rgba(23, 32, 28, 0.08);
  font-family: Inter, "Segoe UI", "Noto Sans KR", system-ui, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

body {
  min-height: 100%;
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-size: 15px;
  letter-spacing: 0;
}

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

button {
  cursor: pointer;
}

a {
  color: inherit;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  min-height: 64px;
  padding: 0 28px;
  border-bottom: 1px solid rgba(216, 224, 220, 0.9);
  background: rgba(246, 247, 244, 0.92);
  backdrop-filter: blur(16px);
}

.brand,
.topnav {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand {
  font-weight: 800;
}

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 8px;
  background: var(--teal);
  color: #fff;
}

.topnav a {
  min-height: 36px;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  font-weight: 700;
}

.page-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0 56px;
}

.hero-band {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.hero-band.compact {
  align-items: center;
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--teal);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 32px;
  line-height: 1.18;
}

h2 {
  margin-bottom: 0;
  font-size: 18px;
  line-height: 1.25;
}

h3 {
  margin-bottom: 6px;
  font-size: 16px;
  line-height: 1.35;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.hero-stats span,
.status-pill,
.tag,
.state-label {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 5px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-strong);
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.status-pill {
  background: #edf7f5;
  color: var(--teal-dark);
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1.4fr) minmax(180px, 0.9fr) auto;
  gap: 12px;
  align-items: end;
  margin: 16px 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.request-band {
  margin: 0 0 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.request-form {
  display: grid;
  grid-template-columns: minmax(180px, 1fr) minmax(160px, 0.75fr) minmax(160px, 1fr) auto minmax(90px, 0.55fr);
  gap: 12px;
  align-items: end;
  padding: 16px;
}

.field {
  display: grid;
  gap: 7px;
}

.field span,
.check-field span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

input,
select,
textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 9px 11px;
  outline: none;
}

textarea {
  min-height: 72px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--teal);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.14);
}

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

.segmented button,
.ghost-button,
.primary-button,
.danger-button,
.icon-button {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  font-weight: 800;
}

.segmented button {
  padding: 8px 12px;
}

.segmented button.is-active {
  border-color: var(--teal);
  background: #e7f4f1;
  color: var(--teal-dark);
}

.primary-button,
.ghost-button,
.danger-button {
  padding: 9px 14px;
}

.action-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.primary-button {
  border-color: var(--teal);
  background: var(--teal);
  color: #fff;
}

.primary-button:hover {
  background: var(--teal-dark);
}

.ghost-button {
  background: var(--surface-strong);
  color: var(--muted);
}

.danger-button {
  border-color: rgba(190, 18, 60, 0.24);
  background: #fff1f2;
  color: var(--rose);
}

.icon-button {
  display: inline-grid;
  width: 42px;
  padding: 0;
  place-items: center;
  color: var(--teal);
}

.workspace {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

.folder-panel,
.video-panel,
.admin-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  box-shadow: var(--shadow);
}

.folder-panel {
  align-self: start;
  position: sticky;
  top: 82px;
}

.panel-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px;
  border-bottom: 1px solid var(--line);
}

.result-heading {
  align-items: center;
}

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

.folder-list {
  display: grid;
  gap: 4px;
  padding: 10px;
}

.folder-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 42px;
  width: 100%;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--ink);
  padding: 8px 10px;
  text-align: left;
}

.folder-button:hover,
.folder-button.is-active {
  background: var(--surface-strong);
}

.folder-button.is-child {
  padding-left: 24px;
}

.folder-button .count {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 14px;
  padding: 16px;
}

.video-card {
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.thumb-wrap {
  position: relative;
  aspect-ratio: 16 / 9;
  background: #dfe7e3;
}

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

.duration {
  position: absolute;
  right: 8px;
  bottom: 8px;
  padding: 3px 7px;
  border-radius: 6px;
  background: rgba(23, 32, 28, 0.84);
  color: #fff;
  font-size: 12px;
  font-weight: 800;
}

.video-card-body {
  display: grid;
  gap: 10px;
  padding: 14px;
}

.video-title {
  display: -webkit-box;
  min-height: 44px;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.meta-line {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  min-height: 26px;
  padding: 4px 8px;
  background: #f8faf9;
  font-size: 12px;
}

.external-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  border-radius: 8px;
  background: #17201c;
  color: #fff;
  font-weight: 800;
}

.empty-state {
  padding: 28px;
  color: var(--muted);
}

.admin-layout {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin: 16px 0;
}

.admin-section {
  display: grid;
  gap: 14px;
  padding: 16px;
}

.admin-section .panel-heading {
  margin: -16px -16px 0;
}

.admin-section.wide {
  grid-column: 1 / -1;
}

.admin-section.full {
  margin-top: 16px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1.2fr 1fr 0.6fr auto;
  gap: 12px;
  align-items: end;
}

.manual-grid {
  grid-template-columns: 1.4fr 1.1fr 0.9fr 0.7fr;
}

.manual-grid.secondary {
  grid-template-columns: 0.8fr 0.8fr 1.4fr;
}

.span-2 {
  grid-column: span 1;
}

.check-field {
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 42px;
}

.check-field input {
  width: 18px;
  min-height: 18px;
}

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

.compact-select {
  width: auto;
  min-width: 116px;
}

.admin-video-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.category-manage-list {
  display: grid;
  gap: 12px;
  padding: 16px;
}

.category-row {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.category-row-main {
  display: grid;
  grid-template-columns: auto minmax(180px, 1fr) minmax(150px, 0.8fr) minmax(130px, 0.65fr) minmax(90px, 0.45fr);
  gap: 10px;
  align-items: end;
}

.admin-video {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 12px;
}

.admin-video .thumb-wrap {
  border-radius: 8px;
  overflow: hidden;
}

.admin-video-main {
  display: grid;
  gap: 10px;
}

.admin-controls {
  display: grid;
  grid-template-columns: minmax(140px, 0.8fr) minmax(180px, 1fr) minmax(160px, 1fr);
  gap: 10px;
}

.state-label[data-state="published"] {
  background: #e7f4f1;
  color: var(--teal-dark);
}

.state-label[data-state="candidate"] {
  background: #fff7ed;
  color: var(--amber);
}

.state-label[data-state="hidden"] {
  background: #eef2ff;
  color: var(--blue);
}

.state-label[data-state="blocked"] {
  background: #fff1f2;
  color: var(--rose);
}

@media (max-width: 900px) {
  .filters,
  .request-form,
  .workspace,
  .admin-layout,
  .form-grid,
  .admin-video,
  .admin-controls,
  .category-row-main {
    grid-template-columns: 1fr;
  }

  .folder-panel {
    position: static;
  }

  .hero-band {
    align-items: start;
    flex-direction: column;
  }
}

@media (max-width: 560px) {
  .topbar {
    padding: 0 16px;
  }

  .page-shell {
    width: min(100% - 20px, 1180px);
    padding-top: 16px;
  }

  .hero-band,
  .filters,
  .panel-heading,
  .admin-section,
  .video-grid,
  .admin-video-list {
    padding: 12px;
  }

  h1 {
    font-size: 25px;
  }

  .brand span:last-child {
    display: none;
  }
}
