/* Cluster Brand Design System
   Tokens, layout, components — zero shadows, zero gradients, clean lines, warm neutrals */

@import url('https://fonts.googleapis.com/css2?family=Lora&display=swap');

/* ── Color tokens ─────────────────────────────────────────────────────────── */
:root {
  /* Surfaces */
  --canvas:      #F8F9F7;
  --stone:       #EEEEED;
  --pebble:      #D6D5D2;
  --night:       #1A1B1A;

  /* Text */
  --ink:         #1F1F1F;
  --slate:       #6B6B6B;
  --taupe:       #858585;

  /* Accent */
  --sage:        #6B8F6B;
  --sage-tint:   #C4D8BF;
  --rose:        #9B5B6B;
  --rose-tint:   #F0DFE3;
  --amber:       #D4A84B;
  --amber-tint:  #FAF0D4;
  --stream:      #2E6B96;
  --wine:        #733E4A;

  /* Typography */
  --font-heading: 'Lora', Georgia, serif;
  --font-body:    'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* ── Reset / base ─────────────────────────────────────────────────────────── */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html, body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 14px;
  line-height: 1.55;
  min-height: 100vh;
}

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

/* ── Top navigation ───────────────────────────────────────────────────────── */
.topnav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--night);
  color: #fff;
  padding: 0 24px;
  height: 48px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}

.topnav-left {
  display: flex;
  align-items: center;
  gap: 32px;
}

.topnav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 13px;
}

.logo {
  font-family: var(--font-heading);
  font-size: 16px;
  font-weight: 400;
  color: #fff;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.nav-tabs {
  display: flex;
  align-items: stretch;
  height: 48px;
  gap: 2px;
}

.nav-tab {
  display: flex;
  align-items: center;
  padding: 0 16px;
  font-size: 13px;
  color: rgba(255,255,255,0.65);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.nav-tab:hover {
  color: #fff;
}

.nav-tab.active {
  color: #fff;
  background: var(--rose-tint);
  color: var(--rose);
  border-bottom-color: var(--rose);
}

.nav-tab.coming-soon {
  color: var(--taupe);
  position: relative;
}

.nav-tab.coming-soon::after {
  content: '';
  display: inline-block;
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--taupe);
  margin-left: 6px;
  vertical-align: middle;
}

/* ── Status / user area ───────────────────────────────────────────────────── */
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--taupe);
  flex-shrink: 0;
}

.status-dot.ok {
  background: var(--sage);
}

.status-dot.error {
  background: #c0392b;
}

.status-text {
  color: rgba(255,255,255,0.55);
  font-size: 12px;
}

.user-name {
  color: rgba(255,255,255,0.8);
  font-size: 13px;
}

.logout-link {
  color: rgba(255,255,255,0.45);
  font-size: 12px;
  border-left: 1px solid rgba(255,255,255,0.12);
  padding-left: 12px;
  margin-left: 4px;
  transition: color 0.15s;
}

.logout-link:hover {
  color: #fff;
}

/* ── Subtabs ──────────────────────────────────────────────────────────────── */
.subtabs {
  display: flex;
  align-items: stretch;
  height: 38px;
  background: var(--stone);
  border-bottom: 1px solid var(--pebble);
  padding: 0 28px;
  gap: 4px;
}

.subtab {
  display: flex;
  align-items: center;
  padding: 0 14px;
  font-size: 13px;
  color: var(--slate);
  border-bottom: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  white-space: nowrap;
}

.subtab:hover {
  color: var(--ink);
}

.subtab.active {
  color: var(--rose);
  border-bottom-color: var(--rose);
}

/* ── Content wrapper ──────────────────────────────────────────────────────── */
.content {
  padding: 24px 28px;
  max-width: 1400px;
  margin: 0 auto;
}

/* ── Stat cards row ───────────────────────────────────────────────────────── */
.cards-row {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--stone);
  border: 1px solid var(--pebble);
  border-radius: 4px;
  padding: 18px 22px;
  flex: 1 1 160px;
  min-width: 140px;
}

.stat-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--taupe);
  margin-bottom: 6px;
}

.stat-value {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.1;
}

.stat-sub {
  font-size: 12px;
  color: var(--taupe);
  margin-top: 4px;
}

.stat-sub.positive {
  color: var(--sage);
}

.stat-sub.neutral {
  color: var(--taupe);
}

/* ── Two-column layout ────────────────────────────────────────────────────── */
.columns {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}

.column {
  flex: 1 1 0;
  min-width: 0;
}

.column:first-child {
  flex: 2 1 0;
}

/* ── Panel ────────────────────────────────────────────────────────────────── */
.panel {
  background: var(--stone);
  border: 1px solid var(--pebble);
  border-radius: 4px;
  padding: 18px 20px;
  margin-bottom: 20px;
}

.panel-title {
  font-family: var(--font-heading);
  font-size: 15px;
  font-weight: 400;
  color: var(--ink);
  margin-bottom: 14px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pebble);
}

