:root {
  --color-primary: #0b4ea2;
  --color-primary-dark: #083a7c;
  --color-primary-light: #e7effa;
  --color-bg: #f3f5f9;
  --color-surface: #ffffff;
  --color-text: #0f1b2d;
  --color-muted: #64748b;
  --color-border: #e2e8f0;
  --color-amber-bg: #fef3c7;
  --color-amber-text: #92400e;
  --color-blue-bg: #dbeafe;
  --color-blue-text: #1e40af;
  --color-green-bg: #dcfce7;
  --color-green-text: #166534;
  --color-gray-bg: #f1f5f9;
  --color-gray-text: #475569;
  --radius-md: 12px;
  --radius-lg: 16px;
  --shadow-card: 0 1px 3px rgba(15, 27, 45, 0.08);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--color-bg);
  color: var(--color-text);
  -webkit-tap-highlight-color: transparent;
}

body {
  max-width: 640px;
  margin: 0 auto;
  min-height: 100vh;
  padding-bottom: 84px;
  position: relative;
}

a { color: inherit; text-decoration: none; }

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

.topbar h1 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  flex: 1;
  text-align: center;
}

.topbar .back-btn {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  display: flex;
}

.lang-toggle-btn {
  background: var(--color-primary-light);
  color: var(--color-primary);
  border: none;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.topbar .action-link {
  font-weight: 600;
  color: var(--color-primary);
  font-size: 14px;
  background: none;
  border: none;
  cursor: pointer;
}

.page { padding: 20px; }

h2.title {
  font-size: 28px;
  font-weight: 800;
  margin: 4px 0 8px;
  line-height: 1.2;
}

p.subtitle {
  color: var(--color-muted);
  font-size: 15px;
  line-height: 1.5;
  margin: 0 0 24px;
}

label.field-label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  margin: 0 0 8px;
}

.field-group { margin-bottom: 18px; }

.input-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
}

.input-wrap svg { flex-shrink: 0; color: var(--color-muted); }

.input-wrap input, .input-wrap select {
  border: none;
  outline: none;
  font-size: 16px;
  width: 100%;
  background: transparent;
  color: var(--color-text);
  font-family: inherit;
}

textarea {
  width: 100%;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  font-size: 16px;
  font-family: inherit;
  background: var(--color-surface);
  resize: vertical;
  min-height: 100px;
}

.row { display: flex; gap: 12px; }
.row > * { flex: 1; }

.btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  padding: 16px;
  border-radius: var(--radius-md);
  font-size: 16px;
  font-weight: 700;
  border: none;
  cursor: pointer;
  font-family: inherit;
}

.btn-primary { background: var(--color-primary); color: #fff; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-secondary { background: var(--color-primary-light); color: var(--color-primary); }
.btn-outline { background: var(--color-surface); color: var(--color-text); border: 1px solid var(--color-border); }

.btn-otp {
  width: auto;
  padding: 14px 18px;
  white-space: nowrap;
}

.hint { font-size: 13px; color: var(--color-muted); margin-top: 6px; }

.center-text { text-align: center; }
.link { color: var(--color-primary); font-weight: 700; }

.footer-note {
  text-align: center;
  font-size: 12px;
  color: var(--color-muted);
  margin-top: 28px;
  line-height: 1.6;
}

.footer-note a { text-decoration: underline; }

.alert {
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  margin-bottom: 16px;
}

.alert-error { background: #fee2e2; color: #991b1b; }
.alert-success { background: var(--color-green-bg); color: var(--color-green-text); }

/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 640px;
  background: var(--color-surface);
  border-top: 1px solid var(--color-border);
  display: flex;
  justify-content: space-around;
  align-items: center;
  padding: 10px 8px calc(10px + env(safe-area-inset-bottom));
  z-index: 20;
}

.bottom-nav a {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--color-muted);
  flex: 1;
  padding: 4px;
}

.bottom-nav a.active { color: var(--color-primary); }
.bottom-nav a.fab-slot { position: relative; }

.fab {
  position: absolute;
  top: -26px;
  left: 50%;
  transform: translateX(-50%);
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--color-primary);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 14px rgba(11, 78, 162, 0.4);
}

/* Home screen */
.home-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #f4d9c0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-primary-dark);
  flex-shrink: 0;
}

