:root {
  --bg: #f3f6fb;
  --card: #ffffff;
  --text: #0f172a;
  --muted: #64748b;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --border: #dbe4f0;
  --danger: #dc2626;
  --ok: #059669;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --radius: 18px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  font-family: "Vazirmatn", sans-serif;
  color: var(--text);
  background: var(--bg);
}

a { color: inherit; text-decoration: none; }
button, input { font: inherit; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border-radius: 12px;
  padding: 11px 18px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: .18s ease;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  color: #fff;
  box-shadow: 0 8px 18px rgba(37, 99, 235, .28);
}
.btn-primary:hover { filter: brightness(1.05); }
.btn-block { width: 100%; }
.btn-ghost {
  background: #fff;
  border-color: var(--border);
  color: var(--muted);
}
.btn-ghost:hover { color: var(--text); border-color: #94a3b8; }

.alert {
  border-radius: 12px;
  padding: 12px 14px;
  margin: 0 0 16px;
  font-size: .92rem;
}
.alert-error {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}
.alert-ok {
  background: #ecfdf5;
  color: var(--ok);
  border: 1px solid #a7f3d0;
}

/* Login */
.login-page {
  min-height: 100vh;
  background:
    radial-gradient(circle at 15% 20%, rgba(37,99,235,.18), transparent 40%),
    radial-gradient(circle at 85% 80%, rgba(14,165,233,.14), transparent 35%),
    linear-gradient(180deg, #eef4ff, #f8fafc 55%, #eef2f7);
}
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}
.login-card {
  width: min(440px, 100%);
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(219,228,240,.9);
  border-radius: 24px;
  box-shadow: var(--shadow);
  padding: 34px 28px;
}
.login-brand { text-align: center; margin-bottom: 24px; }
.login-brand h1 {
  margin: 14px 0 8px;
  font-size: 1.35rem;
  font-weight: 800;
}
.login-brand p {
  margin: 0;
  color: var(--muted);
  font-size: .92rem;
  line-height: 1.7;
}
.brand-mark { display: inline-flex; }
.brand-mark img {
  display: block;
  width: 72px;
  height: 72px;
  object-fit: contain;
  border-radius: 16px;
  background: #fff;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.08);
}
.brand-mark.sm img {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  box-shadow: none;
  border: 1px solid var(--border);
}

.pwa-install-btn {
  position: fixed;
  inset-inline-start: 16px;
  bottom: 16px;
  z-index: 50;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  background: #0b1f4a;
  color: #fff;
  font: inherit;
  font-weight: 700;
  box-shadow: 0 10px 24px rgba(11, 31, 74, 0.28);
  cursor: pointer;
}
.pwa-install-btn:hover { filter: brightness(1.08); }
.pwa-install-btn[hidden] { display: none !important; }
.login-form { display: grid; gap: 14px; }
.login-form label { display: grid; gap: 7px; }
.login-form span {
  font-size: .88rem;
  color: var(--muted);
  font-weight: 600;
}
.login-form input {
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  background: #fff;
  outline: none;
}
.login-form input:focus {
  border-color: #93c5fd;
  box-shadow: 0 0 0 4px rgba(37,99,235,.12);
}

/* Dashboard */
.dash-page { min-height: 100vh; }
.dash-header {
  background: #fff;
  border-bottom: 1px solid var(--border);
}
.dash-header-inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 10px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 52px;
}
.brand-inline {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  color: inherit;
  text-decoration: none;
}
a.brand-inline:hover strong {
  color: var(--primary);
}
.brand-inline strong {
  display: block;
  font-size: .98rem;
  white-space: nowrap;
}
.brand-inline span { color: var(--muted); font-size: .82rem; }
.header-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;
  flex-shrink: 0;
}
.header-actions .btn {
  padding: 7px 12px;
  font-size: .82rem;
  border-radius: 10px;
  white-space: nowrap;
}
.brand-mark.sm img {
  width: 32px;
  height: 32px;
  border-radius: 8px;
}
.settings-card {
  width: min(480px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
  padding: 28px 24px;
}
.dash-main {
  max-width: 1100px;
  margin: 0 auto;
  padding: 36px 22px 60px;
}
.dash-intro h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  font-weight: 800;
}
.dash-intro p {
  margin: 0 0 28px;
  color: var(--muted);
}
.module-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 18px;
}
.module-card {
  position: relative;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 24px 22px;
  box-shadow: 0 8px 24px rgba(15,23,42,.05);
  transition: .2s ease;
  overflow: hidden;
}
.module-card::before {
  content: "";
  position: absolute;
  inset-inline-end: 0;
  top: 0;
  width: 5px;
  height: 100%;
  background: var(--accent);
}
.module-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 30px rgba(15,23,42,.1);
  border-color: color-mix(in srgb, var(--accent) 35%, white);
}
.module-card.is-disabled {
  opacity: .72;
  cursor: default;
}
.module-card.is-disabled:hover { transform: none; box-shadow: 0 8px 24px rgba(15,23,42,.05); }
.module-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  display: grid;
  place-items: center;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
  margin-bottom: 16px;
}
.module-card h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
}
.module-card p {
  margin: 0;
  color: var(--muted);
  font-size: .9rem;
  line-height: 1.7;
}
.soon-badge {
  display: inline-block;
  margin-top: 14px;
  font-size: .75rem;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, white);
  border-radius: 999px;
  padding: 4px 10px;
}

@media (max-width: 900px) {
  .dash-header-inner {
    padding: 8px 12px;
    min-height: 48px;
    gap: 8px;
  }
  .header-actions .btn {
    padding: 6px 10px;
    font-size: .78rem;
  }
  .dash-main {
    padding: 20px 14px 48px;
  }
  .dash-intro {
    text-align: center;
  }
  .dash-intro h1 {
    font-size: 1.25rem;
  }
  .dash-intro p {
    margin-bottom: 18px;
    font-size: .88rem;
  }
  .module-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 12px;
    justify-content: center;
    max-width: 560px;
    margin-inline: auto;
  }
  .module-card {
    padding: 18px 14px;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
  }
  .module-card::before {
    inset-inline: 0;
    top: auto;
    bottom: 0;
    width: 100%;
    height: 4px;
  }
  .module-icon {
    margin-inline: auto;
    margin-bottom: 12px;
  }
  .module-card h2 {
    font-size: .95rem;
  }
  .module-card p {
    font-size: .78rem;
    line-height: 1.55;
  }
}

@media (max-width: 380px) {
  .module-card {
    padding: 14px 10px;
  }
  .module-card h2 {
    font-size: .88rem;
  }
}
