/* Modern minimalistic UI for Dnimer */

:root {
  --bg: #f5f5f7;
  --bg-elevated: #ffffff;
  --bg-soft: #f0f2f6;
  --border-subtle: rgba(15, 23, 42, 0.08);
  --border-mid: rgba(148, 163, 184, 0.4);
  --border-line: rgba(148, 163, 184, 0.6);
  --border-section: rgba(148, 163, 184, 0.2);
  --accent: #2563eb;
  --accent-soft: rgba(37, 99, 235, 0.15);
  --accent-muted: rgba(37, 99, 235, 0.35);
  --danger: #dc2626;
  --danger-bg: rgba(220, 38, 38, 0.06);
  --danger-border: rgba(220, 38, 38, 0.25);
  --danger-text: #991b1b;
  --success: #16a34a;
  --text-main: #0f172a;
  --text-muted: #6b7280;
  --input-bg: #ffffff;
  --header-bg-start: rgba(248, 250, 252, 0.92);
  --header-bg-end: rgba(248, 250, 252, 0.86);
  --header-border: rgba(148, 163, 184, 0.18);
  --card-shadow: 0 18px 40px rgba(15, 23, 42, 0.08);
  --card-shadow-hover: 0 18px 40px rgba(15, 23, 42, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 999px;
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.55);
  --shadow-subtle: 0 10px 32px rgba(0, 0, 0, 0.4);
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text",
    "Segoe UI", sans-serif;
}

[data-theme="dark"] {
    --bg: #0f1117;
    --bg-elevated: #1a1d27;
    --bg-soft: #232632;
    --border-subtle: rgba(255, 255, 255, 0.08);
    --border-mid: rgba(255, 255, 255, 0.15);
    --border-line: rgba(255, 255, 255, 0.15);
    --border-section: rgba(255, 255, 255, 0.08);
    --accent: #4f8fff;
    --accent-soft: rgba(79, 143, 255, 0.15);
    --accent-muted: rgba(79, 143, 255, 0.35);
    --danger: #f87171;
    --danger-bg: rgba(248, 113, 113, 0.1);
    --danger-border: rgba(248, 113, 113, 0.25);
    --danger-text: #fca5a5;
    --success: #4ade80;
    --text-main: #e2e8f0;
    --text-muted: #94a3b8;
    --input-bg: #1a1d27;
    --header-bg-start: rgba(15, 17, 23, 0.92);
    --header-bg-end: rgba(15, 17, 23, 0.86);
    --header-border: rgba(255, 255, 255, 0.08);
    --card-shadow: 0 18px 40px rgba(0, 0, 0, 0.3);
    --card-shadow-hover: 0 18px 40px rgba(0, 0, 0, 0.45);
  --shadow-soft: 0 18px 40px rgba(0, 0, 0, 0.7);
  --shadow-subtle: 0 10px 32px rgba(0, 0, 0, 0.6);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html,
body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text-main);
  -webkit-font-smoothing: antialiased;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

body > main.app-main {
  flex: 1;
}

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

a:hover {
  text-decoration: underline;
}

p {
  line-height: 1.6;
}

/* Layout shell */
.app-shell {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 20px;
}

.app-header {
  position: static;
  z-index: 20;
  background: var(--bg);
  border-bottom: 1px solid var(--border-subtle);
}

.app-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 0;
  gap: 16px;
  position: relative;
}

.nav-links-landing {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
}

.brand {
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  font-size: 0.9rem;
  color: var(--text-main);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 16px;
  font-size: 0.9rem;
}

.nav-auth {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.85rem;
}

.nav-link {
  color: var(--text-muted);
  text-decoration: none;
  padding: 4px 0;
}

.nav-link:hover {
  color: var(--text-main);
}

/* User menu dropdown */
.user-menu {
  position: relative;
}

.user-menu-trigger {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font: inherit;
  font-size: 0.82rem;
  color: var(--text-muted);
  padding: 4px 0;
  transition: color 0.15s ease;
}

.user-menu-trigger:hover {
  color: var(--text-main);
}

.user-menu-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  padding-top: 6px;
  min-width: 160px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 4px;
  z-index: 30;
}

.user-menu.open .user-menu-dropdown,
.user-menu:hover .user-menu-dropdown {
  display: flex;
  flex-direction: column;
}

.user-menu-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-main);
  text-decoration: none;
  border: none;
  background: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s ease;
  font: inherit;
  width: 100%;
  text-align: left;
}

.user-menu-item:hover {
  background: var(--bg-soft);
  text-decoration: none;
}

.user-menu-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.user-menu-name {
  padding: 8px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-main);
}

.user-menu-item-danger {
  color: var(--danger);
}


.nav-link.subtle {
  font-size: 0.8rem;
}

.nav-link-accent {
  color: var(--accent);
  font-weight: 600;
}
.nav-link-accent:hover {
  color: var(--accent-hover, var(--accent));
}

.app-main {
  padding: 24px 0 40px;
}

.app-footer {
  padding: 20px 0 24px;
  border-top: 1px solid var(--border-subtle);
  font-size: 0.85rem;
  color: var(--text-muted);
}

.app-footer .app-shell {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

.app-footer a {
  color: var(--text-muted);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--text-main);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  border-radius: var(--radius-sm);
  border: 1px solid transparent;
  padding: 9px 16px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  text-decoration: none;
  background: transparent;
  color: var(--text-main);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    box-shadow 0.15s ease, transform 0.1s ease;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.85rem;
}

.btn.btn-xs {
  padding: 4px 10px;
  font-size: 0.75rem;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7b5cff);
  border-color: var(--accent-muted);
  color: #fff;
  box-shadow: var(--shadow-subtle);
}

.btn-primary:hover {
  box-shadow: var(--shadow-soft);
}

.btn-ghost {
  background: transparent;
  border-color: var(--border-mid);
  color: var(--text-muted);
}

.btn-ghost:hover {
  border-color: var(--border-line);
  color: var(--text-main);
  background: var(--bg-soft);
}

.btn-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.btn-danger:hover {
  background: var(--danger-bg);
  filter: brightness(1.1);
}

.btn-danger-solid {
  border-color: var(--danger);
  background: var(--danger);
  color: #fff;
}

.btn-danger-solid:hover {
  background: var(--danger);
  filter: brightness(1.15);
  color: #fff;
}

/* Alerts (messages) */
.alert {
  border-radius: 999px;
  padding: 10px 16px;
  font-size: 0.85rem;
  border: 1px solid var(--border-mid);
  background: var(--bg-elevated);
  color: var(--text-main);
  margin-bottom: 12px;
}

.alert-error,
.alert-danger {
  border-color: var(--danger-border);
  background: var(--danger-bg);
  color: var(--danger-text);
}

.alert-success {
  border-color: rgba(74, 222, 128, 0.3);
  background: rgba(74, 222, 128, 0.1);
  color: var(--success);
}

