/* Self-hosted (fonts/ next to this file) so the app has zero dependency on
   foreign CDNs - critical for users inside Iran where jsdelivr et al. are
   intermittently slow or filtered. Only 3 weights (~30KB each, woff2). */
@font-face {
  font-family: "IRANSansWeb";
  src: url("fonts/IRANSansWeb.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansWeb";
  src: url("fonts/IRANSansWeb_Medium.woff2") format("woff2");
  font-weight: 500;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "IRANSansWeb";
  src: url("fonts/IRANSansWeb_Bold.woff2") format("woff2");
  font-weight: 600 700;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #0a0c12;
  --surface: #141722;
  --surface-2: #1a1f2e;
  --border: #1f2330;
  --text: #eef0f6;
  --text-muted: #7d859c;
  --accent: #6e5cf7;
  --accent-hover: #7f6ff8;
  --accent-grad: linear-gradient(135deg, #7d5cff, #5b45f0);
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
  --info: #38bdf8;
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "IRANSansWeb", "Vazirmatn", Tahoma, sans-serif;
  font-size: 15px;
  -webkit-tap-highlight-color: transparent;
}

/* --- Lightweight "dynamic" polish: cheap, GPU-only (transform/opacity),
   no JS animation loops except the count-up helper in api.js. Kept
   deliberately minimal so it stays smooth on low-end Android/iOS. --- */

#top-loading-bar {
  position: fixed;
  top: 0;
  right: 0;
  left: 0;
  height: 2px;
  background: var(--accent);
  width: 0%;
  opacity: 0;
  z-index: 9999;
  transition: width 0.3s ease, opacity 0.2s ease;
  pointer-events: none;
}

#top-loading-bar.loading {
  width: 70%;
  opacity: 1;
}

/* Transient confirmation toast (showToast in api.js) - e.g. "فایل با
   موفقیت ارسال شد". Sits above the bottom nav / composer and fades out. */
