/* =============================================================================
   ticket_panel.css  —  "Ticket Panel" section styles
   ------------------------------------------------------------------------------
   Uses the SAME CSS custom properties defined in style.css so the new section
   feels native to the existing Ghost Ticket dashboard:

     --bg            #070a12   page background (with radial gradients + grid)
     --panel         rgba(16, 24, 42, 0.82)   translucent card with blur
     --panel-strong  rgba(19, 31, 55, 0.96)   stronger (less translucent)
     --line          rgba(124, 240, 255, 0.22) cyan-tinted hairline
     --text          #eef6ff   primary text (near-white blue)
     --muted         #8ea3bd   secondary text (cool gray)
     --cyan          #36e7ff   neon cyan accent (active states)
     --pink          #ff4fd8
     --green         #6bffbd   mint green (Enabled pill text)
     --danger        #ff5874   pinkish red (delete button)

   Custom local variables (for ticket-panel-only shades that don't exist in the
   global palette) are defined as rgb triplets so they can be alpha-composited.
   ============================================================================= */

:root {
  /* Local-only shades, tuned to feel like part of the same dark cyan theme */
  --tp-card-bg: rgba(16, 24, 42, 0.82);            /* == var(--panel) */
  --tp-card-bg-hover: rgba(22, 33, 58, 0.92);
  --tp-elevated: rgba(19, 31, 55, 0.96);           /* == var(--panel-strong) */
  --tp-line: rgba(124, 240, 255, 0.22);            /* == var(--line) */
  --tp-line-strong: rgba(124, 240, 255, 0.42);
  --tp-line-soft: rgba(124, 240, 255, 0.10);

  --tp-cyan: #36e7ff;
  --tp-cyan-rgb: 54, 231, 255;
  --tp-cyan-soft: rgba(54, 231, 255, 0.10);
  --tp-cyan-softer: rgba(54, 231, 255, 0.055);

  --tp-green-rgb: 107, 255, 189;
  --tp-green-bg: rgba(107, 255, 189, 0.10);
  --tp-green-border: rgba(107, 255, 189, 0.30);

  --tp-danger-rgb: 255, 88, 116;
  --tp-danger-bg: rgba(255, 88, 116, 0.10);
  --tp-danger-border: rgba(255, 88, 116, 0.30);

  --tp-purple-rgb: 167, 139, 250;
  --tp-purple-soft: rgba(167, 139, 250, 0.10);
  --tp-purple-border: rgba(167, 139, 250, 0.28);

  --tp-radius: 10px;
  --tp-radius-sm: 7px;
  --tp-transition: 180ms cubic-bezier(0.4, 0, 0.2, 1);
  --tp-shadow: 0 18px 60px rgba(0, 0, 0, 0.32), inset 0 1px 0 rgba(255, 255, 255, 0.04);
}

/* =============================================================================
   Sidebar active sub-link — the new "Panels" / "Multipurpose panel" links.
   Inherits the existing .sidebar a hover treatment but locks it in for the
   active page so the user always knows where they are.
   ============================================================================= */
.sidebar .nested a.tp-active,
.sidebar .nested a.tp-active:hover {
  color: var(--tp-cyan);
  background: var(--tp-cyan-soft);
  border-left: 2px solid var(--tp-cyan);
  padding-left: calc(10px - 2px);
  border-radius: 0 6px 6px 0;
  font-weight: 700;
  text-shadow: 0 0 12px rgba(var(--tp-cyan-rgb), 0.45);
  transform: translateX(3px);
}

/* =============================================================================
   Page container
   ============================================================================= */
.tp-list-page {
  padding: 24px 24px 40px;
  background: transparent;
  backdrop-filter: none;
  /* drop the global .panel box-shadow/border for this page — the rows carry
     the visual weight, and we want the content-area to feel open */
  border: none;
  box-shadow: none;
  margin-bottom: 0;
}

/* =============================================================================
   Header
   ============================================================================= */
.tp-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 20px;
}

.tp-header-title .badge {
  display: inline-block;
  margin-bottom: 10px;
}

.tp-h1 {
  font-size: 28px;
  font-weight: 850;
  color: var(--text);
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  text-shadow: 0 0 22px rgba(var(--tp-cyan-rgb), 0.18);
}

.tp-subtitle {
  color: var(--muted);
  margin: 0;
  font-size: 14px;
  line-height: 1.55;
  max-width: 640px;
}

/* Counter "4/25" pill on the right */
.tp-counter {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: baseline;
  gap: 2px;
  padding: 10px 16px;
  background: var(--tp-card-bg);
  border: 1px solid var(--tp-line);
  border-radius: var(--tp-radius-sm);
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  color: var(--muted);
  box-shadow: var(--tp-shadow);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tp-counter-num {
  color: var(--tp-cyan);
  font-weight: 850;
  font-size: 17px;
  text-shadow: 0 0 12px rgba(var(--tp-cyan-rgb), 0.45);
}

.tp-counter-sep {
  color: var(--muted);
  margin: 0 2px;
  opacity: 0.7;
}

.tp-counter-max {
  color: var(--muted);
  font-weight: 600;
}

/* =============================================================================
   Search bar
   ============================================================================= */
.tp-search {
  display: flex;
  align-items: center;
  gap: 10px;
  position: relative;
  margin-bottom: 22px;
}

.tp-search-icon {
  position: absolute;
  left: 14px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--muted);
  opacity: 0.7;
  display: inline-flex;
  pointer-events: none;
}

.tp-search-input {
  flex: 1 1 auto;
  height: 46px;
  padding: 0 16px 0 44px;
  background: rgba(4, 8, 16, 0.76);
  border: 1px solid var(--tp-line);
  border-radius: var(--tp-radius-sm);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  outline: none;
  transition: border-color var(--tp-transition),
              box-shadow var(--tp-transition),
              background var(--tp-transition);
}

.tp-search-input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.tp-search-input:focus {
  border-color: rgba(var(--tp-cyan-rgb), 0.55);
  background: rgba(5, 12, 24, 0.9);
  box-shadow: 0 0 0 2px rgba(var(--tp-cyan-rgb), 0.12),
              0 0 22px rgba(var(--tp-cyan-rgb), 0.08);
}

/* =============================================================================
   Rows list
   ============================================================================= */
.tp-rows {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.tp-row {
  background: var(--tp-card-bg);
  border: 1px solid var(--tp-line);
  border-radius: var(--tp-radius);
  overflow: hidden;
  transition: border-color var(--tp-transition),
              background var(--tp-transition),
              box-shadow var(--tp-transition),
              transform var(--tp-transition);
  box-shadow: var(--tp-shadow);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  /* match the global staggered ghost-rise animation timing */
  animation: ghost-rise 0.4s ease-out backwards;
}

.tp-row:nth-child(1) { animation-delay: 0.04s; }
.tp-row:nth-child(2) { animation-delay: 0.10s; }
.tp-row:nth-child(3) { animation-delay: 0.16s; }
.tp-row:nth-child(4) { animation-delay: 0.22s; }
.tp-row:nth-child(5) { animation-delay: 0.28s; }
.tp-row:nth-child(6) { animation-delay: 0.34s; }

.tp-row:hover {
  border-color: var(--tp-line-strong);
  background: var(--tp-card-bg-hover);
  transform: translateX(2px);
}

.tp-row.is-open {
  border-color: rgba(var(--tp-cyan-rgb), 0.55);
  background: var(--tp-card-bg-hover);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.36),
              0 0 28px rgba(var(--tp-cyan-rgb), 0.10),
              inset 0 1px 0 rgba(255, 255, 255, 0.04);
  transform: translateX(0);
}

