:root {
  --brand: #234090;
  --brand-deep: #162a63;
  --brand-tint: #e8ecf8;
  --paper: #f5f6fa;
  --surface: #ffffff;
  --ink: #141b33;
  --ink-soft: #4b5473;
  --line: #d9ddea;
  --gold: #a87a1f;
  --ok: #1d7448;
  --ok-tint: #e1f3e9;
  --warn-tint: #fdf1d6;
  --danger: #b3261e;
  --danger-tint: #fbe5e3;
  --radius: 10px;
  --radius-small: 6px;
  --font-body: "Noto Sans Arabic", "Segoe UI", Tahoma, "Geeza Pro", sans-serif;
  --font-display: "Amiri", "Noto Naskh Arabic", "Traditional Arabic", "Geeza Pro", serif;
  --space: 1rem;
  --focus: 0 0 0 3px rgba(35, 64, 144, 0.35);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 1rem;
  line-height: 1.7;
}

img {
  max-width: 100%;
  display: block;
}

h1,
h2,
h3 {
  font-family: var(--font-display);
  line-height: 1.35;
  margin: 0;
}

a {
  color: var(--brand);
}

:focus-visible {
  outline: none;
  box-shadow: var(--focus);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.button {
  appearance: none;
  border: 1px solid var(--brand);
  background: var(--brand);
  color: #fff;
  font: inherit;
  font-weight: 600;
  padding: 0.55rem 1.1rem;
  border-radius: var(--radius-small);
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  min-height: 2.5rem;
}

.button:hover:not(:disabled) {
  background: var(--brand-deep);
}

.button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-quiet {
  background: transparent;
  color: var(--brand);
  border-color: var(--line);
}

.button-quiet:hover:not(:disabled) {
  background: var(--brand-tint);
}

.button-danger {
  background: var(--danger);
  border-color: var(--danger);
}

.button-danger:hover:not(:disabled) {
  background: #8f1d17;
}

.button-small {
  min-height: 2rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.9rem;
}

.icon-button {
  appearance: none;
  border: 0;
  background: transparent;
  font-size: 1.6rem;
  line-height: 1;
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  cursor: pointer;
  color: var(--ink-soft);
}

.icon-button:hover {
  background: var(--brand-tint);
}

.field {
  display: grid;
  gap: 0.3rem;
  margin-bottom: 0.9rem;
}

.field label {
  font-weight: 600;
  font-size: 0.95rem;
}

.field input,
.field select,
.field textarea,
.input {
  font: inherit;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-small);
  padding: 0.55rem 0.7rem;
  width: 100%;
  min-height: 2.6rem;
}

.field textarea {
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: var(--focus);
}

.field-hint {
  margin: 0;
  font-size: 0.85rem;
  color: var(--ink-soft);
}

.field-error,
.form-error {
  margin: 0;
  color: var(--danger);
  font-size: 0.9rem;
}

.field-error:empty,
.form-error:empty {
  display: none;
}

.form-error {
  background: var(--danger-tint);
  padding: 0.6rem 0.8rem;
  border-radius: var(--radius-small);
  margin-bottom: 0.9rem;
}

.dialog {
  border: 0;
  border-radius: var(--radius);
  padding: 0;
  width: min(34rem, calc(100vw - 1.5rem));
  max-height: calc(100vh - 2rem);
  background: var(--surface);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(20, 27, 51, 0.35);
}

.dialog-wide {
  width: min(52rem, calc(100vw - 1.5rem));
}

.dialog::backdrop {
  background: rgba(20, 27, 51, 0.55);
}

.dialog-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.8rem 1.2rem;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--surface);
  z-index: 1;
}

.dialog-header h2 {
  font-size: 1.4rem;
}

.dialog-body {
  padding: 1.2rem;
}

.toasts {
  position: fixed;
  bottom: 1rem;
  inset-inline: 1rem;
  display: grid;
  gap: 0.5rem;
  justify-items: center;
  z-index: 100;
  pointer-events: none;
}

.toast {
  margin: 0;
  background: var(--ink);
  color: #fff;
  padding: 0.6rem 1.1rem;
  border-radius: var(--radius-small);
  max-width: 32rem;
  box-shadow: 0 8px 24px rgba(20, 27, 51, 0.3);
}

.toast-error {
  background: var(--danger);
}

.toast-success {
  background: var(--ok);
}

.badge {
  display: inline-block;
  padding: 0.1rem 0.6rem;
  border-radius: 999px;
  font-size: 0.85rem;
  font-weight: 600;
  background: var(--brand-tint);
  color: var(--brand-deep);
  white-space: nowrap;
}

.badge-new {
  background: var(--warn-tint);
  color: #7a5200;
}

.badge-delivered,
.badge-available {
  background: var(--ok-tint);
  color: var(--ok);
}

.badge-cancelled,
.badge-returned,
.badge-unavailable {
  background: var(--danger-tint);
  color: var(--danger);
}

.empty {
  text-align: center;
  padding: 2.5rem 1rem;
  color: var(--ink-soft);
}

.empty-title {
  font-family: var(--font-display);
  font-size: 1.4rem;
  color: var(--ink);
  margin: 0 0 0.4rem;
}

.pager {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  padding: 1rem 0;
}

.pager-status {
  color: var(--ink-soft);
}

@media (prefers-reduced-motion: reduce) {
  * {
    animation: none !important;
    transition: none !important;
  }
}
