/* ── Web Awesome token overrides ──────────────────────────────── */
:root {
  --wa-color-brand-base:    #E07060;
  --wa-color-brand-on-base: #FFFFFF;
  --wa-color-neutral-0:     #F5F0E8;
  --wa-color-neutral-950:   #2C2C2C;

  /* Inksight palette */
  --color-bg:          #F5F0E8;
  --color-surface:     #FDFAF4;
  --color-ink:         #2C2C2C;
  --color-slate:       #7A3828;   /* dark coral — replaces dark gray-blue */
  --color-slate-light: #B07868;   /* muted coral — replaces cool gray */
  --color-border:      #DDD8CE;
  --color-coral:       #E07060;
  --color-coral-hover: #C9614F;
  --color-coral-soft:  #F5E6E3;
  --color-coral-dark:  #7A3828;   /* alias for clarity */
}

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

html { font-size: 16px; }

body {
  margin: 0;
  background: var(--color-bg);
  color: var(--color-ink);
  font-family: Georgia, 'Palatino Linotype', serif;
  line-height: 1.6;
}

a { color: var(--color-slate); text-decoration: none; }
a:hover { color: var(--color-coral); text-decoration: none; }

/* ── Dashboard ────────────────────────────────────────────────── */
.dashboard {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.dashboard-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--color-coral);
}

.dashboard-header h1 {
  margin: 0;
  font-size: 1.75rem;
  color: var(--color-coral-dark);
  letter-spacing: -0.02em;
}

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

.story-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.story-card {
  display: block;
  --wa-panel-background-color: var(--color-surface);
  border-left: 3px solid transparent;
  transition: border-color 0.15s;
}

.story-card:hover {
  border-left-color: var(--color-coral);
}

.story-card-content {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 4px 0;
}

.story-info {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.story-title {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--color-ink);
}

.story-title:hover { color: var(--color-coral); }

.story-date {
  font-size: 0.8rem;
  color: var(--color-slate-light);
}

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

.empty-state {
  text-align: center;
  padding: 64px 0;
  color: var(--color-slate);
}

/* ── Login ────────────────────────────────────────────────────── */
.login-body {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--color-bg);
}

.login-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--color-coral);
  border-radius: 6px;
  padding: 48px 40px;
  width: 100%;
  max-width: 380px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.login-title {
  margin: 0 0 4px;
  font-size: 1.8rem;
  text-align: center;
  color: var(--color-coral-dark);
}

.login-subtitle {
  margin: 0 0 32px;
  text-align: center;
  color: var(--color-slate-light);
  font-size: 0.9rem;
}

.login-field { margin-bottom: 16px; }
.login-field wa-input { width: 100%; }

.login-btn { width: 100%; margin-top: 8px; }

.login-error {
  color: var(--color-coral-dark);
  background: var(--color-coral-soft);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.9rem;
  margin-bottom: 16px;
}

/* ── Editor ───────────────────────────────────────────────────── */
.editor-body {
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
  background: var(--color-bg);
}

.editor-layout {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.editor-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 12px 24px;
  border-bottom: 2px solid var(--color-coral-soft);
  background: var(--color-surface);
  flex-shrink: 0;
}

.back-link {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--color-slate);
  white-space: nowrap;
  font-size: 0.9rem;
  font-weight: 500;
}

.back-link:hover { color: var(--color-coral); text-decoration: none; }

.title-input {
  flex: 1;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--color-ink);
  outline: none;
  padding: 4px 8px;
  border-radius: 4px;
  transition: background 0.15s;
}

.title-input:focus {
  background: var(--color-bg);
  outline: 1px solid var(--color-coral-soft);
}

.editor-header-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

#status-badge {
  font-size: 0.75rem;
  color: var(--color-slate);
  white-space: nowrap;
}

.editor-main {
  flex: 1;
  overflow: hidden;
  display: flex;
}

.story-textarea {
  flex: 1;
  width: 100%;
  padding: 40px 48px;
  border: none;
  resize: none;
  font-family: Georgia, 'Palatino Linotype', serif;
  font-size: 1.05rem;
  line-height: 1.7;
  background: var(--color-surface);
  color: var(--color-ink);
  outline: none;
}

/* ── Prediction panel ─────────────────────────────────────────── */
.prediction-panel {
  position: fixed;
  top: 60px;
  right: -360px;
  width: 340px;
  background: var(--color-surface);
  border-left: 3px solid var(--color-coral);
  border-bottom: 1px solid var(--color-border);
  border-top: 1px solid var(--color-border);
  border-radius: 0 0 0 6px;
  box-shadow: -2px 4px 16px rgba(224,112,96,0.12);
  padding: 20px;
  transition: right 0.3s ease;
  z-index: 100;
}

.prediction-panel.visible { right: 0; }

.prediction-panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  font-weight: 600;
  color: var(--color-coral-dark);
  font-size: 0.95rem;
}

.dismiss-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--color-slate-light);
  padding: 0;
  display: flex;
  align-items: center;
  font-size: 1rem;
  transition: color 0.15s;
}

.dismiss-btn:hover { color: var(--color-coral); }

.prediction-list {
  margin: 0 0 16px;
  padding: 0 0 0 20px;
  list-style: disc;
  color: var(--color-ink);
  font-size: 0.9rem;
  line-height: 1.6;
}

.prediction-list li { margin-bottom: 6px; }
.prediction-list li::marker { color: var(--color-coral); }

.confidence-pill {
  display: inline-block;
  background: var(--color-coral-soft);
  color: var(--color-coral-dark);
  font-size: 0.8rem;
  padding: 3px 10px;
  border-radius: 12px;
  font-weight: 500;
}

/* ── Predictions Log ──────────────────────────────────────────── */
.predictions-body {
  background: var(--color-bg);
  min-height: 100vh;
}

.predictions-container {
  max-width: 720px;
  margin: 0 auto;
  padding: 48px 24px;
}

.predictions-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: 2px solid var(--color-coral);
}

.predictions-header h1 {
  margin: 0 0 4px;
  font-size: 1.5rem;
  color: var(--color-coral-dark);
}

.predictions-header h2 {
  margin: 0 0 8px;
  font-size: 1rem;
  font-weight: normal;
  color: var(--color-slate);
}

.prediction-count {
  margin: 0;
  color: var(--color-coral);
  font-size: 0.85rem;
  font-weight: 500;
}

.predictions-log {
  display: flex;
  flex-direction: column;
}

.prediction-block {
  border-top: 1px solid var(--color-border);
  padding: 16px 0 16px 12px;
  border-left: 2px solid transparent;
  transition: border-color 0.15s;
}

.prediction-block:hover {
  border-left-color: var(--color-coral-soft);
}

.prediction-block pre {
  margin: 0;
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.85rem;
  color: var(--color-ink);
  white-space: pre-wrap;
  line-height: 1.6;
}

.empty-predictions {
  color: var(--color-slate-light);
  font-size: 0.95rem;
}

/* ── Mobile ───────────────────────────────────────────────────── */
@media (max-width: 640px) {
  html { font-size: 17px; }

  .dashboard { padding: 24px 16px; }

  .story-textarea { padding: 24px 20px; }

  .editor-header { padding: 10px 16px; gap: 8px; }

  .prediction-panel {
    top: auto;
    bottom: -100%;
    right: 0;
    width: 100%;
    border-left: none;
    border-top: 3px solid var(--color-coral);
    border-radius: 12px 12px 0 0;
    transition: bottom 0.3s ease;
    box-shadow: 0 -4px 16px rgba(224,112,96,0.12);
  }

  .prediction-panel.visible {
    right: 0;
    bottom: 0;
  }
}
