/* ==========================================================================
   NEXTRA CLOUD - DESIGN SYSTEM (Vercel / Geist inspired)
   اصول: پس‌زمینه‌ی مشکی ساده، بوردرهای hairline کم‌کنتراست، بدون glow و گرادیان،
   دکمه‌های کوچک با ارتفاع ثابت، تایپوگرافی Geist (لاتین) + Vazirmatn (فارسی).
   ========================================================================== */

:root {
  /* Surfaces */
  --bg-page: #000000;
  --bg-sidebar: #000000;
  --bg-card: #0a0a0a;
  --bg-card-hover: #111111;
  --bg-surface: #111111;
  --bg-input: #0a0a0a;
  --bg-active: #1a1a1a;

  /* Borders (hairline) */
  --border-subtle: #1f1f1f;
  --border-default: #2e2e2e;
  --border-hover: #454545;

  /* Text */
  --text-primary: #ededed;
  --text-secondary: #a1a1a1;
  --text-muted: #8f8f8f;
  --text-inverse: #000000;

  /* Accents - فقط برای وضعیت‌ها و لینک‌های خاص */
  --accent-white: #ffffff;
  --accent-cyan: #52a8ff;
  --accent-success: #3ecf8e;
  --accent-warning: #f5a524;
  --accent-error: #ef4444;

  /* Geometry */
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
  --radius-xl: 12px;
  --radius-full: 9999px;

  /* Typography: حروف لاتین از Geist و فارسی به‌طور خودکار از Vazirmatn */
  --font-sans: 'Geist', 'Vazirmatn', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'Geist Mono', 'Fira Code', ui-monospace, SFMono-Regular, Menlo, monospace;

  /* Motion */
  --ease-smooth: cubic-bezier(0.16, 1, 0.3, 1);
  --transition-fast: 150ms ease;
  --transition-normal: 250ms var(--ease-smooth);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html {
  scroll-behavior: smooth;
}

body {
  background-color: var(--bg-page);
  color: var(--text-primary);
  font-family: var(--font-sans);
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* دکمه‌ها و فیلدها به‌طور پیش‌فرض فونت سیستم می‌گیرند (نه فونت صفحه)؛
   همین باعث ناخوانا و ناهمگون شدن متن دکمه‌ها بود. */
button, input, select, textarea {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

::selection {
  background: rgba(255, 255, 255, 0.2);
}

:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.55);
  outline-offset: 2px;
}

.app-container {
  position: relative;
  min-height: 100vh;
}

/* ==========================================================================
   1. LANDING PAGE
   ========================================================================== */
.landing-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--border-subtle);
}

.landing-nav {
  max-width: 1080px;
  margin: 0 auto;
  height: 60px;
  padding: 0 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.brand-logo {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--text-primary);
  text-decoration: none;
}

.brand-logo img {
  height: 26px;
  width: auto;
}

.landing-links {
  display: flex;
  align-items: center;
  gap: 1.75rem;
}

.landing-links a {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color var(--transition-fast);
}

.landing-links a:hover {
  color: var(--text-primary);
}

.landing-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

/* Hero */
.hero-section {
  max-width: 900px;
  margin: 0 auto;
  padding: 7rem 1.5rem 6rem;
  text-align: center;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  height: 28px;
  padding: 0 0.875rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 2rem;
}

.live-pulse {
  width: 6px;
  height: 6px;
  background: var(--accent-success);
  border-radius: 50%;
}

.hero-title {
  font-size: clamp(2.25rem, 6vw, 3.75rem);
  font-weight: 700;
  line-height: 1.3;
  color: var(--accent-white);
  margin-bottom: 1.5rem;
}

.hero-subtitle {
  font-size: 1.0625rem;
  color: var(--text-secondary);
  max-width: 620px;
  margin: 0 auto 2.5rem;
  line-height: 2;
}

.hero-cta-group {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
}

/* Sections */
.section {
  border-top: 1px solid var(--border-subtle);
}

.section-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
}

