:root {
  --duck: #FFC93C;
  --duck-hover: #FFD25C;
  --navy: #14213D;
  --navy-deep: #0B1426;
  --navy-raised: #1A2947;
  --parchment: #F7F6F2;
  --ochre: #8A5C00;
  --slate: #5B6478;
  --mist: #A3ABBD;

  --canvas: #FFFFFF;
  --canvas-alt: #F7F6F2;
  --book-bg: #F2F2F5;
  --surface-card: #FFFFFF;
  --ink: #14213D;
  --ink-muted: #5B6478;
  --hairline: rgb(20 33 61 / 0.10);
  --hairline-strong: rgb(20 33 61 / 0.18);
  --accent-text: #8A5C00;
  --focus-ring: #14213D;
  --green: #1D7F3A;
  --green-bg: rgba(29, 127, 58, 0.10);
  --amber: #A15C00;
  --amber-bg: rgba(255, 184, 0, 0.18);
  --red: #C81E1E;
  --red-bg: rgba(215, 0, 21, 0.10);

  --shadow-product: 0 18px 40px -12px rgb(20 33 61 / 0.20), 0 4px 12px rgb(20 33 61 / 0.08);
  --shadow-card: 0 2px 10px rgb(20 33 61 / 0.05), 0 0 0 1px var(--hairline);
  --font-sans: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --font-display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Apple SD Gothic Neo", "Pretendard", "Malgun Gothic", "Noto Sans KR", system-ui, sans-serif;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);
  color-scheme: light;
}

[data-theme="dark"] {
  --canvas: #0B1426;
  --canvas-alt: #14213D;
  --book-bg: #0B1426;
  --surface-card: #1A2947;
  --ink: #FFFFFF;
  --ink-muted: #A3ABBD;
  --hairline: rgb(255 255 255 / 0.11);
  --hairline-strong: rgb(255 255 255 / 0.22);
  --accent-text: #FFC93C;
  --focus-ring: #FFC93C;
  --green: #4ADE80;
  --green-bg: rgba(74, 222, 128, 0.14);
  --amber: #FFC93C;
  --amber-bg: rgba(255, 201, 60, 0.16);
  --red: #FF6B6B;
  --red-bg: rgba(255, 107, 107, 0.16);
  --shadow-product: 0 18px 40px -12px rgb(0 0 0 / 0.55), 0 4px 12px rgb(0 0 0 / 0.30);
  --shadow-card: 0 4px 14px rgb(0 0 0 / 0.28), 0 0 0 1px var(--hairline);
  color-scheme: dark;
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

html {
  scroll-behavior: smooth;
}

body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100dvh;
}

button, input, textarea {
  font: inherit;
  color: inherit;
}

button {
  cursor: pointer;
  background: none;
  border: 0;
}

a {
  color: inherit;
  text-decoration: none;
}

h1, h2, h3, h4 {
  font-family: var(--font-display);
  text-wrap: balance;
}

p {
  text-wrap: pretty;
}

.ko {
  word-break: keep-all;
  overflow-wrap: break-word;
}

.num {
  font-variant-numeric: tabular-nums;
}

