:root {
  --bg: #eef5f7;
  --bg-deep: #dcecf0;
  --surface: rgba(255, 255, 255, 0.9);
  --surface-strong: rgba(255, 255, 255, 0.96);
  --ink: #0b2341;
  --ink-soft: #4f657d;
  --brand-navy: #0b2341;
  --brand-teal: #59c0d1;
  --brand-teal-deep: #288190;
  --brand-magenta: #aa1b5e;
  --brand-coral: #ff5353;
  --brand-orange: #f56802;
  --accent: var(--brand-teal);
  --accent-strong: var(--brand-teal-deep);
  --accent-soft: rgba(89, 192, 209, 0.14);
  --line: rgba(11, 35, 65, 0.12);
  --shadow: 0 24px 60px rgba(11, 35, 65, 0.14);
  --radius-lg: 26px;
  --radius-md: 18px;
  --radius-sm: 12px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: 'Work Sans', 'Segoe UI', sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(89, 192, 209, 0.34), transparent 28%),
    radial-gradient(circle at top right, rgba(170, 27, 94, 0.18), transparent 22%),
    linear-gradient(180deg, #f7fbfc 0%, var(--bg) 48%, var(--bg-deep) 100%);
}

body::before {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  background-image:
    linear-gradient(rgba(11, 35, 65, 0.025) 1px, transparent 1px),
    linear-gradient(90deg, rgba(11, 35, 65, 0.025) 1px, transparent 1px);
  background-size: 34px 34px;
  mask-image: linear-gradient(180deg, rgba(0, 0, 0, 0.18), transparent 75%);
}

.page-shell {
  position: relative;
  max-width: 1240px;
  margin: 0 auto;
  padding: 32px 20px 64px;
}

.hero,
.control-panel,
.table-card {
  backdrop-filter: blur(16px);
}

.hero {
  margin-bottom: 24px;
}

.hero-copy,
.collection-panel,
.control-panel,
.table-card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.56);
  box-shadow: var(--shadow);
}

.hero-copy {
  position: relative;
  padding: 32px;
  border-radius: var(--radius-lg);
  color: #ffffff;
  background:
    radial-gradient(circle at top right, rgba(89, 192, 209, 0.28), transparent 32%),
    linear-gradient(135deg, #0b2341 0%, #13385f 54%, #1a496f 100%);
  overflow: hidden;
}

.hero-copy::after {
  content: '';
  position: absolute;
  inset: auto -8% -32% auto;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(89, 192, 209, 0.34) 0%, rgba(89, 192, 209, 0) 70%);
  pointer-events: none;
}

.eyebrow,
.section-kicker {
  margin: 0 0 12px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  font-size: 0.78rem;
  color: var(--accent-strong);
}

.hero-copy .eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

h1,
h2,
h3 {
  margin: 0;
  font-family: 'Fraunces', Georgia, serif;
  line-height: 1.05;
}

h1 {
  font-size: clamp(2.4rem, 4vw, 4.3rem);
  max-width: 12ch;
}

h2 {
  font-size: clamp(1.6rem, 2vw, 2.3rem);
}

.hero-text,
.empty-state p,
.status-message,
.table-summary,
.selection-summary {
  color: var(--ink-soft);
}

.hero-copy h1,
.hero-copy .hero-text {
  position: relative;
  z-index: 1;
}

.hero-text {
  max-width: 58ch;
  margin: 18px 0 0;
  font-size: 1.05rem;
  line-height: 1.7;
}

.hero-copy .hero-text {
  color: rgba(255, 255, 255, 0.86);
}

.brand-logo {
  position: relative;
  z-index: 1;
  display: block;
  width: min(280px, 100%);
  margin-bottom: 22px;
}

.library-layout {
  display: grid;
  gap: 24px;
}

.collection-panel,
.control-panel,
.table-card {
  border-radius: var(--radius-lg);
  padding: 24px;
}

.collection-panel {
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.94), rgba(248, 252, 252, 0.92)),
    var(--surface);
}

.collection-header {
  margin-bottom: 20px;
}

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

.subcategory-panel {
  margin-top: 20px;
  padding-top: 20px;
  border-top: 1px solid rgba(11, 35, 65, 0.08);
}

.subcategory-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.subcategory-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.collection-card {
  display: grid;
  gap: 10px;
  min-height: 154px;
  padding: 20px;
  border: 1px solid rgba(11, 35, 65, 0.08);
  border-radius: 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.96), rgba(237, 247, 249, 0.92));
  color: var(--brand-navy);
  text-align: left;
  box-shadow: 0 12px 28px rgba(11, 35, 65, 0.08);
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.collection-card:hover {
  transform: translateY(-2px);
  border-color: rgba(89, 192, 209, 0.55);
  box-shadow: 0 18px 34px rgba(11, 35, 65, 0.12);
}

.collection-card[data-active='true'] {
  color: #ffffff;
  border-color: transparent;
  background:
    linear-gradient(135deg, var(--brand-magenta) 0%, #c23374 52%, var(--brand-teal-deep) 100%);
  box-shadow: 0 18px 34px rgba(170, 27, 94, 0.24);
}

.collection-card strong {
  font-family: 'Fraunces', Georgia, serif;
  font-size: 1.26rem;
  line-height: 1.1;
}

.collection-card span:last-child {
  font-size: 0.94rem;
  line-height: 1.45;
  color: var(--ink-soft);
}

.collection-card[data-active='true'] span:last-child,
.collection-card[data-active='true'] .collection-eyebrow {
  color: rgba(255, 255, 255, 0.82);
}

.collection-eyebrow {
  font-size: 0.74rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--brand-teal-deep);
}