.section-head {
  text-align: center;
  margin-bottom: 3.5rem;
}

.section-title {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 0.75rem;
}

.section-subtitle {
  color: var(--text-secondary);
  max-width: 560px;
  margin: 0 auto;
  font-size: 0.9375rem;
  line-height: 1.9;
}

/* شبکه‌ی hairline: خطوط جداکننده با gap:1px روی پس‌زمینه‌ی بوردر ساخته می‌شود
   تا بدون توجه به تعداد ستون‌ها (ریسپانسیو) همیشه تمیز بماند. */
.cells-grid {
  display: grid;
  gap: 1px;
  background: var(--border-subtle);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  overflow: hidden;
}

.cells-3 { grid-template-columns: repeat(3, 1fr); }

.cell {
  background: var(--bg-page);
  padding: 2rem 1.75rem;
}

.cell-icon {
  color: var(--text-primary);
  margin-bottom: 1.25rem;
}

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

.cell h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.cell p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.9;
}

.step-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border: 1px solid var(--border-default);
  border-radius: 50%;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

/* Pricing */
.pricing-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.plan-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  transition: border-color var(--transition-fast);
}

.plan-card:hover {
  border-color: var(--border-hover);
}

.plan-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.plan-price {
  font-size: 1.75rem;
  font-weight: 700;
  margin-top: 0.75rem;
  line-height: 1.3;
}

.plan-price small {
  font-size: 0.8125rem;
  font-weight: 400;
  color: var(--text-muted);
  margin-inline-start: 0.375rem;
}

.plan-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--text-secondary);
  font-size: 0.8125rem;
  margin-bottom: 1.25rem;
}

.plan-meta span + span::before {
  content: "";
  display: inline-block;
  width: 1px;
  height: 10px;
  background: var(--border-default);
  margin-inline-end: 0.75rem;
  vertical-align: middle;
}

.plan-card .btn {
  margin-top: auto;
  width: 100%;
}

/* Final CTA + Footer */
.cta-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 5.5rem 1.5rem;
  text-align: center;
}

.cta-inner h2 {
  font-size: clamp(1.5rem, 3.5vw, 2rem);
  font-weight: 700;
  line-height: 1.5;
  margin-bottom: 1.75rem;
}

.site-footer {
  border-top: 1px solid var(--border-subtle);
}

.site-footer-inner {
  max-width: 1080px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  color: var(--text-muted);
  font-size: 0.8125rem;
}

.site-footer a {
  color: var(--text-secondary);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--text-primary);
}

.landing-section-anchor {
  scroll-margin-top: 60px;
}

/* ==========================================================================
   2. DASHBOARD
   ========================================================================== */
.dashboard-layout {
  display: flex;
  min-height: 100vh;
  position: relative;
}

.sidebar {
  width: 240px;
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  position: fixed;
  top: 0;
  bottom: 0;
  left: 0;
  z-index: 90;
  transition: transform var(--transition-normal);
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 85;
}

.sidebar-header {
  height: 60px;
  padding: 0 1rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
}

.sidebar-menu {
  flex: 1;
  padding: 0.75rem 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow-y: auto;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  height: 36px;
  padding: 0 0.625rem;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  border: 0;
  border-radius: var(--radius-md);
  background: transparent;
  cursor: pointer;
  width: 100%;
  text-align: right;
  text-decoration: none;
  transition: background-color var(--transition-fast), color var(--transition-fast);
}

.sidebar-item svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-item:hover {
  color: var(--text-primary);
  background: var(--bg-card-hover);
}

.sidebar-item.active {
  color: var(--accent-white);
  background: var(--bg-active);
}

.sidebar-item.is-admin {
  color: #ff6b6b;
}

.sidebar-divider {
  height: 1px;
  background: var(--border-subtle);
  margin: 0.5rem 0.25rem;
}

