/**
 * BaladiFix — بوابة الخدمات العامة
 * Government visual identity system (CSS only)
 * Palette: Syrian-inspired formal greens + reserved red for alerts
 */

/* -------------------------------------------------------------------------- */
/* Design tokens                                                              */
/* -------------------------------------------------------------------------- */

:root {
  /* Strict palette */
  --color-primary: #0b3d2e;
  --color-secondary: #145a41;
  --color-bg-page: #f5f7f6;
  --color-surface: #ffffff;
  --color-accent-alert: #ce1126;

  /* Semantic (status — no random hues) */
  --color-status-success: #0f5c3e;
  --color-status-success-bg: #e4f0ea;
  --color-status-warning: #8a6a00;
  --color-status-warning-bg: #f5edd4;
  --color-status-issue: #ce1126;
  --color-status-issue-bg: #fce8ea;

  /* Text */
  --color-text: #1a2e28;
  --color-text-muted: #5a6f66;

  /* Lines & elevation */
  --color-border: #d4e0db;
  --shadow-sm: 0 2px 8px rgba(11, 61, 46, 0.06);
  --shadow-md: 0 4px 20px rgba(11, 61, 46, 0.08);
  --shadow-lg: 0 8px 28px rgba(11, 61, 46, 0.12);

  --radius-card: 10px;

  /* Typography (Arabic-friendly) */
  --font-body: "Noto Sans Arabic", "Segoe UI", system-ui, sans-serif;
  --font-heading: "Cairo", "Noto Sans Arabic", sans-serif;
  --font-weight-body: 400;
  --font-weight-body-strong: 600;
  --font-weight-heading: 700;

  /* Legacy aliases (used across existing markup) */
  --green-dark: var(--color-primary);
  --green-mid: var(--color-secondary);
  --bg-light: var(--color-bg-page);
  --white: var(--color-surface);
  --accent-red: var(--color-accent-alert);
  --text: var(--color-text);
  --text-muted: var(--color-text-muted);
  --border: var(--color-border);
  --shadow: var(--shadow-md);
  --shadow-hover: var(--shadow-lg);
  --radius: var(--radius-card);
  --font: var(--font-body);
  --font-display: var(--font-heading);

  /* Islamic pattern (faded green, layered) */
  --pattern-line-a: rgba(11, 61, 46, 0.045);
  --pattern-line-b: rgba(20, 90, 65, 0.038);
  --pattern-opacity: 0.55;

  /* ارتفاع الهيدر — يُحدَّث من الجافاسكربت للسايدبار على الموبايل */
  --app-navbar-height: 56px;
  --color-heading: var(--color-primary);
}

body.dark-mode {
  --color-bg-page: #080f0d;
  --color-surface: #101a16;
  --color-surface-2: #16241f;
  --color-text: #f2faf6;
  --color-text-muted: #b8d0c4;
  --color-heading: #ffffff;
  --color-border: #355548;
  --color-border-strong: #4a7260;
  --color-status-success: #9ae9c4;
  --color-status-success-bg: #1a3d30;
  --color-status-warning: #f5e6a8;
  --color-status-warning-bg: #423a1a;
  --color-status-issue-bg: #3d181c;
  --shadow-sm: 0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 4px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 10px 40px rgba(0, 0, 0, 0.55);
  --pattern-line-a: rgba(210, 240, 225, 0.05);
  --pattern-line-b: rgba(170, 210, 190, 0.04);
  --pattern-opacity: 0.48;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
  font-size: clamp(15px, 2.8vw, 16px);
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  font-family: var(--font-body);
  font-weight: var(--font-weight-body);
  color: var(--color-text);
  background-color: var(--color-bg-page);
  line-height: 1.6;
  transition: opacity 0.22s ease;
}

/* Headings hierarchy */
h1,
h2,
h3,
.page-title,
.card-title,
.splash-title,
.navbar-portal {
  font-family: var(--font-heading);
  font-weight: var(--font-weight-heading);
}

