/* ── Reset & Base ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  font-size: 14px;
  line-height: 1.55;
}

/* ── Navigation ───────────────────────────────────────────── */
.topnav {
  background: #1e2a4a;
  height: 52px;
  padding: 0 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.nav-brand {
  color: #fff;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.02em;
}
.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
}
.nav-links a {
  color: #9ab0d0;
  text-decoration: none;
  font-size: 13px;
  transition: color 0.15s;
}
.nav-links a:hover { color: #fff; }
.btn-logout {
  background: rgba(255,255,255,0.1);
  padding: 5px 14px;
  border-radius: 5px;
}
.btn-logout:hover {
  background: rgba(255,255,255,0.2) !important;
  color: #fff !important;
}

/* ── Container ────────────────────────────────────────────── */
.container {
  max-width: 1140px;
  margin: 0 auto;
  padding: 28px 20px 48px;
}

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: 11px 16px;
  border-radius: 7px;
  margin-bottom: 18px;
  font-size: 13px;
  line-height: 1.5;
}
.alert ul { margin: 4px 0 0 16px; }
.alert-success {
  background: #d1fae5;
  color: #065f46;
  border: 1px solid #6ee7b7;
}
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fca5a5;
}

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 8px 16px;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
  white-space: nowrap;
  transition: opacity 0.15s, box-shadow 0.15s;
  line-height: 1;
}
.btn:hover { opacity: 0.88; }
.btn:active { opacity: 0.75; }

.btn-primary { background: #3b82f6; color: #fff; }
.btn-secondary { background: #e2e8f0; color: #374151; }
.btn-ghost { background: transparent; color: #6b7280; border: 1px solid #d1d5db; }
.btn-ghost:hover { background: #f3f4f6; opacity: 1; }
.btn-danger { background: #ef4444; color: #fff; }
.btn-sm { padding: 5px 11px; font-size: 12px; }
.btn-full { width: 100%; justify-content: center; padding: 10px 16px; }

/* ── Page Header ──────────────────────────────────────────── */
.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 22px;
}
.page-header h1 {
  font-size: 21px;
  font-weight: 700;
  color: #1e2a4a;
}

/* ── Search Bar ───────────────────────────────────────────── */
.search-bar { margin-bottom: 14px; }
.search-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.search-row input[type="text"] {
  flex: 1;
  max-width: 480px;
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  background: #fff;
}
.search-row input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}

/* ── Table ────────────────────────────────────────────────── */
.table-wrapper {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
  overflow: hidden;
}
table {
  width: 100%;
  border-collapse: collapse;
}
thead { background: #f8fafc; }
th {
  padding: 10px 14px;
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-bottom: 1px solid #e5e7eb;
}
td {
  padding: 11px 14px;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13px;
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f8fafc; }

.cell-id { color: #9ca3af; font-size: 12px; width: 56px; }
.cell-date { color: #6b7280; font-size: 12px; white-space: nowrap; }
.cell-actions {
  white-space: nowrap;
  display: flex;
  gap: 6px;
  align-items: center;
  width: 160px;
}
.empty-row {
  text-align: center;
  color: #9ca3af;
  padding: 52px 20px !important;
  font-size: 14px;
}
.badge {
  display: inline-block;
  background: #eff6ff;
  color: #1d4ed8;
  padding: 2px 9px;
  border-radius: 9999px;
  font-size: 11px;
  font-weight: 600;
}
.table-hint {
  padding: 10px 14px;
  font-size: 12px;
  color: #9ca3af;
  border-top: 1px solid #f1f5f9;
  background: #fafafa;
}

/* ── Login Page ───────────────────────────────────────────── */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  background: #f0f2f5;
}
.login-card {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
  padding: 40px 36px;
  width: 100%;
  max-width: 380px;
}
.login-logo {
  font-size: 22px;
  font-weight: 800;
  color: #1e2a4a;
  text-align: center;
  margin-bottom: 28px;
  letter-spacing: -0.03em;
}
.login-card .form-group { margin-bottom: 16px; }

/* ── Form Sections ────────────────────────────────────────── */
.form-section {
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 1px 4px rgba(0,0,0,0.07);
  padding: 24px 24px 20px;
  margin-bottom: 14px;
}
.meta-section { margin-top: 0; }

.section-title {
  font-size: 13px;
  font-weight: 700;
  color: #374151;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  border-bottom: 1px solid #f1f5f9;
  padding-bottom: 12px;
  margin-bottom: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-hint {
  font-size: 11px;
  font-weight: 400;
  color: #9ca3af;
  text-transform: none;
  letter-spacing: 0;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 16px;
}

/* ── Form Fields ──────────────────────────────────────────── */
.form-group {
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.form-group label {
  font-size: 12px;
  font-weight: 600;
  color: #374151;
}
.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  font-size: 13px;
  color: #111827;
  background: #fff;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59,130,246,0.12);
}
.input-disabled {
  background: #f9fafb !important;
  color: #9ca3af !important;
  cursor: not-allowed;
}
.required { color: #ef4444; margin-left: 2px; }

/* ── Checkboxes ───────────────────────────────────────────── */
.checkbox-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 10px;
  margin-top: 16px;
}
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  padding: 8px 10px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  font-size: 13px;
  color: #374151;
  transition: background 0.12s;
}
.check-item:hover { background: #f8fafc; }
.check-item input[type="checkbox"] {
  width: 15px;
  height: 15px;
  cursor: pointer;
  accent-color: #3b82f6;
  flex-shrink: 0;
}

/* ── Form Actions ─────────────────────────────────────────── */
.form-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 0 8px;
}
.form-actions-right {
  margin-left: auto;
}

/* ── Meta Grid ────────────────────────────────────────────── */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 12px;
}
.meta-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.meta-label {
  font-size: 11px;
  font-weight: 600;
  color: #9ca3af;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.meta-item span:last-child {
  font-size: 13px;
  color: #374151;
}

/* ── Error Page ───────────────────────────────────────────── */
.error-page {
  text-align: center;
  padding: 80px 20px;
}
.error-page h1 {
  font-size: 26px;
  font-weight: 700;
  color: #1e2a4a;
  margin-bottom: 12px;
}
.error-page p {
  color: #6b7280;
  margin-bottom: 24px;
}
