/* dashboard.css — Customer dashboard styles */

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

:root {
  --accent: #1a1a1a;
  --text: #111;
  --muted: #666;
  --border: #e4e4e4;
  --bg: #fff;
  --tile-bg: #fafafa;
  --font-sans: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

body.dash-body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.6;
}

/* ── Layout ──────────────────────────────────────────── */

.dash-wrap {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

/* ── Header ──────────────────────────────────────────── */

.dash-header {
  border-bottom: 1px solid var(--border);
  padding: 20px 0 16px;
  margin-bottom: 40px;
}

.dash-header-inner {
  max-width: 920px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.dash-wordmark {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.01em;
}

.dash-wordmark span {
  font-weight: 400;
  color: var(--muted);
}

.dash-customer-label {
  font-size: 0.8rem;
  color: var(--muted);
}

/* ── Section titles ──────────────────────────────────── */

.dash-section-title {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0 0 16px;
}

/* ── Stat tiles ──────────────────────────────────────── */

.dash-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 48px;
}

.dash-tile {
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 20px 20px 18px;
}

.dash-tile-label {
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 10px;
}

.dash-tile-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
  margin-bottom: 6px;
}

.dash-tile-value--placeholder {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--muted);
  line-height: 1.4;
  margin-bottom: 6px;
}

.dash-tile-note {
  font-size: 0.72rem;
  color: var(--muted);
  line-height: 1.45;
}

/* ── Articles table ──────────────────────────────────── */

.dash-section {
  margin-bottom: 40px;
}

.dash-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 6px;
}

