/* Raymand × Zoodex design tokens — see PRD sections 38–44.
   Raymand indigo is the dominant, "premium financial" voice; Zoodex yellow
   is an accent only (never a competing half of the UI). */
:root {
  --raymand-indigo: #7078a8;
  --raymand-indigo-deep: #353f96;
  --zoodex-yellow: #f4b631;
  --text-primary: #26272b;
  --text-secondary: #6b7280;
  --surface: #ffffff;
  --surface-secondary: #f7f8fa;
  --border: #e5e7eb;
  --success: #1a9c5c;
  --warning: #b8860b;
  --error: #d7373f;
  --radius: 12px;
  --shadow-subtle: 0 1px 2px rgba(20, 24, 40, 0.04), 0 1px 3px rgba(20, 24, 40, 0.06);
  --font-fa: "Vazirmatn", "Tahoma", sans-serif;
  --font-en: "Inter", "Vazirmatn", sans-serif;
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
  font-family: var(--font-fa);
  background: var(--surface-secondary);
  color: var(--text-primary);
  direction: rtl;
  -webkit-font-smoothing: antialiased;
  line-height: 1.7;
}

#root { min-height: 100vh; }

h1, h2, h3, h4 { margin: 0 0 8px; font-weight: 700; }
p { margin: 0 0 12px; color: var(--text-secondary); }

a { color: var(--raymand-indigo-deep); text-decoration: none; }

.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 16px;
}

.mobile-shell {
  max-width: 480px;
  margin: 0 auto;
  min-height: 100vh;
  background: var(--surface);
  box-shadow: var(--shadow-subtle);
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: var(--raymand-indigo-deep);
  color: #fff;
}
.topbar .brand { font-weight: 800; font-size: 15px; display: flex; align-items: center; gap: 6px; }
.topbar .brand .accent { color: var(--zoodex-yellow); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-subtle);
  padding: 20px;
  margin-bottom: 16px;
}

.card-title { font-size: 15px; font-weight: 700; margin-bottom: 4px; }
.card-subtitle { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }

