/* Workshop order system — RTL dashboard + print */

:root {
  --bg: #eef1f6;
  --bg-elevated: #f7f8fb;
  --surface: #ffffff;
  --text: #141821;
  --muted: #5c6473;
  --border: #e4e8f0;
  --primary: #0d6e6e;
  --primary-hover: #095858;
  --primary-soft: rgba(13, 110, 110, 0.14);
  --accent: #c45c26;
  --radius: 16px;
  --radius-sm: 12px;
  --radius-xs: 8px;
  --shadow: 0 4px 24px rgba(20, 24, 33, 0.06);
  --shadow-md: 0 12px 40px rgba(20, 24, 33, 0.1);
  --shadow-drawer: -8px 0 40px rgba(15, 23, 42, 0.18);
  --sidebar-w: min(260px, 82vw);
  --font: "Cairo", system-ui, -apple-system, sans-serif;
  --ease-out: cubic-bezier(0.22, 1, 0.36, 1);
  --ease-smooth: cubic-bezier(0.4, 0, 0.2, 1);
  --touch-min: 44px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-inline: env(safe-area-inset-right, 0px);
  --content-max: 1200px;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  background-image: radial-gradient(ellipse 120% 80% at 100% 0%, rgba(13, 110, 110, 0.06), transparent 50%),
    radial-gradient(ellipse 80% 60% at 0% 100%, rgba(196, 92, 38, 0.04), transparent 45%);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
}

/* Login */
.auth-screen {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(1.25rem + var(--safe-top)) 1.25rem calc(1.25rem + var(--safe-bottom));
  background: linear-gradient(165deg, #0c3535 0%, #0a2a2a 38%, #e8ecf4 38%, #eef1f6 100%);
}

.auth-card {
  width: min(420px, 100%);
  padding: clamp(1.35rem, 4vw, 1.85rem);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(255, 255, 255, 0.65);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  margin-bottom: 1.35rem;
}

.auth-brand__mark {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  display: block;
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 2px 12px rgba(13, 47, 47, 0.12);
}

.auth-brand__title {
  margin: 0;
  font-size: 1.2rem;
  font-weight: 800;
}

.auth-brand__sub {
  margin: 0.2rem 0 0;
  font-size: 0.82rem;
}

.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.auth-error {
  margin: 0;
  font-size: 0.85rem;
  color: #b91c1c;
  font-weight: 600;
}

.auth-hint {
  margin: 1rem 0 0;
  text-align: center;
  line-height: 1.45;
}

.auth-credit {
  margin: 0.85rem 0 0;
  text-align: center;
}

.auth-credit__link {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: color 0.2s, border-color 0.2s;
}

.auth-credit__link:hover {
  color: var(--primary-hover);
  border-bottom-color: rgba(13, 110, 110, 0.35);
}

.btn--block {
  width: 100%;
}

/* إظهار / إخفاء كلمة المرور — LTR على الحاوية حتى يكون زر الإخفاء على يمين الحقل وليس فوق بداية النص (صفحة rtl) */
.password-field {
  position: relative;
  display: block;
  width: 100%;
  direction: ltr;
  unicode-bidi: isolate;
}

.field .password-field__input,
.password-field .password-field__input {
  padding-inline-end: 6rem;
  box-sizing: border-box;
}

.password-field__toggle {
  position: absolute;
  inset-inline-end: 0.45rem;
  inset-block-start: 50%;
  transform: translateY(-50%);
  z-index: 1;
  margin: 0;
  padding: 0.35rem 0.6rem;
  min-height: auto;
  font-size: 0.78rem;
  font-weight: 600;
  font-family: inherit;
  color: var(--primary);
  background: var(--bg-elevated);
  border: 1px solid rgba(13, 110, 110, 0.28);
  border-radius: var(--radius-sm);
  cursor: pointer;
  line-height: 1.2;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.password-field__toggle:hover {
  background: var(--primary-soft);
  border-color: rgba(13, 110, 110, 0.35);
}

.password-field__toggle:focus-visible {
  outline: 2px solid var(--primary);
  outline-offset: 2px;
}

.input--ltr {
  direction: ltr;
  text-align: left;
}

.stack-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.topbar__actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.65rem;
}

.user-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.5rem;
  padding: 0.25rem 0;
}

