:root {
  --bg-overlay: rgba(8, 20, 32, 0.6);
  --card-bg: rgba(255, 255, 255, 0.94);
  --text: #1d2a33;
  --muted: #6b7b86;
  --primary: #2a6f8a;
  --primary-dark: #215b71;
  --border: #dfe7ec;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Poppins", "Segoe UI", Tahoma, sans-serif;
  color: var(--text);
  min-height: 100vh;
  background: linear-gradient(120deg, #cfe3ea 0%, #e7f0f4 45%, #dfe7d8 100%);
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 20px 28px;
  background: linear-gradient(120deg, #e0eef4 0%, #f0f6f4 60%);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  margin: 0;
  font-size: 1.9rem;
}

.topbar p {
  margin: 4px 0 0;
  color: var(--muted);
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background-image:
    radial-gradient(circle at 20% 20%, rgba(255, 255, 255, 0.14), transparent 45%),
    radial-gradient(circle at 80% 0%, rgba(223, 231, 216, 0.2), transparent 40%),
    linear-gradient(var(--bg-overlay), var(--bg-overlay));
  background-size: 100% 100%;
  padding: 32px 16px;
}

.auth-page-with-topbar {
  min-height: calc(100vh - 108px);
  display: block;
  padding: 24px 28px 40px;
  background-image: none;
  background: transparent;
}

.auth-page-with-topbar .card {
  width: 100%;
  max-width: none;
  margin: 0;
}

/* Force full-width layout on authenticated pages across all usuario screens. */
body.is-authenticated .auth-page {
  min-height: calc(100vh - 108px);
  display: block;
  padding: 24px 28px 40px;
  background-image: none;
  background: transparent;
  place-items: initial;
}

body.is-authenticated .auth-page .card,
body.is-authenticated .auth-page .card-wide {
  width: 100%;
  max-width: none;
  margin: 0;
}

.card {
  width: min(480px, 92vw);
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 28px;
  box-shadow: 0 18px 50px rgba(8, 20, 32, 0.25);
  backdrop-filter: blur(8px);
}

.card-wide {
  width: min(1100px, 96vw);
}

.card h1 {
  margin: 0 0 8px;
  font-size: 1.7rem;
  letter-spacing: 0.3px;
}

.card p {
  margin: 0 0 18px;
  color: var(--muted);
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: block;
  font-weight: 600;
  margin-bottom: 6px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--border);
  font-size: 0.95rem;
}

input:focus,
select:focus,
textarea:focus {
  outline: 2px solid rgba(42, 111, 138, 0.35);
  border-color: var(--primary);
}

.btn {
  display: inline-block;
  padding: 12px 16px;
  border: none;
  border-radius: 10px;
  background: var(--primary);
  color: #fff;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s ease;
  text-decoration: none;
}

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

button.btn:not(:has(i)):not(:has(svg)),
a.btn:not(:has(i)):not(:has(svg)) {
  border: 2px solid #0d6efd !important;
  background: #0d6efd !important;
  color: #fff !important;
  box-shadow: 0 1px 4px rgba(13, 110, 253, 0.35) !important;
}

button.btn:not(:has(i)):not(:has(svg)):hover,
a.btn:not(:has(i)):not(:has(svg)):hover {
  background: #0b5ed7 !important;
  border-color: #0b5ed7 !important;
}

button.btn.btn-text-only,
a.btn.btn-text-only {
  border: 2px solid #0d6efd !important;
  background: #0d6efd !important;
  color: #fff !important;
  box-shadow: 0 1px 4px rgba(13, 110, 253, 0.35) !important;
}

button.btn.btn-text-only:hover,
a.btn.btn-text-only:hover {
  background: #0b5ed7 !important;
  border-color: #0b5ed7 !important;
}

.link-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-top: 6px;
  font-size: 0.9rem;
}

.link-row a {
  color: var(--primary);
  text-decoration: none;
  font-weight: 600;
}

.errorlist {
  margin: 0 0 8px;
  padding: 0;
  list-style: none;
  color: #b42318;
  font-size: 0.9rem;
}

.message {
  padding: 10px 12px;
  border-radius: 10px;
  background: #eef4f7;
  border: 1px solid #d6e3ea;
  color: #2b3f4a;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.toolbar form {
  display: flex;
  gap: 8px;
  align-items: center;
}

.btn-secondary {
  background: #e1eef3;
  color: #1d2a33;
}

.btn-secondary:hover {
  background: #cfe3ea;
}

.table-wrap {
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  text-align: left;
  padding: 10px 8px;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--muted);
  font-weight: 600;
}

.pagination {
  margin-top: 16px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

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