.sidebar-footer {
  padding: 0.75rem;
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.user-profile-brief {
  display: flex;
  align-items: center;
  gap: 0.625rem;
  min-width: 0;
}

.user-avatar {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  border-radius: 50%;
  background: var(--bg-active);
  border: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.75rem;
  color: var(--text-primary);
}

.user-name {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-primary);
  line-height: 1.4;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.user-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  line-height: 1.4;
}

/* Main Workspace */
.main-workspace {
  flex: 1;
  margin-left: 240px;
  min-width: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.workspace-topbar {
  height: 60px;
  padding: 0 1.5rem;
  border-bottom: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 80;
}

.workspace-title {
  font-size: 0.9375rem;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.btn-sidebar-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  background: transparent;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  cursor: pointer;
  flex-shrink: 0;
}

.btn-sidebar-toggle svg {
  width: 16px;
  height: 16px;
}

.workspace-content {
  flex: 1;
  padding: 2rem;
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
}

/* List toolbar (search) */
.list-toolbar {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.search-field {
  position: relative;
  flex: 1;
}

.search-field svg {
  position: absolute;
  inset-inline-start: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: var(--text-muted);
  pointer-events: none;
}

.search-field input {
  width: 100%;
  height: 36px;
  padding: 0 2.5rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast);
}

.search-field input::placeholder {
  color: var(--text-muted);
}

.search-field input:focus {
  border-color: var(--text-muted);
}

/* Cards */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1rem;
}

.project-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  transition: border-color var(--transition-fast);
}

.project-card:hover {
  border-color: var(--border-hover);
}

.project-card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.project-name {
  font-size: 0.9375rem;
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.5;
}

.project-domain {
  display: inline-block;
  direction: ltr;
  unicode-bidi: isolate;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast);
}

.project-domain:hover {
  color: var(--text-primary);
}

.project-git-pill {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  min-width: 0;
  padding: 0.375rem 0.625rem;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-secondary);
  direction: ltr;
  text-align: left;
}

.project-git-pill svg {
  width: 14px;
  height: 14px;
  flex-shrink: 0;
}

.project-git-pill span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.project-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1rem;
}

.project-meta strong {
  font-weight: 500;
  color: var(--text-secondary);
}

.project-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: auto;
  padding-top: 1rem;
  border-top: 1px solid var(--border-subtle);
}

.project-actions .btn {
  flex: 1;
}

/* Status: نقطه‌ی رنگی + متن خنثی، مثل Vercel */
.status-pill {
  --dot: var(--text-muted);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  height: 24px;
  padding: 0 0.625rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 500;
  color: var(--text-secondary);
  text-transform: capitalize;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--dot);
}

.status-running { --dot: var(--accent-success); }
.status-building { --dot: #0070f3; }
.status-building::before { animation: status-pulse 1.4s ease-in-out infinite; }
.status-stopped { --dot: var(--accent-error); }
.status-setup { --dot: var(--accent-warning); }

@keyframes status-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* Billing: خلاصه‌ی موجودی + بسته‌های CU */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1rem;
  margin-bottom: 2rem;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
}

.stat-label {
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1.4;
  margin: 0.25rem 0;
}

.stat-value small {
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
}

.stat-sub {
  font-size: 0.75rem;
  color: var(--text-secondary);
}

.section-label {
  font-size: 0.9375rem;
  font-weight: 600;
  margin: 2rem 0 0.875rem;
}

.callout {
  font-size: 0.8125rem;
  line-height: 1.9;
  color: var(--text-secondary);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
  padding: 0.875rem 1rem;
  margin-bottom: 1rem;
}

.callout-warning {
  border-color: rgba(245, 165, 36, 0.5);
  background: rgba(245, 165, 36, 0.06);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.package-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 1rem;
}

.package-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1.125rem;
}

.package-card.is-inactive {
  opacity: 0.6;
}

.package-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.package-title {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  min-width: 0;
}

.package-name {
  font-size: 0.9375rem;
  font-weight: 600;
}

.package-source,
.package-tag {
  font-size: 0.6875rem;
  padding: 0.125rem 0.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  color: var(--text-secondary);
  white-space: nowrap;
}

