:root {
  --bg: #0b0d10;
  --panel: #12161b;
  --panel-2: #171c22;
  --border: #262d36;
  --text: #eef2f6;
  --muted: #9aa6b2;
  --accent: #4f8cff;
  --accent-2: #7aa7ff;
  --success: #31c48d;
  --danger: #ef4444;
  --shadow: 0 10px 30px rgba(0,0,0,.25);
  --radius: 18px;
  --ease: 180ms cubic-bezier(.2,.8,.2,1);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

html, body {
  margin: 0;
  padding: 0;
  background: linear-gradient(180deg, #0a0c0f 0%, #0d1117 100%);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

body {
  animation: pageIn 260ms var(--ease);
}

@keyframes pageIn {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

a {
  color: inherit;
  text-decoration: none;
  transition: color var(--ease), opacity var(--ease);
}

.container {
  max-width: 1180px;
  margin: 0 auto;
  padding: 28px 18px 60px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-badge {
  width: 42px;
  height: 42px;
  border-radius: 14px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  font-weight: 800;
  color: white;
  box-shadow: var(--shadow);
  transition: transform var(--ease), box-shadow var(--ease);
}

.brand-badge:hover {
  transform: translateY(-1px);
}

.brand-text h1 {
  margin: 0;
  font-size: 1.2rem;
}

.brand-text p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: .92rem;
}

.nav {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.nav a {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  padding: 10px 14px;
  border-radius: 12px;
  color: var(--muted);
  transition:
    color var(--ease),
    border-color var(--ease),
    background var(--ease),
    transform var(--ease);
}

.nav a.active,
.nav a:hover {
  color: var(--text);
  border-color: #3a4653;
  background: rgba(255,255,255,.05);
  transform: translateY(-1px);
}

.hero {
  background: linear-gradient(180deg, rgba(79,140,255,.12), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: 24px;
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
  transition: border-color var(--ease), transform var(--ease);
}

.hero:hover {
  border-color: #334152;
}

.hero h2 {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.hero p {
  margin: 0;
  color: var(--muted);
  line-height: 1.6;
  max-width: 760px;
}

.grid {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 18px;
}

.card {
  grid-column: span 12;
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease),
    box-shadow var(--ease);
}

.card:hover {
  transform: translateY(-2px);
  border-color: #334152;
  box-shadow: 0 14px 34px rgba(0,0,0,.28);
}

.card h3 {
  margin: 0 0 8px;
  font-size: 1.05rem;
}

.card p {
  margin: 0;
  color: var(--muted);
  line-height: 1.55;
}

.card-lg { grid-column: span 6; }
.card-md { grid-column: span 4; }

.actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 18px;
}

.btn {
  appearance: none;
  border: none;
  border-radius: 14px;
  padding: 14px 18px;
  font-weight: 700;
  font-size: .98rem;
  cursor: pointer;
  transition:
    transform var(--ease),
    opacity var(--ease),
    background var(--ease),
    border-color var(--ease),
    box-shadow var(--ease);
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 8px 20px rgba(79,140,255,.18);
}

.btn-secondary {
  background: rgba(255,255,255,.04);
  color: var(--text);
  border: 1px solid var(--border);
}

.btn-wide {
  width: 100%;
  justify-content: center;
}

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

.btn:active {
  transform: translateY(0) scale(.985);
}

.section-title {
  margin: 0 0 14px;
  font-size: 1rem;
  color: var(--muted);
  font-weight: 700;
  letter-spacing: .02em;
}

.form {
  display: grid;
  gap: 12px;
}

.label {
  font-size: .92rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.input, .textarea, .select {
  width: 100%;
  background: rgba(255,255,255,.03);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 13px;
  outline: none;
  transition:
    border-color var(--ease),
    background var(--ease),
    box-shadow var(--ease),
    transform var(--ease);
}

.textarea {
  min-height: 180px;
  resize: vertical;
  line-height: 1.55;
}

.input:hover, .textarea:hover, .select:hover {
  border-color: #364352;
}

.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(79,140,255,.14);
}

.file-upload {
  display: grid;
  gap: 10px;
}

.file-upload input[type="file"] {
  display: none;
}

.file-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 52px;
  width: 100%;
  border-radius: 14px;
  border: 1px dashed #405063;
  background: rgba(255,255,255,.03);
  color: var(--text);
  font-weight: 700;
  padding: 14px 16px;
  cursor: pointer;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease),
    box-shadow var(--ease);
}

.file-trigger:hover {
  transform: translateY(-1px);
  border-color: var(--accent);
  background: rgba(79,140,255,.08);
}

.file-meta {
  font-size: .92rem;
  color: var(--muted);
  min-height: 22px;
}

.list {
  display: grid;
  gap: 12px;
}

.item {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition:
    transform var(--ease),
    border-color var(--ease),
    background var(--ease);
}

.item:hover {
  transform: translateY(-1px);
  border-color: #364352;
  background: rgba(255,255,255,.04);
}

.item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 6px;
}

.item-title {
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: .82rem;
  padding: 7px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  background: rgba(255,255,255,.03);
}

.badge.success {
  color: #dff8ee;
  border-color: rgba(49,196,141,.25);
  background: rgba(49,196,141,.12);
}

.muted {
  color: var(--muted);
}

.empty {
  color: var(--muted);
  padding: 12px 0;
}

.kpi {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-top: 16px;
}

.kpi-box {
  background: rgba(255,255,255,.03);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px;
  transition: transform var(--ease), border-color var(--ease);
}

.kpi-box:hover {
  transform: translateY(-1px);
  border-color: #364352;
}

.kpi-box .value {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 4px;
}

.kpi-box .label2 {
  color: var(--muted);
  font-size: .88rem;
}

.footer-note {
  margin-top: 26px;
  color: var(--muted);
  font-size: .9rem;
}

.split {
  display: grid;
  grid-template-columns: 1.15fr .85fr;
  gap: 18px;
}

.link-card {
  display: block;
}

.flash {
  margin-bottom: 16px;
  padding: 12px 14px;
  border-radius: 12px;
  border: 1px solid rgba(49,196,141,.25);
  background: rgba(49,196,141,.12);
  color: #dff8ee;
  animation: pageIn 220ms var(--ease);
}

.file-name {
  margin-top: 8px;
  font-size: .92rem;
  color: var(--muted);
}

@media (max-width: 900px) {
  .card-lg, .card-md { grid-column: span 12; }
  .kpi { grid-template-columns: 1fr; }
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }
  .split {
    grid-template-columns: 1fr;
  }
}

/* --- Stepper / wizard UI --- */
.stepper {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.step {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  border-radius: 999px;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--muted);
}

.step.active {
  color: var(--text);
  border-color: var(--accent);
  background: rgba(79,140,255,.12);
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .84rem;
  font-weight: 800;
  background: rgba(255,255,255,.08);
  border: 1px solid var(--border);
}

.step.active .step-num {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  border-color: transparent;
}

.step-section {
  scroll-margin-top: 20px;
}

.section-subtext {
  color: var(--muted);
  margin: 0 0 14px;
  line-height: 1.5;
  font-size: .94rem;
}

/* --- Project card kebab menu --- */
.project-card-wrap {
  position: relative;
}

.kebab {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: all var(--ease);
  z-index: 3;
}

.kebab:hover {
  color: var(--text);
  border-color: #3a4653;
  background: rgba(255,255,255,.08);
}

.kebab-menu {
  position: absolute;
  top: 54px;
  right: 12px;
  min-width: 150px;
  border-radius: 14px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, var(--panel), var(--panel-2));
  box-shadow: var(--shadow);
  overflow: hidden;
  display: none;
  z-index: 5;
}

