:root {
  --bg: #0b1220;
  --panel: #111a2e;
  --border: #223052;
  --text: #e6edf7;
  --muted: #8ea1c0;
  --primary: #6366f1;
  --green: #22c55e;
  --red: #dc2626;
  --amber: #d97706;
  --radius: 14px;
  --input-bg: var(--bg);
  --row-hover: #141f38;
  --th-bg: #16223d;
  --glow: #1e2a4a;
  --card-grad-1: #151f38;
  --card-grad-2: #111a2e;
  --input-border: #2a3a5e;
}

:root[data-theme="light"] {
  --bg: #f3f5fa;
  --panel: #ffffff;
  --border: #e2e6f0;
  --text: #131b2e;
  --muted: #667089;
  --input-bg: #f7f8fc;
  --row-hover: #f2f4fa;
  --th-bg: #eef1f8;
  --glow: #dbe3f7;
  --card-grad-1: #f7f9fd;
  --card-grad-2: #ffffff;
  --input-border: #d7dceb;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: "Vazirmatn", Tahoma, system-ui, sans-serif;
  background: radial-gradient(1200px 600px at 50% -10%, var(--glow), var(--bg));
  color: var(--text);
  min-height: 100vh;
}

.wrap { max-width: 1180px; margin: 0 auto; padding: 24px; }

.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}
.top-actions { display: flex; gap: 10px; }

.brand { font-size: 22px; font-weight: 800; display: flex; align-items: center; gap: 10px; }
.brand span { color: var(--primary); }
.mark {
  width: 34px; height: 34px; border-radius: 10px;
  background: linear-gradient(135deg, var(--primary), var(--green));
  display: flex; align-items: center; justify-content: center; font-weight: 800;
}

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  margin-bottom: 20px;
}
.panel h3 { margin: 0 0 14px; font-size: 15px; color: var(--text); opacity: .85; }

.cards { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card {
  flex: 1; min-width: 150px;
  background: linear-gradient(135deg, var(--card-grad-1), var(--card-grad-2));
  border: 1px solid var(--border); border-radius: 12px; padding: 14px 16px;
}
.card .k { color: var(--muted); font-size: 12px; }
.card .v { font-size: 20px; font-weight: 700; margin-top: 4px; }

.svc-row { display: flex; gap: 10px; flex-wrap: wrap; }
.svc { font-size: 12px; padding: 5px 10px; border-radius: 20px; border: 1px solid var(--border); }
.svc.on { color: var(--green); border-color: rgba(34,197,94,.4); }
.svc.off { color: var(--red); border-color: rgba(220,38,38,.4); }

form.add { display: flex; gap: 12px; flex-wrap: wrap; align-items: end; }
form.add > div { flex: 1; min-width: 140px; }
label { display: block; font-size: 12px; color: var(--muted); margin-bottom: 5px; }
input, select {
  width: 100%; padding: 10px 12px; border-radius: 9px;
  border: 1px solid var(--input-border); background: var(--input-bg); color: var(--text);
  font-family: inherit;
}
.field { margin-bottom: 16px; }

.btn {
  border: 0; border-radius: 9px; padding: 10px 18px; cursor: pointer;
  font-family: inherit; font-weight: 700; color: #fff;
}
.btn.g { background: var(--green); }
.btn.r { background: var(--red); }
.btn.b { background: var(--primary); }
.btn.y { background: var(--amber); }
.btn.s { padding: 6px 10px; font-size: 12px; font-weight: 600; }
.btn.ghost { background: transparent; border: 1px solid var(--border); color: var(--text); }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--panel); }
th, td { padding: 10px 12px; text-align: right; border-bottom: 1px solid var(--border); font-size: 13px; white-space: nowrap; }
th { background: var(--th-bg); color: var(--muted); font-weight: 700; }
tr:hover td { background: var(--row-hover); }

.on { color: var(--green); font-weight: 700; }
.off { color: #64748b; }
.over { color: var(--red); font-weight: 700; }

.bar { height: 7px; background: var(--border); border-radius: 6px; overflow: hidden; margin-top: 5px; min-width: 100px; }
.bar > i { display: block; height: 100%; background: linear-gradient(90deg, #22c55e, #eab308, #ef4444); }

.mono { font-family: ui-monospace, Menlo, monospace; direction: ltr; display: inline-block; }
.acts { display: flex; gap: 6px; }
.hint { color: var(--muted); font-size: 13px; margin: 0; }

.backup-row { display: flex; align-items: center; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.backup-row h3 { margin-bottom: 4px; }
.backup-row .btn { flex-shrink: 0; }

.svc-card { text-align: center; }

.menu { position: relative; display: inline-block; }
.menu summary {
  list-style: none; cursor: pointer; width: 30px; height: 30px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  border: 1px solid var(--border); color: var(--text); user-select: none;
}
.menu summary::-webkit-details-marker { display: none; }
.menu[open] summary { background: var(--row-hover); }
.menu-list {
  position: fixed; z-index: 200;
  background: var(--panel); border: 1px solid var(--border); border-radius: 10px;
  min-width: 150px; padding: 6px; box-shadow: 0 12px 30px rgba(0,0,0,.35);
  display: flex; flex-direction: column; gap: 2px;
}
.menu-item {
  background: none; border: 0; color: var(--text); text-align: right; padding: 8px 10px;
  border-radius: 7px; cursor: pointer; font-family: inherit; font-size: 13px; width: 100%;
}
.menu-item:hover { background: var(--row-hover); }
.menu-item.danger { color: var(--red); }

.edit-row { display: none; }
.edit-row.open { display: table-row; }
.edit-row td { background: var(--row-hover); padding: 14px; }
.edit-row .add > div { min-width: 130px; }

/* login */
.lg { min-height: 100vh; display: flex; align-items: center; justify-content: center; }
.box {
  width: 340px; background: var(--panel); border: 1px solid var(--border);
  border-radius: 18px; padding: 28px; box-shadow: 0 20px 60px rgba(0,0,0,.45);
}
.box h1 { font-size: 20px; margin: 0 0 4px; text-align: center; }
.box h1 span { color: var(--primary); }
.box p { color: var(--muted); font-size: 13px; text-align: center; margin: 0 0 20px; }
.box input { margin-bottom: 14px; }
.box .btn { width: 100%; }
.logo {
  width: 54px; height: 54px; margin: 0 auto 12px; border-radius: 14px;
  background: linear-gradient(135deg, var(--primary), var(--green));
  display: flex; align-items: center; justify-content: center; font-size: 26px; font-weight: 800;
}
.mono-input { font-family: ui-monospace, Menlo, monospace; direction: ltr; text-align: left; }

.ok-msg {
  background: rgba(34,197,94,.12); border: 1px solid rgba(34,197,94,.4); color: var(--green);
  padding: 10px 14px; border-radius: 9px; font-size: 13px; margin-bottom: 16px;
}

.err {
  background: #3b1220; border: 1px solid #7f1d1d; color: #fca5a5;
  padding: 8px; border-radius: 9px; font-size: 13px; text-align: center; margin-bottom: 14px;
}