.user-strip__name {
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--muted);
  max-width: min(10rem, 28vw);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.modal--wide {
  width: min(960px, 96vw);
  max-height: 92vh;
}

.users-admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

@media (max-width: 900px) {
  .users-admin-grid {
    grid-template-columns: 1fr;
  }
}

.users-admin__h {
  margin: 0 0 0.75rem;
  font-size: 1rem;
  color: var(--primary);
}

.users-table {
  font-size: 0.82rem;
}

.perm-grid {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
  padding: 0.65rem 0.75rem;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
}

.perm-grid__title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.audit-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  max-height: 220px;
  overflow-y: auto;
}

.audit-list__item {
  font-size: 0.8rem;
  padding: 0.45rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  line-height: 1.4;
}

.audit-list__meta {
  display: block;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 0.2rem;
}

.nav-btn.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

.dash-card.is-disabled {
  opacity: 0.45;
  pointer-events: none;
  cursor: not-allowed;
}

/* زر القائمة — يظهر على التابلت والموبايل */
.nav-toggle {
  display: none;
  flex-shrink: 0;
  width: var(--touch-min);
  height: var(--touch-min);
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--primary);
  cursor: pointer;
  transition: background 0.2s var(--ease-smooth), border-color 0.2s, box-shadow 0.2s var(--ease-smooth);
  box-shadow: var(--shadow);
}

.nav-toggle:hover {
  background: var(--bg-elevated);
  border-color: rgba(13, 110, 110, 0.22);
}

.nav-toggle:focus-visible {
  outline: none;
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.nav-toggle__bars {
  display: block;
  width: 1.125rem;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  box-shadow: 0 -6px 0 currentColor, 0 6px 0 currentColor;
}

.sidebar-backdrop {
  display: none;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: linear-gradient(180deg, #0e3a3a 0%, #0b2e2e 55%, #0a2828 100%);
  color: #e8f2f2;
  display: flex;
  flex-direction: column;
  padding: 1.25rem 1rem;
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  z-index: 40;
  transition: transform 0.32s var(--ease-out), box-shadow 0.32s var(--ease-out);
  box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.5rem 0.35rem 1.25rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  margin-bottom: 1rem;
}

.brand__mark {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 1px rgba(255, 255, 255, 0.2);
}

.brand__text {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.brand__title {
  font-weight: 700;
  font-size: 1.05rem;
}

.brand__subtitle {
  font-size: 0.72rem;
  opacity: 0.85;
  line-height: 1.35;
}

.nav-sections {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  flex: 1;
  overflow-y: auto;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  width: 100%;
  min-height: var(--touch-min);
  padding: 0.65rem 0.9rem;
  border: none;
  border-inline-start: 3px solid transparent;
  border-radius: var(--radius-sm);
  background: transparent;
  color: inherit;
  font-family: inherit;
  font-size: 0.93rem;
  text-align: right;
  cursor: pointer;
  transition: background 0.2s var(--ease-smooth), transform 0.15s var(--ease-smooth),
    border-color 0.2s var(--ease-smooth);
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.09);
}

.nav-btn:active {
  transform: scale(0.98);
}

.nav-btn.is-active {
  background: rgba(255, 255, 255, 0.2);
  font-weight: 600;
  border-inline-start-color: rgba(255, 255, 255, 0.5);
}

.nav-btn__icon {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.85rem;
  flex-shrink: 0;
}

.nav-btn__badge {
  margin-right: auto;
  background: var(--accent);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  min-width: 1.35rem;
  text-align: center;
}

.sidebar__footer {
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  align-items: stretch;
}

.sidebar__credit {
  margin: 0;
  text-align: center;
}

.sidebar__credit-link {
  display: inline-block;
  font-size: 0.72rem;
  font-weight: 600;
  color: rgba(232, 242, 242, 0.88);
  text-decoration: none;
  padding: 0.35rem 0.25rem;
  border-radius: var(--radius-xs);
  transition: color 0.2s, background 0.2s;
}

.sidebar__credit-link:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.small {
  font-size: 0.75rem;
}

.muted {
  color: var(--muted);
}

.main-wrap {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: calc(0.85rem + var(--safe-top)) clamp(1rem, 3vw, 1.5rem) 0.85rem;
  padding-inline-end: max(1rem, var(--safe-inline));
  background: rgba(255, 255, 255, 0.86);
  backdrop-filter: blur(20px) saturate(1.2);
  -webkit-backdrop-filter: blur(20px) saturate(1.2);
  border-bottom: 1px solid rgba(228, 232, 240, 0.95);
  flex-wrap: wrap;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.8) inset;
}

.topbar__title-wrap {
  flex: 1;
  min-width: 160px;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.topbar__logo {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: contain;
  flex-shrink: 0;
  background: rgba(13, 110, 110, 0.08);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.9) inset;
}

.topbar__titles {
  min-width: 0;
}

.page-title {
  margin: 0;
  font-size: clamp(1.15rem, 2.8vw, 1.4rem);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.25;
}

.page-desc {
  margin: 0.25rem 0 0;
  font-size: clamp(0.8rem, 2.2vw, 0.9rem);
  line-height: 1.45;
}

.search-wrap {
  min-width: 200px;
  flex: 1;
  max-width: 380px;
}

.global-search-results {
  padding: 0 clamp(1rem, 3vw, 1.5rem);
  margin-bottom: 0.75rem;
  position: relative;
  z-index: 25;
}

.global-search-results__inner {
  padding: 0.85rem 1.1rem;
  box-shadow: var(--shadow);
  max-height: 380px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.global-search-results__title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--muted);
  flex-shrink: 0;
}