.kebab-menu.open {
  display: block;
}

.kebab-item {
  display: block;
  width: 100%;
  text-align: left;
  padding: 12px 14px;
  background: transparent;
  border: none;
  color: var(--text);
  cursor: pointer;
  transition: background var(--ease);
}

.kebab-item:hover {
  background: rgba(255,255,255,.06);
}

.kebab-item.danger {
  color: #ffb4b4;
}

.kebab-item.danger:hover {
  background: rgba(239,68,68,.14);
}

.project-card-link {
  display: block;
}

/* keep text from sitting under kebab */
.project-card-pad {
  padding-right: 44px;
}

/* ===== Sticky project bar ===== */
.sticky-project-bar {
  position: sticky;
  top: 0;
  z-index: 40;
  margin-bottom: 18px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(11, 13, 16, 0.82);
  backdrop-filter: blur(10px);
  box-shadow: var(--shadow);
}

.sticky-project-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.sticky-left {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.sticky-title {
  font-size: 1rem;
  font-weight: 800;
  color: var(--text);
}

.sticky-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  color: var(--muted);
  font-size: .9rem;
}

.save-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 999px;
  border: 1px solid rgba(49,196,141,.24);
  background: rgba(49,196,141,.10);
  color: #dff8ee;
  font-size: .9rem;
  white-space: nowrap;
}