.app-toast {
  position: fixed;
  left: 50%;
  bottom: 84px;
  transform: translate(-50%, 12px);
  max-width: 90%;
  padding: 11px 18px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-size: 13px;
  font-weight: 500;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  opacity: 0;
  pointer-events: none;
  z-index: 9998;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.app-toast.show {
  opacity: 1;
  transform: translate(-50%, 0);
}

.app-toast-success {
  border-color: rgba(34, 197, 94, 0.5);
  color: #4ade80;
}

.app-toast-error {
  border-color: rgba(239, 68, 68, 0.5);
  color: #f87171;
}

@keyframes fadeInUp {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.ticket-card,
.bubble,
.player-stat-card,
.option-card,
.priority-card,
.empty-state,
.status-banner {
  animation: fadeInUp 0.22s ease both;
}

.ticket-card,
.option-card,
.priority-card,
.btn-primary,
.btn-secondary {
  transition: transform 0.12s ease, box-shadow 0.12s ease, background-color 0.12s ease;
}

.ticket-card:active,
.option-card:active,
.priority-card:active,
.btn-primary:active,
.btn-secondary:active {
  transform: scale(0.97);
}

.badge {
  transition: background-color 0.2s ease, color 0.2s ease;
}

.app {
  max-width: 480px;
  margin: 0 auto;
  /* --tg-vh (set in api.js from Telegram.WebApp.viewportHeight) tracks the
     WebView's real visible height so this shrinks when the keyboard opens
     instead of staying pinned to the pre-keyboard 100vh. */
  height: var(--tg-vh, 100vh);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  z-index: 10;
}

.topbar h1 {
  font-size: 17px;
  margin: 0;
}

.topbar-actions {
  margin-right: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Shown only to logged-in admins (see index.js) - a plain in-page link
   rather than a Telegram WebApp button, since navigating to admin/
   index.html this way stays inside the same WebApp session/initData
   instead of launching a brand-new one (which some clients mishandle for
   inline-keyboard buttons). */
.admin-panel-link {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 999px;
  padding: 7px 12px;
  font-size: 12px;
  text-decoration: none;
  white-space: nowrap;
}

.back {
  color: var(--text);
  text-decoration: none;
  font-size: 20px;
}

/* Links never render with the browser's default underline anywhere in the
   app - everything link-like here is styled as a button, card, or nav item. */
a {
  text-decoration: none;
}

.gate-hint a {
  color: var(--accent-hover);
  font-weight: 600;
}

.content {
  flex: 1;
  min-height: 0; /* let this scroll internally instead of pushing .app past --tg-vh */
  padding: 16px;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.loading,
.empty,
.error {
  text-align: center;
  color: var(--text-muted);
  margin-top: 40px;
}

.error {
  color: var(--danger);
}

/* --- Player dashboard (home page stat cards + recent tickets panel) --- */

.player-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr auto;
  grid-template-rows: auto auto;
  gap: 12px;
  margin-bottom: 20px;
}

.player-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.player-stat-icon {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
}

.player-stat-icon svg {
  width: 17px;
  height: 17px;
}

.player-stat-value {
  font-size: 24px;
  font-weight: 500;
}

.player-stat-label {
  font-size: 12.5px;
  font-weight: 500;
}

.player-stat-sub {
  font-size: 11.5px;
  color: var(--text-muted);
}

.player-stat-card.stat-warning .player-stat-icon {
  background: rgba(245, 158, 11, 0.15);
  color: var(--warning);
}

.player-stat-card.stat-info .player-stat-icon {
  background: rgba(56, 189, 248, 0.15);
  color: var(--info);
}

.player-stat-card.stat-success .player-stat-icon {
  background: rgba(34, 197, 94, 0.15);
  color: var(--success);
}

.player-stat-card.stat-total {
  grid-row: 1 / span 2;
  grid-column: 3;
  justify-content: center;
  align-items: center;
  text-align: center;
  border-color: var(--accent);
  min-width: 108px;
}

.player-stat-card.stat-total .player-stat-icon {
  background: rgba(110, 92, 247, 0.15);
  color: var(--accent);
}

.player-stat-card.stat-closed {
  grid-column: 1 / span 2;
}

@media (max-width: 380px) {
  .player-stat-grid {
    grid-template-columns: 1fr 1fr;
    grid-template-rows: auto auto auto;
  }

  .player-stat-card.stat-total {
    grid-row: auto;
    grid-column: 1 / span 2;
  }

  .player-stat-card.stat-closed {
    grid-column: 1 / span 2;
  }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 18px;
}

.panel-header-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 14px;
}

.panel-title {
  font-size: 15px;
  font-weight: 600;
  margin: 0;
}

.archive-link {
  display: block;
  text-align: center;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
  color: var(--text-muted);
  text-decoration: none;
  font-size: 13px;
}

.ticket-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 12px 14px;
  margin-bottom: 8px;
  text-decoration: none;
  color: var(--text);
}

.ticket-card-chip {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(110, 92, 247, 0.14);
  color: var(--accent-hover);
}

.ticket-card-chip svg {
  width: 16px;
  height: 16px;
}

.ticket-card.chip-open .ticket-card-chip,
.ticket-card.chip-reopened .ticket-card-chip {
  background: rgba(99, 102, 241, 0.16);
  color: #a5b4fc;
}

.ticket-card.chip-assigned .ticket-card-chip,
.ticket-card.chip-in_progress .ticket-card-chip {
  background: rgba(245, 158, 11, 0.14);
  color: #fbbf24;
}

.ticket-card.chip-closed .ticket-card-chip {
  background: rgba(34, 197, 94, 0.13);
  color: #4ade80;
}

.ticket-card-body {
  flex: 1;
  min-width: 0;
}

.ticket-card-title {
  display: block;
  font-size: 13.5px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ticket-card-sub {
  display: block;
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}

.badge {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--text-muted);
  white-space: nowrap;
}

.badge-open,
.badge-reopened {
  background: #3730a3;
  color: #c7d2fe;
}

.badge-assigned,
.badge-in_progress {
  background: #78350f;
  color: #fde68a;
}

.badge-closed {
  background: #14532d;
  color: #bbf7d0;
}

/* --- Site header (injected by nav.js on pages with data-nav) ---
   Full-width brand bar: Alpha RP mark + product name on the start (right, in
   RTL) and the signed-in user chip on the end. Shared by home/archive/
   account; detail flows (chat, wizard) have no chrome. */
.site-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.site-header-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.brand-mark {
  display: flex;
  flex-shrink: 0;
  color: var(--accent);
}

.brand-mark svg {
  width: 32px;
  height: 32px;
  display: block;
}

.brand-mark img {
  height: 34px;
  width: auto;
}

.site-header-titles {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.site-header-title {
  font-size: 15px;
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header-subtitle {
  font-size: 10.5px;
  color: var(--text-muted);
  letter-spacing: 0.03em;
}

.site-header-user {
  flex-shrink: 0;
  font-size: 12px;
  color: var(--text-muted);
  background: var(--surface-2);
  border: 1px solid var(--border);
  padding: 6px 11px;
  border-radius: 999px;
  white-space: nowrap;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
}

.site-header-user:empty {
  display: none;
}

/* --- Primary navigation (injected by nav.js on pages with data-nav) ---
   One <nav> that becomes a bottom tab bar on phones and a vertical sidebar
   on desktop, entirely via CSS (see the min-width block below). On phones
   it's a normal flex item at the bottom of .app's column - NOT
   position:fixed - so it plays nice with the --tg-vh keyboard-resize layout
   the same way the chat composer does. */
.app-nav {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-around;
  background: var(--bg);
  border-top: 1px solid var(--border);
  padding: 8px 4px;
  padding-bottom: calc(8px + env(safe-area-inset-bottom));
}

/* On phones both groups' items sit in the single bottom bar; the groups are
   only meaningful (top vs. pinned-bottom) in the desktop sidebar. */
.app-nav-group {
  display: contents;
}

.app-nav-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-width: 56px;
  font-size: 11px;
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s ease;
}

.app-nav-item svg {
  width: 22px;
  height: 22px;
}

.app-nav-item.active {
  color: var(--accent);
}

/* Logout only makes sense for web-login sessions and lives on the account
   page on phones - hidden from the bottom bar to keep it to the core tabs. */
.app-nav-logout {
  display: none;
}

.app-nav-fab {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  margin-top: -26px;
  border: 4px solid var(--bg);
  box-shadow: 0 8px 20px rgba(110, 92, 247, 0.4);
}

.app-nav-fab svg {
  width: 22px;
  height: 22px;
}

.app-nav-fab:active {
  transform: scale(0.94);
}

/* The "new request" label only appears in the desktop sidebar - on phones
   the FAB is an icon-only round button. */
.app-nav-fab-label {
  display: none;
}

/* --- Desktop / PC layout ---------------------------------------------------
   On a wide *browser* window the fixed 480px phone column looked tiny and
   lost in whitespace ("صفحه تیکت‌ها کوچیکه"). At >=900px the same pages turn
   into an admin-panel-style shell: a full-width brand header on top, a
   vertical sidebar (the same nav, restyled) on the right, and a wide content
   area on the left. Scoped to body[data-nav] so only the list pages
   (home/archive/account) change - detail flows have no chrome and stay
   centered. The breakpoint only ever triggers in a real desktop browser;
   Telegram's Mini App window is never this wide, so the phone layout is
   preserved untouched inside Telegram on every platform. */
@media (min-width: 900px) {
  /* Full-bleed shell: no centered max-width column - the sidebar sits flush
     against the right edge of the window (first grid column in RTL) and
     spans the full viewport height, exactly like the admin panel. */
  body[data-nav] .app {
    max-width: none;
    width: 100%;
    height: 100vh;
    display: grid;
    grid-template-columns: 250px minmax(0, 1fr);
    grid-template-rows: auto auto 1fr;
    grid-template-areas:
      "nav header"
      "nav topbar"
      "nav content";
  }

  body[data-nav] .site-header {
    grid-area: header;
    padding: 14px 28px;
  }

  body[data-nav] .site-header-title {
    font-size: 16px;
  }

  body[data-nav] .brand-mark svg {
    width: 36px;
    height: 36px;
  }

  body[data-nav] .brand-mark img {
    height: 40px;
  }

  /* Like the reference layout: the cards sit in a comfortable centered
     column inside the main area, while the shell itself stays full-bleed. */
  body[data-nav] .topbar {
    grid-area: topbar;
    position: static;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 24px 32px 4px;
    border-bottom: none;
  }

  body[data-nav] .topbar h1 {
    font-size: 20px;
  }

  body[data-nav] .content {
    grid-area: content;
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    padding: 10px 32px 32px;
  }

  /* nav → vertical sidebar (RTL: right column, divider on its left) */
  body[data-nav] .app-nav {
    grid-area: nav;
    flex-direction: column;
    align-items: stretch;
    justify-content: flex-start;
    height: 100%;
    background: var(--surface);
    border-top: none;
    border-left: 1px solid var(--border);
    padding: 20px 12px;
  }

  body[data-nav] .app-nav-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
  }

  /* The secondary group (account / admin / logout) sinks to the bottom. */
  body[data-nav] .app-nav-bottom {
    margin-top: auto;
    border-top: 1px solid var(--border);
    padding-top: 10px;
  }

  body[data-nav] .app-nav-item {
    flex-direction: row;
    justify-content: flex-start;
    gap: 12px;
    min-width: 0;
    font-size: 13.5px;
    padding: 11px 12px;
    border-radius: 10px;
  }

  body[data-nav] .app-nav-item svg {
    width: 20px;
    height: 20px;
  }

  body[data-nav] .app-nav-item.active {
    background: rgba(110, 92, 247, 0.12);
  }

  /* Logout is a real sidebar row on desktop (web-login sessions only). */
  body[data-nav] .app-nav-logout {
    display: flex;
    color: var(--danger);
  }

  /* The FAB becomes a full-width "new request" button inside the top group. */
  body[data-nav] .app-nav-fab {
    width: 100%;
    height: auto;
    margin: 6px 0 0;
    border: none;
    border-radius: 10px;
    box-shadow: none;
    padding: 12px;
    gap: 8px;
    font-size: 13.5px;
  }

  body[data-nav] .app-nav-fab-label {
    display: inline;
  }

  /* Stats spread into a single clean 4-across row instead of the phone's
     2+1 arrangement. */
  body[data-nav="home"] .player-stat-grid {
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
  }

  body[data-nav="home"] .player-stat-card.stat-total {
    grid-row: auto;
    grid-column: auto;
  }

  body[data-nav="home"] .player-stat-card.stat-closed {
    grid-column: auto;
  }

  /* Recent tickets fill the wide panel as a 2-up grid instead of one long
     narrow column. The header row, empty-state and archive link still span
     the full width. */
  body[data-nav="home"] .content .panel {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px 12px;
    align-content: start;
  }

  body[data-nav="home"] .content .panel > .panel-header-row,
  body[data-nav="home"] .content .panel > .empty-state,
  body[data-nav="home"] .content .panel > .archive-link {
    grid-column: 1 / -1;
  }

  body[data-nav="home"] .content .ticket-card {
    margin-bottom: 0;
  }
}

.form {
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}

input,
select,
textarea {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  color: var(--text);
  font-family: inherit;
  font-size: 14px;
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  outline: none;
  border-color: var(--accent);
}

.btn-primary {
  background: var(--accent-grad);
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 14px;
  font-size: 15px;
  font-family: inherit;
  cursor: pointer;
}

.btn-primary:active {
  filter: brightness(1.12);
}

.btn-small {
  padding: 10px 16px;
  font-size: 14px;
}

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 13px;
  cursor: pointer;
}

