:root {
  /* A4 paper tone — almost white, very subtle warm tint */
  --bg: #fdfcf8;
  --paper: #ffffff;
  --text: #2a2824;
  --text-muted: rgba(42, 40, 36, 0.62);
  --text-subtle: rgba(42, 40, 36, 0.38);
  --border: rgba(42, 40, 36, 0.12);
  --hover: rgba(42, 40, 36, 0.05);
  --card-bg: #ffffff;
  --card-shadow: rgba(15, 15, 15, 0.07) 0px 0px 0px 1px, rgba(15, 15, 15, 0.08) 0px 3px 8px;
  --card-shadow-hover: rgba(15, 15, 15, 0.1) 0px 0px 0px 1px, rgba(15, 15, 15, 0.14) 0px 10px 24px;
  --blue: rgb(35, 131, 226);
  --radius: 14px;

  /* Stronger tag palette — solid, not transparent */
  --tag-default-bg: #e7e3d8;
  --tag-gray-bg:    #d8d5cc;
  --tag-brown-bg:   #e6cdb8;
  --tag-orange-bg:  #f5c89a;
  --tag-yellow-bg:  #f3dc8b;
  --tag-green-bg:   #b6d9a7;
  --tag-blue-bg:    #a7c8e5;
  --tag-purple-bg:  #cbb6e0;
  --tag-pink-bg:    #e8b4cb;
  --tag-red-bg:     #f0b2a7;

  --tag-text: #2a2824;

  --mode-icon-light-display: inline;
  --mode-icon-dark-display: none;
}

html[data-mode="dark"] {
  --bg: #1c1a16;
  --paper: #24211c;
  --text: #ece6d6;
  --text-muted: rgba(236, 230, 214, 0.65);
  --text-subtle: rgba(236, 230, 214, 0.4);
  --border: rgba(236, 230, 214, 0.14);
  --hover: rgba(236, 230, 214, 0.06);
  --card-bg: #2a2620;
  --card-shadow: 0 0 0 1px rgba(0,0,0,0.4), 0 4px 12px rgba(0,0,0,0.4);
  --card-shadow-hover: 0 0 0 1px rgba(236, 230, 214, 0.2), 0 14px 30px rgba(0,0,0,0.5);
  --blue: #7ab5ff;

  --tag-default-bg: #3a3429;
  --tag-gray-bg:    #3a3429;
  --tag-brown-bg:   #6b4e33;
  --tag-orange-bg:  #8a5223;
  --tag-yellow-bg:  #8a6f1a;
  --tag-green-bg:   #2f6a3e;
  --tag-blue-bg:    #2a4f82;
  --tag-purple-bg:  #513770;
  --tag-pink-bg:    #6f2f55;
  --tag-red-bg:     #7a3228;

  --tag-text: #ece6d6;

  --mode-icon-light-display: none;
  --mode-icon-dark-display: inline;
}

* { box-sizing: border-box; }

/* Text IS selectable (so copying a single name / link works).
   Friction comes from JS: blocked right-click, blocked Ctrl+A/S/U.
   Drag-save of images is still blocked. */
img { -webkit-user-drag: none; user-drag: none; pointer-events: auto; }

html, body {
  margin: 0;
  padding: 0;
  font-family: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
}

/* ---------- Page header ---------- */

.page-header {
  max-width: 1400px;
  margin: 0 auto;
  padding: 64px 96px 0 96px;
}

.title-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 24px;
}

.page-icon {
  font-size: 38px;
  line-height: 1;
}

.page-header h1 {
  font-size: 40px;
  font-weight: 700;
  margin: 0;
  letter-spacing: -0.02em;
}

.view-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 0;
}

.tab {
  background: transparent;
  border: none;
  padding: 6px 10px;
  font-size: 14px;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius);
  transition: background 0.1s;
  position: relative;
  bottom: -1px;
  border-bottom: 2px solid transparent;
}
.tab:hover { background: var(--hover); }
.tab.active {
  color: var(--text);
  font-weight: 500;
  border-bottom-color: var(--text);
}
.tab-count {
  font-size: 11px;
  color: var(--text-muted);
  margin-left: 2px;
  font-variant-numeric: tabular-nums;
}

/* Saved view sub-toggle */
.saved-sub-toggle {
  display: flex;
  gap: 6px;
  margin: 0 0 18px 0;
}
.saved-pill {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 5px 14px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 500;
}
.saved-pill:hover { color: var(--text); background: var(--hover); }
.saved-pill.active {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

/* Empty state */
.empty-state {
  text-align: center;
  padding: 64px 20px;
  color: var(--text-muted);
}
.empty-icon { font-size: 48px; opacity: 0.4; margin-bottom: 16px; }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.empty-hint { font-size: 14px; }

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px 0 16px 0;
  gap: 12px;
}

.filter-bar {
  display: flex;
  gap: 4px;
}

.filter-add, .sort-add {
  color: var(--text-subtle);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 8px;
  border-radius: 4px;
  user-select: none;
}
.filter-add:hover, .sort-add:hover { background: var(--hover); color: var(--text); }
.sort-add.active { background: var(--tag-orange-bg); color: var(--text); }

.toolbar-actions {
  display: flex;
  gap: 8px;
  align-items: center;
}

#search {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 6px 10px;
  font-size: 13px;
  width: 220px;
  outline: none;
  transition: border-color 0.15s;
}
#search:focus { border-color: var(--blue); }

.theme-picker {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-right: 4px;
}
.theme-btn {
  background: transparent;
  border: none;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-right: 1px solid var(--border);
}
.theme-btn:last-child { border-right: none; }
.theme-btn:hover { background: var(--hover); }
.theme-btn.active {
  background: var(--text);
  color: var(--bg);
}

.mode-toggle {
  position: fixed;
  left: 20px;
  bottom: 20px;
  z-index: 90;
  background: var(--paper);
  border: 1px solid var(--border);
  color: var(--text);
  width: 44px; height: 44px;
  border-radius: 50%;
  font-size: 18px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  box-shadow: 0 6px 18px rgba(0,0,0,0.18);
  transition: transform 0.15s, background 0.15s;
}
.mode-toggle:hover { background: var(--hover); transform: scale(1.08); }
.mode-icon-light { display: var(--mode-icon-light-display); }
.mode-icon-dark { display: var(--mode-icon-dark-display); }