/* ── Main row layout ───────────────────────────────────────────────────── */
.tp-row-main {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 140px 140px 110px;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
}

@media (max-width: 880px) {
  .tp-row-main {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "info actions"
      "status tickets";
    row-gap: 12px;
  }
  .tp-info        { grid-area: info; }
  .tp-actions     { grid-area: actions; }
  .tp-col-status  { grid-area: status; }
  .tp-col-tickets { grid-area: tickets; }
}

/* ── Info column ───────────────────────────────────────────────────────── */
.tp-info {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}

.tp-icon {
  flex: 0 0 auto;
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 9px;
  background: var(--tp-cyan-soft);
  color: var(--tp-cyan);
  border: 1px solid rgba(var(--tp-cyan-rgb), 0.30);
  box-shadow: inset 0 0 14px rgba(var(--tp-cyan-rgb), 0.06);
  transition: transform var(--tp-transition), box-shadow var(--tp-transition);
}

.tp-row:hover .tp-icon {
  transform: scale(1.04);
  box-shadow: 0 0 18px rgba(var(--tp-cyan-rgb), 0.20);
}

.tp-icon-multi {
  background: var(--tp-purple-soft);
  color: rgb(var(--tp-purple-rgb));
  border-color: var(--tp-purple-border);
  box-shadow: inset 0 0 14px rgba(var(--tp-purple-rgb), 0.06);
}

.tp-row:hover .tp-icon-multi {
  box-shadow: 0 0 18px rgba(var(--tp-purple-rgb), 0.22);
}

.tp-text {
  min-width: 0;
}

.tp-name {
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0;
}

.tp-channel {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 3px;
  font-size: 13px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-link-icon {
  flex: 0 0 auto;
  color: var(--muted);
  opacity: 0.7;
}

.tp-channel-sub {
  color: var(--muted);
  opacity: 0.7;
  margin-left: 4px;
}

/* ── Status pill column ───────────────────────────────────────────────── */
.tp-col-status {
  display: flex;
  align-items: center;
}

/* NOTE: deliberately NOT reusing .status-pill.open/.closed from style.css —
   those are for ticket open/close status and are cyan/gray. The user spec
   asks for "dark green background + light green text" for the Enabled badge
   on ticket panels, so we use a dedicated modifier here. */
.tp-status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.01em;
  border: 1px solid transparent;
  white-space: nowrap;
  transition: border-color var(--tp-transition), background var(--tp-transition);
}

.tp-status-pill.enabled {
  background: var(--tp-green-bg);
  color: var(--green);
  border-color: var(--tp-green-border);
  text-shadow: 0 0 8px rgba(var(--tp-green-rgb), 0.30);
}

.tp-status-pill.disabled {
  background: rgba(255, 255, 255, 0.04);
  color: var(--muted);
  border-color: var(--tp-line);
}

.tp-status-pill .tp-status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 6px currentColor;
}

.tp-status-pill.sm {
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
}

/* ── Open tickets column ──────────────────────────────────────────────── */
.tp-col-tickets {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  line-height: 1.1;
}

.tp-open-num {
  font-size: 20px;
  font-weight: 850;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.tp-open-label {
  font-size: 10px;
  color: var(--muted);
  margin-top: 3px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

/* ── Action buttons ───────────────────────────────────────────────────── */
.tp-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-end;
}

.tp-delete {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--tp-danger-bg);
  color: var(--danger);
  border: 1px solid var(--tp-danger-border);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  font-weight: inherit;
  box-shadow: none;
  transition: transform var(--tp-transition),
              background var(--tp-transition),
              border-color var(--tp-transition),
              box-shadow var(--tp-transition);
}

.tp-delete:hover {
  background: rgba(var(--tp-danger-rgb), 0.18);
  border-color: rgba(var(--tp-danger-rgb), 0.55);
  transform: translateY(-1px);
  box-shadow: 0 0 18px rgba(var(--tp-danger-rgb), 0.20);
}

.tp-delete:active {
  transform: translateY(0);
}

.tp-expand {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  cursor: pointer;
  padding: 0;
  font-weight: inherit;
  box-shadow: none;
  transition: transform var(--tp-transition),
              color var(--tp-transition),
              border-color var(--tp-transition),
              background var(--tp-transition);
}

.tp-expand:hover {
  color: var(--tp-cyan);
  border-color: rgba(var(--tp-cyan-rgb), 0.55);
  background: var(--tp-cyan-soft);
  transform: translateY(-1px);
}

.tp-expand .tp-chevron {
  transition: transform var(--tp-transition);
}

.tp-row.is-open .tp-expand {
  color: var(--tp-cyan);
  border-color: rgba(var(--tp-cyan-rgb), 0.55);
  background: var(--tp-cyan-soft);
}

.tp-row.is-open .tp-expand .tp-chevron {
  transform: rotate(180deg);
}

/* =============================================================================
   Accordion-expanded section (shared by both pages)
   ------------------------------------------------------------------------------
   Uses the modern grid-template-rows: 0fr → 1fr trick for a smooth height
   animation that doesn't need to know the content's pixel height.
   ============================================================================= */
.tp-row-expanded {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows var(--tp-transition);
}

.tp-row.is-open .tp-row-expanded {
  grid-template-rows: 1fr;
}

.tp-row-expanded > .tp-expanded-inner {
  overflow: hidden;
  min-height: 0;
}

.tp-row.is-open .tp-row-expanded > .tp-expanded-inner {
  border-top: 1px solid var(--tp-line-soft);
}

.tp-expanded-inner {
  padding: 0 20px;
  background: var(--tp-elevated);
}

.tp-row.is-open .tp-expanded-inner {
  padding-top: 18px;
  padding-bottom: 18px;
}

/* ── Quick-config grid (panels.html) ──────────────────────────────────── */
.tp-quick-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px 24px;
  margin-bottom: 18px;
}

.tp-quick-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.tp-quick-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  font-weight: 700;
  opacity: 0.8;
}

.tp-quick-value {
  font-size: 14px;
  color: var(--text);
  word-break: break-word;
}

.tp-quick-value code {
  font-family: "SFMono-Regular", "Consolas", monospace;
  font-size: 12px;
  color: var(--tp-cyan);
  background: var(--tp-cyan-soft);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid rgba(var(--tp-cyan-rgb), 0.20);
}

