* { margin: 0; padding: 0; box-sizing: border-box; }

html {
  min-height: 100%;
  background: linear-gradient(135deg, #051424 0%, #0d2e5c 55%, #163b72 100%);
  height: 100%;
}

body {
  min-height: 100vh;
  background: linear-gradient(135deg, #051424 0%, #0d2e5c 55%, #163b72 100%);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color: #195396;
  padding: 20px;
  margin: 0;
  display: block;
  justify-content: unset;
  align-items: unset;
  min-height: auto;
  background-attachment: fixed;
}

.card {
  width: 100%;
  max-width: 2500px;
  margin: 0 auto;
  min-height: 800px;
  background: linear-gradient(135deg, #051424 0%, #0d2e5c 55%, #163b72 100%);
  background-attachment: fixed;
  color: #24476e;
  backdrop-filter: blur(6px);
  border: none;
  border-radius: 30px;
  padding: 55px 45px;
  box-shadow: 0 8px 30px rgba(2,8,30,0.6);
  display: flex;
  flex-direction: column;
  justify-content: flex-start;
  align-items: flex-start;
}

.logo {
  text-align: center;
  margin-bottom: 30px;
  width: 100%;
}

.logo-img {
  width: 100px;
  height: 100px;
  border-radius: 18px;
  object-fit: cover;
  display: block;
  margin: 0 auto 15px;
  border: 4px solid rgba(102, 126, 234, 0.9);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.4);
  transition: transform 0.3s ease;
}

.logo-img:hover {
  transform: scale(1.05);
}

.logo h2 {
  font-size: 28px;
  font-weight: 900;
  line-height: 1.2;
  color: #ffffff;
  text-shadow: 0 2px 8px rgba(0,0,0,0.45);
  margin-bottom: 5px;
}

.logo p {
  font-size: 15px;
  color: rgba(255,255,255,0.85);
  font-weight: 500;
}

.top-right {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 20px;
  gap: 20px;
  width: 100%;
  padding-right: 80px;
}

.top-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-start;
  gap: 10px;
  width: 100%;
}

.dashboard-actions {
  display: flex;
  gap: 15px;
  align-items: center;
  width: 100%;
  justify-content: flex-start;
  flex-wrap: wrap;
  margin-top: 15px;
  z-index: 1;
  padding-right: 80px;
}

.top-row h2 {
  margin: 0;
  color: #667eea;
  font-size: 26px;
  font-weight: 900;
}

.top-row .small-text {
  display: block;
  color: #f5f4f7;
  font-size: 14px;
  font-weight: 500;
}

.form-group {
  margin-bottom: 22px;
  width: 100%;
}

label {
  display: block;
  font-size: 14px;
  color: #ffffff;
  margin-bottom: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: 10px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: rgba(102, 126, 234, 0.05);
  color: #ffffff;
  font-size: 15px;
  font-weight: 500;
  outline: none;
  transition: all 0.3s ease;
}

input::placeholder,
textarea::placeholder {
  color: rgba(255, 255, 255, 0.7);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #667eea;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
  background: rgba(102, 126, 234, 0.1);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

select {
  appearance: none;
  -webkit-appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, rgba(102, 126, 234, 0.5) 50%), linear-gradient(135deg, rgba(102, 126, 234, 0.5) 50%, transparent 50%);
  background-position: calc(100% - 15px) center, calc(100% - 10px) center;
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
  padding-right: 35px;
  cursor: pointer;
}

select option {
  color: #ffffff !important;
  background: #1f2a3f;
}

.custom-select-options {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 12px;
  background: #1b2438;
  border: 2px solid rgba(102, 126, 234, 0.3);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
}

.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 14px 28px;
  border: none;
  border-radius: 12px;
  font-size: 16px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 15px;
  line-height: 1;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 0.8px;
}

.btn-login:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.2);
}

.btn-login:active {
  transform: translateY(0);
}

