/* بوابة تقديم طلبات الإقرارات — هوية النظام (كحلي + ذهبي + Tajawal) */
:root {
  --primary: #0e2133;
  --primary-mid: #1a3a57;
  --secondary: #235583;
  --accent: #dba227;
  --accent-soft: #e6b85c;
  --bg: #f8f9fa;
  --card: #ffffff;
  --text: #34495e;
  --text-muted: #7f8c8d;
  --border: #dee2e6;
  --success: #27ae60;
  --danger: #c0392b;
  --radius: 16px;
  --radius-sm: 10px;
  --shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 10px 10px -5px rgba(0, 0, 0, 0.04);
  --ui-font: 'Tajawal', Tahoma, 'Segoe UI', sans-serif;
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  direction: rtl;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--ui-font);
  color: var(--text);
  background-color: var(--bg);
  background-image: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%230e2133' fill-opacity='0.03'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 1.5rem 1rem 2.5rem;
}

a {
  color: var(--secondary);
  text-decoration: none;
}

a:hover {
  color: var(--primary);
}

.portal-wrap {
  width: min(520px, 100%);
  margin: 0 auto;
}

/* البطاقة — نمط verify */
.portal-card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
  position: relative;
  border-top: 5px solid var(--accent);
}

.card-header {
  background: linear-gradient(180deg, var(--primary) 0%, var(--primary-mid) 100%);
  padding: 1.75rem 1.25rem 2.25rem;
  text-align: center;
  color: #fff;
  position: relative;
  clip-path: polygon(0 0, 100% 0, 100% 85%, 50% 100%, 0 85%);
  margin-bottom: 0.5rem;
}

.logo-wrapper {
  background: #fff;
  width: 88px;
  height: 88px;
  border-radius: 50%;
  margin: 0 auto 0.85rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.12);
  border: 3px solid var(--accent);
}

.logo-wrapper img {
  width: 62%;
  height: auto;
  object-fit: contain;
}

.card-header .embassy-title {
  margin: 0;
  font-weight: 800;
  font-size: 1.15rem;
  letter-spacing: 0.3px;
  color: #fff;
}

.card-header .embassy-sub {
  margin: 0.3rem 0 0;
  font-size: 0.9rem;
  opacity: 0.88;
  font-weight: 400;
  color: #fff;
}

.card-body {
  padding: 1.25rem 1.5rem 1.75rem;
}

.portal-title {
  text-align: center;
  margin: 0 0 0.4rem;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
  line-height: 1.55;
}

.portal-sub {
  text-align: center;
  margin: 0 0 1.5rem;
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.65;
}

/* الأزرار */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.85rem 1.25rem;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  text-decoration: none;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
  width: 100%;
  box-shadow: 0 2px 4px rgba(14, 33, 51, 0.15);
}

.btn-primary:hover {
  background: var(--primary-mid);
  color: #fff;
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  width: 100%;
  margin-top: 0.35rem;
  font-weight: 600;
}

.btn-ghost:hover {
  color: var(--primary);
  background: rgba(14, 33, 51, 0.04);
}

.portal-phone {
  margin-top: 1.5rem;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.92rem;
}

.portal-phone strong a,
.portal-phone a {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.5px;
}

.portal-phone a:hover {
  color: var(--accent-soft);
}

/* شريط الخطوات */
.steps-bar {
  display: flex;
  gap: 0.4rem;
  margin-bottom: 1.35rem;
}

.steps-bar span {
  flex: 1;
  height: 4px;
  border-radius: 99px;
  background: var(--border);
  transition: background 0.25s ease;
}

.steps-bar span.active {
  background: var(--primary);
}

.steps-bar span.done {
  background: var(--accent);
}

.step-panel {
  display: none;
}

.step-panel.active {
  display: block;
}

.step-heading {
  margin: 0 0 1.15rem;
  font-size: 1.1rem;
  text-align: center;
  color: var(--primary);
  font-weight: 700;
}

/* الحقول */
.field {
  margin-bottom: 1rem;
}

.field label {
  display: block;
  margin-bottom: 0.4rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text);
}

.field label .req {
  color: var(--danger);
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.85rem;
  font-family: inherit;
  font-size: 1rem;
  background: #fff;
  color: var(--text);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(219, 162, 39, 0.22);
}

.field-error {
  margin-top: 0.35rem;
  color: var(--danger);
  font-size: 0.82rem;
  display: none;
}

.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
}

.field.has-error .field-error {
  display: block;
}

.passport-row {
  display: flex;
  gap: 0.5rem;
  direction: ltr;
}

.passport-row select {
  width: 4.5rem;
  flex-shrink: 0;
}

.passport-row input {
  flex: 1;
}

