.admin-shell {
  display: flex;
  min-height: 100vh;
}

.admin-sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  padding: 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.admin-brand {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 18px;
  padding: 0 6px;
}

.admin-sidebar nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  background: transparent;
  border: none;
  color: var(--muted);
  text-align: left;
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  margin: 0;
}

.nav-item:hover {
  background: var(--surface-2);
  color: var(--text);
}

.nav-item.active {
  background: rgba(91, 140, 255, 0.14);
  color: var(--accent);
}

.admin-main {
  flex: 1;
  padding: 28px 32px;
  max-width: 1100px;
}

.admin-main h2 {
  margin-top: 0;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.panel-header select {
  max-width: 200px;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 14px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.stat-label {
  color: var(--muted);
  font-size: 0.8rem;
}

.stat-value {
  font-size: 1.6rem;
  font-weight: 700;
}

.table-wrap {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow-x: auto;
}

#orders-tbody td:nth-child(5) {
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#orders-tbody td:nth-child(1),
#tab-orders .table-wrap th:first-child {
  width: 36px;
  text-align: center;
}

.row-actions {
  display: flex;
  gap: 8px;
}

.row-actions button {
  width: auto;
  margin: 0;
  padding: 6px 10px;
  font-size: 0.78rem;
}

.link-btn {
  background: transparent;
  border: none;
  color: var(--accent);
  padding: 0;
  width: auto;
  margin: 0;
  font-size: 0.8rem;
  text-decoration: underline;
}

.link-btn.danger {
  color: var(--danger);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  width: 100%;
  max-width: 420px;
  max-height: 90vh;
  overflow-y: auto;
}

.modal h3 {
  margin-top: 0;
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 18px;
}

.modal-actions button {
  margin-top: 0;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
}

.checkbox-row input {
  width: auto;
}

.checkbox-row label {
  margin: 0;
  color: var(--text);
}

@media (max-width: 720px) {
  .admin-shell {
    flex-direction: column;
  }
  .admin-sidebar {
    width: 100%;
    flex-direction: row;
    overflow-x: auto;
  }
  .admin-sidebar nav {
    flex-direction: row;
  }
  #logout-btn {
    margin-top: 0 !important;
  }
  .admin-main {
    padding: 20px;
  }
}
