:root {
  color-scheme: light;
  --bg: #f6f3ee;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #6b7280;
  --line: #d9d4c9;
  --casehug: #85c440;
  --casehug-dark: #4d8f20;
  --main: #246bfe;
  --second: #ff9700;
  --danger: #c44949;
  --shadow: 0 16px 40px rgba(31, 41, 51, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  display: flex;
  flex-direction: column;
  gap: 24px;
  padding: 28px 22px;
  background: #141c24;
  color: #f9fafb;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 42px;
  height: 42px;
  place-items: center;
  border-radius: 8px;
  background: var(--casehug);
  color: #10200a;
  font-weight: 900;
}

.brand p,
.brand span {
  margin: 0;
}

.brand p {
  font-size: 18px;
  font-weight: 800;
}

.brand span,
.eyebrow,
.side-panel span {
  color: #9ca3af;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.nav-tabs {
  display: grid;
  gap: 8px;
}

.nav-tab {
  width: 100%;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 12px 14px;
  background: transparent;
  color: #d1d5db;
  text-align: left;
}

.nav-tab.is-active,
.nav-tab:hover {
  border-color: rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.side-panel {
  display: grid;
  gap: 14px;
  margin-top: auto;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 8px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.06);
}

.side-panel strong {
  font-size: 24px;
}

.target-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.target-row b {
  color: #ffffff;
}

.main {
  min-width: 0;
  padding: 32px;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 26px;
}

h1,
h2,
h3 {
  margin: 0;
  line-height: 1.1;
}

h1 {
  margin-top: 5px;
  font-size: clamp(34px, 5vw, 56px);
}

h2 {
  font-size: 22px;
}

h3 {
  font-size: 16px;
}

.top-actions,
.toolbar,
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.select-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-weight: 700;
}

select,
input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #ffffff;
  color: var(--ink);
}

.primary-button,
.secondary-button,
.casehug-button,
.not-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  padding: 0 14px;
  font-weight: 800;
}

.primary-button,
.casehug-button.is-selected {
  background: var(--casehug);
  color: #10200a;
}

.secondary-button,
.not-button,
.casehug-button {
  border-color: var(--line);
  background: #ffffff;
  color: var(--ink);
}

.secondary-button:hover,
.casehug-button:hover,
.not-button:hover {
  border-color: #a9a297;
}

.secondary-button.danger,
.not-button.is-selected {
  border-color: rgba(196, 73, 73, 0.3);
  background: #fff2f2;
  color: var(--danger);
}

.view {
  display: none;
}

.view.is-visible {
  display: block;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 20px;
}

.summary-card,
.section-band,
.manual-form,
.completed-panel,
.video-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.summary-card {
  display: grid;
  gap: 10px;
  padding: 18px;
}

.summary-card strong {
  font-size: 32px;
}

.summary-card span {
  color: var(--muted);
  font-weight: 700;
}

.progress-track {
  height: 8px;
  overflow: hidden;
  border-radius: 999px;
  background: #ebe7df;
}

.progress-bar {
  height: 100%;
  border-radius: inherit;
  background: var(--casehug);
}

.section-band {
  padding: 20px;
}

.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.section-heading.compact {
  margin-bottom: 14px;
}

.sync-pill,
.channel-chip,
.status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  background: #eef2f7;
  color: #44515f;
  font-size: 12px;
  font-weight: 800;
}

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

.month-card {
  display: grid;
  gap: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: #fffdf9;
}

.month-card.is-complete {
  border-color: rgba(77, 143, 32, 0.3);
}

.month-top {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.month-rows {
  display: grid;
  gap: 8px;
}

.month-row {
  display: grid;
  grid-template-columns: 74px 1fr auto;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.mini-bar {
  height: 7px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e4dc;
}

.mini-fill {
  height: 100%;
  border-radius: inherit;
}

.mini-fill.main-fill {
  background: var(--main);
}

.mini-fill.second-fill {
  background: var(--second);
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 16px;
}

.search-wrap {
  display: flex;
  align-items: center;
  min-width: min(420px, 100%);
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding-left: 12px;
  background: #ffffff;
}

.search-wrap input {
  width: 100%;
  border: 0;
}

.search-wrap input:focus {
  outline: none;
}

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

.video-card {
  overflow: hidden;
}

.thumb-link {
  display: block;
  aspect-ratio: 16 / 9;
  background: #d8dde4;
}

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

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

.video-meta,
.video-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.video-meta time {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.channel-chip.main-chip {
  background: rgba(36, 107, 254, 0.12);
  color: #174cad;
}

.channel-chip.second-chip {
  background: rgba(255, 151, 0, 0.16);
  color: #9b5a00;
}

.video-actions button {
  flex: 1;
}

.completed-layout {
  display: grid;
  grid-template-columns: minmax(260px, 380px) minmax(0, 1fr);
  gap: 18px;
}

.manual-form,
.completed-panel {
  padding: 18px;
}

.manual-form {
  display: grid;
  align-content: start;
  gap: 13px;
}

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

.completed-list {
  display: grid;
  gap: 8px;
  max-height: 680px;
  overflow: auto;
  padding-right: 4px;
}

.completed-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  background: #fffdf9;
}

.completed-item a,
.completed-item span {
  overflow: hidden;
  color: var(--ink);
  font-weight: 800;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.completed-item small {
  color: var(--muted);
  font-weight: 700;
}

.remove-button {
  min-width: 34px;
  height: 34px;
  border: 1px solid rgba(196, 73, 73, 0.3);
  border-radius: 8px;
  background: #fff2f2;
  color: var(--danger);
  font-weight: 900;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  font-weight: 800;
}

@media (max-width: 1100px) {
  .summary-grid,
  .month-grid,
  .video-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 820px) {
  .app-shell,
  .completed-layout {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    gap: 16px;
    padding: 18px;
  }

  .nav-tabs {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }

  .nav-tab {
    text-align: center;
  }

  .side-panel {
    margin-top: 0;
  }

  .main {
    padding: 22px 16px;
  }

  .topbar,
  .section-heading {
    flex-direction: column;
  }
}

@media (max-width: 620px) {
  .summary-grid,
  .month-grid,
  .video-grid {
    grid-template-columns: 1fr;
  }

  .top-actions,
  .toolbar {
    align-items: stretch;
  }

  .top-actions > *,
  .toolbar > * {
    width: 100%;
  }

  .select-wrap {
    justify-content: space-between;
  }
}
