@font-face { font-family: "IRANSans"; src: url("fonts/IRANSansFaNum.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "IRANSans"; src: url("fonts/IRANSansFaNum_Medium.woff2") format("woff2"); font-weight: 500; font-display: swap; }
@font-face { font-family: "IRANSans"; src: url("fonts/IRANSansFaNum_Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --bg: #070a17;
  --panel: #ffffff0b;
  --panel-2: #ffffff14;
  --solid: #12162b;
  --border: #ffffff1a;
  --text: #eef0fb;
  --muted: #9aa1c4;
  --accent: #7c6cff;
  --accent-2: #22d3ee;
  --good: #34d399;
  --warn: #fbbf24;
  --bad: #f87171;
  --radius: 16px;
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  font-family: "IRANSans", Tahoma, sans-serif;
  background: radial-gradient(900px 600px at 85% -10%, #4f46e540, transparent 60%), radial-gradient(800px 500px at 0% 110%, #06b6d425, transparent 60%), var(--bg);
  background-attachment: fixed;
  color: var(--text);
  font-size: 14px;
  line-height: 1.7;
}
a { color: var(--accent-2); text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
.boot { padding: 40px; text-align: center; color: var(--muted); }
.mono { font-family: Consolas, "Courier New", monospace; direction: ltr; unicode-bidi: isolate; letter-spacing: .02em; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.good { color: var(--good); } .warn { color: var(--warn); } .bad { color: var(--bad); }

/* layout */
.shell { display: flex; min-height: 100vh; }
.side { width: 230px; flex-shrink: 0; padding: 16px; border-inline-start: 0; position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 4px; }
.brand { display: flex; align-items: center; gap: 10px; padding: 6px 8px 18px; font-weight: 700; font-size: 17px; }
.brand img { width: 30px; height: 30px; }
.brand span { background: linear-gradient(90deg, var(--accent), var(--accent-2)); -webkit-background-clip: text; background-clip: text; color: transparent; }
.nav a { display: block; padding: 9px 12px; border-radius: 12px; color: var(--muted); }
.nav a:hover { background: var(--panel-2); color: var(--text); }
.nav a.on { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--text); }
.side .bottom { margin-top: auto; }
main { flex: 1; min-width: 0; padding: 24px 28px 60px; }
h1 { font-size: 20px; margin: 0 0 16px; }
h2 { font-size: 16px; margin: 0; }
.head { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.head h1 { margin: 0; flex: 1; }

.card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius); backdrop-filter: blur(16px); }
.card + .card, .card + .grid, .grid + .card { margin-top: 16px; }
.pad { padding: 16px 18px; }
.card-head { display: flex; align-items: center; gap: 10px; padding: 14px 18px; border-bottom: 1px solid var(--border); flex-wrap: wrap; }
.card-head h2 { flex: 1; }
.grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.stat { padding: 16px 18px; }
.stat b { display: block; font-size: 26px; }
.stat span { color: var(--muted); font-size: 12px; }

/* controls */
.btn { display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border); background: var(--panel-2); border-radius: 10px; padding: 7px 14px; cursor: pointer; white-space: nowrap; transition: .15s; }
.btn:hover { border-color: color-mix(in srgb, var(--accent) 60%, transparent); }
.btn.primary { background: linear-gradient(135deg, var(--accent), color-mix(in srgb, var(--accent) 60%, var(--accent-2))); border-color: transparent; color: #fff; }
.btn.danger { color: var(--bad); }
.btn.sm { padding: 3px 10px; font-size: 12px; border-radius: 8px; }
.btn:disabled { opacity: .5; cursor: default; }
input, select, textarea { background: #0006; border: 1px solid var(--border); border-radius: 10px; padding: 8px 12px; width: 100%; outline: none; }
input:focus, select:focus, textarea:focus { border-color: var(--accent); }
select option { background: var(--solid); }
textarea { min-height: 90px; resize: vertical; }
label.f { display: block; margin-bottom: 12px; }
label.f > span { display: block; font-size: 12px; color: var(--muted); margin-bottom: 4px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.search { max-width: 320px; }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { width: auto; }

/* tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 10px 14px; text-align: start; border-bottom: 1px solid var(--border); vertical-align: middle; }
th { font-size: 12px; color: var(--muted); font-weight: 500; white-space: nowrap; }
tr:last-child td { border-bottom: 0; }
tbody tr.link { cursor: pointer; }
tbody tr.link:hover { background: var(--panel-2); }
.empty { padding: 30px; text-align: center; color: var(--muted); }

.tag { display: inline-block; padding: 0 9px; border-radius: 99px; font-size: 11px; line-height: 20px; background: var(--panel-2); border: 1px solid var(--border); white-space: nowrap; }
.tag.good { color: var(--good); border-color: color-mix(in srgb, var(--good) 40%, transparent); }
.tag.bad { color: var(--bad); border-color: color-mix(in srgb, var(--bad) 40%, transparent); }
.tag.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 40%, transparent); }

/* toggles */
.sw { position: relative; width: 42px; height: 24px; border-radius: 99px; background: #ffffff22; border: 0; cursor: pointer; flex-shrink: 0; transition: .15s; }
.sw::after { content: ""; position: absolute; top: 2px; right: 20px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .15s; }
.sw.on { background: var(--accent); }
.sw.on::after { right: 2px; }
.feat { display: flex; align-items: center; gap: 12px; padding: 10px 18px; border-bottom: 1px solid var(--border); }
.feat:last-child { border-bottom: 0; }
.feat .t { flex: 1; }
.feat .o { font-size: 11px; }

/* license card */
.lic { padding: 16px 18px; border-bottom: 1px solid var(--border); }
.lic:last-child { border-bottom: 0; }
.lic-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.lic-key { font-size: 16px; font-weight: 700; }
.lic-meta { display: flex; gap: 18px; flex-wrap: wrap; margin: 8px 0; color: var(--muted); font-size: 12px; }
.lic-meta b { color: var(--text); font-weight: 500; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; }
.devices { margin-top: 10px; background: #0003; border-radius: 12px; }
.devices td, .devices th { padding: 7px 12px; font-size: 12px; }

/* events */
.ev-kind { white-space: nowrap; }

/* modal + toast */
.modal-bg { position: fixed; inset: 0; background: #000a; display: grid; place-items: center; z-index: 50; padding: 16px; }
.modal { width: min(520px, 100%); max-height: 90vh; overflow: auto; background: var(--solid); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; }
.modal h2 { margin-bottom: 14px; }
.modal .foot { display: flex; gap: 8px; justify-content: flex-start; margin-top: 16px; }
#toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); z-index: 60; display: flex; flex-direction: column; gap: 8px; align-items: center; }
#toast div { background: var(--solid); border: 1px solid var(--border); border-radius: 12px; padding: 10px 18px; box-shadow: 0 10px 30px #0008; }
#toast div.err { border-color: var(--bad); color: var(--bad); }

/* login */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login .card { width: min(360px, 100%); padding: 28px; }
.login .brand { justify-content: center; }

@media (max-width: 760px) {
  .shell { flex-direction: column; }
  .side { width: auto; height: auto; position: static; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px; }
  .brand { padding: 0 0 0 10px; }
  .nav { display: flex; flex-wrap: wrap; gap: 2px; }
  .nav a { padding: 6px 10px; }
  .side .bottom { margin: 0; }
  main { padding: 16px; }
  .row2 { grid-template-columns: 1fr; }
}

/* utilities (no inline styles: the CSP forbids them) */
.mb6 { margin-bottom: 6px; } .mb12 { margin-bottom: 12px; } .mt0 { margin-top: 0; } .mt6 { margin-top: 6px; } .mt12 { margin-top: 12px; }
.pre { white-space: pre-wrap; } .w480 { max-width: 480px; } .w640 { max-width: 640px; } .full { width: 100%; justify-content: center; }
.wauto { width: auto; } .breakall { word-break: break-all; } .center { text-align: center; }