.tp-quick-msg {
  color: var(--muted);
  font-style: italic;
  font-size: 13px;
}

/* Spanning item (used for the embed description which can be long) */
.tp-quick-item-wide {
  grid-column: 1 / -1;
}

/* Inline channel-ID hint inside the Channel quick-item value */
.tp-quick-id {
  color: var(--muted);
  opacity: 0.7;
  font-size: 11px;
  margin-left: 4px;
  font-family: "SFMono-Regular", "Consolas", monospace;
}

/* Embed-color chip — small swatch shown next to the hex code */
.tp-color-chip {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 3px;
  vertical-align: middle;
  margin-right: 4px;
  border: 1px solid var(--tp-line);
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.4);
}

/* ── Expanded action buttons (bottom of accordion) ─────────────────────── */
.tp-expanded-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 16px;
  margin-top: 4px;
  border-top: 1px dashed var(--tp-line-soft);
}

.tp-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 7px;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: transform var(--tp-transition),
              background var(--tp-transition),
              border-color var(--tp-transition),
              color var(--tp-transition);
}

.tp-btn-primary {
  background:
    linear-gradient(135deg, rgba(var(--tp-cyan-rgb), 0.22), rgba(var(--tp-cyan-rgb), 0.10));
  color: var(--tp-cyan);
  border-color: rgba(var(--tp-cyan-rgb), 0.45);
  box-shadow: 0 0 14px rgba(var(--tp-cyan-rgb), 0.10);
  text-shadow: 0 0 6px rgba(var(--tp-cyan-rgb), 0.25);
}

.tp-btn-primary:hover {
  transform: translateY(-1px);
  border-color: rgba(var(--tp-cyan-rgb), 0.70);
  box-shadow: 0 0 22px rgba(var(--tp-cyan-rgb), 0.20);
}

.tp-btn-ghost {
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border-color: var(--tp-line);
}

.tp-btn-ghost:hover {
  color: var(--text);
  border-color: var(--tp-line-strong);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

/* =============================================================================
   Sub-panel list (multipurpose_panels.html only)
   ============================================================================= */
.tp-subpanel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.tp-subpanel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--muted);
}

.tp-subpanel-title strong {
  color: var(--text);
  font-weight: 700;
}

.tp-subpanel-count {
  font-size: 11px;
  color: var(--muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid var(--tp-line);
  font-weight: 700;
  letter-spacing: 0.02em;
}

.tp-subpanel-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 18px;
}

.tp-subpanel-row {
  display: grid;
  grid-template-columns: 28px minmax(0, 1fr) auto auto auto;
  align-items: center;
  gap: 14px;
  padding: 10px 14px;
  background: rgba(4, 8, 16, 0.50);
  border: 1px solid var(--tp-line-soft);
  border-radius: 7px;
  transition: border-color var(--tp-transition),
              background var(--tp-transition),
              transform var(--tp-transition);
}

.tp-subpanel-row:hover {
  border-color: var(--tp-line);
  background: rgba(4, 8, 16, 0.75);
  transform: translateX(2px);
}

@media (max-width: 720px) {
  .tp-subpanel-row {
    grid-template-columns: 28px minmax(0, 1fr) auto;
    grid-template-areas:
      "icon text actions"
      "icon status tickets";
    row-gap: 8px;
  }
  .tp-sub-icon     { grid-area: icon; }
  .tp-sub-text     { grid-area: text; }
  .tp-sub-actions  { grid-area: actions; }
  .tp-status-pill.sm { grid-area: status; justify-self: start; }
  .tp-sub-tickets  { grid-area: tickets; justify-self: end; }
}

.tp-sub-icon {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  background: var(--tp-purple-soft);
  color: rgb(var(--tp-purple-rgb));
  border: 1px solid var(--tp-purple-border);
}

.tp-sub-text {
  min-width: 0;
}

.tp-sub-name {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tp-sub-channel {
  font-size: 12px;
  color: var(--muted);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: 0.85;
}

.tp-sub-tickets {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
}

.tp-sub-tickets-num {
  font-size: 14px;
  font-weight: 800;
  color: var(--text);
}

.tp-sub-tickets-label {
  font-size: 10px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.8;
}

.tp-sub-actions {
  display: flex;
  align-items: center;
  gap: 6px;
}

.tp-icon-btn {
  width: 28px;
  height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.03);
  color: var(--muted);
  border: 1px solid var(--tp-line);
  border-radius: 6px;
  cursor: pointer;
  padding: 0;
  font-weight: inherit;
  box-shadow: none;
  transition: color var(--tp-transition),
              border-color var(--tp-transition),
              background var(--tp-transition),
              transform var(--tp-transition);
}

.tp-icon-btn:hover {
  color: var(--text);
  border-color: var(--tp-line-strong);
  background: rgba(255, 255, 255, 0.06);
  transform: translateY(-1px);
}

.tp-delete-sm {
  color: var(--danger);
  border-color: var(--tp-danger-border);
  background: var(--tp-danger-bg);
}

.tp-delete-sm:hover {
  color: var(--danger);
  border-color: rgba(var(--tp-danger-rgb), 0.55);
  background: rgba(var(--tp-danger-rgb), 0.18);
  box-shadow: 0 0 14px rgba(var(--tp-danger-rgb), 0.18);
}

.tp-subpanel-empty {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px;
  background: rgba(4, 8, 16, 0.50);
  border: 1px dashed var(--tp-line);
  border-radius: 7px;
  color: var(--muted);
  font-size: 13px;
}

/* =============================================================================
   Empty / no-results states
   ============================================================================= */
.tp-empty {
  text-align: center;
  padding: 64px 24px;
  background: var(--tp-card-bg);
  border: 1px dashed var(--tp-line);
  border-radius: var(--tp-radius);
  color: var(--muted);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.tp-empty-icon {
  color: var(--muted);
  margin-bottom: 12px;
  display: inline-flex;
  opacity: 0.5;
}

.tp-empty h3 {
  color: var(--text);
  font-size: 16px;
  margin: 0 0 6px;
  font-weight: 800;
}

.tp-empty p {
  font-size: 13px;
  margin: 0;
  color: var(--muted);
}

.tp-no-results {
  text-align: center;
  padding: 24px;
  color: var(--muted);
  font-size: 13px;
}

.tp-row[hidden] { display: none; }

/* =============================================================================
   Honor prefers-reduced-motion — same as the global stylesheet does
   ============================================================================= */
@media (prefers-reduced-motion: reduce) {
  body:not([data-motion="full"]) .tp-row,
  body:not([data-motion="full"]) .tp-row:nth-child(n) {
    animation: none;
  }
  body:not([data-motion="full"]) .tp-row-expanded {
    transition: none;
  }
}

/* Panel creation entry point */
.tp-create-panel {
  min-height: 86px;
  margin: 4px 0 34px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  border: 1px solid var(--tp-line-strong);
  border-radius: 8px;
  color: var(--text);
  background: rgba(13, 21, 37, 0.72);
  font-size: 19px;
  font-weight: 800;
  transition: border-color var(--tp-transition), background var(--tp-transition), transform var(--tp-transition), box-shadow var(--tp-transition);
}

.tp-create-panel svg {
  width: 27px;
  height: 27px;
  color: var(--tp-cyan);
  transition: transform 320ms cubic-bezier(.2, .8, .2, 1);
}

.tp-create-panel:hover {
  border-color: rgba(var(--tp-cyan-rgb), .72);
  background: rgba(18, 29, 49, .9);
  transform: translateY(-2px);
  box-shadow: 0 18px 48px rgba(0, 0, 0, .26), 0 0 28px rgba(var(--tp-cyan-rgb), .09);
}

.tp-create-panel:hover svg { transform: rotate(90deg); }
.tp-create-panel.is-disabled { color: var(--muted); border-color: var(--tp-line); cursor: not-allowed; opacity: .68; }
.tp-create-panel.is-disabled:hover { transform: none; box-shadow: none; }

.tp-library-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 17px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--tp-line-soft);
}

