/* ============================================================================
   panel.css — the thin sub-app layer for panel.tihe.ir.
   Loads AFTER assets/hub.css and consumes its tokens only. Per the design
   system rules this file must never touch :root — no token is redefined here,
   so per-user themes and dark mode keep working for free.
   ========================================================================= */

/* ─── Sub-app page header (design system §7, rule 9) ─────────────────── */

.sl-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.15rem;
  flex-wrap: wrap;
  padding: 0.9rem 1.35rem;
  border-radius: var(--radius-xl);
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  position: relative;
  overflow: hidden;
}

.sl-header::before {
  content: "";
  position: absolute;
  inset-inline: 0;
  top: 0;
  height: 1px;
  background: linear-gradient(90deg,
    transparent 0%,
    rgba(var(--surface-rgb), 0.9) 30%,
    rgba(var(--primary-rgb), 0.5) 55%,
    rgba(var(--surface-rgb), 0.9) 80%,
    transparent 100%);
}

.sl-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
  min-width: 0;
}

.sl-breadcrumb a {
  color: var(--text-muted);
  text-decoration: none;
  font-weight: 700;
  padding: 0.3rem 0.6rem;
  border-radius: 999px;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.sl-breadcrumb a:hover {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.08);
}

.sl-breadcrumb a:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

/* Back arrows are mirrored, never swapped for a different glyph. */
.sl-breadcrumb svg {
  width: 15px;
  height: 15px;
  transform: scaleX(-1);
  flex: none;
}

.sl-breadcrumb__sep {
  color: var(--text-faint);
}

