:root {
  --bg: #f3f7f1;
  --panel: #fffef9;
  --text: #19222f;
  --muted: #5f6a77;
  --line: #d9e1d6;
  --ok: #147a40;
  --bad: #a83232;
  --accent: #1f7a8c;
  --accent-2: #dca64c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", "Avenir Next", "Helvetica Neue", sans-serif;
  color: var(--text);
  background: linear-gradient(155deg, #edf6f0 0%, #f5efe0 100%);
  overflow-x: hidden;
}

.background-shape {
  position: fixed;
  border-radius: 50%;
  filter: blur(80px);
  opacity: 0.4;
  pointer-events: none;
}

.bg-one {
  width: 380px;
  height: 380px;
  background: #8ecae6;
  top: -120px;
  right: -120px;
}

.bg-two {
  width: 320px;
  height: 320px;
  background: #ffd166;
  left: -80px;
  bottom: -80px;
}

.layout {
  position: relative;
  max-width: 1100px;
  margin: 0 auto;
  padding: 28px 18px 36px;
  z-index: 1;
}

.hero h1 {
  margin: 0;
  font-size: clamp(1.7rem, 3.5vw, 2.6rem);
  letter-spacing: 0.02em;
}

.hero p {
  margin: 10px 0 0;
  color: var(--muted);
}

.main-tabs {
  display: flex;
  gap: 10px;
  margin-top: 18px;
  flex-wrap: wrap;
}

.main-tab {
  min-height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 0.9rem;
  cursor: pointer;
}

.main-tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, #1a759f, #34a0a4);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 8px 18px rgba(26, 117, 159, 0.2);
}

.panel {
  margin-top: 18px;
  background: color-mix(in srgb, var(--panel) 92%, #ffffff);
  border: 1px solid color-mix(in srgb, var(--line) 70%, #ffffff);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(17, 36, 58, 0.12);
  padding: 16px;
  animation: rise 0.45s ease;
}

.panel-hidden {
  display: none;
}

.toolbar {
  display: flex;
  gap: 12px;
  align-items: end;
  justify-content: space-between;
  flex-wrap: wrap;
}

.control {
  display: grid;
  gap: 6px;
}

.control span {
  font-size: 0.88rem;
  color: var(--muted);
}

select,
.btn {
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 12px;
  font: inherit;
}

select {
  min-width: 180px;
}

.btn {
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent), #2d728f);
  border: none;
  color: #f7fbfd;
  font-weight: 600;
}

.btn-alt {
  background: #ffffff;
  color: var(--text);
  border: 1px solid var(--line);
}

.btn-alt:hover {
  background: #f3f8fc;
}

.meta {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  margin: 14px 0 10px;
  align-items: center;
  flex-wrap: wrap;
}

.tabs {
  display: flex;
  gap: 8px;
  margin: 8px 0 12px;
  flex-wrap: wrap;
}

.tab {
  height: 34px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  color: var(--text);
  padding: 0 14px;
  font: inherit;
  font-size: 0.88rem;
  cursor: pointer;
}

.tab.active {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent), #2d728f);
  color: #ffffff;
  font-weight: 600;
}

.panel-title-row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.panel-title-row h2 {
  margin: 0;
  font-size: 1.16rem;
}

.hint {
  color: var(--muted);
  font-size: 0.84rem;
}

.info-toolbar {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  flex-wrap: wrap;
}

.muted {
  color: var(--muted);
}

.info-output {
  margin-top: 10px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
}

.info-empty {
  margin: 0;
  padding: 12px;
  color: var(--muted);
}

.data-table-wrap {
  overflow: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 620px;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  border-bottom: 1px solid #ebf0ea;
  text-align: left;
  font-size: 0.9rem;
}

.data-table th {
  background: #f4f8f5;
  color: #304255;
  font-weight: 600;
}

.unlisted-grid {
  display: grid;
  gap: 10px;
  padding: 10px;
}

.unlisted-item {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #fffefb;
}

.unlisted-media-link {
  display: block;
  margin-bottom: 8px;
}

.unlisted-thumb {
  width: 100%;
  max-height: 220px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #e8ece6;
  background: #ffffff;
}

.unlisted-head {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
  margin-bottom: 6px;
}

.pill {
  display: inline-flex;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  border: 1px solid var(--line);
  background: #ffffff;
}