.global-search-results__list {
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.global-search-results__item {
  width: 100%;
  text-align: right;
  padding: 0.7rem 0.9rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafbfc;
  cursor: pointer;
  font-family: inherit;
  font-size: 0.9rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.35rem 0.85rem;
  transition: background 0.15s, border-color 0.15s;
  color: var(--text);
}

.global-search-results__item:hover {
  background: var(--primary-soft);
  border-color: var(--primary);
}

.global-search-results__item:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.global-search-results__item .gsr-order {
  font-weight: 800;
  color: var(--primary);
}

.global-search-results__item .gsr-phone-wrap {
  font-size: 0.85rem;
}

.global-search-results__item .gsr-phone-wrap .phone-wa,
.global-search-results__item .gsr-phone-wrap .phone-ltr {
  color: var(--muted);
}

.input-phone-ltr {
  direction: ltr !important;
  text-align: left !important;
  unicode-bidi: plaintext;
}

.phone-ltr,
a.phone-wa {
  direction: ltr;
  unicode-bidi: isolate;
  text-align: left;
  display: inline-block;
}

a.phone-wa {
  color: var(--primary);
  font-weight: 600;
  text-decoration: none;
}

a.phone-wa:hover {
  text-decoration: underline;
}

.orders-table td .phone-ltr,
.orders-table td a.phone-wa {
  max-width: 14rem;
  white-space: nowrap;
}

.modal__body dd .phone-wa {
  word-break: break-all;
  white-space: normal;
}

.global-search-results__meta {
  margin-inline-start: auto;
  font-size: 0.75rem;
}

.content {
  padding: clamp(1rem, 3vw, 1.35rem) clamp(1rem, 3vw, 1.5rem) calc(2rem + var(--safe-bottom));
  flex: 1;
  max-width: var(--content-max);
  margin-inline: auto;
  width: 100%;
}

.section-intro {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.95rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  gap: clamp(0.85rem, 2.5vw, 1.15rem);
}

.dash-card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(1.1rem, 3vw, 1.35rem);
  box-shadow: var(--shadow);
  border: 1px solid rgba(228, 232, 240, 0.95);
  cursor: pointer;
  text-align: right;
  transition: transform 0.22s var(--ease-out), box-shadow 0.22s var(--ease-out), border-color 0.2s;
  font-family: inherit;
  color: inherit;
  width: 100%;
  min-height: 7.5rem;
}

.dash-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: rgba(13, 110, 110, 0.12);
}

.dash-card:active {
  transform: translateY(-1px);
}

.dash-card__top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.dash-card__icon {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--primary-soft);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
}

.dash-card__count {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--primary);
}

.dash-card__title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.dash-card__desc {
  margin: 0.35rem 0 0;
  font-size: 0.82rem;
  color: var(--muted);
  line-height: 1.45;
}

.view-panel {
  max-width: var(--content-max);
  margin: 0 auto;
  width: 100%;
}

