:root {
  --bg: #f4f7fb;
  --card: #ffffff;
  --primary: #4f46e5;
  --primary-dark: #3730a3;
  --text: #1f2937;
  --muted: #6b7280;
  --border: #e5e7eb;
  --success: #10b981;
  --warning: #f59e0b;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Arial, Helvetica, sans-serif;
  background: linear-gradient(135deg, #eef2ff 0%, #f8fafc 100%);
  color: var(--text);
  display: grid;
  place-items: center;
}

.container {
  width: min(100%, 720px);
  padding: 24px;
}

.card {
  background: var(--card);
  border-radius: 20px;
  box-shadow: 0 20px 40px rgba(79, 70, 229, 0.12);
  padding: 32px 24px;
}

.header {
  text-align: center;
  margin-bottom: 24px;
}

.eyebrow {
  margin: 0 0 8px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
}

h1 {
  margin: 0;
  font-size: 2rem;
}

.form {
  display: grid;
  gap: 18px;
}

.login-form {
  max-width: 440px;
  margin: 0 auto;
}

.demo-accounts {
  display: grid;
  gap: 7px;
  max-width: 440px;
  margin: 22px auto 0;
  padding: 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
  color: var(--muted);
  font-size: 0.9rem;
}

.demo-accounts strong {
  color: var(--text);
}

.demo-accounts code {
  color: var(--primary-dark);
  font-weight: 700;
}

.account-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 24px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #f8fafc;
}

.account-bar > div {
  display: flex;
  align-items: center;
  gap: 10px;
}

.role-badge {
  padding: 4px 8px;
  border-radius: 999px;
  background: #e0e7ff;
  color: var(--primary-dark);
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.08em;
}

.logout-btn {
  padding: 8px 12px;
  border: 1px solid var(--border);
  background: #ffffff;
  color: var(--danger);
  font-size: 0.85rem;
}

.logout-btn:hover {
  background: #fee2e2;
}

.field-group {
  display: grid;
  gap: 8px;
}

label {
  font-weight: 700;
  font-size: 0.95rem;
}

input {
  width: 100%;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 1rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1);
}

button {
  border: none;
  border-radius: 12px;
  background: var(--primary);
  color: white;
  font-weight: 700;
  font-size: 1rem;
  padding: 14px 18px;
  cursor: pointer;
  transition: background 0.2s ease, transform 0.2s ease;
}

button:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}

.result {
  margin-top: 28px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px 18px;
  text-align: center;
}

.result-label {
  margin: 0;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.75rem;
  font-weight: 700;
}

#bmi-value {
  margin: 12px 0 8px;
  font-size: 2.2rem;
  color: var(--primary-dark);
}

#bmi-category {
  margin: 0;
  color: var(--text);
  font-weight: 600;
}

.save-note,
.success-message {
  margin: 12px 0 0;
  color: var(--success);
  font-size: 0.9rem;
  font-weight: 700;
}

.error-message {
  margin: 12px 0 0;
  color: var(--danger);
  font-size: 0.9rem;
  font-weight: 700;
}

.history-box {
  margin-top: 24px;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
}

.history-box h3 {
  margin: 0 0 12px;
  font-size: 1.1rem;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th,
td {
  text-align: left;
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 700;
}

.row-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-start;
}

.row-actions a,
.delete-btn {
  display: inline-block;
  padding: 6px 10px;
  border-radius: 8px;
  text-decoration: none;
  font-size: 0.8rem;
  font-weight: 700;
}

.edit-link {
  background: #e0e7ff;
  color: var(--primary-dark);
}

.delete-form {
  display: inline;
  margin: 0;
}

.delete-btn {
  background: #fee2e2;
  color: #991b1b;
  border: none;
  cursor: pointer;
}

.cancel-link {
  display: inline-block;
  margin-top: 10px;
  color: var(--primary-dark);
  font-weight: 700;
  text-decoration: none;
}

.empty-message {
  margin-top: 18px;
  text-align: center;
  color: var(--muted);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 1000;
}

.modal-box {
  width: min(100%, 420px);
  background: #ffffff;
  border-radius: 18px;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.2);
  padding: 20px;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-header h3 {
  margin: 0;
}

.close-modal {
  text-decoration: none;
  color: var(--text);
  font-size: 1.6rem;
  line-height: 1;
}

.modal-form {
  display: grid;
  gap: 18px;
}

.modal-actions {
  display: flex;
  gap: 12px;
  align-items: center;
}

@media (max-width: 480px) {
  .container {
    padding: 16px;
  }

  .card {
    padding: 20px 16px;
  }

  table {
    font-size: 0.8rem;
  }

  .row-actions {
    flex-direction: column;
    align-items: flex-start;
  }

  .modal-actions {
    flex-direction: column;
    align-items: stretch;
  }

  .account-bar {
    align-items: flex-start;
  }

  .account-bar > div {
    align-items: flex-start;
    flex-direction: column;
  }
}