/* ===== Timeline ===== */
.timeline {
  display: flex;
  align-items: center;
  gap: 0;
  overflow-x: auto;
  padding-bottom: 4px;
  margin-bottom: 18px;
}

.timeline-step {
  display: flex;
  align-items: center;
  color: var(--muted);
  flex: 0 0 auto;
}

.timeline-bubble {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: .9rem;
  font-weight: 800;
  background: rgba(255,255,255,.05);
  border: 1px solid var(--border);
  transition: all var(--ease);
}

.timeline-label {
  margin-left: 10px;
  margin-right: 14px;
  font-size: .92rem;
  font-weight: 700;
  white-space: nowrap;
}

.timeline-line {
  width: 46px;
  height: 2px;
  background: linear-gradient(90deg, rgba(255,255,255,.08), rgba(255,255,255,.16));
  margin-right: 14px;
  border-radius: 999px;
}

.timeline-step.active .timeline-bubble {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  border-color: transparent;
  color: white;
  box-shadow: 0 6px 16px rgba(79,140,255,.25);
}

.timeline-step.active .timeline-label {
  color: var(--text);
}

/* ===== Floating AI button ===== */
.ai-fab {
  position: fixed;
  right: 22px;
  bottom: 22px;
  width: 62px;
  height: 62px;
  border-radius: 50%;
  border: 1px solid rgba(79,140,255,.35);
  background: linear-gradient(135deg, rgba(79,140,255,.95), rgba(122,167,255,.95));
  color: white;
  display: grid;
  place-items: center;
  font-size: 1.35rem;
  font-weight: 900;
  box-shadow: 0 16px 34px rgba(0,0,0,.35);
  cursor: pointer;
  z-index: 70;
  transition: transform var(--ease), box-shadow var(--ease), opacity var(--ease);
}

.ai-fab:hover {
  transform: translateY(-2px) scale(1.02);
  box-shadow: 0 20px 38px rgba(0,0,0,.42);
}

.ai-panel {
  position: fixed;
  right: 22px;
  bottom: 96px;
  width: min(380px, calc(100vw - 28px));
  max-height: min(70vh, 720px);
  overflow: auto;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,22,27,.96), rgba(23,28,34,.96));
  box-shadow: 0 20px 40px rgba(0,0,0,.42);
  padding: 16px;
  z-index: 70;
  display: none;
}

.ai-panel.open {
  display: block;
  animation: pageIn 180ms var(--ease);
}

.ai-panel-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
}

.ai-panel-title {
  font-weight: 800;
  font-size: 1rem;
}

.ai-panel-sub {
  color: var(--muted);
  font-size: .88rem;
  margin-top: 2px;
}

.ai-close {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  cursor: pointer;
}

.ai-quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 14px 0;
}

.ai-quick-grid form {
  margin: 0;
}

.ai-panel textarea {
  min-height: 110px;
}

.ai-helper {
  color: var(--muted);
  font-size: .88rem;
  line-height: 1.5;
  margin-top: 8px;
}

/* ===== AI loading overlay ===== */
.ai-thinking {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  background: rgba(5, 8, 12, 0.58);
  backdrop-filter: blur(8px);
  z-index: 90;
}

.ai-thinking.show {
  display: flex;
}

.ai-thinking-box {
  width: min(520px, calc(100vw - 32px));
  border-radius: 24px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,22,27,.98), rgba(23,28,34,.98));
  box-shadow: 0 20px 50px rgba(0,0,0,.42);
  padding: 28px;
  text-align: center;
}