.panel-head {
  margin-bottom: 1rem;
}

.panel-head h2 {
  margin: 0 0 0.35rem;
  font-size: 1.25rem;
}

.panel-head--row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* Form — workshop order (structured sections) */
.order-form {
  max-width: 920px;
  margin: 0 auto;
}

.form-doc-head {
  margin-bottom: 1rem;
}

.form-doc-head__badge {
  display: inline-block;
  padding: 0.28rem 0.75rem;
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 800;
}

.form-doc-head__hint {
  margin: 0.4rem 0 0;
  font-size: 0.84rem;
}

.order-form .form-section {
  margin-bottom: 1.1rem;
}

.form-section--mint {
  border-inline-end: 4px solid #059669;
  background: linear-gradient(165deg, rgba(209, 250, 229, 0.5) 0%, #fff 42%);
}

.form-section--sky {
  border-inline-end: 4px solid #0284c7;
  background: linear-gradient(165deg, rgba(224, 242, 254, 0.6) 0%, #fff 44%);
}

.form-section--rose {
  border-inline-end: 4px solid #db2777;
  background: linear-gradient(165deg, rgba(252, 231, 243, 0.65) 0%, #fff 44%);
}

.form-section--amber {
  border-inline-end: 4px solid #d97706;
  background: linear-gradient(165deg, rgba(254, 243, 199, 0.58) 0%, #fff 42%);
}

.form-section--slate {
  border-inline-end: 4px solid #475569;
  background: linear-gradient(165deg, rgba(241, 245, 249, 0.95) 0%, #fff 46%);
}

.form-section__ribbon {
  display: block;
  font-size: 0.71rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 0.25rem;
}

.form-section--mint .form-section__title {
  color: #047857;
  border-bottom-color: rgba(5, 150, 105, 0.22);
}

.form-section--sky .form-section__title {
  color: #0369a1;
  border-bottom-color: rgba(2, 132, 199, 0.22);
}

.form-section--rose .form-section__title {
  color: #be185d;
  border-bottom-color: rgba(219, 39, 119, 0.22);
}

.form-section--amber .form-section__title {
  color: #b45309;
  border-bottom-color: rgba(217, 119, 6, 0.22);
}

.form-section--slate .form-section__title {
  color: #334155;
  border-bottom-color: rgba(71, 85, 105, 0.28);
}

.seg-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin: 0.85rem 0 1rem;
  padding: 0.8rem 0.9rem;
  background: rgba(255, 255, 255, 0.75);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.seg-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.45rem 0.65rem;
}

.seg-group__label {
  width: 100%;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.seg {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.42rem 0.78rem;
  border: 1px solid var(--border);
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.84rem;
  background: #fff;
  transition: border-color 0.15s, background 0.15s, box-shadow 0.15s;
  user-select: none;
}

.seg:has(input:checked) {
  border-color: var(--primary);
  background: var(--primary-soft);
  font-weight: 600;
  box-shadow: 0 0 0 2px rgba(13, 110, 110, 0.12);
}

.seg input {
  margin: 0;
  accent-color: var(--primary);
}

.chk-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0.75rem 0 1rem;
  padding: 0.65rem 0.9rem;
  background: rgba(255, 255, 255, 0.72);
  border-radius: var(--radius-sm);
  border: 1px dashed var(--border);
}

.chk {
  display: inline-flex;
  align-items: center;
  gap: 0.42rem;
  font-size: 0.88rem;
  cursor: pointer;
}

.chk input {
  width: 1.08rem;
  height: 1.08rem;
  accent-color: var(--primary);
}

.print-header {
  text-align: center;
  margin-bottom: 1.25rem;
  padding-bottom: 0.75rem;
  border-bottom: 2px solid var(--text);
}

.print-header__logo {
  margin: 0 auto;
  max-width: 140px;
}

.print-header__logo-img {
  display: block;
  width: auto;
  max-width: 120px;
  max-height: 120px;
  height: auto;
  margin: 0 auto;
  object-fit: contain;
}

.print-header__sub {
  font-size: 0.85rem;
  color: var(--muted);
  margin-top: 0.25rem;
}

.form-grid {
  display: grid;
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-grid--meta {
  grid-template-columns: 1fr;
}

.form-grid--split {
  grid-template-columns: 1fr 1fr;
}

@media (max-width: 768px) {
  .form-grid--split {
    grid-template-columns: 1fr;
  }
}

.card {
  background: var(--surface);
  border-radius: var(--radius);
  padding: clamp(1rem, 2.5vw, 1.2rem) clamp(1.05rem, 2.5vw, 1.3rem);
  box-shadow: var(--shadow);
  border: 1px solid rgba(228, 232, 240, 0.9);
}

.form-section__title {
  margin: 0 0 0.9rem;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--primary);
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--border);
}

.fields-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 0.85rem;
}

.fields-row--quad {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
}

.field--wide {
  grid-column: span 2;
}

.field--full {
  grid-column: 1 / -1;
}

@media (max-width: 640px) {
  .field--wide {
    grid-column: span 1;
  }
}

.field label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 0.35rem;
  color: var(--muted);
}

.input,
.field input,
.field textarea,
.field select {
  width: 100%;
  min-height: 2.75rem;
  padding: 0.55rem 0.85rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: max(16px, 0.92rem);
  background: var(--bg-elevated);
  color: var(--text);
  transition: border-color 0.2s, box-shadow 0.2s var(--ease-smooth), background 0.2s;
}

.field textarea {
  min-height: 4.5rem;
}

.input:focus,
.field input:focus,
.field textarea:focus,
.field select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.65rem;
  margin-top: 1.25rem;
  padding-top: 1rem;
  border-top: 1px dashed var(--border);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: var(--touch-min);
  padding: 0.55rem 1.15rem;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.2s var(--ease-smooth), color 0.2s, border-color 0.2s, transform 0.15s var(--ease-smooth),
    box-shadow 0.2s var(--ease-smooth);
}

