:root {
  --bg-body: #0f111a;
  --bg-card: #181b29;
  --bg-soft: #202438;
  --bg-input: #121420;
  --border-color: #2b304c;
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --brand-primary: #6366f1;
  --brand-hover: #4f46e5;
  --brand-light: rgba(99, 102, 241, 0.15);
  --success: #10b981;
  --success-bg: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --warning-bg: rgba(245, 158, 11, 0.12);
  --danger: #ef4444;
  --danger-bg: rgba(239, 68, 68, 0.12);
  --radius-lg: 16px;
  --radius-md: 12px;
  --radius-sm: 8px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: -apple-system, BlinkMacSystemFont, "IRANSans", "Vazirmatn", "Segoe UI", Roboto, sans-serif;
  background: var(--bg-body);
  color: var(--text-main);
  direction: rtl;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
}

.container {
  max-width: 1680px;
  width: 95%;
  margin: 0 auto;
  padding: 24px 20px;
}

/* Header */
.topbar {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border-color);
  padding: 14px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}
.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 18px;
  font-weight: 900;
  color: var(--text-main);
  text-decoration: none;
}
.brand-badge {
  background: var(--brand-light);
  color: var(--brand-primary);
  font-size: 12px;
  padding: 3px 10px;
  border-radius: 999px;
  font-weight: 700;
}

/* Cards & Layout */
.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 20px;
  margin-bottom: 24px;
}
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 22px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
}
.card-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-color);
}
.card-title {
  font-size: 16px;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
}
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-primary { background: var(--brand-light); color: var(--brand-primary); }

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 13px;
  border: none;
  cursor: pointer;
  text-decoration: none;
  transition: all 0.2s ease;
  font-family: inherit;
}
.btn-primary { background: var(--brand-primary); color: #fff; }
.btn-primary:hover { background: var(--brand-hover); }
.btn-ghost { background: var(--bg-soft); color: var(--text-main); border: 1px solid var(--border-color); }
.btn-ghost:hover { background: var(--border-color); }
.btn-success { background: var(--success); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; font-size: 12px; border-radius: 6px; }
.btn-xs { padding: 3px 8px; font-size: 11px; border-radius: 4px; }

/* Forms */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
}
.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.field.full { grid-column: 1 / -1; }
.field label {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted);
}
.input, .textarea {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 13px;
  width: 100%;
  transition: border-color 0.2s;
}
.input:focus, .textarea:focus {
  outline: none;
  border-color: var(--brand-primary);
}
.ltr { direction: ltr; text-align: left; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; }

/* Tables */
.table-wrap {
  overflow-x: auto;
  margin-top: 10px;
  border-radius: var(--radius-md);
  -webkit-overflow-scrolling: touch;
}
.table {
  width: 100%;
  border-collapse: collapse;
  text-align: right;
  font-size: 13px;
}
.table th {
  background: var(--bg-soft);
  color: var(--text-muted);
  padding: 12px 14px;
  font-weight: 700;
  border-bottom: 1px solid var(--border-color);
  white-space: nowrap;
}
.table td {
  padding: 14px;
  border-bottom: 1px solid var(--border-color);
  vertical-align: middle;
  white-space: nowrap;
}
.table tr:hover td { background: rgba(255, 255, 255, 0.02); }

/* Progress bar */
.progress-bar-bg {
  width: 100%;
  height: 8px;
  background: var(--bg-soft);
  border-radius: 999px;
  overflow: hidden;
  margin: 10px 0;
  border: 1px solid var(--border-color);
}
.progress-bar-fill {
  height: 100%;
  background: var(--brand-primary);
  border-radius: 999px;
  transition: width 0.4s ease;
}

/* Alert boxes */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.alert-success { background: var(--success-bg); color: var(--success); border: 1px solid rgba(16, 185, 129, 0.3); }
.alert-danger { background: var(--danger-bg); color: var(--danger); border: 1px solid rgba(239, 68, 68, 0.3); }

/* Copy box */
.copy-box {
  display: flex;
  align-items: center;
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 6px 12px;
  gap: 8px;
}
.copy-box code {
  flex: 1;
  font-size: 12.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--brand-primary);
}

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

/* Public Portal & Support Tools */
.portal-header {
  text-align: center;
  padding: 40px 20px 24px;
}
.portal-title {
  font-size: 30px;
  font-weight: 900;
  margin-bottom: 12px;
  color: #ffffff;
}
.portal-subtitle {
  color: var(--text-muted);
  max-width: 650px;
  margin: 0 auto 28px;
  font-size: 15px;
  line-height: 1.8;
}

.software-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  gap: 24px;
  margin-bottom: 40px;
}
.software-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 8px 30px rgba(0, 0, 0, 0.25);
}
.software-card:hover {
  transform: translateY(-5px);
  border-color: rgba(99, 102, 241, 0.5);
  box-shadow: 0 16px 40px rgba(99, 102, 241, 0.12);
}
.software-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--brand-primary), #a855f7);
  opacity: 0;
  transition: opacity 0.3s ease;
}
.software-card:hover::before,
.software-card.featured::before {
  opacity: 1;
}

.software-head {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 18px;
}
.software-icon-wrap {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 10px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  flex-shrink: 0;
}
.software-icon-wrap img, .software-icon-wrap svg {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
}
.software-meta h2 {
  font-size: 19px;
  font-weight: 800;
  color: var(--text-main);
  margin-bottom: 4px;
}
.software-desc {
  color: var(--text-muted);
  font-size: 13.5px;
  line-height: 1.7;
  margin-bottom: 20px;
  flex: 1;
}
.software-features {
  list-style: none;
  padding: 0;
  margin: 0 0 24px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.software-features li {
  font-size: 12.5px;
  color: var(--text-main);
  display: flex;
  align-items: center;
  gap: 8px;
}
.software-features li svg {
  color: var(--success);
  flex-shrink: 0;
}
.software-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: auto;
}
.btn-download {
  background: linear-gradient(135deg, #6366f1, #4f46e5);
  color: #fff;
  padding: 12px 20px;
  font-size: 13.5px;
  font-weight: 800;
  border-radius: var(--radius-md);
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  box-shadow: 0 4px 14px rgba(99, 102, 241, 0.35);
  transition: all 0.2s;
}
.btn-download:hover {
  background: linear-gradient(135deg, #4f46e5, #4338ca);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(99, 102, 241, 0.45);
}
.btn-sub-download {
  background: var(--bg-soft);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  padding: 8px 14px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  text-align: center;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}
.btn-sub-download:hover {
  background: var(--border-color);
}

/* Steps section */
.guide-box {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 32px;
  margin-bottom: 40px;
}
.guide-title {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 24px;
  text-align: center;
}
.steps-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 20px;
}
.step-item {
  background: var(--bg-soft);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: center;
  position: relative;
}
.step-num {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--brand-primary);
  color: #fff;
  font-weight: 900;
  font-size: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 12px;
}
.step-item h3 {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 6px;
}
.step-item p {
  font-size: 12.5px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Search bar and table tools in admin */
.table-header-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 14px;
}
.search-box-input {
  background: var(--bg-input);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  color: var(--text-main);
  padding: 8px 14px;
  font-size: 13px;
  width: 260px;
  max-width: 100%;
}
.search-box-input:focus {
  outline: none;
  border-color: var(--brand-primary);
}