.unlisted-lines {
  display: grid;
  gap: 3px;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: 0.88rem;
}

.unlisted-actions {
  margin-top: 10px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.mini-btn {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #ffffff;
  color: var(--text);
  padding: 6px 9px;
  cursor: pointer;
  font: inherit;
  font-size: 0.82rem;
}

.mini-btn:hover {
  background: #f2f7f4;
}

.item-link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

.item-link:hover {
  text-decoration: underline;
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #ffffff;
  font-size: 0.85rem;
}

.badge.off {
  color: var(--bad);
  border-color: color-mix(in srgb, var(--bad) 40%, #fff);
}

.table-wrap {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #ffffff;
}

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

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid #ebf0ea;
  font-size: 0.92rem;
}

th {
  background: #f4f8f5;
  color: #304255;
  font-weight: 600;
}

tr.disabled {
  background: #fff3f3;
}

.status-label {
  font-size: 0.8rem;
  padding: 4px 8px;
  border-radius: 999px;
  color: #fff;
  font-weight: 600;
}

.status-label.on {
  background: var(--ok);
}

.status-label.off {
  background: var(--bad);
}

.switch {
  position: relative;
  display: inline-block;
  width: 48px;
  height: 28px;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  inset: 0;
  border-radius: 40px;
  background: #cdd7ca;
  transition: 0.18s ease;
}

.slider::before {
  content: "";
  position: absolute;
  height: 22px;
  width: 22px;
  left: 3px;
  top: 3px;
  border-radius: 50%;
  background: #ffffff;
  transition: 0.18s ease;
}

.switch input:checked + .slider {
  background: linear-gradient(135deg, var(--accent-2), #ee964b);
}

.switch input:checked + .slider::before {
  transform: translateX(20px);
}

.enabled-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}

.empty-state {
  text-align: center;
  color: var(--muted);
  padding: 16px;
}

.error {
  margin: 12px 0 0;
  color: #a83232;
}

.hidden {
  display: none;
}

@keyframes rise {
  from {
    transform: translateY(8px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

@media (max-width: 720px) {
  .layout {
    padding: 20px 12px 24px;
  }

  .panel {
    padding: 12px;
  }

  .hero p {
    font-size: 0.92rem;
  }

  .main-tabs {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
  }

  .main-tab {
    width: 100%;
  }

  .toolbar {
    align-items: stretch;
  }

  .control {
    width: 100%;
  }

  select,
  .btn {
    width: 100%;
    min-height: 42px;
  }

  .tabs {
    flex-wrap: nowrap;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 4px;
    margin-bottom: 10px;
  }

  .tab {
    flex: 0 0 auto;
    min-height: 40px;
    font-size: 0.84rem;
    white-space: nowrap;
  }

  .table-wrap {
    overflow: visible;
    border: none;
    background: transparent;
  }

  table {
    min-width: 0;
  }

  thead {
    display: none;
  }

  tbody {
    display: grid;
    gap: 10px;
  }

  tbody tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: #ffffff;
    overflow: hidden;
  }

  tbody tr.disabled {
    background: #fff3f3;
    border-color: #f1d3d3;
  }

  td {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #ebf0ea;
    padding: 10px 12px;
    font-size: 0.9rem;
  }

  td:last-child {
    border-bottom: none;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.73rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
  }

  .enabled-cell .switch {
    width: 56px;
    height: 32px;
  }

  .enabled-cell .slider::before {
    width: 26px;
    height: 26px;
  }

  .enabled-cell .switch input:checked + .slider::before {
    transform: translateX(24px);
  }

  .empty-state {
    justify-content: center;
    text-align: center;
  }

  .empty-state::before {
    content: none;
  }

  .info-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  .info-toolbar .btn {
    width: 100%;
  }

  .data-table {
    min-width: 0;
  }

  .data-table-wrap {
    overflow: visible;
  }

  .data-table thead {
    display: none;
  }

  .data-table tbody {
    display: grid;
    gap: 10px;
    padding: 10px;
  }

  .data-table tr {
    display: block;
    border: 1px solid var(--line);
    border-radius: 12px;
    overflow: hidden;
  }

  .data-table td {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    border-bottom: 1px solid #ebf0ea;
  }

  .data-table td:last-child {
    border-bottom: none;
  }

  .data-table td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 0.73rem;
    letter-spacing: 0.02em;
    text-transform: uppercase;
    font-weight: 600;
  }
}