.btn-admin {
  background: linear-gradient(135deg, #ff6b35, #ff8c42);
  color: #ffffff;
  font-weight: 900;
}

.btn-user {
  background: linear-gradient(135deg, #ffd700, #ffcc33);
  color: #102043;
  font-weight: 900;
}

.btn-logout {
  padding: 10px 16px;
  border: 2px solid rgba(102, 126, 234, 0.4);
  border-radius: 10px;
  background: rgba(102, 126, 234, 0.1);
  color: #764ba2;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.btn-logout:hover {
  background: rgba(102, 126, 234, 0.2);
  box-shadow: 0 10px 25px rgba(102, 126, 234, 0.15);
  border-color: rgba(102, 126, 234, 0.6);
}

.error-msg {
  background: rgba(255, 107, 107, 0.15);
  border: 2px solid rgba(255, 107, 107, 0.4);
  border-radius: 10px;
  color: #d63031;
  font-size: 14px;
  font-weight: 600;
  padding: 12px 14px;
  margin-top: 12px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.success-screen {
  text-align: center;
  width: 100%;
}

.success-screen .big-icon {
  font-size: 70px;
  margin-bottom: 18px;
}

.success-screen h3 {
  font-size: 26px;
  margin-bottom: 12px;
  color: #667eea;
  font-weight: 900;
}

.success-screen p {
  font-size: 15px;
  color: #764ba2;
  margin-bottom: 20px;
}

.badge {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 18px;
  font-size: 13px;
  font-weight: 700;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.badge.admin {
  background: rgba(255, 215, 0, 0.2);
  color: #d4a017;
  border: 2px solid rgba(255, 215, 0, 0.4);
}

.badge.user {
  background: rgba(102, 126, 234, 0.2);
  color: #667eea;
  border: 2px solid rgba(102, 126, 234, 0.4);
}

/* Table styles */
.dataTables_wrapper {
  width: 100%;
  box-sizing: border-box;
  color: #2d3748;
}

.dataTables_wrapper .dt-buttons {
  margin-bottom: 12px;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.dataTables_wrapper .dataTables_filter {
  margin: 8px 0;
}

.dataTables_wrapper .dataTables_filter input {
  padding: 10px 12px;
  border-radius: 8px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: rgba(102, 126, 234, 0.08);
  color: #2d3748;
  font-weight: 500;
}

.dataTables_wrapper .dataTables_length select {
  padding: 8px 10px;
  border-radius: 8px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: rgba(102, 126, 234, 0.08);
  color: #2d3748;
  font-weight: 500;
}

.dashboard-card {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  padding: 20px;
  min-height: 200px;
  border-radius: 12px;
  background: rgba(102, 126, 234, 0.05);
  border: 2px solid rgba(102, 126, 234, 0.15);
}

.dashboard-card h3 {
  margin-bottom: 10px;
  color: #ffffff;
  font-size: 16px;
  font-weight: 900;
}

.dashboard-card p {
  margin-bottom: 15px;
  line-height: 1.6;
  color: #ffffff;
  font-size: 14px;
}

.dashboard-card .btn-login {
  margin-top: auto;
  width: fit-content;
}

.dashboard-card table {
  width: 100%;
  border-collapse: collapse;
}

#fichas-table {
  width: 100% !important;
}

#fichas-table thead {
  background: rgba(102, 126, 234, 0.1);
}

#fichas-table thead th {
  padding: 12px 10px;
  color: #667eea;
  font-weight: 700;
  border-bottom: 2px solid rgba(102, 126, 234, 0.2);
  text-align: left;
}

#fichas-table tbody td {
  padding: 12px 10px;
  color: #2d3748;
  border-bottom: 1px solid rgba(102, 126, 234, 0.1);
}

#fichas-table tbody tr:hover {
  background: rgba(102, 126, 234, 0.05);
}

/* Responsive */
@media (max-width: 768px) {
  body {
    padding: 15px;
  }
  .card {
    padding: 30px 20px;
  }
  .logo h2 {
    font-size: 22px;
  }
  .btn-login {
    padding: 12px 20px;
    font-size: 14px;
  }
}

@media (max-width: 480px) {
  .card {
    width: 100%;
    padding: 20px 15px;
  }
  .logo-img {
    width: 80px;
    height: 80px;
  }
  .logo h2 {
    font-size: 20px;
  }
  .logo p {
    font-size: 13px;
  }
  label {
    font-size: 13px;
  }
  input,
  select,
  textarea {
    font-size: 13px;
    padding: 10px 12px;
  }
  .btn-login {
    padding: 30px 18px;
    font-size: 15px;
  }
  .top-row h2 {
    font-size: 18px;
  }
}

/* Utility */
.container {
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.small-text {
  color: #764ba2;
  font-size: 0.9rem;
}

.cards-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
  margin-top: 18px;
}