.tp-library-head h2 { margin: 0 0 3px; font-size: 20px; }
.tp-library-head p { margin: 0; font-size: 12px; }
.tp-list-page form, .tp-editor-page form { display: block; }
.tp-list-page svg, .tp-editor-page svg { width: 18px; height: 18px; }

.tp-page-switcher {
  width: fit-content;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin: 0 0 24px;
  padding: 4px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(4, 8, 16, .64);
}

.tp-page-switcher a {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
  transition: color var(--tp-transition), background var(--tp-transition), box-shadow var(--tp-transition);
}

.tp-page-switcher a:hover { color: var(--text); background: rgba(255, 255, 255, .04); }
.tp-page-switcher a.is-active { color: var(--tp-cyan); background: var(--tp-cyan-soft); box-shadow: inset 0 0 0 1px rgba(var(--tp-cyan-rgb), .2); }
.tp-editor-switcher { margin-top: 4px; }

/* Panel editor */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.tp-editor-page { min-width: 0; padding: 8px 4px 40px; }
body.motion-enabled .tp-editor-page.motion-reveal { clip-path: none; }

.tp-editor-header {
  display: grid;
  grid-template-columns: 44px minmax(150px, 1fr) minmax(210px, 290px) minmax(176px, auto);
  align-items: center;
  gap: 14px;
  padding: 12px 0 22px;
}

.tp-editor-back {
  width: 42px;
  height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--muted);
  transition: color var(--tp-transition), border-color var(--tp-transition), background var(--tp-transition), transform var(--tp-transition);
}

.tp-editor-back:hover { color: var(--text); border-color: var(--tp-line); background: rgba(255, 255, 255, .04); transform: translateX(-2px); }

.tp-editor-title {
  min-width: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  font-size: 24px;
  font-weight: 760;
}

.tp-editor-title span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-editor-title small { flex: 0 0 auto; font-family: "SFMono-Regular", Consolas, monospace; font-size: 10px; color: var(--muted); }
.tp-editor-channel { position: relative; display: block; }
.tp-editor-channel > svg { position: absolute; z-index: 1; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }

.tp-editor-channel select {
  width: 100%;
  height: 48px;
  padding: 0 36px 0 40px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(21, 29, 48, .92);
  color: var(--text);
  font: inherit;
  outline: none;
}

.tp-editor-top-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.tp-editor-top-actions .tp-editor-save { width: 176px; }
.tp-editor-top-actions .tp-editor-save-secondary {
  width: 104px;
  border-color: var(--tp-line);
  background: rgba(11, 18, 31, .78);
  color: var(--muted);
  box-shadow: none;
}
.tp-editor-top-actions .tp-editor-save-secondary:hover {
  border-color: rgba(var(--tp-cyan-rgb), .42);
  background: var(--tp-cyan-soft);
  color: var(--text);
  box-shadow: none;
}

.tp-editor-save {
  width: 100%;
  min-height: 48px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  padding: 0 16px;
  border: 1px solid rgba(var(--tp-cyan-rgb), .58);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(54, 231, 255, .27), rgba(57, 135, 235, .22));
  color: var(--text);
  font-size: 14px;
  font-weight: 800;
  white-space: nowrap;
}

.tp-editor-save:hover { box-shadow: 0 0 28px rgba(var(--tp-cyan-rgb), .18); }
.tp-editor-save:disabled { cursor: wait; opacity: .7; transform: none; }
.tp-editor-save.is-saving svg { animation: tp-send-pulse .8s ease-in-out infinite alternate; }

@keyframes tp-send-pulse { to { transform: translate(3px, -3px); opacity: .55; } }

.tp-form-errors {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 14px 16px;
  margin-bottom: 18px;
  border: 1px solid var(--tp-danger-border);
  border-radius: 8px;
  background: var(--tp-danger-bg);
  color: var(--danger);
}

.tp-form-errors > svg { flex: 0 0 auto; margin-top: 2px; }
.tp-form-errors strong { color: var(--text); font-size: 13px; }
.tp-form-errors p { margin: 4px 0 0; color: #ff9bab; font-size: 12px; line-height: 1.45; }

.tp-tabs {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow-x: auto;
  padding: 0 2px;
  border-bottom: 1px solid var(--tp-line-soft);
  scrollbar-width: thin;
}

.tp-tabs button {
  flex: 0 0 auto;
  min-width: 86px;
  height: 47px;
  padding: 0 13px;
  border: 0;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: transparent;
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 650;
}

.tp-tabs button:hover, .tp-tabs button.is-active { transform: none; background: transparent; box-shadow: none; color: var(--text); border-bottom-color: var(--tp-cyan); }
.tp-tab-panels { padding: 30px 2px 10px; }
.tp-tab-panel { animation: tp-panel-in .42s cubic-bezier(.2, .75, .2, 1) both; }
.tp-tab-panel[hidden] { display: none; }

@keyframes tp-panel-in {
  from { opacity: 0; transform: translateY(13px); }
  to { opacity: 1; transform: translateY(0); }
}

.tp-section-heading {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 28px;
  margin-bottom: 28px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--tp-line-soft);
}

.tp-section-heading h2 { margin: 3px 0 0; color: var(--text); font-size: 20px; }
.tp-section-heading p { max-width: 400px; margin: 0; font-size: 12px; text-align: right; line-height: 1.55; }
.tp-kicker { color: var(--tp-cyan); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .11em; }
.tp-section-heading-action { align-items: center; }

.tp-form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; }
.tp-field { min-width: 0; display: flex; flex-direction: column; align-items: stretch; gap: 8px; padding: 0; margin: 0; border: 0; color: var(--muted); }
.tp-field > span, .tp-field > legend, .tp-field > label, .tp-field legend { padding: 0; color: var(--text); font-size: 13px; font-weight: 760; }
.tp-field > small { margin-top: -4px; color: var(--muted); font-size: 11px; line-height: 1.45; }
.tp-field-wide { grid-column: 1 / -1; }
.tp-field[data-text-category][hidden] { display: none; }

