* {
  box-sizing: border-box;
}

:root {
  --bg: #f3f4f8;
  --card-bg: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #d1d5db;
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --danger: #c62828;
}

body {
  margin: 0;
  font-family: "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.45;
}

.hidden {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  background: var(--card-bg);
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  padding: 22px;
  border: 1px solid #e5e7eb;
}

.login-card h2 {
  margin: 0 0 14px;
  font-size: 22px;
  letter-spacing: 0.01em;
}

.topbar-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: #111827;
  color: #e5e7eb;
  padding: 18px 14px;
}

.brand {
  margin: 0 0 18px;
  font-size: 20px;
}

.menu {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.menu-title {
  margin: 12px 8px 4px;
  font-size: 12px;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.menu-item {
  color: #9ca3af;
  text-decoration: none;
  padding: 9px 10px;
  border-radius: 8px;
  border-left: 3px solid transparent;
}

.menu-item.active,
.menu-item:hover {
  color: #fff;
  background: #1f2937;
  border-left-color: #3b82f6;
}

.main {
  padding: 20px;
}

.topbar {
  margin-bottom: 14px;
}

.topbar h2 {
  margin: 0;
}

.muted {
  margin-top: 6px;
  color: var(--muted);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.stat-card {
  background: var(--card-bg);
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
  padding: 12px 14px;
}

.stat-title {
  margin: 0;
  font-size: 12px;
  color: #6b7280;
}

.stat-value {
  margin: 6px 0 0;
  font-size: 22px;
  font-weight: 700;
}

.card {
  background: var(--card-bg);
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.card h3 {
  margin: 0 0 12px;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.form-span-2 {
  grid-column: span 2;
}

.form-row {
  display: flex;
  flex-direction: column;
}

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
}

label {
  margin-bottom: 4px;
  font-weight: 600;
  font-size: 13px;
  color: #374151;
}

input,
select {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  font-size: 14px;
  color: var(--text);
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder {
  color: #9ca3af;
}

input:focus,
select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

button {
  min-height: 40px;
  padding: 0 14px;
  font-size: 14px;
  font-weight: 600;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  margin-right: 8px;
  transition: background 0.2s ease, transform 0.05s ease;
}

button:hover {
  background: var(--primary-hover);
}

button:active {
  transform: translateY(1px);
}

.warn {
  background: #b45309;
}

.warn:hover {
  background: #92400e;
}

.ghost-btn {
  background: #e5e7eb;
  color: #111827;
  margin-right: 0;
}

.ghost-btn:hover {
  background: #d1d5db;
}

.actions {
  display: flex;
  gap: 8px;
}

.pager {
  margin-top: 10px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 700px;
}

th,
td {
  border-bottom: 1px solid #e5e7eb;
  padding: 10px 8px;
  text-align: left;
}

#message {
  margin-top: 10px;
  min-height: 20px;
  font-size: 13px;
}

#login-message {
  margin: 12px 0 0;
  min-height: 20px;
  color: #374151;
  font-size: 13px;
}

@media (max-width: 980px) {
  .layout {
    grid-template-columns: 1fr;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