:focus-visible {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

.icon-radius {
  border-radius: 22.37%;
}

.wrap {
  max-width: 1120px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

.wrap-narrow {
  max-width: 820px;
  margin-inline: auto;
  padding-inline: clamp(16px, 4vw, 32px);
}

/* Sticky Apple Header (matching duckcy.pages.dev) */
.site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  height: 56px;
  border-bottom: 1px solid transparent;
  background: color-mix(in srgb, var(--canvas) 76%, transparent);
  -webkit-backdrop-filter: saturate(180%) blur(20px);
  backdrop-filter: saturate(180%) blur(20px);
  transition: border-color 0.2s;
}

.site-header.scrolled {
  border-bottom-color: var(--hairline);
}

.header-inner {
  display: flex;
  height: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.brand-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  font-weight: 700;
  font-size: 18px;
  letter-spacing: -0.02em;
  flex-shrink: 0;
}

.brand-link img {
  width: 28px;
  height: 28px;
  display: block;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nav-link {
  display: inline-flex;
  align-items: center;
  min-height: 36px;
  padding: 6px 12px;
  border-radius: 9999px;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-muted);
  transition: color 0.15s, background-color 0.15s;
}

.nav-link:hover {
  color: var(--ink);
  background: var(--hairline);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-width: 36px;
  height: 36px;
  padding: 0 10px;
  border-radius: 9999px;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  transition: background-color 0.15s, transform 0.1s;
}

.icon-btn:hover {
  background: var(--hairline);
}

.icon-btn:active {
  transform: scale(0.95);
}

.icon-btn.spin svg {
  animation: spin 0.6s ease;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Buttons & Pills */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
  padding: 12px 24px;
  border-radius: 9999px;
  background: var(--duck);
  color: var(--navy);
  font-size: 16px;
  font-weight: 700;
  letter-spacing: -0.01em;
  transition: background-color 0.2s, transform 0.12s, opacity 0.2s;
}

.btn-primary:hover {
  background: var(--duck-hover);
}

.btn-primary:active {
  transform: scale(0.97);
}

.btn-primary:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 42px;
  padding: 9px 18px;
  border-radius: 9999px;
  background: var(--canvas-alt);
  color: var(--ink);
  border: 1px solid var(--hairline);
  font-size: 14px;
  font-weight: 600;
  transition: background-color 0.15s, border-color 0.15s, transform 0.12s;
}

.btn-secondary:hover {
  border-color: var(--hairline-strong);
  background: color-mix(in srgb, var(--ink) 5%, var(--canvas-alt));
}

.btn-secondary:active {
  transform: scale(0.97);
}

.btn-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 34px;
  padding: 5px 13px;
  border-radius: 9999px;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  white-space: nowrap;
  transition: border-color 0.15s, color 0.15s;
}

.btn-chip:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.btn-chip.active {
  background: var(--navy);
  color: #FFFFFF;
  border-color: var(--navy);
}

[data-theme="dark"] .btn-chip.active {
  background: var(--duck);
  color: var(--navy);
  border-color: var(--duck);
}

/* Typography Scale */
.t-eyebrow {
  font-size: 12.5px;
  line-height: 1.2;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--accent-text);
}

.t-hero {
  font-size: clamp(2rem, 1.2rem + 3.4vw, 3.35rem);
  line-height: 1.12;
  font-weight: 700;
  letter-spacing: -0.03em;
}

.t-title {
  font-size: clamp(1.5rem, 1.2rem + 1.2vw, 2rem);
  line-height: 1.18;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.t-card {
  font-size: 19px;
  line-height: 1.3;
  font-weight: 700;
  letter-spacing: -0.015em;
}

/* Home Hero & Creator Studio */
.hero {
  padding: clamp(40px, 6vw, 76px) 0 clamp(28px, 4vw, 44px);
  text-align: center;
}

.hero-lead {
  max-width: 34em;
  margin: 16px auto 0;
  font-size: clamp(16px, 1.4vw + 12px, 19px);
  color: var(--ink-muted);
  line-height: 1.65;
}

.studio-card {
  background: var(--surface-card);
  border-radius: 24px;
  padding: clamp(20px, 4vw, 36px);
  box-shadow: var(--shadow-product), 0 0 0 1px var(--hairline);
}

.field-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.field-hint {
  font-size: 13px;
  color: var(--ink-muted);
  line-height: 1.5;
}

.input-row {
  display: flex;
  gap: 8px;
  align-items: stretch;
}

.text-input {
  width: 100%;
  min-height: 48px;
  padding: 11px 15px;
  border-radius: 14px;
  border: 1px solid var(--hairline-strong);
  background: var(--canvas-alt);
  color: var(--ink);
  font-size: 15px;
  transition: border-color 0.15s, background-color 0.15s;
}

.text-input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface-card);
}