.dash-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.dash-table th {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  padding: 11px 16px;
  background: var(--tile-bg);
  text-align: left;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

.dash-table td {
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

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

.dash-table a {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}

.dash-table a:hover {
  color: #444;
}

/* "announced on @<handle>" affordance — small, muted, no underline
   until hover so the article row still leads with the title link. */
.dash-article-tweetlink {
  display: inline-block;
  margin-left: 8px;
  color: #888;
  font-size: 0.78rem;
  text-decoration: none;
}
.dash-article-tweetlink:hover {
  color: #333;
  text-decoration: underline;
}

.dash-log-tweetlink {
  color: #1d6fa5;
  text-decoration: none;
}
.dash-log-tweetlink:hover {
  text-decoration: underline;
}

.dash-badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 2px 7px;
  border-radius: 3px;
  background: #e8f5e9;
  color: #2e7d32;
}

.dash-badge--pending {
  background: #fff8e1;
  color: #f57f17;
}

.dash-badge--failed {
  background: #fce4ec;
  color: #c62828;
}

.dash-badge--indexed {
  background: #e8f5e9;
  color: #2e7d32;
}

.dash-badge--not-indexed {
  background: #fce4ec;
  color: #c62828;
}

.dash-table tbody tr {
  cursor: pointer;
}

.dash-table tbody tr:hover {
  background: var(--tile-bg);
}

.dash-empty {
  padding: 32px 16px;
  color: var(--muted);
  font-size: 0.875rem;
  text-align: center;
}

/* ── Activity log (collapsible) ──────────────────────── */

.dash-details {
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.dash-details summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  background: var(--tile-bg);
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  border-bottom: 1px solid var(--border);
  user-select: none;
  list-style: none;
}

.dash-details summary::-webkit-details-marker { display: none; }

.dash-details summary::after {
  content: '▾';
  font-size: 0.9rem;
  color: var(--muted);
}

.dash-details[open] summary::after {
  content: '▴';
}

.dash-log-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

.dash-log-table th {
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 10px 16px;
  text-align: left;
  border-bottom: 1px solid var(--border);
  background: var(--tile-bg);
  white-space: nowrap;
}

.dash-log-table td {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  vertical-align: top;
}

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

.dash-log-ts {
  font-size: 0.75rem;
  color: var(--muted);
  white-space: nowrap;
}

/* ── Gate screen (no customer found) ─────────────────── */

.dash-gate {
  min-height: 60vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 60px 24px;
  text-align: center;
}

.dash-gate h2 {
  font-size: 1.1rem;
  font-weight: 600;
  color: var(--text);
  margin: 0;
}

.dash-gate p {
  font-size: 0.875rem;
  color: var(--muted);
  margin: 0;
  max-width: 340px;
}

.dash-gate form {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
  justify-content: center;
}

.dash-gate input[type="email"] {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  width: 240px;
}

.dash-gate input[type="email"]:focus {
  border-color: #999;
}

.dash-gate button {
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 8px 16px;
  font-size: 0.875rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
}

.dash-gate button:hover {
  background: #333;
}

/* ── Inline notices ──────────────────────────────────── */

.dash-notice {
  font-size: 0.82rem;
  padding: 8px 12px;
  border-radius: 4px;
  margin-bottom: 20px;
}

.dash-notice--ok {
  background: #e8f5e9;
  color: #2e7d32;
}

.dash-notice--err {
  background: #fce4ec;
  color: #c62828;
}

/* ── New property form ───────────────────────────────── */

.dash-prop-form-wrap {
  padding: 20px 16px;
  border-top: 1px solid var(--border);
}

.dash-prop-form {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  max-width: 680px;
}

.dash-prop-field {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.dash-prop-field label {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.dash-prop-optional {
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}

.dash-prop-field input {
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px 10px;
  font-size: 0.875rem;
  font-family: var(--font-sans);
  color: var(--text);
  outline: none;
  background: var(--bg);
}

.dash-prop-field input:focus {
  border-color: #999;
}

.dash-prop-field input:disabled {
  background: var(--tile-bg);
  color: var(--muted);
  cursor: not-allowed;
}

.dash-prop-hint {
  font-size: 0.71rem;
  color: var(--muted);
  line-height: 1.4;
}

.dash-prop-submit {
  grid-column: 1 / -1;
  justify-self: start;
  border: none;
  background: var(--accent);
  color: #fff;
  border-radius: 4px;
  padding: 9px 18px;
  font-size: 0.82rem;
  font-weight: 600;
  font-family: var(--font-sans);
  cursor: pointer;
  margin-top: 4px;
}

.dash-prop-submit:hover {
  background: #333;
}

/* ── Responsive ──────────────────────────────────────── */

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

@media (max-width: 480px) {
  .dash-tiles {
    grid-template-columns: 1fr;
  }
  .dash-tile-value {
    font-size: 1.6rem;
  }
}

/* ── Per-article analytics page additions ─────────── */

.dash-row-title {
  color: var(--text);
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-thickness: 1px;
}
.dash-row-title:hover { color: #444; }

.dash-row-live {
  margin-left: 8px;
  color: #888;
  font-size: 0.78rem;
  text-decoration: none;
}
.dash-row-live:hover {
  color: #333;
  text-decoration: underline;
}

.dash-back-link {
  font-size: 0.82rem;
  color: #666;
  text-decoration: none;
}
.dash-back-link:hover { color: #333; text-decoration: underline; }

.dash-chip {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  padding: 3px 8px;
  border-radius: 999px;
  background: var(--tile-bg);
  color: var(--muted);
  border: 1px solid var(--border);
  margin-right: 6px;
}
.dash-chip--ok { background: #e8f5e9; color: #2e7d32; border-color: #c8e6c9; }
.dash-chip--err { background: #fce4ec; color: #c62828; border-color: #f8bbd0; }
.dash-chip--pending { background: #fff8e1; color: #f57f17; border-color: #ffe082; }

.dash-chip-row { line-height: 1.9; }

.dash-chip-note {
  color: var(--muted);
  font-size: 0.78rem;
  margin: 0;
}

.dash-meta-label {
  color: #999;
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
}

.dash-tweet-card {
  background: var(--tile-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 16px 20px;
  max-width: 680px;
}
.dash-tweet-card-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 8px 16px;
  align-items: baseline;
  font-size: 0.85rem;
  margin-bottom: 6px;
}
.dash-tweet-card-note {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 8px 0 0;
  line-height: 1.5;
}

.dash-copy-row {
  display: flex;
  align-items: center;
  gap: 8px;
}
.dash-copy-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 7px 10px;
  font-size: 0.78rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  color: var(--text);
  background: var(--tile-bg);
  outline: none;
  min-width: 0;
}
.dash-copy-input:focus { border-color: #999; }

.dash-copy-btn {
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font-size: 0.78rem;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--font-sans);
  white-space: nowrap;
  transition: background-color 0.1s ease;
}
.dash-copy-btn:hover { background: var(--tile-bg); }
.dash-copy-btn--ok { color: #2e7d32; border-color: #c8e6c9; }

.dash-chart {
  width: 100%;
  max-width: 600px;
  height: 140px;
  display: block;
}
.dash-chart rect { fill: var(--text); }
.dash-chart.dash-chart--empty { fill: var(--border); }
.dash-chart-axis { stroke: var(--border); stroke-width: 1; }
.dash-chart-label {
  font-size: 0.7rem;
  fill: var(--muted);
  font-family: var(--font-sans);
}

.dash-related-ctr-empty {
  color: var(--muted);
  font-size: 0.82rem;
  padding: 12px 16px;
}
