/* پنل سرور — تم تیره فارسی */
:root {
  --bg: #0d1117;
  --bg2: #10161f;
  --panel: #161b22;
  --panel2: #1c2230;
  --border: #2a3245;
  --text: #e6edf3;
  --muted: #8b949e;
  --accent: #58a6ff;
  --green: #3fb950;
  --red: #f85149;
  --yellow: #d29922;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: Vazirmatn, "Segoe UI", Tahoma, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.7;
}
.muted { color: var(--muted); font-size: 12.5px; font-weight: 400; }
.hidden { display: none !important; }

/* ---------- هدر ---------- */
.top {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 18px;
  background: var(--panel);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
}
.brand { display: flex; align-items: center; gap: 8px; font-weight: 700; font-size: 15px; color: var(--accent); }
.srv-chip {
  background: var(--panel2); border: 1px solid var(--border);
  border-radius: 999px; padding: 3px 12px; font-size: 12.5px; color: var(--muted);
}
.spacer { flex: 1; }
.user { color: var(--muted); font-size: 12.5px; }

/* ---------- هشدارها ---------- */
#alerts { padding: 0 18px; }
.alert {
  display: flex; align-items: center; gap: 8px;
  margin-top: 10px; padding: 8px 14px; border-radius: 10px;
  font-size: 13px; border: 1px solid;
}
.alert.warn { background: rgba(210, 153, 34, .12); border-color: rgba(210, 153, 34, .5); color: #e3b341; }
.alert.crit { background: rgba(248, 81, 73, .12); border-color: rgba(248, 81, 73, .5); color: #ff7b72; }

/* ---------- تب‌ها ---------- */
.tabs { display: flex; gap: 6px; padding: 14px 18px 0; }
.tab {
  background: none; border: 1px solid transparent; color: var(--muted);
  padding: 8px 18px; border-radius: 10px 10px 0 0; cursor: pointer;
  font-family: inherit; font-size: 14px;
}
.tab:hover { color: var(--text); }
.tab.active {
  color: var(--text); background: var(--panel);
  border-color: var(--border); border-bottom-color: var(--panel);
  font-weight: 700;
}
main { padding: 0 18px 40px; }
main > section { border-top: 1px solid var(--border); padding-top: 16px; }

/* ---------- کارت‌ها ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; margin-bottom: 16px; }
.row3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 14px; margin-bottom: 16px; }
.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: 12px; padding: 14px 16px; margin-bottom: 0;
}
#tab-stats .card { margin-bottom: 16px; }
.card h3 { margin: 0 0 10px; font-size: 14px; font-weight: 700; }
.card-body { font-size: 13px; }

/* نوارهای دیسک */
.disk-card .bar { height: 10px; border-radius: 6px; background: var(--panel2); overflow: hidden; margin: 8px 0 6px; }
.disk-card .bar i { display: block; height: 100%; border-radius: 6px; background: var(--green); }
.disk-card .bar i.mid { background: var(--yellow); }
.disk-card .bar i.high { background: var(--red); }
.disk-title { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.disk-title b { font-size: 13px; }
.disk-title .pct { font-weight: 700; }
.disk-sub { color: var(--muted); font-size: 12px; font-family: var(--mono); direction: ltr; text-align: right; }

/* مترها */
.meter { margin-bottom: 10px; }
.meter .m-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 4px; }
.meter .bar { height: 8px; border-radius: 5px; background: var(--panel2); overflow: hidden; }
.meter .bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.kv { display: flex; justify-content: space-between; padding: 3px 0; font-size: 12.5px; }
.kv span:first-child { color: var(--muted); }
.kv .mono { font-family: var(--mono); direction: ltr; }

/* ---------- جدول‌ها ---------- */
.table-wrap { overflow-x: auto; }
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th {
  text-align: right; color: var(--muted); font-weight: 600; font-size: 12px;
  padding: 8px 10px; border-bottom: 1px solid var(--border); white-space: nowrap;
}
.tbl td { padding: 7px 10px; border-bottom: 1px solid rgba(42, 50, 69, .5); vertical-align: middle; }
.tbl tr:last-child td { border-bottom: none; }
.tbl tbody tr:hover { background: rgba(88, 166, 255, .05); }
.tbl .mono { font-family: var(--mono); font-size: 12px; direction: ltr; }

/* وضعیت‌ها */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  border-radius: 999px; padding: 2px 12px; font-size: 12px; border: 1px solid;
  white-space: nowrap;
}
.chip .dot { width: 7px; height: 7px; border-radius: 50%; }
.chip.ok { color: var(--green); border-color: rgba(63, 185, 80, .5); background: rgba(63, 185, 80, .1); }
.chip.ok .dot { background: var(--green); }
.chip.bad { color: var(--red); border-color: rgba(248, 81, 73, .5); background: rgba(248, 81, 73, .1); }
.chip.bad .dot { background: var(--red); }
.chip.mid { color: var(--yellow); border-color: rgba(210, 153, 34, .5); background: rgba(210, 153, 34, .1); }
.chip.mid .dot { background: var(--yellow); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* بزرگ‌ترین پوشه‌ها */
.dirbars { display: flex; flex-direction: column; gap: 8px; }
.dirbar { display: grid; grid-template-columns: minmax(160px, 1fr) 220px 80px; align-items: center; gap: 10px; font-size: 12.5px; }
.dirbar .p { font-family: var(--mono); direction: ltr; text-align: left; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dirbar .bar { height: 8px; background: var(--panel2); border-radius: 5px; overflow: hidden; }
.dirbar .bar i { display: block; height: 100%; background: var(--accent); border-radius: 5px; }
.dirbar .s { font-family: var(--mono); direction: ltr; text-align: left; color: var(--muted); }

/* ---------- نقشهٔ فایل‌ها ---------- */
.map-note p { margin: 4px 0 0; }
.map-card { display: flex; flex-direction: column; gap: 6px; }
.map-card .path { font-family: var(--mono); direction: ltr; text-align: left; color: var(--accent); font-size: 12.5px; word-break: break-all; }
.map-card .desc { color: var(--muted); font-size: 12.5px; min-height: 20px; }
.map-card .map-foot { display: flex; align-items: center; gap: 8px; margin-top: 6px; }
.map-card .size { font-family: var(--mono); font-size: 12px; color: var(--muted); direction: ltr; }
.map-card .grow { flex: 1; }

/* ---------- دکمه‌ها ---------- */
.btn {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 14px; cursor: pointer; font-family: inherit; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
}
.btn:hover { border-color: var(--accent); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: rgba(88, 166, 255, .15); border-color: rgba(88, 166, 255, .5); color: var(--accent); }
.btn-danger { background: rgba(248, 81, 73, .12); border-color: rgba(248, 81, 73, .5); color: var(--red); }
.btn-ghost { background: none; }
.btn-sm { padding: 3px 9px; font-size: 12px; border-radius: 7px; }

/* ---------- فایل‌منیجر ---------- */
.fm-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 10px; }
.fm-toolbar select {
  background: var(--panel2); color: var(--text); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 10px; font-family: inherit; font-size: 12.5px; max-width: 220px;
}
.crumbs {
  flex: 1; min-width: 220px; background: var(--panel2); border: 1px solid var(--border);
  border-radius: 8px; padding: 6px 12px; font-family: var(--mono); font-size: 12.5px;
  overflow-x: auto; white-space: nowrap; direction: ltr; text-align: left;
}
.crumbs a { color: var(--accent); text-decoration: none; cursor: pointer; }
.crumbs a:hover { text-decoration: underline; }
.crumbs .sep { color: var(--muted); margin: 0 3px; }
.crumbs .cur { color: var(--text); }
.fm-actions { display: flex; gap: 6px; }
.fm-readonly {
  background: rgba(210, 153, 34, .1); border: 1px solid rgba(210, 153, 34, .4);
  color: #e3b341; border-radius: 10px; padding: 7px 14px; font-size: 12.5px; margin-bottom: 10px;
}
.fm td.act { text-align: left; white-space: nowrap; }
.fm .name-cell { display: flex; align-items: center; gap: 8px; cursor: default; }
.fm .name-cell .nm { word-break: break-all; }
.fm .name-cell.linked { cursor: pointer; color: var(--accent); }
.fm .icon { flex: none; display: inline-flex; }
.fm .icon svg { display: block; }
.fm .linkto { color: var(--muted); font-size: 11px; font-family: var(--mono); direction: ltr; }
.fm-hint { margin-top: 10px; }
#fmTableWrap.dragover { outline: 2px dashed var(--accent); outline-offset: -4px; }

/* ---------- مودال ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(0, 0, 0, .6);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 20px;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: 14px;
  width: 100%; max-width: 560px; padding: 18px 20px; max-height: 90vh; display: flex; flex-direction: column;
}
.modal.wide { max-width: 900px; height: 80vh; }
.modal h3 { margin: 0 0 12px; font-size: 15px; }
.modal .m-body { flex: 1; overflow: auto; }
.modal label { display: block; font-size: 12.5px; color: var(--muted); margin: 10px 0 4px; }
.modal input[type="text"], .modal textarea {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 8px 12px;
  font-family: inherit; font-size: 13px;
}
.modal textarea { font-family: var(--mono); direction: ltr; min-height: 45vh; resize: vertical; font-size: 12.5px; white-space: pre; }
.modal .m-foot { display: flex; justify-content: flex-start; gap: 8px; margin-top: 14px; }
.modal .m-msg { color: var(--red); font-size: 12.5px; margin-top: 8px; min-height: 16px; }

/* ---------- توست ---------- */
#toasts { position: fixed; bottom: 16px; left: 16px; z-index: 200; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast {
  background: var(--panel2); border: 1px solid var(--border); border-radius: 10px;
  padding: 10px 14px; font-size: 13px; box-shadow: 0 4px 16px rgba(0, 0, 0, .4);
}
.toast.ok { border-color: rgba(63, 185, 80, .6); }
.toast.err { border-color: rgba(248, 81, 73, .6); }
.toast .prog { height: 6px; background: var(--bg); border-radius: 4px; margin-top: 8px; overflow: hidden; }
.toast .prog i { display: block; height: 100%; background: var(--accent); width: 0; }

/* ---------- لاگین ---------- */
.login-body {
  min-height: 100vh; display: flex; align-items: center; justify-content: center;
  background: radial-gradient(1200px 500px at 70% -10%, rgba(88, 166, 255, .08), transparent), var(--bg);
}
.login-card {
  background: var(--panel); border: 1px solid var(--border); border-radius: 16px;
  padding: 34px 34px 28px; width: 100%; max-width: 380px;
}
.login-card h1 { margin: 8px 0 2px; font-size: 20px; text-align: center; }
.login-sub { text-align: center; color: var(--muted); font-size: 12.5px; margin: 0 0 18px; }
.login-logo { display: flex; justify-content: center; color: var(--accent); }
.login-card label { display: block; font-size: 12.5px; color: var(--muted); margin: 12px 0 4px; }
.login-card input {
  width: 100%; background: var(--bg2); color: var(--text);
  border: 1px solid var(--border); border-radius: 8px; padding: 9px 12px; font-size: 14px; font-family: inherit;
}
.login-card button {
  width: 100%; margin-top: 18px; background: rgba(88, 166, 255, .18);
  border: 1px solid rgba(88, 166, 255, .55); color: var(--accent);
  border-radius: 8px; padding: 10px; font-size: 14px; font-family: inherit; cursor: pointer; font-weight: 700;
}
.login-card button:disabled { opacity: .6; }
.login-error {
  margin-top: 12px; background: rgba(248, 81, 73, .12); border: 1px solid rgba(248, 81, 73, .5);
  color: #ff7b72; border-radius: 8px; padding: 8px 12px; font-size: 12.5px;
}

@media (max-width: 720px) {
  .dirbar { grid-template-columns: 1fr 90px; }
  .dirbar .bar { display: none; }
  .top { padding: 10px 12px; }
  main { padding: 0 10px 30px; }
  .tabs { padding: 12px 12px 0; }
  #alerts { padding: 0 12px; }
}
