:root {
  --bg: #0b1220;
  --card: #121a2c;
  --muted: #9aa4b2;
  --text: #e6edf6;
  --border: rgba(255, 255, 255, 0.08);
  --primary: #3b82f6;
  --danger: #ef4444;
  --success: #22c55e;
  --warning: #f59e0b;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, Arial, "Noto Sans", "Liberation Sans", sans-serif;
  background: radial-gradient(1200px 600px at 20% 0%, rgba(59,130,246,.15), transparent 60%),
              radial-gradient(900px 500px at 90% 10%, rgba(34,197,94,.12), transparent 65%),
              var(--bg);
  color: var(--text);
}

a { color: inherit; text-decoration: none; }

.container {
  max-width: 1240px;
  margin: 40px auto;
  padding: 0 16px;
}

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

.brand {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.brand-title { font-weight: 700; letter-spacing: .2px; }
.brand-subtitle { color: var(--muted); font-size: 12px; }

.card {
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.02));
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px;
}

.grid {
  display: grid;
  gap: 16px;
}

@media (min-width: 1100px) {
  .grid-2 { grid-template-columns: 1.1fr .9fr; }
}

.title { margin: 0 0 10px; font-size: 18px; }
.muted { color: var(--muted); }

.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.row-between { justify-content: space-between; }

.input, .textarea {
  width: 100%;
  background: rgba(0,0,0,.18);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 10px 12px;
  outline: none;
}
.textarea { min-height: 110px; resize: vertical; }

.label { font-size: 13px; color: var(--muted); margin-bottom: 6px; }
.field { display: grid; gap: 6px; margin-bottom: 12px; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: rgba(255,255,255,.06);
  color: var(--text);
  cursor: pointer;
  font-weight: 600;
}
.btn:hover { background: rgba(255,255,255,.08); }
.btn-primary { background: rgba(59,130,246,.18); border-color: rgba(59,130,246,.35); }
.btn-primary:hover { background: rgba(59,130,246,.24); }
.btn-danger { background: rgba(239,68,68,.15); border-color: rgba(239,68,68,.35); }
.btn-danger:hover { background: rgba(239,68,68,.22); }
.btn-ghost { background: transparent; }

.alert {
  border-radius: 12px;
  padding: 10px 12px;
  border: 1px solid var(--border);
  background: rgba(0,0,0,.20);
  margin-bottom: 12px;
}
.alert-success { border-color: rgba(34,197,94,.35); background: rgba(34,197,94,.08); }
.alert-error { border-color: rgba(239,68,68,.35); background: rgba(239,68,68,.08); }
.alert-warning { border-color: rgba(245,158,11,.35); background: rgba(245,158,11,.08); }

.table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-wrap table { min-width: 100%; }

table {
  width: 100%;
  border-collapse: collapse;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
}
th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}
th { color: var(--muted); font-weight: 600; font-size: 12px; }
tr:last-child td { border-bottom: none; }

.pill {
  display: inline-flex;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  max-width: 100%;
  overflow-wrap: anywhere;
  word-break: break-word;
}

.btn-block { width: 100%; }

pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}

@media (min-width: 900px) {
  table { table-layout: fixed; }
  th:nth-child(1), td:nth-child(1) { width: 34%; }
  th:nth-child(2), td:nth-child(2) { width: 36%; }
  th:nth-child(3), td:nth-child(3) { width: 15%; }
  th:nth-child(4), td:nth-child(4) { width: 15%; }
}

@media (max-width: 900px) {
  .table-wrap { overflow-x: visible; }
  .table-wrap table { min-width: 0; }

  table { border: none; }
  thead { display: none; }
  tbody { display: grid; gap: 12px; }
  tr {
    display: grid;
    gap: 10px;
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px;
    background: rgba(0,0,0,.14);
  }
  th, td { border-bottom: none; padding: 0; }
  td {
    display: grid;
    gap: 6px;
  }
  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 12px;
    font-weight: 600;
  }
  td.actions .row { flex-direction: row; align-items: center; justify-content: flex-start; }
  td.actions .btn { width: auto; }
}

@media (max-width: 640px) {
  .container { margin: 18px auto; padding: 0 12px; }
  .card { padding: 14px; border-radius: 12px; }
  .topbar { flex-direction: column; align-items: flex-start; }
  .row { flex-direction: column; align-items: stretch; }
  .btn { width: 100%; padding: 12px 14px; touch-action: manipulation; }
  .input, .textarea { font-size: 16px; }
  th, td { padding: 10px; }
}
