@import url("https://fonts.googleapis.com/css2?family=Cairo:wght@400;500;600;700&family=Inter:wght@400;500;600;700&family=Raleway:wght@700;800;900&display=swap");

:root {
  color-scheme: light;
  --bg: #ffffff;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --surface-3: #eff6ff;
  --text: #0f172a;
  --muted: #64748b;
  --line: #dbe7f3;
  --line-strong: #bae6fd;
  --primary: #0ea5e9;
  --primary-strong: #2563eb;
  --primary-dark: #075985;
  --accent: #f97316;
  --accent-strong: #ea580c;
  --warn: #b45309;
  --danger: #dc2626;
  --success: #15803d;
  --shadow: 0 18px 45px rgba(15, 23, 42, 0.08);
  --shadow-hover: 0 24px 55px rgba(14, 165, 233, 0.15);
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-heading: "Raleway", var(--font-sans);
  --font-arabic: "Cairo", var(--font-sans);
  font-family: var(--font-sans);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(239, 246, 255, 0.9) 0%, rgba(255, 255, 255, 0.96) 36%, rgba(248, 250, 252, 0.95) 100%),
    linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(37, 99, 235, 0.08) 45%, rgba(249, 115, 22, 0.08));
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(120deg, rgba(14, 165, 233, 0.13), transparent 38%),
    linear-gradient(245deg, rgba(37, 99, 235, 0.12), transparent 42%),
    linear-gradient(8deg, transparent 55%, rgba(249, 115, 22, 0.1));
  animation: meshShift 18s ease-in-out infinite alternate;
  transform-origin: center;
}

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

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.95);
  color: var(--text);
  cursor: pointer;
  padding: 0 14px;
  transition: transform 0.22s ease, border-color 0.22s ease, background-color 0.22s ease, box-shadow 0.22s ease;
}

button:hover {
  transform: translateY(-1px);
  border-color: var(--line-strong);
  box-shadow: 0 10px 24px rgba(14, 165, 233, 0.12);
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(14, 165, 233, 0.22);
  outline-offset: 2px;
}

.primary {
  border-color: transparent;
  background: linear-gradient(135deg, var(--accent) 0%, var(--accent-strong) 100%);
  color: white;
  font-weight: 800;
  box-shadow: 0 12px 28px rgba(249, 115, 22, 0.28);
}

.primary:hover {
  background: linear-gradient(135deg, #fb923c 0%, var(--accent-strong) 100%);
  box-shadow: 0 16px 34px rgba(249, 115, 22, 0.34);
}

.icon-button {
  width: auto;
}

.shell,
.customer-shell {
  width: min(1280px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 30px 0 44px;
}

.customer-shell {
  width: min(1120px, calc(100vw - 28px));
}

.topbar,
.form-header,
.section-heading,
.copy-row,
.detail-title,
.status-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar,
.form-header {
  min-height: 86px;
  margin-bottom: 20px;
  border-bottom: 1px solid rgba(186, 230, 253, 0.7);
  padding-bottom: 18px;
}

.brand-lockup {
  display: flex;
  align-items: center;
  gap: 13px;
  min-width: 0;
}

.brand-logo {
  display: block;
  width: 150px;
  max-width: 32vw;
  height: auto;
  flex: 0 0 auto;
  filter: drop-shadow(0 12px 22px rgba(37, 99, 235, 0.16));
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary-strong);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

h1,
h2,
h3 {
  font-family: var(--font-heading);
  letter-spacing: 0;
}

h1 {
  margin-bottom: 0;
  font-size: clamp(1.65rem, 2.4vw, 2.35rem);
  line-height: 1.08;
}

h2 {
  margin-bottom: 14px;
  font-size: 1.06rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.98rem;
}

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

.panel {
  border: 1px solid rgba(203, 213, 225, 0.78);
  border-radius: 8px;
  background:
    linear-gradient(135deg, rgba(14, 165, 233, 0.04), rgba(37, 99, 235, 0.035)),
    rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
  padding: 18px;
  animation: fadeUp 0.48s ease both;
  transition: transform 0.24s ease, border-color 0.24s ease, box-shadow 0.24s ease;
}

.panel:hover {
  border-color: rgba(14, 165, 233, 0.32);
  box-shadow: var(--shadow-hover);
}

.narrow {
  width: min(420px, 100%);
}

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

label {
  display: grid;
  gap: 6px;
  color: #334155;
  font-size: 0.9rem;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  min-height: 40px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.98);
  color: var(--text);
  padding: 9px 10px;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background-color 0.18s ease;
}

textarea {
  resize: vertical;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--primary);
  background: white;
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.12);
  outline: 0;
}