.text-input::placeholder {
  color: var(--ink-muted);
  opacity: 0.72;
}

.creator-grid {
  display: grid;
  gap: 20px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr;
  gap: 18px;
}

@media (min-width: 720px) {
  .two-col {
    grid-template-columns: 1.15fr 0.85fr;
    align-items: start;
  }
}

/* Inline 4-digit PIN setter */
.pin-setter-box {
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  border-radius: 18px;
  padding: 16px;
}

.pin-setter-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 12px;
}

.pin-slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}

.pin-slot {
  height: 54px;
  border-radius: 14px;
  background: var(--surface-card);
  border: 1.5px solid var(--hairline-strong);
  display: grid;
  place-items: center;
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  transition: border-color 0.15s, transform 0.1s;
}

.pin-slot.filled {
  border-color: var(--ink);
}

.pin-slot.active-slot {
  border-color: var(--accent-text);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--duck) 28%, transparent);
}

.mini-keypad {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}

.mini-key {
  height: 42px;
  border-radius: 12px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  font-size: 16px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  transition: background-color 0.12s, transform 0.08s;
}

.mini-key:hover {
  background: color-mix(in srgb, var(--ink) 5%, var(--surface-card));
}

.mini-key:active {
  transform: scale(0.95);
}

.mini-key.muted {
  background: transparent;
  border-color: transparent;
  color: var(--ink-muted);
  font-size: 13px;
}

/* iOS Switch */
.toggle-list {
  display: grid;
  gap: 10px;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
}

.toggle-text strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
}

.toggle-text span {
  display: block;
  font-size: 12.5px;
  color: var(--ink-muted);
}

.switch {
  position: relative;
  width: 48px;
  height: 28px;
  flex-shrink: 0;
}

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

.switch-track {
  position: absolute;
  inset: 0;
  border-radius: 9999px;
  background: var(--hairline-strong);
  transition: background-color 0.2s;
  cursor: pointer;
}

.switch-track::after {
  content: "";
  position: absolute;
  top: 3px;
  left: 3px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 2px 5px rgb(0 0 0 / 0.20);
  transition: transform 0.2s var(--ease);
}

.switch input:checked + .switch-track {
  background: #34C759;
}

.switch input:checked + .switch-track::after {
  transform: translateX(20px);
}

.switch input:focus-visible + .switch-track {
  outline: 2px solid var(--focus-ring);
  outline-offset: 2px;
}

/* Result & Recent Links */
.result-card {
  margin-top: 20px;
  padding: 20px;
  border-radius: 18px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline-strong);
  animation: rise 0.35s var(--ease) backwards;
}

.share-url-box {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 12px;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  margin: 12px 0;
}

.share-url-text {
  flex: 1;
  min-width: 0;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.error-banner {
  padding: 12px 15px;
  border-radius: 14px;
  background: var(--red-bg);
  color: var(--red);
  font-size: 14px;
  font-weight: 600;
}

/* Dark Feature Tile (duckcy.pages.dev unzip tile pattern) */
.feature-tile {
  margin-top: clamp(32px, 5vw, 56px);
  background: var(--navy);
  color: #FFFFFF;
  border-radius: 26px;
  padding: clamp(24px, 4vw, 44px);
  display: grid;
  gap: 24px;
  box-shadow: 0 20px 50px -16px rgb(11 20 38 / 0.45);
}

@media (min-width: 780px) {
  .feature-tile {
    grid-template-columns: 1.2fr 0.8fr;
    align-items: center;
  }
}

.feature-tile .t-eyebrow {
  color: var(--duck);
}

.feature-tile p.lead {
  color: #A3ABBD;
  margin-top: 10px;
  font-size: 16px;
  line-height: 1.65;
}

.demo-preview-pill {
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 18px;
  padding: 18px;
  display: grid;
  gap: 10px;
}

.demo-stat-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 14px;
  padding: 6px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.09);
}

