:root {
  --bg: #f3f7fb;
  --surface: #ffffff;
  --surface-soft: #f7f9fd;
  --ink: #20304f;
  --muted: #62708b;
  --line: #d8e1ef;
  --line-strong: #aebdd3;
  --teal: #078b56;
  --blue: #3299bd;
  --amber: #a16207;
  --red: #b91c1c;
  --green: #078b56;
  --violet: #7b58a6;
  --brand-navy: #506aa6;
  --brand-cyan: #2b9fc3;
  --brand-purple: #825bac;
  --brand-green: #079451;
  --shadow: 0 14px 34px rgba(55, 79, 126, 0.1);
}

/* المنصة المالية الموحدة */
.finance-metrics{display:grid;grid-template-columns:repeat(3,1fr);gap:14px;margin:18px 0}.finance-metrics article{background:#fff;border:1px solid var(--line,#dde6e3);border-radius:16px;padding:18px;box-shadow:0 8px 22px rgba(20,74,63,.07)}.finance-metrics span,.finance-metrics strong{display:block}.finance-metrics span{color:#6b7975;font-size:12px}.finance-metrics strong{color:#176b5b;font-size:23px;margin-top:8px}.finance-workspace{display:grid;grid-template-columns:360px minmax(0,1fr);gap:18px;align-items:start}.finance-form-panel{position:sticky;top:14px}.finance-list-panel{min-width:0}.tax-preview{background:#e8f5f1;color:#176b5b;border:1px solid #cce2dc;border-radius:10px;padding:12px;font-weight:700}.finance-table-wrap{overflow:auto}.finance-table{width:100%;border-collapse:collapse;min-width:680px}.finance-table th,.finance-table td{text-align:right;padding:12px;border-bottom:1px solid #e5ecea;font-size:12px}.finance-table th{color:#66746f;background:#f7faf9}.finance-status{display:inline-block;background:#e8f5f1;color:#176b5b;border-radius:16px;padding:5px 9px;font-size:10px}.finance-report-grid{display:grid;grid-template-columns:repeat(3,1fr);gap:18px}.finance-summary-row{display:flex;align-items:center;justify-content:space-between;padding:12px 0;border-bottom:1px solid #e7eeec}.finance-total{color:#176b5b;font-size:16px;border-bottom:0}.finance-calculator-fab{position:fixed;left:22px;bottom:22px;z-index:40;border:0;border-radius:24px;background:#176b5b;color:#fff;padding:12px 17px;box-shadow:0 12px 28px rgba(23,107,91,.32);cursor:pointer}.finance-calculator{display:none;position:fixed;left:22px;bottom:78px;width:320px;background:#fff;border:1px solid #dce7e4;border-radius:16px;box-shadow:0 25px 65px rgba(20,59,51,.3);z-index:45;overflow:hidden}.finance-calculator.is-open{display:block}.finance-calculator header{display:flex;align-items:center;justify-content:space-between;padding:13px 15px;border-bottom:1px solid #e3ebe9}.finance-calculator header strong,.finance-calculator header small{display:block}.finance-calculator header small{color:#6d7a76;font-size:9px}.finance-calculator header button{border:0;background:transparent;font-size:22px;cursor:pointer}.finance-calculator output{display:block;background:#173f38;color:#fff;padding:18px;text-align:left;font-size:28px;direction:ltr;min-height:65px}.finance-vat-buttons{display:grid;grid-template-columns:repeat(3,1fr);gap:6px;padding:9px;background:#f7faf9}.finance-vat-buttons button{border:1px solid #cce2dc;background:#e8f5f1;color:#176b5b;border-radius:8px;padding:8px 3px;font-size:10px}.finance-calc-grid{display:grid;grid-template-columns:repeat(4,1fr);gap:7px;padding:11px}.finance-calc-grid button{height:42px;border:0;border-radius:8px;background:#f0f4f3;cursor:pointer;font-weight:700}.finance-calc-grid button:last-child{background:#176b5b;color:#fff}.employee-management{align-items:start}
@media(max-width:900px){.finance-workspace{grid-template-columns:1fr}.finance-form-panel{position:static}.finance-report-grid{grid-template-columns:1fr}.finance-metrics{grid-template-columns:1fr 1fr}}
@media(max-width:600px){.finance-metrics{grid-template-columns:1fr}.finance-calculator{left:10px;right:10px;width:auto}.view-switch{overflow:auto;flex-wrap:nowrap}.view-switch button{white-space:nowrap}}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: Tahoma, Arial, sans-serif;
  line-height: 1.6;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  width: min(1480px, 100%);
  margin: 0 auto;
  padding: 20px;
}

.topbar {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) minmax(300px, 720px);
  gap: 16px;
  align-items: stretch;
  margin-bottom: 16px;
}

.brand-panel,
.role-panel,
.panel,
.metric-card,
.order-card,
.customer-card,
.notification-card {
  border: 1px solid var(--line);
  background: var(--surface);
  border-radius: 8px;
}

.brand-panel {
  padding: 20px;
}

.brand-logo {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  margin-bottom: 14px;
}

.brand-logo img {
  display: block;
  width: min(280px, 100%);
  max-height: 132px;
  object-fit: contain;
  background: white;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
}

.eyebrow {
  color: var(--teal);
  font-size: 0.82rem;
  font-weight: 700;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: clamp(1.6rem, 3vw, 2.35rem);
  letter-spacing: 0;
}

h2 {
  font-size: 1.1rem;
  margin-bottom: 12px;
}

h3 {
  font-size: 1rem;
  margin-bottom: 8px;
}

.muted {
  color: var(--muted);
}

.role-panel {
  padding: 14px;
}

.role-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(120px, 1fr));
  gap: 8px;
}

.role-card {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 10px;
  text-align: right;
  color: var(--ink);
  min-height: 78px;
}

.role-card strong,
.role-card span {
  display: block;
}

.role-card span {
  color: var(--muted);
  font-size: 0.8rem;
}

.role-card.is-active {
  border-color: var(--teal);
  background: #ecfdf5;
}

.view-switch {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}

.view-button,
.action-button,
.secondary-button,
.danger-button {
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  padding: 9px 12px;
  min-height: 42px;
}

.view-button.is-active,
.action-button.primary {
  border-color: var(--teal);
  background: var(--teal);
  color: white;
}

.secondary-button {
  background: var(--surface-soft);
}

.danger-button {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(150px, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  padding: 14px;
}

.metric-card span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
}

.metric-card strong {
  display: block;
  margin-top: 4px;
  font-size: 1.35rem;
  overflow-wrap: anywhere;
}

.workspace-grid {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.panel {
  padding: 16px;
}

.stack {
  display: grid;
  gap: 12px;
}

.field {
  display: grid;
  gap: 6px;
}

.field label {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  padding: 10px 12px;
  min-height: 42px;
}

.field textarea {
  min-height: 90px;
  resize: vertical;
}

.check-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--ink);
  font-size: 0.9rem;
}

.filters {
  display: grid;
  grid-template-columns: minmax(220px, 1fr) 170px 150px;
  gap: 10px;
  margin-bottom: 14px;
}

.board {
  overflow-x: auto;
  padding-bottom: 4px;
}

.lanes {
  display: grid;
  grid-template-columns: repeat(6, minmax(340px, 1fr));
  gap: 10px;
  min-width: 2100px;
}

.lane {
  border: 1px solid var(--line);
  background: var(--surface-soft);
  border-radius: 8px;
  padding: 10px;
  min-height: 420px;
}

.lane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
  gap: 10px;
}

.lane-header strong {
  font-size: 0.95rem;
}

.count-pill,
.badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: white;
  min-height: 26px;
  padding: 2px 9px;
  color: var(--muted);
  font-size: 0.78rem;
  white-space: nowrap;
}

.order-card {
  padding: 12px;
  margin-bottom: 10px;
  box-shadow: 0 8px 18px rgba(23, 32, 51, 0.05);
}

.order-head,
.order-meta-row,
.order-actions,
.status-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.order-head {
  justify-content: space-between;
}

.order-code {
  font-weight: 800;
}

.order-title {
  margin: 8px 0 8px;
}

.order-meta {
  display: grid;
  gap: 6px;
  margin: 10px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.order-meta-row {
  justify-content: space-between;
  border-bottom: 1px dashed var(--line);
  padding-bottom: 5px;
}

.order-meta-row:last-child {
  border-bottom: 0;
}

.status-row {
  flex-wrap: wrap;
  margin: 8px 0;
}

.badge.urgent {
  border-color: #fed7aa;
  background: #fff7ed;
  color: #9a3412;
}

.badge.high {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--amber);
}

.badge.normal {
  border-color: #bfdbfe;
  background: #eff6ff;
  color: var(--blue);
}

.badge.delay {
  border-color: #fecaca;
  background: #fff1f2;
  color: var(--red);
}

.badge.done {
  border-color: #bbf7d0;
  background: #f0fdf4;
  color: var(--green);
}