.sl-breadcrumb__here {
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sl-header__actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

/* hub.css paints .hero h2 with an --accent gradient, and --accent stays dark
   navy in dark mode — the title all but disappears. Sub-app pages relight it. */
[data-mode="dark"] .hero h2 {
  background: linear-gradient(135deg, var(--text) 0%, var(--primary-lite) 100%);
  -webkit-background-clip: text;
  background-clip: text;
}

/* ─── Page title block ───────────────────────────────────────────────── */

.p-title {
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  animation-delay: 0.06s;
}

.p-title h1 {
  margin: 0;
  font-size: clamp(1.1rem, 2.2vw, 1.45rem);
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}

.p-title p {
  margin: 0.4rem 0 0;
  font-size: 0.97rem;
  line-height: 1.85;
  color: var(--text-muted);
  max-width: 55ch;
}

/* ─── Cards ──────────────────────────────────────────────────────────── */

.p-card {
  border-radius: var(--radius-xl);
  padding: 1.25rem 1.35rem;
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.p-card__head {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
  margin-bottom: 1.15rem;
}

.p-card__head h2 {
  margin: 0;
  flex: 1;
  min-width: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
}

.p-card__head p {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: var(--text-faint);
  font-weight: 400;
}

.p-grid {
  display: grid;
  gap: 1.15rem;
}

.p-grid--2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.p-grid--3 { grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); }
.p-grid--4 { grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }

/* ─── Tone icon tiles (§2 — the only saturated surfaces) ─────────────── */

.p-tile {
  width: 49px;
  height: 49px;
  border-radius: var(--radius-md);
  display: grid;
  place-items: center;
  flex: none;
  color: #fff;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast);
}

.p-tile svg {
  width: 33px;
  height: 33px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
}

.p-tile--sm { width: 38px; height: 38px; border-radius: 12px; }
.p-tile--sm svg { width: 22px; height: 22px; }

.p-tile--coral {
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.32), 0 2px 6px rgba(var(--primary-rgb), 0.20);
}
.p-tile--violet {
  background: linear-gradient(140deg, var(--violet-lite), var(--violet));
  box-shadow: 0 8px 24px rgba(var(--violet-rgb), 0.32), 0 2px 6px rgba(var(--violet-rgb), 0.20);
}
.p-tile--navy {
  background: linear-gradient(140deg, var(--accent-lite), var(--accent));
  box-shadow: 0 8px 24px rgba(var(--accent-rgb), 0.32), 0 2px 6px rgba(var(--accent-rgb), 0.20);
}
.p-tile--teal {
  background: linear-gradient(140deg, #2dd4bf, #0d9488);
  box-shadow: 0 8px 24px rgba(13, 148, 136, 0.32), 0 2px 6px rgba(13, 148, 136, 0.20);
}
.p-tile--green {
  background: linear-gradient(140deg, #4ade80, #16a34a);
  box-shadow: 0 8px 24px rgba(22, 163, 74, 0.32), 0 2px 6px rgba(22, 163, 74, 0.20);
}
.p-tile--amber {
  background: linear-gradient(140deg, #fbbf24, #d97706);
  box-shadow: 0 8px 24px rgba(217, 119, 6, 0.32), 0 2px 6px rgba(217, 119, 6, 0.20);
}
.p-tile--indigo {
  background: linear-gradient(140deg, #818cf8, #4f46e5);
  box-shadow: 0 8px 24px rgba(79, 70, 229, 0.32), 0 2px 6px rgba(79, 70, 229, 0.20);
}

/* ─── Stat tiles ─────────────────────────────────────────────────────── */

.p-stat {
  border-radius: var(--radius-xl);
  padding: 1.15rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.9rem;
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.p-stat__text { min-width: 0; }

.p-stat__value {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
  line-height: 1.2;
  font-variant-numeric: tabular-nums;
}

.p-stat__label {
  display: block;
  margin-top: 0.2rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

/* ─── Badges (§7 — always a tinted trio) ─────────────────────────────── */

.p-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  white-space: nowrap;
}

.p-badge--paid {
  color: #16a34a;
  background: rgba(22, 163, 74, 0.12);
  border: 1px solid rgba(22, 163, 74, 0.20);
}
.p-badge--pending {
  color: #d97706;
  background: rgba(217, 119, 6, 0.12);
  border: 1px solid rgba(217, 119, 6, 0.20);
}
.p-badge--failed {
  color: #dc2626;
  background: rgba(220, 38, 38, 0.12);
  border: 1px solid rgba(220, 38, 38, 0.20);
}
.p-badge--new {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.12);
  border: 1px solid rgba(var(--primary-rgb), 0.20);
}
.p-badge--idle {
  color: #64748b;
  background: rgba(100, 116, 139, 0.12);
  border: 1px solid rgba(100, 116, 139, 0.20);
}

/* ─── Buttons — exactly one filled coral per view (rule 7) ───────────── */

.p-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  border: 0;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  text-decoration: none;
  transition: transform var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.p-btn svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
}

.p-btn--primary {
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
  color: #fff;
  box-shadow: 0 8px 24px rgba(var(--primary-rgb), 0.32), 0 2px 6px rgba(var(--primary-rgb), 0.20);
}
.p-btn--primary:hover { transform: translateY(-1px); box-shadow: 0 12px 30px rgba(var(--primary-rgb), 0.38); }
.p-btn--primary:active { transform: scale(0.98); }
.p-btn--primary:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.p-btn--ghost {
  background: rgba(var(--accent-rgb), 0.07);
  color: var(--text);
}
.p-btn--ghost:hover { background: rgba(var(--accent-rgb), 0.11); transform: translateY(-1px); }
.p-btn--ghost:active { transform: scale(0.98); }
.p-btn--ghost:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.p-btn--sm { padding: 0.45rem 0.8rem; font-size: 0.78rem; }

/* Follows the hub (.submit-btn:disabled): dimmed, still legible, no hover lift. */
.p-btn:disabled {
  cursor: default;
  opacity: 0.45;
  transform: none;
  box-shadow: none;
}
.p-btn:disabled:hover { transform: none; }
.p-btn--ghost:disabled:hover { background: rgba(var(--accent-rgb), 0.07); }

.p-iconbtn {
  width: 34px;
  height: 34px;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.70);
  color: var(--text-muted);
  display: grid;
  place-items: center;
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.p-iconbtn svg {
  width: 17px; height: 17px;
  stroke: currentColor; stroke-width: 2;
  stroke-linecap: round; stroke-linejoin: round; fill: none;
}

.p-iconbtn:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), 0.40); transform: translateY(-1px); }
.p-iconbtn:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── Inputs ─────────────────────────────────────────────────────────── */