/* -------------------------------------------------------------------------- */
/* Islamic geometric pattern — main canvas (CSS only)                        */
/* -------------------------------------------------------------------------- */

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: var(--pattern-opacity);
  background-color: var(--color-bg-page);
  /* Star / grid symmetry: three axes + orthogonal mesh */
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent 0,
      transparent 22px,
      var(--pattern-line-a) 22px,
      var(--pattern-line-a) 23px
    ),
    repeating-linear-gradient(
      90deg,
      transparent 0,
      transparent 22px,
      var(--pattern-line-a) 22px,
      var(--pattern-line-a) 23px
    ),
    repeating-linear-gradient(
      45deg,
      transparent 0,
      transparent 16px,
      var(--pattern-line-b) 16px,
      var(--pattern-line-b) 17px
    ),
    repeating-linear-gradient(
      -45deg,
      transparent 0,
      transparent 16px,
      var(--pattern-line-b) 16px,
      var(--pattern-line-b) 17px
    ),
    repeating-linear-gradient(
      60deg,
      transparent 0,
      transparent 31px,
      rgba(11, 61, 46, 0.028) 31px,
      rgba(11, 61, 46, 0.028) 32px
    ),
    repeating-linear-gradient(
      -60deg,
      transparent 0,
      transparent 31px,
      rgba(11, 61, 46, 0.028) 31px,
      rgba(11, 61, 46, 0.028) 32px
    );
}

body.dark-mode::before {
  background-color: var(--color-bg-page);
}

.hidden {
  display: none !important;
}

/* -------------------------------------------------------------------------- */
/* Official emblem — no distortion                                            */
/* -------------------------------------------------------------------------- */

.brand-emblem {
  object-fit: contain;
  object-position: center;
  flex-shrink: 0;
  background: var(--color-surface);
}

.brand-emblem--navbar {
  width: clamp(40px, 10vw, 48px);
  height: clamp(40px, 10vw, 48px);
  padding: 4px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.22);
  box-shadow: var(--shadow-sm);
  background: #ffffff;
}

body.dark-mode .brand-emblem--navbar {
  background: #f0f5f3;
  border-color: rgba(255, 255, 255, 0.28);
}

.brand-emblem--splash {
  width: min(200px, 42vw);
  height: min(200px, 42vw);
  max-height: 220px;
  max-width: 220px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.28);
}

.splash-emblem-wrap {
  display: flex;
  justify-content: center;
  margin-bottom: 1.25rem;
}

/* -------------------------------------------------------------------------- */
/* Splash screen                                                              */
/* -------------------------------------------------------------------------- */

.splash {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(168deg, var(--color-primary) 0%, var(--color-secondary) 48%, #082a22 100%);
  animation: splashFadeIn 1s ease-out forwards;
}

@keyframes splashFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.splash-pattern {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.splash-pattern--geometric {
  opacity: 0.22;
  background-image:
    repeating-linear-gradient(
      45deg,
      rgba(255, 255, 255, 0.09) 0,
      rgba(255, 255, 255, 0.09) 1px,
      transparent 1px,
      transparent 18px
    ),
    repeating-linear-gradient(
      -45deg,
      rgba(255, 255, 255, 0.07) 0,
      rgba(255, 255, 255, 0.07) 1px,
      transparent 1px,
      transparent 18px
    ),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04) 0,
      rgba(255, 255, 255, 0.04) 1px,
      transparent 1px,
      transparent 24px
    );
}

.splash-content {
  position: relative;
  text-align: center;
  color: var(--color-surface);
  max-width: 32rem;
  padding: 1.5rem;
  animation: splashContentIn 1.15s ease-out 0.12s both;
}