.badge.external {
  border-color: #ddd6fe;
  background: #f5f3ff;
  color: var(--violet);
}

.progress {
  position: relative;
  height: 8px;
  overflow: hidden;
  background: #e5e7eb;
  border-radius: 999px;
}

.progress span {
  display: block;
  height: 100%;
  background: var(--teal);
}

.order-note {
  color: var(--muted);
  font-size: 0.84rem;
  border-right: 3px solid var(--line-strong);
  padding: 8px 10px 8px 0;
  margin: 10px 0;
}

.order-actions {
  flex-wrap: wrap;
  margin-top: 10px;
}

.action-button,
.secondary-button,
.danger-button {
  font-size: 0.85rem;
}

details.delay-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

details.delay-box summary,
details.edit-box summary {
  color: var(--red);
  cursor: pointer;
  font-weight: 700;
  font-size: 0.88rem;
}

details.edit-box {
  margin-top: 10px;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}

details.edit-box summary {
  color: var(--teal);
}

.delay-form,
.edit-order-form {
  display: grid;
  gap: 8px;
  margin-top: 10px;
}

.notification-card {
  padding: 12px;
  margin-bottom: 8px;
}

.notification-card strong {
  display: block;
  font-size: 0.9rem;
}

.notification-card span {
  color: var(--muted);
  font-size: 0.82rem;
}

.role-summary {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #f8fafc;
}

.permission-list {
  display: grid;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.permission-list li {
  border-right: 3px solid var(--teal);
  padding-right: 10px;
  color: var(--muted);
}

.customer-layout {
  display: grid;
  grid-template-columns: minmax(300px, 390px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
}

.customer-statement-panel {
  grid-column: 1 / -1;
  margin-top: 4px;
}

.customer-statement-search {
  max-width: 720px;
  align-items: end;
}

.customer-statement-result {
  margin-top: 18px;
}

.statement-related-orders {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.statement-related-orders article {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fbfa;
}

.statement-related-orders article div,
.statement-related-orders article span,
.statement-related-orders article strong {
  display: block;
}

.statement-related-orders article span {
  color: var(--muted);
  font-size: 12px;
  margin-top: 4px;
}

.external-account-orders,
.statement-order-results {
  margin-top: 18px;
}

.customer-card {
  padding: 20px;
  box-shadow: var(--shadow);
}

.customer-brand-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  overflow: hidden;
  border-color: #cfe2df;
  background:
    radial-gradient(circle at 12% 15%, rgba(37, 99, 235, 0.09), transparent 34%),
    linear-gradient(135deg, #ffffff 0%, #f1faf7 100%);
}

.customer-brand-panel .brand-logo {
  margin: 0;
}

.customer-brand-copy {
  display: grid;
  gap: 2px;
  text-align: left;
}

.customer-brand-copy span {
  color: var(--teal);
  font-size: 0.8rem;
  font-weight: 800;
}

.customer-brand-copy strong {
  color: var(--ink);
  font-size: clamp(1rem, 2vw, 1.35rem);
}

.customer-search-panel {
  position: sticky;
  top: 16px;
  padding: 22px;
  border-color: #cfe2df;
  box-shadow: var(--shadow);
}

.customer-search-kicker,
.customer-personal-welcome > span,
.customer-appreciation-grid > div > span {
  color: var(--teal);
  font-size: 0.78rem;
  font-weight: 800;
}

.customer-search-panel h2 {
  margin: 3px 0 6px;
}

.customer-search-form {
  display: grid;
  gap: 14px;
  margin-top: 18px;
}

.customer-search-button {
  width: 100%;
  min-height: 48px;
}

.customer-search-welcome,
.customer-no-result {
  display: grid;
  gap: 8px;
  min-height: 220px;
  place-content: center;
  text-align: center;
  background: linear-gradient(145deg, #f1faf7, #eef5ff);
}

.customer-search-welcome span {
  color: var(--teal);
  font-weight: 800;
}

.customer-search-welcome strong,
.customer-no-result strong {
  font-size: 1.25rem;
}

.customer-search-welcome small,
.customer-no-result span {
  color: var(--muted);
}

.customer-personal-welcome {
  margin: -4px -4px 20px;
  padding: 22px;
  border: 1px solid #cfe2df;
  border-radius: 14px;
  background:
    linear-gradient(115deg, rgba(15, 118, 110, 0.09), rgba(37, 99, 235, 0.08)),
    #ffffff;
}

.customer-personal-welcome h1 {
  margin: 2px 0 4px;
  color: var(--ink);
  font-size: clamp(1.35rem, 3vw, 2rem);
}

.customer-personal-welcome p {
  margin: 0;
  color: var(--muted);
}

.customer-appreciation-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.customer-appreciation-grid > div {
  padding: 18px;
  border: 1px solid;
  border-radius: 14px;
}

.customer-appreciation-grid h3 {
  margin: 4px 0 6px;
  font-size: 1.05rem;
}

.customer-appreciation-grid p {
  margin: 0;
  color: var(--muted);
}

.customer-review-callout {
  border-color: #bfdbfe !important;
  background: #eff6ff;
}

.customer-return-callout {
  border-color: #bbf7d0 !important;
  background: #f0fdf4;
}

.timeline {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 22px 1fr;
  gap: 10px;
  align-items: start;
}

.timeline-dot {
  width: 12px;
  height: 12px;
  margin-top: 7px;
  border-radius: 999px;
  background: var(--line-strong);
}

.timeline-item.is-public .timeline-dot {
  background: var(--teal);
}

.timeline-item strong {
  display: block;
}

.timeline-item span {
  color: var(--muted);
  font-size: 0.82rem;
}

.customer-stage {
  display: grid;
  grid-template-columns: repeat(7, minmax(90px, 1fr));
  gap: 8px;
  margin: 14px 0;
}

.stage-step {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-soft);
  min-height: 64px;
  color: var(--muted);
  font-size: 0.82rem;
}

.stage-step.is-active,
.stage-step.is-done {
  border-color: var(--teal);
  background: #ecfdf5;
  color: var(--ink);
}

.stage-step {
  display: flex;
  align-items: center;
  gap: 8px;
  transition: background-color 160ms ease, border-color 160ms ease, color 160ms ease;
}

.stage-step-marker {
  display: inline-grid;
  place-items: center;
  flex: 0 0 27px;
  width: 27px;
  height: 27px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #64748b;
  font-weight: 800;
}

.stage-step.is-done {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.stage-step.is-done .stage-step-marker {
  background: #16a34a;
  color: #fff;
}

.stage-step.is-active {
  border-color: #0f766e;
  background: #0f766e;
  color: #fff;
  box-shadow: 0 8px 18px rgba(15, 118, 110, 0.2);
}

.stage-step.is-active .stage-step-marker {
  background: #fff;
  color: #0f766e;
}

.empty-state {
  border: 1px dashed var(--line-strong);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  background: var(--surface-soft);
}

.sync-status {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-weight: 700;
}

.sync-status.is-online {
  border-color: rgba(21, 128, 61, 0.3);
  background: #ecfdf5;
  color: var(--green);
}

.sync-status.is-local {
  border-color: rgba(161, 98, 7, 0.35);
  background: #fffbeb;
  color: var(--amber);
}

.toast {
  position: fixed;
  bottom: 18px;
  left: 18px;
  max-width: 360px;
  border: 1px solid var(--line);
  border-right: 5px solid var(--teal);
  background: white;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: var(--shadow);
  transform: translateY(20px);
  opacity: 0;
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.site-footer {
  margin-top: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
  color: var(--muted);
  padding: 14px 18px;
  text-align: center;
  font-weight: 700;
}

.login-layout {
  display: grid;
  grid-template-columns: minmax(280px, 0.85fr) minmax(320px, 1fr);
  gap: 16px;
  min-height: calc(100vh - 40px);
  align-items: center;
}

.login-brand {
  min-height: 360px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.login-panel {
  box-shadow: var(--shadow);
}

.employee-login-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 1fr));
  gap: 8px;
  margin-top: 14px;
}

.employee-login-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 10px;
  text-align: right;
  color: var(--ink);
}

.employee-login-card strong,
.employee-login-card span,
.employee-login-card small {
  display: block;
}

.employee-login-card span,
.employee-login-card small {
  color: var(--muted);
}

.account-panel {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.account-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.two-fields {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.employee-list {
  display: grid;
  gap: 8px;
}

.employee-management {
  display: grid;
  grid-template-columns: 380px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.employee-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px;
  background: var(--surface-soft);
}

.employee-row-wide {
  align-items: flex-start;
}

.employee-row strong,
.employee-row small {
  display: block;
}

.employee-row small {
  color: var(--muted);
}

.employee-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
}

.permissions-box {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-soft);
  padding: 12px;
}

.permissions-box h3 {
  margin-bottom: 10px;
}

.permission-check {
  border-bottom: 1px dashed var(--line);
  padding-bottom: 8px;
  margin-bottom: 8px;
}

.permission-check:last-child {
  border-bottom: 0;
  margin-bottom: 0;
  padding-bottom: 0;
}

.mini {
  min-height: 34px;
  padding: 6px 9px;
  font-size: 0.78rem;
}

.invoice-card {
  display: grid;
  gap: 10px;
}

.invoice-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
}

.invoice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.invoice-grid div,
.finance-grid div {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px;
  background: var(--surface-soft);
}

.invoice-grid span,
.finance-grid span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.invoice-grid strong,
.finance-grid strong {
  display: block;
  overflow-wrap: anywhere;
}

.invoice-table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid var(--line);
  font-size: 0.84rem;
}