.alert-debug {
  opacity: 0.8;
}

/* Cards / surfaces */
.card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  box-shadow: var(--card-shadow);
}

.card-body {
  padding: 16px 18px;
}

.card-header {
  padding: 14px 18px 0;
}

/* Timeline */
.time-gap {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin: 10px 0;
}

.own_markdown,
.markdown {
  font-size: 0.98rem;
  line-height: 1.65;
}

.timeline {
  position: relative;
  margin-left: 16px;
  padding-left: 28px;
  border-left: 1px solid var(--border-line);
}

.timeline-item {
  position: relative;
  margin-bottom: 20px;
}

.timeline-dot {
  position: absolute;
  left: -33px;
  top: 6px;
  width: 9px;
  height: 9px;
  background: var(--accent);
  border-radius: 50%;
  box-shadow: 0 0 0 5px var(--accent-soft);
}

.timeline-content {
  padding: 4px 0;
}

.timeline-time {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

/* Landing — Hero */
.hero {
  text-align: center;
  padding: 56px 0 40px;
  max-width: 640px;
  margin: 0 auto;
}

.hero-eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.16em;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.lang-switch {
  margin-left: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  text-decoration: none;
}

.lang-switch:hover {
  color: var(--accent);
}

.hero-title {
  font-size: 2.8rem;
  font-weight: 750;
  letter-spacing: -0.035em;
  line-height: 1.15;
  margin: 0 0 20px;
}

.hero-lead {
  color: var(--text-muted);
  font-size: 1.05rem;
  line-height: 1.7;
  margin: 0 auto;
  max-width: 520px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 28px;
}

/* Landing — Example use cases */
.examples {
  padding: 48px 0;
}

.examples-label {
  text-align: center;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin: 0 0 24px;
}

.examples-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.example-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  padding: 20px;
}

.example-topic {
  font-size: 0.9rem;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text-main);
}

.example-chain {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.example-entry {
  padding-left: 14px;
  border-left: 2px solid var(--border-mid);
}

.example-entry-now {
  border-left-color: var(--accent);
}

.example-time {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.example-entry p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.5;
  font-style: italic;
  color: var(--text-main);
}

.example-advice {
  margin: 14px 0 0;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  background: var(--bg-soft);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
  font-style: normal;
}

.example-mark {
  display: inline-block;
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 2px 10px;
  font-size: 0.76rem;
  font-weight: 600;
  font-style: normal;
}

.examples-caption {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 24px 0 0;
}

/* Landing — Features */
.features {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
  padding: 12px 0 48px;
  border-top: 1px solid var(--border-section);
}

.feature-card {
  padding: 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.feature-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--accent-soft);
  color: var(--accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 12px;
}

.features h3 {
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0 0 6px;
}

.features p {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* Landing — Bottom CTA */
.hero-bottom {
  text-align: center;
  padding: 32px 0 24px;
  border-top: 1px solid var(--border-section);
}

.hero-bottom-text {
  font-size: 1.15rem;
  color: var(--text-muted);
  line-height: 1.6;
  margin: 0 0 20px;
}

/* Landing — Featured chain section wrapper */
.featured-chain-section {
  padding: 0 0 48px;
  border-top: 1px solid var(--border-section);
}

.featured-chain-section > .examples-label {
  padding-top: 36px;
}

.featured-chain-section .chain-example {
  max-width: 520px;
  margin: 0 auto;
}

/* ── Unified chain example block (landing + examples page) ── */
.chain-example {
  display: flex;
  flex-direction: column;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}

.chain-example.is-visible {
  opacity: 1;
  transform: translateY(0);
}

/* On the examples page cards are static — no scroll animation */
.chain-example--flat {
  opacity: 1;
  transform: none;
}

.chain-example-title {
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0 0 12px;
  color: var(--text-main);
}

/* entries + gaps live here; grows to fill available height in the grid */
.chain-example-body {
  display: flex;
  flex-direction: column;
  flex: 1;
}

/* white block per dnime entry */
.chain-example-entry {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 12px 14px;
}

.chain-example-time {
  display: block;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.chain-example-entry--now .chain-example-time {
  color: var(--accent);
  font-weight: 600;
}

.chain-example-entry p {
  margin: 0;
  font-size: 0.88rem;
  line-height: 1.55;
  font-style: italic;
  color: var(--text-main);
}

.chain-example-gap {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
}

.chain-example-gap-line {
  flex: 1;
  height: 1px;
  background: var(--border-mid);
}

.chain-example-gap-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  white-space: nowrap;
}

/* gray hint block — pushed to bottom of its column */
.chain-example-footer {
  margin-top: 12px;
  padding: 11px 14px;
  background: var(--bg-soft);
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  line-height: 1.5;
  color: var(--text-muted);
}

.chain-example-badge {
  display: inline-block;
  margin-top: 8px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 2px 9px;
  font-size: 0.72rem;
  font-weight: 600;
  font-style: normal;
  letter-spacing: 0.02em;
}

/* Landing — 3-card row; align-items: stretch (grid default) makes all
   columns the same height; flex: 1 on body fills extra space evenly */
.examples-grid--three {
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  gap: 28px;
}

.examples-more {
  text-align: center;
  margin: 20px 0 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
}

.examples-more-divider {
  color: var(--border-mid);
  font-size: 0.85rem;
}

.examples-more a {
  font-size: 0.85rem;
  color: var(--text-muted);
  text-decoration: none;
}

.examples-more a:hover {
  color: var(--accent);
}

/* Examples page */
.examples-page-header {
  padding: 32px 0 24px;
  border-bottom: 1px solid var(--border-section);
  margin-bottom: 36px;
}

.examples-page-header h1 {
  font-size: 1.6rem;
  font-weight: 750;
  letter-spacing: -0.025em;
  margin: 0 0 6px;
}

.examples-page-header p {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin: 0;
}

.examples-theme {
  margin-bottom: 40px;
}

.examples-theme-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: var(--text-muted);
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
}

.examples-theme-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 16px;
  align-items: start;
}

@media (max-width: 680px) {
  .examples-theme-list {
    grid-template-columns: 1fr;
  }
}

/* Page header — row variant (title centered, action on the right) */
.page-header {
  margin-bottom: 24px;
}

.page-header-row {
  position: relative;
  text-align: center;
  margin-bottom: 24px;
}

.page-header-row .btn {
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
}

/* Page header — stacked variant (back button top-left, title centered below) */
.page-header-stacked {
  margin-bottom: 24px;
}

.page-back {
  margin-bottom: 12px;
}

.page-title {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.03em;
  margin: 0;
  text-align: center;
}

.page-hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  text-align: center;
  margin: 4px 0 20px;
  line-height: 1.5;
}

