:root {
  --bg: #0f172a;
  --panel: #1e293b;
  --panel-2: #273449;
  --text: #e2e8f0;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #ef4444;
  --ok: #22c55e;
  --warn: #f59e0b;
  --border: #334155;
  --radius: 10px;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

a { color: #60a5fa; }

.center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
}

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  width: 100%;
  max-width: 420px;
}

.brand {
  font-size: 20px;
  font-weight: 700;
  margin: 0 0 4px;
}
.subtle { color: var(--muted); font-size: 13px; margin: 0 0 20px; }

label { display: block; font-size: 13px; margin: 14px 0 6px; color: var(--muted); }

input, textarea, select {
  width: 100%;
  padding: 10px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  font-size: 14px;
}
textarea { resize: vertical; min-height: 64px; }

input:focus, textarea:focus { outline: 2px solid var(--primary); border-color: var(--primary); }

button {
  margin-top: 18px;
  width: 100%;
  padding: 11px 14px;
  background: var(--primary);
  border: none;
  border-radius: 8px;
  color: white;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
}
button:hover { background: var(--primary-hover); }
button.secondary { background: transparent; border: 1px solid var(--border); }
button:disabled { opacity: 0.6; cursor: not-allowed; }

.msg { margin-top: 14px; font-size: 13px; min-height: 18px; }
.msg.error { color: var(--danger); }
.msg.ok { color: var(--ok); }

.required::after { content: " *"; color: var(--danger); }

/* App shell */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 240px;
  background: var(--panel);
  border-right: 1px solid var(--border);
  padding: 22px 16px;
  display: flex;
  flex-direction: column;
}
.sidebar .brand { padding: 0 8px 16px; border-bottom: 1px solid var(--border); }
.nav { display: flex; flex-direction: column; gap: 4px; margin-top: 16px; flex: 1; }
.nav a {
  display: block;
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--text);
  text-decoration: none;
  font-size: 14px;
}
.nav a:hover { background: var(--panel-2); }
.nav a.active { background: var(--primary); color: white; }
.content { flex: 1; padding: 32px; max-width: 920px; }
.content h1 { margin-top: 0; font-size: 22px; }

.panel {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 22px;
  margin-bottom: 20px;
}

.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
@media (max-width: 640px) { .grid2 { grid-template-columns: 1fr; } }

.code {
  background: #0b1222;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
  font-family: ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 12.5px;
  white-space: pre-wrap;
  word-break: break-all;
}

.badge {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 600;
}
.badge.ok { background: rgba(34,197,94,0.15); color: var(--ok); }
.badge.warn { background: rgba(245,158,11,0.15); color: var(--warn); }
.badge.bad { background: rgba(239,68,68,0.15); color: var(--danger); }
.badge.gray { background: rgba(148,163,184,0.18); color: var(--muted); }

.row { display: flex; gap: 10px; align-items: center; }
.row.wrap { flex-wrap: wrap; }
.spacer { flex: 1; }
.hidden { display: none !important; }
.kv { color: var(--muted); font-size: 13px; margin: 6px 0; }
.kv b { color: var(--text); }

/* Toolbar / filters */
.toolbar { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-end; margin-bottom: 16px; }
.toolbar .field { display: flex; flex-direction: column; }
.toolbar label { margin: 0 0 4px; }
.toolbar input, .toolbar select { width: auto; min-width: 150px; }
.toolbar button { margin-top: 0; width: auto; }

/* Table */
.table-wrap { overflow-x: auto; border: 1px solid var(--border); border-radius: var(--radius); }
table.licenses { width: 100%; border-collapse: collapse; font-size: 13px; min-width: 820px; }
table.licenses th, table.licenses td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.licenses th { background: var(--panel-2); color: var(--muted); font-weight: 600; position: sticky; top: 0; }
table.licenses tbody tr:hover { background: rgba(255,255,255,0.03); }
table.licenses td.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: 12px; }
table.licenses .actions-cell { display: flex; gap: 6px; }
table.licenses button { margin: 0; width: auto; padding: 5px 10px; font-size: 12px; }

.btn-sm { margin: 0; width: auto; padding: 6px 12px; font-size: 13px; }
.btn-danger { background: var(--danger); }
.btn-danger:hover { background: #dc2626; }

/* Pagination */
.pagination { display: flex; gap: 10px; align-items: center; justify-content: flex-end; margin-top: 14px; font-size: 13px; color: var(--muted); }
.pagination button { margin: 0; width: auto; padding: 6px 12px; }

/* States */
.empty-state { text-align: center; padding: 40px 20px; color: var(--muted); }
.loading { color: var(--muted); padding: 20px; text-align: center; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(2,6,23,0.7);
  display: flex; align-items: center; justify-content: center; padding: 20px; z-index: 50;
}
.modal {
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 24px; width: 100%; max-width: 460px;
}
.modal h2 { margin: 0 0 8px; font-size: 18px; }
.modal .row { justify-content: flex-end; margin-top: 18px; }
.modal .row button { width: auto; margin-top: 0; }
.warn-text { color: var(--warn); font-size: 13px; }