.ficha-card {
  border-radius: 12px;
  padding: 14px;
  background: rgba(102, 126, 234, 0.08);
  box-shadow: 0 6px 18px rgba(102, 126, 234, 0.1);
}

/* Custom select dropdown */
.custom-select-wrapper {
  position: relative;
  width: 100%;
  margin-top: 8px;
}

.custom-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  padding: 12px 15px;
  border-radius: 10px;
  background: rgba(102, 126, 234, 0.05);
  color: #ffffff;
  border: 2px solid rgba(102, 126, 234, 0.3);
  min-height: 45px;
  box-shadow: 0 4px 16px rgba(102, 126, 234, 0.08);
  transition: all 0.3s ease;
  font-weight: 500;
}

.custom-select-display.open {
  border-color: #667eea;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
  background: rgba(102, 126, 234, 0.1);
}

.custom-select-display::after {
  content: '\25BE';
  margin-left: 10px;
  font-size: 0.9rem;
  color: #667eea;
  transition: transform 0.2s ease;
}

.custom-select-display.open::after {
  transform: rotate(180deg);
}

.custom-select-options {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 12px;
  background: #ffffff;
  border: 2px solid rgba(102, 126, 234, 0.3);
  box-shadow: 0 15px 40px rgba(102, 126, 234, 0.15);
}

.custom-select-options.open {
  display: block;
}

