/*
  The ZenAI page (D1, TO-55): every brief, grouped by report, with its filters.

  Its own stylesheet, like zen-drawer.css. The page carries .tomo-face, so every token below (and
  the dark palette) comes from tomo-face.css. Nothing here invents a colour. One centred column,
  as the chat has it (Ro, 23 Oct 2026); inside it, each brief is the kit's collapsible row
  (TomoCollapsibleRow, Ro, 26 Oct 2026): compact collapsed, the detail on expand, one list at every
  width, the same pattern as Connections and Settings. The row's own styles are in tomo-face.css.

  Hosts include it after tomo-face.css:
    <link rel="stylesheet" href="_content/Tomo.Face/zen-page.css" />
*/

.zen-page.tomo-face {
  display: block;
  background: var(--tomo-canvas);
  color: var(--tomo-text-primary);
}

.zen-page__column {
  box-sizing: border-box;
  width: min(100% - 32px, clamp(720px, 62vw, 1080px));
  margin: 0 auto;
  padding: var(--tomo-space-6) 0 var(--tomo-space-8);
}

.zen-page__top { margin-bottom: var(--tomo-space-4); }

.zen-page__title {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.015em;
}

.zen-page__sub { margin: 2px 0 0; font-size: 14px; color: var(--tomo-text-muted); }

/* ---------- Filters: New brief, then one-at-a-time chips ---------- */

.zen-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--tomo-space-2);
  margin-bottom: var(--tomo-space-6);
}

.zen-filters__new { margin-right: var(--tomo-space-2); }

.zen-filters__chip {
  min-height: 32px;
  padding: 0 var(--tomo-space-3);
  border: 1px solid var(--tomo-border-light);
  border-radius: var(--tomo-radius-full);
  background: var(--tomo-surface);
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--tomo-text-secondary);
  cursor: pointer;
  transition: background var(--tomo-duration-fast) var(--tomo-ease-out),
              border-color var(--tomo-duration-fast) var(--tomo-ease-out),
              color var(--tomo-duration-fast) var(--tomo-ease-out);
}

.zen-filters__chip:hover { border-color: var(--tomo-border-strong); color: var(--tomo-text-primary); }
.zen-filters__chip:focus-visible { outline: 2px solid var(--tomo-accent); outline-offset: 1px; }

.zen-filters__chip--on {
  border-color: var(--tomo-accent);
  background: var(--tomo-accent-subtle);
  color: var(--tomo-accent);
}

/* ---------- Groups ---------- */

.zen-page__groups { display: flex; flex-direction: column; gap: var(--tomo-space-8); }

.zen-group__head {
  margin: 0 0 var(--tomo-space-3);
  font-size: 14px;
  font-weight: 700;
  color: var(--tomo-text-primary);
}

/* The rows: the kit's list (tomo-face.css .tomo-crow-list), one column at every width. */
.zen-group__rows { margin: 0; }

/* ---------- A row's sub line and open body ---------- */

.zen-row__headline { color: var(--tomo-text-secondary); }

.zen-row__error { margin: 0; font-size: 13px; font-weight: 600; color: var(--tomo-danger-ink); }

.zen-row__reason { margin: 0; font-size: 13px; color: var(--tomo-text-secondary); }

/* Facts: flat hairline rows, no boxes, as the connection rows have them. */
.zen-row__facts { margin: 0; border-top: 1px solid var(--tomo-border-subtle); }

.zen-row__fact {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr);
  gap: 2px 16px;
  align-items: baseline;
  padding: 8px 0;
  border-bottom: 1px solid var(--tomo-border-subtle);
  font-size: 13.5px;
}

.zen-row__fact dt { color: var(--tomo-text-muted); font-size: 13px; }
.zen-row__fact dd { margin: 0; min-width: 0; color: var(--tomo-text-primary); }

.zen-row__actions { display: flex; flex-wrap: wrap; align-items: center; gap: var(--tomo-space-2); }
.zen-row__actions .tomo-btn { min-height: 32px; padding: 0 var(--tomo-space-3); font-size: 13px; }

/* ---------- States ---------- */

.zen-page__failure { align-items: center; }
.zen-page__failtext { flex: 1; }

.zen-page__empty { padding: var(--tomo-space-8) 0; text-align: center; }
.zen-page__emptytitle { margin: 0; font-size: 15px; font-weight: 600; color: var(--tomo-text-secondary); }

.zen-page__signin { display: flex; flex-direction: column; align-items: flex-start; gap: var(--tomo-space-3); }
.zen-page__signin .zen-connect__title,
.zen-page__signin .zen-connect__lede { margin: 0; }

/* Loading: a row-shaped placeholder, the collapsed row's height. */
.zen-row--skeleton {
  display: flex;
  align-items: center;
  gap: var(--tomo-crow-gap);
  min-height: calc(var(--tomo-crow-tile) + 2 * var(--tomo-crow-pad-y));
  padding: var(--tomo-crow-pad-y) var(--tomo-crow-pad-x);
}

.zen-row__skellines { display: flex; flex: 1; flex-direction: column; gap: 8px; min-width: 0; }

.zen-page__skel {
  display: block;
  border-radius: var(--tomo-radius-sm);
  background: var(--tomo-border-light);
  animation: zen-page-pulse 1.4s ease-in-out infinite;
}

.zen-page__skel--head { width: 260px; max-width: 70%; height: 14px; margin-bottom: var(--tomo-space-3); }
.zen-page__skel--tile { flex: none; width: var(--tomo-crow-tile); height: var(--tomo-crow-tile); border-radius: var(--tomo-radius-md); }
.zen-page__skel--name { width: 40%; height: 12px; }
.zen-page__skel--line { width: 75%; height: 10px; }

