:root {
  --bg: #f5f6fa;
  --card: #fff;
  --text: #1f2430;
  --muted: #8a90a3;
  --border: #e4e7f0;
  --accent: #2563eb;
  --danger: #dc2626;
  --ok: #16a34a;
  --warn: #d97706;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
}

.wrap {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 16px 60px;
}

h1 {
  font-size: 20px;
  margin: 0 0 4px;
}

.sub {
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 20px;
}

.toolbar {
  display: flex;
  gap: 8px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.toolbar input {
  flex: 1;
  min-width: 260px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
}

button {
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
}

button:disabled {
  opacity: .5;
  cursor: not-allowed;
}

button.secondary {
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
}

button.small {
  padding: 4px 10px;
  font-size: 12px;
}

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--border);
}

.msg {
  margin-bottom: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 13px;
  display: none;
}

.msg.error {
  display: block;
  background: #fee2e2;
  color: #991b1b;
}

.msg.info {
  display: block;
  background: #dbeafe;
  color: #1e40af;
}

table {
  width: 100%;
  border-collapse: collapse;
  background: var(--card);
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, .06);
}

th, td {
  padding: 10px 12px;
  text-align: left;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

th {
  background: #fafbfe;
  color: var(--muted);
  font-weight: 600;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .03em;
}

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

td.name a {
  color: var(--text);
  text-decoration: none;
  font-weight: 500;
}

td.name a:hover {
  color: var(--accent);
}

td.price {
  font-weight: 600;
  white-space: nowrap;
}

td.actions {
  white-space: nowrap;
  text-align: right;
}

td.actions button {
  margin-left: 4px;
}

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 600;
}

.badge.active {
  background: #dcfce7;
  color: var(--ok);
}

.badge.paused {
  background: #f1f5f9;
  color: var(--muted);
}

.badge.flagged {
  background: #fef3c7;
  color: var(--warn);
}

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

.err-text {
  color: var(--danger);
  font-size: 11px;
  max-width: 240px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  display: block;
}

tr.history-row td {
  background: #fafbfe;
  padding: 8px 24px;
}

.history-list {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
}

.history-list b {
  color: var(--text);
}

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

.spin {
  display: inline-block;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}