.demo-stat-row:last-child {
  border-bottom: 0;
}

.demo-stat-row span {
  color: #A3ABBD;
}

.demo-stat-row b {
  font-variant-numeric: tabular-nums;
  color: #FFFFFF;
}

/* Philosophy / How It Works Cards */
.sec-block {
  margin-top: clamp(48px, 6vw, 80px);
}

.ap-cards {
  list-style: none;
  margin-top: 24px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.ap-card {
  background: var(--canvas-alt);
  border-radius: 20px;
  padding: 22px;
  box-shadow: 0 0 0 1px var(--hairline);
}

.ap-n {
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  margin-bottom: 12px;
  border-radius: 50%;
  background: var(--duck);
  color: var(--navy);
  font-size: 13px;
  font-weight: 700;
}

.ap-card h3 {
  font-size: 17px;
  font-weight: 700;
  margin-bottom: 6px;
}

.ap-card p {
  font-size: 14.5px;
  color: var(--ink-muted);
  line-height: 1.6;
}

.recent-list {
  display: grid;
  gap: 10px;
  margin-top: 12px;
}

.recent-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 16px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
}

.recent-item-meta {
  min-width: 0;
}

.recent-item-meta strong {
  display: block;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.recent-item-meta span {
  font-size: 12.5px;
  color: var(--ink-muted);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* Footer */
.site-footer {
  margin-top: clamp(56px, 8vw, 96px);
  padding: 28px 0 44px;
  border-top: 1px solid var(--hairline);
  text-align: center;
  font-size: 12.5px;
  color: var(--ink-muted);
  line-height: 1.7;
}

/* =====================================================
   Admin-Dashboard Style Frosted 4-Digit PIN Lock Screen
   (matching duckc & stidamset)
   ===================================================== */
#authOverlay {
  position: fixed;
  inset: 0;
  z-index: 9999;
  background: rgba(242, 242, 245, 0.90);
  -webkit-backdrop-filter: saturate(180%) blur(24px);
  backdrop-filter: saturate(180%) blur(24px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  transition: opacity 0.18s ease, visibility 0.18s ease;
}

[data-theme="dark"] #authOverlay {
  background: rgba(11, 20, 38, 0.92);
}

#authOverlay.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

.pin-box {
  width: 100%;
  max-width: 320px;
  text-align: center;
  color: var(--ink);
}

.pin-badge {
  width: 56px;
  height: 56px;
  margin: 0 auto 16px;
  border-radius: 22.37%;
  background: var(--navy);
  color: var(--duck);
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px -8px rgb(20 33 61 / 0.35);
}

[data-theme="dark"] .pin-badge {
  background: rgba(255, 201, 60, 0.14);
  border: 1px solid rgba(255, 201, 60, 0.35);
}

.pin-lock-svg {
  width: 26px;
  height: 26px;
}

.pin-title {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 6px;
}

.pin-subtitle {
  font-size: 14px;
  color: var(--ink-muted);
  margin-bottom: 10px;
  min-height: 20px;
}

.pin-error {
  font-size: 13px;
  font-weight: 600;
  color: var(--red);
  min-height: 20px;
  margin-bottom: 14px;
}

.pin-dots {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-bottom: 28px;
}

.pin-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1.5px solid var(--ink);
  opacity: 0.45;
  transition: background-color 0.15s, border-color 0.15s, opacity 0.15s, transform 0.12s;
}

[data-theme="dark"] .pin-dot {
  border-color: rgba(255, 255, 255, 0.65);
}

.pin-dot.filled {
  background: var(--ink);
  border-color: var(--ink);
  opacity: 1;
  transform: scale(1.08);
}

[data-theme="dark"] .pin-dot.filled {
  background: var(--duck);
  border-color: var(--duck);
}

.pin-pad {
  display: grid;
  grid-template-columns: repeat(3, 74px);
  gap: 14px 18px;
  justify-content: center;
}