.ai-thinking-title {
  font-size: 1.25rem;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 10px;
  background: linear-gradient(90deg, #ffffff 0%, #8fb5ff 25%, #ffffff 50%, #8fb5ff 75%, #ffffff 100%);
  background-size: 220% auto;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerText 1.8s linear infinite;
}

.ai-thinking-sub {
  color: var(--muted);
  font-size: .95rem;
}

@keyframes shimmerText {
  to {
    background-position: 220% center;
  }
}

@media (max-width: 720px) {
  .ai-panel {
    right: 14px;
    bottom: 88px;
    width: calc(100vw - 28px);
  }

  .ai-fab {
    right: 14px;
    bottom: 14px;
  }

  .ai-quick-grid {
    grid-template-columns: 1fr;
  }
}

/* ===== Mobile fixes ===== */
@media (max-width: 700px) {
  .container {
    padding: 16px 12px 88px;
  }

  .hero {
    padding: 18px;
    border-radius: 18px;
  }

  .hero h2 {
    font-size: 1.35rem;
    line-height: 1.2;
  }

  .card {
    padding: 16px;
    border-radius: 16px;
  }

  .sticky-project-bar {
    top: 8px;
    padding: 12px;
    border-radius: 14px;
    margin-bottom: 14px;
  }

  .sticky-project-inner {
    align-items: flex-start;
    gap: 10px;
  }

  .sticky-left {
    width: 100%;
  }

  .sticky-title {
    font-size: .98rem;
    line-height: 1.25;
    word-break: break-word;
  }

  .sticky-meta {
    gap: 6px;
    font-size: .82rem;
  }

  .save-pill {
    width: 100%;
    justify-content: center;
    font-size: .84rem;
    padding: 9px 11px;
  }

  .timeline {
    gap: 10px;
    overflow-x: auto;
    padding: 2px 2px 8px;
    margin-bottom: 14px;
    scrollbar-width: thin;
  }

  .timeline-line {
    width: 24px;
    margin-right: 10px;
  }

  .timeline-bubble {
    width: 30px;
    height: 30px;
    font-size: .82rem;
  }

  .timeline-label {
    margin-left: 8px;
    margin-right: 10px;
    font-size: .84rem;
  }

  .input, .textarea, .select {
    font-size: 16px;
  }

  .textarea {
    min-height: 170px;
  }

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

  .actions .btn,
  .actions a.btn,
  .actions form {
    width: 100%;
  }

  .btn {
    min-height: 48px;
    font-size: .95rem;
  }

  .topbar {
    gap: 12px;
    margin-bottom: 18px;
  }

  .brand {
    width: 100%;
  }

  .brand-text h1 {
    font-size: 1.05rem;
  }

  .brand-text p {
    font-size: .85rem;
  }

  .nav {
    width: 100%;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
  }

  .nav a {
    text-align: center;
    padding: 10px 8px;
    font-size: .88rem;
  }

  .ai-fab {
    width: 56px;
    height: 56px;
    right: 14px;
    bottom: 14px;
    font-size: 1.2rem;
  }

  .ai-panel {
    right: 10px;
    left: 10px;
    bottom: 78px;
    width: auto;
    max-height: 72vh;
    border-radius: 18px;
    padding: 14px;
  }

  .ai-panel-title {
    font-size: .98rem;
  }

  .ai-panel-sub,
  .ai-helper {
    font-size: .84rem;
  }

  .ai-quick-grid {
    grid-template-columns: 1fr;
    gap: 8px;
  }

  .ai-thinking-box {
    width: calc(100vw - 24px);
    padding: 22px 18px;
    border-radius: 20px;
  }

  .ai-thinking-title {
    font-size: 1.08rem;
  }

  .ai-thinking-sub {
    font-size: .9rem;
  }

  .item-top {
    align-items: flex-start;
  }

  .badge {
    font-size: .78rem;
  }

  audio {
    min-height: 42px;
  }
}

/* extra small phones */
@media (max-width: 420px) {
  .container {
    padding-left: 10px;
    padding-right: 10px;
  }

  .hero h2 {
    font-size: 1.22rem;
  }

  .timeline-label {
    font-size: .8rem;
  }

  .sticky-meta {
    font-size: .78rem;
  }

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

  .brand-badge {
    width: 38px;
    height: 38px;
    border-radius: 12px;
  }
}



/* ===== AI polish + mobile nav refinement ===== */

.ai-fab {
  font-size: 1.65rem;
  line-height: 1;
}

.ai-fab span {
  display: inline-block;
  transform: translateY(-1px);
}

.ai-thinking {
  position: static;
  inset: auto;
  display: none;
  align-items: stretch;
  justify-content: stretch;
  background: transparent;
  backdrop-filter: none;
  z-index: auto;
  margin-top: 14px;
}

.ai-thinking.show {
  display: block;
}

.ai-thinking-box {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,22,27,.98), rgba(23,28,34,.98));
  box-shadow: none;
  padding: 18px;
  text-align: left;
}