.dnime-list {
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.dnime-card {
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  padding: 20px 24px 18px;
  box-shadow: var(--card-shadow);
  position: relative;
}

.dnime-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.dnime-card-title {
  font-size: 1.4rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  margin: 0;
}

.dnime-card-date {
  font-size: 0.75rem;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
  padding-top: 5px;
}

.dnime-card-link {
  position: relative;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.dnime-card-link:hover {
  border-color: var(--border-mid);
  box-shadow: var(--card-shadow-hover);
}

.dnime-card-link .card-title-link {
  color: inherit;
  text-decoration: none;
}

.dnime-card-link .card-title-link::after {
  content: '';
  position: absolute;
  inset: 0;
}

.dnime-card-link .dnime-card-bottom,
.dnime-card-link .dnime-card-tags,
.dnime-card-link .dnime-card-date {
  position: relative;
  z-index: 1;
}

.dnime-card-root {
  margin-bottom: 14px;
}

.dnime-card-root > p:first-child {
  margin-top: 0;
}

.dnime-card-root > p:last-child {
  margin-bottom: 0;
}

.dnime-card-root p:empty {
  display: none;
}

.dnime-card-link .dnime-card-root {
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Cap heading sizes inside card previews so they don't dominate the line-clamp */
.dnime-card-root h1,
.dnime-card-root h2,
.dnime-card-root h3,
.dnime-card-root h4,
.dnime-card-root h5,
.dnime-card-root h6 {
  margin: 0 0 4px;
}

.dnime-card-link .dnime-card-root h1,
.dnime-card-link .dnime-card-root h2,
.dnime-card-link .dnime-card-root h3 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.4;
}


.dnime-card-root img {
  display: block;
  margin: 0 auto;
  max-width: 100%;
  height: auto;
}

/* ── DnimerEditor ── */
.dnimer-editor-wrap {
  position: relative;
}

/* Toolbar */
.dnimer-toolbar {
  display: flex;
  gap: 1px;
  padding: 6px 8px;
  border: 1px solid var(--border-subtle);
  border-radius: 10px 10px 0 0;
  flex-wrap: wrap;
  background: var(--bg-soft);
  position: sticky;
  top: 0;
  z-index: 10;
}

.dnimer-toolbar-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  color: var(--text-muted);
  transition: all 0.1s;
}

.dnimer-toolbar-btn:hover {
  background: var(--bg-elevated);
  color: var(--text-main);
}

.dnimer-toolbar-btn.is-active {
  background: var(--accent-soft);
  color: var(--accent);
}

.dnimer-toolbar-btn svg {
  display: block;
}

.dnimer-toolbar-hlabel {
  font-size: 0.72rem;
  font-weight: 700;
  font-family: inherit;
  letter-spacing: -0.02em;
  line-height: 1;
  display: block;
  min-width: 16px;
  text-align: center;
}

.dnimer-toolbar-sep {
  width: 1px;
  background: var(--border-subtle);
  margin: 2px 4px;
  align-self: stretch;
}

/* Editor area */
.dnimer-editor-area {
  padding: 16px 20px;
  font-size: 1rem;
  line-height: 1.7;
  color: var(--text-main);
  min-height: 200px;
  cursor: text;
  border: 1px solid var(--border-subtle);
  border-top: none;
  border-radius: 0 0 10px 10px;
  background: var(--bg-elevated);
  transition: border-color 0.15s;
}

.dnimer-editor-area:focus-within {
  border-color: var(--accent-muted);
}

.dnimer-editor-area .tiptap {
  outline: none;
  min-height: inherit;
}

.dnimer-editor-area .tiptap > *:first-child { margin-top: 0; }
.dnimer-editor-area .tiptap > *:last-child { margin-bottom: 0; }

.dnimer-editor-area p { margin: 0 0 0.75em; }
.dnimer-editor-area h1,
.dnimer-editor-area h2,
.dnimer-editor-area h3 {
  margin: 1.2em 0 0.4em;
  font-weight: 700;
  line-height: 1.3;
}
.dnimer-editor-area h1 { font-size: 1.5rem; }
.dnimer-editor-area h2 { font-size: 1.25rem; }
.dnimer-editor-area h3 { font-size: 1.1rem; }
.dnimer-editor-area ul,
.dnimer-editor-area ol {
  padding-left: 1.5em;
  margin: 0 0 0.75em;
}
.dnimer-editor-area li { margin-bottom: 0.2em; }
.dnimer-editor-area blockquote {
  border-left: 3px solid var(--accent-soft);
  padding-left: 1em;
  margin: 0.5em 0;
  color: var(--text-muted);
}
.dnimer-editor-area code {
  background: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
}
.dnimer-editor-area pre {
  background: var(--bg-soft);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.75em 0;
}
.dnimer-editor-area pre code {
  background: none;
  padding: 0;
}
.dnimer-editor-area s { opacity: 0.55; }
.dnimer-editor-area a { color: var(--accent); text-decoration: underline; }
.dnimer-editor-area ul[data-type="taskList"] {
  list-style: none;
  padding-left: 0;
}
.dnimer-editor-area ul[data-type="taskList"] li {
  display: flex;
  align-items: baseline;
  gap: 6px;
}
.dnimer-editor-area ul[data-type="taskList"] li label {
  flex-shrink: 0;
}
.dnimer-editor-area hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.5em 0;
}
/* Placeholder */
.dnimer-editor-area .tiptap p.is-editor-empty:first-child::before {
  content: attr(data-placeholder);
  float: left;
  color: var(--text-muted);
  pointer-events: none;
  height: 0;
}

/* Resizable image */
.dnimer-img-wrap {
  display: flex;
  justify-content: center;
  position: relative;
  margin: 0.75em 0;
  line-height: 0;
}

.dnimer-img-wrap img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
  cursor: default;
  display: block;
}

.dnimer-img-wrap .dnimer-img-resize-handle {
  position: absolute;
  right: 0;
  bottom: 0;
  width: 14px;
  height: 14px;
  background: var(--accent);
  border-radius: 3px 0 6px 0;
  cursor: se-resize;
  opacity: 0;
  transition: opacity 0.15s;
}

.dnimer-img-wrap:hover .dnimer-img-resize-handle,
.dnimer-img-wrap.selected .dnimer-img-resize-handle,
.dnimer-img-wrap.resizing .dnimer-img-resize-handle {
  opacity: 1;
}

.dnimer-img-wrap.selected img {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}


.dnime-card-root blockquote {
  border-left: 3px solid var(--accent-soft);
  padding-left: 1em;
  margin: 0.5em 0;
  color: var(--text-muted);
}

.dnime-card-root hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: 1.25em 0;
}

.dnime-card-root code {
  background: var(--bg-soft);
  padding: 2px 5px;
  border-radius: 4px;
  font-size: 0.9em;
  font-family: ui-monospace, "SF Mono", "Fira Code", monospace;
}

