/* =========================================================
   Participation Tracker — tool-specific styles.
   Layered on /tools/_shared/tool.css.
   Reference shared tokens only; no tokens defined here.
   ========================================================= */

/* Laptop-first widget. Setup form stays comfortably readable;
   tally grid uses the width on a 1280px laptop. */
.pt-card {
  max-width: 1120px;
}

/* ---------- Privacy banner ---------- */
.pt-privacy-banner {
  display: flex;
  align-items: flex-start;
  gap: var(--space-3);
  margin: 0 0 var(--space-6);
  padding: var(--space-3) var(--space-4);
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  font-size: 14px;
  line-height: 1.5;
}
.pt-privacy-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  margin-top: 2px;
  color: var(--accent);
}
.pt-privacy-banner strong { font-weight: 700; }

/* ---------- Setup phase ---------- */
.pt-setup {
  max-width: 560px;
  margin: 0 auto;
}

.pt-field {
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  margin-bottom: var(--space-5);
}
.pt-field label {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--space-2);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.pt-status {
  font-size: 12px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.pt-status strong { color: var(--text); font-weight: 700; }
.pt-dupe-notice {
  margin: 0;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
  line-height: 1.4;
  background: var(--accent-soft-bg);
  color: var(--accent-soft-fg);
  border: 1px solid var(--accent);
  border-radius: var(--radius-sm);
}
.pt-dupe-notice[hidden] { display: none; }

.pt-sample-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
}
.pt-sample-actions .btn {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
}

.pt-field textarea {
  width: 100%;
  resize: vertical;
  min-height: 180px;
  padding: var(--space-4);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-inset);
  color: var(--text);
  font: inherit;
  font-size: 15px;
  line-height: 1.55;
  transition: var(--transition-colors);
}
.pt-field textarea::placeholder { color: var(--text-subtle); }
.pt-field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}
.pt-field-hint {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-muted);
  margin: 0;
}

/* ---------- Tally toolbar ---------- */
.pt-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  padding: var(--space-3) var(--space-4);
  background: var(--surface-inset);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: var(--space-5);
}

.pt-summary {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: var(--space-2) var(--space-4);
  color: var(--text-secondary);
  font-size: 14px;
}
.pt-summary-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-variant-numeric: tabular-nums;
}
.pt-summary-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  line-height: 1;
}
.pt-summary-quiet .pt-summary-value { color: var(--accent); }
.pt-summary-label {
  font-size: 13px;
  color: var(--text-muted);
}
.pt-summary-sep {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: var(--border);
}
@media (max-width: 500px) {
  .pt-summary-sep { display: none; }
}

.pt-sort {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
}
.pt-sort-label {
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.18em;
  color: var(--text-muted);
}
.pt-sort-select {
  padding: 8px 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: var(--transition-colors);
}
.pt-sort-select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

/* ---------- Tile grid ---------- */
.pt-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: var(--space-3);
  margin-bottom: var(--space-5);
}

.pt-tile-wrap {
  position: relative;
}

.pt-tile {
  width: 100%;
  min-height: 108px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: var(--space-4) var(--space-3);
  background: var(--accent-soft-bg);
  border: 1px solid var(--accent);
  border-radius: var(--radius);
  color: var(--accent-soft-fg);
  font: inherit;
  cursor: pointer;
  text-align: center;
  transition: background 0.12s ease, border-color 0.12s ease,
              transform 0.08s ease, box-shadow 0.12s ease;
  box-shadow: var(--shadow-sm);
}
.pt-tile:hover:not(:disabled) {
  background: color-mix(in srgb, var(--accent) 22%, var(--surface));
  border-color: var(--accent-hover);
}
.pt-tile:active:not(:disabled) {
  transform: translateY(1px);
}
.pt-tile:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
}

.pt-tile-name {
  font-size: 15px;
  font-weight: 700;
  line-height: 1.25;
  color: inherit;
  word-break: break-word;
}
.pt-tile-count {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
}

/* Zero-count tiles stay visually distinct — outlined, not filled.
   Dashed border + muted text + smaller count carry the signal
   even if color is unavailable. */
.pt-tile.is-zero {
  background: var(--surface);
  border: 1px dashed var(--border-strong);
  color: var(--text-muted);
  box-shadow: none;
}
.pt-tile.is-zero .pt-tile-count {
  color: var(--text-subtle);
  font-size: 24px;
}
.pt-tile.is-zero:hover:not(:disabled) {
  background: var(--surface-inset);
  border-color: var(--accent);
  border-style: solid;
  color: var(--text);
}

/* Minus button sits in the tile's top-right corner. */
.pt-tile-minus {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font: inherit;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  transition: var(--transition-colors);
}
.pt-tile-minus:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}
.pt-tile-minus:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.pt-tile-minus:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}
.pt-tile-minus-icon {
  width: 14px;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  display: block;
}

/* ---------- Actions row ---------- */
.pt-actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  justify-content: flex-end;
  margin-bottom: var(--space-4);
}
.pt-actions .btn {
  min-height: 42px;
}
@media (max-width: 560px) {
  .pt-actions {
    justify-content: stretch;
  }
  .pt-actions .btn {
    flex: 1 1 160px;
  }
}

/* ---------- Inline confirm ---------- */
.pt-confirm {
  margin: var(--space-3) 0 var(--space-5);
  padding: var(--space-4) var(--space-5);
  background: var(--danger-soft-bg);
  border: 1px solid var(--danger);
  border-radius: var(--radius);
  color: var(--danger-soft-fg);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.pt-confirm[hidden] { display: none; }
.pt-confirm-text {
  margin: 0;
  font-size: 14px;
  line-height: 1.4;
  flex: 1 1 240px;
}
.pt-confirm-actions {
  display: inline-flex;
  gap: var(--space-2);
  flex-wrap: wrap;
}
.pt-confirm-actions .btn {
  min-height: 38px;
}

/* ---------- Privacy footer / erase ---------- */
.pt-privacy-footer {
  margin-top: var(--space-5);
  padding-top: var(--space-5);
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
}
.pt-privacy-footer-note {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}
.pt-btn-small {
  min-height: 36px;
  padding: var(--space-2) var(--space-3);
  font-size: 13px;
}

/* ---------- Mobile tweaks ---------- */
@media (max-width: 560px) {
  .pt-toolbar {
    flex-direction: column;
    align-items: stretch;
  }
  .pt-sort {
    justify-content: space-between;
  }
  .pt-grid {
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  }
}
@media (max-width: 400px) {
  .pt-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: var(--space-2);
  }
  .pt-tile {
    min-height: 96px;
  }
  .pt-tile-count {
    font-size: 28px;
  }
}