.package-tag {
  color: var(--accent-cyan);
  border-color: rgba(82, 168, 255, 0.35);
}

.package-metric-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8125rem;
  margin-bottom: 0.5rem;
}

.package-metric-row > span:first-child {
  color: var(--text-muted);
}

.package-metric-sub {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.375rem;
}

.progress {
  height: 6px;
  border-radius: var(--radius-full);
  background: var(--bg-active);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--accent-white);
}

.progress-fill.is-time {
  background: var(--text-muted);
}

/* ==========================================================================
   Admin panel + tables + invoice
   ========================================================================== */
.tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 1.5rem;
  overflow-x: auto;
  overflow-y: hidden;
}

.tab {
  background: transparent;
  border: 0;
  border-bottom: 2px solid transparent;
  color: var(--text-secondary);
  padding: 0.625rem 0.875rem;
  font-size: 0.875rem;
  cursor: pointer;
  white-space: nowrap;
  margin-bottom: -1px;
  transition: color var(--transition-fast);
}

.tab:hover { color: var(--text-primary); }
.tab.active { color: var(--accent-white); border-bottom-color: var(--accent-white); }

.tab-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-inline-start: 0.375rem;
  border-radius: var(--radius-full);
  background: var(--accent-warning);
  color: #000;
  font-size: 0.6875rem;
  font-weight: 700;
}

.stat-grid-4 { grid-template-columns: repeat(4, 1fr); }
.stat-link { cursor: pointer; transition: border-color var(--transition-fast); }
.stat-link:hover { border-color: var(--border-hover); }

.section-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.filters .grow { flex: 1; min-width: 220px; }
.filters .filter-select, .filters .filter-input { width: auto; min-width: 140px; height: 36px; }

.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  margin-bottom: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.data-table th {
  text-align: right;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--bg-card);
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  white-space: nowrap;
}

.data-table td {
  padding: 0.625rem 0.875rem;
  border-bottom: 1px solid var(--border-subtle);
  vertical-align: middle;
}

.data-table tbody tr:last-child td { border-bottom: 0; }
.row-click { cursor: pointer; }
.row-click:hover td { background: var(--bg-card-hover); }

.nowrap { white-space: nowrap; }
.mono { font-family: var(--font-mono); font-size: 0.75rem; direction: ltr; unicode-bidi: isolate; }
.cell-main { font-weight: 500; }
.cell-sub { font-size: 0.75rem; color: var(--text-muted); }
.link { color: var(--accent-cyan); text-decoration: none; }
.link:hover { text-decoration: underline; }
.text-danger { color: #ff6b6b; }

.badge {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 0.5rem;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-full);
  font-size: 0.6875rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.badge-ok { color: var(--accent-success); border-color: rgba(62, 207, 142, 0.35); }
.badge-danger { color: #ff6b6b; border-color: rgba(239, 68, 68, 0.4); }
.badge-info { color: var(--accent-cyan); border-color: rgba(82, 168, 255, 0.35); }
.badge-admin { color: var(--accent-white); border-color: var(--accent-white); }
.status-neutral { --dot: var(--text-muted); }

.pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin: 0.75rem 0 1rem;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

.pagination-actions, .action-bar { display: flex; gap: 0.5rem; flex-wrap: wrap; }

.btn-danger {
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(239, 68, 68, 0.5);
}

.btn-danger:hover:not(:disabled) { background: rgba(239, 68, 68, 0.1); }

.modal-content.modal-wide { max-width: 960px; }

.modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.modal-title { font-size: 1.0625rem; font-weight: 600; }
.modal-sub { font-size: 0.8125rem; color: var(--text-secondary); margin-top: 0.25rem; }

.kv-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}

.kv-grid > div > span { display: block; font-size: 0.75rem; color: var(--text-muted); }
.kv-grid b { font-size: 0.875rem; font-weight: 500; }

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.inline-form { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; }
.inline-form .form-input, .inline-form .form-select { width: auto; height: 36px; min-width: 110px; }

.danger-zone {
  margin-top: 1.5rem;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-lg);
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.danger-zone p { font-size: 0.8125rem; color: var(--text-secondary); }
.danger-zone .form-input { min-width: 260px; }

.log-pre, .details-pre {
  direction: ltr;
  text-align: left;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 1rem;
  max-height: 60vh;
  overflow: auto;
}

.details-pre { max-height: 200px; padding: 0.5rem; margin-top: 0.375rem; }
.data-table summary { cursor: pointer; color: var(--accent-cyan); font-size: 0.75rem; }

.invoice-amount {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.375rem;
  text-align: center;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

.invoice-amount-value { font-size: 2rem; font-weight: 700; line-height: 1.4; }
.invoice-amount-value small { font-size: 0.875rem; font-weight: 400; color: var(--text-muted); }

.invoice-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.625rem 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.875rem;
}

.invoice-row > span { min-width: 80px; color: var(--text-muted); }
.invoice-row > b { flex: 1; font-weight: 500; }
.invoice-row .mono { font-size: 0.9375rem; letter-spacing: 0.05em; }
.invoice-timer { text-align: center; margin: 1rem 0; font-size: 0.875rem; color: var(--text-secondary); }


/* Support tickets */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  margin-inline-start: auto;
  border-radius: var(--radius-full);
  background: var(--accent-cyan);
  color: #000;
  font-size: 0.6875rem;
  font-weight: 700;
}