.form-error {
  color: var(--danger);
  font-size: 13px;
  min-height: 18px;
}

.ticket-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 16px;
}

.meta-line {
  font-size: 12px;
  color: var(--text-muted);
}

.chat {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
}

.bubble-mine {
  align-self: flex-start;
  background: var(--accent);
  color: #fff;
  border-bottom-left-radius: 4px;
}

.bubble-theirs {
  align-self: flex-end;
  background: var(--surface);
  border: 1px solid var(--border);
  border-bottom-right-radius: 4px;
}

.bubble-sender {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 4px;
}

.bubble-time {
  font-size: 10px;
  opacity: 0.7;
  margin-top: 4px;
}

.ticket-actions {
  display: flex;
  gap: 10px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.composer {
  /* Normal flex-flow item (not position: fixed) so it can never end up
     misplaced when Telegram's WebView resizes for the on-screen keyboard -
     it just sits at the bottom of .app's flex column, right above the
     keyboard, and never overlaps or jumps. */
  flex-shrink: 0;
  display: flex;
  gap: 10px;
  padding: 12px 16px;
  padding-bottom: calc(12px + env(safe-area-inset-bottom));
  background: var(--bg);
  border-top: 1px solid var(--border);
}

/* Visible confirmation that a file is actually queued to send - without
   this, selecting a file only changed the paperclip icon's tint by a few
   shades, easy to miss entirely and looked like "nothing happened". */
.pending-attachment-preview {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 12.5px;
}

/* [hidden] and a plain class selector have equal CSS specificity - without
   this, "display: flex" above always won the cascade regardless of the
   hidden attribute, so the preview box never actually hid itself. */
.pending-attachment-preview[hidden] {
  display: none;
}

.pending-attachment-preview span:nth-child(2) {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.pending-attachment-preview button {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 15px;
  cursor: pointer;
  padding: 0 4px;
}

.pending-attachment-icon,
.attachment-chip-icon {
  display: flex;
  flex-shrink: 0;
}

.pending-attachment-icon svg,
.attachment-chip-icon svg {
  width: 15px;
  height: 15px;
}

/* Telegram's in-app WebView doesn't support window.prompt() (silently
   no-ops) - this is the shared promptModal() replacement (see api.js). */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  width: 100%;
  max-width: 380px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.modal-box h3 {
  margin: 0;
  font-size: 15px;
}

.modal-box textarea,
.modal-box input {
  width: 100%;
}

.modal-box .field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.modal-box .field label {
  font-size: 12.5px;
  color: var(--text-muted);
}

.modal-actions {
  display: flex;
  gap: 10px;
  justify-content: flex-end;
}

.composer {
  align-items: flex-end;
}

.composer textarea {
  flex: 1;
  max-height: 100px;
  border-radius: 20px;
  padding: 10px 16px;
}

/* Telegram-style circular send button (the SVG lives in ticket.html) */
.composer .send-btn {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border: none;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.composer .send-btn svg {
  width: 19px;
  height: 19px;
}

.composer .send-btn:active {
  transform: scale(0.92);
}

/* --- Registration gate --- */

.gate {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 32px 24px;
  gap: 10px;
}

.gate-icon {
  margin-bottom: 8px;
  color: var(--accent);
}

.gate-icon svg {
  width: 42px;
  height: 42px;
}

.gate h2 {
  margin: 0;
  font-size: 18px;
}

.gate p {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  line-height: 1.8;
  max-width: 320px;
}

.gate-hint {
  color: var(--text) !important;
}

.gate .btn-primary {
  margin-top: 14px;
  padding: 12px 32px;
}

/* --- Account page --- */

.account-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 24px 16px 28px;
}

.account-avatar {
  width: 72px;
  height: 72px;
  border-radius: 50%;
  background: var(--accent-grad);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 30px;
  font-weight: 500;
}

.account-name {
  font-size: 17px;
  font-weight: 500;
  margin-top: 4px;
}

.account-role-badge {
  background: rgba(110, 92, 247, 0.14);
  color: var(--accent-hover);
}

.account-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 13.5px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.account-row:first-child {
  padding-top: 0;
}

.account-row-label {
  color: var(--text-muted);
}

/* --- Premium empty state --- */

.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  padding: 56px 24px 24px;
}

.empty-state-icon {
  width: 84px;
  height: 84px;
  border-radius: 50%;
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 12px;
}

.empty-state-icon svg {
  width: 36px;
  height: 36px;
}

.empty-state h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
}