.dnime-card-root pre {
  background: var(--bg-soft);
  padding: 12px 16px;
  border-radius: 8px;
  overflow-x: auto;
  margin: 0.75em 0;
  font-size: 0.9em;
}

.dnime-card-root pre code {
  background: none;
  padding: 0;
  font-size: inherit;
}

.dnime-card-root a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
}

.dnime-card-root a:hover {
  text-decoration-color: var(--accent);
}

.dnime-card-root table {
  border-collapse: collapse;
  width: 100%;
  margin: 12px 0;
  font-size: 0.9em;
}

.dnime-card-root th,
.dnime-card-root td {
  border: 1px solid var(--border-subtle);
  padding: 6px 12px;
  text-align: left;
}

.dnime-card-root th {
  background: var(--bg-soft);
  font-weight: 600;
}

.dnime-card-root del {
  opacity: 0.55;
}

.dnime-card-root mark {
  background: var(--accent-soft);
  padding: 1px 4px;
  border-radius: 3px;
}

.dnime-card-root .task-list {
  list-style: none;
  padding-left: 0;
}

.dnime-card-root .task-list-item {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.dnime-card-root .task-list-control input[type="checkbox"] {
  margin: 0;
  accent-color: var(--accent);
}

.dnime-card-bottom {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 0;
}

.dnime-card-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 4px;
  margin-top: 0;
}

.dnime-card-meta {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 0.8rem;
  color: var(--text-muted);
}

.dnime-card-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
}

.dnime-card-editor {
  background: var(--bg-soft);
  border-style: dashed;
}

.dnime-card-draft {
  border-style: dashed;
  border-color: var(--accent-muted);
  position: relative;
}

.draft-badge {
  position: absolute;
  top: -9px;
  right: 16px;
  background: var(--accent-soft);
  color: var(--accent);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  text-transform: uppercase;
}

.visibility-badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visibility-badge.user-menu-trigger {
  cursor: pointer;
  padding: 2px 0;
  border: none;
  background: none;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.visibility-public {
  color: var(--success);
}

.visibility-private {
  color: var(--text-muted);
}

.subtle-link {
  color: inherit;
  text-decoration: none;
}

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

.page-meta {
  text-align: center;
  margin-top: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

/* Detail date line */
.detail-date-line {
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
}

/* Detail status line */
.detail-status-line {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 6px;
  flex-wrap: wrap;
  position: relative;
}
.detail-info-sep {
  color: var(--border-mid);
}
.detail-badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 10px;
  border-radius: var(--radius-sm);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}
.detail-badge-private {
  background: var(--bg-soft);
  color: var(--text-muted);
  border: 1px solid var(--border-mid);
}
.detail-badge-public {
  background: rgba(22, 163, 74, 0.1);
  color: var(--success);
  border: 1px solid rgba(22, 163, 74, 0.25);
}
/* --- Tooltip --- */
[data-tooltip] {
  position: relative;
}
[data-tooltip]::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: #1e293b;
  color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.15s;
  z-index: 10;
}
[data-theme="dark"] [data-tooltip]::after {
  background: #e2e8f0;
  color: #1e293b;
}
[data-tooltip]:hover::after {
  opacity: 1;
}

/* --- Public icon on timeline cards --- */
.public-icon {
  display: inline-flex;
  align-items: center;
  color: var(--success);
  vertical-align: -2px;
  cursor: default;
}

.detail-share-link {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.detail-share-link:hover {
  text-decoration-style: solid;
}
.detail-revisit-info {
  font-size: 0.82rem;
  color: var(--accent);
  font-weight: 500;
}
.detail-revisit-note {
  font-size: 0.85em;
  color: var(--text-muted);
}
.detail-author-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.detail-author-link:hover {
  text-decoration: underline;
}

/* Gear menu */
.detail-gear-wrap {
  position: relative;
}
.detail-gear-btn {
  background: none;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  cursor: pointer;
  padding: 4px 8px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
}
.detail-gear-btn:hover {
  border-color: var(--border-line);
  color: var(--text-main);
  background: var(--bg-soft);
}
.detail-gear-dropdown {
  display: none;
  position: absolute;
  right: 0;
  top: 100%;
  min-width: 180px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 4px;
  padding-top: 10px;
  z-index: 30;
  flex-direction: column;
}
.detail-gear-wrap:hover .detail-gear-dropdown {
  display: flex;
}
.detail-gear-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  font-size: 0.82rem;
  color: var(--text-main);
  text-decoration: none;
  cursor: pointer;
  border-radius: 8px;
  transition: background 0.1s;
  font: inherit;
  width: 100%;
  text-align: left;
  background: none;
  border: none;
}
.detail-gear-item:hover {
  background: var(--bg-soft);
}
.gear-pin-limit-msg {
  display: block;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 2px 14px 6px;
  pointer-events: none;
}

.detail-gear-item-danger {
  color: var(--danger);
}
.detail-gear-item-danger:hover {
  background: var(--danger-bg);
}
.detail-gear-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 4px 0;
}

.inline-form {
  display: contents;
}

/* Revisits */
.dnime-card-entry {
  position: relative;
}

.entry-delete-form {
  position: absolute;
  top: 12px;
  right: 14px;
}

.entry-delete-btn {
  opacity: 0;
  font-size: 1.1rem;
  line-height: 1;
  color: var(--text-muted);
  transition: opacity 0.15s ease, color 0.15s ease;
}

.dnime-card-entry:hover .entry-delete-btn {
  opacity: 1;
}

.entry-delete-btn:hover {
  color: var(--text-base);
}

/* Entry inline editing */
.entry-view .dnime-card-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 6px;
  font-size: 0.8rem;
  color: var(--text-muted);
}
.entry-edited-badge {
  font-size: 0.75rem;
  color: var(--text-muted);
  font-style: italic;
}
.entry-edit-btn {
  font-size: 0.75rem;
  color: var(--text-muted);
  opacity: 0;
  transition: opacity 0.15s;
  text-decoration: underline;
  text-decoration-style: dotted;
  text-underline-offset: 2px;
}
.dnime-card-entry:hover .entry-edit-btn {
  opacity: 1;
}
.entry-edit-btn:hover {
  color: var(--accent);
  text-decoration-style: solid;
}
.entry-title-input {
  display: block;
  width: 100%;
  font-size: 1rem;
  font-weight: 600;
  border: none;
  border-bottom: 1px solid var(--border-mid);
  background: transparent;
  color: var(--text-main);
  padding: 4px 0 6px;
  margin-bottom: 10px;
  outline: none;
  box-sizing: border-box;
}
.entry-title-input:focus {
  border-bottom-color: var(--accent);
}

.revisit-section {
  display: flex;
  align-items: center;
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid var(--border-subtle);
}

