:root {
  --bg: #f6efe4;
  --bg-accent: #e0efe3;
  --surface: rgba(255, 251, 244, 0.82);
  --surface-strong: #fffaf1;
  --border: rgba(50, 41, 34, 0.12);
  --text: #2b241d;
  --muted: #64584e;
  --accent: #116466;
  --accent-deep: #0b4f50;
  --accent-soft: #d7ecec;
  --shadow: 0 20px 45px rgba(79, 59, 32, 0.12);
  --radius-xl: 28px;
  --radius-lg: 20px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Space Grotesk", sans-serif;
  color: var(--text);
  background:
    radial-gradient(circle at top left, rgba(255, 255, 255, 0.9), transparent 30%),
    radial-gradient(circle at right 20%, rgba(17, 100, 102, 0.15), transparent 20%),
    linear-gradient(135deg, var(--bg), var(--bg-accent));
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background-image: linear-gradient(rgba(17, 100, 102, 0.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(17, 100, 102, 0.035) 1px, transparent 1px);
  background-size: 36px 36px;
  pointer-events: none;
  opacity: 0.55;
}

.page-shell {
  position: relative;
  z-index: 1;
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
  padding: 2rem 0 3rem;
}

.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  background: var(--surface);
  backdrop-filter: blur(18px);
  box-shadow: var(--shadow);
}

.hero {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(240px, 1fr);
  gap: 1.5rem;
  padding: 2rem;
  animation: rise 600ms ease both;
}

.eyebrow {
  margin: 0 0 0.5rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent);
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1,
h2,
h3 {
  text-wrap: balance;
}

h1 {
  margin-bottom: 0.9rem;
  font-family: "Newsreader", serif;
  font-size: clamp(2.5rem, 5vw, 4.7rem);
  line-height: 0.95;
}

.hero-copy {
  max-width: 62ch;
  margin-bottom: 0;
  color: var(--muted);
  line-height: 1.6;
}

.hero-meta {
  display: grid;
  align-content: start;
  gap: 0.4rem;
  padding: 1.25rem;
  border-radius: var(--radius-lg);
  background: linear-gradient(160deg, rgba(17, 100, 102, 0.12), rgba(255, 250, 241, 0.7));
}

.meta-label {
  margin-bottom: 0;
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--muted);
}

.meta-value {
  margin-bottom: 0.9rem;
  font-size: 1.15rem;
  font-weight: 500;
}

.meta-value.time {
  margin-bottom: 0;
  font-size: clamp(1.8rem, 4vw, 3rem);
  font-weight: 700;
  color: var(--accent-deep);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.module {
  padding: 1.5rem;
  animation: rise 700ms ease both;
}

.module-header {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.module-header h2 {
  margin-bottom: 0;
  font-size: 1.6rem;
}

.module-actions {
  display: flex;
  align-items: center;
  gap: 0.7rem;
}

button,
input,
select {
  font: inherit;
}

.primary-button,
.secondary-button,
.icon-button {
  border: 0;
  cursor: pointer;
  transition: transform 180ms ease, background-color 180ms ease, color 180ms ease;
}

.primary-button,
.secondary-button {
  border-radius: 999px;
  padding: 0.8rem 1.15rem;
  font-weight: 700;
}

.primary-button {
  color: white;
  background: var(--accent-deep);
}

.secondary-button {
  color: var(--accent-deep);
  background: var(--accent-soft);
}

.primary-button:hover,
.secondary-button:hover,
.icon-button:hover {
  transform: translateY(-1px);
}

.bookmark-form {
  display: grid;
  gap: 1rem;
  padding: 1rem;
  margin-bottom: 1.25rem;
  border: 1px solid rgba(17, 100, 102, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 241, 0.78);
}

.bookmark-form.is-collapsed {
  display: none;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

label {
  display: grid;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.95rem;
}

input,
select {
  width: 100%;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(43, 36, 29, 0.12);
  border-radius: 14px;
  background: white;
  color: var(--text);
}

input:focus,
select:focus {
  outline: 2px solid rgba(17, 100, 102, 0.25);
  border-color: var(--accent);
}

.form-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.form-message {
  min-height: 1.25rem;
  margin-bottom: 0;
  font-size: 0.92rem;
  color: var(--muted);
}

.form-message.is-error {
  color: #b14432;
}

.bookmark-sections {
  display: grid;
  gap: 1rem;
}

.bookmark-section-block {
  padding: 1rem;
  border: 1px solid rgba(17, 100, 102, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 250, 241, 0.56);
}

.bookmark-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}

.bookmark-section-title {
  margin-bottom: 0.15rem;
  font-size: 1.1rem;
}

.bookmark-section-count {
  margin-bottom: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.bookmark-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1rem;
}

.bookmark-empty {
  padding: 1.5rem;
  border: 1px dashed rgba(17, 100, 102, 0.22);
  border-radius: var(--radius-lg);
  color: var(--muted);
  background: rgba(255, 255, 255, 0.55);
}

.bookmark-tile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.8rem;
  align-items: start;
  padding: 1rem;
  border: 1px solid rgba(17, 100, 102, 0.12);
  border-radius: var(--radius-lg);
  background: var(--surface-strong);
  animation: rise 450ms ease both;
}

.bookmark-link {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  min-width: 0;
  text-decoration: none;
  color: inherit;
}

.bookmark-icon {
  display: grid;
  place-items: center;
  width: 2.9rem;
  height: 2.9rem;
  border-radius: 16px;
  background: linear-gradient(140deg, var(--accent-soft), rgba(17, 100, 102, 0.2));
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--accent-deep);
  flex-shrink: 0;
}