.ai-thinking-title {
  font-size: 1.02rem;
  font-weight: 900;
  line-height: 1.25;
  margin-bottom: 8px;
  background: linear-gradient(180deg, #ffffff 0%, #8fb5ff 35%, #ffffff 70%, #8fb5ff 100%);
  background-size: 100% 240%;
  background-position: 0% 0%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerTextVertical 1.4s linear infinite;
}

.ai-thinking-sub {
  color: var(--muted);
  font-size: .92rem;
}

@keyframes shimmerTextVertical {
  0% {
    background-position: 0% 0%;
  }
  100% {
    background-position: 0% 240%;
  }
}

/* make the AI panel feel more chat-like */
.ai-panel {
  padding: 14px;
}

.ai-panel-top {
  margin-bottom: 8px;
}

.ai-panel .textarea {
  min-height: 88px;
}

.ai-helper {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.06);
}

/* mobile nav: smaller + less wide */
@media (max-width: 700px) {
  .topbar {
    gap: 10px;
  }

  .nav {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .nav a {
    flex: 0 0 auto;
    width: auto;
    min-width: 82px;
    padding: 9px 12px;
    font-size: .84rem;
    border-radius: 10px;
  }

  .ai-fab {
    width: 58px;
    height: 58px;
    right: 14px;
    bottom: 14px;
    font-size: 1.5rem;
  }

  .ai-panel {
    right: 10px;
    left: 10px;
    bottom: 82px;
    width: auto;
    max-height: 68vh;
    border-radius: 18px;
    padding: 14px;
  }

  .ai-thinking-box {
    padding: 16px;
    border-radius: 16px;
  }

  .ai-thinking-title {
    font-size: .98rem;
  }
}

@media (max-width: 420px) {
  .nav a {
    min-width: 74px;
    padding: 8px 10px;
    font-size: .8rem;
  }

  .ai-fab {
    width: 56px;
    height: 56px;
    font-size: 1.42rem;
  }
}




/* ===== Chat-style AI panel ===== */
.ai-fab {
  font-size: 1.9rem;
  line-height: 1;
}

.ai-fab span {
  display: inline-block;
  transform: translateY(-1px);
}

.ai-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.ai-panel.open {
  display: flex;
}

.ai-chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 280px;
  overflow: auto;
  padding-right: 2px;
}

.ai-msg {
  max-width: 88%;
  padding: 11px 13px;
  border-radius: 16px;
  line-height: 1.45;
  font-size: .93rem;
  word-wrap: break-word;
  white-space: pre-wrap;
}

.ai-msg.user {
  align-self: flex-end;
  background: rgba(79,140,255,.14);
  border: 1px solid rgba(79,140,255,.25);
  color: var(--text);
}

.ai-msg.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,.04);
  border: 1px solid var(--border);
  color: var(--text);
}

.ai-msg.system {
  align-self: center;
  background: rgba(255,255,255,.03);
  border: 1px dashed var(--border);
  color: var(--muted);
  font-size: .88rem;
}

.ai-chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.ai-chip {
  appearance: none;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.04);
  color: var(--text);
  padding: 10px 12px;
  border-radius: 999px;
  cursor: pointer;
  transition: all var(--ease);
  font-size: .88rem;
  font-weight: 700;
}

.ai-chip:hover {
  background: rgba(255,255,255,.08);
  border-color: #3a4653;
}

.ai-chat-form {
  display: grid;
  gap: 10px;
}

.ai-chat-input-wrap {
  display: grid;
  gap: 8px;
}

.ai-chat-actions {
  display: flex;
  justify-content: flex-end;
}

.ai-thinking {
  display: none;
  margin-top: 4px;
}

.ai-thinking.show {
  display: block;
}

