@import url('https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;500&display=swap');

:root{
  --bg:#F5F6FB;
  --surface:#FFFFFF;
  --surface-2:#FAFBFF;
  --border:#E7E9F3;
  --text:#1E2333;
  --muted:#6B7280;
  --primary:#5B5FEF;
  --primary-dark:#4A4DD1;
  --accent:#1FBF9F;
  --warning:#F5A623;
  --danger:#EF4444;
  --radius:16px;
}

*{box-sizing:border-box;}
html,body{height:100%;}
body{
  font-family:'Vazirmatn', sans-serif;
  background:
    radial-gradient(1200px 600px at 100% -10%, rgba(91,95,239,0.07), transparent),
    radial-gradient(1000px 500px at -10% 110%, rgba(31,191,159,0.06), transparent),
    var(--bg);
  color:var(--text);
  margin:0;
}

.mono{ font-family:'JetBrains Mono', monospace; direction:ltr; text-align:left; unicode-bidi:plaintext;}

/* Layout */
.app-shell{ display:flex; min-height:100vh; }
.sidebar{
  width:250px; flex-shrink:0; background:var(--surface);
  border-left:1px solid var(--border);
  padding:24px 18px; display:flex; flex-direction:column; gap:6px;
}
.brand{ display:flex; align-items:center; gap:10px; padding:6px 10px 22px 10px; }
.brand-badge{
  width:36px; height:36px; border-radius:10px;
  background:linear-gradient(135deg, var(--primary), var(--accent));
  display:flex; align-items:center; justify-content:center; color:#fff; font-weight:800;
}
.brand-name{ font-weight:800; font-size:16px; }
.brand-sub{ font-size:11px; color:var(--muted); margin-top:-2px; }

.nav-link{
  display:flex; align-items:center; gap:10px; padding:11px 14px; border-radius:12px;
  color:var(--muted); text-decoration:none; font-weight:600; font-size:14px;
  transition:background .15s, color .15s;
}
.nav-link:hover{ background:var(--surface-2); color:var(--text); }
.nav-link.active{ background:rgba(91,95,239,0.1); color:var(--primary); }
.nav-link .dot{ width:6px; height:6px; border-radius:50%; background:currentColor; opacity:.5; }

.main{ flex:1; min-width:0; }
.topbar{
  display:flex; align-items:center; justify-content:space-between;
  padding:18px 28px; border-bottom:1px solid var(--border); background:var(--surface);
  position:sticky; top:0; z-index:10;
}
.content{ padding:28px; max-width:1200px; margin:0 auto; }

/* Cards */
.card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:20px;
}
.stat-card{
  background:var(--surface); border:1px solid var(--border); border-radius:var(--radius);
  padding:18px 20px; display:flex; flex-direction:column; gap:6px;
}
.stat-num{ font-size:28px; font-weight:800; }
.stat-label{ color:var(--muted); font-size:13px; font-weight:600; }

/* Buttons */
.btn{
  display:inline-flex; align-items:center; gap:6px; justify-content:center;
  padding:9px 16px; border-radius:10px; font-weight:700; font-size:13.5px;
  border:1px solid transparent; cursor:pointer; transition:transform .1s, opacity .15s;
}
.btn:active{ transform:scale(0.97); }
.btn-primary{ background:var(--primary); color:#fff; }
.btn-primary:hover{ background:var(--primary-dark); }
.btn-outline{ background:var(--surface); border-color:var(--border); color:var(--text); }
.btn-outline:hover{ background:var(--surface-2); }
.btn-danger{ background:#FEF2F2; color:var(--danger); border-color:#FDE2E2; }
.btn-sm{ padding:6px 10px; font-size:12.5px; border-radius:8px; }

/* Badges */
.badge{
  display:inline-flex; align-items:center; gap:6px; padding:4px 10px; border-radius:999px;
  font-size:12px; font-weight:700;
}
.badge .dot{ width:7px; height:7px; border-radius:50%; }
.badge-active{ background:#ECFDF5; color:#059669; }
.badge-active .dot{ background:#10B981; }
.badge-expired{ background:#FEF2F2; color:#DC2626; }
.badge-expired .dot{ background:#EF4444; }
.badge-limited{ background:#FFFBEB; color:#B45309; }
.badge-limited .dot{ background:#F59E0B; }
.badge-disabled{ background:#F3F4F6; color:#6B7280; }
.badge-disabled .dot{ background:#9CA3AF; }

/* Table */
table{ width:100%; border-collapse:collapse; }
th{ text-align:right; font-size:12px; color:var(--muted); font-weight:700; padding:10px 12px; border-bottom:1px solid var(--border); }
td{ padding:12px; border-bottom:1px solid var(--border); font-size:14px; }
tr:last-child td{ border-bottom:none; }
tr:hover td{ background:var(--surface-2); }

/* Inputs */
.field label{ display:block; font-size:12.5px; font-weight:700; color:var(--muted); margin-bottom:6px; }
.field input, .field select, .field textarea{
  width:100%; padding:10px 12px; border-radius:10px; border:1px solid var(--border);
  background:var(--surface-2); font-family:inherit; font-size:13.5px; color:var(--text);
}
.field textarea{ font-family:'JetBrains Mono', monospace; direction:ltr; text-align:left; }
.field input:focus, .field select:focus, .field textarea:focus{ outline:2px solid var(--primary); outline-offset:1px; background:#fff; }

/* Modal */
.modal-backdrop{
  position:fixed; inset:0; background:rgba(20,22,40,0.45); display:none;
  align-items:center; justify-content:center; z-index:50; padding:20px;
}
.modal-backdrop.open{ display:flex; }
.modal{ background:#fff; border-radius:18px; padding:24px; width:100%; max-width:480px; max-height:88vh; overflow-y:auto; }

.token-chip{
  display:inline-flex; align-items:center; gap:8px; background:var(--surface-2);
  border:1px solid var(--border); border-radius:10px; padding:8px 12px; font-size:13px;
}

@media (max-width: 860px){
  .app-shell{ flex-direction:column; }
  .sidebar{ width:100%; border-left:none; border-bottom:1px solid var(--border); flex-direction:row; overflow-x:auto; padding:12px; }
  .brand{ padding:0 10px 0 0; }
  .nav-link{ white-space:nowrap; }
  .content{ padding:18px; }
  table{ display:block; overflow-x:auto; }
}