.p-field {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  min-width: 0;
}

.p-field > label {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
}

.p-input,
.p-select,
.p-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 0.7rem 0.9rem;
  border-radius: var(--radius-sm);
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.70);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.p-textarea { resize: vertical; min-height: 4.5rem; line-height: 1.7; }

.p-input::placeholder,
.p-textarea::placeholder { color: var(--text-faint); }

.p-input:focus,
.p-select:focus,
.p-textarea:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.40);
  background: rgba(var(--surface-rgb), 0.82);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}

.p-hint { font-size: 0.78rem; color: var(--text-faint); }

/* Search — pill, with its own blur and a positioned magnifier. */
.p-search {
  position: relative;
  flex: 1;
  min-width: 190px;
}

.p-search input {
  width: 100%;
  font-family: inherit;
  font-size: 0.9rem;
  color: var(--text);
  padding: 0.7rem 2.6rem 0.7rem 1rem;
  border-radius: 999px;
  border: 1.5px solid rgba(var(--surface-rgb), 0.85);
  background: rgba(var(--surface-rgb), 0.65);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast), background var(--transition-fast);
}

.p-search input::placeholder { color: var(--text-faint); }

.p-search input:focus {
  outline: none;
  border-color: rgba(var(--primary-rgb), 0.40);
  background: rgba(var(--surface-rgb), 0.82);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.10);
}

.p-search svg {
  position: absolute;
  inset-inline-start: auto;
  inset-inline-end: 1rem;
  top: 50%;
  transform: translateY(-50%);
  width: 17px;
  height: 17px;
  stroke: var(--text-faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  pointer-events: none;
  transition: stroke var(--transition-fast);
}

.p-search:focus-within svg { stroke: var(--primary); }

.p-toolbar {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  flex-wrap: wrap;
}

/* ─── Tabs ───────────────────────────────────────────────────────────── */

.p-tabs {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.p-tab {
  padding: 0.5rem 0.95rem;
  border-radius: 999px;
  border: 0;
  background: transparent;
  font-family: inherit;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  text-decoration: none;
  transition: color var(--transition-fast), background var(--transition-fast);
}

.p-tab:hover { color: var(--text); background: rgba(var(--accent-rgb), 0.06); }
.p-tab:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.p-tab[aria-selected="true"] {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.10);
}

/* ─── Tables ─────────────────────────────────────────────────────────── */

/* Wide content scrolls inside its own container — the page never scrolls
   horizontally. */
.p-tablewrap {
  overflow-x: auto;
  margin-inline: -0.35rem;
  padding-inline: 0.35rem;
}

.p-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  white-space: nowrap;
}

.p-table th {
  text-align: start;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  padding: 0 0.75rem 0.6rem;
  border-bottom: 1.5px solid rgba(var(--accent-rgb), 0.10);
}

.p-table td {
  padding: 0.75rem;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(var(--accent-rgb), 0.06);
}

.p-table tbody tr {
  transition: background var(--transition-fast);
}

.p-table tbody tr:hover { background: rgba(var(--accent-rgb), 0.035); }
.p-table tbody tr:last-child td { border-bottom: 0; }

.p-table .p-strong { color: var(--text); font-weight: 700; }
.p-num { font-variant-numeric: tabular-nums; }
.ltr { direction: ltr; text-align: start; unicode-bidi: isolate; }

/* ─── Preview ribbon (only on /{panel}/preview) ──────────────────────── */

.p-previewbar {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 1.15rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #fff;
  background: linear-gradient(140deg, var(--accent-lite), var(--accent));
  text-align: center;
}

.p-previewbar span { opacity: 0.82; font-weight: 400; letter-spacing: 0; }

.p-previewbar a {
  color: #fff;
  text-decoration: underline;
  text-underline-offset: 3px;
}

.p-previewbar a:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ─── Empty / loading states ─────────────────────────────────────────── */

.p-empty {
  padding: 2.5rem 1.15rem;
  text-align: center;
  color: var(--text-faint);
  font-size: 0.85rem;
}