.pin-btn {
  width: 74px;
  height: 74px;
  border-radius: 50%;
  border: 0;
  background: rgba(20, 33, 61, 0.08);
  color: var(--ink);
  font-size: 28px;
  font-weight: 400;
  font-variant-numeric: tabular-nums;
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: background-color 0.14s, transform 0.08s;
}

.pin-btn:hover {
  background: rgba(20, 33, 61, 0.14);
}

.pin-btn:active {
  background: #FFFFFF;
  transform: scale(0.94);
}

[data-theme="dark"] .pin-btn {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

[data-theme="dark"] .pin-btn:hover {
  background: rgba(255, 255, 255, 0.20);
}

[data-theme="dark"] .pin-btn:active {
  background: rgba(255, 255, 255, 0.34);
}

.pin-btn.action {
  background: transparent;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-muted);
}

.pin-btn.action:hover {
  color: var(--ink);
  background: rgba(20, 33, 61, 0.06);
}

[data-theme="dark"] .pin-btn.action {
  color: var(--duck);
}

.pin-btn.action:active {
  background: transparent;
}

.pin-home-link {
  display: inline-block;
  margin-top: 26px;
  font-size: 13px;
  color: var(--ink-muted);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%, 60% { transform: translateX(-8px); }
  40%, 80% { transform: translateX(8px); }
}

.shake {
  animation: shake 0.35s ease;
}

/* =====================================================
   Unlocked Vault & Notion Content Renderer
   ===================================================== */
.vault-main {
  padding: 24px 0 72px;
}

.vault-cover {
  width: 100%;
  height: clamp(140px, 22vw, 220px);
  object-fit: cover;
  border-radius: 22px;
  margin-bottom: 20px;
  border: 1px solid var(--hairline);
}

.vault-page-head {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 22px;
}

.vault-title-wrap {
  display: flex;
  align-items: center;
  gap: 12px;
}

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

.vault-page-icon img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  object-fit: cover;
}

.vault-meta-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.meta-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 9999px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink-muted);
  font-variant-numeric: tabular-nums;
}

.live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #34C759;
}

/* Book / Tab Strip (from duckcy.pages.dev) */
.db-shell {
  margin-top: 16px;
}

.tabs {
  position: relative;
  z-index: 2;
  display: flex;
  height: 43px;
  margin-bottom: -3px;
  max-width: 480px;
}

.tab {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  margin: 3px 0;
  padding: 0 14px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  background: color-mix(in srgb, var(--canvas-alt) 85%, transparent);
  color: var(--ink-muted);
  font-size: 14px;
  font-weight: 600;
  border-radius: 14px 14px 0 0;
  border: 1px solid var(--hairline);
  border-bottom: 0;
}

.tab[aria-selected="true"] {
  z-index: 1;
  margin: 0;
  padding-bottom: 3px;
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: 0 -2px 10px rgb(20 33 61 / 0.04);
}

.db-panel {
  position: relative;
  z-index: 1;
  background: var(--surface-card);
  border: 1px solid var(--hairline);
  border-radius: 0 18px 22px 22px;
  padding: clamp(16px, 2.5vw, 24px);
  box-shadow: var(--shadow-card);
}

@media (max-width: 520px) {
  .tabs {
    max-width: 100%;
  }
  .db-panel {
    border-radius: 0 0 20px 20px;
  }
}

.db-toolbar {
  display: grid;
  gap: 12px;
  margin-bottom: 16px;
}

.db-search-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
}

.search-box {
  position: relative;
  flex: 1;
  min-width: 220px;
}

.search-box > .search-icon {
  position: absolute;
  left: 13px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-muted);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.search-input {
  width: 100%;
  height: 40px;
  padding: 0 14px 0 38px;
  border-radius: 12px;
  border: 1px solid var(--hairline);
  background: var(--canvas-alt);
  font-size: 14px;
}

.search-input:focus {
  outline: none;
  border-color: var(--ink);
  background: var(--surface-card);
}

.filter-strip {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}

/* Apple Table & Mobile Cards */
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: 16px;
}

