:root {
  --bg: #12161c;
  --surface: #1a2029;
  --surface-alt: #1f2734;
  --border: #2b323f;
  --text: #e7e9ec;
  --text-muted: #8791a1;
  --accent: #e2a33b;
  --accent-soft: rgba(226, 163, 59, 0.14);
  --online: #4fae7c;
  --online-soft: rgba(79, 174, 124, 0.14);
  --waiting: #e2a33b;
  --disabled: #545d6c;
  --danger: #d9634b;
  --radius: 8px;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: 'Manrope', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

.mono {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Consolas, monospace;
}

/* -------------------- Top bar -------------------- */

.topbar {
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}

.topbar__inner {
  max-width: 1100px;
  margin: 0 auto;
  padding: 22px 32px;
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.brand {
  font-size: 20px;
  font-weight: 800;
  margin: 0;
  letter-spacing: -0.01em;
}

.brand__sub {
  margin: 0;
  color: var(--text-muted);
  font-size: 14px;
  flex: 1;
}

.topbar__count {
  color: var(--text-muted);
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

/* -------------------- Layout -------------------- */

.layout {
  max-width: 1100px;
  margin: 0 auto;
  padding: 32px;
}

.grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 24px;
  align-items: start;
}

@media (max-width: 780px) {
  .grid { grid-template-columns: 1fr; }
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
}

.panel--table { padding: 0; overflow: hidden; }

.panel__title {
  margin: 0 0 6px;
  font-size: 16px;
  font-weight: 700;
}

.panel__hint {
  margin: 0 0 20px;
  color: var(--text-muted);
  font-size: 13px;
  line-height: 1.5;
}

/* -------------------- Flash messages -------------------- */

.flash-stack {
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.flash {
  padding: 10px 14px;
  border-radius: var(--radius);
  font-size: 14px;
  border: 1px solid transparent;
}

.flash--success {
  background: var(--online-soft);
  border-color: rgba(79, 174, 124, 0.35);
  color: #b7e6cb;
}

.flash--error {
  background: rgba(217, 99, 75, 0.14);
  border-color: rgba(217, 99, 75, 0.35);
  color: #f2b7a9;
}

/* -------------------- Form -------------------- */

.form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.field__label {
  font-size: 13px;
  color: var(--text-muted);
}

.field__optional {
  font-size: 12px;
  color: var(--text-muted);
  opacity: 0.7;
}

.field input {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

.field input:focus {
  outline: none;
  border-color: var(--accent);
}

.field input.mono {
  font-size: 13px;
}

.button {
  margin-top: 4px;
  background: var(--accent);
  color: #1a1206;
  border: none;
  border-radius: 6px;
  padding: 11px 16px;
  font-size: 14px;
  font-weight: 700;
  font-family: inherit;
  cursor: pointer;
}

.button:hover { filter: brightness(1.08); }
.button:focus-visible { outline: 2px solid var(--text); outline-offset: 2px; }

/* -------------------- Table -------------------- */

.tracker-table {
  width: 100%;
  border-collapse: collapse;
}

.tracker-table th {
  text-align: left;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}

.tracker-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  vertical-align: middle;
}

.tracker-table tr:last-child td { border-bottom: none; }

.tracker-table tr.is-disabled { opacity: 0.55; }

.cell-name { font-weight: 600; }
.cell-imei { font-size: 13px; color: var(--text-muted); }
.cell-muted { color: var(--text-muted); font-size: 13px; }

.cell-actions {
  display: flex;
  gap: 14px;
  justify-content: flex-end;
}

.cell-actions form { margin: 0; }

.link-button {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
  text-decoration-color: transparent;
  transition: text-decoration-color 0.15s;
}

.link-button:hover { text-decoration-color: currentColor; color: var(--text); }
.link-button--danger:hover { color: var(--danger); }

/* -------------------- Status -------------------- */

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13px;
  color: var(--text-muted);
  white-space: nowrap;
}

.status__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--disabled);
  flex-shrink: 0;
}

.status--online .status__dot {
  background: var(--online);
  box-shadow: 0 0 0 0 var(--online-soft);
  animation: pulse 2s ease-in-out infinite;
}

.status--online { color: var(--online); }
.status--waiting .status__dot { background: var(--waiting); }
.status--waiting { color: var(--waiting); }
.status--disabled .status__dot { background: var(--disabled); }

@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(79, 174, 124, 0.45); }
  70%  { box-shadow: 0 0 0 6px rgba(79, 174, 124, 0); }
  100% { box-shadow: 0 0 0 0 rgba(79, 174, 124, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .status--online .status__dot { animation: none; }
}

/* -------------------- Empty state -------------------- */

.empty-state {
  padding: 60px 32px;
  text-align: center;
  color: var(--text-muted);
}

.empty-state p { margin: 0 0 6px; }
.empty-state__hint { font-size: 13px; }
