* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family: sans-serif;
  -webkit-font-smoothing: antialiased;
}

:root {
  --primary-color: #1a73e8;
  --primary-hover: #1557b0;
  --danger-color: #d93025;
  --text-primary: #202124;
  --text-secondary: #5f6368;
  --border-color: #dadce0;
  --background-light: #f8f9fa;
  --button-color: #2c7a4e;
  --button-hover: #1e5937;
}

body {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  background-color: var(--background-light);
  color: var(--text-primary);
  font-weight: 400;
}

/* Navigation Bar Styles */
.navbar {
  background-color: white;
  box-shadow: 0 1px 2px 0 rgb(60 64 67 / 30%), 0 2px 6px 2px rgb(60 64 67 / 15%);
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;

  /* Match .container so the logo lines up with the page content below it. */
  max-width: 1500px;
  margin: 0 auto;
  padding: 0.75rem 1.5rem;
}

.nav-logo a {
  color: var(--primary-color);
  font-size: 1.25rem;
  font-weight: 500;
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 0.875rem;
  font-weight: 500;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--primary-color);
}

.container {
  width: 100%;
  max-width: 1500px;
  margin: 2rem auto;
  padding: 0 1.5rem;
  display: flex;
  flex-direction: column;
}

.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  width: 100%;
}

.login-card {
  background: white;
  padding: 3rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  width: 100%;
  max-width: 450px;
  text-align: center;
}

.profile-card {
  background: white;
  padding: 2rem;
  border-radius: 8px;
  border: 1px solid var(--border-color);
  width: 100%;
  margin-bottom: 2rem;
}

h1 {
  color: var(--text-primary);
  font-size: 24px;
  margin-bottom: 2rem;
  font-weight: 500;
}

h2 {
  color: var(--text-primary);
  font-size: 20px;
  margin: 1.5rem 0;
  font-weight: 500;
}

.input-group {
  text-align: left;
  margin-bottom: 1.5rem;
}

label {
  display: block;
  font-size: 0.9rem;
  margin-bottom: 0.5rem;
  color: var(--text-secondary);
  font-weight: 500;
}

input {
  width: 100%;

  /* Keep text fields readable instead of stretching the full page width. */
  max-width: 40rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  font-weight: 400;
  outline: none;
  transition: border 0.2s;
}

/* Checkboxes/radios are not text fields: don't stretch them to 100% (which
   made the "Enabled" box render full-width with a centered tick). */
input[type="checkbox"],
input[type="radio"] {
  width: auto;
  max-width: none;

  /* Pin the tick colour to the brand instead of the viewer's OS accent. */
  accent-color: var(--primary-color);
}

input:focus {
  border: 2px solid var(--primary-color);
}

/* Selects share the text-input look instead of the tiny native default. */
select {
  width: 100%;
  max-width: 40rem;
  padding: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-size: 1rem;
  background: white;
  color: var(--text-primary);
  cursor: pointer;
}

select:focus {
  border: 2px solid var(--primary-color);
  outline: none;
}

.btn {
  padding: 0.75rem 1.5rem;
  background: var(--button-color);
  border: none;
  color: white;
  font-size: 0.875rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.2s;
  text-decoration: none;
  display: inline-block;
}

.btn:hover {
  background: var(--button-hover);
}

a.btn {
  color: white;
  text-decoration: none;
}

a.btn:hover {
  color: white;
  text-decoration: none;
}

.btn-block {
  width: 100%;
}

.links {
  margin-top: 1.5rem;
  font-size: 0.875rem;
}

.links a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.forgot-password-link a {
  color: var(--primary-color);
  text-decoration: none;
  font-size: 0.95em;
  transition: color 0.2s;
}

.links a:hover {
  text-decoration: underline;
}

.forgot-password-link a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

.error-message {
  background-color: #fce8e6;
  color: var(--danger-color);
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--danger-color);
  border-radius: 4px;
  font-size: 0.875rem;
  text-align: center;
}

.info-message {
  background-color: #e8f0fe;
  color: var(--primary-color);
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--primary-color);
  border-radius: 4px;
  font-size: 0.875rem;
}

.profile-info {
  text-align: left;
  margin: 1rem 0;
  font-size: 0.875rem;
}

.profile-info p {
  margin: 0.75rem 0;
  color: var(--text-secondary);
}

.profile-info strong {
  color: var(--text-primary);
  display: inline-block;
  width: 150px;
}

.events-list {
  margin-top: 1rem;
}

.event-item {
  padding: 1rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.event-item:last-child {
  border-bottom: none;
}

.event-time {
  color: var(--text-secondary);
  font-size: 0.75rem;
  white-space: nowrap;
}

.event-content {
  flex: 1;
}

.event-action {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 0.25rem;
}

.event-details {
  font-size: 0.875rem;
  color: var(--text-secondary);
  font-weight: 400;
}

.change-password {
  text-align: left;
  padding-top: 1.5rem;
  border-top: 1px solid var(--border-color);
}

.logout-btn {
  margin-top: 1.5rem;
  background: var(--danger-color);
}

.logout-btn:hover {
  background: #c5221f;
}

/* Table styles moved from users.css */
.table-container {
  overflow-x: auto;
  margin-top: 1rem;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background-color: white;
  box-shadow: 0 1px 2px 0 rgb(60 64 67 / 30%);
  border-radius: 4px;
}

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background-color: var(--background-light);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}