.dnime-card > .revisit-section:last-child {
  margin-bottom: -8px;
}

.btn-inline {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  color: inherit;
  cursor: pointer;
}

.revisit-toggle {
  background: var(--bg-soft);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-main);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.revisit-toggle:hover {
  border-color: var(--border-line);
  background: var(--bg-soft);
}

.revisit-form {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 2px;
}

.revisit-form[hidden] {
  display: none;
}

.revisit-form input[type="datetime-local"] {
  width: auto;
  padding: 4px 8px;
  font-size: 0.82rem;
  border-radius: 8px;
}

/* Mark entries in chain */
.mark-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 10px 16px;
}

.mark-badge {
  background: var(--accent-soft);
  border: 1px solid var(--accent-muted);
  color: var(--accent);
  border-radius: var(--radius-sm);
  padding: 3px 12px;
  font-size: 0.76rem;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.mark-date {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.mark-delete {
  font-size: 1rem;
  line-height: 1;
  opacity: 0;
  transition: opacity 0.15s ease;
}

.mark-entry:hover .mark-delete {
  opacity: 1;
}

/* Mark pills + dropdown (bottom of detail page) */
.marks-section {
  margin-bottom: 16px;
}

.marks-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.mark-pill {
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.mark-pill:hover {
  border-color: var(--accent-muted);
  color: var(--accent);
  background: var(--accent-soft);
}

.marks-custom-inline {
  display: flex;
  align-items: center;
  gap: 6px;
}

.marks-custom-inline input[type="text"] {
  width: 130px;
  padding: 3px 8px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

/* Manage marks page */
.marks-manage-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
  margin-bottom: 16px;
}

.marks-manage-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  transition: box-shadow 0.15s ease;
}

.marks-manage-item.dragging {
  opacity: 0.4;
}

.marks-manage-handle {
  cursor: grab;
  color: var(--text-muted);
  font-size: 1rem;
  user-select: none;
  line-height: 1;
}

.marks-manage-label {
  flex: 1;
  font-size: 0.85rem;
  color: var(--text-main);
  min-width: 0;
}

.marks-manage-add {
  margin-top: 8px;
}

.marks-manage-add-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.marks-manage-add-form input[type="text"] {
  width: 200px;
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

/* Manage pages — inline editing & create row */
.manage-create-row {
  margin-bottom: 16px;
}

.manage-create-form {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.manage-create-form input[type="text"] {
  width: 220px;
  padding: 6px 10px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

.manage-inline-input {
  flex: 1;
  min-width: 80px;
  padding: 2px 6px;
  font-size: 0.85rem;
  border-radius: 6px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

.manage-count {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-decoration: none;
  padding: 1px 6px;
  background: var(--bg-soft);
  border-radius: 10px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: color 0.15s ease;
}

a.manage-count:hover {
  color: var(--accent);
}

/* Tags */
.tags-section {
  margin-bottom: 20px;
}

.tags-pills {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.tag-pill {
  display: inline-block;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 4px 12px;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: border-color 0.15s ease, background 0.15s ease, color 0.15s ease;
  font-family: inherit;
}

.tag-pill:hover {
  border-color: var(--border-mid);
  color: var(--text-main);
  text-decoration: none;
}

.tag-pill-active {
  background: var(--accent-soft);
  border-color: var(--accent-muted);
  color: var(--accent);
}

.tag-pill-active:hover {
  background: rgba(37, 99, 235, 0.2);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}

.tag-pill-add {
  font-weight: 600;
  padding: 4px 14px;
}

.tag-pill-sm {
  display: inline-block;
  background: var(--accent-soft);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
  font-size: 0.68rem;
  font-weight: 500;
  color: var(--accent);
  text-decoration: none;
  transition: opacity 0.15s ease;
}

.tag-pill-sm:hover {
  opacity: 0.8;
  text-decoration: none;
}

.tag-add-form {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.tag-add-form[hidden] {
  display: none;
}

.tag-add-form input[type="text"] {
  width: 140px;
  padding: 3px 8px;
  font-size: 0.78rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

/* Tag picker dropdown */
.tag-picker-dropdown {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 6px;
}

.tag-picker-dropdown[hidden] {
  display: none;
}

.tag-picker-available {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  min-height: 22px;
}

.tag-picker-none {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-style: italic;
}

.tag-available-pill {
  background: var(--bg-soft);
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 3px 10px;
  font-size: 0.78rem;
  cursor: pointer;
  color: var(--text-main);
  font-family: var(--font-sans);
}

.tag-available-pill:hover {
  background: var(--accent-soft);
  border-color: var(--accent-muted);
  color: var(--accent);
  text-decoration: none;
}

.tag-picker-input-row {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tag-picker-input-row input[type="text"] {
  flex: 1;
  min-width: 0;
  padding: 4px 8px;
  font-size: 0.82rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

.tag-picker-input-row input[type="text"]:focus {
  outline: none;
  border-color: var(--accent);
}

/* Timeline controls */
.timeline-controls {
  margin-bottom: 20px;
}
.tag-filter-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 10px;
}
.timeline-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.sort-pills {
  display: flex;
  align-items: center;
  gap: 4px;
  flex-wrap: wrap;
}
.sort-pill {
  font-size: 0.75rem;
  padding: 3px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  text-decoration: none;
  transition: background 0.15s, color 0.15s;
  border: none;
  background: none;
  cursor: pointer;
  font-family: inherit;
}
.sort-pill:hover {
  background: var(--bg-soft);
  color: var(--text-main);
  text-decoration: none;
}
.sort-pill-active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sort-pill-active:hover {
  background: var(--accent-soft);
  color: var(--accent);
}
.filter-sep {
  width: 1px;
  height: 14px;
  background: var(--border-mid);
  margin: 0 4px;
}
.date-filter-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}
.month-picker-wrap {
  position: relative;
  display: inline-flex;
}
.month-picker-popup {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  z-index: 40;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  padding: 10px;
  min-width: 180px;
}
.month-picker-popup[hidden] {
  display: none;
}
.month-picker-year-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 8px;
}
.month-picker-year {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-main);
}
.month-picker-nav {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 1.1rem;
  color: var(--text-muted);
  padding: 0 6px;
  line-height: 1;
  border-radius: var(--radius-sm);
  transition: color 0.15s, background 0.15s;
}
.month-picker-nav:hover {
  color: var(--text-main);
  background: var(--bg-soft);
}
.month-picker-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 3px;
}
.month-picker-cell {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.75rem;
  color: var(--text-muted);
  padding: 5px 4px;
  border-radius: var(--radius-sm);
  text-align: center;
  font-family: inherit;
  transition: background 0.12s, color 0.12s;
}
.month-picker-cell:hover {
  background: var(--bg-soft);
  color: var(--text-main);
}

/* Pinned cards */
.pinned-section {
  margin-bottom: 24px;
}

.section-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 10px;
}

.dnime-card-pinned {
  border-left: 3px solid var(--accent);
}

.dnime-card-revisit-suggestion {
  border-left: 3px solid var(--accent-muted);
}

.dnime-card-revisit-suggestion .dnime-card-date {
  color: var(--accent);
  font-weight: 500;
}

/* Revisit card bottom — 3-column: [Re-dnime] [reason] [tags] */
.dnime-card-bottom--revisit {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
}

.dnime-card-bottom--revisit .btn {
  justify-self: start;
}

.dnime-card-bottom--revisit .revisit-reason {
  text-align: center;
}

.dnime-card-bottom--revisit .dnime-card-tags {
  justify-self: end;
  margin-top: 0;
}

/* Revisit reason labels */
.revisit-reason {
  font-size: 0.72rem;
  color: var(--text-muted);
  font-style: italic;
}
.revisit-reason-reminder {
  color: var(--accent);
  font-style: normal;
  font-weight: 500;
}

/* Empty state */
.empty-state {
  padding: 48px 24px;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}

.empty-state-headline {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text-main);
  margin: 0;
}

.empty-state-body {
  font-size: 0.9rem;
  max-width: 340px;
  line-height: 1.6;
  margin: 0;
}

/* Archived cards */
.dnime-card-archived {
  opacity: 0.75;
}

.revisit-active {
  display: flex;
  align-items: center;
  gap: 8px;
}

.revisit-label {
  font-size: 0.78rem;
  color: var(--accent);
  font-weight: 500;
}

/* Forms */
form {
  margin: 0;
}

label {
  display: block;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--text-muted);
  margin-bottom: 6px;
}

input[type="text"],
input[type="email"],
input[type="password"],
textarea,
select {
  width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border-line);
  background: var(--input-bg);
  padding: 9px 11px;
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease,
    background 0.15s ease;
}

input:focus,
textarea:focus,
select:focus {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.meta-actions-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.meta-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: none;
  border: 1px dashed var(--border-mid);
  border-radius: var(--radius-sm);
  padding: 5px 11px;
  font-size: 0.78rem;
  font-family: inherit;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.meta-action-btn:hover {
  border-color: var(--accent-muted);
  border-style: solid;
  color: var(--accent);
  background: var(--accent-soft);
}

.meta-action-btn svg {
  flex-shrink: 0;
  opacity: 0.7;
}

.meta-action-btn-active {
  border-style: solid;
  border-color: var(--border-mid);
  color: var(--text-main);
}

.meta-action-btn-active svg {
  opacity: 1;
}

.backdate-section {
  margin-top: 10px;
}

.backdate-toggle-wrap[hidden],
.backdate-form[hidden] {
  display: none;
}

.label-optional {
  font-size: 0.72rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-left: 4px;
  text-transform: lowercase;
}

.draft-clickable {
  cursor: pointer;
}

.draft-clickable:hover {
  opacity: 0.8;
}

.dnime-card-draft-rednime .form-actions {
  margin-top: 8px;
}

.rednime-discard {
  color: var(--danger-text) !important;
  border-color: transparent !important;
}

.rednime-discard:hover {
  color: var(--danger) !important;
}

/* .backdate-link removed — replaced by .meta-action-btn */

.backdate-form {
  display: flex;
  align-items: center;
  gap: 8px;
}

.backdate-form label {
  font-size: 0.78rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.backdate-form input[type="datetime-local"] {
  padding: 4px 8px;
  font-size: 0.8rem;
  border-radius: 8px;
  border: 1px solid var(--border-mid);
  background: var(--input-bg);
  color: var(--text-main);
}

.form-actions {
  margin-top: 14px;
  display: flex;
  gap: 8px;
}

/* Search icon button */
.search-icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  color: var(--text-muted);
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s ease, background 0.15s ease;
}

.search-icon-btn:hover {
  color: var(--text-main);
  background: var(--bg-soft);
}

/* Search modal */
.search-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.4);
  backdrop-filter: blur(4px);
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 24px;
}

.search-overlay[hidden] {
  display: none;
}

.search-modal {
  width: 100%;
  max-width: 560px;
  max-height: 70vh;
  display: flex;
  flex-direction: column;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
}

.search-modal input {
  border: none;
  border-bottom: 1px solid var(--border-subtle);
  border-radius: 0;
  font-size: 1.05rem;
  padding: 16px 20px;
}

.search-modal input:focus {
  box-shadow: none;
  border-color: var(--border-subtle);
}

.search-results {
  overflow-y: auto;
  padding: 6px;
}

/* Feedback modal */
#feedback-modal.search-overlay {
  padding: 24px;
  align-items: flex-start;
}