/* قائمة أنواع الإقرار */
.type-list {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  margin-bottom: 1.25rem;
  max-height: 55vh;
  overflow: auto;
  padding-left: 0.15rem;
}

.type-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.8rem 0.9rem;
  cursor: pointer;
  background: #fff;
  transition: var(--transition);
}

.type-option:hover {
  border-color: var(--secondary);
}

.type-option.selected {
  border-color: var(--accent);
  background: rgba(14, 33, 51, 0.05);
  box-shadow: 0 0 0 1px rgba(219, 162, 39, 0.35);
}

.type-option input {
  accent-color: var(--primary);
  width: auto;
}

/* المراجعة */
.review-box {
  background: rgba(14, 33, 51, 0.03);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.review-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--border);
  font-size: 0.95rem;
}

.review-row:last-child {
  border-bottom: none;
}

.review-row span:first-child {
  color: var(--text-muted);
  flex-shrink: 0;
}

.review-row span:last-child {
  font-weight: 600;
  text-align: left;
  word-break: break-word;
  color: var(--primary);
}

.form-actions {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  margin-top: 0.5rem;
}

/* تنبيهات */
.alert {
  border-radius: var(--radius-sm);
  padding: 0.75rem 0.9rem;
  margin-bottom: 1rem;
  font-size: 0.92rem;
}

.alert-error {
  background: #fdf2f2;
  color: var(--danger);
  border: 1px solid #f5c6cb;
}

.alert-info {
  background: rgba(35, 85, 131, 0.08);
  color: var(--secondary);
  border: 1px solid rgba(35, 85, 131, 0.2);
}

/* صفحة النجاح */
.success-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: rgba(39, 174, 96, 0.12);
  color: var(--success);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2rem;
  margin: 0.25rem auto 1rem;
  font-weight: 700;
  border: 2px solid rgba(39, 174, 96, 0.35);
}

.request-no-box {
  background: rgba(14, 33, 51, 0.03);
  border: 2px dashed var(--accent);
  border-radius: var(--radius-sm);
  padding: 1rem;
  text-align: center;
  margin: 1.15rem 0;
  font-size: 1.35rem;
  font-weight: 800;
  letter-spacing: 1px;
  direction: ltr;
  unicode-bidi: isolate;
  color: var(--primary);
}

.visit-info {
  text-align: center;
  color: var(--text-muted);
  line-height: 1.75;
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.visit-info strong {
  color: var(--text);
}

@media (max-width: 480px) {
  body {
    padding: 1rem 0.65rem 2rem;
  }

  .card-body {
    padding: 1rem 1.1rem 1.5rem;
  }

  .logo-wrapper {
    width: 76px;
    height: 76px;
  }
}

/* الصفحة الرئيسية */
.home-page {
  padding-top: 56px;
}

.home-hero {
  max-width: 680px;
  margin: 0 auto;
  padding: 42px;
  border: 1px solid var(--border);
  border-top: 5px solid var(--gold);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: var(--shadow-lg);
  text-align: center;
}

.home-mark {
  width: 92px;
  height: 92px;
  margin: 0 auto 18px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  box-shadow: 0 8px 24px rgba(14, 33, 51, 0.12);
}

.home-mark img {
  width: 58px;
  height: 58px;
}

.home-eyebrow {
  margin: 0 0 8px;
  color: var(--gold);
  font-size: 0.78rem;
  font-weight: 800;
}

.home-hero h2 {
  max-width: 520px;
  margin: 0 auto 14px;
  color: var(--navy);
  font-size: clamp(1.55rem, 4vw, 2.15rem);
  font-weight: 900;
  line-height: 1.35;
}

.home-lead {
  max-width: 580px;
  margin: 0 auto 28px;
  color: var(--text-mid);
  font-size: 0.95rem;
}

.home-cta {
  max-width: 320px;
  margin: 0 auto;
  padding: 14px 28px;
}

.home-steps {
  max-width: 680px;
  margin: 22px auto 0;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.home-steps article {
  padding: 20px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
  text-align: center;
}

.home-steps article > span {
  width: 30px;
  height: 30px;
  margin: 0 auto 10px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--gold-pale);
  color: var(--navy);
  font-weight: 900;
}

.home-steps h3 {
  margin: 0 0 4px;
  color: var(--navy);
  font-size: 0.88rem;
}

.home-steps p {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.74rem;
}

.home-contact {
  margin: 22px auto 0;
  text-align: center;
  color: var(--text-soft);
  font-size: 0.82rem;
}

.home-contact a {
  margin-right: 6px;
  color: var(--navy);
  direction: ltr;
  font-weight: 800;
}

@media (max-width: 640px) {
  .home-page {
    padding-top: 28px;
  }

  .home-hero {
    padding: 30px 20px;
  }

  .home-steps {
    grid-template-columns: 1fr;
  }
}

/* =====================================================================
   التخطيط الموسّع للبوابة — مطابق للنموذج المعتمد
   ===================================================================== */
:root {
  --navy: #0e2133;
  --navy-mid: #1c3a55;
  --navy-light: #2a5278;
  --gold: #dba227;
  --gold-light: #e6b85c;
  --gold-pale: #fdf5e2;
  --off-white: #f7f9fb;
  --text-mid: #4a6070;
  --text-soft: #8099ae;
  --success-bg: #eaf7f0;
  --error-bg: #fdf0ee;
  --radius-lg: 20px;
  --shadow-lg: 0 12px 48px rgba(14, 33, 51, 0.16);
}

body {
  display: block;
  padding: 0;
  background: var(--off-white);
  font-size: 15px;
  line-height: 1.6;
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 0;
  background: var(--navy);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.25);
}