.nav-badge[hidden] { display: none; }

.unread-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-inline-end: 0.5rem;
  border-radius: 50%;
  background: var(--accent-cyan);
  vertical-align: middle;
}

.ticket-head { margin-bottom: 1.25rem; }
.ticket-title { font-size: 1.125rem; font-weight: 600; line-height: 1.6; }
.ticket-sub { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.5rem; }

.thread {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.bubble {
  max-width: 88%;
  padding: 0.75rem 1rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  background: var(--bg-card);
}

.bubble-user { align-self: flex-start; }
.bubble-support { align-self: flex-end; background: var(--bg-surface); border-color: var(--border-default); }
.bubble-note { align-self: stretch; max-width: 100%; border-style: dashed; border-color: rgba(245, 165, 36, 0.5); background: rgba(245, 165, 36, 0.06); }

.bubble-meta {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

.bubble-meta b { color: var(--text-secondary); font-weight: 500; }
.bubble-body { font-size: 0.875rem; line-height: 1.9; white-space: pre-wrap; word-break: break-word; }

.reply-box { display: flex; flex-direction: column; gap: 0.75rem; }
.form-textarea { height: auto; padding: 0.625rem 0.75rem; line-height: 1.8; resize: vertical; min-height: 96px; }
.reply-options { display: flex; flex-wrap: wrap; gap: 1.25rem; font-size: 0.8125rem; color: var(--text-secondary); }
.check { display: inline-flex; align-items: center; gap: 0.375rem; cursor: pointer; }

/* Empty state */
.empty-state {
  border: 1px dashed var(--border-default);
  border-radius: var(--radius-lg);
  padding: 4.5rem 1.5rem;
  text-align: center;
}

.empty-state-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  margin-bottom: 1.25rem;
}

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

.empty-state h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
}

.empty-state p {
  color: var(--text-secondary);
  font-size: 0.875rem;
  line-height: 1.9;
  max-width: 460px;
  margin: 0 auto 1.5rem;
}

