body {
    color: #222222;
    background-color: #ffffff;
    margin: 2em auto;
    padding: 0 .62em;
    font: 1em sans-serif;
    max-width: 60em;
}

div.flash {
    border: 1px solid #00aa00;
    background-color: #adebad;
    border-radius: .4em;
    padding: 1em;
    margin-bottom: 1em;
    animation: .25s linear 3s forwards fade-out;

    position: fixed; 
    top: 1rem;   
    right: 1rem;  
    z-index: 9999; 
    width: max-content; /* so it shrinks to fit */
    width: 300px;   
}

@keyframes fade-out {
    from { opacity: 1; }
    to { opacity: 0; display: none; }
}

@media (max-width: 768px) {
    .flash {
        display: none;
    }
}

table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 24px;
  background-color: #ffffff;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  font-size: 0.95rem;
  color: #374151;
}

thead {
  background-color: #f9fafb;
  font-weight: 600;
  text-transform: capitalize;
  color: #1f2937;
}

table th,
table td {
  padding: 16px 20px;
  text-align: left;
}

table th:first-child,
table td:first-child {
  text-align: center;
  width: 40px;
}

tbody tr {
  border-top: 1px solid #e5e7eb;
  transition: background-color 0.2s;
}

tbody tr:hover {
  background-color: #f3f4f6;
}

/* Optional: zebra striping */
tbody tr:nth-child(even) {
  background-color: #fafafa;
}

/* Link inside table */
table a {
  color: #3399cc;
  text-decoration: none;
  font-weight: 500;
}

table a:hover {
  text-decoration: underline;
}

form {
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 24px;
  max-width: 100%;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  margin-bottom: 24px;
}

/* === Labels === */
form label {
  display: block;
  margin-bottom: 6px;
  font-size: 0.95rem;
  font-weight: 500;
  color: #374151;
}

/* === Inputs, Selects, Textareas === */
form input[type=text],
form input[type=password],
form input[type=number],
form select,
form textarea {
  display: block;
  width: 100%;
  font-size: 1rem;
  padding: 10px 14px;
  margin-bottom: 16px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  transition: border-color 0.2s, box-shadow 0.2s;
  color: #111827;
}

form input:focus,
form select:focus,
form textarea:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2); /* blue-500 */
}

/* === Error Inputs === */
form input.error,
form textarea.error,
form select.error {
  border-color: #dc2626;
  background-color: #fef2f2;
}

form span.error {
  font-size: 0.875rem;
  color: #dc2626;
  margin-top: -12px;
  margin-bottom: 12px;
  display: block;
}

/* === Alert (centered error message) === */
form span.alert {
  display: block;
  text-align: center;
  color: #dc2626;
  font-weight: 500;
  margin: 16px 0;
}

/* === Readonly Inputs === */
form input[readonly] {
  color: #6b7280;
  background-color: #f3f4f6;
}

/* === Buttons === */
form button {
  font-size: 1rem;
  font-weight: 500;
  padding: 10px 16px;
  margin: 6px 8px 6px 0;
  border-radius: 8px;
  border: 1px solid #d1d5db;
  cursor: pointer;
  transition: background-color 0.2s, border-color 0.2s;
}

form button[type=submit] {
  background-color: #3b82f6;
  color: white;
  border-color: #3b82f6;
}

form button[type=submit]:hover {
  background-color: #2563eb;
  border-color: #2563eb;
}

form button[type=button] {
  background-color: #f9fafb;
  color: #374151;
}

form button[type=button]:hover {
  background-color: #f3f4f6;
}

form button[disabled] {
  background-color: #e5e7eb;
  color: #9ca3af;
  cursor: not-allowed;
}

/* === Hidden Inline Form === */
form.hidden {
  display: inline;
  padding: 0;
  margin: 0;
  border: none;
  background-color: transparent;
}

form.hidden button {
  display: inline;
  padding: 0 10px 0 0;
  margin: 0;
  background: none;
  border: none;
  color: #2563eb;
  font-size: 0.95rem;
  cursor: pointer;
}