.field { margin-bottom: 16px; }
.field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-primary);
}
.field .hint { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }
.field .source-tag {
  display: inline-block;
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 999px;
  margin-inline-start: 8px;
  background: var(--surface-secondary);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.field .source-tag.zoodex { color: var(--raymand-indigo-deep); border-color: var(--raymand-indigo); }

input[type="text"], input[type="tel"], input[type="number"], input[type="password"], select, textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  background: var(--surface);
  color: var(--text-primary);
  outline: none;
  transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { border-color: var(--raymand-indigo); }

.otp-input {
  width: 100%;
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font-size: 22px;
  letter-spacing: 10px;
  text-align: center;
  font-family: var(--font-en);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: 10px;
  border: 1px solid transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: opacity 0.15s, transform 0.05s;
  font-family: inherit;
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-primary { background: var(--raymand-indigo-deep); color: #fff; width: 100%; }
.btn-primary:hover:not(:disabled) { opacity: 0.92; }
.btn-secondary { background: var(--surface-secondary); color: var(--text-primary); border-color: var(--border); }
.btn-ghost { background: transparent; color: var(--raymand-indigo-deep); }
.btn-danger { background: #fdecec; color: var(--error); }
.btn-success { background: #e8f7ef; color: var(--success); }
.btn-block { width: 100%; }
.btn-sm { padding: 7px 12px; font-size: 12px; }

.progress-track {
  width: 100%;
  height: 10px;
  border-radius: 999px;
  background: var(--surface-secondary);
  overflow: hidden;
  border: 1px solid var(--border);
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--raymand-indigo), var(--raymand-indigo-deep));
  border-radius: 999px;
  transition: width 0.3s ease;
}

.checklist-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.checklist-item:last-child { border-bottom: none; }
.checklist-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-size: 12px; flex-shrink: 0; }
.checklist-icon.ok { background: #e8f7ef; color: var(--success); }
.checklist-icon.warn { background: #fff6e5; color: var(--warning); }

.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-success { background: #e8f7ef; color: var(--success); }
.badge-warning { background: #fff6e5; color: var(--warning); }
.badge-error { background: #fdecec; color: var(--error); }
.badge-neutral { background: var(--surface-secondary); color: var(--text-secondary); border: 1px solid var(--border); }
.badge-info { background: #eef0fa; color: var(--raymand-indigo-deep); }

.upload-box {
  border: 1.5px dashed var(--border);
  border-radius: var(--radius);
  padding: 16px;
  text-align: center;
  background: var(--surface-secondary);
  cursor: pointer;
  font-size: 13px;
}
.upload-box.uploaded { border-style: solid; border-color: var(--success); background: #f3fbf6; }
.upload-box.needs-correction { border-style: solid; border-color: var(--warning); background: #fffaf0; }
.upload-box input[type="file"] { display: none; }

.doc-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 12px; border: 1px solid var(--border); border-radius: 10px; margin-bottom: 8px; background: var(--surface); }
.doc-row .meta { font-size: 12px; color: var(--text-secondary); }

.step-dots { display: flex; gap: 6px; justify-content: center; padding: 10px 0; }
.step-dots .dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border); }
.step-dots .dot.active { background: var(--raymand-indigo-deep); width: 18px; border-radius: 4px; }
.step-dots .dot.done { background: var(--raymand-indigo); }

.wizard-body { flex: 1; padding: 20px 18px 100px; overflow-y: auto; }
.wizard-footer {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: 14px 18px;
  display: flex;
  gap: 10px;
}

.alert { padding: 12px 14px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.alert-error { background: #fdecec; color: var(--error); }
.alert-info { background: #eef0fa; color: var(--raymand-indigo-deep); }
.alert-success { background: #e8f7ef; color: var(--success); }

.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { display: flex; gap: 12px; padding-bottom: 20px; position: relative; }
.timeline li::before { content: ""; position: absolute; top: 20px; bottom: 0; right: 9px; width: 2px; background: var(--border); }
.timeline li:last-child::before { display: none; }
.timeline .dot { width: 20px; height: 20px; border-radius: 50%; background: var(--raymand-indigo-deep); color: #fff; display: flex; align-items: center; justify-content: center; font-size: 11px; flex-shrink: 0; }
.timeline .dot.pending { background: var(--border); color: var(--text-secondary); }

/* --- Admin (desktop-first) --- */
.admin-shell { display: flex; min-height: 100vh; }
.admin-sidebar {
  width: 220px;
  background: var(--raymand-indigo-deep);
  color: #fff;
  flex-shrink: 0;
  padding: 20px 14px;
}
.admin-sidebar .brand { font-weight: 800; margin-bottom: 24px; font-size: 15px; }
.admin-sidebar .brand .accent { color: var(--zoodex-yellow); }
.admin-nav a, .admin-nav button {
  display: block;
  width: 100%;
  text-align: right;
  background: none;
  border: none;
  color: rgba(255,255,255,0.85);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  margin-bottom: 2px;
}
.admin-nav a.active, .admin-nav button.active { background: rgba(255,255,255,0.12); color: #fff; }
.admin-main { flex: 1; padding: 24px; min-width: 0; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 24px; }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; box-shadow: var(--shadow-subtle); }
.stat-card .value { font-size: 26px; font-weight: 800; font-family: var(--font-en); color: var(--raymand-indigo-deep); }
.stat-card .label { font-size: 12px; color: var(--text-secondary); margin-top: 4px; }

.table-wrap { overflow-x: auto; background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-subtle); }
table { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 720px; }
th { text-align: right; padding: 12px 14px; background: var(--surface-secondary); color: var(--text-secondary); font-weight: 600; font-size: 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); white-space: nowrap; }
tr:last-child td { border-bottom: none; }
tr.clickable { cursor: pointer; }
tr.clickable:hover { background: var(--surface-secondary); }

.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 20px; overflow-x: auto; }
.tabs button { background: none; border: none; padding: 10px 16px; font-size: 13px; font-weight: 600; color: var(--text-secondary); cursor: pointer; border-bottom: 2px solid transparent; font-family: inherit; white-space: nowrap; }
.tabs button.active { color: var(--raymand-indigo-deep); border-bottom-color: var(--raymand-indigo-deep); }

.filters-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px; }
.filters-row input, .filters-row select { width: auto; min-width: 160px; }

.doc-viewer-panel { display: flex; gap: 20px; flex-wrap: wrap; }
.doc-viewer-panel .preview { flex: 1 1 320px; min-height: 220px; background: var(--surface-secondary); border-radius: var(--radius); display: flex; align-items: center; justify-content: center; color: var(--text-secondary); font-size: 13px; border: 1px solid var(--border); }
.doc-viewer-panel .info { flex: 1 1 260px; }

.center-screen { min-height: 100vh; display: flex; align-items: center; justify-content: center; background: var(--surface-secondary); padding: 20px; }
.login-card { width: 100%; max-width: 380px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 480px) { .grid-2 { grid-template-columns: 1fr; } }

.text-sm { font-size: 12px; color: var(--text-secondary); }
.mt-2 { margin-top: 8px; }
.mt-3 { margin-top: 16px; }
.mb-0 { margin-bottom: 0; }
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }
.gap-2 { gap: 8px; }
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 50%; animation: spin 0.6s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