.channel-thumb-link {
  display: inline-block;
  border: 0;
  background: transparent;
  padding: 0;
  border-radius: 3px;
  transition: box-shadow 0.15s, transform 0.15s;
  line-height: 0;
  cursor: zoom-in;
}
.channel-thumb-link:hover {
  box-shadow: 0 0 0 2px var(--blue);
  transform: scale(1.03);
}
.channel-thumb-link img { display: block; border-radius: 3px; }

.new-btn {
  background: var(--blue);
  color: #fff;
  border: none;
  padding: 6px 12px;
  border-radius: var(--radius);
  font-size: 13px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.new-btn:hover { filter: brightness(1.05); }
.caret { font-size: 10px; opacity: 0.8; }

/* ---------- Main area ---------- */

main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 8px 96px 8px 96px;
}

/* ---------- Gallery view ---------- */

.gallery {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(290px, 1fr));
  gap: 18px;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  overflow: hidden;
  cursor: pointer;
  transition: box-shadow 0.18s, transform 0.18s;
  display: flex;
  flex-direction: column;
}
.card:hover {
  box-shadow: var(--card-shadow-hover);
  transform: translateY(-2px);
}

.card-image-wrap {
  position: relative;
}

/* ---- Skeleton loading cards (YouTube-style shimmer) ---- */

.skeleton { pointer-events: none; }
.skeleton .skeleton-img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
}
.skeleton-img,
.skeleton-line,
.skeleton-tags span {
  background: linear-gradient(90deg,
    var(--hover) 0%,
    var(--border) 40%,
    var(--hover) 80%);
  background-size: 200% 100%;
  animation: nh-shimmer 1.4s infinite linear;
  border-radius: 4px;
}
.skeleton-line {
  height: 12px;
  margin-bottom: 7px;
}
.skeleton-line.short { width: 55%; }
.skeleton-title {
  height: 18px;
  width: 75%;
  margin-bottom: 14px;
}
.skeleton-tags {
  display: flex;
  gap: 4px;
  margin-bottom: 10px;
}
.skeleton-tags span {
  width: 70px;
  height: 18px;
  border-radius: 999px;
}

@keyframes nh-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---- Per-image loading (pulse until image loads, then fade in) ---- */

.card-image-wrap.img-loading::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
    var(--hover) 0%,
    var(--border) 40%,
    var(--hover) 80%);
  background-size: 200% 100%;
  animation: nh-shimmer 1.4s infinite linear;
  z-index: 0;
}
.card-image-wrap img {
  position: relative;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.3s ease-out;
}
.card-image-wrap:not(.img-loading) img {
  opacity: 1;
}

.card-image {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: cover;
  object-position: top;
  background: #f1f0ee;
  display: block;
  border-bottom: 1px solid var(--border);
}

.flag-buttons {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 3;
}

.flag-btn {
  background: rgba(255, 255, 255, 0.92);
  color: #1a1a1a;
  border: 1px solid rgba(0,0,0,0.08);
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  padding: 0;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
  transition: transform 0.12s, background 0.12s;
}
html[data-mode="dark"] .flag-btn {
  background: rgba(40, 38, 34, 0.92);
  color: var(--text);
  border-color: rgba(255,255,255,0.1);
}
.flag-btn:hover { transform: scale(1.12); }
.flag-btn .flag-icon-on  { display: none; }
.flag-btn .flag-icon-off { display: inline; }
.flag-btn.on .flag-icon-on  { display: inline; }
.flag-btn.on .flag-icon-off { display: none; }
.flag-btn.flag-bm.on    { background: #ffc33c; color: #4a2f00; border-color: #ffc33c; }
.flag-btn.just-clicked { transform: scale(1.25); }

/* Like button at bottom of card body, with count */
.like-row {
  margin-top: auto;
  padding-top: 4px;
  display: flex;
  align-items: center;
}
.like-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 3px 10px 3px 8px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  transition: transform 0.12s, background 0.12s, color 0.12s, border-color 0.12s;
  font-variant-numeric: tabular-nums;
}
.like-btn:hover { color: var(--text); background: var(--hover); }
.like-btn .flag-icon-on  { display: none; font-size: 15px; line-height: 1; }
.like-btn .flag-icon-off { display: inline; font-size: 15px; line-height: 1; }
.like-btn.on .flag-icon-on  { display: inline; }
.like-btn.on .flag-icon-off { display: none; }
.like-btn.on {
  background: rgba(255, 91, 110, 0.12);
  color: #ff5b6e;
  border-color: rgba(255, 91, 110, 0.4);
}
.like-btn.just-clicked { transform: scale(1.08); }

