:root {
  --bg: #0f172a;
  --panel: #111827;
  --card: #1f2937;
  --text: #f8fafc;
  --muted: #94a3b8;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --border: #334155;
  --success: #22c55e;
  --danger: #ef4444;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, Segoe UI, sans-serif;
  background: linear-gradient(180deg, #0b1220, #111827);
  color: var(--text);
  min-height: 100vh;
}

.layout {
  max-width: 1200px;
  margin: 0 auto;
  padding: 1.25rem;
}

.header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

h1 { margin: 0 0 .25rem; font-size: 1.75rem; }
.subtitle { margin: 0; color: var(--muted); }
.header-actions { display: flex; gap: .75rem; flex-wrap: wrap; }

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.card, .panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
}

.card {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.label { color: var(--muted); font-size: .9rem; }
.card strong { font-size: 1.4rem; }

.panel { padding: 1rem; }
.panel-header {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.panel-header h2 { margin: 0; font-size: 1.1rem; }

#searchInput {
  min-width: 220px;
  flex: 1;
  max-width: 360px;
  padding: .65rem .85rem;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--panel);
  color: var(--text);
}

.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 720px;
}

th, td {
  padding: .75rem;
  border-bottom: 1px solid var(--border);
  text-align: right;
}

th { color: var(--muted); font-weight: 600; }
.empty { text-align: center; color: var(--muted); }

.btn {
  border: none;
  border-radius: 10px;
  padding: .65rem 1rem;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary { background: var(--primary); color: white; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-secondary { background: #334155; color: white; }
.btn-light { background: #1e293b; color: white; border: 1px solid var(--border); }
.btn:disabled { opacity: .6; cursor: not-allowed; }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 1rem;
  margin-top: 1rem;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, .7);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  z-index: 1000;
}

.modal {
  width: min(640px, 100%);
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 1.25rem;
  position: relative;
}

.modal-close {
  position: absolute;
  left: 1rem;
  top: .75rem;
  background: transparent;
  border: none;
  color: var(--text);
  font-size: 1.5rem;
  cursor: pointer;
}

.modal-content {
  display: grid;
  gap: .75rem;
  margin-top: 1rem;
}

.modal-content img {
  max-width: 100%;
  border-radius: 10px;
  border: 1px solid var(--border);
}

.hidden { display: none !important; }

.toast {
  position: fixed;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  background: #14532d;
  color: white;
  padding: .75rem 1rem;
  border-radius: 10px;
  z-index: 1100;
}

.toast.error { background: #7f1d1d; }

@media (max-width: 640px) {
  .header { align-items: flex-start; }
  .header-actions { width: 100%; }
  .header-actions .btn { flex: 1; }
}