@keyframes splashContentIn {
  from {
    opacity: 0;
    transform: translateY(18px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.splash-title {
  font-size: clamp(1.65rem, 4.5vw, 2.35rem);
  letter-spacing: 0.02em;
  margin: 0 0 0.4rem;
  line-height: 1.25;
}

.splash-subtitle {
  margin: 0;
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 600;
  opacity: 0.95;
}

.splash-tag-en {
  margin: 0.85rem 0 0;
  font-size: 0.88rem;
  font-weight: 400;
  opacity: 0.78;
  line-height: 1.5;
}

.splash.splash-out {
  animation: splashOut 0.55s ease forwards;
}

@keyframes splashOut {
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* -------------------------------------------------------------------------- */
/* Application shell                                                          */
/* -------------------------------------------------------------------------- */

.app {
  position: relative;
  z-index: 1;
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  animation: appIn 0.45s ease;
}

@keyframes appIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

/* Top bar — ثابت أعلى الصفحة */
.navbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem 1rem;
  padding: calc(0.5rem + env(safe-area-inset-top, 0px)) clamp(0.65rem, 3vw, 1.25rem) 0.5rem;
  min-height: 52px;
  background: #0b3d2e;
  color: #ffffff;
  box-shadow: var(--shadow-md);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 200;
  flex-shrink: 0;
}

body.dark-mode .navbar {
  background: #071f18;
  box-shadow: 0 2px 16px rgba(0, 0, 0, 0.5);
}

.navbar-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
}

.navbar-titles {
  display: flex;
  flex-direction: column;
  line-height: 1.25;
  text-align: start;
  min-width: 0;
  flex: 1 1 auto;
}

.navbar-portal {
  font-size: clamp(0.88rem, 3.2vw, 1.2rem);
  font-weight: 700;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: min(52vw, 16rem);
}

.navbar-product {
  font-size: 0.78rem;
  font-weight: 600;
  opacity: 0.88;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem 0.5rem;
  flex-shrink: 0;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.navbar-actions .nav-staff-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
}

/* Language switch (government-neutral) */
.lang-switch {
  display: inline-flex;
  border-radius: var(--radius-card);
  border: 1px solid rgba(255, 255, 255, 0.35);
  overflow: hidden;
}

.btn-lang {
  font-family: var(--font-body);
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.35rem 0.55rem;
  border: none;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  transition: background 0.2s, color 0.2s;
}

.btn-lang:hover {
  background: rgba(255, 255, 255, 0.1);
}

.btn-lang.active {
  background: rgba(255, 255, 255, 0.2);
  color: var(--color-surface);
}

.layout {
  display: flex;
  flex-direction: row;
  flex: 1;
  position: relative;
  min-height: 0;
  width: 100%;
}

/* Sidebar — same family as navbar (dark green) */
.sidebar {
  width: 248px;
  flex-shrink: 0;
  background: #0b3d2e;
  color: rgba(255, 255, 255, 0.92);
  border-inline-end: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition:
    transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
    box-shadow 0.3s ease,
    opacity 0.22s ease;
}

body.dark-mode .sidebar {
  background: #071f18;
  border-color: rgba(255, 255, 255, 0.06);
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  padding: 1rem 0.65rem;
  gap: 0.25rem;
}

.nav-item {
  font-family: var(--font-body);
  font-size: 0.92rem;
  font-weight: 500;
  text-align: start;
  padding: 0.65rem 0.75rem;
  border: none;
  border-radius: var(--radius-card);
  background: transparent;
  color: rgba(255, 255, 255, 0.9);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  transition: background 0.2s, color 0.2s, transform 0.12s;
}

.nav-item:hover {
  background: var(--color-secondary);
  color: var(--color-surface);
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: var(--color-surface);
  font-weight: 700;
  border-inline-start: 3px solid rgba(255, 255, 255, 0.55);
}

.nav-icon {
  display: flex;
  width: 22px;
  height: 22px;
  flex-shrink: 0;
  opacity: 0.9;
}

.nav-icon svg {
  width: 100%;
  height: 100%;
}

.nav-label {
  flex: 1;
  line-height: 1.35;
}

.nav-item-admin {
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  margin-top: 0.45rem;
  padding-top: 0.85rem;
}

.btn-sidebar-mobile {
  display: none;
}

/* -------------------------------------------------------------------------- */
/* تبديل اللغة (RTL/LTR) — تلاشي خفيف بدون قفزة بصرية للسايدبار            */
/* -------------------------------------------------------------------------- */

body.lang-switching {
  opacity: 0.88;
  pointer-events: none;
}

body.lang-switching .sidebar {
  transition: opacity 0.18s ease !important;
}

/* Main content — light field, cards float above */
.main {
  flex: 1;
  min-width: 0;
  padding: clamp(0.85rem, 3vw, 1.75rem) clamp(0.75rem, 4vw, 2rem);
  max-width: 1180px;
  width: 100%;
  margin-inline: auto;
}

.section {
  animation: sectionIn 0.32s ease;
}

@keyframes sectionIn {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.page-title {
  font-size: clamp(1.25rem, 4vw, 1.65rem);
  color: var(--color-primary);
  margin: 0 0 0.35rem;
  line-height: 1.3;
}

body.dark-mode .page-title {
  color: var(--color-heading);
}

.page-lead {
  color: var(--color-text-muted);
  margin: 0 0 1.5rem;
  font-size: clamp(0.88rem, 2.5vw, 0.98rem);
  line-height: 1.55;
}

/* Cards — white, soft shadow, 10px radius */
.card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-md);
  padding: 1.5rem;
  border: 1px solid var(--color-border);
  transition: box-shadow 0.25s;
}

.card:hover {
  box-shadow: var(--shadow-hover);
}

.card-narrow {
  max-width: 420px;
  margin-inline: auto;
}

.card-title {
  margin: 0 0 0.5rem;
  font-size: 1.3rem;
  color: var(--color-primary);
}

body.dark-mode .card-title {
  color: var(--color-heading);
}

.card-desc {
  color: var(--color-text-muted);
  margin: 0 0 1.25rem;
  font-size: 0.95rem;
}

.card-table {
  padding: 0;
  overflow: hidden;
}

/* Stats — accent bars use semantic colors */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 148px), 1fr));
  gap: clamp(0.65rem, 2vw, 1rem);
}