.admin-grid {
  display: grid;
  grid-template-columns: minmax(260px, 340px) minmax(300px, 420px) minmax(420px, 1fr);
  gap: 16px;
  align-items: start;
}

.list-panel,
.detail-panel {
  min-height: 520px;
}

.record-list {
  display: grid;
  gap: 10px;
}

.record-item {
  display: grid;
  width: 100%;
  gap: 5px;
  border-radius: 8px;
  padding: 12px;
  text-align: left;
}

.record-item.active {
  border-color: var(--primary);
  box-shadow: inset 3px 0 0 var(--primary), 0 10px 22px rgba(14, 165, 233, 0.1);
}

.record-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  min-height: 24px;
  border-radius: 999px;
  padding: 2px 9px;
  background: #e0f2fe;
  color: var(--primary-dark);
  font-size: 0.78rem;
  font-weight: 800;
}

.status-pill.submitted {
  background: #dbeafe;
  color: var(--primary-strong);
}

.status-pill.needs_info {
  background: #ffedd5;
  color: var(--warn);
}

.status-pill.approved_for_scoring {
  background: #dcfce7;
  color: var(--success);
}

.link-box {
  display: grid;
  gap: 6px;
  margin-top: 16px;
}

.copy-row input {
  min-width: 0;
}

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

.full {
  grid-column: 1 / -1;
}

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

.fields.one {
  grid-template-columns: 1fr;
}

.fields.costs {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}

.fields.uploads {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.wide {
  grid-column: 1 / -1;
}

.question-list {
  display: grid;
  gap: 12px;
}

.question-item {
  display: grid;
  gap: 6px;
}

.notice,
.submit-bar {
  grid-column: 1 / -1;
  border: 1px solid #fed7aa;
  border-radius: 8px;
  background: #fff7ed;
  padding: 14px 16px;
}

.notice {
  margin-bottom: 16px;
  color: #7c2d12;
}

.submit-bar {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  border-color: rgba(203, 213, 225, 0.78);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.language-switch {
  display: inline-flex;
  flex: 0 0 auto;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: white;
}

.language-switch button {
  min-width: 48px;
  border: 0;
  border-radius: 0;
}

.language-switch button.active {
  background: linear-gradient(135deg, var(--primary), var(--primary-strong));
  color: white;
  font-weight: 800;
}

.empty-state {
  display: grid;
  min-height: 300px;
  place-content: center;
  color: var(--muted);
  text-align: center;
}

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

.detail-field {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.8);
  padding: 10px;
}

.detail-field span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.detail-field p {
  overflow-wrap: anywhere;
  margin: 4px 0 0;
  white-space: pre-wrap;
}

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

.upload-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(248, 250, 252, 0.68);
  padding: 10px;
}

.error-text,
.warning-text {
  color: var(--danger);
  font-weight: 800;
}

.hidden {
  display: none !important;
}

[dir="rtl"] body,
[dir="rtl"] h1,
[dir="rtl"] h2,
[dir="rtl"] h3 {
  font-family: var(--font-arabic);
}

[dir="rtl"] .topbar,
[dir="rtl"] .form-header,
[dir="rtl"] .section-heading,
[dir="rtl"] .copy-row,
[dir="rtl"] .detail-title,
[dir="rtl"] .status-row,
[dir="rtl"] .brand-lockup {
  direction: rtl;
}

@keyframes meshShift {
  0% {
    transform: translate3d(-1.5%, -1%, 0) scale(1);
  }
  50% {
    transform: translate3d(1.5%, 1%, 0) scale(1.03);
  }
  100% {
    transform: translate3d(-0.5%, 1.5%, 0) scale(1.01);
  }
}

@keyframes fadeUp {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}

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

  .detail-panel,
  .list-panel {
    min-height: 0;
  }
}

@media (max-width: 760px) {
  .shell,
  .customer-shell {
    width: min(100% - 20px, 1120px);
    padding-top: 16px;
  }

  .topbar,
  .form-header,
  .section-heading,
  .submit-bar {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .fields,
  .fields.costs,
  .fields.uploads,
  .detail-grid {
    grid-template-columns: 1fr;
  }

  .panel {
    padding: 14px;
  }

  .brand-lockup {
    align-items: flex-start;
    flex-direction: column;
    gap: 8px;
  }

  .brand-logo {
    width: 118px;
    max-width: 42vw;
  }
}