/* Table flags (like + bookmark inline) */
.cell-flags-row { display: flex; gap: 4px; }
.cell-flags .flag-btn {
  width: 26px; height: 26px; font-size: 14px;
  background: transparent; border: 1px solid var(--border); box-shadow: none;
}
.cell-flags .flag-like-sm.on { background: rgba(255, 91, 110, 0.15); color: #ff5b6e; border-color: rgba(255, 91, 110, 0.5); }
.cell-flags .flag-bm.on { background: #ffc33c; color: #4a2f00; border-color: #ffc33c; }

.card-body {
  padding: 14px 16px 16px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 0;
}

.card-title {
  font-weight: 600;
  font-size: 16px;
  color: var(--text);
  display: flex;
  align-items: center;
  gap: 6px;
  letter-spacing: -0.01em;
}

.card-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.tag {
  display: inline-block;
  padding: 2px 10px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 999px;
  background: var(--tag-default-bg);
  color: var(--tag-text);
  line-height: 1.5;
  max-width: 100%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tag-gray    { background: var(--tag-gray-bg); }
.tag-brown   { background: var(--tag-brown-bg); }
.tag-orange  { background: var(--tag-orange-bg); }
.tag-yellow  { background: var(--tag-yellow-bg); }
.tag-green   { background: var(--tag-green-bg); }
.tag-blue    { background: var(--tag-blue-bg); }
.tag-purple  { background: var(--tag-purple-bg); }
.tag-pink    { background: var(--tag-pink-bg); }
.tag-red     { background: var(--tag-red-bg); }

.card-desc {
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---------- Table view ---------- */

.table-scroll {
  overflow: scroll;
  max-height: calc(100vh - 270px);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--paper);
  scrollbar-width: auto;
  scrollbar-color: var(--text-muted) var(--hover);
  overflow-anchor: none;        /* kill browser scroll-anchor teleport */
  scroll-behavior: auto;        /* no smooth animation that can overshoot */
}
.table-scroll * { overflow-anchor: none; }

/* Chrome / Edge / Safari — always-visible, Notion-style fat scrollbar with arrows */
.table-scroll::-webkit-scrollbar {
  height: 16px;
  width: 16px;
  background: var(--hover);
}
.table-scroll::-webkit-scrollbar-track {
  background: var(--hover);
}
.table-scroll::-webkit-scrollbar-thumb {
  background: var(--text-subtle);
  border-radius: 8px;
  min-height: 50px;
  min-width: 50px;
}
.table-scroll::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }
.table-scroll::-webkit-scrollbar-thumb:active { background: var(--text); }
.table-scroll::-webkit-scrollbar-corner { background: var(--hover); }

/* Arrow buttons at the ends (Notion-style) */
.table-scroll::-webkit-scrollbar-button:single-button {
  background: var(--hover);
  display: block;
  height: 16px;
  width: 16px;
  background-repeat: no-repeat;
  background-position: center;
  background-size: 8px 8px;
}
.table-scroll::-webkit-scrollbar-button:single-button:hover {
  background-color: var(--border);
}
.table-scroll::-webkit-scrollbar-button:horizontal:single-button:decrement {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path d='M6 1L2 4l4 3' fill='none' stroke='%238b90a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.table-scroll::-webkit-scrollbar-button:horizontal:single-button:increment {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path d='M2 1l4 3-4 3' fill='none' stroke='%238b90a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.table-scroll::-webkit-scrollbar-button:vertical:single-button:decrement {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path d='M1 6l3-4 3 4' fill='none' stroke='%238b90a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.table-scroll::-webkit-scrollbar-button:vertical:single-button:increment {
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 8 8'><path d='M1 2l3 4 3-4' fill='none' stroke='%238b90a0' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
}
.table-scroll::-webkit-scrollbar-button:double-button,
.table-scroll::-webkit-scrollbar-button:start:increment,
.table-scroll::-webkit-scrollbar-button:end:decrement {
  display: none;
}

/* Sticky header so column labels stay visible while scrolling rows */
.table-scroll table.channels-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper);
}

table.channels-table {
  width: max-content;
  min-width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  table-layout: auto;
  contain: layout style;        /* isolate reflow inside the table */
}

table.channels-table th,
table.channels-table td {
  border: 1px solid var(--border);
  padding: 6px 10px;
  text-align: left;
  vertical-align: middle;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 300px;
}

table.channels-table th {
  color: var(--text-muted);
  font-weight: 600;
  background: var(--paper);
  border-bottom: 2px solid var(--border);
  font-size: 12px;
  letter-spacing: 0.02em;
}

table.channels-table a {
  color: var(--blue);
  text-decoration: none;
  border-bottom: 1px solid color-mix(in oklab, var(--blue) 45%, transparent);
  padding-bottom: 1px;
}
table.channels-table a:hover {
  border-bottom-color: var(--blue);
}

table.channels-table tbody tr { cursor: pointer; }
table.channels-table tbody tr:hover { background: var(--hover); }

table.channels-table td.cell-image img {
  width: 40px;
  height: 24px;
  object-fit: cover;
  border-radius: 2px;
  display: block;
}

table.channels-table td.cell-name {
  font-weight: 500;
}
.row-icon { color: var(--text-subtle); margin-right: 6px; }

/* ---------- Modal (detail) ---------- */

.modal {
  position: fixed;
  inset: 0;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 20px;
  z-index: 100;
  overflow-y: auto;
}
.modal.hidden { display: none; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.4);
  backdrop-filter: blur(2px);
}

.modal-card {
  position: relative;
  max-width: 900px;
  width: 100%;
  background: var(--paper);
  color: var(--text);
  border-radius: 10px;
  box-shadow: 0 18px 48px rgba(0,0,0,0.25);
  padding: 56px 72px 72px 72px;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: none;
  font-size: 22px;
  color: var(--text-muted);
  cursor: pointer;
  width: 32px;
  height: 32px;
  border-radius: 6px;
  line-height: 1;
}
.modal-close:hover { background: var(--hover); }

.modal-title {
  font-size: 40px;
  font-weight: 700;
  margin: 0 0 24px 0;
  letter-spacing: -0.02em;
}

.properties {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 6px 12px;
  font-size: 14px;
  margin-bottom: 24px;
}

.prop-label {
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 6px;
  border-radius: 4px;
}

.prop-value {
  padding: 4px 6px;
  border-radius: 4px;
}
.prop-value a { color: inherit; text-decoration: underline; }

.prop-value .tag { font-size: 13px; padding: 2px 8px; }

.prop-value.channel-thumb img {
  width: 48px;
  height: 32px;
  object-fit: cover;
  border-radius: 3px;
}

.body-section {
  margin-top: 8px;
  font-size: 15px;
  line-height: 1.7;
}
.body-section p { margin: 0.15em 0; }
.body-section p.section-head {
  font-weight: 600;
  margin-top: 1em;
}
.body-empty {
  color: var(--text-subtle);
  font-style: italic;
}

.prop-icon { opacity: 0.5; font-size: 14px; }