.bookmark-text {
  display: grid;
  gap: 0.18rem;
  min-width: 0;
}

.bookmark-name,
.bookmark-domain {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bookmark-domain {
  color: var(--muted);
  font-size: 0.9rem;
}

.icon-button {
  align-self: center;
  padding: 0.5rem 0.75rem;
  border-radius: 999px;
  background: rgba(43, 36, 29, 0.06);
  color: var(--muted);
}

.icon-button-ghost {
  display: grid;
  place-items: center;
  min-width: 2.8rem;
  min-height: 2.8rem;
  padding: 0;
  background: rgba(17, 100, 102, 0.09);
  color: var(--accent-deep);
}

.icon-button-ghost svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: currentColor;
}

.module-bookmarks {
  position: relative;
}

.settings-popover {
  position: absolute;
  top: 5.4rem;
  right: 1.5rem;
  z-index: 5;
  width: min(520px, calc(100vw - 3rem));
  padding: 1rem;
  border-radius: 24px;
  background: rgba(255, 249, 240, 0.96);
}

.settings-popover.is-hidden {
  display: none;
}

.popover-header,
.popover-panel-header,
.assignment-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
}

.popover-header {
  margin-bottom: 1rem;
}

.popover-header h3,
.popover-panel-header h4 {
  margin-bottom: 0;
}

.section-form {
  display: grid;
  gap: 0.6rem;
  margin-bottom: 1rem;
}

.section-form-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.75rem;
}

.popover-content {
  display: grid;
  gap: 1rem;
}

.popover-panel {
  padding: 1rem;
  border: 1px solid rgba(17, 100, 102, 0.12);
  border-radius: var(--radius-lg);
  background: rgba(255, 255, 255, 0.62);
}

.section-list,
.assignment-list {
  display: grid;
  gap: 0.75rem;
}

.section-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.55rem 0.8rem;
  border-radius: 999px;
  background: rgba(17, 100, 102, 0.1);
  color: var(--accent-deep);
  font-weight: 500;
}

.section-chip-count {
  color: var(--muted);
  font-size: 0.86rem;
}

.assignment-row {
  padding: 0.8rem 0.9rem;
  border-radius: 16px;
  background: rgba(246, 239, 228, 0.72);
}

.assignment-row strong {
  display: block;
  margin-bottom: 0.1rem;
}

.assignment-row span {
  color: var(--muted);
  font-size: 0.9rem;
}

.assignment-row select {
  width: auto;
  min-width: 140px;
  padding-right: 2.25rem;
}

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(18px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 900px) {
  .hero,
  .dashboard-grid,
  .field-grid {
    grid-template-columns: 1fr;
  }

  .page-shell {
    width: min(100% - 1rem, 1180px);
    padding-top: 1rem;
  }
}

@media (max-width: 640px) {
  .hero,
  .module {
    padding: 1.15rem;
  }

  .module-header,
  .form-actions,
  .assignment-row {
    flex-direction: column;
    align-items: stretch;
  }

  .module-actions,
  .section-form-row {
    grid-template-columns: 1fr;
  }

  .module-actions {
    display: grid;
  }

  .settings-popover {
    top: 7.5rem;
    right: 1rem;
    width: calc(100vw - 2rem);
  }

  .bookmark-grid {
    grid-template-columns: 1fr;
  }
}