@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;700;800&display=swap');

:root {
  --bg: #edf2fb;
  --bg-soft: #f8fbff;
  --bg-accent: #dbe7ff;
  --card: rgba(255, 255, 255, 0.94);
  --card-strong: #ffffff;
  --ink: #102a56;
  --muted: #5f79a3;
  --line: rgba(16, 42, 86, 0.1);
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #e5efff;
  --navy: #0f2854;
  --navy-deep: #0a1d3f;
  --danger: #d64747;
  --shadow: 0 18px 50px rgba(15, 40, 84, 0.12);
  --radius: 28px;
}

html {
  font-size: 15px;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Vazirmatn", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top center, rgba(37, 99, 235, 0.08), transparent 26%),
    radial-gradient(circle at bottom left, rgba(15, 40, 84, 0.08), transparent 22%),
    linear-gradient(180deg, var(--bg-soft), var(--bg));
}

a {
  text-decoration: none;
}

.app-shell {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 352px;
  margin: 28px 28px 28px 0;
  border-radius: 30px;
  background: linear-gradient(180deg, var(--navy-deep), #18376e);
  color: #f8fafc;
  padding: 22px;
  display: flex;
  flex-direction: column;
  gap: 24px;
  box-shadow: var(--shadow);
  align-self: flex-start;
  position: sticky;
  top: 24px;
}

.brand-block h2,
.hero-panel h1,
.page-title {
  margin: 0;
  font-weight: 800;
}

.eyebrow {
  display: inline-block;
  font-size: 0.9rem;
  color: var(--primary);
  margin-bottom: 10px;
  font-weight: 700;
}

.nav-stack {
  display: grid;
  gap: 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  padding-top: 18px;
}

.sidebar-logout {
  margin-top: auto;
  padding-top: 18px;
  border-top: 1px solid rgba(255,255,255,0.08);
}

.nav-stack .nav-link {
  color: #f4f7ff;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 17px 20px;
  background: rgba(255,255,255,0.03);
  transition: 0.2s ease;
  font-size: 1.05rem;
  font-weight: 700;
}

.nav-stack .nav-link:hover {
  background: rgba(255,255,255,0.08);
  border-color: rgba(255,255,255,0.08);
  color: #fff;
  transform: translateX(-3px);
}

.nav-stack .nav-link.active {
  background: linear-gradient(135deg, #2c6cff, var(--primary));
  color: #fff;
  box-shadow: inset 0 1px 0 rgba(255,255,255,0.12);
}

.main-shell {
  flex: 1;
  padding: 28px 28px 28px;
}

.content-shell {
  padding-top: 0;
}

.hero-panel,
.panel-card,
.stat-card,
.login-card {
  background: var(--card);
  border: 1px solid rgba(173, 193, 224, 0.35);
  box-shadow: var(--shadow);
  backdrop-filter: blur(12px);
}

.hero-panel {
  padding: 34px 36px;
  border-radius: var(--radius);
  margin-bottom: 28px;
  position: relative;
  overflow: hidden;
}

.hero-panel::before {
  content: "";
  position: absolute;
  inset: auto auto -48px -36px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: rgba(37, 99, 235, 0.1);
}

.hero-panel p {
  max-width: 860px;
  color: var(--muted);
  margin: 12px 0 0;
  font-size: 1.06rem;
  line-height: 2;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 20px;
  margin-bottom: 28px;
}

.stat-card {
  border-radius: 24px;
  padding: 24px 28px;
  position: relative;
  overflow: hidden;
  min-height: 146px;
}

.stat-card::before {
  content: "";
  position: absolute;
  inset: auto auto -34px -28px;
  width: 116px;
  height: 116px;
  border-radius: 50%;
  background: var(--primary-soft);
}

.stat-card span {
  display: block;
  color: var(--muted);
  font-size: 1rem;
  position: relative;
  z-index: 1;
}

.stat-card strong {
  display: block;
  margin-top: 18px;
  font-size: 3rem;
  line-height: 1;
  color: var(--navy);
  position: relative;
  z-index: 1;
}

.panel-card {
  border-radius: var(--radius);
  padding: 28px;
}

.narrow-card {
  max-width: 860px;
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: start;
  gap: 16px;
  margin-bottom: 18px;
}

.panel-header h1,
.panel-header h2 {
  margin: 0;
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--navy);
}

.panel-header p,
.text-muted {
  color: var(--muted) !important;
}

.table {
  --bs-table-color: var(--ink);
}

.table thead th {
  color: var(--muted);
  font-weight: 700;
  border-bottom-width: 1px;
}

.table > :not(caption) > * > * {
  border-bottom-color: var(--line);
  background: transparent;
  padding-top: 1rem;
  padding-bottom: 1rem;
}

.truncate-cell {
  max-width: 340px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.actions-cell {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.search-form {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
}

.info-grid {
  display: grid;
  gap: 14px;
  margin: 0;
}

.info-grid div {
  border: 1px solid var(--line);
  border-radius: 20px;
  padding: 16px 18px;
  background: #f8fbff;
}

.info-grid dt {
  font-size: 0.82rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.info-grid dd {
  margin: 0;
  font-weight: 600;
}

.code-area {
  font-family: Consolas, monospace;
  direction: ltr;
}

.login-page {
  display: grid;
  place-items: center;
  padding: 24px;
}

.login-shell {
  width: min(100%, 540px);
}

.login-card {
  border-radius: 36px;
  padding: 40px;
}

.login-brand {
  margin-bottom: 28px;
}

.login-form .form-control {
  min-height: 52px;
}

.btn-primary {
  background: linear-gradient(135deg, #2c6cff, var(--primary));
  border-color: transparent;
  border-radius: 18px;
  min-height: 50px;
  font-weight: 700;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--primary-dark);
  border-color: transparent;
}

.btn-outline-primary {
  color: var(--primary);
  border-color: rgba(37, 99, 235, 0.28);
  border-radius: 16px;
  font-weight: 700;
}

.btn-outline-primary:hover,
.btn-outline-primary:focus {
  background: var(--primary-soft);
  color: var(--primary-dark);
  border-color: rgba(37, 99, 235, 0.35);
}

.btn-outline-danger {
  color: var(--danger);
  border-color: rgba(185, 28, 28, 0.4);
}

.btn-outline-light {
  border-color: rgba(255,255,255,0.35);
  color: #fff;
  border-radius: 16px;
  min-width: 112px;
  font-weight: 700;
}

.form-control,
.form-select {
  border-radius: 18px;
  border-color: rgba(16, 42, 86, 0.12);
  padding: 0.9rem 1rem;
  background: #fff;
}

.form-control:focus,
.form-select:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(37, 99, 235, 0.14);
}

.badge.text-bg-dark {
  background: var(--navy) !important;
}

.badge.text-bg-secondary {
  background: #7f8fb0 !important;
}

.badge.text-bg-success {
  background: #1f8f5f !important;
}

.alert-success {
  border-radius: 18px;
  background: #eefaf4;
  border-color: #c7edd6;
  color: #17603d;
}

.shadow-lg {
  box-shadow: var(--shadow) !important;
}

@media (max-width: 991.98px) {
  .app-shell {
    flex-direction: column;
  }

  .sidebar {
    width: 100%;
    margin: 20px 20px 0;
    position: static;
  }

  .main-shell {
    padding: 20px;
  }

  .stats-grid {
    grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  }
}
