/*
 * Teacher Assistant — Estils base
 * Depèn de ub-tokens.css
 */

@import url("ub-tokens.d52bf0731c45.css");

/* ══════════════════════════════════════
   Reset i base
══════════════════════════════════════ */

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
}

body {
  font-family: var(--font-family);
  font-size: var(--font-size-base);
  font-weight: var(--font-weight-normal);
  line-height: var(--line-height-base);
  color: var(--color-text);
  background-color: var(--color-bg-subtle);
}

a {
  color: var(--color-link);
  text-decoration: none;
}
a:hover {
  color: var(--color-link-hover);
  text-decoration: underline;
}

/* ══════════════════════════════════════
   Layout principal
══════════════════════════════════════ */

.ta-layout {
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  grid-template-rows: var(--header-height) 1fr;
  grid-template-areas:
    "sidebar  header"
    "sidebar  main";
  min-height: 100vh;
}

/* ── Header ── */
.ta-header {
  grid-area: header;
  background-color: var(--color-bg-header);
  color: var(--color-text);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 var(--space-5);
  border-bottom: 0.5px solid var(--color-border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.ta-header__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  letter-spacing: 0.01em;
  color: var(--color-text);
}

.ta-header__breadcrumb {
  font-size: var(--font-size-sm);
  color: var(--color-text-muted);
}

.ta-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
}

