/* Activity log */
.activity-filters {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  padding: 8px 12px;
  background: #fafbfc;
  border: 1px solid #eceef1;
  border-radius: 8px;
  flex-wrap: wrap;
}
.activity-filters__group { display: flex; align-items: center; gap: 6px; }

.filter-select {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12.5px;
  color: #475260;
}
.filter-select__label { color: #93a0aa; }
.filter-select__select {
  border: 1px solid #d9dde2;
  background: #fff;
  border-radius: 5px;
  padding: 3px 26px 3px 8px;
  font: inherit;
  font-size: 12.5px;
  color: #1a1d21;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'><path d='M3 5l3 3 3-3' fill='none' stroke='%23475260' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  background-size: 10px;
  transition: border-color var(--dur-fast) var(--ease-std);
}
.filter-select__select:hover { border-color: #c5cbd2; }
.filter-select__select:focus {
  outline: none;
  border-color: var(--accent-color, var(--assh-teal));
}

/* Activity table headers */
.activity-table thead th {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #93a0aa;
  text-align: left;
  padding: 10px 14px;
  border-bottom: 1px solid #eceef1;
  background: #fafbfc;
}

/* ============================================================
   Full-page activity table — uses fixed layout + an explicit <colgroup>
   so colspan rows (the "Change behavior" adjust row) cannot push
   columns wider than the table's own width.
   The home-page preview keeps the default auto layout (no --full class).
   ============================================================ */

.activity-table--full {
  table-layout: fixed;
  width: 100%;
}

/* ============================================================
   "Change behavior" inline slot row — sits directly beneath the
   activity row it belongs to, spanning all 5 columns.
   ============================================================ */

.activity-row__adjust-slot > td {
  padding: 0 !important;
  background: transparent;
  border-bottom: 1px solid var(--bg-border, #eceef1);
  /* Belt-and-suspenders for any user agent that ignores fixed layout
     hints on percentage-width children inside colspan cells. */
  overflow: hidden;
  min-width: 0;
}

.activity-adjust-form {
  margin: 4px 14px 14px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--activity-adjust-border, #f3d77a);
  background: var(--activity-adjust-bg, #fffbeb);
  color: var(--activity-adjust-fg, #7a5d10);
  box-sizing: border-box;
  max-width: 100%;
  min-width: 0;
}

.activity-adjust-form__form { margin: 0; min-width: 0; }

.activity-adjust-form__label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--activity-adjust-label, #7a5d10);
}

.activity-adjust-form__textarea {
  display: block;
  width: 100%;
  max-width: 100%;
  /* Critical: kill the textarea's default cols-based min-width — otherwise
     the cell sizes to fit the textarea's intrinsic width, not the viewport. */
  min-width: 0;
  font: inherit;
  font-size: 13px;
  line-height: 1.45;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--activity-adjust-input-border, #f3d77a);
  background: var(--activity-adjust-input-bg, #ffffff);
  color: var(--activity-adjust-input-fg, var(--fg-app, #1a1d21));
  resize: vertical;
  min-height: 64px;
  box-sizing: border-box;
  /* Prevent unbroken long tokens from making the textarea overflow horizontally */
  word-break: break-word;
  overflow-wrap: anywhere;
}

.activity-adjust-form__textarea:focus {
  outline: none;
  border-color: var(--assh-ui-yellow-dark, #B75A0D);
  box-shadow: 0 0 0 3px rgba(183, 90, 13, 0.18);
}

.activity-adjust-form__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
  align-items: center;
}

.activity-adjust-form__hint {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--activity-adjust-hint, #8a6f1a);
}

/* In-flight status: visible while Opus is rewriting (5–15s) so the user
   isn't left wondering whether the click registered. Replaces the hint
   in the same row position. */
.activity-adjust-form__status {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  font-size: 12px;
  font-weight: 500;
  color: var(--activity-adjust-status, #7a5d10);
}
/* The [hidden] HTML attribute uses a low-specificity UA rule
   ([hidden]{display:none}) that loses to the .activity-adjust-form__status
   author rule above. Without this override, the status + spinner shows
   immediately when the form is loaded, before the user clicks Rewrite. */
.activity-adjust-form__status[hidden] {
  display: none;
}

.activity-adjust-form__spinner {
  width: 13px;
  height: 13px;
  border: 2px solid currentColor;
  border-top-color: transparent;
  border-radius: 50%;
  animation: btn-spin 0.6s linear infinite;
  flex-shrink: 0;
}

[data-theme="dark"] {
  --activity-adjust-status: #f0c878;
}

/* Dark theme — re-skin the amber surface so the text stays readable
   and the panel reads as themed (not raw yellow). */
[data-theme="dark"] {
  --activity-adjust-bg:           rgba(183, 90, 13, 0.10);
  --activity-adjust-border:       rgba(183, 90, 13, 0.45);
  --activity-adjust-fg:           var(--fg-app, #e6e9ed);
  --activity-adjust-label:        #f0c878;
  --activity-adjust-input-bg:     var(--bg-elevated, #161a1f);
  --activity-adjust-input-border: rgba(183, 90, 13, 0.55);
  --activity-adjust-input-fg:     var(--fg-app, #e6e9ed);
  --activity-adjust-hint:         var(--fg-muted-app, #8b939d);
}

[data-theme="dark"] .activity-row__adjust-slot > td {
  border-bottom-color: var(--bg-border, #232a31);
}

/* ============================================================
   Responsive activity table — let the table scroll horizontally
   INSIDE its card on narrow viewports rather than pushing horizontal
   scroll onto the entire page. min-width matches the colgroup sum
   plus a comfortable Email column.
   ============================================================ */
.table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.activity-table--full {
  min-width: 820px;
}

/* ============================================================
   "Rewriting your ruleset" overlay — appears after submit, replaces
   the form body so the wait state is impossible to miss.
   ============================================================ */
.activity-adjust-form__overlay {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 28px 16px;
  min-height: 180px;
  text-align: center;
  color: var(--activity-adjust-fg, #7a5d10);
}
.activity-adjust-form__overlay[hidden] { display: none; }
.activity-adjust-form__spinner--lg {
  width: 32px;
  height: 32px;
  border-width: 3px;
}
.activity-adjust-form__overlay-title {
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  color: var(--activity-adjust-fg, #7a5d10);
}
.activity-adjust-form__overlay-sub {
  font-size: 13px;
  color: var(--activity-adjust-hint, #8a6f1a);
  max-width: 460px;
  line-height: 1.5;
}