.tp-field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
.tp-field select,
.tp-field textarea {
  width: 100%;
  min-height: 46px;
  padding: 11px 13px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  outline: none;
  background: rgba(4, 8, 16, .72);
  color: var(--text);
  font: inherit;
  font-size: 13px;
  resize: vertical;
  transition: border-color var(--tp-transition), background var(--tp-transition), box-shadow var(--tp-transition);
}

.tp-field select[multiple] { min-height: 112px; resize: none; }
.tp-field select option { background: #0c1321; color: var(--text); padding: 6px; }
.tp-field textarea { line-height: 1.55; }
.tp-field input[readonly] { color: var(--muted); cursor: default; }
.tp-field input:focus, .tp-field select:focus, .tp-field textarea:focus, .tp-editor-channel select:focus { border-color: rgba(var(--tp-cyan-rgb), .58); background: rgba(6, 13, 25, .92); box-shadow: 0 0 0 2px rgba(var(--tp-cyan-rgb), .1); }

.tp-role-picker { position: relative; }
.tp-role-control {
  min-height: 48px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 42px;
  align-items: stretch;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(4, 8, 16, .72);
}
.tp-role-picker.is-open .tp-role-control {
  border-color: rgba(var(--tp-cyan-rgb), .58);
  box-shadow: 0 0 0 2px rgba(var(--tp-cyan-rgb), .1);
}
.tp-role-chips {
  min-width: 0;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 6px;
  padding: 7px 8px;
}
.tp-role-chips > button {
  max-width: 100%;
  min-height: 30px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 7px 4px 9px;
  border: 1px solid rgba(var(--tp-cyan-rgb), .3);
  border-radius: 6px;
  background: var(--tp-cyan-soft);
  color: var(--text);
  box-shadow: none;
  font-size: 11px;
  font-weight: 700;
}
.tp-role-chips > button:hover { transform: none; border-color: rgba(var(--tp-cyan-rgb), .58); box-shadow: none; }
.tp-role-chips > button span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tp-role-chips > button svg { width: 13px; height: 13px; flex: 0 0 auto; color: var(--tp-cyan); }
.tp-role-placeholder { padding-left: 4px; color: var(--muted); font-size: 12px; }
.tp-role-placeholder[hidden] { display: none; }
.tp-role-toggle {
  width: 42px;
  min-height: 46px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-left: 1px solid var(--tp-line-soft);
  border-radius: 0 7px 7px 0;
  background: transparent;
  color: var(--muted);
  box-shadow: none;
}
.tp-role-toggle:hover { transform: none; background: var(--tp-cyan-soft); color: var(--tp-cyan); box-shadow: none; }
.tp-role-toggle svg { width: 17px; height: 17px; transition: transform var(--tp-transition); }
.tp-role-picker.is-open .tp-role-toggle svg { transform: rotate(180deg); }
.tp-role-menu {
  --tp-role-menu-max-height: 320px;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  width: 100%;
  max-height: var(--tp-role-menu-max-height);
  overflow: hidden;
  padding: 7px;
  border: 1px solid rgba(var(--tp-cyan-rgb), .36);
  border-radius: 8px;
  background: #080f1d;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .48);
}
.tp-role-picker.opens-up .tp-role-menu { top: auto; bottom: calc(100% + 6px); }
.tp-role-menu[hidden] { display: none; }
.tp-role-search { position: relative; margin-bottom: 6px; }
.tp-role-search > svg {
  position: absolute;
  z-index: 1;
  left: 10px;
  top: 50%;
  width: 15px;
  height: 15px;
  transform: translateY(-50%);
  color: var(--muted);
  pointer-events: none;
}
.tp-field .tp-role-menu .tp-role-search input[type="search"] {
  min-height: 38px;
  padding: 8px 30px 8px 32px;
  resize: none;
}
.tp-role-options {
  max-height: calc(var(--tp-role-menu-max-height) - 51px);
  overflow-y: auto;
  scrollbar-width: thin;
}
.tp-role-menu label {
  min-height: 38px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
}
.tp-role-menu [data-role-option][hidden] { display: none; }
.tp-role-menu label:hover, .tp-role-menu label:has(input:checked) { background: var(--tp-cyan-soft); }
.tp-role-menu input { width: 16px; height: 16px; flex: 0 0 auto; accent-color: var(--tp-cyan); }
.tp-role-menu span { min-width: 0; overflow-wrap: anywhere; color: var(--text); font-size: 12px; }
.tp-role-menu p { margin: 0; padding: 18px 10px; color: var(--muted); font-size: 12px; text-align: center; }

.tp-prefix-field { gap: 9px; }
.tp-prefix-list { display: flex; flex-wrap: wrap; gap: 7px; }
.tp-prefix-list button {
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border: 1px solid var(--tp-line);
  border-radius: 7px;
  background: rgba(11, 18, 31, .7);
  color: var(--text);
  box-shadow: none;
  font-size: 11px;
}
.tp-prefix-list button:hover { transform: none; border-color: rgba(var(--tp-cyan-rgb), .5); background: var(--tp-cyan-soft); box-shadow: none; }
.tp-prefix-list code { color: var(--tp-cyan); font-family: "SFMono-Regular", Consolas, monospace; font-size: 9px; }

.tp-mention-settings { padding-top: 2px; }
.tp-mention-grid { display: flex; flex-direction: column; gap: 8px; }
.tp-mention-row {
  min-height: 66px;
  display: grid;
  grid-template-columns: minmax(160px, 1fr) minmax(270px, .9fr);
  align-items: center;
  gap: 18px;
  padding: 10px 12px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(11, 18, 31, .62);
}
.tp-mention-row strong, .tp-mention-row small { display: block; }
.tp-mention-row strong { color: var(--text); font-size: 12px; }
.tp-mention-row small { margin-top: 3px; color: var(--muted); font-size: 10px; }
.tp-mention-options { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 5px; }
.tp-mention-options label { cursor: pointer; }
.tp-mention-options input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.tp-mention-options span {
  min-height: 36px;
  display: grid;
  place-items: center;
  padding: 4px 7px;
  border: 1px solid var(--tp-line);
  border-radius: 6px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 740;
}
.tp-mention-options input:checked + span { border-color: rgba(var(--tp-cyan-rgb), .5); background: var(--tp-cyan-soft); color: var(--text); }
.tp-mention-options input:focus-visible + span { outline: 2px solid var(--tp-cyan); outline-offset: 2px; }

.tp-field-inline {
  min-height: 76px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 14px 16px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(11, 18, 31, .62);
}

.tp-field-inline label { display: block; color: var(--text); font-weight: 760; }
.tp-field-inline p { margin: 3px 0 0; font-size: 11px; line-height: 1.45; }
.tp-field-inline .tp-switch { flex: 0 0 auto; display: flex; grid-template-columns: none; align-items: center; gap: 9px; cursor: pointer; }
.tp-switch input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; pointer-events: none; }
.tp-switch-track { box-sizing: border-box; flex: 0 0 auto; display: block; width: 43px; height: 24px; padding: 3px; border: 1px solid var(--tp-line); border-radius: 999px; background: rgba(255, 255, 255, .08); transition: background var(--tp-transition), border-color var(--tp-transition); }
.tp-switch-track span { display: block; width: 16px; height: 16px; border-radius: 50%; background: var(--muted); transition: transform var(--tp-transition), background var(--tp-transition), box-shadow var(--tp-transition); }
.tp-switch input:checked + .tp-switch-track { background: var(--tp-green-bg); border-color: var(--tp-green-border); }
.tp-switch input:checked + .tp-switch-track span { transform: translateX(19px); background: var(--green); box-shadow: 0 0 10px rgba(var(--tp-green-rgb), .35); }
.tp-switch input:focus-visible + .tp-switch-track { outline: 2px solid var(--tp-cyan); outline-offset: 2px; }
.tp-switch-label { min-width: 55px; color: var(--muted); font-size: 11px; font-weight: 700; }