.header-inner {
  max-width: 860px;
  margin: 0 auto;
  padding: 14px 24px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-logo {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  border: 2px solid rgba(219, 162, 39, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  overflow: hidden;
}

.header-logo img {
  width: 36px;
  height: 36px;
  object-fit: contain;
}

.header-text {
  flex: 1;
}

.header-title {
  margin: 0;
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.2;
  letter-spacing: 0.2px;
}

.header-sub {
  margin: 2px 0 0;
  color: var(--gold-light);
  font-size: 0.78rem;
  font-weight: 500;
}

.header-badge {
  padding: 4px 10px;
  border: 1px solid rgba(219, 162, 39, 0.35);
  border-radius: 999px;
  background: rgba(219, 162, 39, 0.15);
  color: var(--gold-light);
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.progress-bar {
  background: rgba(255, 255, 255, 0.07);
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}

.progress-inner.steps-bar {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  align-items: stretch;
  gap: 0;
}

.progress-inner .progress-step {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  height: auto;
  padding: 10px 0;
  position: relative;
  border-radius: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.75rem;
  font-weight: 600;
  transition: color 0.25s;
}

.progress-inner .progress-step + .progress-step::before {
  content: "";
  position: absolute;
  right: 100%;
  top: 50%;
  width: 20px;
  height: 1px;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.12);
}

.progress-inner .progress-step.active {
  background: transparent;
  color: var(--gold-light);
}

.progress-inner .progress-step.done {
  background: transparent;
  color: rgba(255, 255, 255, 0.55);
}

.progress-inner .step-dot {
  width: 22px;
  height: 22px;
  border: 2px solid currentColor;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 22px;
  background: transparent;
  color: inherit;
  font-size: 0.65rem;
  font-weight: 800;
}

.progress-inner .step-dot::after {
  content: attr(data-n);
}

.progress-inner .progress-step > span:last-child {
  flex: 0 1 auto;
  width: auto;
  height: auto;
  border-radius: 0;
  background: transparent;
}

.progress-inner .progress-step.active .step-dot {
  border-color: var(--gold);
  background: var(--gold);
  color: var(--navy);
}

.progress-inner .progress-step.done .step-dot {
  border-color: rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.15);
}

.progress-inner .progress-step.done .step-dot::after {
  content: "✓";
}

.main {
  max-width: 860px;
  min-height: calc(100vh - 190px);
  margin: 0 auto;
  padding: 32px 24px 80px;
}

.notice {
  padding: 14px 18px;
  margin-bottom: 28px;
  border: 1px solid rgba(219, 162, 39, 0.35);
  border-radius: var(--radius);
  background: var(--gold-pale);
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.notice-icon {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-weight: 900;
}

.notice-text {
  color: #7a5a00;
  font-size: 0.85rem;
  line-height: 1.55;
}

.notice-text strong {
  display: block;
  margin-bottom: 2px;
}

.form-card {
  margin-bottom: 20px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
  box-shadow: 0 4px 24px rgba(14, 33, 51, 0.1);
  overflow: hidden;
  animation: portalFadeIn 0.3s ease;
}

.form-card-header {
  padding: 20px 28px 18px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 14px;
}

.form-card-body {
  padding: 24px 28px;
}

.card-icon {
  width: 42px;
  height: 42px;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 18px;
}

.card-title {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
  font-weight: 800;
}

.card-subtitle {
  margin: 2px 0 0;
  color: var(--text-soft);
  font-size: 0.78rem;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.form-grid .field {
  margin: 0;
}

.form-grid .full,
.form-grid .alert {
  grid-column: 1 / -1;
}

.field label {
  margin-bottom: 6px;
  font-size: 0.83rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  padding: 10px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background-color: var(--off-white);
  font-size: 0.9rem;
}

.field select {
  appearance: none;
  padding-left: 36px;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='%238099ae' d='M6 8L0 0h12z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: left 14px center;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--navy-mid);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(28, 58, 85, 0.1);
}

.field.has-error input,
.field.has-error select {
  border-color: var(--danger);
  background-color: var(--error-bg);
}

.type-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  max-height: none;
  overflow: visible;
  padding: 0;
  margin-bottom: 0;
}

.type-option {
  min-height: 140px;
  padding: 16px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  background: var(--off-white);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-align: center;
  position: relative;
  user-select: none;
}

.type-option:hover {
  border-color: var(--navy-mid);
  background: #fff;
  box-shadow: 0 4px 24px rgba(14, 33, 51, 0.1);
  transform: translateY(-2px);
}

.type-option.selected {
  border-color: var(--gold);
  background: var(--gold-pale);
  box-shadow: 0 0 0 3px rgba(219, 162, 39, 0.18);
}

.type-option input[type="radio"] {
  position: absolute;
  width: 0;
  height: 0;
  opacity: 0;
}

.type-icon {
  font-size: 26px;
  line-height: 1;
}

.type-name {
  color: var(--text);
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1.3;
}

.type-desc {
  display: block;
  margin-top: 4px;
  color: var(--text-muted, #7f8c8d);
  font-size: 0.68rem;
  font-weight: 500;
  line-height: 1.35;
}

.type-check {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--gold);
  color: var(--navy);
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 900;
}

.type-option.selected .type-check {
  display: flex;
}

.review-box {
  padding: 20px;
  margin-bottom: 0;
  border-radius: var(--radius);
  background: var(--off-white);
}

.review-row {
  align-items: baseline;
  justify-content: flex-start;
  gap: 8px;
  padding: 8px 0;
}

.review-row span:first-child {
  min-width: 140px;
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 600;
}

.review-row span:last-child {
  color: var(--navy);
  font-size: 0.9rem;
  font-weight: 700;
  text-align: right;
}

.form-actions {
  margin-top: 28px;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 12px;
}

.form-actions .btn {
  width: auto;
  margin: 0;
  padding: 12px 24px;
}

.form-actions .btn-primary,
.form-actions .btn-submit {
  flex: 1;
}

.btn-primary {
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--navy-mid), var(--navy-light));
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(14, 33, 51, 0.25);
}