.empty-state p {
  margin: 0;
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.9;
  max-width: 280px;
}

.empty-state .btn-primary {
  margin-top: 20px;
  width: 100%;
  max-width: 280px;
  padding: 16px;
  font-size: 15px;
  font-weight: 600;
  border-radius: 14px;
  box-shadow: 0 10px 24px rgba(110, 92, 247, 0.35);
}

/* --- Wizard --- */

.wizard-progress {
  display: flex;
  gap: 6px;
  margin-bottom: 24px;
}

.wizard-progress-step {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--surface-2);
}

.wizard-progress-step.done,
.wizard-progress-step.active {
  background: var(--accent);
}

.wizard-step-title {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.wizard-step-heading {
  font-size: 18px;
  font-weight: 600;
  margin: 0 0 20px;
}

.wizard-nav {
  display: flex;
  gap: 10px;
  margin-top: 24px;
}

.wizard-nav .btn-primary {
  flex: 1;
}

.wizard-nav .btn-secondary {
  flex: 0 0 auto;
}

.identity-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  gap: 10px;
}

.identity-card-name {
  font-size: 15px;
  font-weight: 600;
}

.identity-card-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-bottom: 2px;
}

.identity-edit-btn {
  background: none;
  border: none;
  color: var(--accent);
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}