.tp-segmented { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
.tp-segmented label { display: block; cursor: pointer; }
.tp-segmented input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; pointer-events: none; }
.tp-segmented span { height: 48px; display: flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid var(--tp-line); border-radius: 8px; background: rgba(4, 8, 16, .62); color: var(--muted); font-size: 12px; font-weight: 720; transition: color var(--tp-transition), border-color var(--tp-transition), background var(--tp-transition), box-shadow var(--tp-transition); }
.tp-segmented input:checked + span { color: var(--tp-cyan); border-color: rgba(var(--tp-cyan-rgb), .52); background: var(--tp-cyan-soft); box-shadow: inset 0 0 18px rgba(var(--tp-cyan-rgb), .05); }
.tp-segmented input:focus-visible + span { outline: 2px solid var(--tp-cyan); outline-offset: 2px; }

.tp-embed-layout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(280px, .85fr); gap: 28px; align-items: start; }
.tp-color-field > div { display: flex; align-items: center; gap: 12px; }
.tp-color-field input[type="color"] { width: 54px; height: 42px; padding: 3px; border: 1px solid var(--tp-line); border-radius: 7px; background: rgba(4, 8, 16, .76); cursor: pointer; }
.tp-color-field output { color: var(--muted); font-family: "SFMono-Regular", Consolas, monospace; font-size: 12px; }

.tp-discord-preview {
  min-width: 0;
  padding: 18px;
  border: 1px solid rgba(255, 255, 255, .09);
  border-radius: 8px;
  background: #313338;
  box-shadow: 0 20px 48px rgba(0, 0, 0, .3);
}

