:root {
  --bg: #10140f;
  --bg-elev: #171c16;
  --bg-row: #1b221a;
  --line: #2c3629;
  --text: #e7eee3;
  --muted: #8b9786;
  --accent: #c6f355;
  --accent-ink: #15200a;
  --warn: #ffb454;
  --danger: #ff6b5a;
  --ok: #6ddea8;
  --radius: 10px;
  --font: "IBM Plex Sans Arabic", "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100%;
  background:
    radial-gradient(1200px 500px at 100% -10%, #24301f 0%, transparent 55%),
    var(--bg);
  color: var(--text);
  font-family: var(--font);
}

body {
  padding: 24px;
}

.app {
  max-width: 1280px;
  margin: 0 auto;
}

.top {
  display: flex;
  align-items: center;
  gap: 20px;
  margin-bottom: 22px;
  flex-wrap: wrap;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  min-width: 200px;
}

.brand-mark {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 12px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-weight: 500;
  font-size: 14px;
}

.brand h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.02em;
}

.sub {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.tabs {
  display: flex;
  gap: 6px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  padding: 4px;
  border-radius: 999px;
}

.tab {
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  text-decoration: none;
}

a.tab {
  display: inline-flex;
  align-items: center;
}

.tab.active {
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.filter-tabs {
  border-radius: 10px;
}

.filter-tabs .tab {
  padding: 7px 12px;
  font-size: 0.85rem;
}

.stat.ok span {
  color: var(--ok);
}

.docs {
  margin-inline-start: auto;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.9rem;
  border: 1px solid var(--line);
  padding: 8px 12px;
  border-radius: 8px;
}

.docs:hover {
  color: var(--text);
  border-color: var(--muted);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.toolbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.stats {
  display: flex;
  gap: 10px;
}

.stat {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 10px 14px;
  min-width: 88px;
}

.stat span {
  display: block;
  font-family: var(--mono);
  font-size: 1.2rem;
  font-weight: 500;
}

.stat label {
  color: var(--muted);
  font-size: 0.75rem;
}

.stat.warn span {
  color: var(--warn);
}

.actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

input,
select,
textarea {
  font: inherit;
  color: var(--text);
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}

input[type="search"] {
  min-width: 220px;
}

.btn {
  font: inherit;
  border-radius: 8px;
  border: 1px solid var(--line);
  padding: 9px 14px;
  cursor: pointer;
}

.btn:disabled {
  opacity: 0.55;
  cursor: wait;
}

.btn.ghost {
  background: transparent;
  color: var(--text);
}

.btn.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

.btn.small {
  padding: 6px 10px;
  font-size: 0.85rem;
}

.btn.tiny {
  padding: 0 6px;
  font-size: 0.85rem;
  line-height: 1.2;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
}

.pub-ip {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
  padding: 0;
  width: min(420px, 92vw);
}

dialog::backdrop {
  background: rgba(8, 10, 8, 0.72);
}

#ip-form,
#assign-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

#ip-form h2,
#assign-form h2 {
  margin: 0;
  font-size: 1.1rem;
}

#ip-form label,
#assign-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow: auto;
  background: var(--bg-elev);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
}

th,
td {
  text-align: start;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  background: #141914;
  position: sticky;
  top: 0;
}

tbody tr:hover td {
  background: var(--bg-row);
}

.muted {
  color: var(--muted);
}

.mono {
  font-family: var(--mono);
  font-size: 0.9rem;
}

.name-cell strong {
  display: block;
  font-weight: 600;
}

.name-cell .ip {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 0.82rem;
  margin-top: 2px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
  border: 1px solid var(--line);
}

.badge.ok {
  color: var(--ok);
  border-color: #2f5a45;
}

.badge.warn {
  color: var(--warn);
  border-color: #5a4a2f;
}

.badge.err {
  color: var(--danger);
  border-color: #5a2f2f;
}

.cpu-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 90px;
}

.cpu-bar .track {
  flex: 1;
  height: 6px;
  background: #2a3328;
  border-radius: 99px;
  overflow: hidden;
}

.cpu-bar .fill {
  height: 100%;
  background: var(--accent);
}

.error-tip {
  color: var(--danger);
  font-size: 0.75rem;
  max-width: 180px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

dialog {
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--bg-elev);
  color: var(--text);
  padding: 0;
  width: min(480px, 92vw);
}

dialog::backdrop {
  background: rgba(8, 10, 8, 0.72);
}

#ticket-form {
  display: grid;
  gap: 12px;
  padding: 20px;
}

#ticket-form h2 {
  margin: 0 0 4px;
  font-size: 1.1rem;
}

#ticket-form label {
  display: grid;
  gap: 6px;
  font-size: 0.9rem;
  color: var(--muted);
}

.dialog-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 6px;
}

#toast {
  position: fixed;
  inset-inline-start: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  background: #24301f;
  border: 1px solid var(--accent);
  color: var(--text);
  padding: 10px 16px;
  border-radius: 999px;
  font-size: 0.9rem;
  z-index: 20;
}

@media (max-width: 720px) {
  body {
    padding: 14px;
  }

  .docs {
    margin-inline-start: 0;
  }

  input[type="search"] {
    min-width: 0;
    width: 100%;
  }
}
