/* Minimal custom CSS — most styling comes from Tailwind via CDN.
 *
 * NOTE on the dark theme: Tailwind 2.x's color palette only goes to
 * gray-900 — `bg-gray-950` (used in the body's class attribute) is a
 * 3.x-only class and resolves to no rule, leaving the page on a
 * default white background. The explicit body rule below establishes
 * the dark surface without depending on a specific Tailwind version. */

html, body {
  background: #0a0a0c;
  color: #e2e8f0;
  min-height: 100vh;
  margin: 0;
}

.row-expanded {
  background-color: rgba(255, 255, 255, 0.03);
}

.row-expanded pre {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.78em;
  color: #cbd5e1;
  background: #0f172a;
  padding: 0.75rem;
  border-radius: 4px;
  margin: 0.5rem 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  color: #e2e8f0;
}
th, td {
  padding: 0.7rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #1f2937;
  font-size: 0.9rem;
  vertical-align: top;
  line-height: 1.45;
}
th {
  font-weight: 700;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #94a3b8;
  background: #111827;
  border-bottom: 2px solid #374151;
  position: sticky;
  top: 0;
}
tbody tr {
  cursor: pointer;
}
tbody tr:hover {
  background-color: rgba(255, 255, 255, 0.035);
}
.cell-mono {
  font-family: 'SF Mono', Menlo, monospace;
  font-size: 0.78rem;
  color: #94a3b8;
}
/* `cell-content` is the row's main column — body / message. Wraps to two
 * lines so the message is actually readable instead of ellipsis-truncated.
 * Older `cell-truncate` style is kept on metadata columns (long user-agent
 * strings, etc.) where wrapping would explode the row height. */
.cell-content {
  max-width: 40ch;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.4;
  word-break: break-word;
}
.cell-truncate {
  max-width: 28ch;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Read state — drives the unread visual indicator. tr[data-read="false"]
 * is unread (default for docs without a readAt timestamp); "true" is read. */
tbody tr[data-read="false"] {
  border-left: 3px solid #3b82f6;
  background-color: rgba(59, 130, 246, 0.04);
}
tbody tr[data-read="false"] td.cell-content {
  font-weight: 600;
  font-size: 0.95rem;
  color: #ffffff;
}
tbody tr[data-read="true"] {
  opacity: 0.55;
}
tbody tr[data-read="true"] td.cell-content {
  color: #cbd5e1;
}

/* Inline action buttons inside row cells. Click handlers stop propagation
 * so clicking an action doesn't trigger the row-expand. */
.row-actions {
  display: flex;
  gap: 0.4rem;
  white-space: nowrap;
}
.row-actions button {
  background: transparent;
  border: 0;
  padding: 0.1rem 0.4rem;
  font: inherit;
  font-size: 0.78em;
  color: #9cc7ff;
  cursor: pointer;
  text-decoration: underline;
}
.row-actions button:hover {
  color: #ffffff;
}
.row-actions button[data-action="delete"] {
  color: #f87171;
}
.row-actions button[data-action="delete"]:hover {
  color: #fca5a5;
}

/* Read-state filter. The dashboard root carries data-filter="all|unread|read";
 * CSS hides rows whose data-read doesn't match. "all" hides nothing. */
#dashboard[data-filter="unread"] tbody tr[data-read="true"]  { display: none; }
#dashboard[data-filter="read"]   tbody tr[data-read="false"] { display: none; }
/* When a row's expanded JSON sibling exists, hide that too in the same cases. */
#dashboard[data-filter="unread"] tbody tr[data-read="true"]  + tr.row-expanded { display: none; }
#dashboard[data-filter="read"]   tbody tr[data-read="false"] + tr.row-expanded { display: none; }

/* Active filter button — visually clear which mode is on. */
.filter-btn[data-active="true"] {
  background: #3b82f6;
  border-color: #3b82f6;
  color: #ffffff;
  font-weight: 600;
}
.filter-btn[data-active="true"]:hover {
  background: #2563eb;
}