/* ─── Launcher cards (the panel.tihe.ir landing) ─────────────────────── */

.p-apps {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 1.15rem;
}

.p-app {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  padding: 1.35rem;
  border-radius: var(--radius-xl);
  text-decoration: none;
  overflow: hidden;
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
  transition: transform var(--transition-card), box-shadow var(--transition-card);
}

/* Tone glow, revealed on hover. */
.p-app::after {
  content: "";
  position: absolute;
  inset: 0;
  opacity: 0;
  pointer-events: none;
  background: radial-gradient(ellipse 70% 60% at 50% 0%, var(--p-app-glow, transparent), transparent 70%);
  transition: opacity var(--transition-card);
}

.p-app:hover {
  transform: translateY(-4px);
  box-shadow:
    0 2px 4px rgba(var(--accent-rgb), 0.04),
    0 14px 34px var(--glass-shadow-deep),
    0 40px 72px rgba(var(--accent-rgb), 0.08),
    inset 0 1px 0 rgba(var(--surface-rgb), 0.85);
}

.p-app:hover::after { opacity: 0.45; }
.p-app:hover .p-tile { transform: scale(1.08); }
.p-app:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }

.p-app__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.7rem;
  position: relative;
}

.p-app__title {
  margin: 0;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.35;
  color: var(--accent);
  position: relative;
}

.p-app__desc {
  margin: 0.35rem 0 0;
  font-size: 0.85rem;
  line-height: 1.7;
  color: var(--text-muted);
  position: relative;
}

.p-app__foot {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.78rem;
  color: var(--text-faint);
  position: relative;
}

.p-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--success);
  flex: none;
}

.p-app__path {
  font-size: 0.78rem;
  color: var(--text-faint);
  direction: ltr;
  unicode-bidi: isolate;
}

/* Card copy uses --accent as a FOREGROUND, so it has to be remapped in dark
   mode or it goes dark-on-dark. */
html[data-mode="dark"] .p-app__title { color: var(--text); }

/* ─── Chat shell (webinar panel) ─────────────────────────────────────── */

.p-chat {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 1.15rem;
  align-items: start;
}

.p-thread {
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  max-height: 380px;
  overflow-y: auto;
  padding-inline-end: 0.35rem;
}

.p-msg {
  display: flex;
  gap: 0.7rem;
  align-items: flex-start;
}

.p-msg__avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--violet-lite), var(--violet));
}

.p-msg__body { min-width: 0; }

.p-msg__meta {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  font-size: 0.78rem;
  margin-bottom: 0.2rem;
}

.p-msg__name { font-weight: 700; color: var(--text); }
.p-msg__time { color: var(--text-faint); font-variant-numeric: tabular-nums; }

.p-msg__text {
  margin: 0;
  font-size: 0.9rem;
  line-height: 1.75;
  color: var(--text-muted);
  padding: 0.6rem 0.85rem;
  border-radius: var(--radius-md);
  border-start-start-radius: 6px;
  background: rgba(var(--accent-rgb), 0.05);
}

.p-msg--own .p-msg__avatar { background: linear-gradient(140deg, var(--primary-lite), var(--primary)); }
.p-msg--own .p-msg__text { background: rgba(var(--primary-rgb), 0.09); }

.p-composer {
  display: flex;
  align-items: flex-end;
  gap: 0.5rem;
  margin-top: 1.15rem;
  padding-top: 1.15rem;
  border-top: 1.5px solid rgba(var(--accent-rgb), 0.08);
}

.p-chips {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-bottom: 0.7rem;
}

.p-chip {
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.10);
  background: rgba(var(--surface-rgb), 0.55);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast), transform var(--transition-fast);
}

.p-chip:hover { color: var(--primary); border-color: rgba(var(--primary-rgb), 0.35); transform: translateY(-1px); }
.p-chip:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.p-people {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  max-height: 420px;
  overflow-y: auto;
}

.p-person {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.5rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: background var(--transition-fast);
}

.p-person:hover { background: rgba(var(--accent-rgb), 0.05); }

