:root {
  --bg: #070b18;
  --bg-soft: #0f172a;
  --card: #ffffff;
  --ink: #0f172a;
  --muted: #64748b;
  --line: #e2e8f0;
  --brand: #4f46e5;
  --brand-2: #7c3aed;
  --ok: #16a34a;
  --warn: #f97316;
  --err: #ef4444;
  --radius: 16px;
  --shadow: 0 24px 70px rgba(2, 6, 23, 0.35);
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { scroll-behavior: smooth; }

body {
  font-family: "Vazirmatn", "Segoe UI", Tahoma, Arial, sans-serif;
  background: radial-gradient(1200px 600px at 80% -10%, #312e81 0%, transparent 55%), var(--bg);
  color: #e2e8f0;
  min-height: 100vh;
  line-height: 1.9;
}

body[dir="ltr"] { font-family: "Segoe UI", Inter, Tahoma, Arial, sans-serif; }

a { color: #a5b4fc; text-decoration: none; }
a:hover { color: #c7d2fe; }

.wrap { width: min(1280px, 100% - 40px); margin-inline: auto; }

/* ---------------- header ---------------- */
.top {
  /* the header carries the full menu, so it is allowed to be wider than the
     content column - otherwise the items wrap onto a second line */
  position: sticky; top: 0; z-index: 30;
  backdrop-filter: blur(14px);
  background: rgba(7, 11, 24, 0.78);
  border-bottom: 1px solid rgba(148, 163, 184, 0.16);
}
.top .inner { display: flex; align-items: center; gap: 14px; padding: 12px 0; width: min(1560px, 100% - 40px); margin-inline: auto; }
.logo { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 20px; color: #fff; }
.logo .mark {
  width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center;
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  box-shadow: 0 10px 30px rgba(79, 70, 229, 0.45);
}
nav.main { display: flex; gap: 2px; margin-inline-start: 6px; flex-wrap: nowrap; align-items: center; }
nav.main a {
  padding: 8px 11px; border-radius: 999px; color: #cbd5e1; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
nav.main a:hover { background: rgba(148, 163, 184, 0.14); color: #fff; }
nav.main a.active { background: rgba(79, 70, 229, 0.25); color: #fff; }
.spacer { flex: 1; }
.lang { display: flex; gap: 4px; background: rgba(148, 163, 184, 0.12); padding: 4px; border-radius: 999px; }
.lang button {
  border: 0; background: transparent; color: #cbd5e1; font-weight: 700; font-size: 13px;
  padding: 6px 12px; border-radius: 999px; cursor: pointer;
}
.lang button.on { background: #fff; color: #0f172a; }

/* ---------------- generic ---------------- */
.hero { padding: 64px 0 30px; text-align: center; }
.hero h1 { font-size: clamp(30px, 4.6vw, 52px); line-height: 1.35; color: #fff; }
.hero h1 .grad {
  background: linear-gradient(135deg, #818cf8, #c084fc);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero p.lead { margin-top: 14px; color: #94a3b8; font-size: 18px; }
.pill {
  display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px; border-radius: 999px;
  background: rgba(79, 70, 229, 0.16); border: 1px solid rgba(129, 140, 248, 0.35);
  color: #c7d2fe; font-weight: 700; font-size: 13px;
}

.card {
  background: var(--card); color: var(--ink); border-radius: var(--radius);
  box-shadow: var(--shadow); padding: 26px;
}
.card.dark {
  background: rgba(15, 23, 42, 0.72); color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.16);
  box-shadow: none;
}
.card h2 { font-size: 20px; margin-bottom: 12px; }
.grid { display: grid; gap: 18px; }
.grid.two { grid-template-columns: 1.15fr 0.85fr; }
.grid.three { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 900px) { .grid.two, .grid.three { grid-template-columns: 1fr; } }

section { padding: 34px 0; }
h2.section-title { color: #fff; font-size: 26px; margin-bottom: 18px; }
p.muted, .muted { color: var(--muted); }
.small { font-size: 13px; }

/* ---------------- uploader ---------------- */
.drop {
  border: 2px dashed #cbd5e1; border-radius: 14px; padding: 30px 20px; text-align: center;
  background: #f8fafc; cursor: pointer; transition: 0.18s ease;
}
.drop:hover, .drop.over { border-color: var(--brand); background: #eef2ff; }
.drop .ico { font-size: 38px; }
.drop b { display: block; margin-top: 8px; font-size: 17px; }
.field { margin-top: 16px; }
.field label { display: block; font-weight: 700; font-size: 14px; margin-bottom: 6px; color: #334155; }
.field input[type="text"], .field input[type="file"], .field select {
  width: 100%; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px;
  font: inherit; font-size: 14px; background: #fff; color: var(--ink);
}
.field .hint { color: var(--muted); font-size: 12.5px; margin-top: 5px; }
.row { display: flex; gap: 12px; flex-wrap: wrap; align-items: center; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; justify-content: center;
  padding: 13px 22px; border: 0; border-radius: 999px; font: inherit; font-weight: 800;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; cursor: pointer;
  box-shadow: 0 14px 34px rgba(79, 70, 229, 0.35);
}
.btn:disabled { opacity: 0.55; cursor: not-allowed; box-shadow: none; }
.btn.ghost { background: #0f172a; box-shadow: none; }
.btn.small { padding: 9px 15px; font-size: 13px; }
.btn.link { background: transparent; color: var(--brand); box-shadow: none; padding: 6px 0; }

.progress { height: 8px; background: #e2e8f0; border-radius: 999px; overflow: hidden; margin-top: 14px; }
.progress > i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--brand), var(--brand-2)); transition: width 0.3s ease; }
.status { margin-top: 12px; font-size: 14px; }
.status .ok { color: var(--ok); font-weight: 700; }
.status .err { color: var(--err); font-weight: 700; }

.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.stat-grid div { background: #f1f5f9; border-radius: 10px; padding: 10px 12px; }
.stat-grid b { display: block; font-size: 20px; color: #0f172a; }
@media (max-width: 700px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ---------------- tables ---------------- */
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 10px 12px; text-align: start; border-bottom: 1px solid var(--line); }
th { background: #f8fafc; font-size: 13px; color: #475569; }
td .tag { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.tag.ts { background: #fee2e2; color: #b91c1c; }
.tag.nts { background: #dcfce7; color: #15803d; }
.tag.os { background: #e0e7ff; color: #3730a3; }
.tag.miss { background: #f1f5f9; color: #64748b; }
code, pre {
  font-family: var(--mono); direction: ltr; text-align: left;
}
code { background: #0f172a; color: #34d399; padding: 2px 7px; border-radius: 6px; font-size: 12.5px; }
pre {
  background: #0b1120; color: #e2e8f0; border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px; padding: 14px 16px; overflow-x: auto; font-size: 13px; line-height: 1.7;
}
pre .c { color: #64748b; }
pre .s { color: #7dd3fc; }

/* ---------------- misc ---------------- */
ol.steps, ul.bullets { padding-inline-start: 22px; }
ol.steps li, ul.bullets li { margin: 6px 0; }
.callout {
  border-inline-start: 5px solid var(--brand); background: #f8fafc; border-radius: 12px;
  padding: 14px 16px; margin: 14px 0; color: #334155;
}
.callout.warn { border-color: var(--warn); background: #fff7ed; color: #7c2d12; }
.callout.ok { border-color: var(--ok); background: #f0fdf4; color: #14532d; }
.badge-row { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.badge-row span { background: rgba(148, 163, 184, 0.15); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; color: #cbd5e1; }

footer.site {
  margin-top: 40px; padding: 26px 0 40px; border-top: 1px solid rgba(148, 163, 184, 0.16);
  color: #94a3b8; font-size: 13.5px;
}
footer.site .inner { display: flex; gap: 16px; flex-wrap: wrap; justify-content: space-between; }

.toast {
  position: fixed; inset-inline-end: 22px; bottom: 22px; z-index: 60;
  background: #0f172a; color: #fff; padding: 13px 18px; border-radius: 12px;
  box-shadow: var(--shadow); font-size: 14px; opacity: 0; transform: translateY(10px);
  transition: 0.24s ease; pointer-events: none;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: #7f1d1d; }
.toast.ok { background: #14532d; }

/* ---------------- commercial platform ---------------- */
.hidden { display: none !important; }
.auth-slot { display: flex; gap: 8px; align-items: center; margin-inline-start: 10px; }

.plans { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; align-items: stretch; }
@media (max-width: 1100px) { .plans { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 680px) { .plans { grid-template-columns: 1fr; } }

.plan {
  background: #fff; color: var(--ink); border-radius: 16px; padding: 22px;
  box-shadow: var(--shadow); display: flex; flex-direction: column; gap: 10px;
  border: 2px solid transparent;
}
.plan.hl { border-color: var(--brand); position: relative; }
.plan.hl::after {
  content: 'پیشنهاد ویژه'; position: absolute; top: -12px; inset-inline-start: 18px;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff;
  font-size: 11.5px; font-weight: 700; padding: 3px 10px; border-radius: 999px;
}
.plan h3 { font-size: 20px; }
.plan .price { font-size: 30px; font-weight: 800; color: var(--brand); }
.plan .price small { font-size: 13px; color: var(--muted); font-weight: 600; }
.plan ul { list-style: none; padding: 0; margin: 6px 0 0; color: #334155; font-size: 14px; }
.plan ul li { padding: 5px 0; border-bottom: 1px dashed #e2e8f0; }
.plan ul li:last-child { border-bottom: 0; }
.plan ul li::before { content: '✓ '; color: var(--ok); font-weight: 800; }
.plan ul li.off::before { content: '× '; color: #cbd5e1; }
.plan ul li.off { color: #94a3b8; }
.plan .foot { margin-top: auto; }

.card.auth { max-width: 480px; margin-inline: auto; }
/* ---------------- applications / licences panel ----------------
   Light styles on purpose: these blocks carry text inputs and date pickers, and
   a dark card made every control look like a stray white box. */
.icu-app {
  margin-top: 14px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #f8fafc;
}
.icu-app-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap; margin-bottom: 10px;
}
.icu-app-head b { font-size: 16px; }
.icu-item {
  border: 1px solid var(--line); border-radius: 12px; background: #fff;
  padding: 10px 12px; margin-bottom: 8px;
}
.icu-item-warn { background: #fff7ed; border-color: #fed7aa; }
.icu-item-head {
  display: flex; align-items: center; justify-content: space-between;
  gap: 10px; flex-wrap: wrap;
}
.icu-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
/* the per domain "what happens when the licence is revoked" switch */
.icu-select {
  width: auto; min-width: 180px; padding: 6px 10px; font-size: 13px;
  border: 1px solid #cbd5e1; border-radius: 10px; background: #fff; color: #0f172a;
}
.icu-requests {
  border: 1px solid #fed7aa; background: #fff7ed; color: #7c2d12;
  border-radius: 12px; padding: 12px 14px; margin: 10px 0 14px;
}
.icu-requests > b { display: block; margin-bottom: 8px; }
.icu-app label { display: block; font-size: 13px; font-weight: 700; color: #334155; margin-bottom: 5px; }
.icu-app input { width: 100%; }
.btn.danger { background: #fee2e2; color: #b91c1c; box-shadow: none; }
.btn.danger:hover { background: #fecaca; color: #7f1d1d; }
/* ---------------- Jalali date picker ---------------- */
.jdp-input { cursor: pointer; background: #fff; }
.jdp {
  position: absolute; z-index: 60; width: 268px; padding: 12px;
  background: #fff; color: var(--ink); border: 1px solid var(--line);
  border-radius: 14px; box-shadow: 0 24px 60px rgba(15, 23, 42, .22);
  font-size: 13.5px;
}
.jdp-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.jdp-head select {
  flex: 1; padding: 6px 8px; border: 1px solid var(--line); border-radius: 9px;
  background: #f8fafc; font: inherit; color: var(--ink);
}
.jdp-nav {
  border: 1px solid var(--line); background: #f8fafc; color: var(--ink);
  width: 30px; height: 30px; border-radius: 9px; cursor: pointer; font-size: 16px; line-height: 1;
}
.jdp-nav:hover { background: #eef2ff; }
.jdp-week, .jdp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 3px; }
.jdp-week span { text-align: center; color: var(--muted); font-size: 12px; padding: 3px 0; }
.jdp-day {
  border: 0; background: transparent; color: var(--ink); border-radius: 9px;
  padding: 7px 0; cursor: pointer; font: inherit;
}
.jdp-day:hover { background: #eef2ff; }
.jdp-day.today { box-shadow: inset 0 0 0 1px #c7d2fe; }
.jdp-day.on { background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; }
.jdp-day.jdp-empty { visibility: hidden; }
.jdp-foot { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.jdp-btn {
  flex: 1; border: 0; border-radius: 999px; padding: 8px 10px; cursor: pointer;
  background: linear-gradient(135deg, var(--brand), var(--brand-2)); color: #fff; font: inherit; font-weight: 700;
}
.jdp-btn.ghost { background: #f1f5f9; color: #334155; }
.field .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
@media (max-width: 560px) { .field .row2 { grid-template-columns: 1fr; } }

table.kv td:first-child { color: var(--muted); width: 42%; }
.progress.thin { height: 6px; }
.meter { display: flex; justify-content: space-between; font-size: 12.5px; color: var(--muted); margin-top: 4px; }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 16px; }
.tabs button {
  border: 1px solid var(--line); background: #fff; color: #334155; font: inherit; font-weight: 600;
  padding: 8px 14px; border-radius: 999px; cursor: pointer;
}
.tabs button.on { background: #0f172a; color: #fff; border-color: #0f172a; }
.panel { display: none; }
.panel.on { display: block; }
.list-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 12px; margin-bottom: 8px;
  font-size: 14px; flex-wrap: wrap;
}
.tag.ok { background: #dcfce7; color: #15803d; }
.tag.warn { background: #fef3c7; color: #b45309; }
.tag.err { background: #fee2e2; color: #b91c1c; }
.tag.info { background: #e0e7ff; color: #3730a3; }
.stat-grid.small b { font-size: 16px; }
.dark-panel { background: rgba(15,23,42,.72); border: 1px solid rgba(148,163,184,.16); border-radius: 16px; padding: 20px; color: #e2e8f0; }
.dark-panel h2, .dark-panel h3 { color: #fff; }
.dark-panel .muted { color: #94a3b8; }

/* ---------------- responsive / mobile ---------------- */
html, body { max-width: 100%; }
body { overflow-x: hidden; }

/* grid/flex children default to min-width:auto, which lets a wide <pre> or table
 * stretch the whole layout - the usual cause of mobile horizontal overflow */
.grid > *, .row > *, .plans > *, .stat-grid > * { min-width: 0; }
.card { min-width: 0; }
pre, table, code { max-width: 100%; }
pre { overflow-x: auto; }
.table-wrap, .card > div[style*="overflow-x"] { max-width: 100%; }

.nav-toggle {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 42px;
  height: 38px;
  padding: 0;
  background: rgba(148, 163, 184, .14);
  border: 1px solid rgba(148, 163, 184, .2);
  border-radius: 10px;
  cursor: pointer;
}
.nav-toggle span {
  display: block;
  width: 20px;
  height: 2px;
  margin-inline: auto;
  border-radius: 2px;
  background: #e2e8f0;
  transition: transform .2s ease, opacity .2s ease;
}
body.nav-open .nav-toggle span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
body.nav-open .nav-toggle span:nth-child(2) { opacity: 0; }
body.nav-open .nav-toggle span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
.nav-auth { display: none; }

@media (max-width: 1200px) {
  .wrap { width: min(1280px, 100% - 26px); }
  .top .inner { width: min(1560px, 100% - 26px); }

  /* header: logo + language + a hamburger that opens the nav panel */
  .top .inner { flex-wrap: nowrap; gap: 6px; padding: 9px 0; }
  .logo { font-size: 16.5px; gap: 7px; min-width: 0; flex: 0 1 auto; overflow: hidden; }
  .logo .mark { width: 29px; height: 29px; border-radius: 9px; font-size: 14px; flex: 0 0 auto; }
  .lang { padding: 3px; flex: 0 0 auto; }
  .lang button { padding: 5px 8px; font-size: 12px; }
  .nav-toggle { display: inline-flex; flex: 0 0 auto; }
  .auth-slot { display: none; }

  nav.main {
    position: absolute;
    top: 100%;
    inset-inline: 0;
    display: none;
    flex-direction: column;
    align-items: stretch;
    gap: 2px;
    margin: 0;
    padding: 10px 14px 16px;
    background: #070b18;
    border-bottom: 1px solid rgba(148, 163, 184, .18);
    box-shadow: 0 20px 40px rgba(0, 0, 0, .5);
    max-height: calc(100vh - 60px);
    overflow-y: auto;
  }
  body.nav-open nav.main { display: flex; }
  nav.main a { padding: 12px 14px; border-radius: 12px; font-size: 15px; }
  nav.main a.active { background: rgba(79, 70, 229, .28); }
  .nav-auth { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; padding-top: 12px; border-top: 1px solid rgba(148, 163, 184, .16); }
  .nav-auth .btn { width: 100%; }

  /* layout */
  .hero { padding: 30px 0 14px; }
  .hero h1 { font-size: clamp(23px, 7.4vw, 32px); }
  .hero p.lead { font-size: 15.5px; }
  .hero .pill { font-size: 12px; padding: 6px 12px; }
  section { padding: 22px 0; }
  h2.section-title { font-size: 21px; }
  .card { padding: 18px; border-radius: 14px; }
  .card h2 { font-size: 18px; }

  /* tables scroll instead of breaking the layout */
  .card table { display: block; overflow-x: auto; white-space: nowrap; -webkit-overflow-scrolling: touch; }
  .card table.kv { display: table; white-space: normal; }
  pre { font-size: 12px; padding: 12px; }
  .tabs { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 4px; }
  .tabs button { flex: 0 0 auto; }
  .stat-grid { grid-template-columns: repeat(2, 1fr); }
  .stat-grid b { font-size: 17px; }
  .list-row { align-items: flex-start; }
  .list-row select, .list-row input { max-width: 100%; }

  /* forms */
  .row2 { grid-template-columns: 1fr !important; }
  .row > .btn { flex: 1 1 auto; }

  /* footer */
  footer.site .inner { flex-direction: column; gap: 10px; }
  .toast { inset-inline: 14px; bottom: 14px; text-align: center; }
}

@media (max-width: 420px) {
  .wrap { width: min(1180px, 100% - 20px); }
  .hero h1 { font-size: clamp(21px, 7.6vw, 27px); }
  .plan { padding: 18px; }
  .plan .price { font-size: 26px; }
}