/* ---------- Responsive ---------- */

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px;
}
.lightbox.hidden { display: none; }
.lightbox-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 15, 15, 0.85);
  cursor: zoom-out;
}
.lightbox img {
  position: relative;
  max-width: 100%;
  max-height: 100%;
  border-radius: 6px;
  box-shadow: 0 30px 80px rgba(0,0,0,0.6);
  background: #222;
}
.lightbox-close {
  position: fixed;
  top: 20px;
  right: 24px;
  background: rgba(255,255,255,0.1);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.3);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  font-size: 24px;
  cursor: pointer;
  z-index: 201;
}
.lightbox-close:hover { background: rgba(255,255,255,0.2); }

/* ---------- Filter panel ---------- */

.filter-add.active {
  background: var(--tag-blue-bg);
  color: var(--text);
}

.filter-panel {
  position: absolute;
  z-index: 150;
  background: var(--paper);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(15, 15, 15, 0.15);
  padding: 14px 16px;
  width: 420px;
  max-width: 92vw;
  max-height: 70vh;
  overflow-y: auto;
}
.filter-panel.hidden { display: none; }
.filter-group { margin-bottom: 14px; }
.filter-group-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-bottom: 6px;
  font-weight: 600;
}
.filter-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.filter-chip {
  cursor: pointer;
  border: 1px solid transparent;
  opacity: 0.65;
  transition: opacity 0.1s, border-color 0.1s;
}
.filter-chip:hover { opacity: 1; }
.filter-chip.selected {
  opacity: 1;
  border-color: var(--text);
  font-weight: 500;
}
.sort-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.sort-row {
  display: grid;
  grid-template-columns: 16px 1fr 140px 24px;
  gap: 6px;
  align-items: center;
}
.sort-drag {
  color: var(--text-subtle);
  cursor: grab;
  font-size: 11px;
  text-align: center;
  line-height: 1;
}
.sort-select {
  background: var(--paper);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 13px;
  color: var(--text);
  cursor: pointer;
  outline: none;
}
.sort-select:focus { border-color: var(--blue); }
.sort-remove {
  background: transparent;
  border: none;
  color: var(--text-subtle);
  font-size: 16px;
  cursor: pointer;
  width: 24px; height: 24px;
  border-radius: 4px;
  line-height: 1;
}
.sort-remove:hover { background: var(--hover); color: var(--text); }

.sort-add-row {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  padding-top: 10px;
  border-top: 1px solid var(--border);
}
.sort-add-btn {
  background: transparent;
  border: 1px dashed var(--border);
  border-radius: 6px;
  padding: 5px 12px;
  font-size: 13px;
  color: var(--text-muted);
  cursor: pointer;
}
.sort-add-btn:hover { border-style: solid; color: var(--text); background: var(--hover); }

.filter-footer {
  border-top: 1px solid var(--border);
  padding-top: 10px;
  display: flex;
  justify-content: flex-end;
}
.filter-clear {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 4px 10px;
  font-size: 12px;
  cursor: pointer;
  color: var(--text-muted);
}
.filter-clear:hover { background: var(--hover); }

@media (max-width: 900px) {
  .page-header, main { padding-left: 24px; padding-right: 24px; }
  .modal-card { padding: 40px 24px; }
  .properties { grid-template-columns: 140px 1fr; }
  .modal-title { font-size: 30px; }
}


/* ===================================================================
   AOY Program — course SPA (home / module / lesson)
   =================================================================== */

.page-header { padding: 40px 64px 16px 64px; }
.aoy-top { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.aoy-breadcrumb { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); }
.aoy-brand { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; }

.aoy-crumbs { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); flex-wrap: wrap; }
.aoy-crumb { text-decoration: none; color: var(--text-muted); padding: 2px 6px; border-radius: 4px; }
.aoy-crumb:hover { background: var(--hover); color: var(--text); }
.aoy-crumb-current { color: var(--text); font-weight: 500; }
.aoy-crumb-sep { color: var(--text-subtle); }

main { max-width: 1200px; margin: 0 auto; padding: 8px 64px 64px 64px; }

.aoy-hero { margin: 8px 0 16px 0; }
.aoy-hero h1 { font-size: 28px; font-weight: 800; margin: 0 0 4px 0; letter-spacing: -0.02em; }
.aoy-hero-lead { font-size: 14px; color: var(--text-muted); margin: 0 0 4px 0; }
.aoy-hero-meta { font-size: 12px; color: var(--text-subtle); margin: 0; font-variant-numeric: tabular-nums; }

.aoy-module-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 22px; }
.aoy-module-cover-large {
  width: 100%;
  aspect-ratio: 16 / 5;
  background-size: 112% auto;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: var(--hover);
  border-radius: 14px;
  margin-bottom: 24px;
  border: 1px solid var(--border);
  overflow: hidden;
}
.aoy-module-card { background: var(--card-bg); border-radius: 14px; box-shadow: var(--card-shadow); overflow: hidden; cursor: pointer; display: flex; flex-direction: column; text-decoration: none; color: inherit; transition: transform 0.18s, box-shadow 0.18s; }
.aoy-module-card:hover { transform: translateY(-3px); box-shadow: var(--card-shadow-hover); }

.aoy-cover {
  width: 100%;
  aspect-ratio: 16 / 5;
  background-size: 110% auto;
  background-position: center center;
  background-repeat: no-repeat;
  background-color: #f1f0ee;
  border-bottom: 1px solid var(--border);
}
.aoy-cover-placeholder { display: flex; align-items: center; justify-content: center; font-weight: 800; color: var(--text-subtle); background: linear-gradient(135deg, var(--hover), var(--border)); }
.aoy-cover-n { font-size: 56px; }