.option-cards {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.option-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  cursor: pointer;
  text-align: right;
}

.option-card.selected {
  border-color: var(--accent);
  background: rgba(110, 92, 247, 0.1);
}

.option-card-icon {
  display: flex;
  color: var(--accent-hover);
}

.option-card-icon svg {
  width: 20px;
  height: 20px;
}

.option-card-label {
  font-size: 14px;
  flex: 1;
}

.priority-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.priority-card {
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 14px;
  text-align: center;
  cursor: pointer;
  background: var(--surface);
  font-size: 13.5px;
}

.priority-card.selected {
  border-color: var(--accent);
  background: rgba(110, 92, 247, 0.1);
}

.priority-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin: 0 auto 8px;
}

.priority-low .priority-dot { background: #38bdf8; }
.priority-medium .priority-dot { background: #facc15; }
.priority-high .priority-dot { background: #fb923c; }
.priority-urgent .priority-dot { background: #ef4444; }

.dropzone {
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 28px 16px;
  text-align: center;
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
}

.dropzone.dragover {
  border-color: var(--accent);
  background: rgba(110, 92, 247, 0.06);
  color: var(--text);
}

.dropzone-icon {
  display: flex;
  justify-content: center;
  color: var(--text-muted);
  margin-bottom: 8px;
}

.dropzone-icon svg {
  width: 28px;
  height: 28px;
}

.file-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 14px;
}

.file-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.file-item-icon {
  display: flex;
  color: var(--text-muted);
}

.file-item-icon svg {
  width: 18px;
  height: 18px;
}

.file-item-info {
  flex: 1;
  min-width: 0;
}

.file-item-name {
  font-size: 13px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.file-item-size {
  font-size: 11px;
  color: var(--text-muted);
}

.file-item-remove {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 16px;
  cursor: pointer;
  flex-shrink: 0;
}

.file-item-progress {
  height: 3px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
  margin-top: 4px;
}

.file-item-progress-bar {
  height: 100%;
  background: var(--accent);
  width: 0%;
  transition: width 0.2s;
}

.summary-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 13.5px;
  border-bottom: 1px solid var(--border);
  padding-bottom: 12px;
}

.summary-row-label {
  color: var(--text-muted);
  flex-shrink: 0;
}

.summary-row-value {
  text-align: left;
  word-break: break-word;
}

.status-banner {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 16px;
  text-align: center;
  margin-bottom: 18px;
}

.status-banner p {
  margin: 6px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.8;
}

.attachment-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(255, 255, 255, 0.08);
  border: none;
  border-radius: 10px;
  padding: 6px 10px;
  margin-top: 6px;
  font-size: 12.5px;
  text-decoration: none;
  color: inherit;
  font-family: inherit;
  cursor: pointer;
  width: 100%;
  text-align: right;
}

.attachment-chip:disabled {
  opacity: 0.7;
  cursor: default;
}

.attachment-send-hint {
  margin-right: auto;
  color: var(--accent);
  font-size: 11px;
}

.bubble-mine .attachment-send-hint {
  color: rgba(255, 255, 255, 0.85);
}

.bubble-theirs .attachment-chip {
  background: var(--surface-2);
}

.attachment-media {
  display: block;
  max-width: 260px;
  max-height: 320px;
  border-radius: 10px;
  margin-top: 6px;
  background: var(--surface-2);
  overflow: hidden;
}

.attachment-media img,
video.attachment-media {
  display: block;
  width: 100%;
  max-height: 320px;
  border-radius: 10px;
  object-fit: contain;
}