.tp-discord-meta { display: flex; align-items: center; gap: 7px; color: #f2f3f5; font-family: Arial, sans-serif; font-size: 12px; }
.tp-discord-meta strong { font-size: 13px; }
.tp-discord-meta > span:not(.tp-discord-avatar) { padding: 2px 4px; border-radius: 3px; background: #5865f2; font-size: 8px; }
.tp-discord-meta time { color: #949ba4; font-size: 9px; }
.tp-discord-avatar { width: 32px; height: 32px; display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; background: #1d9bb4; color: white; font-size: 14px; font-weight: 800; }

.tp-discord-embed {
  min-height: 104px;
  margin: 8px 0 9px 39px;
  padding: 12px 13px;
  border-left: 4px solid var(--preview-color, #36e7ff);
  border-radius: 4px;
  background: #2b2d31;
  color: #f2f3f5;
  font-family: Arial, sans-serif;
  overflow-wrap: anywhere;
}

.tp-discord-embed strong { display: block; font-size: 13px; line-height: 1.35; }
.tp-discord-embed p { margin: 7px 0 0; color: #dbdee1; font-size: 11px; line-height: 1.5; white-space: pre-wrap; }
.tp-discord-button { min-height: 34px; margin-left: 39px; padding: 0 12px; border: 0; border-radius: 4px; background: #5865f2; color: white; box-shadow: none; font-family: Arial, sans-serif; font-size: 11px; }
.tp-discord-button:disabled { opacity: 1; cursor: default; }
.tp-discord-button:hover { transform: none; border: 0; box-shadow: none; }
.tp-discord-button.blurple, .tp-discord-button.blurple:hover { background: #5865f2; }
.tp-discord-button.gray, .tp-discord-button.gray:hover { background: #4e5058; }
.tp-discord-button.green, .tp-discord-button.green:hover { background: #248046; }
.tp-discord-button.red, .tp-discord-button.red:hover { background: #da373c; }

.tp-question-list { display: flex; flex-direction: column; gap: 14px; }
.tp-question { padding: 16px; border: 1px solid var(--tp-line); border-radius: 8px; background: rgba(11, 18, 31, .68); }
.tp-question-head { min-height: 32px; display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 14px; padding-bottom: 11px; border-bottom: 1px solid var(--tp-line-soft); color: var(--text); font-size: 12px; font-weight: 740; }
.tp-question-head b { color: var(--tp-cyan); }
.tp-question-head button { width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--tp-danger-border); border-radius: 7px; background: var(--tp-danger-bg); color: var(--danger); box-shadow: none; }
.tp-question-head button:hover { background: rgba(var(--tp-danger-rgb), .18); border-color: rgba(var(--tp-danger-rgb), .5); box-shadow: none; }
.tp-question-empty { min-height: 180px; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px; border: 1px dashed var(--tp-line); border-radius: 8px; color: var(--muted); }
.tp-question-empty[hidden] { display: none; }
.tp-question-choices[hidden] { display: none; }
.tp-question-empty svg { width: 28px; height: 28px; opacity: .5; }
.tp-question-empty p { margin: 0; font-size: 12px; text-align: center; }

.tp-auto-close-settings { min-width: 0; margin: 22px 0 0; padding: 0; border: 0; }
.tp-auto-close-settings[disabled] { opacity: .55; }
.tp-auto-close-list { display: flex; flex-direction: column; gap: 14px; margin-top: 20px; }
.tp-auto-close-step { padding: 16px; border: 1px solid var(--tp-line); border-radius: 8px; background: rgba(11, 18, 31, .68); }
.tp-auto-close-step.is-close-step { border-color: rgba(var(--tp-cyan-rgb), .34); }
.tp-auto-close-step .tp-question-head { margin-bottom: 16px; }
.tp-auto-close-step textarea { resize: vertical; }
.tp-auto-close-add-row { display: flex; justify-content: flex-end; margin-top: 14px; }
.tp-auto-close-settings .tp-question-empty { margin-top: 20px; }
.tp-section-heading-action { align-items: center; }
.tp-section-heading-action .tp-btn { flex: 0 0 auto; }
.tp-choice-list { display: flex; flex-direction: column; gap: 8px; }
.tp-choice-row { display: grid; grid-template-columns: 26px minmax(0, 1fr) 36px; align-items: center; gap: 8px; }
.tp-choice-row > span { width: 24px; height: 24px; display: grid; place-items: center; border: 1px solid var(--tp-line); border-radius: 50%; color: var(--muted); font-size: 10px; font-weight: 750; }
.tp-choice-row > input { min-width: 0; }
.tp-choice-row > button { width: 36px; height: 36px; display: inline-flex; align-items: center; justify-content: center; padding: 0; border: 1px solid var(--tp-danger-border); border-radius: 7px; background: var(--tp-danger-bg); color: var(--danger); box-shadow: none; }
.tp-choice-row > button:hover { transform: none; border-color: rgba(var(--tp-danger-rgb), .5); background: rgba(var(--tp-danger-rgb), .18); box-shadow: none; }
.tp-choice-row > button:disabled { opacity: .35; cursor: not-allowed; }
.tp-choice-row > button svg, .tp-add-choice svg { width: 15px; height: 15px; }
.tp-add-choice { align-self: flex-start; min-height: 36px; display: inline-flex; align-items: center; gap: 7px; padding: 0 12px; border: 1px solid rgba(var(--tp-cyan-rgb), .38); border-radius: 7px; background: var(--tp-cyan-soft); color: var(--tp-cyan); box-shadow: none; font-size: 11px; font-weight: 750; }
.tp-add-choice:hover { transform: none; border-color: rgba(var(--tp-cyan-rgb), .62); background: rgba(var(--tp-cyan-rgb), .13); box-shadow: none; }

.tp-check-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
.tp-check-grid label { min-height: 48px; display: flex; align-items: center; gap: 9px; padding: 0 13px; border: 1px solid var(--tp-line); border-radius: 8px; background: rgba(4, 8, 16, .62); cursor: pointer; }
.tp-check-grid input { width: 16px; height: 16px; accent-color: var(--tp-cyan); }
.tp-check-grid span { color: var(--muted); font-size: 12px; }
.tp-check-grid label:has(input:checked) { border-color: rgba(var(--tp-cyan-rgb), .45); background: var(--tp-cyan-soft); }
.tp-check-grid input:checked + span { color: var(--text); }

.tp-color-options { display: flex; flex-wrap: wrap; gap: 9px; }
.tp-color-options label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
.tp-color-options input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; pointer-events: none; }
.tp-color-options label > span { width: 31px; height: 31px; border: 2px solid transparent; border-radius: 7px; box-shadow: inset 0 0 0 4px rgba(4, 8, 16, .82); }
.tp-color-options span.blurple { background: #5865f2; }
.tp-color-options span.gray { background: #6d6f78; }
.tp-color-options span.green { background: #2d9d62; }
.tp-color-options span.red { background: #d83c4b; }
.tp-color-options b { color: var(--muted); font-size: 10px; font-weight: 650; }
.tp-color-options input:checked + span { border-color: var(--text); box-shadow: inset 0 0 0 4px rgba(4, 8, 16, .82), 0 0 12px rgba(255, 255, 255, .16); }
.tp-color-options input:focus-visible + span { outline: 2px solid var(--tp-cyan); outline-offset: 2px; }
.tp-unsaved-bar {
  position: fixed;
  z-index: 1100;
  left: calc(50% + 134px);
  bottom: 20px;
  width: min(720px, calc(100vw - 320px));
  min-height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 12px 10px 16px;
  border: 1px solid rgba(255, 255, 255, .12);
  border-radius: 8px;
  background: #11151d;
  box-shadow: 0 18px 46px rgba(0, 0, 0, .52);
  transform: translateX(-50%);
  animation: tp-unsaved-in .2s ease-out both;
}
.tp-unsaved-bar[hidden] { display: none; }
.tp-editor-page.has-unsaved-changes { padding-bottom: 112px; }
.tp-unsaved-message, .tp-unsaved-actions { display: flex; align-items: center; }
.tp-unsaved-message { min-width: 0; gap: 9px; color: var(--text); }
.tp-unsaved-message svg { width: 18px; height: 18px; flex: 0 0 auto; color: #f0b232; }
.tp-unsaved-message strong { overflow-wrap: anywhere; font-size: 13px; }
.tp-unsaved-actions { flex: 0 0 auto; gap: 8px; }
.tp-unsaved-bar .tp-editor-save {
  width: 156px;
  min-height: 42px;
  background: #248046;
  border-color: #2d9d62;
  box-shadow: none;
}
.tp-unsaved-bar .tp-editor-save:hover { background: #1f713d; border-color: #38ad6e; box-shadow: none; }
.tp-editor-reset {
  min-width: 72px;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--text);
  box-shadow: none;
  font-size: 12px;
  font-weight: 760;
}
.tp-editor-reset:hover { transform: none; background: rgba(255, 255, 255, .08); color: var(--text); box-shadow: none; }

@keyframes tp-unsaved-in {
  from { opacity: 0; transform: translate(-50%, 12px); }
  to { opacity: 1; transform: translate(-50%, 0); }
}

.tp-multi-editor-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(280px, .9fr);
  gap: 28px;
  align-items: start;
  margin-bottom: 40px;
}

.tp-multi-buttons-heading { margin-top: 10px; }
.tp-multi-button-list { display: flex; flex-direction: column; gap: 12px; }
.tp-multi-button-row {
  display: grid;
  grid-template-columns: 28px minmax(190px, 1.15fr) minmax(160px, 1fr) 112px 38px;
  align-items: end;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--tp-line);
  border-radius: 8px;
  background: rgba(11, 18, 31, .68);
}

.tp-multi-drag { height: 46px; display: inline-flex; align-items: center; justify-content: center; color: var(--muted); opacity: .55; }
.tp-multi-color { min-width: 0; }
.tp-multi-button-row > .tp-delete { margin-bottom: 4px; }
.tp-multi-preview-buttons { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0 39px; }
.tp-multi-preview-button { min-height: 32px; display: inline-flex; align-items: center; padding: 0 11px; border-radius: 4px; color: white; font-family: Arial, sans-serif; font-size: 11px; font-weight: 650; overflow-wrap: anywhere; }
.tp-multi-preview-button.blurple { background: #5865f2; }
.tp-multi-preview-button.gray { background: #4e5058; }
.tp-multi-preview-button.green { background: #248046; }
.tp-multi-preview-button.red { background: #da373c; }

/* Light theme overrides for ticket-panel surfaces. Discord previews stay dark
   so they continue to match Discord's real message appearance. */
html[data-theme="light"] {
  --tp-card-bg: rgba(255, 255, 255, 0.9);
  --tp-card-bg-hover: rgba(248, 252, 255, 0.98);
  --tp-elevated: rgba(255, 255, 255, 0.98);
  --tp-line: rgba(20, 86, 112, 0.22);
  --tp-line-strong: rgba(20, 86, 112, 0.4);
  --tp-line-soft: rgba(20, 86, 112, 0.11);
  --tp-cyan: #087f9c;
  --tp-cyan-rgb: 8, 127, 156;
  --tp-cyan-soft: rgba(8, 127, 156, 0.1);
  --tp-cyan-softer: rgba(8, 127, 156, 0.055);
  --tp-green-rgb: 8, 122, 85;
  --tp-green-bg: rgba(8, 122, 85, 0.1);
  --tp-green-border: rgba(8, 122, 85, 0.3);
  --tp-danger-rgb: 199, 53, 83;
  --tp-danger-bg: rgba(199, 53, 83, 0.09);
  --tp-danger-border: rgba(199, 53, 83, 0.28);
  --tp-purple-rgb: 114, 72, 180;
  --tp-purple-soft: rgba(114, 72, 180, 0.09);
  --tp-purple-border: rgba(114, 72, 180, 0.24);
  --tp-shadow: 0 16px 46px rgba(50, 74, 96, 0.12), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

html[data-theme="light"] .tp-search-input,
html[data-theme="light"] .tp-editor-channel select,
html[data-theme="light"] .tp-field input:not([type="checkbox"]):not([type="radio"]):not([type="color"]),
html[data-theme="light"] .tp-field select,
html[data-theme="light"] .tp-field textarea,
html[data-theme="light"] .tp-role-control,
html[data-theme="light"] .tp-role-menu,
html[data-theme="light"] .tp-prefix-list button,
html[data-theme="light"] .tp-mention-row,
html[data-theme="light"] .tp-field-inline,
html[data-theme="light"] .tp-segmented span,
html[data-theme="light"] .tp-color-field input[type="color"],
html[data-theme="light"] .tp-question,
html[data-theme="light"] .tp-auto-close-step,
html[data-theme="light"] .tp-check-grid label,
html[data-theme="light"] .tp-multi-button-row,
html[data-theme="light"] .tp-subpanel-row {
  background: rgba(255, 255, 255, 0.9);
  color: var(--text);
}

html[data-theme="light"] .tp-search-input:focus,
html[data-theme="light"] .tp-field input:focus,
html[data-theme="light"] .tp-field select:focus,
html[data-theme="light"] .tp-field textarea:focus,
html[data-theme="light"] .tp-editor-channel select:focus {
  background: #ffffff;
}

html[data-theme="light"] .tp-field select option {
  background: #ffffff;
  color: var(--text);
}

html[data-theme="light"] .tp-editor-top-actions .tp-editor-save-secondary,
html[data-theme="light"] .tp-btn-ghost,
html[data-theme="light"] .tp-subpanel-count,
html[data-theme="light"] .tp-page-switcher a:hover,
html[data-theme="light"] .tp-editor-back:hover {
  background: rgba(23, 32, 51, 0.05);
}

html[data-theme="light"] .tp-unsaved-bar {
  background: #ffffff;
  border-color: var(--tp-line);
  box-shadow: 0 18px 46px rgba(50, 74, 96, 0.22);
}

@media (max-width: 980px) {
  .tp-editor-header { grid-template-columns: 44px minmax(0, 1fr) minmax(190px, 230px); }
  .tp-editor-top-actions { grid-column: 2 / -1; justify-self: end; }
  .tp-embed-layout { grid-template-columns: 1fr; }
  .tp-discord-preview { max-width: 520px; }
  .tp-multi-editor-layout { grid-template-columns: 1fr; }
  .tp-multi-button-row { grid-template-columns: 24px minmax(180px, 1.2fr) minmax(150px, 1fr) 100px 38px; }
}

@media (max-width: 720px) {
  .tp-list-page { padding: 16px 2px 32px; }
  .tp-header { align-items: center; }
  .tp-create-panel { min-height: 72px; margin-bottom: 28px; padding: 0 18px; font-size: 16px; }
  .tp-page-switcher { width: 100%; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .tp-page-switcher a { padding: 0 8px; }
  .tp-editor-page { padding-top: 0; }
  .tp-editor-header { grid-template-columns: 40px minmax(0, 1fr); gap: 9px; }
  .tp-editor-title { font-size: 19px; }
  .tp-editor-title small { display: none; }
  .tp-editor-channel { grid-column: 1 / -1; }
  .tp-editor-header > .tp-editor-top-actions { display: none; }
  .tp-tabs { margin: 0 -2px; }
  .tp-tabs button { min-width: 80px; padding: 0 10px; }
  .tp-tab-panels { padding-top: 24px; }
  .tp-section-heading { display: block; }
  .tp-section-heading p { margin-top: 8px; text-align: left; }
  .tp-section-heading-action { display: flex; align-items: center; }
  .tp-section-heading-action p { margin: 0; }
  .tp-form-grid { grid-template-columns: 1fr; }
  .tp-field-wide { grid-column: auto; }
  .tp-field-inline { align-items: flex-start; }
  .tp-role-menu { position: static; max-height: none; margin-top: 6px; }
  .tp-role-options { max-height: 220px; }
  .tp-mention-row { grid-template-columns: 1fr; gap: 10px; }
  .tp-check-grid { grid-template-columns: 1fr; }
  .tp-segmented span { padding: 0 8px; text-align: center; }
  .tp-discord-preview { padding: 14px; }
  .tp-discord-embed, .tp-discord-button { margin-left: 0; }
  .tp-multi-button-row { grid-template-columns: minmax(0, 1fr) 38px; align-items: end; }
  .tp-multi-button-row .tp-field { grid-column: 1 / -1; }
  .tp-multi-button-row > .tp-delete { grid-column: 2; grid-row: 1; }
  .tp-multi-drag { grid-column: 1; grid-row: 1; justify-content: flex-start; height: 34px; }
  .tp-multi-preview-buttons { margin-left: 0; }
  .shell:has(.tp-list-page) ~ .user-profile-card,
  .shell:has(.tp-editor-page) ~ .user-profile-card {
    position: relative;
    left: auto;
    bottom: auto;
    width: min(210px, calc(100% - 32px));
    margin: 0 16px 24px;
  }
}

@media (max-width: 820px) {
  .tp-unsaved-bar {
    left: 50%;
    bottom: 12px;
    width: min(720px, calc(100vw - 24px));
  }
  body:has(.tp-unsaved-bar:not([hidden])) .user-profile-card {
    opacity: 0;
    pointer-events: none;
  }
}

@media (max-width: 560px) {
  .tp-unsaved-bar { align-items: stretch; gap: 10px; padding: 12px; }
  .tp-unsaved-message { flex: 1 1 auto; }
  .tp-unsaved-message strong { font-size: 11px; }
  .tp-unsaved-actions { gap: 4px; }
  .tp-unsaved-bar .tp-editor-save { width: 126px; padding-inline: 8px; }
  .tp-editor-reset { min-width: 56px; padding-inline: 7px; }
}

@media (prefers-reduced-motion: reduce) {
  body:not([data-motion="full"]) .tp-tab-panel,
  body:not([data-motion="full"]) .tp-editor-save.is-saving svg { animation: none; }
  body:not([data-motion="full"]) .tp-create-panel svg { transition: none; }
}