/* ==========================================================================
   3. BUTTONS - ارتفاع ثابت، فونت صفحه، آیکون ۱۶px
   ========================================================================== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  height: 36px;
  padding: 0 0.875rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  line-height: 1;
  white-space: nowrap;
  cursor: pointer;
  text-decoration: none;
  transition: background-color var(--transition-fast), border-color var(--transition-fast), color var(--transition-fast);
}

.btn svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--accent-white);
  color: var(--text-inverse);
  border: 1px solid var(--accent-white);
}

.btn-primary:hover:not(:disabled) {
  background: #d4d4d4;
  border-color: #d4d4d4;
}

.btn-secondary {
  background: transparent;
  color: var(--text-primary);
  border: 1px solid var(--border-default);
}

.btn-secondary:hover:not(:disabled) {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.btn-sm {
  height: 32px;
  padding: 0 0.75rem;
  font-size: 0.8125rem;
}

.btn-icon {
  width: 32px;
  padding: 0;
}

.btn-lg {
  height: 44px;
  padding: 0 1.25rem;
  font-size: 0.9375rem;
  border-radius: var(--radius-lg);
}

/* ==========================================================================
   4. MODALS & FORMS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(8px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-normal);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal-content {
  background: var(--bg-card);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-xl);
  padding: 1.5rem;
  width: 100%;
  max-width: 480px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.6);
}

.form-group {
  margin-bottom: 1.125rem;
}

.form-label {
  display: block;
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
}

.form-input, .form-select, .input {
  width: 100%;
  height: 40px;
  padding: 0 0.75rem;
  background: var(--bg-input);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  font-size: 0.875rem;
  outline: none;
  transition: border-color var(--transition-fast), box-shadow var(--transition-fast);
}

textarea.form-input {
  height: auto;
  padding: 0.625rem 0.75rem;
}

.form-input::placeholder, .input::placeholder {
  color: var(--text-muted);
}

.form-input:focus, .form-select:focus, .input:focus {
  border-color: var(--text-muted);
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.08);
}

/* ==========================================================================
   5. UTILITIES: bidi isolation + skeleton loading
   ========================================================================== */

/* برای مقادیر لاتین/تکنیکال (username, IP, git URL) که وسط متن فارسی می‌آیند؛
   بدون این، الگوریتم bidi مرورگر متن را قاطی و کج نشان می‌دهد. */
.ltr-inline {
  direction: ltr;
  unicode-bidi: isolate;
  display: inline-block;
}

@keyframes skeleton-shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-surface) 25%, #1a1a1a 37%, var(--bg-surface) 63%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.4s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

.skeleton-text {
  height: 0.875rem;
  width: 60%;
  margin-bottom: 0.5rem;
}

.skeleton-text.w-40 { width: 40%; }
.skeleton-text.w-80 { width: 80%; }
.skeleton-text.w-100 { width: 100%; }

.skeleton-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.skeleton-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .skeleton, .status-building::before { animation: none; }
}

/* ==========================================================================
   6. RESPONSIVE
   ========================================================================== */
@media (max-width: 1100px) {
  .stat-grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
  .cells-3 { grid-template-columns: 1fr; }
  .pricing-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid, .stat-grid-4 { grid-template-columns: 1fr; }
  .kv-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  /* سایدبار off-canvas: با دکمه‌ی همبرگر در تاپ‌بار باز می‌شود */
  .sidebar {
    transform: translateX(-100%);
    box-shadow: 8px 0 24px rgba(0, 0, 0, 0.5);
  }

  .sidebar.mobile-open {
    transform: translateX(0);
  }

  .sidebar-backdrop.active {
    display: block;
  }

  .main-workspace {
    margin-left: 0;
  }

  .btn-sidebar-toggle {
    display: flex;
  }

  .workspace-topbar {
    padding: 0 0.75rem;
    gap: 0.5rem;
  }

  /* دکمه‌های تاپ‌بار روی موبایل فقط آیکون نشان می‌دهند */
  .btn-label-text {
    display: none;
  }

  .workspace-topbar .btn-sm {
    padding: 0;
    width: 32px;
  }

  .workspace-content {
    padding: 1.25rem 1rem;
  }

  .cards-grid,
  .package-list {
    grid-template-columns: 1fr;
  }

  .modal-content,
  .modal-content.modal-wide {
    max-width: calc(100vw - 1rem);
    padding: 1.25rem;
  }

  /* لندینگ */
  .landing-links {
    display: none;
  }

  .landing-nav {
    padding: 0 1rem;
  }

  .hero-section {
    padding: 4.5rem 1rem 4rem;
  }

  .hero-cta-group {
    flex-direction: column;
    align-items: stretch;
  }

  .section-inner, .cta-inner {
    padding: 3.5rem 1rem;
  }

  .section-head {
    margin-bottom: 2.5rem;
  }

  .pricing-grid {
    grid-template-columns: 1fr;
  }

  .site-footer-inner {
    padding: 1.5rem 1rem;
    flex-direction: column;
    align-items: flex-start;
  }
}