.stat-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  padding: 1.25rem;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  border-top: 4px solid var(--color-secondary);
  transition: transform 0.2s;
}

.stat-card:hover {
  transform: translateY(-2px);
}

.stat-pending {
  border-top-color: #b8962e;
}

.stat-progress {
  border-top-color: var(--color-secondary);
}

.stat-resolved {
  border-top-color: var(--color-status-success);
}

.stat-value {
  font-family: var(--font-heading);
  font-size: clamp(1.5rem, 5vw, 2rem);
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.15;
}

body.dark-mode .stat-value {
  color: var(--color-heading);
}

.stat-label {
  font-size: clamp(0.78rem, 2.2vw, 0.88rem);
  color: var(--color-text-muted);
  line-height: 1.35;
}

body.dark-mode .stat-card {
  background: var(--color-surface-2);
  border-color: var(--color-border);
  box-shadow: var(--shadow-sm);
}

body.dark-mode .stat-pending {
  border-top-color: #c9a84a;
}

body.dark-mode .stat-resolved {
  border-top-color: var(--color-status-success);
}

/* Forms */
.form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.form-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 140px;
}

.form-group.grow {
  flex: 1;
}

.label {
  font-weight: var(--font-weight-body-strong);
  font-size: 0.9rem;
  color: var(--color-primary);
}

body.dark-mode .label {
  color: #b8dcc8;
}

.input,
.textarea {
  font-family: var(--font-body);
  font-size: 1rem;
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.2s, box-shadow 0.2s;
}

.input:focus,
.textarea:focus {
  outline: none;
  border-color: var(--color-secondary);
  box-shadow: 0 0 0 3px rgba(20, 90, 65, 0.2);
}

body.dark-mode .input:focus,
body.dark-mode .textarea:focus {
  border-color: #5a9e7e;
  box-shadow: 0 0 0 3px rgba(90, 158, 126, 0.25);
}

.textarea {
  resize: vertical;
  min-height: 100px;
}

.input-file {
  font-size: 0.88rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 0.5rem;
}

/* Alerts / errors — only red usage */
.form-error {
  color: var(--color-accent-alert);
  font-size: 0.9rem;
  margin: 0;
  font-weight: 600;
}

/* Buttons — green primary, hover darker */
.btn {
  font-family: var(--font-body);
  font-size: 0.95rem;
  font-weight: var(--font-weight-body-strong);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-card);
  border: 2px solid transparent;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, border-color 0.2s, transform 0.12s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--color-primary);
  color: var(--color-surface);
}

.btn-primary:hover {
  background: #072920;
  filter: brightness(0.95);
}

.btn-outline {
  background: transparent;
  color: var(--color-surface);
  border-color: rgba(255, 255, 255, 0.55);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
}

.main .btn-outline {
  color: var(--color-primary);
  border-color: var(--color-secondary);
}

.main .btn-outline:hover {
  background: rgba(11, 61, 46, 0.07);
}

body.dark-mode .main .btn-outline {
  color: #f5fffa;
  border-color: #5a9078;
  background: rgba(255, 255, 255, 0.04);
}

body.dark-mode .main .btn-outline:hover {
  background: rgba(255, 255, 255, 0.1);
  border-color: #7abf9e;
}

.btn-ghost {
  background: transparent;
  color: var(--color-text-muted);
  border-color: var(--color-border);
}

.btn-ghost:hover {
  background: var(--color-bg-page);
}

.btn-danger {
  background: transparent;
  color: var(--color-accent-alert);
  border-color: var(--color-accent-alert);
}

.btn-danger:hover {
  background: rgba(206, 17, 38, 0.08);
}