.btn:active {
  transform: scale(0.98);
}

.btn--primary {
  background: linear-gradient(180deg, #0f7a7a 0%, var(--primary) 100%);
  color: #fff;
  box-shadow: 0 2px 12px rgba(13, 110, 110, 0.28);
}

.btn--primary:hover {
  background: linear-gradient(180deg, #118585 0%, var(--primary-hover) 100%);
  box-shadow: 0 4px 16px rgba(13, 110, 110, 0.32);
}

.btn--secondary {
  background: var(--surface);
  color: var(--primary);
  border-color: var(--primary);
}

.btn--secondary:hover {
  background: var(--primary-soft);
}

.btn--ghost {
  background: transparent;
  color: var(--muted);
  border-color: var(--border);
}

.btn--ghost:hover {
  background: var(--bg);
  color: var(--text);
}

.btn--danger {
  background: #b91c1c;
  color: #fff;
}

.btn--danger:hover {
  background: #991b1b;
}

.btn--sm {
  min-height: 2.5rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.82rem;
}

.btn--icon {
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 1.35rem;
  line-height: 1;
}

.btn--icon:hover {
  background: var(--bg);
  color: var(--text);
}

/* Table */
.table-wrap {
  padding: 0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  border-radius: var(--radius-sm);
  scrollbar-width: thin;
}

.orders-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
}

.orders-table th,
.orders-table td {
  padding: clamp(0.65rem, 2vw, 0.85rem) clamp(0.65rem, 2vw, 1rem);
  text-align: right;
  border-bottom: 1px solid var(--border);
}

.orders-table th {
  background: #f8f9fb;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.orders-table tbody tr:hover {
  background: #fafbfc;
}

.table-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.table-priority-select {
  min-width: 7rem;
  max-width: 11rem;
  font-size: 0.8rem !important;
  padding: 0.35rem 0.55rem !important;
  cursor: pointer;
}

.badge {
  display: inline-block;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge--high {
  background: #fee2e2;
  color: #991b1b;
}

.badge--medium {
  background: #fef3c7;
  color: #92400e;
}

.badge--low {
  background: #e0e7ff;
  color: #3730a3;
}

.badge--status-ns {
  background: #f3f4f6;
  color: #4b5563;
}

.badge--status-ip {
  background: #dbeafe;
  color: #1e40af;
}

.badge--status-c {
  background: #d1fae5;
  color: #065f46;
}

.badge--status-h {
  background: #fce7f3;
  color: #9d174d;
}

.badge--stage-dyn {
  background: #f0fdfa;
  color: #0f766e;
  border: 1px solid #99f6e4;
}

.badge--stage-dist {
  background: #e0f2fe;
  color: #075985;
}

.badge--stage-design {
  background: #fef3c7;
  color: #92400e;
}

.badge--stage-emb {
  background: #ede9fe;
  color: #5b21b6;
}

.badge--stage-fin {
  background: #ffedd5;
  color: #9a3412;
}

.badge--stage-arch {
  background: #f3f4f6;
  color: #374151;
}

.empty-state {
  padding: 2rem;
  text-align: center;
  color: var(--muted);
  margin: 0;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.45);
  z-index: 90;
}

.modal {
  position: fixed;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(640px, calc(100vw - 1.5rem));
  max-height: min(90vh, 100dvh - 1.5rem);
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  border: 1px solid rgba(228, 232, 240, 0.95);
  z-index: 100;
  display: flex;
  flex-direction: column;
}

.modal__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

.modal__header h2 {
  margin: 0;
  font-size: 1.1rem;
}

.modal__body {
  padding: 1rem 1.25rem;
  overflow-y: auto;
  flex: 1;
}

.modal__footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: flex-end;
}