.data-table tr:last-child td {
  border-bottom: none;
}

.data-table tr:hover {
  background-color: rgb(0 0 0 / 2%);
}

.text-muted {
  color: var(--text-secondary);
  font-style: italic;
}

.margin-top-1 {
  margin-top: 1rem;
}

.margin-top-2 {
  margin-top: 2rem;
}

.admin-links {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
}

.password-input {
  width: 320px;
  max-width: 100%;
}

.forgot-password-link {
  text-align: right;
  margin-bottom: 1em;
}

/* Admin UI */
.admin-nav {
  display: flex;
  gap: 1.5rem;
  padding-bottom: 1rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

/* stylelint-disable-next-line no-descending-specificity */
.admin-nav a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

.admin-nav .admin-nav-right {
  margin-left: auto;
  color: var(--text-secondary);
}

.flash {
  padding: 0.75rem;
  margin-bottom: 1rem;
  border-radius: 4px;
  font-size: 0.875rem;
}

.flash-info {
  background-color: #e8f0fe;
  color: var(--primary-color);
  border: 1px solid var(--primary-color);
}

.flash-error {
  background-color: #fce8e6;
  color: var(--danger-color);
  border: 1px solid var(--danger-color);
}

/* A bordered panel, e.g. one application on the Applications page. */
.card {
  background: white;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}

.card h2 {
  margin-top: 0;
}

/* A horizontal row of action buttons/forms (each button may be its own
   <form>, so they are laid out as flex items rather than stacking). */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: 1rem;
}

/* Data-entry forms: keep the whole form (fields + fieldsets) to a readable
   column instead of spanning the wide table container. */
.admin-form {
  max-width: 40rem;
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 1.5rem;
}

.filters input,
.filters select {
  width: auto;
}

.grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
  background-color: white;
  border-radius: 4px;
  overflow: hidden;
  box-shadow: 0 1px 2px 0 rgb(60 64 67 / 30%);
}

/* stylelint-disable no-descending-specificity */
.grid th,
.grid td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
  vertical-align: top;
}
/* stylelint-enable no-descending-specificity */

.grid th {
  background-color: var(--background-light);
  color: var(--text-secondary);
  font-weight: 500;
}

.pill {
  display: inline-block;
  padding: 0.1rem 0.5rem;
  margin: 0.1rem;
  border-radius: 999px;
  font-size: 0.75rem;
  background-color: var(--background-light);
  border: 1px solid var(--border-color);
}

.pill-success {
  background-color: #e6f4ea;
  border-color: #34a853;
  color: #137333;
}

.pill-failed,
.pill-exhausted {
  background-color: #fce8e6;
  border-color: var(--danger-color);
  color: var(--danger-color);
}

.muted {
  color: var(--text-secondary);
  font-style: italic;
}

.body {
  background-color: white;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 1rem;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
  font-family: monospace;
  font-size: 0.8rem;
}

.meta dt {
  font-weight: 500;
  color: var(--text-secondary);
}

.meta dd {
  margin: 0 0 0.5rem;
}

.pager {
  display: flex;
  gap: 1rem;
  align-items: center;
  margin-top: 1rem;
}

.login-box {
  background: white;
  padding: 2rem;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  max-width: 400px;
  margin: 2rem auto;
}

textarea {
  width: 100%;
  padding: 0.5rem;
  border: 1px solid var(--border-color);
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.85rem;
  margin-bottom: 1rem;
}

button {
  padding: 0.5rem 1rem;
  background: var(--button-color);
  border: none;
  color: white;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 4px;
  cursor: pointer;
}

button:hover {
  background: var(--button-hover);
}

fieldset {
  border: 1px solid var(--border-color);
  border-radius: 4px;
  padding: 0.75rem 1rem 1rem;
  margin-bottom: 1rem;
}

/* Give the legend padding so it sits cleanly in the border notch (the global
   reset had stripped it, leaving the text jammed against the border). */
legend {
  padding: 0 0.4rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
}

fieldset label {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  margin-right: 1rem;
  margin-bottom: 0.35rem;
}

/* Add-form field rhythm. Placed after the base element rules above so the
   more-specific .admin-form selectors don't precede their lower-specificity
   counterparts (no-descending-specificity). Each label sits just above its
   control and every control has the same gap to the next field; checkboxes
   /radios are excluded so the inline .form-check row is untouched. */
.admin-form label {
  margin-bottom: 0.4rem;
}

.admin-form input:not([type="checkbox"], [type="radio"]),
.admin-form select,
.admin-form textarea,
.admin-form fieldset {
  margin-bottom: 1.25rem;
}

.admin-form .form-check {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 0.5rem 0 1.25rem;
}

.admin-form .form-check label {
  margin: 0;
}