.ai-thinking-box {
  width: 100%;
  border-radius: 18px;
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(18,22,27,.98), rgba(23,28,34,.98));
  padding: 16px;
  text-align: left;
}

.ai-thinking-title {
  font-size: 1rem;
  font-weight: 900;
  line-height: 1.2;
  margin-bottom: 6px;
  background: linear-gradient(90deg, #ffffff 0%, #8fb5ff 25%, #ffffff 50%, #8fb5ff 75%, #ffffff 100%);
  background-size: 220% auto;
  background-position: 0% center;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmerHorizontal 1.2s linear infinite;
}

.ai-thinking-sub {
  color: var(--muted);
  font-size: .9rem;
}

@keyframes shimmerHorizontal {
  0% {
    background-position: 0% center;
  }
  100% {
    background-position: 220% center;
  }
}

@media (max-width: 700px) {
  .nav {
    width: 100%;
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
  }

  .nav a {
    flex: 0 0 auto;
    width: auto;
    min-width: 76px;
    padding: 8px 11px;
    font-size: .82rem;
    border-radius: 10px;
  }

  .ai-fab {
    width: 58px;
    height: 58px;
    font-size: 1.72rem;
  }

  .ai-panel {
    right: 10px;
    left: 10px;
    bottom: 82px;
    width: auto;
    max-height: 72vh;
  }

  .ai-chat-log {
    max-height: 230px;
  }

  .ai-msg {
    max-width: 94%;
    font-size: .9rem;
  }

  .ai-chip-row {
    gap: 7px;
  }

  .ai-chip {
    width: 100%;
    text-align: left;
  }
}




/* ===== AI panel layout fix + history controls ===== */
.ai-panel {
  display: none;
  flex-direction: column;
  gap: 12px;
}

.ai-panel.open {
  display: flex;
}

.ai-chat-log {
  display: flex;
  flex-direction: column;
  gap: 10px;
  max-height: 260px;
  min-height: 160px;
  overflow: auto;
  padding-right: 2px;
  margin-bottom: 2px;
}

.ai-controls-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.ai-controls-row .btn,
.ai-controls-row .ai-chip {
  flex: 1 1 auto;
}

.ai-version-box {
  border-top: 1px solid rgba(255,255,255,.06);
  padding-top: 10px;
}

.ai-version-list {
  display: grid;
  gap: 8px;
  max-height: 160px;
  overflow: auto;
}

.ai-version-item {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 10px 12px;
  background: rgba(255,255,255,.03);
}

.ai-version-item strong {
  display: block;
  margin-bottom: 4px;
  font-size: .88rem;
}

.ai-version-item span {
  color: var(--muted);
  font-size: .84rem;
  line-height: 1.4;
}

@media (max-width: 700px) {
  .ai-chat-log {
    max-height: 200px;
    min-height: 140px;
  }

  .ai-controls-row {
    flex-direction: column;
  }
}




/* clickable timeline */
.timeline-link {
  text-decoration: none;
  color: inherit;
  display: inline-flex;
  align-items: center;
}

.timeline-link:hover .timeline-bubble {
  transform: translateY(-1px);
  border-color: #3a4653;
}

.timeline-link:hover .timeline-label {
  color: var(--text);
}

/* live save pill states */
.save-pill.saving {
  border-color: rgba(79,140,255,.28);
  background: rgba(79,140,255,.12);
  color: #dbe8ff;
}

.save-pill.unsaved {
  border-color: rgba(245,158,11,.28);
  background: rgba(245,158,11,.12);
  color: #ffe7b3;
}

/* editor toolbar */
.editor-toolbar {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 8px;
  margin-bottom: 6px;
}

.editor-toolbar .btn {
  min-height: 42px;
}

/* on mobile stack toolbar nicely */
@media (max-width: 700px) {
  .editor-toolbar {
    display: grid;
    grid-template-columns: 1fr 1fr;
  }
}



/* Import from YouTube button */

.nav-import {
  color: white;
  background: linear-gradient(90deg,#ff4b6e,#ff8a3d);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  text-decoration: none;
  margin-right: 6px;
  box-shadow: 0 0 6px rgba(255,120,120,0.5);
  transition: all .25s ease;
}

.nav-import:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 12px rgba(255,120,120,0.8);
}