.p-person__name {
  flex: 1;
  min-width: 0;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.p-avatar-sm {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 0.70rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(140deg, var(--accent-lite), var(--accent));
}

/* ─── Drop zone (speech panel) ───────────────────────────────────────── */

.p-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.7rem;
  padding: 2.75rem 1.35rem;
  border-radius: var(--radius-xl);
  border: 1.5px dashed rgba(var(--primary-rgb), 0.30);
  background: rgba(var(--primary-rgb), 0.04);
  text-align: center;
  cursor: pointer;
  transition: border-color var(--transition-fast), background var(--transition-fast), transform var(--transition-fast);
}

.p-drop:hover {
  border-color: rgba(var(--primary-rgb), 0.55);
  background: rgba(var(--primary-rgb), 0.07);
  transform: translateY(-2px);
}

.p-drop:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

.p-drop__title { margin: 0; font-size: 0.97rem; font-weight: 700; color: var(--text); }
.p-drop__hint { margin: 0; font-size: 0.85rem; color: var(--text-faint); }

.p-divider {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: var(--text-faint);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
}

.p-divider::before,
.p-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: rgba(var(--accent-rgb), 0.10);
}

/* Progress */
.p-progress {
  height: 7px;
  border-radius: 999px;
  background: rgba(var(--accent-rgb), 0.08);
  overflow: hidden;
}

.p-progress__bar {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(140deg, var(--primary-lite), var(--primary));
}

/* Inline progress block — for a bar that lives inside a card (under the
   output it belongs to) rather than in a card of its own. */
.p-progressbox {
  margin-top: 1.15rem;
  padding: 0.9rem 1rem 1rem;
  border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), 0.04);
  border: 1px solid rgba(var(--accent-rgb), 0.08);
  animation: rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.p-progressbox__title {
  margin: 0;
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--text);
}

/* ─── Layout helpers ─────────────────────────────────────────────────── */

/* A column of cards inside a p-grid cell, on the grid's own rhythm. */
.p-stack {
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
  min-width: 0;
}

/* The chosen file / link, shown under the picker it was chosen from. */
.p-selected {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  margin-top: 0.9rem;
  padding: 0.7rem 0.8rem;
  border-radius: var(--radius-md);
  border: 1.5px solid rgba(var(--primary-rgb), 0.22);
  background: rgba(var(--primary-rgb), 0.05);
}