.home-header .greeting { flex: 1; }
.home-header .greeting h2 { margin: 0; font-size: 16px; font-weight: 700; }
.home-header .greeting p { margin: 2px 0 0; font-size: 13px; color: var(--color-muted); }

.bell-btn {
  position: relative;
  background: none;
  border: none;
  cursor: pointer;
}

.bell-dot {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 9px;
  height: 9px;
  background: var(--color-primary);
  border-radius: 50%;
  border: 2px solid var(--color-surface);
}

.search-bar {
  margin: 16px 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-md);
  padding: 12px 16px;
  color: var(--color-muted);
  font-size: 14px;
}

.section {
  padding: 24px 20px 0;
}

.section-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 14px;
}

.section-head h3 { margin: 0; font-size: 16px; font-weight: 700; }
.section-head .view-all { font-size: 13px; font-weight: 700; color: var(--color-primary); }

.category-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
}

.category-card {
  background: var(--color-surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--color-border);
  padding: 14px 4px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
}

.category-card .icon-badge {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--color-primary);
}

.promo-banner {
  background: linear-gradient(135deg, var(--color-primary), var(--color-primary-dark));
  border-radius: var(--radius-lg);
  color: #fff;
  padding: 22px;
  position: relative;
  overflow: hidden;
}

.promo-banner h3 { margin: 0 0 6px; font-size: 19px; }
.promo-banner p { margin: 0 0 16px; font-size: 13.5px; opacity: 0.92; max-width: 75%; }

.promo-btn {
  background: #fff;
  color: var(--color-primary);
  border: none;
  padding: 10px 18px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12.5px;
  letter-spacing: 0.3px;
  cursor: pointer;
}

/* Ticket cards */
.ticket-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-bottom: 14px;
}

.ticket-card .ticket-top {
  display: flex;
  align-items: center;
  gap: 12px;
}

.ticket-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--color-primary-light);
  color: var(--color-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.ticket-top .ticket-meta { flex: 1; min-width: 0; }
.ticket-meta .ticket-name { font-weight: 700; font-size: 15px; margin: 0 0 2px; }
.ticket-meta .ticket-id { font-size: 12px; color: var(--color-muted); margin: 0; }

.badge {
  font-size: 11px;
  font-weight: 700;
  padding: 5px 10px;
  border-radius: 999px;
  white-space: nowrap;
}

.badge-amber { background: var(--color-amber-bg); color: var(--color-amber-text); }
.badge-blue { background: var(--color-blue-bg); color: var(--color-blue-text); }
.badge-green { background: var(--color-green-bg); color: var(--color-green-text); }
.badge-gray { background: var(--color-gray-bg); color: var(--color-gray-text); }

.ticket-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--color-border);
  font-size: 13px;
  color: var(--color-muted);
}

.ticket-footer .track-link {
  color: var(--color-primary);
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 4px;
}

.stars { color: #f5a623; font-size: 14px; letter-spacing: 1px; }

/* Tabs */
.tabs {
  display: flex;
  gap: 22px;
  padding: 0 20px;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
}

.tab {
  padding: 14px 0;
  font-size: 14px;
  font-weight: 700;
  color: var(--color-muted);
  border-bottom: 2px solid transparent;
  cursor: pointer;
}

.tab.active { color: var(--color-primary); border-color: var(--color-primary); }

.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: var(--color-muted);
}

.loading-state { text-align: center; padding: 40px; color: var(--color-muted); font-size: 14px; }

.chip-group { display: flex; flex-wrap: wrap; gap: 10px; }

.chip {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  color: var(--color-text);
}

