@font-face { font-family: "Vazirmatn"; src: url("fonts/vazirmatn_regular.ttf") format("truetype"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/vazirmatn_medium.ttf") format("truetype"); font-weight: 500; font-display: swap; }
@font-face { font-family: "Vazirmatn"; src: url("fonts/vazirmatn_bold.ttf") format("truetype"); font-weight: 700; font-display: swap; }

:root {
  --primary: #4f46e5;
  --primary-dark: #4338ca;
  --primary-soft: #eef2ff;
  --bg: #f4f6fb;
  --card: #ffffff;
  --text: #1e293b;
  --muted: #64748b;
  --border: #e2e8f0;
  --success: #16a34a;
  --success-soft: #dcfce7;
  --danger: #dc2626;
  --danger-soft: #fee2e2;
  --warning: #d97706;
  --warning-soft: #fef3c7;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, .08);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

html, body { height: 100%; }

body {
  font-family: "Vazirmatn", Tahoma, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

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

/* ---------------------------------------------------------------- auth layout */

.auth {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.auth-side {
  background: linear-gradient(145deg, #4f46e5 0%, #7c3aed 100%);
  color: #fff;
  padding: 56px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  position: relative;
  overflow: hidden;
}

.auth-side::before,
.auth-side::after {
  content: "";
  position: absolute;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
}
.auth-side::before { width: 420px; height: 420px; top: -120px; left: -140px; }
.auth-side::after { width: 300px; height: 300px; bottom: -100px; right: -80px; }

.auth-side > * { position: relative; z-index: 1; }

.brand { display: flex; align-items: center; gap: 12px; font-weight: 700; font-size: 22px; }
.brand-logo {
  width: 44px; height: 44px; border-radius: 12px;
  background: #fff; color: var(--primary);
  display: grid; place-items: center; font-size: 22px; font-weight: 700;
}

.auth-side h2 { font-size: 30px; font-weight: 700; margin-bottom: 14px; }
.auth-side p { opacity: .85; max-width: 420px; }

.features { list-style: none; margin-top: 28px; display: grid; gap: 12px; }
.features li { display: flex; align-items: center; gap: 10px; opacity: .92; }
.features li::before {
  content: "✓"; width: 24px; height: 24px; border-radius: 50%;
  background: rgba(255, 255, 255, .2); display: grid; place-items: center; font-size: 13px;
}

.auth-side small { opacity: .7; }

.auth-main {
  display: flex; align-items: center; justify-content: center;
  padding: 40px 24px;
}

.auth-card {
  width: 100%; max-width: 400px;
}

.auth-card .brand { color: var(--primary); margin-bottom: 32px; display: none; }

.auth-card h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; }
.auth-card .lead { color: var(--muted); margin-bottom: 28px; font-size: 15px; }

.field { margin-bottom: 18px; }
.field label { display: block; font-size: 14px; font-weight: 500; margin-bottom: 8px; }

.input {
  width: 100%;
  height: 50px;
  border: 1.5px solid var(--border);
  border-radius: 12px;
  padding: 0 16px;
  font: inherit;
  font-size: 16px;
  background: #fff;
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
}
.input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.input.ltr { direction: ltr; text-align: left; letter-spacing: 1px; }
.input.invalid { border-color: var(--danger); box-shadow: 0 0 0 4px var(--danger-soft); }

.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error { font-size: 13px; color: var(--danger); margin-top: 6px; min-height: 20px; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  height: 50px; padding: 0 22px;
  border: 0; border-radius: 12px;
  font: inherit; font-size: 16px; font-weight: 500;
  cursor: pointer;
  transition: background .15s, transform .05s, opacity .15s;
}
.btn:active { transform: scale(.99); }
.btn[disabled] { opacity: .6; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; width: 100%; }
.btn-primary:hover:not([disabled]) { background: var(--primary-dark); }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: var(--bg); }
.btn-outline { background: #fff; border: 1.5px solid var(--border); color: var(--text); height: 42px; font-size: 14px; }
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }
.btn-danger { background: var(--danger-soft); color: var(--danger); height: 42px; font-size: 14px; }
.btn-danger:hover { background: #fecaca; }

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2.5px solid rgba(255, 255, 255, .4); border-top-color: #fff;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.checkbox { display: flex; align-items: flex-start; gap: 10px; font-size: 13px; color: var(--muted); margin-bottom: 22px; }
.checkbox input { margin-top: 4px; accent-color: var(--primary); width: 16px; height: 16px; }

.auth-footer { margin-top: 28px; font-size: 13px; color: var(--muted); text-align: center; }

/* OTP */

.phone-chip {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--primary-soft); color: var(--primary);
  padding: 4px 12px; border-radius: 999px; font-size: 14px; font-weight: 500;
  direction: ltr;
}

.otp {
  display: flex; gap: 10px; justify-content: center; direction: ltr; margin: 8px 0 6px;
}
.otp input {
  width: 58px; height: 62px;
  border: 1.5px solid var(--border); border-radius: 12px;
  text-align: center; font: inherit; font-size: 26px; font-weight: 700;
  color: var(--text); background: #fff;
  transition: border-color .15s, box-shadow .15s;
}
.otp input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 4px var(--primary-soft); }
.otp.invalid input { border-color: var(--danger); animation: shake .35s; }
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-5px); }
  75% { transform: translateX(5px); }
}