.invoice-table th,
.invoice-table td {
  padding: 8px;
  border-bottom: 1px solid var(--line);
  text-align: right;
  vertical-align: top;
}

.invoice-table th {
  background: #eef2f7;
  color: var(--muted);
  font-size: 0.76rem;
}

.invoice-table tr:last-child td {
  border-bottom: 0;
}

.finance-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.finance-grid .done {
  border-color: #bbf7d0;
  background: #f0fdf4;
}

.finance-grid .delay {
  border-color: #fecaca;
  background: #fff1f2;
}

.customer-finance {
  margin: 12px 0;
}

.reminder-strip {
  border: 1px solid #fde68a;
  border-radius: 8px;
  background: #fffbeb;
  color: var(--amber);
  padding: 8px 10px;
  font-size: 0.82rem;
}

.action-button.whatsapp {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
}

.action-button.warning {
  border-color: #fde68a;
  background: #fffbeb;
  color: var(--amber);
}

.action-button.review {
  border-color: #c4b5fd;
  background: #f5f3ff;
  color: var(--violet);
}

@media (max-width: 1100px) {
  .topbar,
  .workspace-grid,
  .customer-layout,
  .login-layout,
  .employee-management {
    grid-template-columns: 1fr;
  }

  .role-grid {
    grid-template-columns: repeat(2, minmax(130px, 1fr));
  }

  .metrics-grid {
    grid-template-columns: repeat(2, minmax(140px, 1fr));
  }
}

@media (max-width: 760px) {
  .app-shell {
    padding: 12px;
  }

  .brand-logo {
    justify-content: center;
  }

  .brand-logo img {
    width: min(220px, 100%);
    max-height: 112px;
  }

  .filters,
  .two-fields,
  .invoice-grid,
  .finance-grid,
  .employee-login-grid {
    grid-template-columns: 1fr;
  }

  .customer-stage {
    grid-template-columns: repeat(2, minmax(120px, 1fr));
  }

  .role-grid,
  .metrics-grid {
    grid-template-columns: 1fr;
  }

  .account-panel,
  .employee-row {
    align-items: stretch;
    flex-direction: column;
  }

  .employee-actions {
    justify-content: stretch;
  }

  .employee-actions button {
    width: 100%;
  }
}
.workflow-preview {
  display: grid;
  gap: 8px;
  padding: 14px;
  border: 1px solid rgba(23, 107, 91, 0.2);
  border-radius: 14px;
  background: rgba(23, 107, 91, 0.06);
}

.workflow-preview strong { color: #176b5b; }
.workflow-preview span { color: #40534e; font-size: 0.9rem; }

.delivery-notice {
  margin: 14px 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: #fff8e6;
  border: 1px solid #efdca6;
  color: #705a20;
  line-height: 1.8;
}

.finance-expense-lists {
  display: grid;
  gap: 16px;
  grid-column: 1 / -1;
}

.finance-group-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.finance-group-head h2 { margin: 0; }
.finance-group-head strong { color: #176b5b; white-space: nowrap; }
.employee-permission-editor {
  width: 100%;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid rgba(23, 107, 91, 0.14);
}

.employee-permission-editor summary {
  cursor: pointer;
  color: #176b5b;
  font-weight: 700;
}

.employee-permission-form {
  display: grid;
  gap: 12px;
  margin-top: 12px;
}
.finance-calc-grid .calc-key-operation {
  background: #dfeeea;
  color: #176b5b;
  font-size: 18px;
}

.finance-calc-grid .calc-key-utility {
  background: #fff2dc;
  color: #8b5e12;
}

.finance-calc-grid .calc-key-equals {
  background: #176b5b;
  color: #fff;
  font-size: 18px;
}

.finance-calc-grid .calc-key-zero,
.finance-calc-grid .calc-key-decimal {
  grid-column: span 2;
}

.finance-calc-grid button.calc-key-decimal {
  background: #f0f4f3;
  color: #172a25;
}
.platform-messaging-card {
  display: grid;
  gap: 5px;
  margin-top: 14px;
  padding: 12px;
  border-radius: 10px;
  border: 1px solid #fde68a;
  background: #fffbeb;
}

.platform-messaging-card.is-connected {
  border-color: #86efac;
  background: #f0fdf4;
}

.platform-messaging-card a,
.site-footer a {
  color: #176b5b;
  font-weight: 800;
  direction: ltr;
}

/* استجابة تلقائية لكل أحجام الشاشات */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  overflow-x: hidden;
}

img,
canvas {
  max-width: 100%;
  height: auto;
}

.app-shell {
  width: 100%;
  max-width: 1480px;
}

.workspace-grid > *,
.topbar > *,
.finance-workspace > *,
.customer-layout > *,
.employee-management > *,
.order-card,
.panel {
  min-width: 0;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
}

.metrics-grid,
.role-grid {
  grid-template-columns: repeat(auto-fit, minmax(min(155px, 100%), 1fr));
}

.board {
  max-width: 100%;
  overflow: visible;
}

.lanes {
  grid-template-columns: repeat(auto-fit, minmax(min(300px, 100%), 1fr));
  min-width: 0;
}

.customer-stage {
  grid-template-columns: repeat(auto-fit, minmax(min(125px, 100%), 1fr));
}

.finance-table-wrap {
  width: 100%;
  max-width: 100%;
  -webkit-overflow-scrolling: touch;
}

.order-actions,
.account-actions,
.employee-actions {
  flex-wrap: wrap;
}

.order-actions button {
  flex: 1 1 150px;
}

.site-footer {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 8px 22px;
}

@media (max-width: 1100px) {
  .app-shell { padding: 16px; }
  .workspace-grid { grid-template-columns: minmax(260px, 320px) minmax(0, 1fr); }
  .topbar { grid-template-columns: 1fr; }
  .finance-workspace,
  .customer-layout,
  .employee-management,
  .login-layout { grid-template-columns: 1fr; }
  .finance-form-panel { position: static; }
}

@media (max-width: 820px) {
  .workspace-grid { grid-template-columns: 1fr; }
  .lanes { grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr)); }
  .finance-report-grid { grid-template-columns: 1fr; }
  .login-layout { min-height: auto; }
}

@media (max-width: 600px) {
  .app-shell { padding: 8px; }
  .panel,
  .order-card,
  .customer-card { padding: 12px; }
  h1 { font-size: clamp(1.35rem, 7vw, 1.9rem); }
  h2 { font-size: clamp(1.05rem, 5.5vw, 1.35rem); }
  .view-switch {
    overflow-x: auto;
    flex-wrap: nowrap;
    padding-bottom: 6px;
    scrollbar-width: thin;
  }
  .view-switch button { flex: 0 0 auto; white-space: nowrap; }
  .two-fields,
  .invoice-grid,
  .finance-grid,
  .filters,
  .employee-login-grid { grid-template-columns: 1fr; }
  .invoice-top,
  .finance-group-head { flex-direction: column; align-items: stretch; }
  .action-button,
  .secondary-button,
  .danger-button,
  .view-button { min-height: 44px; }
  .finance-calculator-fab { left: 12px; bottom: 12px; }
  .finance-calculator { left: 8px; right: 8px; bottom: 70px; width: auto; }
  .finance-table { min-width: 640px; }
}