/* ── Sidebar (clar — acordat) ── */
.ta-sidebar {
  grid-area: sidebar;
  background-color: var(--color-bg-sidebar);
  color: var(--color-text);
  border-right: 0.5px solid var(--color-border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.ta-sidebar__brand {
  height: var(--header-height);
  display: flex;
  align-items: center;
  padding: 0 var(--space-4);
  border-bottom: 0.5px solid var(--color-border);
  gap: var(--space-3);
  flex-shrink: 0;
}

.ta-sidebar__brand-logo {
  width: 24px;
  height: 24px;
  border-radius: 4px;
  background-color: var(--ub-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ta-sidebar__brand-logo span {
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.ta-sidebar__brand-text {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.ta-sidebar__nav {
  flex: 1;
  padding: var(--space-3) 0;
}

.ta-sidebar__section-label {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
  padding: var(--space-4) var(--space-4) var(--space-2);
}

.ta-sidebar__item {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-4);
  color: var(--color-text-muted);
  font-size: var(--font-size-sm);
  cursor: pointer;
  border-left: 3px solid transparent;
  border-radius: 0 var(--border-radius-sm) var(--border-radius-sm) 0;
  transition: all var(--transition-base);
  text-decoration: none;
}

.ta-sidebar__item:hover {
  background-color: rgba(0,114,206,0.05);
  color: var(--color-text);
  text-decoration: none;
}

.ta-sidebar__item.active {
  border-left-color: var(--ub-primary);
  background-color: var(--ub-primary-light);
  color: var(--ub-primary);
  font-weight: var(--font-weight-medium);
}

.ta-sidebar__item-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  opacity: 0.8;
}

.ta-sidebar__footer {
  padding: var(--space-4);
  border-top: 0.5px solid var(--color-border);
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
}

/* ── Menú mòbil: botó hamburguesa, tancar i overlay (amagats en escriptori) ── */
.ta-menu-toggle,
.ta-sidebar__close {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: none;
  border: none;
  border-radius: var(--border-radius-sm);
  color: var(--color-text);
  cursor: pointer;
  flex-shrink: 0;
}

.ta-menu-toggle:hover,
.ta-sidebar__close:hover {
  background-color: rgba(0,114,206,0.08);
}

.ta-sidebar-backdrop {
  display: none;
}

/* ── Contingut principal ── */
.ta-main {
  grid-area: main;
  padding: var(--space-5);
  overflow-y: auto;
}

/* ══════════════════════════════════════
   Components
══════════════════════════════════════ */

/* ── Targetes ── */
.ta-card {
  background-color: var(--color-surface);
  border-radius: var(--border-radius);
  border: 0.5px solid var(--color-border);
}

.ta-card__header {
  padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}

.ta-card__title {
  font-size: var(--font-size-lg);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.ta-card__body {
  padding: var(--space-5);
}

.ta-card__footer {
  padding: var(--space-3) var(--space-5);
  border-top: 1px solid var(--color-border);
  background-color: var(--color-bg-subtle);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
}

/* ── Capçalera de pàgina ── */
.ta-page-header {
  margin-bottom: var(--space-5);
}

.ta-page-header__title {
  font-size: var(--font-size-2xl);
  font-weight: var(--font-weight-bold);
  color: var(--color-text);
  line-height: var(--line-height-tight);
}

.ta-page-header__subtitle {
  margin-top: var(--space-2);
  font-size: var(--font-size-base);
  color: var(--color-text-muted);
}

/* ── Grid de targetes ── */
.ta-card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: var(--space-4);
}

/* ── Fila de bloc (Detall/Edita d'activitat) ── */
.ta-block-row {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  padding: var(--space-3) var(--space-5);
  border-bottom: 1px solid var(--color-border);
}

.ta-block-row:last-child {
  border-bottom: none;
}

.ta-block-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--border-radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: var(--font-size-base);
  flex-shrink: 0;
}

.ta-block-icon--blue   { background: var(--ub-primary-light); color: var(--ub-primary); }
.ta-block-icon--green  { background: #dcfce7; color: #166534; }
.ta-block-icon--amber  { background: #ffedd5; color: #9a3412; }
.ta-block-icon--teal   { background: #e6eef0; color: var(--ub-tertiary); }
.ta-block-icon--purple { background: #f3e8ee; color: var(--ub-tertiary-light); }
.ta-block-icon--slate  { background: var(--color-bg-subtle); color: var(--color-text-muted); border: 1px solid var(--color-border); }

.ta-block-info {
  flex: 1;
  min-width: 0;
}

.ta-block-name {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.ta-block-desc {
  font-size: var(--font-size-xs);
  color: var(--color-text-muted);
  margin-top: 2px;
}

.ta-block-action {
  font-size: var(--font-size-sm);
  color: var(--color-link);
  white-space: nowrap;
  text-decoration: none;
  flex-shrink: 0;
}

.ta-block-action:hover {
  text-decoration: underline;
}

/* ── Graf compactat (Vista resum) ── */
.ta-graph-cols {
  display: flex;
  gap: 0;
}
.ta-graph-col {
  padding: 0 var(--space-2);
  display: flex;
  flex-direction: column;
  min-width: 150px;
  flex: 1;
}
.ta-graph-col-title {
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-semibold, 600);
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--color-text-muted);
  margin-bottom: var(--space-3);
  text-align: center;
  padding-bottom: var(--space-2);
  border-bottom: 2px solid var(--color-border);
  white-space: nowrap;
}
.ta-graph-nodes {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  flex: 1;
}
.ta-gnode {
  border-radius: var(--border-radius-sm);
  padding: 7px 10px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  border: 1.5px solid;
  text-align: center;
  line-height: 1.3;
}
.ta-gnode--font { background: var(--color-bg-subtle); border-color: var(--color-border); color: var(--color-text); }
.ta-gnode--raw  { background: var(--ub-primary-light); border-color: var(--ub-primary); color: var(--ub-primary); }
.ta-gnode--ev   { background: #e6eef0; border-color: var(--ub-tertiary); color: var(--ub-tertiary); }
.ta-gnode--crit { background: #f3e8ee; border-color: var(--ub-tertiary-light); color: var(--ub-tertiary-light); }
.ta-gnode--warn { background: #ffedd5; border-color: #d97706; color: #9a3412; }
.ta-gnode-sub {
  font-size: 10px;
  font-weight: var(--font-weight-normal);
  opacity: .8;
  margin-top: 2px;
}
.ta-gsvg {
  position: absolute;
  top: 0;
  left: 0;
  pointer-events: none;
  overflow: visible;
}

/* ── Botons ── */
.ta-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  cursor: pointer;
  border: 1px solid transparent;
  transition: all var(--transition-fast);
  white-space: nowrap;
  text-decoration: none;
}

.ta-btn--primary {
  background-color: var(--ub-primary);
  color: var(--color-text-inverse);
  border-color: var(--ub-primary);
}
.ta-btn--primary:hover {
  background-color: var(--ub-primary-dark);
  border-color: var(--ub-primary-dark);
  color: var(--color-text-inverse);
  text-decoration: none;
}

.ta-btn--ghost {
  background-color: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}
.ta-btn--ghost:hover {
  background-color: var(--color-bg-subtle);
  color: var(--color-text);
  text-decoration: none;
}

.ta-btn--sm {
  padding: var(--space-1) var(--space-3);
  font-size: var(--font-size-xs);
}

/* ── Badges d'estat ── */
.ta-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px var(--space-3);
  border-radius: 100px;
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-medium);
  white-space: nowrap;
}

.ta-badge--pending   { background: #fef9c3; color: #854d0e; }
.ta-badge--running   { background: var(--ub-primary-light); color: var(--ub-primary-dark); }
.ta-badge--waiting   { background: #ffedd5; color: #9a3412; }
.ta-badge--completed { background: #dcfce7; color: #166534; }
.ta-badge--error     { background: #fee2e2; color: #991b1b; }
.ta-badge--skipped   { background: var(--ub-gray-light); color: var(--ub-gray-mid); }
.ta-badge--draft     { background: var(--ub-gray-light); color: var(--ub-gray-mid); }

.ta-badge__dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background-color: currentColor;
}

.ta-badge--running .ta-badge__dot {
  animation: ta-pulse 1.5s ease-in-out infinite;
}

@keyframes ta-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: 0.3; }
}

/* ── Pipeline visual ── */
.ta-pipeline {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ta-pipeline__phase {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-2) var(--space-3);
  border-radius: var(--border-radius-sm);
  font-size: var(--font-size-sm);
  border: 1px solid var(--color-border);
  background: var(--color-bg);
}

.ta-pipeline__phase--running {
  border-color: var(--ub-primary);
  background: var(--ub-primary-light);
}

.ta-pipeline__phase--completed {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--color-text-muted);
}

.ta-pipeline__phase--error {
  border-color: #fca5a5;
  background: #fff5f5;
}

.ta-pipeline__phase-num {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background-color: var(--color-bg-subtle);
  border: 1px solid var(--color-border);
  font-size: var(--font-size-xs);
  font-weight: var(--font-weight-bold);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-text-muted);
  flex-shrink: 0;
}

.ta-pipeline__phase--running  .ta-pipeline__phase-num { background: var(--ub-primary); border-color: var(--ub-primary); color: #fff; }
.ta-pipeline__phase--completed .ta-pipeline__phase-num { background: #2e7d32; border-color: #2e7d32; color: #fff; }
.ta-pipeline__phase--error     .ta-pipeline__phase-num { background: #c62828; border-color: #c62828; color: #fff; }

.ta-pipeline__phase-name {
  font-weight: var(--font-weight-medium);
}

/* ── Progress bar ── */
.ta-progress {
  height: 6px;
  background-color: var(--ub-gray-light);
  border-radius: 100px;
  overflow: hidden;
}

.ta-progress__bar {
  height: 100%;
  background-color: var(--ub-primary);
  border-radius: 100px;
  transition: width var(--transition-base);
}

/* ── Taules ── */
.ta-table {
  width: 100%;
  border-collapse: collapse;
  font-size: var(--font-size-sm);
}

.ta-table th {
  text-align: left;
  padding: var(--space-3) var(--space-4);
  background-color: var(--color-bg-subtle);
  font-weight: var(--font-weight-medium);
  color: var(--color-text-muted);
  font-size: var(--font-size-xs);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--color-border);
}

.ta-table td {
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.ta-table tbody tr:hover {
  background-color: var(--color-bg-subtle);
}

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

/* ── Alertes ── */
.ta-alert {
  display: flex;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-4);
  border-radius: var(--border-radius);
  font-size: var(--font-size-sm);
  border: 1px solid;
}

.ta-alert--info    { background: var(--ub-primary-light); border-color: #bfdbfe; color: #1e3a5f; }
.ta-alert--warning { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.ta-alert--error   { background: #fef2f2; border-color: #fca5a5; color: #7f1d1d; }
.ta-alert--success { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }

/* ── Formularis ── */
.ta-form-group {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
}

.ta-label {
  font-size: var(--font-size-sm);
  font-weight: var(--font-weight-medium);
  color: var(--color-text);
}

.ta-input,
.ta-select,
.ta-textarea {
  padding: var(--space-2) var(--space-3);
  border: 1px solid var(--color-border);
  border-radius: var(--border-radius-sm);
  font-family: var(--font-family);
  font-size: var(--font-size-sm);
  color: var(--color-text);
  background-color: var(--color-bg);
  transition: border-color var(--transition-fast);
  width: 100%;
}

.ta-input:focus,
.ta-select:focus,
.ta-textarea:focus {
  outline: none;
  border-color: var(--ub-primary);
  box-shadow: 0 0 0 3px rgba(0,114,206,0.15);
}

/* ── Variants compactes ── */
.ta-input--sm,
.ta-select--sm {
  padding: 2px var(--space-2);
  font-size: var(--font-size-xs, .75rem);
  width: auto;
}

/* ── Utilities ── */
.ta-flex         { display: flex; }
.ta-flex-center  { display: flex; align-items: center; }
.ta-gap-2        { gap: var(--space-2); }
.ta-gap-3        { gap: var(--space-3); }
.ta-gap-4        { gap: var(--space-4); }
.ta-gap-5        { gap: var(--space-5); }
.ta-mb-3         { margin-bottom: var(--space-3); }
.ta-mb-4         { margin-bottom: var(--space-4); }
.ta-mb-5         { margin-bottom: var(--space-5); }
.ta-text-muted   { color: var(--color-text-muted); }
.ta-text-sm      { font-size: var(--font-size-sm); }
.ta-text-xs      { font-size: var(--font-size-xs); }
.ta-font-medium  { font-weight: var(--font-weight-medium); }
.ta-font-bold    { font-weight: var(--font-weight-bold); }
.ta-w-full       { width: 100%; }
.ta-sr-only {
  position: absolute; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden;
  clip: rect(0,0,0,0); border: 0;
}

/* ── Expandable table rows ── */
.ta-row-expandable { display: none; background-color: var(--color-bg-subtle, #f8f8f8); }
.ta-row-expandable.is-open { display: table-row; }

/* ── File upload component (ta-upload) ── */
.ta-upload { display: flex; flex-direction: column; gap: var(--space-3); }

.ta-upload__demo-notice {
  display: flex; align-items: center; gap: var(--space-2);
  font-size: var(--font-size-sm);
}

.ta-upload__form { display: flex; flex-direction: column; gap: var(--space-3); }

.ta-upload__input { display: none; }

.ta-upload__dropzone {
  border: 2px dashed var(--ub-gray-light);
  border-radius: var(--radius-md);
  padding: var(--space-5);
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
  background: var(--color-bg-subtle, #fafafa);
  min-height: 140px;
  display: flex; align-items: center; justify-content: center;
}
.ta-upload__dropzone:hover,
.ta-upload__dropzone--drag {
  border-color: var(--ub-primary);
  background: color-mix(in srgb, var(--ub-primary) 5%, transparent);
}
.ta-upload__dropzone--has-file {
  border-style: solid;
  border-color: var(--ub-primary);
  background: color-mix(in srgb, var(--ub-primary) 4%, transparent);
}
.ta-upload__dropzone--error {
  border-color: var(--color-danger, #d32f2f);
  background: color-mix(in srgb, var(--color-danger, #d32f2f) 4%, transparent);
}

.ta-upload__prompt {
  display: flex; flex-direction: column; align-items: center; gap: var(--space-1);
  color: var(--color-text-muted);
  pointer-events: none;
}
.ta-upload__prompt svg { color: var(--ub-gray-light); margin-bottom: var(--space-1); }
.ta-upload__prompt-main { font-weight: var(--font-weight-medium); color: var(--color-text); }
.ta-upload__prompt-sub  { font-size: var(--font-size-sm); }
.ta-upload__prompt-hint { font-size: var(--font-size-xs); margin-top: var(--space-1); }

.ta-upload__file-preview {
  display: flex; align-items: center; gap: var(--space-3);
  width: 100%; pointer-events: none;
}
.ta-upload__file-preview button { pointer-events: auto; }
.ta-upload__file-info { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 0; }
.ta-upload__file-name { font-weight: var(--font-weight-medium); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.ta-upload__error { color: var(--color-danger, #d32f2f); font-size: var(--font-size-sm); margin: 0; }

.ta-upload__actions { display: flex; align-items: center; gap: var(--space-2); }

.ta-upload__spinner {
  display: inline-block;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: ta-spin 0.7s linear infinite;
  vertical-align: middle; margin-right: var(--space-1);
}
@keyframes ta-spin { to { transform: rotate(360deg); } }

/* ══════════════════════════════════════
   Responsive — mòbil (< 768px)
══════════════════════════════════════ */

@media (max-width: 767px) {
  .ta-layout {
    /* minmax(0, 1fr): a wide child (a row of actions, a table) must not widen the whole page. */
    grid-template-columns: minmax(0, 1fr);
    /* The header grows with its content (a long title, several actions) instead of overflowing a
       fixed row on top of the page. */
    grid-template-rows: auto 1fr;
    grid-template-areas:
      "header"
      "main";
  }

  .ta-header,
  .ta-main {
    min-width: 0;
  }

  .ta-header {
    min-height: var(--header-height);
    flex-wrap: wrap;
    gap: var(--space-2) var(--space-3);
    padding: var(--space-2) var(--space-3);
  }

  .ta-header > :first-child {
    min-width: 0;
    flex: 1 1 12rem;
  }

  .ta-header__title {
    display: block;
    overflow-wrap: anywhere;
  }

  /* Actions wrap under the title and never push the page sideways. */
  .ta-header__actions {
    flex-wrap: wrap;
    max-width: 100%;
    gap: var(--space-2);
  }

  /* Botó hamburguesa visible només a mòbil */
  .ta-menu-toggle {
    display: flex;
  }

  /* Sidebar esdevé un calaix lateral (off-canvas), amagat per defecte */
  .ta-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    width: 85%;
    max-width: 300px;
    height: 100vh;
    z-index: 300;
    transform: translateX(-100%);
    transition: transform var(--transition-base, 0.2s ease);
    box-shadow: var(--shadow-lg);
  }

  .ta-sidebar.is-open {
    transform: translateX(0);
  }

  .ta-sidebar__close {
    display: flex;
    margin-left: auto;
  }

  .ta-sidebar__nav {
    display: block;
    padding: var(--space-3) 0;
  }

  .ta-sidebar__item {
    font-size: var(--font-size-sm);
  }

  .ta-sidebar__footer {
    display: block;
  }

  /* Overlay fosc darrere el calaix, clicable per tancar */
  .ta-sidebar-backdrop.is-open {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.4);
    z-index: 250;
  }

  .ta-main {
    padding: var(--space-3);
  }

  .ta-card-grid {
    grid-template-columns:minmax(0,1fr);
  }

  /* A wide table or grid scrolls inside its card instead of widening the page. */
  .ta-card,
  .ta-dag-wrapper {
    max-width: 100%;
    overflow-x: auto;
  }

  /* A table of a few columns becomes a list of small blocks, the header of each cell in front of it. */
  .ta-table--stack,
  .ta-table--stack tbody,
  .ta-table--stack tr,
  .ta-table--stack td { display: block; width: auto; }
  .ta-table--stack thead { display: none; }
  .ta-table--stack tr { padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border); }
  .ta-table--stack td { border: 0; padding: 2px 0; text-align: left !important; }
  .ta-table--stack td[data-label]::before {
    content: attr(data-label) ": "; color: var(--color-text-muted); font-size: var(--font-size-xs);
  }

  /* A row of short cells becomes one wrapped line, the actions at its end. */
  .ta-table--rows,
  .ta-table--rows tbody { display: block; width: auto; }
  .ta-table--rows thead { display: none; }
  .ta-table--rows tr {
    display: flex; flex-wrap: wrap; align-items: center;
    gap: var(--space-1) var(--space-3); padding: var(--space-2) 0;
    border-bottom: 1px solid var(--color-border);
  }
  .ta-table--rows td { display: block; border: 0; padding: 0; text-align: left !important; }
  .ta-table--rows td:last-child { margin-left: auto; }

  /* Side-by-side blocks (before / after) stack. */
  .ta-cols-2 {
    grid-template-columns: 1fr !important;
  }
}


/* A row of short cells of the history of a review is one wrapped line, the actions at its end: it lives in a narrow column. */
.ta-table--line,
.ta-table--line tbody { display: block; width: auto; }
.ta-table--line thead { display: none; }
.ta-table--line tr {
  display: flex; flex-wrap: wrap; align-items: center;
  gap: var(--space-1) var(--space-3); padding: var(--space-2);
  border-bottom: 1px solid var(--color-border);
}
.ta-table--line td { display: block; border: 0; padding: 0; text-align: left !important; }
.ta-table--line td:last-child { margin-left: auto; }
.ta-table--line td:empty { display: none; }

/* Square icon buttons (the history of a review): the meaning is in title and aria-label. */
.ta-icon-btns { display: inline-flex; gap: var(--space-1); vertical-align: middle; }
.ta-icon-btn {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; padding: 0; border-radius: var(--border-radius);
  border: 1px solid var(--color-border); background: var(--color-surface);
  color: var(--color-text-muted); cursor: pointer; text-decoration: none;
}
.ta-icon-btn:hover { color: #fff; background: var(--ub-primary); border-color: var(--ub-primary); }
.ta-icon-btn:focus-visible { outline: 2px solid var(--ub-primary); outline-offset: 2px; }

/* ── Activity toolbox (core/activity_hub.html) ───────────────────────────── */
.tt-layout{display:grid;grid-template-columns:270px 1fr;gap:16px;align-items:start}
.tt-guide{padding:14px}
.tt-bar{height:6px;border-radius:4px;background:#E3E7EF;overflow:hidden;margin:8px 0}.tt-bar i{display:block;height:100%;background:var(--ub-primary,#0072CE)}
.tt-checks{list-style:none;margin:0;padding:0}.tt-checks li{display:flex;gap:8px;padding:7px 0;border-bottom:1px solid #EEF0F5;font-size:13px}.tt-checks li:last-child{border:0}
.tt-dot{width:18px;height:18px;border-radius:50%;display:grid;place-items:center;font-size:11px;font-weight:700;flex:none;margin-top:1px}
.tt-dot--ok{background:#EAF3DE;color:#3B6D11}.tt-dot--warn{background:#FAEEDA;color:#854F0B}.tt-dot--todo{background:#ECEFF4;color:#646464}
.tt-note{margin-top:10px;padding:8px 10px;border-radius:8px;background:#F4F6FA;font-size:12px}
.tt-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:6px}
.tt-group{margin:14px 0 6px;font-size:12px;font-weight:600;letter-spacing:.05em;text-transform:uppercase;color:#646464}
.tt-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:10px}
.tt-card{display:flex;gap:10px;align-items:flex-start;padding:12px}.tt-body{flex:1;min-width:0}
.tt-ico{width:34px;height:34px;border-radius:8px;display:grid;place-items:center;font-size:17px;background:#E6F1FB;flex:none}
.tt-actions{display:flex;flex-direction:column;gap:4px;align-items:stretch}.tt-actions form{margin:0}
.tt-badge-llm{background:#EFE8F8;color:#6B3FA0}
.tt-drawer{position:fixed;right:0;top:0;bottom:0;width:380px;background:#fff;border-left:1px solid #DDE1EA;box-shadow:-10px 0 24px rgba(20,30,60,.12);padding:16px;overflow:auto;z-index:1000}
.tt-drawer[hidden]{display:none}.tt-drawer-head{display:flex;align-items:center;justify-content:space-between}
.tt-item{padding:10px;margin-bottom:8px}
@media (max-width:900px){.tt-layout{grid-template-columns:minmax(0,1fr)}.tt-grid{grid-template-columns:minmax(0,1fr)}.tt-drawer{width:100%}}

/* Activity presets (core/activity_form.html) */
.tt-presets{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:10px}
.tt-preset{display:flex;flex-direction:column;gap:6px;padding:12px;cursor:pointer;position:relative}
.tt-preset input{position:absolute;right:10px;top:10px}
.tt-preset:has(input:checked){border-color:var(--ub-primary,#0072CE);box-shadow:0 0 0 2px rgba(0,114,206,.18)}
.tt-preset--off{opacity:.6;cursor:not-allowed}
.tt-preset-title{display:flex;align-items:center;gap:8px}
.tt-includes{margin:0;padding-left:16px;font-size:12px;color:#444}
@media (max-width:900px){.tt-presets{grid-template-columns:minmax(0,1fr)}}

/* Configuration assistant (core/activity_hub.html) */
.tt-assistant-btn{position:fixed;right:20px;bottom:18px;background:var(--ub-primary,#0072CE);color:#fff;border:0;border-radius:999px;padding:10px 16px;font-weight:600;box-shadow:0 6px 18px rgba(0,114,206,.35);cursor:pointer;z-index:900}
.tt-chat{display:flex;flex-direction:column}.tt-chat[hidden]{display:none}
.tt-chat-log{flex:1;overflow:auto;margin:6px 0;display:flex;flex-direction:column;gap:6px}
.tt-msg{padding:8px 11px;border-radius:12px;font-size:13px;max-width:92%}.tt-msg--me{background:var(--ub-primary,#0072CE);color:#fff;align-self:flex-end}.tt-msg--bot{background:#EEF2F8;align-self:flex-start}
.tt-plan{border:1px solid var(--ub-primary,#0072CE);border-radius:10px;padding:10px 12px;background:#F5FAFF;font-size:13px;margin:6px 0}.tt-plan ul{margin:6px 0 8px;padding-left:18px}
.tt-chat-form{display:flex;gap:6px}.tt-chat-form input{flex:1}.tt-chat-meta{margin:4px 0}

/* ── Compact evidence DAG (static/ta/js/evidence-dag.js) ─────────────────────────────────────── */
.edag { display: none; }
@media (min-width: 900px) { .edag { display: block; } }
.edag__bar { display: flex; justify-content: flex-end; margin-bottom: var(--space-2); }
.edag__cols { display: grid; gap: var(--space-6); position: relative; }
.edag__col { display: flex; flex-direction: column; gap: var(--space-2); }
.edag__title { font-size: var(--font-size-xs); text-transform: uppercase; letter-spacing: .05em; color: var(--color-text-muted); }
.edag__svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.edag__node { border: 1px solid var(--color-border, #dde3ea); border-radius: 6px; padding: 6px 10px; font-size: var(--font-size-sm); background: var(--color-bg-subtle, #f6f8fa); cursor: pointer; text-align: left; position: relative; z-index: 1; }
.edag__node small { display: block; color: var(--color-text-muted); }
.edag__mark { font-weight: 700; }
.edag__node--ok { background: #e6eef0; border-color: var(--ub-tertiary, #2a6f7f); }
.edag__node--warn { background: #fff4d6; border-color: #d9a400; }
.edag__node--fail { background: #ffedd5; border: 1px dashed #d97706; color: #9a3412; }
.edag__node--unknown { background: #f1f1f1; border: 1px dashed #888; color: #555; }
.ta-active-check { display: inline-flex; align-items: center; justify-content: center; width: 1.4em; height: 1.4em; border-radius: 50%; background: #166534; color: #fff; font-weight: 700; font-size: .85em; line-height: 1; }
.edag__node--accepted { background: #e3f6e8; border: 1px dashed #17692b; color: #17692b; }
.edag__node--waived, .edag__node--na { opacity: .55; }
.edag__node--decision { background: #e8eefc; border-color: #5b7fd6; }
/* A bloc of the rubric is neutral: a pink or red tint reads as "something is wrong". Only a bloc that is
   still pending a review uses the same amber as the other "needs attention" nodes. */
.edag__node--bloc { background: #eef1f5; border-color: #9aa7b8; }
.edag__node--group { background: #e4e9f1; border-color: #7e8da6; font-weight: 600; }
.edag__node--final { background: #1f3a5f; border-color: #1f3a5f; color: #fff; }
.edag__node--final small { color: #d6e2f3; }
.edag__node--bloc-pending { background: #fff4d6; border-color: #d9a400; }
.edag__node.is-hot { box-shadow: 0 0 0 2px #d97706; }
.edag__node.is-dim { opacity: .3; }
.edag__detail { margin-top: var(--space-3); padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-border, #dde3ea); min-height: 3rem; }
.ta-calc-cell--final { background: var(--ub-primary-light, #E6F1FB); }