/* ── Event list ───────────────────────────────────────────────────────────── */
.event {
  padding: 10px 12px;
  border-left: 3px solid var(--pebble);
  margin-bottom: 8px;
  background: var(--canvas);
  border-radius: 0 3px 3px 0;
}

.event.success { border-left-color: var(--sage); }
.event.info    { border-left-color: var(--stream); }
.event.warning { border-left-color: var(--amber); }
.event.config  { border-left-color: var(--rose); }
.event.error   { border-left-color: #c0392b; }

.event-time {
  font-size: 11px;
  color: var(--taupe);
  margin-bottom: 2px;
}

.event-title {
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
}

.event-detail {
  font-size: 12px;
  color: var(--slate);
  margin-top: 2px;
}

/* ── Detail sections ──────────────────────────────────────────────────────── */
.detail-section {
  margin-bottom: 16px;
}

.detail-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--taupe);
  margin-bottom: 6px;
}

.detail-box {
  background: var(--canvas);
  border: 1px solid var(--pebble);
  border-radius: 3px;
  padding: 10px 12px;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.5;
}

.detail-box.matched {
  background: var(--sage-tint);
  border-color: var(--sage);
}

/* ── Badges ───────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 3px;
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  background: var(--pebble);
  color: var(--ink);
  vertical-align: middle;
}

.badge.success {
  background: var(--sage-tint);
  color: var(--sage);
}

.badge.pending {
  background: var(--amber-tint);
  color: var(--amber);
}

.badge.error {
  background: #fce8e8;
  color: #c0392b;
}

/* ── Data table ───────────────────────────────────────────────────────────── */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--taupe);
  font-weight: 500;
  padding: 8px 12px;
  border-bottom: 1px solid var(--pebble);
  background: var(--stone);
}

.data-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--stone);
  color: var(--ink);
  vertical-align: top;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover td {
  background: var(--stone);
}

/* ── Filters ──────────────────────────────────────────────────────────────── */
.filters {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 16px;
  align-items: center;
}

.filter-select,
.filter-input {
  background: var(--canvas);
  border: 1px solid var(--pebble);
  border-radius: 3px;
  padding: 6px 10px;
  font-size: 13px;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
  transition: border-color 0.15s;
}

.filter-select:focus,
.filter-input:focus {
  border-color: var(--slate);
}

/* ── Editor area ──────────────────────────────────────────────────────────── */
.editor-area {
  width: 100%;
  min-height: 400px;
  background: var(--canvas);
  border: 1px solid var(--pebble);
  border-radius: 3px;
  padding: 12px 14px;
  font-family: 'Courier New', Courier, monospace;
  font-size: 13px;
  color: var(--ink);
  line-height: 1.6;
  resize: vertical;
  outline: none;
  transition: border-color 0.15s;
}

.editor-area:focus {
  border-color: var(--slate);
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 3px;
  font-size: 13px;
  font-family: var(--font-body);
  font-weight: 500;
  border: 1px solid transparent;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  white-space: nowrap;
  text-decoration: none;
}

.btn-primary {
  background: var(--rose);
  color: #fff;
  border-color: var(--rose);
}

.btn-primary:hover {
  background: var(--wine);
  border-color: var(--wine);
}

.btn-secondary {
  background: var(--stone);
  color: var(--ink);
  border-color: var(--pebble);
}

.btn-secondary:hover {
  background: var(--pebble);
}

/* ── Special pages ────────────────────────────────────────────────────────── */
.coming-soon-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 48px);
  text-align: center;
  color: var(--taupe);
  gap: 12px;
}

.coming-soon-page h1 {
  font-family: var(--font-heading);
  font-weight: 400;
  font-size: 24px;
  color: var(--slate);
}

.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: var(--canvas);
}

.login-card {
  background: var(--stone);
  border: 1px solid var(--pebble);
  border-radius: 6px;
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card h1 {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 400;
  margin-bottom: 8px;
}

.login-card p {
  font-size: 13px;
  color: var(--slate);
  margin-bottom: 28px;
}

.btn-google {
  background: var(--night);
  color: #fff;
  border-color: var(--night);
  width: 100%;
  justify-content: center;
  padding: 10px 20px;
  font-size: 14px;
}

.btn-google:hover {
  background: #2c2d2c;
  border-color: #2c2d2c;
}

/* ── Markdown rendered content ────────────────────────────────────────────── */
.markdown-content {
  font-size: 14px;
  line-height: 1.65;
  color: var(--ink);
}

.markdown-content h1,
.markdown-content h2,
.markdown-content h3,
.markdown-content h4 {
  font-family: var(--font-heading);
  font-weight: 400;
  color: var(--ink);
  margin-top: 1.4em;
  margin-bottom: 0.5em;
  line-height: 1.25;
}

.markdown-content h1 { font-size: 22px; }
.markdown-content h2 { font-size: 18px; }
.markdown-content h3 { font-size: 15px; }
.markdown-content h4 { font-size: 14px; color: var(--slate); }

.markdown-content p {
  margin-bottom: 0.85em;
}

.markdown-content ul,
.markdown-content ol {
  margin: 0 0 0.85em 1.4em;
}

.markdown-content li {
  margin-bottom: 0.25em;
}

.markdown-content hr {
  border: none;
  border-top: 1px solid var(--pebble);
  margin: 20px 0;
}

.markdown-content table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin-bottom: 1em;
}