@keyframes zen-page-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

/* ---------- A text link and an inline error, for the pages beside the brief list ---------- */
/* They were .zen-card__link and .zen-card__error until the page's cards became the kit's rows. */

.zen-link {
  padding: 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-weight: 600;
  color: var(--tomo-accent);
  cursor: pointer;
}

.zen-link:hover { text-decoration: underline; }
.zen-link:focus-visible { outline: 2px solid var(--tomo-accent); outline-offset: 2px; }

.zen-error { margin: 0; font-size: 12px; color: var(--tomo-danger-ink); }

/* ---------- A brief's settings (TO-56): rows of label and value, then the actions ---------- */

.zen-settings__column, .zen-edit__column { max-width: 760px; }

.zen-settings__back {
  display: inline-flex;
  align-items: center;
  gap: var(--tomo-space-1);
  margin: 0 0 var(--tomo-space-3);
  padding: 2px 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  color: var(--tomo-text-secondary);
  cursor: pointer;
}

.zen-settings__back:hover { color: var(--tomo-accent); }
.zen-settings__back:focus-visible { outline: 2px solid var(--tomo-accent); outline-offset: 2px; }

.zen-settings__title { font-size: 22px; margin-bottom: var(--tomo-space-4); }

.zen-settings__rows { margin: 0 0 var(--tomo-space-6); }

.zen-settings__row {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: var(--tomo-space-4);
  padding: var(--tomo-space-3) 0;
  border-top: 1px solid var(--tomo-border-subtle);
  font-size: 14px;
}

.zen-settings__row:first-child { border-top: 0; }
.zen-settings__row dt { font-weight: 600; color: var(--tomo-text-muted); }
.zen-settings__row dd { margin: 0; display: flex; flex-direction: column; gap: 2px; color: var(--tomo-text-primary); }
.zen-settings__status--stopped { color: var(--tomo-warn-ink) !important; font-weight: 600; }

.zen-settings__acts { display: flex; flex-wrap: wrap; gap: var(--tomo-space-2); }
.zen-settings__delete { color: var(--tomo-danger-ink); }

.zen-settings__micro {
  max-width: 60ch;
  margin: var(--tomo-space-3) 0 0;
  font-size: 13px;
  line-height: 1.5;
  color: var(--tomo-text-muted);
}

.zen-settings__how { display: inline-block; margin-top: var(--tomo-space-6); font-size: 14px; }

/* One inline confirmation: where Delete was, no modal. */
.zen-confirm {
  padding: var(--tomo-space-3) var(--tomo-space-4);
  border: 1px solid var(--tomo-danger-line);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-danger-bg);
}

.zen-confirm__q { margin: 0; font-size: 14px; font-weight: 700; color: var(--tomo-danger-ink); }
.zen-confirm__d { margin: 2px 0 0; font-size: 13px; color: var(--tomo-text-secondary); }
.zen-confirm__problem { margin: var(--tomo-space-2) 0 0; font-size: 13px; color: var(--tomo-danger-ink); }
.zen-confirm__acts { display: flex; gap: var(--tomo-space-2); margin-top: var(--tomo-space-3); }

.zen-confirm .tomo-btn--danger {
  border: 0;
  background: var(--tomo-danger);
  color: var(--tomo-on-danger);
}

@media (max-width: 640px) {
  .zen-settings__row { grid-template-columns: 1fr; gap: 2px; }
}

/* ---------- How ZenAI works (E1, TO-57) ---------- */

.zen-how__title { margin-bottom: 2px; }
.zen-how__sub { margin-bottom: var(--tomo-space-6); }
.zen-how__section { margin-bottom: var(--tomo-space-6); }
.zen-how__head {
  margin: 0 0 var(--tomo-space-2);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--tomo-text-muted);
}

/* Every part is a collapsible kit row (Ro, 26 Oct 2026): one column, no card grids. */
.zen-how__rows > li { min-width: 0; }
.zen-how__num { font-size: 15px; font-weight: 700; line-height: 1; }

.zen-how__line { font-size: 13px; line-height: 1.45; color: var(--tomo-text-secondary); margin: 0; }

.zen-how__last {
  margin: 0 0 var(--tomo-space-2);
  padding: var(--tomo-space-3) var(--tomo-space-4);
  border-radius: var(--tomo-radius-md);
  background: var(--tomo-surface-sunken);
  border: 1px solid var(--tomo-border-light);
  font-size: 13px;
  color: var(--tomo-text-secondary);
}
.zen-how__last--stopped { border-color: var(--tomo-warn-line); color: var(--tomo-warn-ink); font-weight: 600; }
.zen-how__last .zen-link { margin-left: var(--tomo-space-2); }

/* ---------- Phone ---------- */

@media (max-width: 640px) {
  .zen-page__column { padding-top: var(--tomo-space-4); }
  .zen-row__fact { grid-template-columns: 96px minmax(0, 1fr); }
  .zen-filters { gap: 6px; }
  .zen-filters__new { width: 100%; margin: 0 0 var(--tomo-space-1); }
}

@media (prefers-reduced-motion: reduce) {
  .zen-page__skel { animation: none; }
}

/* ---------- TO-58: Pinned and New on the collapsed row (the on-mock strip is the row's own) ---------- */

.zen-row__chip {
  display: inline-block;
  margin-right: 6px;
  padding: 0 7px;
  border-radius: var(--tomo-radius-full);
  background: var(--tomo-surface-sunken);
  color: var(--tomo-text-secondary);
  font-size: 11px;
  font-weight: 700;
  line-height: 16px;
  vertical-align: 1px;
}

.zen-row__chip--new { background: var(--tomo-accent); color: var(--tomo-surface); }