.btn-ghost {
  border: 1.5px solid var(--border);
  background: transparent;
  color: var(--text-mid);
}

.btn-ghost:hover {
  border-color: var(--text-mid);
  background: var(--off-white);
}

.btn-submit {
  background: linear-gradient(135deg, var(--success), #1d8a52);
  color: #fff;
  justify-content: center;
  font-size: 0.95rem;
  padding: 14px 28px;
}

.btn-submit:hover {
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 6px 20px rgba(26, 122, 74, 0.3);
}

.site-footer {
  padding: 20px 24px;
  background: var(--navy);
  color: rgba(255, 255, 255, 0.45);
  text-align: center;
  font-size: 0.76rem;
}

@keyframes portalFadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

@media (max-width: 640px) {
  .main {
    padding: 20px 16px 60px;
  }

  .header-inner,
  .progress-inner.steps-bar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .header-badge {
    display: none;
  }

  .progress-step > span:last-child {
    display: none;
  }

  .form-card-header,
  .form-card-body {
    padding: 18px;
  }

  .form-grid {
    grid-template-columns: 1fr;
  }

  .type-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .form-actions {
    flex-wrap: wrap;
  }

  .form-actions .btn-primary,
  .form-actions .btn-submit {
    min-width: 100%;
    order: -1;
  }
}

@media (max-width: 400px) {
  .type-list {
    grid-template-columns: 1fr;
  }

  .review-row {
    display: grid;
    gap: 2px;
  }

  .review-row span:first-child {
    min-width: 0;
  }
}

.category-list {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 8px;
}

.category-option {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  padding: 22px 14px 18px;
  border: 1.5px solid rgba(15, 45, 80, 0.12);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}

.category-option:hover {
  border-color: rgba(15, 45, 80, 0.28);
  box-shadow: 0 4px 14px rgba(15, 45, 80, 0.08);
}

.category-option.selected {
  border-color: var(--portal-navy, #0f2d50);
  background: rgba(15, 45, 80, 0.04);
  box-shadow: 0 0 0 1px var(--portal-navy, #0f2d50);
}

.category-option input[type="radio"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.category-option .category-desc {
  font-size: 0.82rem;
  color: #5a6a7a;
  line-height: 1.45;
}

@media (max-width: 640px) {
  .category-list {
    grid-template-columns: 1fr;
  }

  .progress-inner.steps-bar {
    gap: 4px;
  }
}


/* صفحة نجاح الطلب */
.success-page {
  text-align: center;
  padding-top: 48px;
}

.success-circle {
  width: 88px;
  height: 88px;
  margin: 0 auto 24px;
  border: 3px solid var(--success);
  background: var(--success-bg);
  color: var(--success);
  font-size: 38px;
  animation: successPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.success-title {
  margin: 0 0 8px;
  color: var(--navy);
  font-size: 1.5rem;
  font-weight: 900;
}

.success-subtitle {
  margin: 0 0 32px;
  color: var(--text-mid);
  font-size: 0.9rem;
}

.ticket {
  max-width: 420px;
  margin: 0 auto 32px;
  padding: 28px;
  position: relative;
  border: 2px dashed var(--border);
  border-radius: var(--radius-lg);
  background: #fff;
}

.ticket::before,
.ticket::after {
  content: "";
  position: absolute;
  top: 50%;
  width: 24px;
  height: 24px;
  border: 2px dashed var(--border);
  border-radius: 50%;
  background: var(--off-white);
  transform: translateY(-50%);
}

.ticket::before { right: -13px; }
.ticket::after { left: -13px; }

.ticket-label {
  margin: 0 0 10px;
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.8px;
}

.ticket-number {
  display: block;
  margin-bottom: 16px;
  color: var(--navy);
  direction: ltr;
  font-size: 2.75rem;
  font-weight: 900;
  letter-spacing: 3px;
  line-height: 1.15;
  padding: 12px 8px;
  border-radius: 12px;
  background: linear-gradient(180deg, #fff8e8 0%, #fff 100%);
  border: 2px solid var(--accent, #dba227);
  text-align: center;
}

.ticket-divider {
  margin: 16px 0;
  border: 0;
  border-top: 1px dashed var(--border);
}

.ticket-info {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  text-align: right;
}

.ticket-date {
  text-align: left;
}

.ticket-info-label,
.ticket-info-value {
  display: block;
}

.ticket-info-label {
  color: var(--text-soft);
  font-size: 0.75rem;
  font-weight: 600;
}

.ticket-info-value {
  color: var(--navy);
  font-size: 0.82rem;
  font-weight: 800;
}

.directions {
  max-width: 520px;
  margin: 0 auto 24px;
  padding: 20px 24px;
  border-radius: var(--radius);
  background: var(--navy);
  text-align: right;
}

.directions-title {
  margin: 0 0 12px;
  color: var(--gold-light);
  font-size: 0.8rem;
  font-weight: 800;
}

.directions-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 7px 0;
}

.directions-row + .directions-row {
  border-top: 1px solid rgba(255, 255, 255, 0.07);
}

.directions-icon {
  flex-shrink: 0;
  font-size: 16px;
}

.directions-text {
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.83rem;
}

.success-actions {
  max-width: 420px;
  margin: 0 auto;
  display: flex;
  gap: 12px;
}

.success-actions .btn {
  flex: 1;
  width: auto;
  margin: 0;
}

@keyframes successPop {
  from { transform: scale(0); opacity: 0; }
  to { transform: scale(1); opacity: 1; }
}

@media (max-width: 480px) {
  .success-page {
    padding-top: 32px;
  }

  .ticket-number {
    font-size: 2rem;
  }

  .success-actions {
    flex-direction: column;
  }

  .ticket-info {
    display: grid;
  }

  .ticket-date {
    text-align: right;
  }
}

/* =====================================================================
   ورقة A4 التفاعلية
   ===================================================================== */
.paper-sheet {
  max-width: 720px;
  margin: 0 auto 16px;
  padding: 28px 32px 24px;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
  box-shadow: 0 8px 32px rgba(14, 33, 51, 0.12);
  min-height: 640px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.paper-header.locked {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 14px;
  border-radius: 8px;
  background: rgba(14, 33, 51, 0.04);
  border: 1px dashed rgba(14, 33, 51, 0.18);
  pointer-events: none;
  user-select: none;
}

.paper-header img {
  width: 48px;
  height: 48px;
  object-fit: contain;
}

.paper-header strong {
  display: block;
  color: var(--navy);
  font-size: 0.95rem;
}

.paper-header span,
.paper-header em {
  display: block;
  color: var(--text-soft);
  font-size: 0.78rem;
  font-style: normal;
}

.paper-meta.locked {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 12px;
  border-radius: 6px;
  background: rgba(219, 162, 39, 0.08);
  border: 1px dashed rgba(219, 162, 39, 0.35);
  color: var(--text-mid);
  font-size: 0.82rem;
  font-weight: 700;
  pointer-events: none;
  user-select: none;
}

.paper-doc-title.locked {
  text-align: center;
  color: var(--navy);
  font-size: 1.05rem;
  font-weight: 900;
  pointer-events: none;
  user-select: none;
}

.paper-body {
  flex: 1;
  min-height: 220px;
  padding: 14px 16px;
  border: 1.5px solid var(--navy-mid);
  border-radius: 8px;
  background: #fffef8;
  color: var(--navy);
  font-size: 0.95rem;
  line-height: 1.85;
  outline: none;
  direction: rtl;
  text-align: right;
  white-space: pre-wrap;
  word-break: break-word;
}

.paper-body:focus {
  box-shadow: 0 0 0 3px rgba(28, 58, 85, 0.12);
  border-color: var(--gold);
}

.paper-readonly .paper-body {
  border-style: dashed;
  border-color: var(--border);
  background: var(--off-white);
  pointer-events: none;
}

.paper-footer.locked {
  padding: 12px;
  border-radius: 8px;
  background: rgba(14, 33, 51, 0.04);
  border: 1px dashed rgba(14, 33, 51, 0.18);
  pointer-events: none;
  user-select: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.paper-sign,
.paper-consul {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--text-mid);
  font-size: 0.8rem;
  font-weight: 700;
}

.paper-stamp {
  padding: 6px 10px;
  border: 1px dashed var(--text-soft);
  border-radius: 6px;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.paper-barcode-placeholder {
  text-align: center;
  color: var(--text-soft);
  font-size: 0.72rem;
}

.paper-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.char-counter {
  color: var(--text-soft);
  font-size: 0.8rem;
  font-weight: 700;
}

.char-counter.over {
  color: var(--danger);
}

.review-paper-heading {
  margin: 22px 0 12px;
  color: var(--navy);
  font-size: 0.95rem;
  font-weight: 800;
}

.review-paper-heading[hidden],
.paper-sheet[hidden] {
  display: none !important;
}

@media (max-width: 640px) {
  .paper-sheet {
    padding: 18px 14px;
    min-height: 0;
  }

  .paper-meta.locked,
  .paper-sign,
  .paper-consul {
    flex-direction: column;
  }

  .paper-toolbar {
    flex-wrap: wrap;
  }
}

/* حساب المواطن */
.auth-main { max-width: 720px; margin: 0 auto; }
.form-section-title {
  margin: 1.5rem 0 0.75rem;
  font-size: 1.05rem;
  color: var(--primary, #0e2133);
  border-bottom: 1px solid var(--border, #dee2e6);
  padding-bottom: 0.35rem;
}
.auth-actions { margin-top: 1.25rem; }
.auth-actions .btn-primary { width: 100%; }
.auth-switch {
  text-align: center;
  margin: 0.75rem 0 0;
  color: var(--text-muted, #7f8c8d);
  font-size: 0.95rem;
}
.phone-row { display: flex; gap: 8px; }
.phone-row select { max-width: 140px; flex-shrink: 0; }
.phone-row input { flex: 1; }
.home-cta-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  margin-top: 1.25rem;
}
.home-cta-secondary {
  border: 1.5px solid rgba(14, 33, 51, 0.2);
  color: var(--primary, #0e2133) !important;
  background: transparent;
}
.citizen-dash { max-width: 900px; margin: 0 auto; }
.citizen-actions {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 1.25rem;
}
.citizen-action-card {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 6px;
  padding: 18px 16px;
  border: 1.5px solid rgba(14, 33, 51, 0.12);
  border-radius: 14px;
  background: #fff;
  cursor: pointer;
  text-align: right;
  font: inherit;
  color: inherit;
  text-decoration: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.citizen-action-card:hover {
  border-color: var(--primary, #0e2133);
  box-shadow: 0 4px 14px rgba(14, 33, 51, 0.08);
  color: inherit;
}
.citizen-action-card.primary {
  background: linear-gradient(160deg, #0e2133 0%, #1a3a57 100%);
  color: #fff;
  border-color: transparent;
}
.citizen-action-card.primary:hover { color: #fff; }
.citizen-action-card .ca-icon { font-size: 1.4rem; }
.citizen-action-card .ca-title { font-weight: 700; font-size: 1.05rem; }
.citizen-action-card .ca-desc { font-size: 0.85rem; opacity: 0.8; }
.header-logout {
  color: #fff !important;
  border: 1px solid rgba(255, 255, 255, 0.35);
  margin-inline-start: auto;
}
.citizen-requests-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}
.citizen-requests-table th,
.citizen-requests-table td {
  padding: 10px 8px;
  border-bottom: 1px solid var(--border, #dee2e6);
  text-align: right;
}
.citizen-requests-table th {
  background: #f1f4f7;
  font-weight: 700;
}
.alert-warning {
  background: #fff8e6;
  border: 1px solid #e6c35c;
  color: #7a5b00;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 1rem;
}
.alert-success {
  background: #e8f8ef;
  border: 1px solid #27ae60;
  color: #1e7a45;
  padding: 12px 14px;
  border-radius: 10px;
  margin-bottom: 1rem;
}
input.locked-field,
select.locked-field {
  background: #f1f4f7 !important;
  cursor: default;
}

.citizen-identity-summary {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px 28px;
  margin-bottom: 22px;
  padding: 18px;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 12px;
  background: #f8fafc;
}

.citizen-identity-summary[hidden] {
  display: none;
}

#applicantInputFields[hidden] {
  display: none;
}

.citizen-identity-summary > div,
.profile-display-field {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.citizen-identity-summary span,
.profile-display-field label {
  color: var(--secondary, #235583);
  font-size: 0.88rem;
}

.citizen-identity-summary strong,
.profile-display-field strong {
  color: var(--primary, #0e2133);
  font-weight: 700;
}

.profile-display-field {
  min-height: 48px;
  padding: 10px 4px;
  border-bottom: 1px solid #edf0f3;
}

.muted { color: var(--text-muted, #7f8c8d); }
@media (max-width: 640px) {
  .citizen-actions { grid-template-columns: 1fr; }
  .citizen-identity-summary { grid-template-columns: 1fr; }
  .requests-table-wrap { overflow-x: auto; }
}

/* ???? ??????? + ????? ????? + ??????? */
.confirm-accuracy {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 18px 0 8px;
  padding: 14px 16px;
  border: 1.5px solid rgba(14, 33, 51, 0.15);
  border-radius: 12px;
  background: #f8fafc;
  cursor: pointer;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--primary, #0e2133);
}
.confirm-accuracy input {
  margin-top: 3px;
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  accent-color: var(--primary, #0e2133);
}
.referral-fee {
  margin-top: 18px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #fff8e8;
  border: 1px solid rgba(219, 162, 39, 0.45);
  text-align: center;
}
.referral-fee-value {
  display: block;
  margin-top: 4px;
  color: var(--navy, #0e2133);
  font-size: 1.35rem;
  font-weight: 900;
}
.referral-docs {
  margin-top: 18px;
  text-align: right;
}
.referral-section-title {
  margin: 0 0 10px;
  color: var(--navy, #0e2133);
  font-size: 0.95rem;
  font-weight: 800;
}
.referral-docs ul {
  margin: 0;
  padding: 0 1.2rem 0 0;
  color: var(--text, #34495e);
  line-height: 1.7;
}
.referral-docs li { margin-bottom: 4px; }
.referral-verify {
  margin-top: 18px;
  padding-top: 14px;
  border-top: 1px dashed var(--border, #dee2e6);
  text-align: center;
}
.referral-verify a {
  display: inline-block;
  margin-top: 4px;
  color: var(--secondary, #235583);
  font-weight: 800;
  direction: ltr;
  font-size: 1rem;
}
@media print {
  body {
    background: #fff !important;
    padding: 0 !important;
  }
  .no-print,
  .site-header,
  .site-footer,
  .success-actions,
  .directions {
    display: none !important;
  }
  .success-page {
    padding: 0 !important;
  }
  .ticket,
  .referral-sheet {
    box-shadow: none !important;
    border: 2px solid #0e2133 !important;
    max-width: 100% !important;
  }
  .ticket-number {
    font-size: 2.8rem !important;
  }
}

/* لوحة المواطن */
.citizen-dashboard-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 90% 5%, rgba(219, 162, 39, 0.1), transparent 25rem),
    var(--off-white, #f8f9fa);
}

.citizen-dashboard-header .header-inner {
  max-width: 1040px;
}

.citizen-header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-inline-start: auto;
}

.header-home-link,
.header-logout {
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid rgba(255, 255, 255, 0.24);
  border-radius: 9px;
  color: #fff !important;
  background: rgba(255, 255, 255, 0.06);
  font-family: inherit;
  font-size: 0.8rem;
  font-weight: 700;
  line-height: 1.2;
}

.header-home-link:hover,
.header-logout:hover {
  border-color: rgba(219, 162, 39, 0.75);
  background: rgba(219, 162, 39, 0.14);
}

.citizen-dash.main {
  width: 100%;
  max-width: 1040px;
  padding-top: 30px;
}

.citizen-actions {
  gap: 16px;
  margin-bottom: 24px;
}

.citizen-action-card {
  min-height: 138px;
  justify-content: center;
  padding: 22px 20px;
  border-radius: 16px;
  box-shadow: 0 4px 18px rgba(14, 33, 51, 0.07);
}

.citizen-action-card:not(.primary) {
  border-color: rgba(14, 33, 51, 0.1);
}

.citizen-action-card:not(.primary).active {
  border-color: var(--gold, #dba227);
  background: var(--gold-pale, #fff8e8);
  box-shadow: 0 0 0 3px rgba(219, 162, 39, 0.16);
}

.citizen-action-card.primary {
  position: relative;
  overflow: hidden;
}

.citizen-action-card.primary::after {
  content: "←";
  position: absolute;
  left: 20px;
  bottom: 16px;
  color: var(--gold-light, #f3d489);
  font-size: 1.25rem;
  font-weight: 900;
}

.citizen-action-card .ca-icon {
  display: inline-flex;
  width: 38px;
  height: 38px;
  align-items: center;
  justify-content: center;
  border-radius: 11px;
  background: rgba(14, 33, 51, 0.06);
  font-size: 1.2rem;
}

.citizen-action-card.primary .ca-icon {
  background: rgba(255, 255, 255, 0.12);
}

.citizen-action-card .ca-title {
  font-size: 1.08rem;
}

.dash-panel {
  border: 0;
  box-shadow: 0 8px 32px rgba(14, 33, 51, 0.09);
}

.dash-panel[hidden] {
  display: none !important;
}

.dash-panel .form-card-header {
  padding: 22px 26px;
  background: linear-gradient(180deg, #fff, #fbfcfd);
}

.dash-panel .form-card-body {
  padding: 26px;
}

.dash-panel .form-section-title {
  margin-top: 28px;
  padding: 10px 14px;
  border: 0;
  border-right: 4px solid var(--gold, #dba227);
  border-radius: 8px;
  background: #f8fafc;
}

.dash-panel .form-section-title:first-child {
  margin-top: 0;
}

.dash-panel .field label {
  display: block;
  color: var(--navy, #0e2133);
}

.dash-panel .field input,
.dash-panel .field select {
  width: 100%;
  min-height: 44px;
}

.dash-panel .field input:disabled {
  border-color: #e4e9ee;
  background: #edf1f4;
  color: #627181;
  opacity: 1;
}

.dash-panel .form-actions {
  padding-top: 18px;
  margin-top: 20px;
  border-top: 1px solid var(--border, #dee2e6);
}

.dash-panel .form-actions .btn {
  min-width: 180px;
}

.requests-table-wrap {
  width: 100%;
  overflow-x: auto;
  border: 1px solid var(--border, #dee2e6);
  border-radius: 12px;
}

.requests-table-wrap[hidden] {
  display: none !important;
}

.citizen-requests-table {
  min-width: 720px;
}

.citizen-requests-table th {
  padding: 13px 14px;
  background: var(--navy, #0e2133);
  color: #fff;
  font-size: 0.78rem;
  white-space: nowrap;
}

.citizen-requests-table td {
  padding: 14px;
  background: #fff;
  vertical-align: middle;
}

.citizen-requests-table tbody tr:nth-child(even) td {
  background: #fafbfc;
}

.citizen-requests-table tbody tr:hover td {
  background: #fffaf0;
}

.citizen-request-no {
  color: var(--navy, #0e2133);
  font-weight: 900;
  letter-spacing: 0.3px;
}

.citizen-category,
.citizen-status {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 800;
  white-space: nowrap;
}

.citizen-category {
  background: #edf3f8;
  color: var(--secondary, #235583);
}

.citizen-status.pending {
  background: #fff3cd;
  color: #806000;
}

.citizen-status.issued {
  background: #e8f8ef;
  color: #187744;
}

.citizen-status.rejected {
  background: #fdecec;
  color: #a72b2b;
}

#requestsLoading,
#requestsEmpty {
  padding: 36px 20px;
  border: 1px dashed var(--border, #dee2e6);
  border-radius: 12px;
  background: #fafbfc;
  text-align: center;
}

#formAlert:not([hidden]),
#passportWarn:not([hidden]) {
  margin-bottom: 18px;
}

@media (max-width: 760px) {
  .citizen-dashboard-header .header-inner {
    gap: 10px;
  }

  .citizen-header-actions {
    gap: 5px;
  }

  .header-home-link {
    display: none;
  }

  .header-logout {
    min-height: 34px;
    padding: 7px 10px;
    font-size: 0.72rem;
  }

  .citizen-dash.main {
    padding: 20px 14px 60px;
  }

  .citizen-actions {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .citizen-action-card {
    min-height: 96px;
    padding: 16px;
  }

  .dash-panel .form-card-header,
  .dash-panel .form-card-body {
    padding: 18px;
  }

  .dash-panel .form-grid {
    grid-template-columns: 1fr;
  }

  .dash-panel .form-actions .btn {
    width: 100%;
    min-width: 0;
  }

  .phone-row {
    flex-direction: column;
  }

  .phone-row select {
    width: 100%;
    max-width: none;
  }
}

@media (max-width: 430px) {
  .citizen-dashboard-header .header-logo {
    width: 42px;
    height: 42px;
  }

  .citizen-dashboard-header .header-title {
    font-size: 0.9rem;
  }

  .citizen-dashboard-header .header-sub {
    max-width: 150px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}