.subcategory-card {
  min-height: 48px;
  padding: 0 18px;
  border: 1px solid rgba(11, 35, 65, 0.1);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.96);
  color: var(--brand-navy);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    border-color 160ms ease,
    background 160ms ease;
}

.subcategory-card:hover {
  transform: translateY(-1px);
  border-color: rgba(89, 192, 209, 0.52);
  box-shadow: 0 12px 24px rgba(11, 35, 65, 0.08);
}

.subcategory-card[data-active='true'] {
  border-color: transparent;
  background: linear-gradient(135deg, var(--brand-teal) 0%, var(--brand-teal-deep) 100%);
  color: #ffffff;
}

.filter-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) repeat(2, minmax(180px, 1fr));
  gap: 16px;
}

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

.field span {
  font-size: 0.92rem;
  font-weight: 600;
}

.field input,
.field select,
.button {
  border-radius: 999px;
  border: 1px solid var(--line);
  font: inherit;
}

.field input,
.field select {
  width: 100%;
  min-height: 50px;
  padding: 0 16px;
  background: var(--surface-strong);
  color: var(--ink);
}

.field input:focus,
.field select:focus,
.button:focus {
  outline: 2px solid rgba(89, 192, 209, 0.32);
  outline-offset: 2px;
}

.action-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin: 20px 0 16px;
}

.selection-summary {
  font-weight: 600;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.button {
  min-height: 48px;
  padding: 0 18px;
  cursor: pointer;
  font-weight: 600;
  transition:
    transform 160ms ease,
    box-shadow 160ms ease,
    background 160ms ease;
}

.button:hover:not(:disabled) {
  transform: translateY(-1px);
}

.button:disabled {
  cursor: wait;
  opacity: 0.55;
  transform: none;
}

.button-primary {
  background: linear-gradient(135deg, var(--brand-magenta) 0%, #c03273 100%);
  border-color: transparent;
  color: #ffffff;
  box-shadow: 0 18px 34px rgba(170, 27, 94, 0.22);
}

.button-secondary {
  background: var(--brand-navy);
  border-color: transparent;
  color: #ffffff;
}

.button-ghost {
  background: transparent;
  color: var(--ink);
}

.status-panel {
  display: grid;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.64);
  border: 1px solid rgba(25, 51, 45, 0.08);
}

.status-message {
  margin: 0;
  font-size: 0.95rem;
}

.status-message[data-tone='error'] {
  color: #9b1c1c;
}

.status-message[data-tone='success'] {
  color: var(--accent-strong);
}

.progress-shell {
  display: grid;
  gap: 8px;
}

.progress-label {
  font-size: 0.9rem;
  color: var(--ink-soft);
}

progress {
  width: 100%;
  height: 10px;
  border: none;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(25, 51, 45, 0.08);
}

progress::-webkit-progress-bar {
  background: rgba(25, 51, 45, 0.08);
}

progress::-webkit-progress-value {
  background: linear-gradient(90deg, var(--brand-teal) 0%, var(--brand-teal-deep) 100%);
}

progress::-moz-progress-bar {
  background: linear-gradient(90deg, var(--brand-teal) 0%, var(--brand-teal-deep) 100%);
}

.table-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 18px;
}

.table-summary {
  margin: 0;
  font-size: 0.95rem;
}

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

.library-table {
  width: 100%;
  border-collapse: collapse;
  border-radius: var(--radius-md);
  overflow: hidden;
}

.library-table th,
.library-table td {
  padding: 16px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: middle;
}

.library-table thead {
  background: rgba(89, 192, 209, 0.12);
}

.library-table th {
  font-size: 0.88rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent-strong);
}

.library-table tbody tr {
  background: rgba(255, 255, 255, 0.74);
  transition: background 160ms ease;
}

.library-table tbody tr:hover {
  background: rgba(89, 192, 209, 0.09);
}

.title-cell {
  font-weight: 600;
}

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

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

.checkbox-cell input {
  inline-size: 18px;
  block-size: 18px;
  accent-color: var(--brand-magenta);
}

.empty-state {
  margin-top: 16px;
  padding: 24px;
  border: 1px dashed rgba(25, 51, 45, 0.24);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.48);
}

.empty-state h3 {
  margin-bottom: 10px;
}

.print-frame {
  position: fixed;
  width: 0;
  height: 0;
  border: 0;
  opacity: 0;
  pointer-events: none;
}

code {
  font-family: Consolas, 'Courier New', monospace;
}

@media (max-width: 980px) {
  .filter-grid,
  .action-bar,
  .table-header {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

  .hero-copy,
  .collection-panel,
  .control-panel,
  .table-card {
    padding: 22px;
  }

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

  .button-row {
    width: 100%;
  }

  .button {
    width: 100%;
  }

  .subcategory-header {
    flex-direction: column;
    align-items: stretch;
  }
}

@media (max-width: 760px) {
  .page-shell {
    padding: 18px 14px 36px;
  }

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

  .library-table thead {
    display: none;
  }

  .library-table,
  .library-table tbody,
  .library-table tr,
  .library-table td {
    display: block;
    width: 100%;
  }

  .library-table tr {
    margin-bottom: 14px;
    border: 1px solid var(--line);
    border-radius: var(--radius-md);
    overflow: hidden;
    background: rgba(255, 255, 255, 0.84);
  }

  .library-table td {
    display: grid;
    grid-template-columns: 108px minmax(0, 1fr);
    gap: 12px;
    padding: 12px 14px;
  }

  .library-table td::before {
    content: attr(data-label);
    font-size: 0.8rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent-strong);
  }
}
