:root {
  --brand: #1e5ee8;
  --brand-dark: #1a4fc7;
  --brand-soft: #eaf0fe;
  --bg: #f4f6fb;
  --surface: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --error: #dc2626;
  --error-soft: #fee2e2;
  --border: #e2e8f0;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --radius: 16px;
  --radius-sm: 10px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, -apple-system, BlinkMacSystemFont, "SF Pro Display", "Segoe UI", Tahoma, sans-serif;
  font-size: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  min-height: 100dvh;
}

body {
  display: flex;
  flex-direction: column;
}

a { color: var(--brand); text-decoration: none; }
a:hover { text-decoration: underline; }

.app {
  max-width: 560px;
  width: 100%;
  margin: 0 auto;
  padding: 20px 16px 40px;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 4px 20px;
}

.topbar .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
}

.topbar .brand img { width: 32px; height: 32px; border-radius: 8px; }

.topbar .icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--muted);
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.topbar .icon-btn:hover { background: var(--brand-soft); color: var(--brand); }

.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
}

.card + .card { margin-top: 16px; }

.home-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 22px;
  cursor: pointer;
  border: none;
  width: 100%;
  text-align: right;
  font-family: inherit;
  color: inherit;
  transition: transform 0.15s, box-shadow 0.15s;
}

.home-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(30, 94, 232, 0.08), 0 16px 32px rgba(30, 94, 232, 0.12);
}

.home-card .badge {
  width: 60px;
  height: 60px;
  border-radius: 16px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 28px;
  flex-shrink: 0;
}

.home-card h2 {
  margin: 0 0 4px;
  font-size: 18px;
  font-weight: 700;
}

.home-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
}

.home-card .chev {
  margin-inline-start: auto;
  color: var(--muted);
  font-size: 22px;
}

.page-head {
  display: flex;
  gap: 14px;
  margin-bottom: 20px;
}

.page-head .badge {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--brand-soft);
  color: var(--brand);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  flex-shrink: 0;
}

.page-head h1 { margin: 0 0 2px; font-size: 20px; font-weight: 700; }
.page-head p { margin: 0; color: var(--muted); font-size: 14px; }

form { display: flex; flex-direction: column; gap: 16px; }

.field label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 8px;
  color: var(--text);
}

.field input {
  width: 100%;
  padding: 14px 16px;
  font-size: 16px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s, box-shadow 0.15s;
  direction: ltr;
  text-align: left;
}

.field input:focus {
  outline: none;
  border-color: var(--brand);
  box-shadow: 0 0 0 4px rgba(30, 94, 232, 0.12);
}

.field .hint { font-size: 12px; color: var(--muted); margin-top: 6px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 14px 20px;
  font-size: 16px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  border: none;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s, color 0.15s, transform 0.05s;
  width: 100%;
}

.btn:active { transform: translateY(1px); }

.btn-primary { background: var(--brand); color: #fff; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-primary:disabled {
  background: var(--muted);
  cursor: not-allowed;
  opacity: 0.7;
}

.btn-ghost {
  background: transparent;
  color: var(--brand);
  border: 1px solid var(--border);
}
.btn-ghost:hover { background: var(--brand-soft); }

.divider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--muted);
  font-size: 12px;
  margin: 20px 0 4px;
}
.divider::before, .divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--border);
}

.spinner {
  width: 18px;
  height: 18px;
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.result {
  margin-top: 20px;
  padding: 18px;
  border-radius: var(--radius-sm);
  display: none;
}
.result.show { display: block; }

.result.success {
  background: var(--success-soft);
  border: 1px solid #86efac;
  color: #14532d;
}

.result.error {
  background: var(--error-soft);
  border: 1px solid #fecaca;
  color: #7f1d1d;
}

.result .result-title {
  font-weight: 700;
  margin: 0 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
}

.result dl {
  margin: 8px 0 0;
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 6px 14px;
  font-size: 14px;
}

.result dt { color: var(--muted); font-weight: 500; }
.result dd { margin: 0; color: var(--text); font-weight: 600; }

.field-error {
  color: var(--error);
  font-size: 13px;
  margin-top: 6px;
  display: none;
}
.field-error.show { display: block; }

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.55);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  padding: 16px;
  z-index: 1000;
  animation: fadeIn 0.2s ease-out;
}

.modal-backdrop[hidden] { display: none; }

.modal {
  background: var(--surface);
  border-radius: 20px 20px 12px 12px;
  padding: 24px 22px 20px;
  width: 100%;
  max-width: 440px;
  text-align: center;
  box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.2);
  animation: slideUp 0.25s ease-out;
}

.modal .modal-logo {
  width: 64px;
  height: 64px;
  border-radius: 16px;
  margin-bottom: 12px;
}

.modal h3 { margin: 0 0 8px; font-size: 18px; font-weight: 700; }
.modal p { margin: 0 0 20px; color: var(--muted); font-size: 14px; }

.modal-actions {
  display: flex;
  gap: 10px;
}

.modal-actions .btn { width: auto; flex: 1; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { transform: translateY(20px); opacity: 0; } to { transform: translateY(0); opacity: 1; } }

@media (min-width: 480px) {
  .modal-backdrop { align-items: center; }
  .modal { border-radius: 20px; }
}

/* Login page centered */
.login-wrap {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 32px 24px;
  width: 100%;
  max-width: 380px;
  text-align: center;
}

.login-card img.logo {
  width: 72px;
  height: 72px;
  border-radius: 20px;
  margin-bottom: 16px;
}

.login-card h1 { margin: 0 0 6px; font-size: 22px; }
.login-card p { margin: 0 0 24px; color: var(--muted); font-size: 14px; }

@media (max-width: 480px) {
  .card { padding: 20px; }
  .home-card { padding: 18px; }
  .home-card .badge { width: 52px; height: 52px; font-size: 24px; }
  .home-card h2 { font-size: 16px; }
}
