:root {
  color-scheme: light;
  --bg: #f0f3f8;
  --bg2: #e6ecf4;
  --surface: #ffffff;
  --surface2: #f6f8fb;
  --text: #152033;
  --muted: #5d6b80;
  --faint: #8b97a8;
  --line: #d5dee8;
  --brand: #1367e8;
  --brand2: #0b57c7;
  --brand-soft: color-mix(in srgb, var(--brand) 12%, #fff);
  --danger: #c42b3a;
  --success: #0f7a56;
  --warn: #b86a12;
  --shadow: 0 1px 0 #1b35500a, 0 10px 28px #1b35500d;
  --radius: 12px;
  --header: 56px;
  --nav: 232px;
  --rail: 250px;
}
html[data-theme="dark"] {
  color-scheme: dark;
  --bg: #071018;
  --bg2: #0c1724;
  --surface: #101c2b;
  --surface2: #162233;
  --text: #edf4ff;
  --muted: #9aabc0;
  --faint: #6e7f94;
  --line: #27384c;
  --brand: #4d9aff;
  --brand2: #78b4ff;
  --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
  --danger: #ff6676;
  --success: #49d6a1;
  --warn: #f0b04a;
  --shadow: 0 12px 32px #0006;
}
@media (prefers-color-scheme: dark) {
  html[data-theme="auto"] {
    color-scheme: dark;
    --bg: #071018; --bg2: #0c1724; --surface: #101c2b; --surface2: #162233;
    --text: #edf4ff; --muted: #9aabc0; --faint: #6e7f94; --line: #27384c;
    --brand: #4d9aff; --brand2: #78b4ff;
    --brand-soft: color-mix(in srgb, var(--brand) 16%, transparent);
    --danger: #ff6676; --success: #49d6a1; --warn: #f0b04a; --shadow: 0 12px 32px #0006;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font: 14px/1.55 Vazirmatn, Tahoma, sans-serif;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
a { color: var(--brand); text-decoration: none; }
code, .ltr { direction: ltr; unicode-bidi: isolate; text-align: left; font-family: ui-monospace, Consolas, monospace; }

.logo {
  width: 36px; height: 36px; border-radius: 10px;
  background: linear-gradient(145deg, #1773ee, #53c4ff);
  color: #fff; display: grid; place-items: center;
  font: 700 18px Arial, sans-serif; flex: 0 0 auto;
}
.logo.lg { width: 56px; height: 56px; border-radius: 16px; font-size: 28px; margin: 0 auto; }

.btn {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 7px 12px; display: inline-flex; align-items: center; gap: 6px;
}
.btn:hover { background: var(--surface2); }
.btn.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn.primary:hover { filter: brightness(1.05); }
.btn.danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 40%, var(--line)); }
.btn.ghost { background: transparent; border-color: transparent; }
.btn.small { padding: 4px 8px; font-size: 12px; }
.btn:disabled { opacity: .45; cursor: not-allowed; }

.topbar {
  height: var(--header);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  display: flex; align-items: center; gap: 12px;
  padding: 0 14px; position: sticky; top: 0; z-index: 40;
}
.brand-lock { display: flex; align-items: center; gap: 10px; min-width: 168px; border: 0; background: transparent; color: inherit; text-align: start; }
.brand-lock strong { display: block; font-size: 14px; line-height: 1.15; }
.brand-lock small { color: var(--faint); font-size: 10px; letter-spacing: .08em; text-transform: uppercase; }
.search { flex: 1; max-width: 520px; margin: 0 auto; position: relative; }
.search input {
  width: 100%; border: 1px solid var(--line); background: var(--bg);
  border-radius: 999px; padding: 8px 16px 8px 40px; outline: none;
}
[dir="rtl"] .search input { padding: 8px 40px 8px 16px; }
.search input:focus { border-color: var(--brand); background: var(--surface); box-shadow: 0 0 0 3px var(--brand-soft); }
.search .mag { position: absolute; top: 50%; transform: translateY(-50%); inset-inline-start: 14px; width: 16px; height: 16px; opacity: .45; }
.search-pop {
  position: absolute; top: calc(100% + 8px); inset-inline: 0;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); max-height: 360px; overflow: auto; z-index: 50;
}
.search-pop button {
  width: 100%; display: flex; gap: 10px; align-items: center; border: 0; background: transparent;
  padding: 9px 12px; text-align: start;
}
.search-pop button:hover { background: var(--brand-soft); }
.search-pop b { font-size: 13px; }
.search-pop span { color: var(--muted); font-size: 12px; }
.top-actions { display: flex; align-items: center; gap: 8px; margin-inline-start: auto; }
.chip {
  border: 1px solid var(--line); background: var(--bg); color: var(--muted);
  border-radius: 999px; padding: 5px 10px; font-size: 12px;
}
.avatar {
  width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--brand-soft); color: var(--brand); font-weight: 700; display: grid; place-items: center;
}
.menu {
  position: absolute; top: calc(var(--header) - 6px); inset-inline-end: 12px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  min-width: 220px; box-shadow: var(--shadow); padding: 6px; z-index: 60;
}
.menu button, .menu a {
  display: block; width: 100%; border: 0; background: transparent; color: inherit;
  padding: 8px 10px; border-radius: 8px; text-align: start;
}
.menu button:hover, .menu a:hover { background: var(--surface2); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 6px 0; }

