/* ==========================================================================
   XDF Moto Tuning - account, support and help pages
   Sign in, create account, password reset, My account, Messages, Contact,
   FAQ, Tutorials, Documentation and the support inbox. Needs css/style.css.
   ========================================================================== */

/* ---------- Page frame ---------- */
.page-band-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px 24px;
}
.page-meta { margin-top: 8px; color: var(--on-dark-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.page-body { position: relative; z-index: 3; margin-top: -40px; padding-bottom: var(--space-20); }
.page-narrow { max-width: 860px; }
@media (max-width: 767px) {
  .page-band { padding: 24px 0 56px; }
  .page-body { padding-bottom: var(--space-16); }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  padding: 24px;
}
.panel + .panel { margin-top: 20px; }
.panel .state { border: 0; padding: var(--space-10) var(--space-4); }
.panel .orders + .pagination, .panel .pagination { margin-top: var(--space-6); }
.panel-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 16px;
  margin-bottom: 20px;
}
.panel-title { font-size: var(--text-lg); font-weight: 700; letter-spacing: -0.01em; }
.panel-count { color: var(--text-3); font-size: var(--text-sm); font-variant-numeric: tabular-nums; }
@media (max-width: 559px) {
  .panel { padding: 18px 16px; border-radius: var(--r-md); }
}

.btn-danger { --btn-bg: var(--danger); --btn-fg: #fff; --btn-border: var(--danger); --btn-bg-hover: #a82020; }
.btn-danger:hover { border-color: #a82020; }
.btn-danger-ghost { --btn-bg: transparent; --btn-fg: var(--danger); --btn-border: #efc3c3; --btn-bg-hover: var(--danger-bg); }

/* ---------- Forms ---------- */
.form-stack { display: grid; gap: 18px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; }
.form-grid .span-2 { grid-column: 1 / -1; }
@media (max-width: 559px) {
  .form-grid { grid-template-columns: 1fr; }
}
.field .input:disabled, .input[readonly] { background: var(--surface-2); color: var(--text-2); cursor: default; }
.field-row { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.field-row a { font-size: var(--text-sm); font-weight: 600; }
.field-aside {
  justify-self: end;
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  font-size: var(--text-sm);
  font-weight: 600;
}
@media (pointer: coarse) { .field-aside { min-height: 44px; } }
.field-meta { display: flex; justify-content: flex-end; font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }
.field-error { margin: 0; }
.optional { font-weight: 500; color: var(--text-3); }
.nowrap { white-space: nowrap; }

.textarea { min-height: 140px; padding: 12px 14px; line-height: 1.5; resize: vertical; }

.input-wrap { position: relative; display: block; }
.input-wrap > .input { padding-right: 50px; }
.input-toggle {
  position: absolute;
  top: 2px; right: 2px;
  display: grid;
  place-items: center;
  width: 44px; height: 40px;
  padding: 0;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-3);
}
.input-toggle:hover { color: var(--text); background: var(--surface-3); }
.input-toggle:focus-visible { outline: var(--focus-outline); outline-offset: -2px; }
.input-toggle svg { width: 18px; height: 18px; }

.input-code {
  min-height: 56px;
  font: 600 1.5rem/1 var(--font-mono);
  letter-spacing: 0.45em;
  text-align: center;
  text-indent: 0.45em;
}
.input-code::placeholder { letter-spacing: 0.45em; color: var(--line-2); }

.check {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  min-height: 24px;
  font-size: var(--text-sm);
  line-height: 1.45;
  color: var(--text-2);
  cursor: pointer;
}
.check input {
  width: 20px; height: 20px;
  margin: 0;
  flex: none;
  accent-color: var(--brand-600);
  cursor: pointer;
}
.check a { font-weight: 600; }

.form-alert {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid;
  border-radius: var(--r-md);
  font-size: var(--text-sm);
  line-height: 1.45;
}
.form-alert.is-error { background: var(--danger-bg); border-color: #f1c3c3; color: #8f1d1d; }
.form-alert.is-success { background: var(--success-bg); border-color: #b7e8c9; color: #0c5a2c; }
.form-alert.is-info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-700); }
.form-alert:focus { outline: none; }
.form-alert:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.form-alert-icon { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.form-alert-text { min-width: 0; overflow-wrap: anywhere; }
.form-alert a { color: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.chip-choice { margin: 0; padding: 0; border: 0; min-width: 0; }
.chip-choice legend { margin-bottom: 8px; padding: 0; }
.chip-options { display: flex; flex-wrap: wrap; gap: 8px; }
.chip-option { position: relative; }
.chip-option input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.chip-option span {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-full);
  background: var(--surface);
  color: var(--text-2);
  font: 600 var(--text-sm)/1 var(--font-body);
  transition: background-color var(--dur-fast) var(--ease-out), border-color var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.chip-option input:hover + span { border-color: var(--text-3); color: var(--text); }
.chip-option input:checked + span { background: var(--ink-900); border-color: var(--ink-900); color: #fff; }
.chip-option input:focus-visible + span { outline: var(--focus-outline); outline-offset: 2px; }
@media (pointer: coarse) { .chip-option span { min-height: 44px; } }

/* ---------- Sign in, create account, password reset ---------- */
.auth-band { height: 196px; }
.auth-wrap {
  position: relative;
  z-index: 3;
  display: flex;
  justify-content: center;
  margin-top: -148px;
  padding: 0 var(--gutter) var(--space-20);
}
.auth-card {
  width: 100%;
  max-width: 440px;
  padding: 36px 32px 28px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg);
}
.auth-title { font-size: var(--text-2xl); font-weight: 800; letter-spacing: -0.025em; }
.auth-lead { margin-top: 8px; color: var(--text-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.auth-lead strong { color: var(--text); }
.auth-form { display: grid; gap: 18px; margin-top: 24px; }
.auth-form > .btn-block { margin-top: 4px; }
.auth-alt {
  margin-top: 24px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  color: var(--text-2);
  font-size: var(--text-sm);
  text-align: center;
}
.auth-alt a { font-weight: 600; }
.auth-links { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 4px 12px; }
.link-btn {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--brand-600);
  font: 600 var(--text-sm)/1.2 var(--font-body);
  cursor: pointer;
}
.link-btn:hover { color: var(--brand-700); }
.link-btn:disabled { color: var(--text-3); cursor: default; }
.link-btn:focus-visible { outline: var(--focus-outline); outline-offset: 2px; border-radius: 4px; }
.steps { display: flex; gap: 6px; margin-bottom: 20px; }
.steps span { height: 4px; flex: 1; border-radius: 2px; background: var(--surface-3); }
.steps span.is-done { background: var(--brand); }
@media (max-width: 479px) {
  .auth-band { height: 150px; }
  .auth-wrap { margin-top: -120px; }
  .auth-card { padding: 26px 20px 20px; border-radius: var(--r-lg); }
}

/* ---------- My account ---------- */
.account { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 28px; align-items: start; }
.account-nav {
  position: sticky;
  top: calc(var(--header-h) + 20px);
  display: grid;
  gap: 2px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
}
.account-nav-link {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
  border: 0;
  border-radius: var(--r-sm);
  background: transparent;
  color: var(--text-2);
  font: 600 var(--text-sm)/1.2 var(--font-body);
  text-align: left;
  text-decoration: none;
  white-space: nowrap;
  cursor: pointer;
}
.account-nav-link svg { width: 18px; height: 18px; color: var(--text-3); flex: none; }
.account-nav-link:hover { background: var(--surface-2); color: var(--text); }
.account-nav-link[aria-current="page"] { background: var(--ink-900); color: #fff; }
.account-nav-link[aria-current="page"] svg { color: var(--brand); }
.account-nav-sep { height: 1px; margin: 6px 4px; background: var(--line); }
.account-nav .nav-count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  border-radius: 10px;
  background: var(--brand);
  color: var(--brand-ink);
  font: 700 11px/20px var(--font-body);
  text-align: center;
}
@media (max-width: 899px) {
  .account { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .account-nav {
    position: static;
    display: flex;
    gap: 4px;
    padding: 6px;
    overflow-x: auto;
    scrollbar-width: none;
  }
  .account-nav::-webkit-scrollbar { display: none; }
  .account-nav-link { width: auto; flex: none; }
  .account-nav-sep { display: none; }
}
/* Phones: the five entries as one row of equal tabs, icon above the label, none hidden off screen. */
@media (max-width: 599px) {
  .account-nav { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 2px; padding: 4px; overflow: visible; }
  .account-nav-link {
    position: relative;
    flex-direction: column;
    justify-content: center;
    gap: 4px;
    width: auto;
    min-width: 0;
    min-height: 56px;
    padding: 6px 2px;
    font-size: 12px;
    letter-spacing: -0.01em;
    text-align: center;
  }
  .account-nav-link span:not(.nav-count) { max-width: 100%; overflow: hidden; text-overflow: ellipsis; }
  .account-nav .nav-count { position: absolute; top: 3px; left: calc(50% + 6px); min-width: 18px; height: 18px; padding: 0 5px; margin: 0; line-height: 18px; }
}

.account-section[hidden] { display: none !important; }

/* Orders */
.orders { display: grid; gap: 14px; }
.order { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); overflow: hidden; }
.order-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 14px;
  padding: 14px 18px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.order-number { font: 700 var(--text-sm)/1.2 var(--font-mono); color: var(--text); }
a.order-number { text-decoration: none; }
a.order-number:hover { color: var(--brand-600); text-decoration: underline; text-underline-offset: 2px; }
.order-date { color: var(--text-3); font-size: var(--text-sm); }
.order-head .status { margin-left: auto; }
.order-lines { margin: 0; padding: 4px 18px; list-style: none; }
.order-line {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0;
  border-bottom: 1px dashed var(--line);
}
.order-line:last-child { border-bottom: 0; }
.order-line-name { font-weight: 600; overflow-wrap: anywhere; }
.order-line-meta { margin-top: 2px; font-size: var(--text-xs); color: var(--text-3); overflow-wrap: anywhere; }
.order-line-price { flex: none; font-variant-numeric: tabular-nums; color: var(--text-2); font-size: var(--text-sm); text-align: right; }
.order-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 16px;
  padding: 14px 18px;
  border-top: 1px solid var(--line);
}
.order-total { font-weight: 700; font-variant-numeric: tabular-nums; }
.order-total small { display: block; font-weight: 500; font-size: var(--text-xs); color: var(--text-3); }
.order-facts { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: var(--text-sm); color: var(--text-2); }
.order-facts span { display: inline-flex; align-items: center; gap: 6px; }
.order-facts svg { width: 16px; height: 16px; color: var(--text-3); }
.order-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.order-error { margin: 0 18px 14px; }
@media (max-width: 559px) {
  .order-head, .order-foot { padding: 12px 14px; }
  .order-lines { padding: 2px 14px; }
  .order-actions { width: 100%; }
  .order-actions .btn { flex: 1 1 auto; }
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 10px;
  border-radius: var(--r-full);
  background: var(--surface-3);
  color: var(--text-2);
  font: 600 var(--text-xs)/1 var(--font-body);
  white-space: nowrap;
}
.status::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status.is-paid, .status.is-sent { background: var(--success-bg); color: var(--success); }
.status.is-pending, .status.is-new { background: var(--warning-bg); color: var(--warning); }
.status.is-failed, .status.is-expired, .status.is-void { background: var(--danger-bg); color: var(--danger); }
.status.is-replied { background: var(--brand-50); color: var(--brand-700); }

.skeleton-card { height: 168px; border-radius: var(--r-lg); }
.skeleton-line { height: 14px; }

/* ---------- Messages ---------- */
.inbox {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  height: min(700px, calc(100vh - var(--header-h) - 150px));
  min-height: 500px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  overflow: hidden;
}
.inbox-side { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.inbox-side-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-height: 56px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--line);
}
.inbox-side-title { font: 700 var(--text-base)/1.2 var(--font-display); font-stretch: var(--stretch-display); }
.inbox-filters { display: flex; gap: 6px; padding: 10px 12px; border-bottom: 1px solid var(--line); overflow-x: auto; }
.inbox-filters .chip { min-height: 32px; padding: 0 12px; }
.inbox-list { flex: 1; min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.inbox-item {
  display: grid;
  gap: 4px;
  width: 100%;
  padding: 14px 16px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.inbox-item:hover { background: var(--surface-2); }
.inbox-item:focus-visible { outline: var(--focus-outline); outline-offset: -2px; }
.inbox-item[aria-current="true"] { background: var(--brand-50); box-shadow: inset 3px 0 0 var(--brand); }
.inbox-item-top { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; min-width: 0; }
.inbox-item-subject { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; font-size: var(--text-sm); }
.inbox-item-date { flex: none; font-size: var(--text-xs); color: var(--text-3); }
.inbox-item-preview { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-sm); color: var(--text-3); }
.inbox-item-foot { display: flex; align-items: center; gap: 8px; }
.inbox-item.is-unread .inbox-item-subject { font-weight: 800; }
.unread-dot { width: 8px; height: 8px; flex: none; border-radius: 50%; background: var(--brand-600); }
.inbox-empty { padding: 32px 20px; text-align: center; color: var(--text-3); font-size: var(--text-sm); }

.thread { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.thread-head {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 64px;
  padding: 10px 20px;
  border-bottom: 1px solid var(--line);
}
.thread-back { display: none; margin-left: -10px; }
.thread-heading { min-width: 0; flex: 1; }
.thread-title { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-md); font-weight: 700; letter-spacing: -0.01em; }
.thread-sub { font-size: var(--text-xs); color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.thread-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.thread-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
  min-height: 0;
  padding: 20px;
  overflow-y: auto;
  background: var(--surface-2);
}
.bubble-group { display: grid; gap: 4px; max-width: min(600px, 86%); justify-items: start; align-self: flex-start; }
.bubble-group.is-mine { justify-items: end; align-self: flex-end; }
.bubble {
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: 14px 14px 14px 4px;
  background: var(--surface);
  font-size: var(--text-sm);
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.is-mine .bubble { border-color: var(--ink-900); border-radius: 14px 14px 4px 14px; background: var(--ink-900); color: #fff; }
.bubble-meta { font-size: var(--text-xs); color: var(--text-3); }
.composer {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  padding: 12px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface);
}
.composer .field { flex: 1; min-width: 0; }
.guest-reply { display: flex; flex-wrap: wrap; gap: 10px; padding: 12px 16px; border-top: 1px solid var(--line); background: var(--surface); }
.guest-reply[hidden] { display: none; }
.composer textarea { min-height: 44px; max-height: 160px; padding: 10px 14px; resize: none; line-height: 1.45; }
.thread-empty { display: grid; place-items: center; flex: 1; padding: 24px; }
@media (max-width: 767px) {
  .inbox { grid-template-columns: minmax(0, 1fr); height: auto; min-height: 0; }
  .inbox-side { border-right: 0; }
  .inbox.is-reading { height: calc(100dvh - var(--header-h) - 24px); min-height: 420px; }
  .inbox.is-reading .inbox-side { display: none; }
  .inbox:not(.is-reading) .thread { display: none; }
  .thread-back { display: inline-grid; }
  .thread-head { padding: 8px 12px; }
  .thread-body { padding: 14px 12px; }
  .composer { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .guest-reply { padding: 10px 12px calc(10px + env(safe-area-inset-bottom, 0px)); }
  .guest-reply .btn { flex: 1 1 140px; }
}

/* ---------- Contact ---------- */
.contact-channels { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.contact-channels + .panel { margin-top: 24px; }
.channel-skel { height: 88px; border-radius: var(--r-lg); }
.channel {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
  margin: 0;
  padding: 20px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-xs);
  color: var(--text);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
a.channel:hover { color: var(--text); border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.channel-icon { display: grid; place-items: center; width: 48px; height: 48px; flex: none; border-radius: 14px; background: var(--brand-50); color: var(--brand-600); }
.channel-icon svg { width: 24px; height: 24px; }
.channel-icon svg.icon-wa { color: #128c4a; }
.channel-body { display: grid; gap: 2px; min-width: 0; flex: 1; }
.channel-name { font-size: var(--text-md); font-weight: 700; }
.channel-value { color: var(--text-2); font-size: var(--text-sm); overflow-wrap: anywhere; }
.channel-go { width: 18px; height: 18px; color: var(--text-3); }
a.channel:hover .channel-go { color: var(--brand-600); }
@media (max-width: 639px) {
  .contact-channels { grid-template-columns: minmax(0, 1fr); gap: 12px; }
  .channel { padding: 16px; }
}
.signed-as {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  background: var(--surface-2);
  font-size: var(--text-sm);
}
.signed-as .sh-avatar { width: 36px; height: 36px; }
.signed-as-name { font-weight: 600; overflow-wrap: anywhere; }
.signed-as-email { color: var(--text-3); font-size: var(--text-xs); overflow-wrap: anywhere; }

/* ---------- FAQ ---------- */
/* One answer open at a time (js/help.js); the open one carries the brand
   edge so the eye finds it again after the list has shifted under it. */
.faq-list { display: grid; gap: 10px; }
.faq-item {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-xs);
  transition: border-color var(--dur) var(--ease-out), box-shadow var(--dur) var(--ease-out);
}
.faq-item[open] { border-color: var(--brand-200); box-shadow: var(--shadow-sm); }
.faq-item summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 56px;
  padding: 14px 18px;
  font-weight: 600;
  list-style: none;
  cursor: pointer;
  border-radius: var(--r-md);
  overflow-wrap: anywhere;
}
.faq-item summary::-webkit-details-marker { display: none; }
.faq-item summary:hover { color: var(--brand-700); }
.faq-item summary:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.faq-item[open] summary { color: var(--brand-700); }
.faq-item summary svg { width: 18px; height: 18px; flex: none; color: var(--text-3); transition: transform var(--dur) var(--ease-out); }
.faq-item[open] summary svg { transform: rotate(180deg); }
.faq-answer { padding: 0 18px 18px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }
/* The question line fills the width on a narrow phone; the chevron keeps its place. */
@media (max-width: 400px) {
  .faq-item summary { gap: 10px; padding: 13px 14px; }
  .faq-answer { padding: 0 14px 16px; }
}
.help-cta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 32px;
  padding: 20px 24px;
  border-radius: var(--r-lg);
  background: var(--ink-900);
  color: var(--on-dark);
}
.help-cta-title { font-size: var(--text-lg); font-weight: 700; }
.help-cta-actions { display: flex; flex-wrap: wrap; gap: 8px; }

/* ---------- Tutorials ---------- */
.tgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 280px), 1fr)); gap: 20px; }
.tcard { display: flex; flex-direction: column; min-width: 0; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); overflow: hidden; }
.tcard-media {
  position: relative;
  display: grid;
  place-items: center;
  width: 100%;
  aspect-ratio: 16 / 9;
  padding: 0;
  border: 0;
  background: linear-gradient(145deg, var(--ink-800), var(--ink-950));
  color: #fff;
  cursor: pointer;
  overflow: hidden;
}
.tcard-media img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; transition: transform var(--dur-slow) var(--ease-out); }
.tcard-media:hover img { transform: scale(1.03); }
.tcard-media:focus-visible { outline: var(--focus-outline); outline-offset: -3px; }
.tcard-play {
  position: relative;
  display: grid;
  place-items: center;
  width: 56px; height: 56px;
  border-radius: 50%;
  background: rgba(6, 8, 11, 0.72);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}
.tcard-play svg { width: 22px; height: 22px; margin-left: 3px; }
.tcard-body { display: grid; gap: 6px; padding: 16px; }
.tcard-title { font-size: var(--text-base); font-weight: 700; line-height: 1.3; overflow-wrap: anywhere; }
.tcard-desc {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  color: var(--text-3);
  font-size: var(--text-sm);
  overflow-wrap: anywhere;
}

.player {
  width: min(960px, calc(100vw - 32px));
  max-width: none;
  padding: 0;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--ink-950);
  color: var(--on-dark);
  box-shadow: var(--shadow-lg);
}
.player::backdrop { background: rgba(6, 8, 11, 0.8); }
.player-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 8px 8px 18px; }
.player-title { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: var(--text-base); font-weight: 700; }
.player-head .btn-icon { color: var(--on-dark); }
.player-frame { aspect-ratio: 16 / 9; background: #000; }
.player-frame iframe, .player-frame video { display: block; width: 100%; height: 100%; border: 0; }
.player-foot { padding: 12px 18px 16px; font-size: var(--text-sm); color: var(--on-dark-2); }
.player-foot a { color: var(--brand); font-weight: 600; }

/* ---------- Documentation ---------- */
.docs { display: grid; gap: 16px; }
.doc { padding: 24px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow-xs); }
.doc-title { font-size: var(--text-xl); font-weight: 700; overflow-wrap: anywhere; }
.doc-body { margin-top: 12px; color: var(--text-2); white-space: pre-line; overflow-wrap: anywhere; }