.feedback-modal-inner {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.feedback-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-main);
}

.feedback-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.feedback-form textarea {
  width: 100%;
  padding: 12px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-main);
  resize: vertical;
  min-height: 100px;
}

.feedback-form textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.feedback-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin: 6px 0 0;
}

.feedback-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

.feedback-success {
  font-size: 0.9rem;
  color: var(--success);
  margin: 0;
}

/* Revisit modal */
.revisit-modal-inner {
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 48px);
  overflow-y: auto;
  flex-shrink: 0;
  padding: 24px;
  background: var(--bg-elevated);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-soft);
}

.revisit-modal-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 4px;
  color: var(--text-main);
}

.revisit-modal-desc {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 16px;
}

.revisit-form-modal {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.revisit-form-modal label {
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--text-main);
}

.revisit-form-modal .optional {
  font-weight: 400;
  color: var(--text-muted);
}

.revisit-form-modal input[type="datetime-local"],
.revisit-form-modal input[type="text"] {
  width: 100%;
  min-width: 0;
  max-width: 100%;
  padding: 10px 14px;
  font-size: 0.9rem;
  font-family: inherit;
  border: 1px solid var(--border-mid);
  border-radius: var(--radius-md);
  background: var(--input-bg);
  color: var(--text-main);
}

.revisit-form-modal input:focus {
  outline: none;
  border-color: var(--accent);
}

.revisit-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin: 0;
}

.revisit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 4px;
  align-items: center;
}

.revisit-remove-btn {
  margin-left: auto;
  font-size: 0.82rem;
  color: var(--text-muted);
}

.revisit-remove-btn:hover {
  color: var(--danger);
}

/* Revisit presets */
.revisit-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
}
.revisit-preset {
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  padding: 5px 12px;
  font-size: 0.76rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  font-family: inherit;
}
.revisit-preset:hover {
  border-color: var(--accent-muted);
  color: var(--accent);
  background: var(--accent-soft);
}

.revisit-note {
  font-size: 0.85em;
  color: var(--text-muted);
}

.search-result {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 14px;
  border-radius: var(--radius-md);
  text-decoration: none;
  transition: background 0.1s ease;
}