/* الملف المحاسبي الأصلي داخل المنصة */
.accounting-native-workspace{display:grid;gap:16px}.accounting-native-nav{display:grid;gap:14px}.accounting-native-tabs{display:flex;gap:8px;overflow-x:auto;padding-bottom:6px;scrollbar-width:thin}.accounting-native-tabs .view-button{flex:0 0 auto}.native-accounting-sheet{display:grid;gap:18px}.accounting-native-grid{display:grid;grid-template-columns:repeat(4,minmax(0,1fr));gap:12px}.native-accounting-form,.native-supplier-settings{display:grid;gap:14px;padding:16px;border:1px solid var(--line);border-radius:14px;background:var(--surface-soft)}.accounting-inline-metrics{margin:0}.order-assignment-panel,.order-delegation-panel{display:grid;gap:12px;margin:0;padding:16px;border:1px solid var(--line);border-radius:14px;background:#f8fafc}.order-assignment-panel legend{padding:0 8px;font-weight:800}.order-cost-required{padding:12px;border:1px solid #f59e0b;border-radius:12px;background:#fffbeb}.order-delegation-panel{margin-top:16px}.order-delegation-form{display:flex;align-items:end;gap:10px}.order-delegation-form .field{flex:1}

@media (max-width:900px){
  .app-shell{width:100%;padding:10px}.topbar,.workspace-grid,.finance-workspace,.employee-management,.finance-report-grid{grid-template-columns:1fr}.topbar{gap:10px}.brand-panel,.role-panel,.panel{padding:14px}.view-switch{display:flex;overflow-x:auto;white-space:nowrap;gap:7px;padding:8px;position:sticky;top:0;z-index:25;background:rgba(248,250,252,.96);backdrop-filter:blur(8px)}.view-button{flex:0 0 auto}.metrics-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.accounting-native-grid,.invoice-grid,.finance-grid,.operational-details-grid{grid-template-columns:repeat(2,minmax(0,1fr))}.finance-form-panel{position:static}.compact-orders-grid{grid-template-columns:1fr}.order-card-expanded{padding:12px}.invoice-table,.finance-table{min-width:620px}.employee-row-wide{grid-template-columns:1fr}.employee-actions{flex-wrap:wrap}.create-order-fab{position:fixed;right:10px;bottom:10px;z-index:60;max-width:calc(100vw - 20px)}
}

@media (max-width:600px){
  body{font-size:14px}.app-shell{padding:6px}.topbar h1{font-size:1.15rem}.account-actions,.create-order-page-head,.accounting-section-head,.order-delegation-form{align-items:stretch;flex-direction:column}.account-actions button,.order-delegation-form button{width:100%}.metrics-grid,.accounting-native-grid,.invoice-grid,.finance-grid,.operational-details-grid,.two-fields,.shipping-details{grid-template-columns:1fr}.metric-card{padding:12px}.compact-order-summary{align-items:flex-start;gap:10px}.compact-order-status{align-items:flex-end}.invoice-top,.status-row,.order-actions{gap:8px}.native-accounting-form,.native-supplier-settings,.order-assignment-panel{padding:12px}.finance-table-wrap{margin-inline:-8px;padding-inline:8px}.create-order-fab{right:8px;bottom:8px;min-height:48px}.finance-calculator-fab{z-index:61}.site-footer{padding-bottom:66px}
}
.finance-close-balance {
  min-width: 155px;
  white-space: normal;
  line-height: 1.35;
}

.finance-closed-label {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 66px;
  padding: 5px 9px;
  border-radius: 999px;
  background: #e8f5f1;
  color: #176b5b;
  font-weight: 700;
  font-size: 0.75rem;
}

.document-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
  align-items: center;
  min-width: 220px;
}

.order-document-actions {
  width: 100%;
  padding-bottom: 0.7rem;
  margin-bottom: 0.25rem;
  border-bottom: 1px solid rgba(23, 107, 91, 0.15);
}

.secondary-button.whatsapp {
  color: #087b3f;
  border-color: rgba(8, 123, 63, 0.3);
  background: #effbf4;
}

.document-link-note {
  display: block;
  margin-top: 0.3rem;
  color: #176b5b;
  font-weight: 700;
}

.document-modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 1200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(15, 35, 31, 0.65);
  backdrop-filter: blur(5px);
}

.document-modal {
  width: min(760px, 100%);
  max-height: calc(100vh - 2rem);
  overflow: auto;
  padding: 1.25rem;
  border-radius: 22px;
  background: #fff;
  box-shadow: 0 28px 80px rgba(7, 31, 26, 0.35);
}

.document-modal > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.document-modal h2 { margin: 0.15rem 0 0; }

.modal-close {
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  color: #263a35;
  background: #edf4f2;
  font-size: 1.7rem;
  cursor: pointer;
}