/* === Horizontal Layout === */
form.horizontal {
  display: flex;
  align-items: center; /* Aligns all items vertically */
  flex-wrap: wrap;
  gap: 12px;
  padding: 16px 24px;
  margin-top: 20px;
}

form.horizontal label {
  margin: 0;
  font-weight: 500;
  color: #374151;
  font-size: 0.95rem;
}

/* Select gets consistent styling */
form.horizontal select {
  padding: 10px 14px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 1rem;
  background-color: #f9fafb;
  color: #111827;
  min-width: 200px;
}

/* Button should also be vertically aligned */
form.horizontal button {
  padding: 10px 16px;
  font-size: 1rem;
  border-radius: 8px;
  font-weight: 500;
  border: 1px solid #3b82f6;
  background-color: #3b82f6;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

form.horizontal button:disabled {
  background-color: #e5e7eb;
  border-color: #cbd5e1;
  color: #9ca3af;
  cursor: not-allowed;
}

a, a:visited {
    color: #0055aa;
}

a:hover {
    color: #002288;
}

nav.pager {
    display: table;
    white-space: nowrap;
    border: 1px solid #aaaaaa;
    border-radius: .4em;
    padding: 0;
    margin: 1em auto;
}


nav.pager a {
    display: inline-block;
    border-left: 1px solid #aaaaaa;
    text-decoration: none;
    padding: .4em .8em .4em .8em;
}

nav.pager a.selected {
    color: #ffffff;
    background-color: #0055ff;
}

nav.pager a:first-child {
    border-left: none;
}

nav.pager a:last-child {
    padding-right: .8em;
}

div.sidebar {
    float: left;
    width: 20%;
}

div.main {
    float: right;
    width: 80%;
}

ul.sidebar {
    padding: 0;
    margin: 0 1em 1em 0;
}

ul.sidebar li {
    padding: .4em .8em;
    list-style-type: none;
}

ul.sidebar li.active {
    background-color: #0055ff;
    border-radius: .4em;
}

ul.sidebar a {
    text-decoration: none;
}

ul.sidebar a:nth-child(even) {
    float: right;
}

ul.sidebar li.active a {
    color: #ffffff;
}

@media screen and (max-width: 60em) {
    div.sidebar,  div.main {
        float: none;
        width: 100%;
    }

    ul.sidebar {
        margin-right: 0;
    }
}

h3 {
    margin: .8em 0em .4em 0em;
}

li.sidebar-header {
    margin-top: 10px;
    font-weight: bold;
}

/* =============================== */
/* Login
/* =============================== */

.login {
  max-width: 400px;
  margin: 60px auto;
  background-color: #ffffff;
  border: 1px solid #e5e7eb;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.login form {
  display: flex;
  flex-direction: column;
}

.form-heading {
  font-size: 1.25rem;
  font-weight: 600;
  color: #111827;
  margin-bottom: 20px;
  text-align: center;
}

.login label {
  font-size: 0.95rem;
  font-weight: 500;
  margin-top: 12px;
  color: #374151;
}

.login input[type="text"],
.login input[type="password"] {
  font-size: 1rem;
  padding: 10px 14px;
  margin-top: 6px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background-color: #f9fafb;
  color: #111827;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.login input:focus {
  border-color: #3b82f6;
  outline: none;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

.login input.error {
  border-color: #dc2626;
  background-color: #fef2f2;
}

.login span.error {
  font-size: 0.875rem;
  color: #dc2626;
  margin-top: 4px;
}

.login span.alert {
  text-align: center;
  color: #dc2626;
  font-weight: 500;
  margin-bottom: 16px;
  display: block;
}

.login button[type="submit"] {
  margin-top: 24px;
  padding: 10px 16px;
  font-size: 1rem;
  font-weight: 500;
  border-radius: 8px;
  border: 1px solid #3b82f6;
  background-color: #3b82f6;
  color: white;
  cursor: pointer;
  transition: background-color 0.2s;
}

.login button[type="submit"]:hover {
  background-color: #2563eb;
}