.search-result:hover,
.search-result-focused {
  background: var(--bg-soft);
  text-decoration: none;
}

.search-result-title {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--text-main);
}

.search-result-preview {
  font-size: 0.82rem;
  color: var(--text-muted);
  line-height: 1.4;
}

.search-result-note {
  font-size: 0.72rem;
  color: var(--accent);
  font-weight: 500;
}

.search-empty {
  text-align: center;
  padding: 20px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

/* Search standalone page */
.search-form input {
  font-size: 1rem;
  padding: 12px 16px;
  border-radius: var(--radius-sm);
}

/* Starter prompts */
.template-picker-wrap {
  margin-bottom: 16px;
}

.template-picker-toggle {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.82rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: color 0.15s ease;
  text-decoration: underline;
  text-underline-offset: 2px;
  text-decoration-style: dotted;
}

.template-picker-toggle:hover,
.template-picker-toggle-active {
  color: var(--accent);
}

.template-picker {
  margin-top: 12px;
  margin-bottom: 4px;
}

.template-description {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: -2px;
  margin-bottom: 6px;
}

.prompt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
}

.prompt-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  text-align: left;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.prompt-card:hover {
  border-color: var(--border-mid);
  box-shadow: var(--card-shadow);
}

.prompt-card-active {
  border-color: var(--accent-muted);
  box-shadow: 0 0 0 1px var(--accent-soft);
}

.prompt-title {
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--text-main);
}

.prompt-hint {
  font-size: 0.78rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Draft recovered toast */
/* ── Image lightbox ─────────────────────────────────────── */
.img-lightbox {
  position: fixed;
  inset: 0;
  z-index: 500;
  background: rgba(0, 0, 0, 0.75);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  opacity: 0;
  transition: opacity 0.18s ease;
  backdrop-filter: blur(4px);
}

.img-lightbox[hidden] {
  display: none;
}

.img-lightbox.is-open {
  opacity: 1;
}

.img-lightbox-inner {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  max-width: min(90vw, 1000px);
  max-height: 90vh;
  gap: 0;
}

.img-lightbox-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 6px 4px;
}

.img-lightbox-link {
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.7);
  text-decoration: none;
  transition: color 0.15s;
}

.img-lightbox-link:hover {
  color: #fff;
}

.img-lightbox-close {
  background: none;
  border: none;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.7);
  padding: 4px;
  display: flex;
  align-items: center;
  border-radius: 6px;
  transition: color 0.15s, background 0.15s;
}

.img-lightbox-close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
}

.img-lightbox-img {
  display: block;
  max-width: 100%;
  max-height: calc(90vh - 48px);
  object-fit: contain;
  border-radius: 6px;
}

.dnime-card-root img {
  cursor: zoom-in;
}

body.lightbox-open {
  overflow: hidden;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(16px);
  padding: 10px 20px;
  font-size: 0.88rem;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-soft);
  opacity: 0;
  transition: opacity 0.2s ease, transform 0.2s ease;
  z-index: 200;
  pointer-events: none;
}

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

.form-error {
  font-size: 0.85rem;
  color: var(--danger);
  margin: 0 0 12px;
  padding: 8px 14px;
  background: var(--danger-bg);
  border: 1px solid var(--danger-border);
  border-radius: var(--radius-md);
}

/* FAQ */
.faq-section {
  border-top: 1px solid var(--border-section);
  padding: 36px 0 24px;
}

.faq-title {
  font-size: 1.3rem;
  font-weight: 700;
  text-align: center;
  margin: 0 0 24px;
}

.faq-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
}

.faq-item {
  padding: 18px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-subtle);
  background: var(--bg-elevated);
}

.faq-item h3 {
  font-size: 0.92rem;
  font-weight: 600;
  margin: 0 0 6px;
}

.faq-item p {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin: 0;
  line-height: 1.55;
}

/* Auth forms */
.auth-container {
  display: flex;
  justify-content: center;
  padding: 24px 0;
}

.auth-card {
  width: 100%;
  max-width: 420px;
}

.auth-card h1,
.auth-card h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  text-align: center;
  margin: 0 0 20px;
}

.auth-card p {
  font-size: 0.9rem;
  color: var(--text-muted);
  text-align: center;
}

.auth-card p a {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: var(--accent-soft);
  text-underline-offset: 2px;
}

.auth-card p a:hover {
  text-decoration-color: var(--accent);
}

.auth-field {
  margin-bottom: 10px;
}

.password-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-input-wrap input {
  flex: 1;
  padding-right: 40px;
}

.password-input-wrap .password-toggle-btn {
  position: absolute;
  right: 10px;
  top: 50%;
  transform: translateY(-50%);
  padding: 6px;
  border: none;
  background: none;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.15s ease;
}

.password-input-wrap .password-toggle-btn:hover {
  color: var(--text-main);
}

.password-input-wrap .password-icon-hide {
  display: none;
}

.password-input-wrap.password-visible .password-icon-show {
  display: none;
}

.password-input-wrap.password-visible .password-icon-hide {
  display: inline-flex;
}

.auth-field label {
  text-transform: none;
  letter-spacing: normal;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-main);
}

.auth-check {
  display: flex;
  align-items: center;
  gap: 8px;
}

.auth-check label {
  margin-bottom: 0;
  font-size: 0.85rem;
}

.auth-check input[type="checkbox"],
.auth-check input[type="radio"] {
  width: auto;
  accent-color: var(--accent);
}

.auth-help {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 4px 0 0;
}

.auth-error {
  font-size: 0.78rem;
  color: var(--danger);
  margin: 4px 0 0;
}

.auth-card .btn {
  width: 100%;
  margin-top: 6px;
}

.auth-card .btn-primary {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.auth-card .btn-primary:hover {
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.18);
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 20px 0 16px;
}

.auth-divider-line {
  flex: 1;
  height: 1px;
  background: var(--border-subtle);
}

.auth-divider-text {
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.auth-provider-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.auth-provider-list .auth-provider-btn {
  width: 100%;
  justify-content: center;
}

.auth-provider-btn .auth-provider-icon {
  flex-shrink: 0;
}

.auth-panel {
  margin-bottom: 20px;
}

.auth-panel-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0 0 14px;
}

.auth-panel-actions {
  display: flex;
  gap: 8px;
  margin-top: 14px;
}

/* Utility */
.muted {
  color: var(--text-muted);
}

.mt-2 {
  margin-top: 8px;
}

.mt-3 {
  margin-top: 12px;
}

.mt-4 {
  margin-top: 16px;
}

.mb-2 {
  margin-bottom: 8px;
}

.mb-3 {
  margin-bottom: 12px;
}

.mb-4 {
  margin-bottom: 16px;
}

.small-text {
  font-size: 0.85rem;
}