.btn-sm {
  font-size: 0.85rem;
  padding: 0.4rem 0.85rem;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border-radius: var(--radius-card);
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: var(--color-surface);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

body.dark-mode .btn-icon .theme-icon-sun {
  display: none;
}

body:not(.dark-mode) .btn-icon .theme-icon-moon {
  display: none;
}

/* أزرار الهيدر (لغة / ثيم / لوحة الموظفين) — حدود بيضاء واضحة في الوضع الداكن */
body.dark-mode .navbar .lang-switch {
  border-color: rgba(255, 255, 255, 0.92);
}

body.dark-mode .navbar .btn-lang {
  color: #ffffff;
}

body.dark-mode .navbar .btn-lang.active {
  background: rgba(255, 255, 255, 0.22);
  color: #ffffff;
}

body.dark-mode .navbar .btn-icon {
  border: 2px solid rgba(255, 255, 255, 0.92);
  color: #ffffff;
  background: rgba(255, 255, 255, 0.07);
}

body.dark-mode .navbar .btn-icon:hover {
  background: rgba(255, 255, 255, 0.16);
}

body.dark-mode .navbar .nav-staff-link.btn {
  color: #ffffff !important;
  border: 2px solid rgba(255, 255, 255, 0.95) !important;
  background: rgba(255, 255, 255, 0.06);
}

body.dark-mode .navbar .nav-staff-link.btn:hover {
  background: rgba(255, 255, 255, 0.14);
}

.image-preview {
  margin-top: 0.75rem;
  border-radius: var(--radius-card);
  overflow: hidden;
  max-width: 320px;
  border: 1px solid var(--color-border);
  box-shadow: var(--shadow-md);
}

.image-preview img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
}

.issues-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 260px), 1fr));
  gap: clamp(0.85rem, 2.5vw, 1.25rem);
}

.issue-card {
  background: var(--color-surface);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-md);
  border: 1px solid var(--color-border);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s, box-shadow 0.2s;
}

.issue-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-hover);
}

.issue-card-img {
  aspect-ratio: 4 / 3;
  object-fit: cover;
  width: 100%;
  background: var(--color-border);
}