.markdown-content table th {
  text-align: left;
  padding: 7px 10px;
  background: var(--stone);
  border-bottom: 1px solid var(--pebble);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--taupe);
  font-weight: 500;
}

.markdown-content table td {
  padding: 7px 10px;
  border-bottom: 1px solid var(--stone);
  vertical-align: top;
}

.markdown-content code {
  font-family: 'Courier New', Courier, monospace;
  font-size: 12px;
  background: var(--stone);
  border: 1px solid var(--pebble);
  border-radius: 2px;
  padding: 1px 5px;
}

.markdown-content pre {
  background: var(--stone);
  border: 1px solid var(--pebble);
  border-radius: 3px;
  padding: 12px 14px;
  overflow-x: auto;
  margin-bottom: 1em;
}

.markdown-content pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 12px;
}

.markdown-content blockquote {
  border-left: 3px solid var(--pebble);
  padding-left: 14px;
  color: var(--slate);
  margin: 0 0 0.85em 0;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .topnav {
    padding: 0 14px;
    flex-wrap: wrap;
    height: auto;
    min-height: 48px;
    gap: 4px;
  }

  .topnav-left {
    gap: 14px;
    flex-wrap: wrap;
  }

  .nav-tabs {
    height: auto;
    flex-wrap: wrap;
    gap: 0;
  }

  .nav-tab {
    padding: 8px 10px;
    font-size: 12px;
  }

  .topnav-right {
    gap: 8px;
    font-size: 12px;
    flex-wrap: wrap;
  }

  .content {
    padding: 16px 14px;
  }

  .columns {
    flex-direction: column;
  }

  .column:first-child {
    flex: 1 1 auto;
  }

  .cards-row {
    gap: 10px;
  }

  .stat-card {
    flex: 1 1 calc(50% - 10px);
    min-width: 120px;
  }

  .subtabs {
    padding: 0 14px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  .filters {
    gap: 8px;
  }

  .filter-select,
  .filter-input {
    font-size: 16px; /* prevent iOS zoom */
  }

  .data-table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* ── Channel badges ──────────────────────────────────────────────────────── */
.channel-badge { display: inline-block; padding: 2px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.5px; }
.channel-badge.linkedin { background: #e8f0fe; color: #0a66c2; }
.channel-badge.instagram { background: #fde8ef; color: #c13584; }
.channel-badge.facebook { background: #e8f0fe; color: #1877f2; }

/* ── Week navigation ─────────────────────────────────────────────────────── */
.week-nav { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.week-nav a { color: var(--rose); text-decoration: none; font-size: 14px; }
.week-nav a:hover { text-decoration: underline; }
.week-nav .current { font-family: 'Lora', Georgia, serif; font-size: 20px; font-weight: 400; color: var(--ink); }

/* ── Post card ───────────────────────────────────────────────────────────── */
.post-card { background: var(--white); border: 1px solid var(--pebble); border-radius: 8px; padding: 14px 18px; margin-bottom: 10px; }
.post-card:hover { border-color: var(--rose); }
.post-card-header { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.post-card-day { font-size: 12px; color: var(--taupe); min-width: 80px; }
.post-card-title { font-size: 14px; font-weight: 500; color: var(--ink); }
.post-card-preview { font-size: 13px; color: var(--slate); line-height: 1.5; margin-top: 4px; }

/* ── Document group ──────────────────────────────────────────────────────── */
.doc-group { margin-bottom: 24px; }
.doc-group-title { font-size: 14px; font-weight: 500; color: var(--ink); margin-bottom: 10px; padding-bottom: 6px; border-bottom: 1px solid var(--pebble); }
.doc-item { display: flex; justify-content: space-between; align-items: center; padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 14px; }
.doc-item:hover { background: var(--stone); }
.doc-item-meta { font-size: 12px; color: var(--taupe); }

/* ── Category filter ─────────────────────────────────────────────────────── */
.cat-filters { display: flex; gap: 6px; margin-bottom: 20px; flex-wrap: wrap; }
.cat-filter { padding: 5px 14px; border-radius: 20px; font-size: 12px; text-decoration: none; color: var(--slate); background: var(--stone); border: 1px solid var(--pebble); }
.cat-filter:hover { border-color: var(--rose); }
.cat-filter.active { background: var(--rose-tint); color: var(--rose); border-color: var(--rose); }

/* ── Quick links ─────────────────────────────────────────────────────────── */
.quick-link { display: block; padding: 8px 12px; border-radius: 6px; text-decoration: none; color: var(--ink); font-size: 13px; border-left: 3px solid transparent; }
.quick-link:hover { background: var(--stone); border-left-color: var(--rose); }

/* ── Section heading with accent ─────────────────────────────────────────── */
.section-heading { font-size: 13px; font-weight: 500; color: var(--taupe); text-transform: uppercase; letter-spacing: 0.5px; margin: 16px 0 8px; }