.detail-grid {
  display: grid;
  gap: 0.65rem;
}

.detail-row {
  display: grid;
  grid-template-columns: 130px 1fr;
  gap: 0.5rem;
  font-size: 0.88rem;
}

.detail-row dt {
  margin: 0;
  font-weight: 600;
  color: var(--muted);
}

.detail-row dd {
  margin: 0;
}

.modal-section {
  margin-top: 1rem;
  padding-top: 1rem;
  border-top: 1px solid var(--border);
}

.modal-section h4 {
  margin: 0 0 0.65rem;
  font-size: 0.88rem;
  color: var(--primary);
}

.control-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.control-group label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--muted);
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
}

.checkbox-row input {
  width: 1.1rem;
  height: 1.1rem;
}

/* Print */
.print-only-block {
  display: none;
}

.print-container {
  position: absolute;
  left: -9999px;
  top: 0;
}

@media print {
  /* Full A4 printable area — moderate margins so content does not spill past the sheet */
  @page {
    size: A4 portrait;
    margin: 9mm 10mm 11mm 10mm;
  }

  body * {
    visibility: hidden;
  }

  .print-container,
  .print-container * {
    visibility: visible;
  }

  .print-container {
    position: static;
    left: auto;
    width: 100%;
    max-width: 190mm;
    margin: 0 auto;
    box-sizing: border-box;
  }

  body {
    background: #fff;
  }

  /* Dense A4 layout for workshop order (order-print) */
  .print-container .order-print {
    max-width: none;
    width: 100%;
    margin: 0;
    padding: 0;
    font-size: 8.75pt;
    line-height: 1.28;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-container .order-print .print-header {
    margin-bottom: 6pt;
    padding-bottom: 4pt;
    border-bottom-width: 1.5pt;
  }

  .print-container .order-print .print-header__logo-img {
    max-height: 14mm;
    max-width: 32mm;
    width: auto;
    margin: 0 auto;
  }

  .print-container .order-print .print-header__sub {
    font-size: 8pt;
    margin-top: 2pt;
  }

  .print-container .order-print .print-blocks {
    display: grid;
    gap: 5pt;
    grid-template-columns: 1fr;
  }

  .print-container .order-print .print-block {
    padding: 5pt 7pt;
    border-radius: 3pt;
    break-inside: auto;
    page-break-inside: auto;
  }

  .print-container .order-print .print-block h3 {
    font-size: 9pt;
    margin: 0 0 5pt;
    padding-bottom: 3pt;
    line-height: 1.2;
  }

  .print-container .order-print .print-block p {
    margin: 0 0 4pt;
    font-size: 8.5pt;
    line-height: 1.3;
  }

  .print-container .order-print .print-kv {
    grid-template-columns: repeat(3, 1fr);
    gap: 3pt 8pt;
    font-size: 8.25pt;
  }

  .print-container .order-print .print-kv strong {
    font-size: 7.5pt;
    margin-bottom: 1pt;
  }

  .print-container .order-print .print-full {
    grid-column: 1 / -1;
  }

  .print-container .order-print .print-kv div {
    min-width: 0;
    word-break: break-word;
    overflow-wrap: break-word;
  }
}

/* When printing from screen, use class on body via JS — alternative: print root */
body.is-printing-order .app-shell,
body.is-printing-order .modal-backdrop,
body.is-printing-order .modal {
  display: none !important;
}

body.is-printing-order .print-container {
  position: static;
  left: auto;
  visibility: visible;
  padding: 0;
  max-width: 190mm;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Shipping label print (compact sticker layout) */
body.is-printing-label .app-shell,
body.is-printing-label .modal-backdrop,
body.is-printing-label .modal {
  display: none !important;
}

body.is-printing-label .print-container {
  position: static;
  left: auto;
  visibility: visible;
  padding: 0;
}

.shipping-label-print {
  font-family: var(--font);
  direction: rtl;
  color: #000;
  width: 100mm;
  max-width: 100%;
  min-height: 135mm;
  margin: 0 auto;
  padding: 5mm 6mm;
  border: 2pt solid #000;
  box-sizing: border-box;
  background: #fff;
  line-height: 1.35;
}

.shipping-label-print .sl-bar {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 2mm;
  flex-wrap: wrap;
  font-size: 8pt;
  font-weight: 700;
  color: #0d6e6e;
  text-align: center;
  border-bottom: 1pt solid #000;
  padding-bottom: 2mm;
  margin-bottom: 3mm;
}

.shipping-label-print .sl-bar__logo {
  height: 6mm;
  width: auto;
  max-width: 10mm;
  object-fit: contain;
}

.shipping-label-print .sl-order {
  font-size: 11pt;
  font-weight: 700;
  text-align: center;
  margin-bottom: 4mm;
}

.shipping-label-print .sl-field {
  margin-bottom: 3.5mm;
  font-size: 10pt;
}

.shipping-label-print .sl-field--hero .sl-v {
  font-size: 14pt;
  font-weight: 800;
  display: block;
  margin-top: 1mm;
  word-break: break-word;
}

.shipping-label-print .sl-k {
  display: block;
  font-size: 8pt;
  font-weight: 700;
  color: #444;
  text-transform: none;
  margin-bottom: 0.5mm;
}

.shipping-label-print .sl-v {
  display: block;
  word-break: break-word;
}

.shipping-label-print .sl-ltr {
  direction: ltr;
  text-align: left;
  unicode-bidi: isolate;
}

.shipping-label-print .sl-dates {
  display: flex;
  flex-direction: column;
  gap: 1mm;
  font-size: 9pt;
  border-top: 1pt dashed #999;
  padding-top: 2.5mm;
  margin-top: 2mm;
}

.shipping-label-print .sl-notes {
  font-size: 8.5pt;
  margin-top: 3mm;
  padding: 2mm;
  background: #f8f8f8;
  border: 1pt solid #ddd;
  border-radius: 2mm;
}

.shipping-label-print .sl-notes .sl-k {
  margin-bottom: 1mm;
}

@media print {
  body.is-printing-label .shipping-label-print {
    border: 2pt solid #000;
    break-inside: avoid;
  }
}

/* On-screen preview of print layout (print dialog uses @media print rules above) */
.order-print {
  font-family: var(--font);
  direction: rtl;
  color: #000;
  max-width: 190mm;
  margin: 0 auto;
  font-size: 9.5pt;
  line-height: 1.32;
  box-sizing: border-box;
}

.order-print .print-header {
  display: block;
  margin-bottom: 8pt;
  border-bottom: 2pt solid #000;
  padding-bottom: 4pt;
}

.order-print .print-blocks {
  display: grid;
  gap: 6pt;
}

.order-print .print-block {
  border: 1pt solid #ccc;
  border-radius: 4pt;
  padding: 6pt 8pt;
  break-inside: auto;
  page-break-inside: auto;
}

.order-print .print-block h3 {
  margin: 0 0 6pt;
  font-size: 9.5pt;
  color: #0d6e6e;
  border-bottom: 0.5pt solid #ddd;
  padding-bottom: 3pt;
}

.order-print .print-kv {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4pt 10pt;
  font-size: 9pt;
}

.order-print .print-kv div {
  break-inside: avoid;
  min-width: 0;
}

.order-print .print-kv strong {
  display: block;
  font-size: 8pt;
  color: #555;
  margin-bottom: 1pt;
}

.order-print .print-full {
  grid-column: 1 / -1;
}

.order-print .print-block p {
  margin: 0 0 4pt;
  font-size: 9pt;
  line-height: 1.35;
}

@media (max-width: 720px) {
  .order-print .print-kv {
    grid-template-columns: 1fr 1fr;
  }
}

/* ——— تابلت وموبايل: قائمة منزلقة + تخطيط متناسق ——— */
@media (max-width: 1024px) {
  .nav-toggle {
    display: inline-flex;
  }

  .sidebar-backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 38;
    background: rgba(15, 23, 42, 0.42);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.3s var(--ease-out), visibility 0.3s;
  }

  .sidebar-backdrop.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
  }

  .app-shell {
    flex-direction: row;
    position: relative;
  }

  /* RTL: بداية السطر = يمين الشاشة — لا تستخدم inset-inline-end (في RTL يصبح يساراً ويغطي المحتوى) */
  .sidebar {
    position: fixed;
    top: 0;
    bottom: 0;
    inset-inline-start: 0;
    width: min(280px, 86vw);
    max-width: 300px;
    height: 100vh;
    height: 100dvh;
    padding-top: calc(1rem + var(--safe-top));
    padding-bottom: calc(1rem + var(--safe-bottom));
    z-index: 45;
    transform: translate3d(100%, 0, 0);
    box-shadow: none;
    pointer-events: none;
  }

  .sidebar.is-open {
    transform: translate3d(0, 0, 0);
    box-shadow: var(--shadow-drawer);
    pointer-events: auto;
  }

  .main-wrap {
    width: 100%;
    min-width: 0;
  }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr;
    grid-template-rows: auto auto;
    column-gap: 0.75rem;
    row-gap: 0.65rem;
    align-items: center;
  }

  .nav-toggle {
    grid-column: 1;
    grid-row: 1;
  }

  .topbar__title-wrap {
    grid-column: 2;
    grid-row: 1;
    min-width: 0;
  }

  .topbar__actions {
    grid-column: 1 / -1;
    grid-row: 2;
    width: 100%;
    flex-direction: column;
    align-items: stretch;
  }

  .user-strip {
    justify-content: flex-start;
    flex-wrap: wrap;
    gap: 0.5rem;
    padding: 0.35rem 0;
    border-bottom: 1px solid rgba(228, 232, 240, 0.6);
    margin-bottom: 0.15rem;
  }

  .search-wrap {
    max-width: none;
    width: 100%;
    min-width: 0;
  }

  .input--search {
    width: 100%;
  }

  .seg {
    min-height: 2.45rem;
    padding: 0.48rem 0.88rem;
  }

  .modal--wide {
    width: calc(100vw - 1.25rem);
    max-height: calc(100dvh - 1.25rem);
  }
}