/* ==========================================================================
   Payment mailbox health, receipts and deposit matching
   ========================================================================== */
.callout-danger {
  border-color: rgba(239, 68, 68, 0.5);
  background: rgba(239, 68, 68, 0.06);
  color: var(--text-primary);
  margin-bottom: 1.5rem;
}

.health-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: var(--radius-full);
  margin-inline-end: 0.375rem;
  background: var(--text-muted);
}
.health-ok { background: var(--accent-success); }
.health-bad { background: #ff6b6b; }

.tabs-sub { margin-bottom: 1rem; }

.receipt-box {
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 0.875rem 1rem;
  margin-top: 1rem;
}
.receipt-title { font-size: 0.875rem; font-weight: 600; margin-bottom: 0.25rem; }
.receipt-box .action-bar { margin-top: 0.625rem; }

.receipt-grid { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 0.75rem; }
.receipt-grid:empty { display: none; }
.receipt-thumb {
  width: 96px;
  height: 96px;
  object-fit: cover;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  background: var(--bg-card);
  cursor: zoom-in;
}
.receipt-thumb.zoomed {
  width: 100%;
  height: auto;
  max-height: 70vh;
  object-fit: contain;
  cursor: zoom-out;
}

.deposit-options { display: flex; flex-direction: column; gap: 0.375rem; }
.deposit-option {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.625rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  cursor: pointer;
}
.deposit-option:hover { border-color: var(--border-strong, #3a3a3a); }
.deposit-suggested { border-color: rgba(62, 207, 142, 0.45); }

/* ==========================================================================
   Project management page
   ========================================================================== */
.project-card-link { cursor: pointer; }
.project-card-link:focus-visible { outline: 2px solid var(--accent-cyan); outline-offset: 2px; }
.project-domain-empty { color: var(--text-muted); font-family: inherit; direction: rtl; }
.card-title { font-size: 1rem; font-weight: 600; margin-bottom: 0.5rem; }
.gitea-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; align-items: start; }

.project-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}
.project-head-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.625rem; min-width: 0; }
.project-head-title h2 { font-size: 1.125rem; font-weight: 600; }

.copy-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid var(--border-subtle);
  min-width: 0;
}
.copy-row > span { min-width: 88px; color: var(--text-muted); font-size: 0.8125rem; flex-shrink: 0; }
.copy-row > code { flex: 1; min-width: 0; overflow-x: auto; white-space: nowrap; font-size: 0.8125rem; }

.env-value { max-width: 320px; overflow-wrap: anywhere; }

.log-toolbar { display: flex; align-items: center; flex-wrap: wrap; gap: 0.75rem; margin-bottom: 0.75rem; }

@media (max-width: 768px) {
  .gitea-grid { grid-template-columns: 1fr; }
  .project-head-title h2 { font-size: 1rem; }
  .copy-row { flex-wrap: wrap; }
  .copy-row > span { min-width: 100%; }
}

/* Announcement banners */
.callout-success {
  border-color: rgba(62, 207, 142, 0.4);
  background: rgba(62, 207, 142, 0.06);
  color: var(--text-primary);
}
#announcement-banners { max-width: 1200px; width: 100%; margin: 0 auto; padding: 1.25rem 2rem 0; }
#announcement-banners:empty { padding: 0; }
@media (max-width: 768px) {
  #announcement-banners { padding: 1rem 1rem 0; }
}
.announcement-banner { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.75rem; }
.announcement-banner > div:first-child { min-width: 0; }
.announcement-banner b { display: block; margin-bottom: 0.25rem; }