@media (max-width: 720px) {
  /* Both landing and authenticated: header wraps, nav goes to second row centered */
  .app-header-inner {
    flex-wrap: wrap;
  }

  .nav-auth {
    flex-shrink: 0;
    margin-left: auto;
  }

  .nav-links {
    order: 3;
    width: 100%;
    justify-content: center;
    padding: 4px 0 8px;
  }

  .nav-links-landing {
    position: static;
    transform: none;
  }

  /* On non-landing pages Sign Up is irrelevant — hide it to save space */
  body:not([data-landing="true"]) #sign-up-link {
    display: none;
  }

  .hero-title {
    font-size: 2rem;
  }

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

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

  .examples-grid--three {
    grid-template-columns: 1fr;
  }

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

}


/* Settings page */
.settings-list {
  display: flex;
  flex-direction: column;
  gap: 1px;
  margin-top: 24px;
}

.settings-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.settings-label strong {
  display: block;
  font-size: 0.88rem;
  color: var(--text-main);
}

.settings-desc {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.theme-switch {
  display: inline-flex;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: 999px;
  padding: 3px;
  cursor: pointer;
  font: inherit;
}

.theme-switch-option {
  padding: 5px 14px;
  font-size: 0.78rem;
  border-radius: 999px;
  color: var(--text-muted);
  transition: all 0.15s ease;
  font-weight: 500;
}

.theme-switch-option.active {
  background: var(--bg-elevated);
  color: var(--text-main);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.settings-section-divider {
  border-top: 1px solid var(--border);
  margin: 8px 0;
}

.settings-row-danger {
  margin-top: 8px;
  border-color: var(--danger-border);
  background: var(--danger-bg);
}

.settings-row-danger .settings-label strong {
  color: var(--danger);
}

.settings-row-danger .settings-desc {
  color: var(--text-muted);
  max-width: 340px;
}

@media (max-width: 640px) {
  .settings-row {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
}

/* Analytics */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 24px;
}

.stat-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 20px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: var(--text-main);
  letter-spacing: -0.02em;
}

.stat-label {
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 500;
}

.stats-section {
  margin-top: 28px;
}

.stat-link-card {
  display: block;
  padding: 14px 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-main);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.88rem;
  transition: border-color 0.15s ease;
  margin-top: 8px;
}

.stat-link-card:hover {
  border-color: var(--accent-muted);
  text-decoration: none;
}

.stat-link-meta {
  display: block;
  font-size: 0.74rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-top: 2px;
}

.stats-chart {
  display: flex;
  align-items: flex-end;
  gap: 6px;
  height: 140px;
  margin-top: 12px;
  padding: 0 4px;
}

.stats-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
  justify-content: flex-end;
}

.stats-bar {
  width: 100%;
  max-width: 40px;
  min-height: 2px;
  background: var(--accent);
  border-radius: 4px 4px 0 0;
  opacity: 0.7;
}

.stats-bar-count {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-weight: 600;
}

.stats-bar-label {
  font-size: 0.6rem;
  color: var(--text-muted);
  white-space: nowrap;
}

@media (max-width: 640px) {
  .stats-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-chart {
    overflow-x: auto;
  }

  .stats-bar-col {
    min-width: 52px;
  }
}

/* ---------- Signup form: live validation ---------- */
.form-hint {
  font-size: 0.85em;
  color: var(--muted, #888);
  margin: 0.2rem 0 0;
  line-height: 1.35;
}
.form-hint:empty { display: none; }

.auth-input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.auth-input-wrap > input {
  flex: 1;
}

.auth-status {
  position: absolute;
  right: 0.6rem;
  width: 1rem;
  height: 1rem;
  display: inline-block;
  pointer-events: none;
}

.auth-field.is-checking .auth-status::after {
  content: "";
  display: block;
  width: 0.85rem;
  height: 0.85rem;
  border: 2px solid var(--muted, #999);
  border-top-color: transparent;
  border-radius: 50%;
  animation: auth-spin 0.7s linear infinite;
}
@keyframes auth-spin { to { transform: rotate(360deg); } }

.auth-field.is-valid .auth-status::after {
  content: "✓";
  color: var(--success, #2a9d4a);
  font-weight: 700;
  font-size: 1rem;
}
.auth-field.is-invalid .auth-status::after {
  content: "✗";
  color: var(--danger, #c0392b);
  font-weight: 700;
  font-size: 1rem;
}

.auth-field.is-valid > input,
.auth-field.is-valid .password-input-wrap > input,
.auth-field.is-valid .auth-input-wrap > input {
  border-color: var(--success, #2a9d4a);
}
.auth-field.is-invalid > input,
.auth-field.is-invalid .password-input-wrap > input,
.auth-field.is-invalid .auth-input-wrap > input {
  border-color: var(--danger, #c0392b);
}

.auth-live-message {
  margin: 0;
  font-size: 0.85em;
  color: var(--muted, #888);
  line-height: 1.35;
}
/* Only reserve vertical space when there is an actual message. */
.auth-live-message:empty { display: none; }
.auth-live-message:not(:empty) { margin-top: 0.2rem; }
.auth-field.is-invalid .auth-live-message { color: var(--danger, #c0392b); }
.auth-field.is-valid .auth-live-message { color: var(--success, #2a9d4a); }

.password-checks {
  list-style: none;
  margin: 0.5rem 0 0;
  padding: 0;
  font-size: 0.88em;
  line-height: 1.5;
}
.password-check {
  display: flex;
  align-items: baseline;
  gap: 0.4rem;
  color: var(--muted, #888);
  transition: color 120ms ease;
}
.password-check.is-valid {
  color: var(--success, #2a9d4a);
}
.password-check-icon {
  display: inline-block;
  min-width: 1ch;
  font-weight: 700;
}

.auth-submit:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* ---------- Settings: profile row ---------- */
.settings-row-profile {
  align-items: flex-start;
}
.settings-profile-fields {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  width: 100%;
  max-width: 28rem;
}
.settings-field {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
}
.settings-field-label {
  font-size: 0.85em;
  color: var(--muted, #888);
}
.settings-field input {
  padding: 0.4rem 0.55rem;
}
.settings-field-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.form-error-inline {
  font-size: 0.85em;
  color: var(--danger, #c0392b);
  margin-top: 0.15rem;
}

/* ---------- Error pages (404, 500, 403, 429) ---------- */
.error-page {
  max-width: 32rem;
  margin: 5rem auto 0;
  text-align: center;
}
.error-code {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted, #999);
  margin: 0 0 1rem;
}
.error-title {
  font-size: 1.6rem;
  font-weight: 700;
  margin: 0 0 0.75rem;
  color: var(--text-main);
  line-height: 1.25;
}
.error-body {
  color: var(--text-muted, #666);
  line-height: 1.65;
  margin: 0 0 2rem;
  font-size: 0.97rem;
}