.p-selected__name {
  margin: 0;
  font-weight: 700;
  font-size: 0.87rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Work layout: a narrow column of controls beside a wide result panel. The
   result is the bigger half — it is what the page is for. */
.p-grid--work {
  grid-template-columns: minmax(320px, 5fr) minmax(0, 7fr);
}

@media (max-width: 900px) {
  .p-grid--work { grid-template-columns: minmax(0, 1fr); }
}

/* Result panels keep their height whether or not there is text in them yet, so
   the page does not jump when the transcript lands. */
.p-note--tall { min-height: 300px; max-height: 460px; }

/* Only on wide screens: stacked columns must not fight the page scroll. */
@media (min-width: 901px) {
  .p-sticky { position: sticky; top: 1.5rem; }
}

/* The hub's empty state, sized to hold an output panel's place. */
.empty-state--tall {
  min-height: 300px;
  justify-content: center;
  border-radius: var(--radius-md);
  border: 1.5px dashed rgba(var(--accent-rgb), 0.14);
  background: rgba(var(--surface-rgb), 0.35);
  padding: 2rem 1.5rem;
}

.empty-state--tall .empty-state__desc { line-height: 1.9; }

/* Footer strip of an output card: export actions on one side, meta on the other. */
.p-outfoot {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 1.15rem;
  padding-top: 1.05rem;
  border-top: 1.5px solid rgba(var(--accent-rgb), 0.08);
}

/* ─── Transcript / note surfaces ─────────────────────────────────────── */

.p-note {
  font-size: 0.9rem;
  line-height: 1.95;
  color: var(--text-muted);
  padding: 1rem 1.15rem;
  border-radius: var(--radius-md);
  background: rgba(var(--accent-rgb), 0.04);
  max-height: 260px;
  overflow-y: auto;
}

.p-note p { margin: 0 0 0.9rem; }
.p-note p:last-child { margin-bottom: 0; }

/* ─── Responsive — a different layout, not a squeezed one ────────────── */

@media (max-width: 768px) {
  .p-chat { grid-template-columns: minmax(0, 1fr); }
  .p-people { max-height: 240px; }
  .sl-header { padding: 0.8rem 1rem; }
  .p-card { padding: 1.15rem 1rem; }
  .p-stat__value { font-size: 1.3rem; }
}

/* ─── Cost kill-switch (rule 4) ──────────────────────────────────────── */

[data-perf="on"] .p-search input {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  background: rgba(var(--surface-rgb), 0.90);
}

[data-perf="on"] .p-app:hover,
[data-perf="on"] .p-app:hover .p-tile,
[data-perf="on"] .p-btn:hover,
[data-perf="on"] .p-chip:hover,
[data-perf="on"] .p-drop:hover,
[data-perf="on"] .p-iconbtn:hover {
  transform: none;
}

[data-perf="on"] .p-app::after { display: none; }

@media (prefers-reduced-motion: reduce) {
  .sl-header,
  .p-title,
  .p-card,
  .p-stat,
  .p-app {
    animation: none;
  }
  .p-app:hover,
  .p-app:hover .p-tile,
  .p-btn:hover,
  .p-chip:hover,
  .p-drop:hover,
  .p-iconbtn:hover {
    transform: none;
  }
}

/* ─── Utility ────────────────────────────────────────────────────────── */

/* Visually hidden, still announced by screen readers. */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ─── Filter chips (report filters) ──────────────────────────────────── */

.p-chipbar {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.p-chipbar__label {
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
  margin-inline-end: 0.2rem;
}

.p-filter {
  padding: 0.35rem 0.8rem;
  border-radius: 999px;
  border: 1px solid rgba(var(--accent-rgb), 0.10);
  background: rgba(var(--surface-rgb), 0.55);
  font-family: inherit;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-muted);
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.p-filter:hover { color: var(--text); border-color: rgba(var(--accent-rgb), 0.20); }
.p-filter:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

.p-filter.is-active {
  color: var(--primary);
  background: rgba(var(--primary-rgb), 0.10);
  border-color: rgba(var(--primary-rgb), 0.28);
}

/* ─── Department / theme picker (radio cards) ────────────────────────── */

.p-picker {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.p-picker__opt {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.5rem 0.9rem;
  border-radius: 999px;
  border: 1.5px solid rgba(var(--accent-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.60);
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text-muted);
  cursor: pointer;
  transition: color var(--transition-fast), border-color var(--transition-fast), background var(--transition-fast);
}

.p-picker__opt input { position: absolute; opacity: 0; pointer-events: none; }
.p-picker__opt:hover { color: var(--text); }

.p-picker__opt:has(input:checked) {
  color: var(--primary);
  border-color: rgba(var(--primary-rgb), 0.45);
  background: rgba(var(--primary-rgb), 0.08);
}

.p-picker__opt:has(input:focus-visible) { outline: 2px solid var(--primary); outline-offset: 2px; }

.p-swatch {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  flex: none;
  box-shadow: inset 0 0 0 1px rgba(var(--accent-rgb), 0.12);
}

/* ─── Checkbox row ───────────────────────────────────────────────────── */

.p-check {
  display: flex;
  align-items: flex-start;
  gap: 0.55rem;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--text);
  cursor: pointer;
  line-height: 1.6;
}

.p-check input {
  accent-color: var(--primary);
  width: 16px;
  height: 16px;
  margin-top: 0.15rem;
  flex: none;
}

.p-check:focus-within { outline: none; }
.p-check input:focus-visible { outline: 2px solid var(--primary); outline-offset: 2px; }

/* ─── Collapsible section (API panel, whitelist) ─────────────────────── */

.p-details {
  border-radius: var(--radius-xl);
  overflow: hidden;
  animation: rise 0.65s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.p-details > summary {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.1rem 1.35rem;
  cursor: pointer;
  font-size: 1.08rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  list-style: none;
  transition: background var(--transition-fast);
}

.p-details > summary::-webkit-details-marker { display: none; }
.p-details > summary:hover { background: rgba(var(--accent-rgb), 0.035); }
.p-details > summary:focus-visible { outline: 2px solid var(--primary); outline-offset: -2px; }

.p-details__caret {
  margin-inline-start: auto;
  width: 17px;
  height: 17px;
  stroke: var(--text-faint);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  fill: none;
  flex: none;
  transition: transform var(--transition-fast);
}

.p-details[open] .p-details__caret { transform: rotate(180deg); }

.p-details__body {
  padding: 0 1.35rem 1.35rem;
  display: flex;
  flex-direction: column;
  gap: 1.15rem;
}

.p-subhead {
  margin: 0 0 0.7rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}

/* ─── Key/value rows + code ──────────────────────────────────────────── */

.p-kv {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.04);
  font-size: 0.85rem;
}

.p-kv__key { font-weight: 700; color: var(--text); flex: none; }

.p-kv__val {
  color: var(--text-muted);
  direction: ltr;
  unicode-bidi: isolate;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
  min-width: 0;
}

.p-code {
  margin: 0;
  padding: 0.8rem 0.9rem;
  border-radius: var(--radius-sm);
  background: rgba(var(--accent-rgb), 0.06);
  border: 1px solid rgba(var(--accent-rgb), 0.08);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.78rem;
  line-height: 1.7;
  color: var(--text-muted);
  direction: ltr;
  text-align: left;
  overflow-x: auto;
  white-space: pre;
}

.p-list {
  margin: 0;
  padding-inline-start: 1.1rem;
  font-size: 0.85rem;
  line-height: 1.9;
  color: var(--text-muted);
}

/* ─── Success / result callout ───────────────────────────────────────── */

.p-callout {
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  border: 1.5px solid rgba(22, 163, 74, 0.28);
  background: rgba(22, 163, 74, 0.07);
}

.p-callout__title {
  margin: 0 0 0.35rem;
  font-size: 0.97rem;
  font-weight: 700;
  color: #16a34a;
}

.p-meta {
  display: flex;
  gap: 0.4rem;
  flex-wrap: wrap;
  margin-top: 0.7rem;
}

.p-metachip {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.70rem;
  font-weight: 700;
  color: var(--text-muted);
  background: rgba(var(--surface-rgb), 0.70);
  border: 1px solid rgba(var(--accent-rgb), 0.08);
}

/* ─── Alt state block (login / OTP demos) ────────────────────────────── */

.p-state {
  border-radius: var(--radius-md);
  padding: 1.15rem 1.25rem;
  border: 1.5px dashed rgba(var(--accent-rgb), 0.14);
  background: rgba(var(--surface-rgb), 0.35);
}

.p-state__tag {
  display: inline-block;
  margin-bottom: 0.8rem;
  font-size: 0.70rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-faint);
}

/* ─── Brand lockup ───────────────────────────────────────────────────── */

.p-brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  min-width: 0;
}