/* ---------- Dialog ---------- */
.x-dialog {
  width: min(440px, calc(100vw - 32px));
  max-width: none;
  padding: 24px;
  border: 0;
  border-radius: var(--r-lg);
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-lg);
}
.x-dialog::backdrop { background: rgba(6, 8, 11, 0.55); }
.x-dialog-title { font-size: var(--text-lg); font-weight: 700; }
.x-dialog-text { margin-top: 8px; color: var(--text-2); font-size: var(--text-sm); }
.x-dialog-actions { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 8px; margin-top: 22px; }
@media (max-width: 419px) {
  .x-dialog-actions .btn { flex: 1 1 auto; }
}

/* ---------- Redirect notice ---------- */
.redirect-note { display: grid; justify-items: center; gap: 12px; padding: 48px 16px; text-align: center; color: var(--text-2); }

/* ---------- Support tickets ---------- */
.status.is-open { background: var(--warning-bg); color: var(--warning); }
.status.is-answered { background: var(--brand-50); color: var(--brand-700); }
.status.is-closed { background: var(--surface-3); color: var(--text-3); }

.tk-cards { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.tk-card {
  display: grid;
  gap: 6px;
  padding: 14px 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  color: inherit;
  text-decoration: none;
}
.tk-card:hover { border-color: var(--line-2); background: var(--surface-2); }
.tk-card:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.tk-card-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tk-ref { font: 700 var(--text-xs)/1.2 var(--font-mono); color: var(--text-3); letter-spacing: 0.02em; }
.tk-card-subject { font-weight: 600; overflow-wrap: anywhere; }
.tk-card-meta { font-size: var(--text-xs); color: var(--text-3); }

.tk-thread { display: grid; gap: 14px; margin: 0; padding: 0; list-style: none; }
.tk-thread:empty { display: none; }
.tk-reply { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.tk-entry {
  padding: 14px 16px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
}
/* The team's answers are the ones a customer scans for. */
.tk-entry.is-team { background: var(--brand-50); border-color: var(--brand-100); }
.tk-entry-head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 4px 12px; }
.tk-entry-who { font-weight: 700; font-size: var(--text-sm); overflow-wrap: anywhere; }
.tk-entry-date { font-size: var(--text-xs); color: var(--text-3); }
.tk-entry-body { margin-top: 8px; color: var(--text-2); line-height: 1.6; overflow-wrap: anywhere; }

.tk-files, .file-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; padding: 0; list-style: none; }
.tk-file, .file-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  max-width: 100%;
  padding: 6px 12px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 999px;
  font-size: var(--text-sm);
  color: var(--text);
  text-decoration: none;
}
.tk-file:hover { border-color: var(--brand); color: var(--brand-700); }
.tk-file:focus-visible { outline: var(--focus-outline); outline-offset: 2px; }
.tk-file svg, .file-chip svg { width: 16px; height: 16px; flex: none; color: var(--text-3); }
.tk-file-name, .file-chip-name { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tk-file-size, .file-chip-size { flex: none; font-size: var(--text-xs); color: var(--text-3); font-variant-numeric: tabular-nums; }

.file-input { padding: 10px 12px; line-height: 1.4; cursor: pointer; }
.file-input::file-selector-button {
  margin-right: 12px;
  padding: 6px 12px;
  border: 1px solid var(--line-2);
  border-radius: var(--r-sm);
  background: var(--surface-2);
  color: var(--text);
  font: inherit;
  font-size: var(--text-sm);
  font-weight: 600;
  cursor: pointer;
}
.file-input::file-selector-button:hover { background: var(--surface-3); }