.notion-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13.5px;
  text-align: left;
}

.notion-table th {
  background: var(--canvas-alt);
  color: var(--ink-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline);
  white-space: nowrap;
}

.notion-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--hairline);
  vertical-align: middle;
}

.notion-table tr:last-child td {
  border-bottom: 0;
}

.notion-table tbody tr:hover {
  background: color-mix(in srgb, var(--canvas-alt) 65%, transparent);
}

.row-title-btn {
  text-align: left;
  font-weight: 600;
  color: var(--ink);
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.row-title-btn:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* Mobile card fallback */
.mobile-cards {
  display: none;
  gap: 12px;
}

@media (max-width: 760px) {
  .table-wrap {
    display: none;
  }
  .mobile-cards {
    display: grid;
  }
}

.m-card {
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  border-radius: 16px;
  padding: 14px 16px;
  display: grid;
  gap: 10px;
}

.m-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.m-card-grid {
  display: grid;
  gap: 8px;
}

.m-card-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  font-size: 13px;
  padding-top: 6px;
  border-top: 1px solid var(--hairline);
}

.m-card-row dt {
  color: var(--ink-muted);
  font-size: 12px;
  flex-shrink: 0;
  padding-top: 2px;
}

.m-card-row dd {
  text-align: right;
  min-width: 0;
  word-break: break-word;
}

/* Cell Chips, Badges, Copy & Secret Reveal */
.tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.n-tag {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
  background: rgba(20, 33, 61, 0.08);
  color: var(--ink);
}

[data-theme="dark"] .n-tag {
  background: rgba(255, 255, 255, 0.12);
  color: #FFFFFF;
}