.p-brand__name {
  margin: 0;
  font-size: 0.97rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1.3;
}

.p-brand__sub {
  margin: 0;
  font-size: 0.78rem;
  color: var(--text-faint);
}

/* ─── Range field ────────────────────────────────────────────────────── */

.p-range {
  width: 100%;
  accent-color: var(--primary);
}

.p-range:focus-visible { outline: 2px solid var(--primary); outline-offset: 3px; }

/* ─── Calendar strip (aghsat) ────────────────────────────────────────── */

.p-cal {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 0.4rem;
}

.p-cal__day {
  border-radius: var(--radius-sm);
  padding: 0.5rem 0.35rem;
  text-align: center;
  background: rgba(var(--surface-rgb), 0.45);
  border: 1px solid rgba(var(--accent-rgb), 0.07);
  font-size: 0.78rem;
  color: var(--text-muted);
}

.p-cal__num { display: block; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; }
.p-cal__day.is-today { border-color: rgba(var(--primary-rgb), 0.45); background: rgba(var(--primary-rgb), 0.08); }
.p-cal__count { display: block; margin-top: 0.2rem; font-size: 0.70rem; color: var(--text-faint); }

[data-perf="on"] .p-details > summary:hover { background: none; }

/* ─── Live-preview runtime bits (toasts, dialogs, busy states) ───────── */