.issue-card-body {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.issue-card-title {
  font-family: var(--font-heading);
  font-size: 1.05rem;
  font-weight: 700;
  margin: 0;
  color: var(--color-primary);
}

body.dark-mode .issue-card-title {
  color: var(--color-heading);
}

body.dark-mode .issue-card {
  background: var(--color-surface);
  border-color: var(--color-border);
}

body.dark-mode .issue-card-img {
  background: var(--color-surface-2);
}

.issue-meta {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.issue-desc {
  margin: 0;
  font-size: 0.92rem;
  line-height: 1.55;
  color: var(--color-text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 4;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Status chips: success (green), warning (yellow), issue (red) — mapped to workflow */
.badge {
  display: inline-block;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.badge-pending {
  background: var(--color-status-warning-bg);
  color: var(--color-status-warning);
}

.badge-progress {
  background: rgba(20, 90, 65, 0.14);
  color: var(--color-secondary);
}

.badge-resolved {
  background: var(--color-status-success-bg);
  color: var(--color-status-success);
}

body.dark-mode .badge-pending {
  background: var(--color-status-warning-bg);
  color: #f0e0a8;
}

body.dark-mode .badge-progress {
  background: rgba(127, 200, 170, 0.18);
  color: #b8f0d8;
  border: 1px solid rgba(127, 200, 170, 0.35);
}

body.dark-mode .badge-resolved {
  background: var(--color-status-success-bg);
  color: #b8e8cc;
}

.issue-after {
  margin-top: 0.5rem;
  font-size: 0.8rem;
}

.issue-after img {
  width: 100%;
  border-radius: 8px;
  margin-top: 0.35rem;
  max-height: 140px;
  object-fit: cover;
}

.empty-state {
  text-align: center;
  padding: 2.5rem;
  color: var(--color-text-muted);
  background: var(--color-surface);
  border-radius: var(--radius-card);
  border: 1px dashed var(--color-border);
}

.table-wrap {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.data-table th,
.data-table td {
  padding: 0.65rem 0.75rem;
  text-align: start;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table th {
  background: rgba(11, 61, 46, 0.06);
  font-weight: 700;
  font-family: var(--font-heading);
  color: var(--color-primary);
}

body.dark-mode .data-table th {
  background: rgba(255, 255, 255, 0.05);
  color: #c5e0d4;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table img.thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 8px;
}

.admin-controls {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  min-width: 140px;
}

.admin-controls select {
  font-size: 0.85rem;
  padding: 0.35rem;
  border-radius: 8px;
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}

.admin-file {
  font-size: 0.75rem;
  max-width: 140px;
}

.admin-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.charts-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 280px), 1fr));
  gap: clamp(0.85rem, 2.5vw, 1.25rem);
}

.chart-card {
  min-height: 280px;
}

.chart-title {
  font-family: var(--font-heading);
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 1rem;
  color: var(--color-primary);
}

body.dark-mode .chart-title {
  color: var(--color-heading);
}

.chart-wrap {
  position: relative;
  height: clamp(200px, 45vw, 260px);
  max-width: 100%;
}

body.dark-mode .chart-wrap {
  background: rgba(0, 0, 0, 0.22);
  border-radius: var(--radius-card);
  border: 1px solid var(--color-border);
}

body.dark-mode .chart-card {
  border-color: var(--color-border);
}

body.dark-mode .empty-state {
  background: var(--color-surface-2);
  border-color: var(--color-border-strong);
  color: var(--color-text-muted);
}

body.dark-mode .toast {
  background: #0d2820;
  color: #f0faf6;
  border-inline-start-color: #6ecf9a;
}

body.dark-mode .data-table th {
  background: rgba(255, 255, 255, 0.06);
  color: var(--color-heading);
}

body.dark-mode .data-table td {
  color: var(--color-text);
  border-bottom-color: var(--color-border);
}

/* Toasts — success green stripe; error uses accent red only */
.toast-container {
  position: fixed;
  top: 1rem;
  inset-inline-end: 1rem;
  z-index: 2000;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  max-width: 360px;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  background: var(--color-primary);
  color: var(--color-surface);
  padding: 0.85rem 1.1rem;
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-hover);
  font-size: 0.95rem;
  animation: toastIn 0.35s ease;
  border-inline-start: 4px solid var(--color-secondary);
}

.toast.success {
  border-inline-start-color: var(--color-status-success);
}

.toast.error {
  border-inline-start-color: var(--color-accent-alert);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* -------------------------------------------------------------------------- */
/* طبقة إغلاق القائمة — موبايل فقط                                               */
/* -------------------------------------------------------------------------- */

.sidebar-backdrop {
  display: none;
}

@media (max-width: 768px) {
  .layout.layout--nav-open .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    top: var(--app-navbar-height, 56px);
    z-index: 90;
    margin: 0;
    padding: 0;
    border: none;
    background: rgba(5, 15, 12, 0.45);
    cursor: pointer;
    -webkit-tap-highlight-color: transparent;
  }

  body.dark-mode .layout.layout--nav-open .sidebar-backdrop {
    background: rgba(0, 0, 0, 0.55);
  }
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 520px) {
  .navbar-product {
    display: none;
  }

  .navbar-portal {
    max-width: min(70vw, 14rem);
  }

  .btn-lang {
    padding: 0.3rem 0.45rem;
    font-size: 0.7rem;
  }
}

@media (max-width: 768px) {
  /*
   * موضع منطقي فقط: inset-inline-start (بدون left/right).
   * LTR: اللوح من اليسار → الإغلاق translateX(-105%) يخفيه نحو اليسار.
   * RTL: اللوح من اليمين → الإغلاق translateX(105%) يخفيه نحو اليمين (مثل درج لوحة الموظفين).
   */
  .sidebar {
    width: min(88vw, 280px);
    max-width: 280px;
    position: fixed;
    top: var(--app-navbar-height, 56px);
    height: calc(100dvh - var(--app-navbar-height, 56px));
    max-height: calc(100vh - var(--app-navbar-height, 56px));
    bottom: auto;
    z-index: 100;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    box-shadow: none;
    inset-inline-start: 0;
    inset-inline-end: auto;
  }

  [dir="ltr"] .sidebar {
    transform: translateX(-105%);
  }

  [dir="rtl"] .sidebar {
    transform: translateX(105%);
  }

  .sidebar.open {
    transform: translateX(0);
    box-shadow: 0 4px 32px rgba(0, 0, 0, 0.28);
  }

  .btn-sidebar-mobile {
    display: flex !important;
  }

  .layout {
    flex-direction: column;
    flex: 1;
  }

  .main {
    padding-top: 0.65rem;
  }

  .navbar-actions .btn-sm,
  .navbar-actions .nav-staff-link {
    font-size: 0.72rem;
    padding: 0.38rem 0.55rem;
  }

  .form-row {
    flex-direction: column;
  }

  .form-group {
    min-width: 100%;
  }
}

@media (min-width: 769px) {
  .btn-sidebar-mobile {
    display: none !important;
  }

  .sidebar-backdrop {
    display: none !important;
  }
}

@media (min-width: 900px) {
  .main {
    padding-inline: 2rem;
  }
}