.custom-select-option {
  padding: 12px 15px;
  color: #2d3748;
  cursor: pointer;
  border-bottom: 1px solid rgba(102, 126, 234, 0.08);
  transition: all 0.2s ease;
  font-weight: 500;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option.active {
  background: rgba(102, 126, 234, 0.12);
  color: #667eea;
  padding-left: 20px;
}

html {
  min-height: 100%;
  background: linear-gradient(135deg, #051424 0%, #0d2e5c 55%, #163b72 100%);
  height: 100%;
}

body {
  min-height: 100vh;
  height: 100%;
  background: linear-gradient(135deg, #051424 0%, #0d2e5c 55%, #163b72 100%);
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  color: #eef6ff;
  padding: 0;
  margin: 0;
  display: block;
  justify-content: unset;
  align-items: unset;
  min-height: auto;
  background-attachment: fixed;
}

.card {
  width: 95%;
  max-width: 800px;
  height: auto;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(14px);
  border: 1px solid rgba(255, 209, 84, 0.22);
  border-radius: 30px;
  padding: 50px 40px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.24), inset 0 1px 0 rgba(255, 255, 255, 0.4);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
}

.logo {
  text-align: center;
  margin-bottom: 35px;
}

.logo-img {
  width: 110px;
  height: 110px;
  border-radius: 24px;
  object-fit: cover;
  display: block;
  margin: 0 auto 20px;
  border: 4px solid rgba(255, 209, 84, 0.9);
  box-shadow: 0 15px 40px rgba(255, 209, 84, 0.25);
  transition: transform 0.3s ease;
}

.logo-img:hover {
  transform: scale(1.05);
}

.logo h2 { font-size: 32px; font-weight: 900; line-height: 1.2; color: #163b72; text-shadow: 0 2px 8px rgba(21, 54, 101, 0.18); }
.logo p  { font-size: 16px; color: rgba(21, 54, 101, 0.75); margin-top: 10px; font-weight: 600; }

.top-right {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 18px;
  gap: 12px;
}
.top-row { display:flex; flex-direction:column; align-items:flex-start; justify-content:flex-start; gap:10px; min-height:72px; }
.dashboard-actions { display:flex; gap:12px; align-items:center; flex:0 0 auto; width:100%; justify-content:flex-start; flex-wrap:wrap; margin-top:12px; z-index:1; }
.top-row > div:first-child { width:100%; min-width: 260px; z-index:2; }
.top-row h2 { margin: 0; color: #ffd700; font-size: 26px; font-weight: 900; }
.top-row .small-text { display:block; margin-top:8px; color: rgba(255,255,255,0.85); font-size: 15px; }
.dashboard-actions .btn-logout, .dashboard-actions .btn-login { min-width: 120px; white-space:nowrap; }
.cards-grid { display:none; grid-template-columns: 1fr 1fr; gap: 18px; margin-top: 18px; }
.ficha-card { border-radius: 12px; padding: 14px; background: rgba(255,255,255,0.05); box-shadow: 0 6px 18px rgba(0,0,0,0.2); }
.dataTables_wrapper { width: 100%; box-sizing: border-box; max-width: 1200px; margin: 0 auto; }
.dataTables_wrapper .dt-buttons { margin-bottom: 12px; display:flex; gap:8px; flex-wrap:wrap; }
.dataTables_wrapper .dataTables_filter { margin-top: 0; }
.dataTables_wrapper .dataTables_filter, .dataTables_wrapper .dataTables_length { margin: 8px 0; }
.dashboard-card table { width: 100%; border-collapse: collapse; }
.dashboard-card { display: flex; flex-direction: column; justify-content: space-between; padding: 22px; min-height: 220px; border-radius: 14px; background: rgba(255,255,255,0.08); border: 1px solid rgba(255,209,84,0.18); }
.dashboard-card h3 { margin-bottom: 12px; color: #ffffff; }
.dashboard-card p { margin-bottom: 18px; line-height: 1.6; color: rgba(255, 255, 255, 0.9); }
.dashboard-card .btn-login { margin-top: auto; width: fit-content; }

.top-right .btn-login {
  width: auto;
  padding: 10px 18px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 18px;
}

label {
  display: block;
  font-size: 15px;
  color: #ffffff;
  margin-bottom: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

input,
select,
textarea {
  width: 100%;
  padding: 12px 15px;
  border-radius: 12px;
  border: 2px solid rgba(102, 126, 234, 0.3);
  background: rgba(102, 126, 234, 0.08);
  color: #2d3748;
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border 0.15s, box-shadow 0.12s, background 0.3s ease;
}

/* Login form overrides - light card background needs dark text */
body > .card input,
body > .card select,
body > .card textarea {
  color: #2d3748;
  background: rgba(102, 126, 234, 0.08);
}

body > .card input[type="email"],
body > .card input[type="password"] {
  color: #1e6fff !important;
}

body > .card label {
  color: #2e24b3;
}

/* Ficha form labels should remain white on dark card background */
.container .card label,
body > .container .card label,
.card:not([style*="rgba(255,255,255)"]) label {
  color: #ffffff;
}

.container .card input,
.container .card select,
.container .card textarea {
  color: #ffffff;
}

.container .card .btn-login.btn-user,
.container .card .btn-logout {
  color: #1e6fff;
  border-color: rgba(30, 111, 255, 0.45);
}

.container .card .btn-login.btn-user:hover,
.container .card .btn-logout:hover {
  color: #1e6fff;
  border-color: rgba(30, 111, 255, 0.65);
}

textarea {
  min-height: 110px;
  resize: vertical;
}

/* Select styling for ficha forms only */
body > .container select,
body > .card:not([style*="rgba(255"]) select {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.2);
  background-image: linear-gradient(45deg, transparent 50%, rgba(0,212,255,0.5) 50%), linear-gradient(135deg, rgba(0,212,255,0.5) 50%, transparent 50%);
  background-position: calc(100% - 20px) center, calc(100% - 14px) center;
  background-size: 8px 8px, 8px 8px;
  background-repeat: no-repeat;
}

/* Login page select - should inherit dark text */
body > .card select {
  color: #2d3748;
  background: rgba(102, 126, 234, 0.08);
}

#loginSection input[type="email"],
#loginSection input[type="password"] {
  color: #1e6fff !important;
  -webkit-text-fill-color: #1e6fff !important;
}

#loginSection label {
  color: #1e6fff !important;
}

#loginSection input[type="email"]::placeholder,
#loginSection input[type="password"]::placeholder {
  color: rgba(30, 111, 255, 0.75) !important;
}

body > .card #loginSection input[type="email"],
body > .card #loginSection input[type="password"] {
  color: #1e6fff !important;
  -webkit-text-fill-color: #1e6fff !important;
}

body > .card #loginSection input[type="email"]::placeholder,
body > .card #loginSection input[type="password"]::placeholder {
  color: rgba(30, 111, 255, 0.75) !important;
}

.custom-select-hidden {
  display: none !important;
  visibility: hidden !important;
  position: absolute !important;
  opacity: 0 !important;
  pointer-events: none !important;
  width: 0 !important;
  height: 0 !important;
}

.custom-select-wrapper {
  position: relative;
  width: 100%;
  margin-top: 8px;
}

.custom-select-display {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  cursor: pointer;
  padding: 14px 16px;
  border-radius: 14px;
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border: 2px solid rgba(255,255,255,0.2);
  min-height: 50px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease;
}