.pv-toasts {
  position: fixed;
  inset-block-end: 1.5rem;
  inset-inline-start: 1.5rem;
  z-index: 120;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.pv-toast {
  pointer-events: auto;
  max-width: min(360px, calc(100vw - 3rem));
  padding: 0.7rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.6;
  color: var(--text);
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  backdrop-filter: blur(var(--blur)) saturate(180%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(180%);
  box-shadow: 0 8px 24px var(--glass-shadow), 0 2px 4px rgba(var(--accent-rgb), 0.06);
  animation: rise 0.28s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pv-toast.is-out { opacity: 0; transition: opacity 0.22s ease; }
.pv-toast--ok    { border-inline-start: 3px solid var(--success); }
.pv-toast--error { border-inline-start: 3px solid #dc2626; }
.pv-toast--info  { border-inline-start: 3px solid var(--primary); }

.pv-overlay {
  position: fixed;
  inset: 0;
  z-index: 130;
  display: grid;
  place-items: center;
  padding: 1.25rem;
  background: rgba(var(--accent-rgb), 0.45);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

.pv-dialog {
  width: min(420px, 100%);
  padding: 1.5rem;
  border-radius: var(--radius-xl);
  background: var(--glass-strong);
  animation: rise 0.35s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.pv-dialog__text {
  margin: 0 0 1.25rem;
  font-size: 0.97rem;
  line-height: 1.85;
  color: var(--text);
}

/* Busy buttons keep their width — the label is replaced by a spinner. */
[aria-busy="true"] {
  position: relative;
  color: transparent !important;
  pointer-events: none;
}

[aria-busy="true"]::after {
  content: "";
  position: absolute;
  inset-block-start: 50%;
  inset-inline-start: 50%;
  width: 15px;
  height: 15px;
  margin: -7.5px 0 0 -7.5px;
  border-radius: 50%;
  border: 2px solid rgba(var(--surface-rgb), 0.45);
  border-top-color: rgba(var(--surface-rgb), 0.95);
  animation: pv-spin 0.7s linear infinite;
}

.p-btn--ghost[aria-busy="true"]::after,
.p-iconbtn[aria-busy="true"]::after {
  border-color: rgba(var(--accent-rgb), 0.20);
  border-top-color: var(--primary);
}

@keyframes pv-spin { to { transform: rotate(360deg); } }

/* Skeleton shimmer for first paint of a live region. */
.pv-skeleton {
  border-radius: var(--radius-sm);
  background: linear-gradient(90deg,
    rgba(var(--accent-rgb), 0.06) 25%,
    rgba(var(--accent-rgb), 0.11) 37%,
    rgba(var(--accent-rgb), 0.06) 63%);
  background-size: 400% 100%;
  animation: pv-shimmer 1.4s ease infinite;
  color: transparent !important;
  min-height: 1em;
}

@keyframes pv-shimmer { from { background-position: 100% 50%; } to { background-position: 0 50%; } }

/* A section the API said is unavailable — dimmed, not hidden. */
.pv-offline { opacity: 0.55; }

.pv-hide { display: none !important; }

[data-perf="on"] .pv-toast,
[data-perf="on"] .pv-overlay {
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
}
[data-perf="on"] .pv-toast { background: rgba(var(--surface-rgb), 0.95); }

@media (prefers-reduced-motion: reduce) {
  .pv-toast, .pv-dialog { animation: none; }
  .pv-skeleton { animation: none; }
}

/* Drop zone while a file is dragged over it. */
.p-drop.is-over {
  border-color: rgba(var(--primary-rgb), 0.70);
  background: rgba(var(--primary-rgb), 0.10);
  transform: translateY(-2px);
}

[data-perf="on"] .p-drop.is-over { transform: none; }