.shell {
  display: grid;
  grid-template-columns: var(--nav) minmax(0, 1fr) var(--rail);
  min-height: calc(100vh - var(--header));
}
.side, .rail {
  background: var(--surface);
  padding: 12px 10px 24px;
  position: sticky; top: var(--header);
  height: calc(100vh - var(--header));
  overflow: auto;
}
.side { border-inline-end: 1px solid var(--line); }
.rail { border-inline-start: 1px solid var(--line); }
.side h4, .rail h4 { margin: 14px 8px 6px; font-size: 11px; color: var(--faint); font-weight: 700; letter-spacing: .04em; }
.side h4:first-child, .rail h4:first-child { margin-top: 4px; }
.side { display: flex; flex-direction: column; }
.side-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; margin-bottom: 6px; border-bottom: 1px solid var(--line); }
.side-brand strong { display: block; font-size: 14px; }
.side-brand small { display: block; color: var(--faint); font-size: 10px; letter-spacing: .04em; }
.side-card { margin-top: auto; padding: 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--brand-soft); }
.side-card strong { display: block; margin-bottom: 6px; font-size: 13px; }
.side-card p { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.nav {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px;
  border: 0; background: transparent; color: var(--muted);
  padding: 8px 10px; border-radius: 10px; text-align: start;
}
.nav span:first-child { flex: 1; }
.nav-ico { width: 16px; height: 16px; display: grid; place-items: center; opacity: .85; flex: 0 0 16px; }
.nav-ico svg { width: 16px; height: 16px; display: block; }
.nav:hover, .nav.active { background: var(--brand-soft); color: var(--brand); font-weight: 650; }
.main { padding: 20px 22px 72px; max-width: 1180px; width: 100%; }
.crumbs { color: var(--faint); font-size: 12px; margin-bottom: 6px; display: flex; gap: 6px; flex-wrap: wrap; }
.crumbs button { border: 0; background: none; color: var(--brand); padding: 0; }
.heading { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; margin-bottom: 16px; }
.heading h1 { margin: 0; font-size: 22px; font-weight: 750; letter-spacing: -.02em; }
.heading p { margin: 4px 0 0; color: var(--muted); max-width: 62ch; }
.toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }

