* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  background: #0b0c10;
  color: #e7e7e7;
}

.header {
  padding: 20px 16px 10px;
  border-bottom: 1px solid #222;
}
h1 { margin: 0 0 4px; font-size: 28px; }
.subtitle { margin: 0; color: #b8b8b8; }

.nav {
  display: flex;
  gap: 10px;
  padding: 10px 16px;
  border-bottom: 1px solid #222;
  background: #0f1117;
}
.nav-btn {
  border: 1px solid #2a2f3a;
  background: #141824;
  color: #e7e7e7;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.nav-btn.active {
  border-color: #6aa9ff;
  box-shadow: 0 0 0 2px rgba(106,169,255,.2);
}

.container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
}

.view { display: block; }
.hidden { display: none; }

.row { display: flex; align-items: center; }
.space-between { justify-content: space-between; }
.gap { gap: 10px; }
.wrap { flex-wrap: wrap; }

.controls {
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
  justify-content: flex-end;
}
.controls .input { width: auto; min-width: 160px; }

.input {
  width: 100%;
  padding: 10px;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #0f1117;
  color: #e7e7e7;
}
.input::placeholder { color: #8a8a8a; }

.table-wrap {
  margin-top: 10px;
  overflow: auto;
  border: 1px solid #222;
  border-radius: 12px;
}
.table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}
.table th, .table td {
  padding: 12px;
  border-bottom: 1px solid #222;
  text-align: left;
}
.table th { background: #0f1117; position: sticky; top: 0; z-index: 1; }
.actions-col { width: 170px; }
.img-col { width: 90px; }

.img-cell { width: 90px; }
.thumb {
  width: 48px;
  height: 72px;
  object-fit: cover;
  border-radius: 10px;
  border: 1px solid #2a2f3a;
  background: #0f1117;
  display: block;
}

.card {
  margin-top: 12px;
  padding: 14px;
  border: 1px solid #222;
  border-radius: 12px;
  background: #0f1117;
}

.grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.field { display: flex; flex-direction: column; gap: 6px; }
.field.checkbox { flex-direction: row; align-items: center; gap: 10px; }

.btn {
  border: 1px solid #2a2f3a;
  background: #141824;
  color: #e7e7e7;
  padding: 10px 12px;
  border-radius: 10px;
  cursor: pointer;
}
.btn.primary { border-color: #6aa9ff; }
.btn.danger { border-color: #ff6a6a; }
.btn.secondary { opacity: 0.9; }

.muted { color: #b8b8b8; }
.small { font-size: 13px; }
.req { color: #ff6a6a; }
.dot { margin: 0 8px; color: #444; }

.error {
  margin: 10px 0 0;
  padding: 10px;
  border-radius: 10px;
  background: rgba(255,106,106,.12);
  border: 1px solid rgba(255,106,106,.4);
  color: #ffd1d1;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin: 12px 0;
}
.stats-grid-2 {
  grid-template-columns: repeat(2, 1fr);
}
.stat {
  padding: 14px;
  border: 1px solid #222;
  border-radius: 12px;
  background: #0f1117;
}
.stat-label { color: #b8b8b8; font-size: 13px; }
.stat-value { font-size: 24px; margin-top: 6px; }

.footer {
  padding: 18px 16px;
  border-top: 1px solid #222;
  text-align: center;
}

@media (max-width: 820px) {
  .grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: 1fr 1fr; }
  .controls { justify-content: flex-start; }
  .controls .input { min-width: 140px; }
}

/* Make table cells vertically centered */
.table th, .table td {
  vertical-align: middle;
}

/* Ensure actions column stays aligned nicely */
.table td:last-child {
  white-space: nowrap;
}

.table td .row.gap {
  justify-content: flex-end;
  align-items: center;
  flex-wrap: nowrap;
}

/* --- HARD FIX: actions alignment --- */

/* Make all table cells vertically centered */
.table th, .table td { vertical-align: middle; }

/* Right-align the Actions column (header + cells) */
.table th.actions-col,
.table td.actions-col {
  text-align: right;
  white-space: nowrap;
}

/* Make the action buttons wrapper behave consistently */
.table td.actions-col .row.gap {
  display: inline-flex;        /* inline-flex prevents full-width stretching */
  justify-content: flex-end;
  align-items: center;
  gap: 10px;
  flex-wrap: nowrap;
}

/* Slightly widen Actions column so buttons never wrap */
.actions-col { width: 220px; }