.aoy-module-body { padding: 10px 14px 12px 14px; }
.aoy-module-title { font-weight: 700; font-size: 15px; letter-spacing: -0.01em; margin-bottom: 3px; }
.aoy-module-meta { font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.aoy-progress-bar { height: 3px; background: var(--hover); border-radius: 2px; margin-top: 6px; overflow: hidden; }
.aoy-progress-fill { height: 100%; background: linear-gradient(90deg, #4ade80, #22c55e); border-radius: 2px; transition: width 0.3s; }

.aoy-module-header { margin: 16px 0 28px 0; }
.aoy-module-number { font-size: 11px; text-transform: uppercase; letter-spacing: 0.2em; color: var(--text-muted); font-weight: 600; }
.aoy-module-h1 { font-size: 36px; font-weight: 800; letter-spacing: -0.02em; margin: 6px 0 8px 0; }
.aoy-module-desc { font-size: 15px; color: var(--text-muted); margin: 0; line-height: 1.55; }

.aoy-lesson-list { display: flex; flex-direction: column; gap: 6px; }
.aoy-lesson-row { display: flex; gap: 14px; padding: 10px 12px; background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px; text-decoration: none; color: inherit; align-items: center; transition: background 0.12s, border-color 0.12s, transform 0.12s; }
.aoy-lesson-row:hover { background: var(--hover); border-color: var(--text-subtle); transform: translateX(2px); }
.aoy-lesson-row.done .aoy-lesson-title { color: var(--text-muted); }
.aoy-lesson-row.sop { border-style: dashed; }

.aoy-lesson-thumb { width: 120px; min-width: 120px; aspect-ratio: 16 / 9; background-size: cover; background-position: center; background-color: var(--hover); border-radius: 6px; display: flex; align-items: center; justify-content: center; color: var(--text-subtle); font-weight: 700; font-size: 12px; }

.aoy-lesson-body { flex: 1; min-width: 0; }
.aoy-lesson-title { font-weight: 600; font-size: 14.5px; margin-bottom: 4px; }
.aoy-lesson-meta { display: flex; gap: 10px; font-size: 12px; color: var(--text-muted); flex-wrap: wrap; }
.aoy-meta-item { white-space: nowrap; }
.aoy-tag-sop { background: var(--tag-orange-bg); color: var(--tag-text); padding: 1px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; letter-spacing: 0.04em; }

.aoy-lesson-page { max-width: 880px; margin: 0 auto; }
.aoy-lesson-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin: 12px 0 20px 0; flex-wrap: wrap; }
.aoy-lesson-h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.02em; margin: 0; flex: 1; min-width: 260px; }
.aoy-complete-btn { background: var(--paper); border: 1px solid var(--border); color: var(--text); padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 600; cursor: pointer; display: inline-flex; align-items: center; gap: 8px; }
.aoy-complete-btn .aoy-complete-check { color: var(--text-subtle); font-weight: 700; }
.aoy-complete-btn.on { background: #22c55e; border-color: #22c55e; color: #fff; }
.aoy-complete-btn.on .aoy-complete-check { color: #fff; }
.aoy-complete-btn:hover { background: var(--hover); }
.aoy-complete-btn.on:hover { background: #16a34a; }

.aoy-video-wrap { position: relative; width: 100%; aspect-ratio: 16 / 9; background: #000; border-radius: 12px; overflow: hidden; margin-bottom: 20px; }
.aoy-video-wrap iframe { width: 100%; height: 100%; border: 0; }

.aoy-timecodes { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; margin-bottom: 20px; }
.aoy-timecodes summary { cursor: pointer; font-weight: 600; font-size: 13px; color: var(--text-muted); list-style: none; user-select: none; }
.aoy-timecodes summary::-webkit-details-marker { display: none; }
.aoy-timecodes ul { margin: 10px 0 0 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 4px; }
.aoy-timecodes li a,
.aoy-timecodes li .aoy-tc-btn {
  display: inline-flex; gap: 10px;
  background: transparent; border: 0;
  color: var(--text); text-decoration: none;
  padding: 4px 8px; border-radius: 6px;
  font-size: 13px; cursor: pointer; text-align: left;
  font: inherit; line-height: 1.45;
}
.aoy-timecodes li a:hover,
.aoy-timecodes li .aoy-tc-btn:hover { background: var(--hover); }
.aoy-tc-time { font-variant-numeric: tabular-nums; color: var(--blue); font-weight: 600; min-width: 50px; }
.aoy-tc-title { color: var(--text); }

.aoy-leave-box { background: rgba(34, 197, 94, 0.08); border: 1px solid rgba(34, 197, 94, 0.3); border-radius: 10px; padding: 14px 18px; margin: 16px 0 24px 0; }
.aoy-leave-head { font-weight: 700; font-size: 13px; text-transform: uppercase; letter-spacing: 0.06em; color: #22c55e; margin-bottom: 8px; }
.aoy-leave-box ul { margin: 0; padding-left: 20px; }
.aoy-leave-box li { margin: 4px 0; font-size: 14.5px; line-height: 1.55; }

.aoy-blocks { font-size: 15px; line-height: 1.7; }
.aoy-block-heading { margin-top: 28px; margin-bottom: 8px; font-weight: 700; letter-spacing: -0.01em; }
.aoy-block-p { margin: 8px 0; }
.aoy-block-list { margin: 8px 0 14px 0; padding-left: 24px; }
.aoy-block-list li { margin: 4px 0; }

.aoy-block-callout { display: flex; gap: 12px; background: var(--hover); border: 1px solid var(--border); border-radius: 10px; padding: 12px 16px; margin: 12px 0; align-items: flex-start; }
.aoy-callout-icon { font-size: 20px; line-height: 1.3; }
.aoy-callout-text { flex: 1; white-space: pre-line; }

.aoy-block-quote { margin: 14px 0; padding: 6px 16px; border-left: 3px solid var(--text); color: var(--text-muted); font-size: 15px; font-style: italic; }

.aoy-block-image { margin: 16px 0; text-align: center; }
.aoy-block-image img { max-width: 100%; border-radius: 8px; border: 1px solid var(--border); cursor: zoom-in; }

.aoy-block-toggle { background: var(--paper); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.aoy-block-toggle summary { cursor: pointer; font-weight: 600; font-size: 14px; }
.aoy-toggle-body { margin-top: 8px; font-size: 14px; color: var(--text-muted); }
.aoy-toggle-body img { max-width: 100%; border-radius: 6px; }

.aoy-lesson-nav { display: flex; justify-content: space-between; gap: 12px; margin-top: 40px; padding-top: 20px; border-top: 1px solid var(--border); }
.aoy-nav-btn { background: var(--paper); border: 1px solid var(--border); border-radius: 10px; padding: 10px 16px; font-size: 13px; color: var(--text); text-decoration: none; max-width: 48%; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: background 0.12s, transform 0.12s; }
.aoy-nav-btn:hover { background: var(--hover); transform: translateY(-1px); }
.aoy-nav-next { margin-left: auto; font-weight: 600; }

.empty-state { text-align: center; padding: 64px 20px; color: var(--text-muted); }
.empty-title { font-size: 18px; font-weight: 600; color: var(--text); margin-bottom: 6px; }

@media (max-width: 720px) {
  .page-header { padding: 24px 20px 12px 20px; }
  main { padding: 8px 20px 40px 20px; }
  .aoy-module-grid { grid-template-columns: 1fr; }
  .aoy-lesson-thumb { width: 92px; min-width: 92px; }
  .aoy-lesson-h1 { font-size: 24px; }
  .aoy-hero h1 { font-size: 28px; }
}


/* ===================================================================
   Notion-style color palette — inline highlights + block backgrounds
   =================================================================== */

/* Inline highlights — text color */
.highlight-default        { color: var(--text); }
.highlight-gray           { color: rgba(155, 154, 151, 1); }
.highlight-brown          { color: rgba(159, 118, 90, 1); }
.highlight-orange         { color: rgba(217, 115, 13, 1); }
.highlight-yellow         { color: rgba(203, 145, 47, 1); }
.highlight-teal,
.highlight-green          { color: rgba(68, 131, 97, 1); }
.highlight-blue           { color: rgba(51, 126, 169, 1); }
.highlight-purple         { color: rgba(144, 101, 176, 1); }
.highlight-pink           { color: rgba(193, 76, 138, 1); }
.highlight-red            { color: rgba(212, 76, 71, 1); }

/* Inline highlights — background tint */
.highlight-default_background { background: transparent; }
.highlight-gray_background    { background: rgba(241, 241, 239, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-brown_background   { background: rgba(244, 238, 238, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-orange_background  { background: rgba(251, 236, 221, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-yellow_background  { background: rgba(251, 243, 219, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-teal_background,
.highlight-green_background   { background: rgba(221, 237, 229, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-blue_background    { background: rgba(221, 235, 241, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-purple_background  { background: rgba(234, 228, 242, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-pink_background    { background: rgba(244, 223, 235, 0.85); padding: 0 4px; border-radius: 3px; }
.highlight-red_background     { background: rgba(251, 228, 228, 0.85); padding: 0 4px; border-radius: 3px; }

/* Dark mode — Notion-faithful color pairs (saturated bg + bright text, AA contrast) */
html[data-mode="dark"] .highlight-gray_background    { background: #3f3f3f; color: #d8d8d6; }
html[data-mode="dark"] .highlight-brown_background   { background: #4a3a30; color: #f3c8a9; }
html[data-mode="dark"] .highlight-orange_background  { background: #5c3b23; color: #ffc78a; }
html[data-mode="dark"] .highlight-yellow_background  { background: #5c4a1d; color: #ffe89c; }
html[data-mode="dark"] .highlight-green_background,
html[data-mode="dark"] .highlight-teal_background    { background: #2d4943; color: #9bd9c8; }
html[data-mode="dark"] .highlight-blue_background    { background: #2d3f5f; color: #a3c8e7; }
html[data-mode="dark"] .highlight-purple_background  { background: #443951; color: #d4bff0; }
html[data-mode="dark"] .highlight-pink_background    { background: #533343; color: #f0a8c4; }
html[data-mode="dark"] .highlight-red_background     { background: #5d3a3a; color: #ffa2a2; }

/* Inline color tones */
html[data-mode="dark"] .highlight-gray   { color: #b3b3b1; }
html[data-mode="dark"] .highlight-brown  { color: #d3a584; }
html[data-mode="dark"] .highlight-orange { color: #ffa15c; }
html[data-mode="dark"] .highlight-yellow { color: #f1d05f; }
html[data-mode="dark"] .highlight-teal,
html[data-mode="dark"] .highlight-green  { color: #79c4a0; }
html[data-mode="dark"] .highlight-blue   { color: #82bce0; }
html[data-mode="dark"] .highlight-purple { color: #c596df; }
html[data-mode="dark"] .highlight-pink   { color: #e795c1; }
html[data-mode="dark"] .highlight-red    { color: #ee8a8a; }

/* Block-level background colors — applied on the block element itself */
.block-color-gray_background,
.block-color-brown_background,
.block-color-orange_background,
.block-color-yellow_background,
.block-color-green_background,
.block-color-blue_background,
.block-color-purple_background,
.block-color-pink_background,
.block-color-red_background {
  border-radius: 8px;
  padding: 12px 16px;
}
.block-color-gray_background    { background: rgba(241, 241, 239, 0.6); }
.block-color-brown_background   { background: rgba(244, 238, 238, 0.6); }
.block-color-orange_background  { background: rgba(251, 236, 221, 0.7); }
.block-color-yellow_background  { background: rgba(251, 243, 219, 0.7); }
.block-color-green_background   { background: rgba(221, 237, 229, 0.7); }
.block-color-blue_background    { background: rgba(221, 235, 241, 0.7); }
.block-color-purple_background  { background: rgba(234, 228, 242, 0.7); }
.block-color-pink_background    { background: rgba(244, 223, 235, 0.7); }
.block-color-red_background     { background: rgba(251, 228, 228, 0.7); }

html[data-mode="dark"] .block-color-gray_background    { background: rgba(120, 119, 116, 0.18); }
html[data-mode="dark"] .block-color-brown_background   { background: rgba(159, 118, 90, 0.18); }
html[data-mode="dark"] .block-color-orange_background  { background: rgba(217, 115, 13, 0.18); }
html[data-mode="dark"] .block-color-yellow_background  { background: rgba(203, 145, 47, 0.18); }
html[data-mode="dark"] .block-color-green_background   { background: rgba(68, 131, 97, 0.18); }
html[data-mode="dark"] .block-color-blue_background    { background: rgba(51, 126, 169, 0.18); }
html[data-mode="dark"] .block-color-purple_background  { background: rgba(144, 101, 176, 0.18); }
html[data-mode="dark"] .block-color-pink_background    { background: rgba(193, 76, 138, 0.18); }
html[data-mode="dark"] .block-color-red_background     { background: rgba(212, 76, 71, 0.18); }

/* Block-level text colors (without background) */
.block-color-red    { color: rgba(212, 76, 71, 1); }
.block-color-orange { color: rgba(217, 115, 13, 1); }
.block-color-blue   { color: rgba(51, 126, 169, 1); }
.block-color-green  { color: rgba(68, 131, 97, 1); }
.block-color-purple { color: rgba(144, 101, 176, 1); }
.block-color-pink   { color: rgba(193, 76, 138, 1); }
.block-color-yellow { color: rgba(203, 145, 47, 1); }
.block-color-brown  { color: rgba(159, 118, 90, 1); }
.block-color-gray   { color: rgba(155, 154, 151, 1); }

html[data-mode="dark"] .block-color-red    { color: #ee8a8a; }
html[data-mode="dark"] .block-color-orange { color: #ffa15c; }
html[data-mode="dark"] .block-color-blue   { color: #82bce0; }
html[data-mode="dark"] .block-color-green  { color: #79c4a0; }
html[data-mode="dark"] .block-color-purple { color: #c596df; }
html[data-mode="dark"] .block-color-pink   { color: #e795c1; }
html[data-mode="dark"] .block-color-yellow { color: #f1d05f; }
html[data-mode="dark"] .block-color-brown  { color: #d3a584; }
html[data-mode="dark"] .block-color-gray   { color: #b3b3b1; }

/* To-do list */
.aoy-block-todo { list-style: none; padding-left: 0; margin: 8px 0 14px 0; }
.aoy-block-todo li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 3px 0;
}
.todo-check {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px; height: 18px; min-width: 18px;
  border: 1.5px solid var(--text-subtle);
  border-radius: 4px;
  font-size: 12px;
  color: transparent;
  margin-top: 3px;
  font-weight: 700;
}
.todo-check.on { background: #2383e2; border-color: #2383e2; color: #fff; }
.todo-text { flex: 1; }
.aoy-block-todo li.todo-done .todo-text { color: var(--text-muted); text-decoration: line-through; opacity: 0.7; }

/* Toggle body — give it normal text color and proper styling */
.aoy-block-toggle { background: var(--paper); border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px; margin: 12px 0; }
.aoy-block-toggle summary { cursor: pointer; font-weight: 600; font-size: 14px; color: var(--text); user-select: none; }
.aoy-toggle-body { margin-top: 12px; color: var(--text); font-size: 14.5px; line-height: 1.65; }
.aoy-toggle-body .aoy-block-heading { margin-top: 16px; }

/* Transcript/timecodes label refinement */
.aoy-tc-count { color: var(--text-subtle); font-weight: 500; margin-left: 4px; }


/* ===================================================================
   AOY polish — Notion-faithful typography, vivid dark mode, big nav
   =================================================================== */

/* Bigger, properly hierarchical headings in lesson body & inside toggles */
.aoy-blocks h2.aoy-block-heading,
.aoy-toggle-body h2.aoy-block-heading {
  font-size: 26px; font-weight: 700; margin-top: 32px; margin-bottom: 8px;
  letter-spacing: -0.015em;
}
.aoy-blocks h3.aoy-block-heading,
.aoy-toggle-body h3.aoy-block-heading {
  font-size: 20px; font-weight: 700; margin-top: 24px; margin-bottom: 8px;
  letter-spacing: -0.01em;
}
.aoy-blocks h4.aoy-block-heading,
.aoy-toggle-body h4.aoy-block-heading {
  font-size: 16px; font-weight: 700; margin-top: 18px; margin-bottom: 6px;
}
.aoy-blocks p, .aoy-toggle-body p { font-size: 15px; line-height: 1.7; margin: 8px 0; }
.aoy-blocks ul, .aoy-blocks ol,
.aoy-toggle-body ul, .aoy-toggle-body ol { font-size: 15px; line-height: 1.7; margin: 10px 0 14px 0; padding-left: 26px; }
.aoy-blocks li, .aoy-toggle-body li { margin: 5px 0; }

/* Toggle body uses regular text color, not muted */
.aoy-toggle-body { color: var(--text); font-size: 15px; line-height: 1.7; }

/* Page-link block (🪛 SOP: ...) and File block */
.aoy-block-page-link {
  display: block;
  text-decoration: none;
  color: var(--text);
  border: 1px solid var(--border);
  background: var(--paper);
  padding: 14px 16px;
  border-radius: 10px;
  margin: 12px 0;
}
.aoy-block-page-link-head {
  display: flex; gap: 10px; align-items: center;
  font-weight: 600; font-size: 14px;
}
.aoy-page-link-icon { font-size: 18px; }
.aoy-block-page-link,
.aoy-block-page-link *,
.aoy-block-page-link-head,
.aoy-block-page-link-head *,
.aoy-page-link-label,
.aoy-page-link-label * {
  color: #d4a017 !important;        /* warm yellow / mustard, readable in both modes */
  background: transparent !important;
  text-decoration: none;
}
.aoy-page-link-label { text-decoration: underline; text-decoration-color: rgba(212, 160, 23, 0.5); }
html[data-mode="dark"] .aoy-block-page-link,
html[data-mode="dark"] .aoy-block-page-link *,
html[data-mode="dark"] .aoy-page-link-label,
html[data-mode="dark"] .aoy-page-link-label * { color: #f1c93f !important; }
.aoy-block-page-link details > summary { cursor: pointer; padding: 8px 0 4px 0; font-weight: 600; color: var(--text-muted); font-size: 13px; }
.aoy-block-page-link .aoy-toggle-body { margin-top: 4px; padding-top: 8px; border-top: 1px solid var(--border); }

.aoy-block-file {
  display: inline-flex; gap: 8px; align-items: center;
  padding: 8px 14px;
  background: var(--paper); border: 1px solid var(--border);
  border-radius: 8px; color: var(--text); text-decoration: none;
  font-size: 13.5px; margin: 8px 0;
}
.aoy-block-file:hover { background: var(--hover); }
.aoy-block-file-icon { opacity: 0.7; }

/* Big Prev/Next nav with red accent */
.aoy-lesson-nav { gap: 16px; margin-top: 56px; padding-top: 24px; }
.aoy-nav-btn {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 22px;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  text-decoration: none;
  flex: 1;
  max-width: 48%;
  white-space: normal;
  line-height: 1.4;
  transition: background 0.15s, transform 0.15s, border-color 0.15s, box-shadow 0.15s;
  position: relative;
  overflow: hidden;
}
.aoy-nav-btn::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: linear-gradient(180deg, #ff4757, #c92a3a);
}
.aoy-nav-prev::before { left: 0; right: auto; }
.aoy-nav-next::before { left: auto; right: 0; }
.aoy-nav-btn:hover {
  background: var(--hover);
  border-color: #ff4757;
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(255, 71, 87, 0.18);
}
.aoy-nav-prev { padding-left: 28px; }
.aoy-nav-next { padding-right: 28px; text-align: right; }

.aoy-nav-direction {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: #ff4757;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 4px;
}


/* Non-clickable visual checkbox at the right end, full row height */
.aoy-lesson-row { padding: 0; overflow: hidden; align-items: stretch; }
.aoy-lesson-row .aoy-lesson-thumb { margin: 8px 0 8px 8px; }
.aoy-lesson-row .aoy-lesson-body { padding: 14px 16px; display: flex; align-items: center; }
.aoy-lesson-row .aoy-lesson-title { font-weight: 600; font-size: 16px; line-height: 1.35; margin: 0; white-space: normal; }
.aoy-lesson-check {
  display: flex; align-items: center; justify-content: center;
  align-self: stretch;
  width: 64px; min-width: 64px;
  background: var(--hover);
  border-left: 1px solid var(--border);
  font-size: 28px; font-weight: 800;
  color: transparent;
  transition: background 0.15s, color 0.15s;
}
.aoy-lesson-check.on {
  background: #22c55e;
  color: #fff;
  border-left-color: #22c55e;
}
.aoy-lesson-row.done { opacity: 0.85; }

/* Completed-module badge on home grid */
.aoy-module-card { position: relative; }
.aoy-cover { position: relative; }
.aoy-module-done-badge {
  position: absolute;
  top: 12px; right: 12px;
  width: 36px; height: 36px;
  background: #22c55e;
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px; font-weight: 800;
  box-shadow: 0 6px 14px rgba(34, 197, 94, 0.35);
  z-index: 2;
}
.aoy-module-card.done .aoy-progress-fill { background: linear-gradient(90deg, #22c55e, #16a34a); }


/* ===================================================================
   Override: kill all Notion inline color tints — keep bold/italic but
   remove every highlight-* / block-color-* color and background.
   =================================================================== */
[class*="highlight-"],
[class*="block-color-"] {
  color: inherit !important;
  background: transparent !important;
  fill: inherit !important;
  padding: 0 !important;
  border-radius: 0 !important;
}


/* ===================================================================
   PURPLE BAN — kill any purple/violet anywhere on the page.
   =================================================================== */
[class*="highlight-purple"],
[class*="block-color-purple"],
.aoy-block-page-link,
.aoy-block-page-link *,
.aoy-page-link-label,
.aoy-page-link-label *,
[class*="purple"],
[style*="purple"] {
  color: inherit !important;
  background: transparent !important;
  fill: inherit !important;
}

/* ===================================================================
   Mini-task — yellow callout box (matches green leave-with style)
   =================================================================== */
.aoy-mini-task {
  background: rgba(245, 200, 154, 0.18);
  border: 1px solid rgba(217, 119, 6, 0.45);
  border-radius: 10px;
  padding: 14px 18px;
  margin: 16px 0 24px 0;
}
.aoy-mini-task-head {
  font-weight: 700;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #d97706;
  margin-bottom: 8px;
}
.aoy-mini-task-list {
  margin: 0;
  padding-left: 22px;
}
.aoy-mini-task-list li {
  margin: 4px 0;
  font-size: 14.5px;
  line-height: 1.55;
}
html[data-mode="dark"] .aoy-mini-task {
  background: rgba(217, 119, 6, 0.12);
  border-color: rgba(255, 178, 88, 0.5);
}
html[data-mode="dark"] .aoy-mini-task-head { color: #ffb858; }

/* SOP page-link headers — yellow accent (no purple) */
.aoy-block-page-link-head { color: #d97706 !important; }
html[data-mode="dark"] .aoy-block-page-link-head { color: #ffb858 !important; }


/* No purple from any <a>, including :visited (browser default) */
.aoy-blocks a, .aoy-blocks a:visited,
.aoy-toggle-body a, .aoy-toggle-body a:visited,
.aoy-block-page-link a, .aoy-block-page-link a:visited,
.aoy-leave-box a, .aoy-leave-box a:visited,
.aoy-mini-task a, .aoy-mini-task a:visited {
  color: #2563eb !important;
  text-decoration: underline;
}
html[data-mode="dark"] .aoy-blocks a,
html[data-mode="dark"] .aoy-toggle-body a,
html[data-mode="dark"] .aoy-block-page-link a,
html[data-mode="dark"] .aoy-leave-box a,
html[data-mode="dark"] .aoy-mini-task a,
html[data-mode="dark"] .aoy-blocks a:visited,
html[data-mode="dark"] .aoy-toggle-body a:visited,
html[data-mode="dark"] .aoy-block-page-link a:visited,
html[data-mode="dark"] .aoy-leave-box a:visited,
html[data-mode="dark"] .aoy-mini-task a:visited {
  color: #7ab5ff !important;
}