.group { margin: 8px 0 22px; }
.group-h { display: flex; align-items: baseline; justify-content: space-between; margin: 0 2px 10px; }
.group-h h2 { margin: 0; font-size: 13px; color: var(--muted); font-weight: 700; }
.tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(148px, 1fr)); gap: 8px; }
.tile {
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
  padding: 12px 10px 11px; text-align: start; box-shadow: var(--shadow);
  cursor: pointer; position: relative; min-height: 118px;
  display: flex; flex-direction: column; gap: 6px;
}
.tile:hover { border-color: color-mix(in srgb, var(--brand) 45%, var(--line)); }
.tile .ico {
  width: 38px; height: 38px; border-radius: 11px;
  display: grid; place-items: center; color: #fff;
}
.tile .ico svg { width: 20px; height: 20px; }
.tile label { font-size: 13px; font-weight: 700; cursor: pointer; line-height: 1.3; }
.tile em { font-style: normal; color: var(--muted); font-size: 11.5px; line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.tile .star {
  position: absolute; top: 6px; inset-inline-end: 6px; border: 0; background: none;
  color: var(--faint); font-size: 14px; padding: 2px;
}
.tile .star.on { color: #e2a008; }

.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px 16px; box-shadow: var(--shadow); margin-bottom: 12px;
}
.card h2 { margin: 0 0 10px; font-size: 15px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; text-align: start; }
th { font-size: 11px; color: var(--faint); background: var(--surface2); font-weight: 700; letter-spacing: .02em; }
th, td { padding: 9px 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
tr:hover td { background: color-mix(in srgb, var(--brand) 4%, transparent); }
.badge {
  display: inline-block; padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 700;
}
.badge.ok { background: color-mix(in srgb, var(--success) 16%, transparent); color: var(--success); }
.badge.off { background: var(--surface2); color: var(--muted); }
.badge.warn { background: color-mix(in srgb, var(--warn) 18%, transparent); color: var(--warn); }

form.stack, .stack { display: grid; gap: 9px; }
label.field { display: grid; gap: 5px; font-size: 12.5px; color: var(--muted); }
input[type="text"], input[type="email"], input[type="password"], input[type="number"], input[type="search"], select, textarea {
  border: 1px solid var(--line); background: var(--surface); color: var(--text);
  border-radius: 8px; padding: 8px 10px; outline: none; width: 100%;
}
input:focus, select:focus, textarea:focus { border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-soft); }
textarea { min-height: 120px; }

.fm { display: grid; grid-template-columns: 200px minmax(0, 1fr); min-height: 440px; }
.fm-tree { border-inline-end: 1px solid var(--line); background: var(--surface2); padding: 8px; overflow: auto; }
.fm-list { padding: 4px 0; }
.fm-row {
  display: grid; grid-template-columns: 28px minmax(0, 1fr) 90px 90px;
  gap: 8px; align-items: center; padding: 7px 10px; border-radius: 8px; cursor: pointer;
}
.fm-row:hover { background: var(--brand-soft); }
.usage { margin: 8px 0 12px; }
.usage .row { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 4px; }
.meter { height: 7px; background: var(--bg2); border-radius: 99px; overflow: hidden; }
.meter i { display: block; height: 100%; background: var(--brand); border-radius: 99px; }
.meter.warn i { background: var(--warn); }
.meter.bad i { background: var(--danger); }
.rail .stat { padding: 8px 10px 10px; }
.toast {
  position: fixed; bottom: 18px; inset-inline-start: 18px; z-index: 80;
  background: var(--text); color: var(--surface); padding: 10px 14px; border-radius: 10px;
  box-shadow: var(--shadow); max-width: min(92vw, 420px);
}
.empty { text-align: center; color: var(--muted); padding: 28px 12px; }
.help { color: var(--muted); font-size: 12.5px; margin: 0 0 12px; }
.alert { padding: 10px 12px; border-radius: 10px; margin: 8px 0 12px; }
.alert.danger { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { border: 0; background: transparent; color: var(--muted); padding: 8px 12px; border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--brand); border-bottom-color: var(--brand); font-weight: 700; }
dialog {
  width: min(560px, calc(100% - 24px)); border: 1px solid var(--line); border-radius: 16px;
  background: var(--surface); color: var(--text); padding: 18px; box-shadow: var(--shadow);
}
dialog::backdrop { background: #07111f88; }
.login-body {
  min-height: 100vh; display: grid; place-items: center; padding: 24px;
  background: radial-gradient(circle at 80% 0, color-mix(in srgb, var(--brand) 18%, transparent), transparent 42%), var(--bg);
}
.login-card {
  width: min(420px, 100%); background: var(--surface); border: 1px solid var(--line);
  border-radius: 20px; padding: 32px; box-shadow: var(--shadow);
}
.login-card h1 { text-align: center; margin: 12px 0 4px; font-size: 22px; }
.login-card .muted { text-align: center; color: var(--muted); }
.langs, .language-bar { display: flex; justify-content: center; gap: 8px; }
.language-bar { position: absolute; top: 16px; inset-inline-end: 18px; font-size: 12px; }
.language-bar a { color: var(--muted); }
.language-bar a[aria-current="page"] { color: var(--brand); font-weight: 700; }
.identity-divider { text-align: center; color: var(--muted); font-size: 12px; margin: 8px 0; }
.foot { text-align: center; color: var(--faint); font-size: 11px; margin: 18px 0 0; }
.editor { min-height: 280px; font-family: ui-monospace, Consolas, monospace; direction: ltr; text-align: left; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--success); display: inline-block; }
.status-dot.down { background: var(--danger); }

@media (max-width: 1200px) { .shell { grid-template-columns: var(--nav) minmax(0,1fr); } .rail { display: none; } }
@media (max-width: 800px) {
  .shell { grid-template-columns: 1fr; }
  .side { display: none; }
  .grid-2, .fm { grid-template-columns: 1fr; }
  .search { max-width: none; }
  .brand-lock small, .brand-lock strong { display: none; }
  .tiles { grid-template-columns: repeat(2, 1fr); }
}