@media (max-width: 640px) {
  .seg {
    min-height: 2.65rem;
    padding: 0.5rem 0.95rem;
  }

  .chk {
    min-height: 2.5rem;
    align-items: center;
  }

  .form-actions {
    flex-direction: column;
  }

  .form-actions .btn {
    width: 100%;
  }

  .table-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .table-actions .btn {
    width: 100%;
    justify-content: center;
  }

  .filters {
    flex-direction: column;
    align-items: stretch;
  }

  .filters .input--select {
    width: 100%;
  }

  .panel-head--row {
    flex-direction: column;
    align-items: stretch;
  }

  .global-search-results__item {
    padding: 0.85rem 1rem;
    min-height: var(--touch-min);
  }

  .dashboard-grid {
    grid-template-columns: 1fr;
  }

  .modal__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .modal__footer .btn {
    width: 100%;
    justify-content: center;
  }

  .btn--icon {
    width: var(--touch-min);
    height: var(--touch-min);
    min-width: var(--touch-min);
  }

  .detail-row {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .detail-row dt {
    font-size: 0.78rem;
  }
}

@media (min-width: 1025px) {
  .sidebar-backdrop {
    display: none !important;
  }

  .sidebar.is-open {
    transform: none;
    box-shadow: inset -1px 0 0 rgba(255, 255, 255, 0.06);
  }
}

[hidden] {
  display: none !important;
}