.resend { display: flex; justify-content: space-between; align-items: center; font-size: 14px; color: var(--muted); margin: 14px 0 22px; }
.resend button { background: none; border: 0; font: inherit; color: var(--primary); cursor: pointer; }
.resend button[disabled] { color: var(--muted); cursor: default; }

.demo-note {
  background: var(--warning-soft); color: #92400e;
  border-radius: 10px; padding: 10px 14px; font-size: 13px; margin-bottom: 20px;
}

/* ---------------------------------------------------------------- dashboard */

.app { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; }

.sidebar {
  background: #0f172a; color: #cbd5e1;
  padding: 24px 16px; display: flex; flex-direction: column; gap: 6px;
  position: sticky; top: 0; height: 100vh;
}
.sidebar .brand { color: #fff; padding: 0 8px 22px; font-size: 20px; }
.sidebar .brand-logo { width: 38px; height: 38px; font-size: 19px; }

.nav-item {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px; border-radius: 10px; color: #cbd5e1; font-size: 15px;
  cursor: pointer;
}
.nav-item:hover { background: rgba(255, 255, 255, .06); text-decoration: none; color: #fff; }
.nav-item.active { background: var(--primary); color: #fff; }
.nav-item svg { width: 20px; height: 20px; flex-shrink: 0; }

.sidebar .spacer { flex: 1; }

.main { padding: 28px 36px 48px; }

.topbar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 28px; }
.topbar h1 { font-size: 22px; font-weight: 700; }
.topbar p { color: var(--muted); font-size: 14px; }

.user-pill { display: flex; align-items: center; gap: 10px; background: #fff; padding: 6px 6px 6px 16px; border-radius: 999px; box-shadow: var(--shadow); }
.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #4f46e5, #7c3aed); color: #fff;
  display: grid; place-items: center; font-weight: 700;
}
.avatar.lg { width: 72px; height: 72px; font-size: 26px; }

.grid { display: grid; gap: 20px; }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-2 { grid-template-columns: 2fr 1fr; }

.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 22px; }
.card h3 { font-size: 16px; font-weight: 700; margin-bottom: 16px; display: flex; justify-content: space-between; align-items: center; }

.stat { display: flex; align-items: center; gap: 14px; }
.stat-icon { width: 48px; height: 48px; border-radius: 12px; display: grid; place-items: center; font-size: 22px; }
.stat b { display: block; font-size: 20px; }
.stat span { color: var(--muted); font-size: 13px; }

.profile { display: flex; align-items: center; gap: 18px; margin-bottom: 22px; }
.profile h2 { font-size: 19px; }
.profile p { color: var(--muted); font-size: 14px; }

.info-list { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 24px; }
.info-list div > span { display: block; color: var(--muted); font-size: 13px; }
.info-list div b { font-weight: 500; }

.badge { display: inline-block; padding: 2px 10px; border-radius: 999px; font-size: 12px; font-weight: 500; }
.badge.ok { background: var(--success-soft); color: var(--success); }
.badge.warn { background: var(--warning-soft); color: var(--warning); }
.badge.off { background: var(--danger-soft); color: var(--danger); }

.list { list-style: none; }
.list li { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 12px 0; border-bottom: 1px solid var(--border); }
.list li:last-child { border-bottom: 0; }
.list .meta { color: var(--muted); font-size: 13px; }

table { width: 100%; border-collapse: collapse; font-size: 14px; }
th { text-align: right; color: var(--muted); font-weight: 500; padding: 10px 8px; border-bottom: 1px solid var(--border); }
td { padding: 12px 8px; border-bottom: 1px solid var(--border); }
tr:last-child td { border-bottom: 0; }

.toggle { position: relative; width: 44px; height: 24px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle span { position: absolute; inset: 0; background: #cbd5e1; border-radius: 999px; transition: .2s; cursor: pointer; }
.toggle span::before { content: ""; position: absolute; width: 18px; height: 18px; right: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle input:checked + span { background: var(--primary); }
.toggle input:checked + span::before { transform: translateX(-20px); }

.toast {
  position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: #0f172a; color: #fff; padding: 12px 20px; border-radius: 10px; font-size: 14px;
  opacity: 0; transition: .25s; pointer-events: none; z-index: 50;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------------------------------------------------------------- responsive */

@media (max-width: 1100px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-side { display: none; }
  .auth-card .brand { display: flex; }
  .app { grid-template-columns: 1fr; }
  .sidebar { display: none; }
  .main { padding: 20px 16px 40px; }
}

@media (max-width: 560px) {
  .grid-4 { grid-template-columns: 1fr; }
  .info-list { grid-template-columns: 1fr; }
  .otp input { width: 50px; height: 56px; font-size: 22px; }
  .topbar { flex-direction: column; align-items: flex-start; gap: 14px; }
}