.custom-select-display.open {
  border-color: rgba(0,212,255,0.6);
  box-shadow: 0 10px 30px rgba(0,212,255,0.2);
}

.custom-select-display::after {
  content: '\25BE';
  margin-left: 12px;
  font-size: 0.95rem;
  color: rgba(0,212,255,0.7);
  transition: transform 0.2s ease;
}

.custom-select-display.open::after {
  transform: rotate(180deg);
}

.custom-select-options {
  display: none;
  position: absolute;
  z-index: 30;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: 260px;
  overflow-y: auto;
  border-radius: 16px;
  background: #1a3a52;
  border: 2px solid rgba(255,255,255,0.2);
  box-shadow: 0 18px 50px rgba(0,0,0,0.3);
}

.custom-select-options.open {
  display: block;
}

.custom-select-option {
  padding: 14px 18px;
  color: #ffffff;
  cursor: pointer;
  border-bottom: 1px solid rgba(255,255,255,0.1);
  transition: background 0.16s ease, color 0.16s ease;
}

.custom-select-option:last-child {
  border-bottom: none;
}

.custom-select-option:hover,
.custom-select-option.active {
  background: rgba(0,212,255,0.2);
  color: #00d4ff;
}

.theme-dark .custom-select-display {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
}

.theme-dark .custom-select-options {
  background: #0f2844;
  border-color: rgba(255,255,255,0.2);
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.4);
}