.chip.selected { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.date-chip {
  flex: 1;
  text-align: center;
  padding: 10px 6px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  cursor: pointer;
}

.date-chip .dow { font-size: 10px; color: var(--color-muted); font-weight: 700; text-transform: uppercase; }
.date-chip .dom { font-size: 17px; font-weight: 800; margin: 2px 0; }
.date-chip .label { font-size: 10px; color: var(--color-muted); }
.date-chip.selected { border-color: var(--color-primary); background: var(--color-primary-light); }
.date-chip.selected .dow, .date-chip.selected .dom { color: var(--color-primary); }

.slot-btn {
  padding: 14px;
  border-radius: 10px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  font-weight: 700;
  font-size: 13px;
  cursor: pointer;
  text-align: center;
}

.slot-btn.selected { background: var(--color-primary); color: #fff; border-color: var(--color-primary); }

.media-row { display: flex; gap: 10px; flex-wrap: wrap; }

.media-thumb {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  object-fit: cover;
  position: relative;
}

.media-tile {
  width: 76px;
  height: 76px;
  border-radius: 10px;
  border: 2px dashed var(--color-border);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  color: var(--color-primary);
  font-size: 10px;
  font-weight: 700;
  cursor: pointer;
  background: var(--color-primary-light);
}

.media-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: rgba(0,0,0,0.55);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  border: none;
  cursor: pointer;
}

.media-preview-wrap { position: relative; display: inline-block; }

/* Ticket detail progress */
.detail-card {
  background: var(--color-primary-light);
  border-radius: var(--radius-lg);
  padding: 20px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
}

.detail-card .eyebrow { font-size: 11px; font-weight: 700; color: var(--color-primary); letter-spacing: 0.4px; text-transform: uppercase; }
.detail-card .ticket-big-id { font-size: 24px; font-weight: 800; margin: 4px 0 14px; }
.detail-card .service-type-label { font-size: 12px; color: var(--color-muted); margin: 0 0 2px; }
.detail-card .service-type-value { font-size: 15px; font-weight: 700; }

.section-eyebrow {
  font-size: 12px;
  font-weight: 700;
  color: var(--color-muted);
  letter-spacing: 0.4px;
  text-transform: uppercase;
  margin: 24px 0 16px;
}

.progress-step { display: flex; gap: 14px; }

.progress-rail {
  display: flex;
  flex-direction: column;
  align-items: center;
}

.progress-dot {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-size: 13px;
}

.progress-dot.done { background: #22c55e; color: #fff; }
.progress-dot.active { background: var(--color-primary); color: #fff; }
.progress-dot.pending { background: #fff; border: 2px solid var(--color-border); }

.progress-line { width: 2px; flex: 1; background: var(--color-border); min-height: 24px; }
.progress-line.done { background: #22c55e; }

.progress-body { padding-bottom: 24px; flex: 1; }
.progress-body h4 { margin: 0 0 2px; font-size: 15px; font-weight: 700; }
.progress-body p { margin: 0; font-size: 13px; color: var(--color-muted); }

.info-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 16px;
  margin-top: 16px;
}

.info-card .eyebrow2 { font-size: 11px; font-weight: 700; color: var(--color-muted); letter-spacing: 0.4px; text-transform: uppercase; }

.tech-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; }
.tech-avatar { width: 46px; height: 46px; border-radius: 50%; background: var(--color-gray-bg); flex-shrink: 0; }
.tech-row .tech-name { font-weight: 700; font-size: 15px; margin: 0; }
.tech-row .tech-sub { font-size: 12px; color: var(--color-muted); margin: 2px 0 0; }

.star-picker { display: flex; justify-content: center; gap: 10px; font-size: 34px; color: var(--color-border); margin: 20px 0 6px; }
.star-picker .filled { color: var(--color-primary); }

@media (min-width: 480px) {
  body { border-left: 1px solid var(--color-border); border-right: 1px solid var(--color-border); }
}

/* RTL (Arabic) support */
html[dir="rtl"] {
  text-align: right;
}

html[dir="rtl"] .back-btn svg,
html[dir="rtl"] .track-link svg,
html[dir="rtl"] .icon-dir svg {
  transform: scaleX(-1);
}

/* Phone numbers, OTP codes and country codes stay LTR even in an RTL page */
html[dir="rtl"] .phone-row,
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] #otp-input {
  direction: ltr;
  text-align: right;
}

html[dir="rtl"] .footer-note a {
  margin: 0 2px;
}

/* Pull-to-refresh indicator (installed PWA mode lacks native browser pull-to-refresh) */
.ptr-indicator {
  position: fixed;
  top: 0;
  left: 50%;
  margin-left: -17px;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: var(--color-surface);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 999;
  opacity: 0;
  pointer-events: none;
}

.ptr-spinner {
  width: 16px;
  height: 16px;
  border: 2px solid var(--color-border);
  border-top-color: var(--color-primary);
  border-radius: 50%;
}

.ptr-indicator.ptr-loading .ptr-spinner {
  animation: ptr-spin 0.6s linear infinite;
}

@keyframes ptr-spin {
  to {
    transform: rotate(360deg);
  }
}