@media (max-width: 680px) {
  .document-actions { min-width: 0; width: 100%; }
  .document-actions button { flex: 1 1 calc(50% - 0.45rem); }
  .document-modal-backdrop { align-items: end; padding: 0; }
  .document-modal { max-height: 92vh; border-radius: 22px 22px 0 0; }
}
.quote-items-head,.quote-item-row{display:grid;grid-template-columns:2fr 1.2fr .7fr 1fr 1fr 1fr 1.2fr auto;gap:8px;align-items:center}
.quote-items-head{border:1px solid #cfe0db;border-bottom:3px solid #176b5b;padding:10px;background:#f3f8f7}
.quote-item-row{border:1px solid #d5e3df;border-top:0;padding:10px;background:#fff}
.quote-items-head>span,.quote-item-row>*{border-left:1px solid #d5e3df;padding-left:8px}
.deleted-record{display:flex;align-items:center;justify-content:space-between;gap:16px;padding:12px 0;border-bottom:1px solid #e1ebe8}.deleted-record>div{display:grid;gap:4px}.deleted-record small{color:#687873;font-size:12px}
.shipment-status{display:flex;flex-wrap:wrap;gap:10px;margin:12px 0;padding:12px;border:1px solid #b8ddd2;border-radius:10px;background:#e8f5f1;color:#176b5b}.shipping-details{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}@media(max-width:700px){.shipping-details{grid-template-columns:1fr}}
.statement-search{display:flex;gap:12px;align-items:end}.statement-search .field{flex:1}.statement-result{order:2}.statement-head{display:flex;justify-content:space-between;align-items:center;gap:18px}.statement-totals{display:grid;grid-template-columns:repeat(3,1fr);gap:12px;margin-top:18px}.statement-totals>div{border:1px solid #d5e3df;border-radius:12px;padding:14px;background:#f7faf9}.statement-totals span,.statement-totals strong{display:block}.statement-totals strong{margin-top:7px;color:#176b5b;font-size:18px}@media(max-width:700px){.statement-search,.statement-head{flex-direction:column;align-items:stretch}.statement-totals{grid-template-columns:1fr}}
.finance-workspace:has(#unifiedQuoteForm){grid-template-columns:minmax(720px,1.55fr) minmax(420px,1fr)}
.finance-workspace:has(#unifiedQuoteForm){display:flex;flex-direction:column;gap:18px}
.finance-workspace:has(#unifiedQuoteForm) .finance-list-panel{order:-1;width:100%}
.finance-workspace:has(#unifiedQuoteForm) .finance-form-panel{order:2;width:100%;position:static}
.finance-workspace:has(#unifiedReceiptForm),.finance-workspace:has(#unifiedPaymentForm){display:flex;flex-direction:column;gap:18px}
.finance-workspace:has(#unifiedReceiptForm) .finance-list-panel,.finance-workspace:has(#unifiedPaymentForm) .finance-list-panel{order:-1;width:100%}
.finance-workspace:has(#unifiedReceiptForm) .finance-form-panel,.finance-workspace:has(#unifiedPaymentForm) .finance-form-panel{order:2;width:100%;position:static}
.finance-form-panel .two-fields{gap:18px}
.finance-form-panel .two-fields>.field{background:#f8fbfa;border:1px solid #d6e4e0;border-radius:12px;padding:12px}
.finance-form-panel .two-fields>.field input,.finance-form-panel .two-fields>.field select{background:#fff}
#unifiedQuoteForm .field>label{font-size:14px;margin-bottom:8px}
#unifiedQuoteForm input,#unifiedQuoteForm textarea{min-height:44px;font-size:14px}
.quote-items{overflow-x:auto;padding-bottom:4px}
.quote-items-head,.quote-item-row{min-width:900px}
.quote-items-head{font-size:.78rem;color:var(--muted);margin-bottom:6px}
.quote-item-row{margin-bottom:8px}
.quote-item-row input,.quote-item-row output{min-width:0}
.quote-item-row output{font-size:.8rem;text-align:center;white-space:nowrap}
@media(max-width:1200px){.finance-workspace:has(#unifiedQuoteForm){grid-template-columns:1fr}.finance-workspace:has(#unifiedQuoteForm) .finance-form-panel{position:static}}
@media(max-width:900px){.quote-items-head{display:none}.quote-item-row{min-width:0;grid-template-columns:repeat(2,minmax(0,1fr));padding:10px;border:1px solid var(--border);border-radius:10px}.quote-item-row output{padding:6px;background:var(--surface-muted);border-radius:6px}.quote-item-row button{grid-column:span 2}}

.customer-topbar {
  grid-template-columns: 1fr;
}

@media (max-width: 760px) {
  .customer-brand-panel {
    align-items: center;
    flex-direction: column;
  }

  .customer-brand-copy {
    text-align: center;
  }

  .customer-search-panel {
    position: static;
  }

  .customer-appreciation-grid {
    grid-template-columns: 1fr;
  }
}

.order-color-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 12px;
}

.legend-item,
.deadline-label {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.76rem;
  font-weight: 700;
}

.legend-item.receive {
  color: #166534;
  background: #dcfce7;
}

.legend-item.approaching {
  color: #9a3412;
  background: #ffedd5;
}

.legend-item.urgent {
  color: #991b1b;
  background: #fee2e2;
}

.compact-orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(270px, 100%), 1fr));
  gap: 12px;
  align-items: start;
}

.load-more-orders {
  display: flex;
  justify-content: center;
  padding: 18px 0 4px;
}

.compact-order-card {
  margin: 0;
  padding: 0;
  overflow: hidden;
  border-right-width: 6px;
  transition: box-shadow 160ms ease, border-color 160ms ease;
}

.compact-order-card[open] {
  grid-column: 1 / -1;
  box-shadow: 0 18px 42px rgba(23, 32, 51, 0.13);
}

.compact-order-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  min-height: 88px;
  padding: 14px;
  list-style: none;
  cursor: pointer;
  user-select: none;
}

.compact-order-summary::-webkit-details-marker {
  display: none;
}

.compact-order-summary::after {
  content: "+";
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--teal);
  background: rgba(15, 118, 110, 0.09);
  font-size: 1.25rem;
  font-weight: 700;
}

.compact-order-card[open] > .compact-order-summary::after {
  content: "−";
}

.compact-order-identity,
.compact-order-status {
  display: flex;
  min-width: 0;
}

.compact-order-identity {
  flex-direction: column;
  gap: 2px;
}

.compact-order-identity strong {
  font-size: 1rem;
  color: var(--ink);
}

.compact-order-identity span {
  overflow: hidden;
  color: var(--muted);
  text-overflow: ellipsis;
  white-space: nowrap;
}

.compact-order-identity small {
  color: #176b5b;
  font-size: 0.76rem;
  direction: ltr;
  text-align: right;
}

.compact-order-status {
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
}

.compact-order-follow {
  min-width: 150px;
  white-space: nowrap;
}

.compact-order-follow:disabled {
  opacity: 0.72;
  cursor: default;
}

.order-content-section {
  display: grid;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.order-content-section > h3 {
  margin: 0;
  font-size: 1rem;
}

.order-workflow-priority {
  border-color: #93c5fd;
  background: #eff6ff;
}

.order-workflow-priority .role-workflow-stack {
  margin: 0;
}

.order-secondary-details {
  margin-top: 4px;
}

.image-source-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.image-camera-input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.attachment-management {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
  padding: 12px;
}

.attachment-management > summary {
  cursor: pointer;
  font-weight: 800;
}

.attachment-management-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin-top: 12px;
}

.attachment-replacement-form {
  display: grid;
  align-content: start;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

@media (max-width: 700px) {
  .attachment-management-grid { grid-template-columns: 1fr; }
  .image-source-controls > button { flex: 1 1 130px; }
}

.order-card-expanded {
  padding: 14px;
  border-top: 1px solid var(--line);
}

.compact-order-card.is-awaiting-receipt {
  border-color: #22c55e;
  background: #f0fdf4;
}

.compact-order-card.is-awaiting-receipt .deadline-label {
  color: #166534;
  background: #dcfce7;
}

.compact-order-card.is-due-approaching {
  border-color: #f97316;
  background: #fff7ed;
}

.compact-order-card.is-due-approaching .deadline-label {
  color: #9a3412;
  background: #ffedd5;
}

.compact-order-card.is-due-urgent {
  border-color: #dc2626;
  background: #fef2f2;
}

.compact-order-card.is-due-urgent .deadline-label {
  color: #991b1b;
  background: #fee2e2;
}

.compact-order-card.is-completed {
  border-color: #16a34a;
  background: #f0fdf4;
}

.compact-order-card.is-completed .deadline-label {
  color: #166534;
  background: #dcfce7;
  font-weight: 800;
}

.compact-order-card.is-active-order .deadline-label {
  color: #334155;
  background: #e2e8f0;
}

.create-order-fab {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  z-index: 80;
  min-height: 50px;
  padding: 0 20px;
  border: 0;
  border-radius: 999px;
  color: #fff;
  background: linear-gradient(135deg, #176b5b, #0f766e);
  box-shadow: 0 14px 34px rgba(15, 118, 110, 0.3);
  font: inherit;
  font-weight: 800;
  cursor: pointer;
}

.create-order-fab:hover { transform: translateY(-2px); }

.admin-live-tracking,
.order-payment-panel {
  display: grid;
  gap: 12px;
  margin: 14px 0;
  padding: 14px;
  border: 1px solid #b8ddd2;
  border-radius: 14px;
  background: #f8fcfb;
}

.admin-live-tracking > header,
.order-payment-panel > div:first-child {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.admin-live-tracking header strong,
.admin-live-tracking header small,
.order-payment-panel strong,
.order-payment-panel small { display: block; }

.admin-live-tracking header small,
.order-payment-panel small { margin-top: 4px; color: var(--muted); }

.admin-live-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.admin-live-summary > div,
.admin-history-list > div {
  padding: 10px;
  border: 1px solid #dbe9e5;
  border-radius: 10px;
  background: #fff;
}

.admin-live-summary span,
.admin-live-summary strong,
.admin-history-list span,
.admin-history-list strong,
.admin-history-list small { display: block; }

.admin-live-summary span,
.admin-history-list span,
.admin-history-list small { color: var(--muted); font-size: 0.72rem; }

.admin-live-summary strong,
.admin-history-list strong { margin-top: 4px; }

.admin-history-list { display: grid; gap: 7px; }
.admin-history-list > div { display: grid; grid-template-columns: 145px 1fr 120px; gap: 10px; align-items: center; }

@media (max-width: 720px) {
  .admin-live-summary { grid-template-columns: 1fr 1fr; }
  .admin-history-list > div { grid-template-columns: 1fr; }
  .create-order-fab { right: 10px; bottom: 10px; min-height: 46px; padding: 0 15px; }
}

.accounting-workbook-nav {
  border-color: #8b5cf6;
  background: #f5f3ff;
  color: #5b21b6;
  font-weight: 800;
}

.accounting-workbook-nav.is-active {
  color: #fff;
  background: linear-gradient(135deg, #6d28d9, #7c3aed);
}

.accounting-launcher {
  border-color: #c4b5fd;
  background: linear-gradient(145deg, #fff, #f5f3ff);
}

.accounting-launcher-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 10px 0 14px;
}

.accounting-launcher-stats span {
  padding: 5px 9px;
  border-radius: 999px;
  color: #5b21b6;
  background: #ede9fe;
  font-size: .75rem;
}

.accounting-workbook-workspace,
.accounting-mapping-grid {
  display: grid;
  gap: 14px;
}

.accounting-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.accounting-section-head h2 { margin: 4px 0; }

.accounting-mapping-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  padding: 14px;
  border: 1px solid #ddd6fe;
  border-radius: 14px;
  background: #faf9ff;
}

.accounting-report-check {
  align-self: end;
  min-height: 48px;
  padding: 10px 12px;
  border: 1px solid #c4b5fd;
  border-radius: 10px;
  background: #f5f3ff;
}

.accounting-safety-note {
  padding: 12px 14px;
  border-right: 4px solid #0f766e;
  border-radius: 9px;
  color: #155e75;
  background: #ecfeff;
  line-height: 1.7;
}

.accounting-preview-table { max-height: 440px; overflow: auto; }
.accounting-preview-table table { min-width: 900px; }

@media (max-width: 900px) {
  .accounting-mapping-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 620px) {
  .accounting-mapping-grid { grid-template-columns: 1fr; }
  .accounting-section-head { flex-direction: column; }
}

.admin-journey {
  display: grid;
  gap: 9px;
  margin-top: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-soft);
}

.journey-heading {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  font-size: 0.82rem;
}

.journey-heading span {
  color: var(--muted);
}

.journey-steps {
  display: grid;
  grid-template-columns: repeat(6, minmax(110px, 1fr));
  gap: 6px;
  overflow-x: auto;
}

.journey-step {
  padding: 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--muted);
  background: white;
  font-size: 0.72rem;
}

.journey-step.is-active {
  border-color: #2563eb;
  color: #1e3a8a;
  background: #eff6ff;
  font-weight: 700;
}

.journey-step.is-done {
  border-color: #86efac;
  color: #166534;
  background: #f0fdf4;
}

.customer-stage {
  grid-template-columns: repeat(6, minmax(110px, 1fr));
}

@media (max-width: 700px) {
  .compact-order-summary {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .compact-order-status {
    align-items: flex-start;
  }

  .journey-heading {
    flex-direction: column;
  }
}

/* الموضع النهائي للحاسبة: أعلى اليسار في جميع المقاسات */
.finance-calculator-fab {
  top: 16px;
  bottom: auto;
  left: 16px;
}

.finance-calculator {
  top: 72px;
  bottom: auto;
  left: 16px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

@media (max-width: 600px) {
  .finance-calculator-fab {
    top: 10px;
    bottom: auto;
    left: 10px;
  }

  .finance-calculator {
    top: 64px;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 76px);
  }
}

.login-help-card {
  margin: 12px 0 18px;
  padding: 12px 14px;
  border: 1px solid #bfdbfe;
  border-radius: 12px;
  color: #1e3a8a;
  background: #eff6ff;
  line-height: 1.7;
}

[hidden] {
  display: none !important;
}

.login-auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.login-auth-actions > button {
  flex: 1 1 180px;
}

.employee-account-summary {
  display: grid;
  gap: 5px;
}

.employee-account-status {
  width: fit-content;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 800;
}

.employee-account-status.is-active {
  color: #166534;
  background: #dcfce7;
}

.employee-account-status.is-pending {
  color: #9a3412;
  background: #ffedd5;
}

.employee-password-value {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
}

.employee-password-value code {
  direction: ltr;
  padding: 4px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  color: #111827;
  background: #f8fafc;
  font-family: Consolas, monospace;
  font-size: 0.86rem;
}

@media (max-width: 620px) {
  .login-auth-actions {
    display: grid;
    grid-template-columns: 1fr;
  }

  .login-auth-actions > button {
    width: 100%;
  }
}

/* تحسينات الهوية البصرية وسهولة التصفح */
body {
  background:
    radial-gradient(circle at 8% 4%, rgba(43, 159, 195, 0.1), transparent 28rem),
    radial-gradient(circle at 96% 10%, rgba(130, 91, 172, 0.08), transparent 30rem),
    var(--bg);
}

.brand-panel,
.role-panel,
.panel,
.metric-card,
.order-card,
.customer-card,
.notification-card {
  border-color: var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.brand-panel {
  border-top: 4px solid var(--brand-navy);
}

.role-panel {
  border-top: 4px solid var(--brand-purple);
}

.eyebrow,
.finance-total,
.finance-group-head strong,
.employee-permission-editor summary {
  color: var(--brand-navy);
}

.view-switch {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 10px;
  border: 1px solid rgba(80, 106, 166, 0.18);
  border-radius: 14px;
  background: rgba(243, 247, 251, 0.96);
  box-shadow: 0 8px 24px rgba(55, 79, 126, 0.09);
}

@supports (backdrop-filter: blur(10px)) {
  .view-switch {
    background: rgba(243, 247, 251, 0.86);
    backdrop-filter: blur(10px);
  }
}

.view-button.is-active,
.action-button.primary {
  border-color: var(--brand-navy);
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-cyan));
}

.view-button:hover,
.action-button:hover,
.secondary-button:hover {
  border-color: var(--brand-cyan);
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  border-color: var(--brand-cyan);
  outline: 3px solid rgba(43, 159, 195, 0.16);
}

.order-entry-form {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.order-entry-form > .two-fields,
.order-entry-form > .order-items-panel,
.order-entry-form > .order-assignment-panel,
.order-entry-form > .order-pricing-panel,
.order-entry-form > .shipping-details,
.order-entry-form > .workflow-preview,
.order-entry-form > .order-notes-field,
.order-entry-form > .order-submit-button {
  grid-column: 1 / -1;
}

.order-entry-form > .field,
.order-entry-form > .two-fields,
.order-entry-form > .shipping-details {
  min-width: 0;
}

.payment-method-field select {
  border-color: rgba(80, 106, 166, 0.42);
  background: linear-gradient(180deg, #fff, #f7f9fd);
  font-weight: 700;
}

.payment-method-summary {
  border-color: rgba(130, 91, 172, 0.28) !important;
  background: linear-gradient(135deg, rgba(80, 106, 166, 0.1), rgba(130, 91, 172, 0.08)) !important;
}

.finance-calculator-fab {
  top: 16px;
  bottom: auto;
  left: 16px;
  z-index: 80;
  border: 1px solid rgba(255, 255, 255, 0.42);
  background: linear-gradient(135deg, var(--brand-navy), var(--brand-purple));
  box-shadow: 0 12px 28px rgba(80, 106, 166, 0.32);
}

.finance-calculator {
  top: 72px;
  bottom: auto;
  left: 16px;
  z-index: 85;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
  border-color: rgba(80, 106, 166, 0.28);
}

.finance-calculator output {
  background: linear-gradient(135deg, #344b80, var(--brand-navy));
}

.finance-calc-grid .calc-key-operation,
.finance-vat-buttons button {
  color: var(--brand-navy);
  background: rgba(43, 159, 195, 0.1);
}

.finance-calc-grid .calc-key-equals {
  background: linear-gradient(135deg, var(--brand-green), var(--brand-cyan));
}

@media (max-width: 780px) {
  .order-entry-form {
    grid-template-columns: 1fr;
  }

  .order-entry-form > * {
    grid-column: 1;
  }
}

@media (max-width: 600px) {
  .finance-calculator-fab {
    top: 10px;
    bottom: auto;
    left: 10px;
  }

  .finance-calculator {
    top: 64px;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 76px);
  }
}

/* استجابة موحدة للكمبيوتر والتابلت والجوال */
html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body,
button,
input,
select,
textarea {
  overflow-wrap: anywhere;
}

.app-shell {
  padding-inline: clamp(10px, 2.2vw, 24px);
}

.panel,
.brand-panel,
.role-panel,
.metric-card,
.customer-card,
.order-card {
  max-width: 100%;
}

.view-switch,
.board,
.finance-table-wrap,
.quote-items,
.customer-stage,
.journey-steps {
  -webkit-overflow-scrolling: touch;
}

.finance-table-wrap,
.quote-items,
.board {
  scrollbar-width: thin;
}

@media (max-width: 1180px) {
  .topbar,
  .finance-workspace,
  .finance-workspace:has(#unifiedQuoteForm),
  .customer-layout,
  .employee-management,
  .login-layout {
    grid-template-columns: 1fr;
  }

  .workspace-grid {
    grid-template-columns: minmax(250px, 310px) minmax(0, 1fr);
  }

  .finance-form-panel,
  .customer-search-panel {
    position: static;
  }

  .finance-report-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .workspace-grid {
    grid-template-columns: 1fr;
  }

  .metrics-grid,
  .finance-metrics,
  .role-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .filters {
    grid-template-columns: minmax(0, 1fr) repeat(2, minmax(140px, 0.55fr));
  }

  .lanes {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .account-panel,
  .statement-head {
    align-items: stretch;
    flex-direction: column;
  }

  .account-actions,
  .document-actions {
    justify-content: stretch;
  }

  .account-actions > *,
  .document-actions > * {
    flex: 1 1 180px;
  }

  .finance-report-grid,
  .customer-appreciation-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 8px;
  }

  .topbar {
    gap: 10px;
    margin-bottom: 10px;
  }

  .panel,
  .brand-panel,
  .role-panel,
  .metric-card,
  .customer-card,
  .order-card {
    padding: 12px;
    border-radius: 10px;
  }

  .view-switch {
    flex-wrap: nowrap;
    overflow-x: auto;
    margin-inline: -8px;
    padding: 0 8px 8px;
  }

  .view-switch > * {
    flex: 0 0 auto;
    white-space: nowrap;
  }

  .metrics-grid,
  .finance-metrics,
  .role-grid,
  .filters,
  .two-fields,
  .invoice-grid,
  .finance-grid,
  .statement-totals,
  .shipping-details,
  .employee-login-grid,
  .tax-choice,
  .order-tax-summary {
    grid-template-columns: 1fr;
  }

  .lanes {
    grid-template-columns: 1fr;
  }

  .lane {
    min-height: auto;
  }

  .customer-stage,
  .journey-steps {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 8px;
    scroll-snap-type: x proximity;
  }

  .customer-stage > *,
  .journey-steps > * {
    flex: 0 0 min(72vw, 230px);
    scroll-snap-align: start;
  }

  .order-head,
  .invoice-top,
  .finance-group-head,
  .statement-search,
  .deleted-record,
  .employee-row,
  .create-order-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .order-actions,
  .account-actions,
  .employee-actions,
  .document-actions {
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .order-actions > *,
  .account-actions > *,
  .employee-actions > *,
  .document-actions > * {
    width: 100%;
  }

  .action-button,
  .secondary-button,
  .danger-button,
  .view-button,
  input,
  select {
    min-height: 46px;
  }

  .invoice-table,
  .finance-table {
    display: block;
    width: 100%;
    min-width: 0;
    overflow-x: auto;
    white-space: nowrap;
  }

  .invoice-table tbody,
  .finance-table tbody {
    white-space: normal;
  }

  .quote-item-row {
    grid-template-columns: 1fr;
  }

  .quote-item-row button {
    grid-column: auto;
  }

  .customer-personal-welcome {
    padding: 16px;
  }

  .finance-calculator {
    right: 8px;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 90px);
    overflow-y: auto;
  }

  .finance-calculator-fab {
    left: 10px;
    bottom: 10px;
  }
}

@media (max-width: 420px) {
  .metrics-grid,
  .finance-metrics,
  .role-grid {
    grid-template-columns: 1fr;
  }

  .brand-logo img {
    width: min(190px, 100%);
    max-height: 96px;
  }

  h1 {
    font-size: 1.38rem;
  }

  h2 {
    font-size: 1.12rem;
  }

  .finance-calc-grid button {
    height: 46px;
  }
}

.fulfillment-control,
.fulfillment-confirmed {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #a7d8ce;
  border-radius: 12px;
  background: linear-gradient(135deg, #eefaf7, #eef5ff);
}

.fulfillment-control > div:first-child,
.fulfillment-confirmed {
  color: var(--ink);
}

.fulfillment-control small,
.fulfillment-confirmed span {
  display: block;
  color: var(--muted);
}

.fulfillment-control-actions {
  display: grid;
  grid-template-columns: minmax(190px, 0.7fr) minmax(220px, 1fr);
  gap: 10px;
  align-items: end;
}

.fulfillment-control-actions .field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.fulfillment-confirmed {
  border-color: #86efac;
  background: #f0fdf4;
}

.customer-fulfillment-status {
  align-items: center;
  border-color: #86efac;
  background: linear-gradient(135deg, #ecfdf5, #eff6ff);
}

.role-workflow-stack {
  display: grid;
  gap: 14px;
  margin: 18px 0;
}

.role-workflow-panel {
  border: 1px solid #cfe1dc;
  border-radius: 16px;
  background: linear-gradient(145deg, #ffffff, #f4faf8);
  padding: 16px;
  box-shadow: 0 10px 24px rgba(23, 107, 91, 0.08);
}

.role-workflow-panel > header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.role-workflow-panel > header strong,
.role-workflow-panel > header small {
  display: block;
}

.role-workflow-panel > header strong {
  color: #176b5b;
  font-size: 16px;
}

.role-workflow-panel > header small {
  color: #66746f;
  margin-top: 5px;
  line-height: 1.7;
}

.role-workflow-content {
  display: grid;
  gap: 12px;
}

.role-workflow-form {
  display: grid;
  gap: 12px;
}

.role-workflow-form textarea {
  min-height: 90px;
  resize: vertical;
}

.workflow-complete-note {
  display: block;
  padding: 11px 13px;
  border-radius: 10px;
  background: #e8f5f1;
  color: #176b5b;
  font-weight: 700;
}

.operational-details {
  margin: 16px 0;
  padding: 15px;
  border: 1px solid #e0e9e6;
  border-radius: 14px;
  background: #fbfdfc;
}

.operational-details h3 {
  margin: 0 0 12px;
  color: #176b5b;
}

.operational-details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.operational-details-grid > div {
  padding: 10px 12px;
  border-radius: 10px;
  background: #ffffff;
  border: 1px solid #e5ecea;
}

.operational-details-grid span,
.operational-details-grid strong {
  display: block;
}

.operational-details-grid span {
  color: #6b7975;
  font-size: 11px;
}

.operational-details-grid strong {
  margin-top: 5px;
  color: #243d37;
}

.quality-issue-alert {
  display: grid;
  gap: 5px;
  margin: 12px 0 0;
  padding: 12px;
  border: 1px solid #efb4ad;
  border-radius: 10px;
  background: #fff1ef;
  color: #9d2f25;
}

.work-attachment-card {
  border-color: #bcd8d1;
}

@media (max-width: 720px) {
  .role-workflow-panel > header {
    flex-direction: column;
  }

  .operational-details-grid,
  .role-workflow-form .two-fields {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .fulfillment-control-actions {
    grid-template-columns: 1fr;
  }
}

.universal-workflow-control,
.design-approval-control,
.design-attachment-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid #b8ddd2;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0faf7, #f3f7ff);
}

.universal-workflow-head,
.design-attachment-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.universal-workflow-head small,
.design-approval-control small,
.design-attachment-card > small {
  display: block;
  color: var(--muted);
}

.universal-workflow-buttons {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.universal-workflow-buttons button:disabled {
  cursor: not-allowed;
  opacity: 0.52;
}

.universal-workflow-buttons .step-done {
  border-color: #86efac;
  background: #f0fdf4;
  color: #166534;
  opacity: 1;
}

.design-approval-control {
  border-color: #bfdbfe;
  background: #eff6ff;
}

.design-file-field {
  display: grid;
  gap: 7px;
  padding: 12px;
  border: 1px dashed #60a5fa;
  border-radius: 10px;
  background: white;
}

.design-file-field span {
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.design-file-field input {
  width: 100%;
}

.item-design-upload-grid,
.item-media-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.item-design-file small {
  line-height: 1.45;
}

.item-media-gallery {
  display: grid;
  gap: 10px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8fafc;
}

.item-media-gallery-head,
.item-media-card header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
}

.item-media-gallery-head h3,
.item-media-card header strong {
  margin: 2px 0 0;
}

.item-media-card {
  display: grid;
  gap: 8px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fff;
}

.item-media-card header {
  display: grid;
}

.item-media-card header small { color: var(--muted); }

.item-media-thumbs {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
}

.item-media-thumbs a {
  display: grid;
  gap: 4px;
  color: var(--ink);
  text-decoration: none;
  font-size: .74rem;
  font-weight: 800;
}

.item-media-thumbs img,
.item-task-design img {
  display: block;
  width: 100%;
  height: 112px;
  object-fit: cover;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.is-admin-compact .item-media-grid { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.is-admin-compact .item-media-thumbs img { height: 76px; }
.media-empty { display:grid; place-items:center; min-height:76px; padding:8px; border:1px dashed var(--line); border-radius:8px; color:var(--muted); font-size:.73rem; text-align:center; }
.item-task-design { display:grid; grid-template-columns:80px 1fr; align-items:center; gap:9px; padding:7px; border:1px solid #bfdbfe; border-radius:9px; background:#eff6ff; color:#1d4ed8; text-decoration:none; font-weight:800; }
.item-task-design img { height:56px; }

.repeat-order-notice {
  display: grid;
  gap: 3px;
  padding: 11px 13px;
  border: 1px solid #86efac;
  border-radius: 10px;
  background: #f0fdf4;
  color: #166534;
}

.repeat-order-backdrop {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  place-items: center;
  padding: 18px;
  background: rgba(15, 23, 42, .68);
}

.repeat-order-dialog {
  width: min(620px, 100%);
  display: grid;
  gap: 16px;
  padding: 20px;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 25px 80px rgba(15,23,42,.3);
}

.repeat-order-dialog > header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.repeat-order-dialog h2 { margin: 3px 0 0; }
.repeat-order-dialog p { margin: 0; color: var(--muted); }

.repeat-order-options {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.repeat-order-options button {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 7px;
  text-align: right;
}

.repeat-order-options button small { white-space: normal; line-height: 1.5; }
.repeat-order-dialog-open { overflow: hidden; }

@media (max-width: 600px) {
  .repeat-order-options { grid-template-columns: 1fr; }
}

.design-attachment-card {
  border-color: #a7d8ce;
  background: #f8fffd;
}

.design-attachment-head h3 {
  margin: 3px 0 0;
}

.design-image-link {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}

.design-image-link img {
  display: block;
  width: 100%;
  max-height: 240px;
  object-fit: contain;
}

/* Keep operational details and real-time follow-up compact on large screens. */
.order-card-expanded {
  width: min(100%, 980px);
  margin-inline: auto;
  padding: 10px;
}

.operational-details,
.admin-live-tracking,
.order-payment-panel {
  margin-block: 9px;
  padding: 10px;
}

.operational-details-grid { gap: 7px; }
.operational-details-grid > div,
.admin-live-summary > div,
.admin-history-list > div { padding: 7px 9px; }
.admin-live-summary strong,
.admin-history-list strong { font-size: .86rem; }

.item-media-thumbs img,
.item-task-design img,
.work-attachment-card img {
  max-height: 88px;
  object-fit: contain;
}

.design-preview-trigger {
  border-color: #b8d8cf;
  background: #eff9f6;
  color: #176b5b;
}

body.design-preview-open {
  overflow: hidden;
}

.design-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 120;
  display: grid;
  place-items: center;
  padding: 24px;
  background: rgba(8, 31, 27, 0.78);
  backdrop-filter: blur(8px);
}

.design-preview-modal {
  width: min(960px, 100%);
  max-height: calc(100vh - 48px);
  overflow: hidden;
  display: grid;
  grid-template-rows: auto minmax(0, 1fr) auto;
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.42);
  border-radius: 24px;
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.38);
}

.design-preview-modal > header,
.design-preview-modal > footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 18px 22px;
}

.design-preview-modal > header {
  border-bottom: 1px solid #e2ebe8;
}

.design-preview-modal > footer {
  border-top: 1px solid #e2ebe8;
}

.design-preview-modal h2,
.design-preview-modal small {
  display: block;
  margin: 0;
}

.design-preview-modal h2 {
  margin-top: 4px;
  color: #174f45;
}

.design-preview-modal small {
  color: #6a7874;
}

.design-preview-close {
  width: 42px;
  height: 42px;
  flex: 0 0 42px;
  border: 0;
  border-radius: 50%;
  background: #edf4f2;
  color: #174f45;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.design-preview-canvas {
  min-height: 280px;
  overflow: auto;
  display: grid;
  place-items: center;
  padding: 18px;
  background:
    linear-gradient(45deg, #eef3f1 25%, transparent 25%),
    linear-gradient(-45deg, #eef3f1 25%, transparent 25%),
    linear-gradient(45deg, transparent 75%, #eef3f1 75%),
    linear-gradient(-45deg, transparent 75%, #eef3f1 75%);
  background-position: 0 0, 0 10px, 10px -10px, -10px 0;
  background-size: 20px 20px;
}

.design-preview-canvas img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 230px);
  object-fit: contain;
  border-radius: 12px;
  box-shadow: 0 12px 35px rgba(20, 60, 52, 0.16);
}

@media (max-width: 760px) {
  .universal-workflow-head,
  .design-attachment-head {
    align-items: stretch;
    flex-direction: column;
  }

  .universal-workflow-buttons {
    grid-template-columns: 1fr;
  }

  .design-preview-backdrop {
    align-items: end;
    padding: 0;
  }

  .design-preview-modal {
    width: 100%;
    max-height: 94vh;
    border-radius: 22px 22px 0 0;
  }

  .design-preview-modal > header,
  .design-preview-modal > footer {
    align-items: flex-start;
    padding: 15px;
  }

  .design-preview-modal > footer {
    flex-direction: column;
  }

  .design-preview-modal > footer .secondary-button {
    width: 100%;
    text-align: center;
  }

  .design-preview-canvas {
    min-height: 240px;
    padding: 10px;
  }

  .design-preview-canvas img {
    max-height: calc(94vh - 210px);
  }
}

.create-order-launcher {
  display: grid;
  gap: 14px;
}

.create-order-launcher h2,
.create-order-page-head h2 {
  margin-bottom: 4px;
}

.create-order-workspace {
  display: grid;
  gap: 16px;
  width: min(1220px, 100%);
  margin: 0 auto;
}

.create-order-panel {
  padding: clamp(16px, 2.4vw, 28px);
}

.create-order-page-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 18px 20px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface);
}

.order-pricing-panel {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-soft);
}

.order-pricing-panel legend {
  padding: 0 8px;
  font-weight: 800;
}

.tax-choice {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.tax-option {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
  cursor: pointer;
}

.tax-option:has(input:checked) {
  border-color: #2563eb;
  color: #1e3a8a;
  background: #eff6ff;
  font-weight: 700;
}

.tax-help {
  margin: 0;
}

.order-tax-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.order-tax-summary > div {
  display: grid;
  gap: 5px;
  padding: 10px;
  border-radius: 9px;
  background: white;
}

.order-tax-summary span {
  color: var(--muted);
  font-size: 0.78rem;
}

.order-tax-summary .is-zero-tax {
  opacity: 0.66;
}

.order-tax-summary .order-total-row {
  color: #166534;
  background: #f0fdf4;
}

.order-items-panel,
.multi-item-workflow {
  display: grid;
  gap: 14px;
  margin: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-soft);
}

.order-items-panel legend {
  padding: 0 8px;
  font-weight: 800;
}

.order-items-panel {
  width: 100%;
  padding: clamp(14px, 2vw, 22px);
  border-color: rgba(80, 106, 166, 0.26);
  background: linear-gradient(180deg, #f8fbff, var(--surface-soft));
}

.order-items-panel > .secondary-button {
  justify-self: start;
  min-width: 180px;
}

.order-items-list,
.orders-list {
  display: grid;
  gap: 14px;
}

.order-item-entry {
  display: grid;
  grid-template-columns: minmax(260px, 2.6fr) minmax(165px, 1.15fr) minmax(90px, .6fr) minmax(155px, 1fr) minmax(205px, 1.35fr) auto;
  gap: 14px;
  align-items: end;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.image-paste-zone {
  position: relative;
  padding: 12px;
  border: 1px dashed rgba(43, 159, 195, 0.58);
  border-radius: 10px;
  background: rgba(43, 159, 195, 0.05);
  cursor: pointer;
  transition: border-color .18s ease, background .18s ease, box-shadow .18s ease;
}

.image-paste-zone:focus,
.image-paste-zone.is-paste-target {
  border-color: var(--brand-cyan);
  background: rgba(43, 159, 195, 0.1);
  box-shadow: 0 0 0 3px rgba(43, 159, 195, 0.14);
  outline: none;
}

.image-paste-zone.has-pasted-image {
  border-color: var(--brand-green);
  background: rgba(35, 160, 118, 0.09);
}

.image-paste-hint {
  display: block;
  margin-top: 7px;
  color: var(--muted);
  font-size: .76rem;
  line-height: 1.5;
}

.edit-item-sizes {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.edit-item-sizes legend {
  grid-column: 1 / -1;
}

.assignment-auto {
  display: grid;
  gap: 3px;
  padding: 10px 12px;
  border: 1px solid #b7d9cc;
  border-radius: 10px;
  background: #f0fdf7;
}

.assignment-auto span,
.assignment-auto small {
  color: var(--muted);
}

.multi-item-task {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
}

.multi-item-task > header,
.section-heading {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.multi-item-task > header div {
  display: grid;
  gap: 4px;
}

.delegated-orders-workspace {
  display: grid;
  gap: 18px;
}

@media (max-width: 700px) {
  .create-order-page-head {
    align-items: stretch;
    flex-direction: column;
  }

  .tax-choice,
  .order-tax-summary {
    grid-template-columns: 1fr;
  }

  .order-item-entry {
    grid-template-columns: 1fr;
    gap: 12px;
    padding: 14px;
  }

  .order-items-panel > .secondary-button {
    width: 100%;
  }

  .edit-item-sizes {
    grid-template-columns: 1fr;
  }

  .order-item-entry .danger-button,
  .section-heading {
    width: 100%;
  }

  .section-heading {
    flex-direction: column;
  }
}

/* تثبيت موضع الحاسبة بعد جميع قواعد الاستجابة السابقة */
.finance-calculator-fab {
  top: 16px;
  bottom: auto;
  left: 16px;
}

.finance-calculator {
  top: 72px;
  bottom: auto;
  left: 16px;
  max-height: calc(100vh - 88px);
  overflow-y: auto;
}

@media (max-width: 600px) {
  .finance-calculator-fab {
    top: 10px;
    bottom: auto;
    left: 10px;
  }

  .finance-calculator {
    top: 64px;
    right: 8px;
    bottom: auto;
    left: 8px;
    width: auto;
    max-height: calc(100vh - 76px);
  }
}
.finance-metric-action{width:100%;margin-top:12px}.finance-receivable-orders{grid-column:1/-1}.finance-receivable-orders .finance-group-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:12px}
.accounting-add-supplier{display:grid;grid-template-columns:minmax(180px,1.4fr) repeat(2,minmax(150px,1fr)) auto;gap:10px;align-items:end;margin-top:14px;padding-top:14px;border-top:1px solid var(--line,#dde6e3)}@media(max-width:900px){.accounting-add-supplier{grid-template-columns:1fr 1fr}.accounting-add-supplier .action-button{grid-column:1/-1}}@media(max-width:560px){.accounting-add-supplier{grid-template-columns:1fr}}

/* v53: البحث المالي الشامل وتفاصيل الموردين والالتزامات */
.finance-global-search {
  margin: 16px 0;
}

.finance-search-row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.finance-search-row input {
  flex: 1;
  min-width: 0;
}

.accounting-entry-block,
.accounting-detail-report {
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line, #dde6e3);
}

.accounting-detail-report {
  overflow: hidden;
}

.obligations-workspace .accounting-detail-report {
  padding-inline: 0;
}

@media (max-width: 600px) {
  .finance-search-row {
    align-items: stretch;
    flex-direction: column;
  }
}

/* v54: معاينة البنود المطابقة عند تحويل عرض السعر */
.quote-conversion-preview {
  display: grid;
  gap: 12px;
  padding: 14px;
  border: 1px solid var(--line, #dde6e3);
  border-radius: 12px;
  background: var(--surface-soft, #f8fbfa);
}

.quote-conversion-preview h3 {
  margin: 4px 0 0;
}

/* v55: زر إنشاء صغير للجوال حتى لا يحجب بيانات الشاشة */
.create-order-fab {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
}

.create-order-fab-icon {
  font-size: 1.35rem;
  line-height: 1;
}

@media (max-width: 720px) {
  .create-order-fab {
    width: 48px;
    min-width: 48px;
    height: 48px;
    min-height: 48px;
    padding: 0;
  }

  .create-order-fab-label {
    display: none;
  }

  .create-order-fab-icon {
    font-size: 1.8rem;
  }
}