.theme-dark .custom-select-option {
  color: #ffffff;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}

.theme-dark .custom-select-option:hover,
.theme-dark .custom-select-option.active {
  background: rgba(0,212,255,0.2);
  color: #00d4ff;
}

.custom-select-display[data-placeholder] {
  color: rgba(255,255,255,0.6);
}

.theme-dark .custom-select-display[data-placeholder] {
  color: rgba(255,255,255,0.6);
}

/* Ensure option text/background are visible across browsers and themes */
select option {
  color: #ffffff !important;
  background: #1a3a52 !important;
  -webkit-text-fill-color: #ffffff !important;
}

.theme-dark input,
.theme-dark textarea {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border-color: rgba(255,255,255,0.2);
}

.theme-dark select {
  background: rgba(255,255,255,0.08);
  color: #ffffff;
  border-color: rgba(255,255,255,0.2);
}

.theme-dark select option {
  color: #ffffff !important;
  background: #1a3a52 !important;
  -webkit-text-fill-color: #ffffff !important;
}

input::placeholder,
textarea::placeholder {
  color: rgba(118, 75, 162, 0.5);
}

input:focus,
select:focus,
textarea:focus {
  border-color: #667eea;
  box-shadow: 0 8px 25px rgba(102, 126, 234, 0.25);
  background: rgba(102, 126, 234, 0.1);
}

.btn-login {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 16px 32px;
  border: none;
  border-radius: 14px;
  font-size: 17px;
  font-weight: 700;
  cursor: pointer;
  margin-top: 20px;
  line-height: 1;
  transition: all 0.3s ease;
  width: 100%;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn-login:hover { transform: translateY(-3px); box-shadow: 0 15px 35px rgba(0, 0, 0, 0.2); }
.btn-login:active { transform: translateY(-1px); }

.btn-admin { background: linear-gradient(135deg, #ff6b35, #ff8c42); color: #ffffff; font-weight: 900; }
.btn-user  { background: linear-gradient(135deg, #ffd700, #ffcc33); color: #102043; font-weight: 900; }

.error-msg {
  background: rgba(255, 107, 107, 0.15);
  border: 2px solid rgba(255, 107, 107, 0.4);
  border-radius: 12px;
  color: #d63031;
  font-size: 15px;
  font-weight: 600;
  padding: 14px 16px;
  margin-top: 16px;
  animation: slideDown 0.3s ease;
}

@keyframes slideDown {
  from { transform: translateY(-10px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

.success-screen {
  text-align: center;
}

.success-screen .big-icon {
  font-size: 80px;
  margin-bottom: 20px;
}

.success-screen h3 { font-size: 28px; margin-bottom: 12px; color: #667eea; font-weight: 900; }
.success-screen p  { font-size: 16px; color: #764ba2; margin-bottom: 24px; }

.btn-logout {
  padding: 12px 18px;
  border: 2px solid rgba(102, 126, 234, 0.4);
  border-radius: 12px;
  background: rgba(102, 126, 234, 0.1);
  color: #764ba2;
  cursor: pointer;
  font-size: 15px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
}

.badge.admin { background: rgba(255, 215, 0, 0.2); color: #d4a017; border: 2px solid rgba(255, 215, 0, 0.4); }
.badge.user  { background: rgba(102, 126, 234, 0.2); color: #667eea; border: 2px solid rgba(102, 126, 234, 0.4); }

@media (max-width: 980px) {
  body { padding: 0; }
  .card { padding: 30px 20px; }
  .logo h2 { font-size: 24px; }
  .top-right { justify-content: center; }
  .btn-login { padding: 12px; }
  .form-group { max-width: 450px; }
}

@media (max-width: 1100px) {
  .cards-grid { display:none !important; }
  .dataTables_wrapper { display:block !important; }
}

@media (min-width: 1100px) {
  .cards-grid { display:grid; }
  .dataTables_wrapper { display:block; }
}

@media (max-width: 520px) {
  .card { width: 100%; padding: 18px; }
  .logo-img { width: 70px; height: 70px; }
  .logo h2 { font-size: 20px; }
  .logo p { font-size: 14px; }
  label { font-size: 13px; }
  input, select, textarea { font-size: 14px; padding: 10px 12px; }
  .btn-login { padding: 10px 16px; font-size: 14px; }
  .form-group { max-width: 100%; }
  .top-row h2 { font-size: 20px; }
}

@media (max-width: 760px) {
  .top-row { align-items:flex-start; }
  .dashboard-actions { width: 100%; justify-content: flex-start; gap:8px; margin-top:10px; }
  .dashboard-actions .btn-logout, .dashboard-actions .btn-login { min-width: 100px; }
  .card { padding: 20px 15px; }
}

/* On very wide screens restore side-by-side layout */
@media (min-width: 1400px) {
  .top-row { flex-direction:row; align-items:center; justify-content:space-between; }
  .top-row > div:first-child { width: auto; flex: 1 1 60%; }
  .dashboard-actions { width: auto; justify-content:flex-end; margin-top:0; }
}

/* Utility */
.container { max-width: 1100px; margin: 0 auto; }
.small-text { color: rgba(255,255,255,0.75); font-size: 0.95rem; }
.dashboard-card { padding: 18px; border-radius: 14px; background: rgba(255,255,255,0.02); border: 1px solid rgba(255,255,255,0.08); color: #ffffff; }

/* Table responsiveness tweaks */
#fichas-table { width: 100% !important; }
#fichas-table td, #fichas-table th { padding: 14px; color: #ffffff; }
#fichas-table thead { background: rgba(255,215,0,0.1); }
#fichas-table tbody tr { border-bottom: 1px solid rgba(255,255,255,0.1); }
#fichas-table tbody tr:hover { background: rgba(255,255,255,0.05); }

/* DataTables styling: clearer headers, spacing and lighter colors */
.dataTables_wrapper {
  color: #ffffff;
}
.dataTables_wrapper .dt-buttons { margin-bottom: 12px; }
.dataTables_wrapper .dataTables_filter { float: right; margin-top: 6px; }
.dataTables_wrapper .dataTables_filter input { padding: 10px 12px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #ffffff; }
.dataTables_wrapper .dataTables_length select { padding: 8px 10px; border-radius: 8px; border: 2px solid rgba(255,255,255,0.2); background: rgba(255,255,255,0.08); color: #ffffff; }

#fichas-table.dataTable thead th {
  background: #f7fafc;
  color: rgba(21,34,43,0.92);
  font-weight: 700;
  border-bottom: 1px solid rgba(21,34,43,0.06);
  padding: 12px 14px;
}
#fichas-table.dataTable tbody td {
  background: transparent;
  color: rgba(21,34,43,0.86);
  padding: 14px 12px;
  vertical-align: middle;
  border-bottom: 1px solid rgba(21,34,43,0.03);
}
#fichas-table.dataTable tbody tr:nth-child(odd) td {
  background: #fbfdff;
}
#fichas-table.dataTable tbody tr:hover td {
  background: #f3f6fa;
}

/* Action buttons inside table */
/* Ensure table buttons are auto-width and inline
  so they don't inherit form's full-width styles
  (override .btn-login width:100%) */
#fichas-table td .btn-login, #fichas-table td .btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  margin: 0 4px 4px 0;
  width: auto;
}
#fichas-table td .btn-login { background: linear-gradient(135deg, #4dabf7, #2f80ed); color: #fff; }
#fichas-table td .btn-delete { background: linear-gradient(135deg, #ff6b78, #ff4b6e); color: #fff; }

/* Admin table buttons (users and fichas search) */
#adminTable td .btn-login, #adminTable td .btn-delete {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border-radius: 10px;
  font-size: 13px;
  margin: 0 4px 4px 0;
  width: auto;
  min-width: 76px;
}
#adminTable td .btn-login { background: linear-gradient(135deg, #4dabf7, #2f80ed); color: #fff; }
#adminTable td .btn-delete { background: linear-gradient(135deg, #ff6b78, #ff4b6e); color: #fff; }

/* Row actions container */
.row-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  align-items: center;
}

/* Admin table action column */
#adminTable td:last-child, #adminTable th:last-child {
  min-width: 180px;
  width: 180px;
}

/* Pagination and info */
.dataTables_wrapper .dataTables_paginate .paginate_button {
  background: #ffffff;
  border: 1px solid rgba(21,34,43,0.04);
  color: rgba(21,34,43,0.86);
  padding: 6px 10px;
  margin: 0 4px;
  border-radius: 8px;
}
.dataTables_wrapper .dataTables_paginate .paginate_button.current {
  background: linear-gradient(135deg,#ffd47a,#ffb347);
  color: #17221c !important;
  border-color: rgba(0,0,0,0.06);
}

/* Make export buttons lighter and inline */
.dt-buttons button {
  background: #ffffff;
  color: rgba(21,34,43,0.92);
  border: 1px solid rgba(21,34,43,0.06);
  padding: 8px 12px;
  border-radius: 8px;
  margin-right: 8px;
}

/* Reduce DataTables default small icons crowding */
.dataTables_wrapper table.dataTable th.control::before { display:none; }

/* Dark theme overrides (applied when body has .theme-dark) */
.theme-dark {
  background: linear-gradient(135deg, #041224 0%, #081827 60%, #051226 100%);
  color: #eef6ff;
}
.theme-dark .card {
  background: rgba(5,15,35,0.96);
  border-color: rgba(255,255,255,0.04);
  box-shadow: 0 28px 64px rgba(0,0,0,0.6);
}
.theme-dark .logo h2 { color: #ffd600; }
.theme-dark .logo p { color: rgba(238,246,255,0.82); }
.theme-dark label { color: rgba(238,246,255,0.86); }
.theme-dark input, .theme-dark textarea {
  background: rgba(255,255,255,0.04);
  color: #eef6ff;
  border: 1px solid rgba(255,255,255,0.06);
}
.theme-dark select {
  background: rgba(255,255,255,0.12);
  color: #15222b;
  border: 1px solid rgba(255,255,255,0.16);
}
.theme-dark select option {
  color: #15222b !important;
  background: #ffffff !important;
  -webkit-text-fill-color: #15222b !important;
}
.theme-dark input::placeholder, .theme-dark textarea::placeholder { color: rgba(238,246,255,0.32); }
.theme-dark .btn-login { box-shadow: 0 8px 26px rgba(0,0,0,0.38); }
.theme-dark .btn-admin { background: linear-gradient(135deg, #ffb347, #ffcc33); color: #152620; }
.theme-dark .btn-user { background: linear-gradient(135deg, #4dabf7, #2f80ed); color: #fff; }
.theme-dark .btn-logout { background: rgba(255,255,255,0.06); color: #fff; border-color: rgba(255,255,255,0.08); }
.theme-dark #fichas-table.dataTable thead th { background: rgba(255,255,255,0.02); color: rgba(238,246,255,0.9); }
.theme-dark #fichas-table.dataTable tbody td { color: rgba(238,246,255,0.92); border-bottom: 1px solid rgba(255,255,255,0.02); }
.theme-dark .dataTables_wrapper .dataTables_filter input, .theme-dark .dataTables_wrapper .dataTables_length select, .theme-dark .dt-buttons button { background: rgba(255,255,255,0.04); color: #eef6ff; border-color: rgba(255,255,255,0.04); }
.theme-dark .ficha-card { background: rgba(255,255,255,0.02); border-color: rgba(255,255,255,0.03); }