.n-tag[data-color="red"] { background: rgba(224, 62, 62, 0.13); color: #B42318; }
.n-tag[data-color="pink"] { background: rgba(217, 70, 143, 0.14); color: #9D174D; }
.n-tag[data-color="orange"] { background: rgba(234, 88, 12, 0.13); color: #9A3412; }
.n-tag[data-color="yellow"] { background: rgba(255, 201, 60, 0.28); color: #7C5100; }
.n-tag[data-color="green"] { background: rgba(29, 127, 58, 0.13); color: #166534; }
.n-tag[data-color="blue"] { background: rgba(0, 102, 204, 0.13); color: #0055AA; }
.n-tag[data-color="purple"] { background: rgba(124, 58, 237, 0.13); color: #5B21B6; }
.n-tag[data-color="brown"] { background: rgba(146, 64, 14, 0.13); color: #78350F; }
.n-tag[data-color="teal"] { background: rgba(13, 148, 136, 0.13); color: #115E59; }

[data-theme="dark"] .n-tag[data-color="red"] { background: rgba(255, 107, 107, 0.20); color: #FCA5A5; }
[data-theme="dark"] .n-tag[data-color="pink"] { background: rgba(244, 114, 182, 0.20); color: #FBCFE8; }
[data-theme="dark"] .n-tag[data-color="orange"] { background: rgba(251, 146, 60, 0.20); color: #FED7AA; }
[data-theme="dark"] .n-tag[data-color="yellow"] { background: rgba(255, 201, 60, 0.22); color: #FFE58F; }
[data-theme="dark"] .n-tag[data-color="green"] { background: rgba(74, 222, 128, 0.20); color: #BBF7D0; }
[data-theme="dark"] .n-tag[data-color="blue"] { background: rgba(96, 165, 250, 0.20); color: #BFDBFE; }
[data-theme="dark"] .n-tag[data-color="purple"] { background: rgba(167, 139, 250, 0.20); color: #DDD6FE; }
[data-theme="dark"] .n-tag[data-color="brown"] { background: rgba(217, 119, 6, 0.22); color: #FDE68A; }
[data-theme="dark"] .n-tag[data-color="teal"] { background: rgba(45, 212, 191, 0.20); color: #99F6E4; }

.pub-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pub-badge.on {
  background: var(--green-bg);
  color: var(--green);
}

.pub-badge.off {
  background: var(--hairline);
  color: var(--ink-muted);
}

.pub-badge::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
}

.inline-secret, .inline-copy-wrap {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  max-width: 100%;
  white-space: nowrap;
}

.mono-val {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}

.mini-action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 3px 8px;
  border-radius: 8px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-muted);
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  white-space: nowrap;
  transition: border-color 0.12s, color 0.12s;
}

.mini-action-btn:hover {
  color: var(--ink);
  border-color: var(--hairline-strong);
}

.rel-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  color: var(--ink);
  transition: border-color 0.12s, background-color 0.12s;
}

.rel-pill:hover {
  border-color: var(--ink);
}

.date-badge {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.exp-flag {
  font-size: 11px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
}

.exp-flag.soon { background: var(--amber-bg); color: var(--amber); }
.exp-flag.expired { background: var(--red-bg); color: var(--red); }

/* General Notion Blocks */
.blocks-flow {
  display: grid;
  gap: 12px;
  margin-bottom: 24px;
}

.nb-h1 { font-size: 26px; font-weight: 700; margin-top: 14px; }
.nb-h2 { font-size: 21px; font-weight: 700; margin-top: 12px; }
.nb-h3 { font-size: 18px; font-weight: 600; margin-top: 8px; }
.nb-p { font-size: 16px; line-height: 1.65; }
.nb-callout {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 16px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
}
.nb-quote {
  padding: 6px 16px;
  border-left: 3px solid var(--duck);
  color: var(--ink-muted);
}
.nb-code {
  background: #0F172A;
  color: #E2E8F0;
  padding: 14px 16px;
  border-radius: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  overflow-x: auto;
}
.nb-divider {
  border: 0;
  border-top: 1px solid var(--hairline);
  margin: 8px 0;
}
.nb-img {
  max-width: 100%;
  border-radius: 16px;
  border: 1px solid var(--hairline);
}
.nb-child-page {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 14px;
  background: var(--canvas-alt);
  border: 1px solid var(--hairline);
  font-weight: 600;
  font-size: 15px;
}

/* Detail / Side-Peek Modal */
dialog.peek-modal {
  margin: auto;
  width: min(620px, calc(100vw - 24px));
  max-height: calc(100dvh - 32px);
  border: 0;
  border-radius: 24px;
  background: var(--surface-card);
  color: var(--ink);
  box-shadow: var(--shadow-product), 0 0 0 1px var(--hairline);
  padding: 0;
  overflow: hidden;
}

dialog.peek-modal::backdrop {
  background: rgba(11, 20, 38, 0.45);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}

.peek-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 22px;
  border-bottom: 1px solid var(--hairline);
}

.peek-body {
  padding: 20px 22px 26px;
  overflow-y: auto;
  max-height: calc(100dvh - 110px);
  display: grid;
  gap: 16px;
}

.peek-props {
  border: 1px solid var(--hairline);
  border-radius: 16px;
  overflow: hidden;
}

.peek-prop-row {
  display: grid;
  grid-template-columns: 112px 1fr;
  gap: 12px;
  padding: 11px 14px;
  font-size: 14px;
  background: var(--canvas-alt);
}

.peek-prop-row + .peek-prop-row {
  border-top: 1px solid var(--hairline);
}

.peek-prop-name {
  color: var(--ink-muted);
  font-size: 13px;
  font-weight: 600;
}

/* Toast */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  background: var(--navy);
  color: #FFFFFF;
  padding: 10px 18px;
  border-radius: 9999px;
  font-size: 13.5px;
  font-weight: 600;
  box-shadow: 0 10px 28px rgb(0 0 0 / 0.25);
  opacity: 0;
  pointer-events: none;
  z-index: 10000;
  transition: opacity 0.2s, transform 0.2s var(--ease);
}

[data-theme="dark"] .toast {
  background: var(--duck);
  color: var(--navy);
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

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

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
}
