:root {
  --color-primary-green: #4E8A24;
  --color-accent-orange: #FA4105;
  --color-brand-blue: #09089C;
  --color-bg-light: #F4F6F9;
  --color-card-bg: #FFFFFF;
  --color-text-dark: #1E293B;
  --color-border: #CBD5E1;
  --color-status-normal: #4E8A24;
  --color-status-abnormal: #FA4105;
  --radius-card: 18px;
  --shadow-soft: 0 18px 45px rgba(16, 24, 40, 0.08);
  --max-page-width: 1300px;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: linear-gradient(180deg, #F4F6F9 0%, #FFFFFF 100%);
  color: var(--color-text-dark);
}

img {
  max-width: 100%;
  display: block;
}

button, input, select, textarea {
  font: inherit;
}

body {
  min-height: 100vh;
}

.login-entry {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
}

.auth-page {
  width: 100%;
  min-height: 100vh;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 0;
  background: #f4f6f9;
}

.entry-frame {
  width: 402px;
  height: 874px;
  display: block;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.08);
  border-radius: 18px;
  overflow: hidden;
  background: #ffffff;
}

.entry-content {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 18px 18px 24px;
  box-sizing: border-box;
}

.entry-logo {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.entry-form {
  width: 100%;
  display: grid;
  gap: 16px;
}

.entry-form input {
  width: 100%;
  height: 56px;
  border: 2px solid rgba(0, 0, 0, 0.16);
  border-radius: 999px;
  padding: 0 20px;
  font-size: 1rem;
  outline: none;
  background: #ffffff;
}

.entry-form input::placeholder {
  color: rgba(0, 0, 0, 0.45);
}

.login-button {
  width: 100%;
  padding: 16px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  background: #08059a;
  color: #ffffff;
  border: none;
}

.create-account-button {
  width: 100%;
  padding: 15px 20px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 1rem;
  background: #ffffff;
  color: #08059a;
  border: 2px solid rgba(0, 0, 0, 0.3);
}

.feedback {
  color: var(--color-accent-orange);
  font-size: 0.95rem;
  margin-top: 0;
}

.hidden {
  display: none !important;
}

.brand-header,
.app-header {
  background: var(--color-brand-blue);
  color: #FFFFFF;
  padding: 24px 20px;
}

/* Force viewport/card size to match requested design and hide any overflow */
html, body {
  height: 874px;
  width: 402px;
  margin: 0 auto;
  overflow: hidden;
}

/* Center the card within the constrained viewport */
.login-entry {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
}

.brand-header {
  text-align: center;
}

.brand-logo {
  display: flex;
  gap: 16px;
  align-items: center;
  max-width: var(--max-page-width);
  margin: 0 auto;
}

.brand-logo img {
  width: 60px;
  height: 60px;
  object-fit: contain;
  background: #FFF;
  border-radius: 14px;
  padding: 8px;
}

.brand-logo h1,
.brand-logo h2,
.brand-logo p {
  margin: 0;
}

.brand-logo h1,
.app-header h1 {
  font-size: 1.4rem;
}

.brand-logo p,
.app-header p {
  color: #E2E8F0;
  font-size: 0.95rem;
}

.app-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}

.top-nav {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 12px;
}

.nav-link,
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 999px;
  padding: 12px 18px;
  text-decoration: none;
  color: #FFFFFF;
  cursor: pointer;
}

.button-secondary {
  background: rgba(255,255,255,0.16);
}

.button-primary {
  background: var(--color-primary-green);
}

.page-shell {
  width: min(1200px, calc(100% - 32px));
  margin: 24px auto;
  padding: 0 16px;
  display: grid;
  gap: 24px;
}

.page-auth {
  align-items: stretch;
}

.auth-card,
.auth-info,
.card,
.panel {
  background: var(--color-card-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius-card);
  box-shadow: var(--shadow-soft);
  padding: 24px;
}

.panel-header,
.card .panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
}

.auth-card h2,
.card h2,
.panel h2,
.kpi-card h3,
.chart-card h3,
.modal-content h3 {
  margin-top: 0;
}

.form-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.table-responsive {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

input, select, textarea {
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--color-border);
  background: #FFFFFF;
  color: var(--color-text-dark);
  padding: 14px 16px;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--color-primary-green);
  box-shadow: 0 0 0 4px rgba(78, 138, 36, 0.12);
}

textarea {
  resize: vertical;
}

label {
  font-weight: 600;
}

.full-width {
  grid-column: 1 / -1;
}

.actions,
.actions-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  align-items: center;
}

.actions-row {
  justify-content: flex-end;
}

.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 20px;
}

.tab-button {
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 10px 18px;
  cursor: pointer;
  color: var(--color-text-dark);
  transition: all 0.2s ease;
}

.tab-button.active,
.tab-button:hover {
  background: var(--color-primary-green);
  color: #ffffff;
  border-color: transparent;
}

.tab-panel.hidden {
  display: none;
}

.detail-row {
  margin-bottom: 10px;
  line-height: 1.5;
}

.vasos-list {
  display: grid;
  gap: 6px;
  margin-top: 10px;
  padding: 14px;
  background: #f8fafc;
  border: 1px solid var(--color-border);
  border-radius: 16px;
}

.vasos-list span {
  display: inline-block;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid rgba(203, 213, 225, 0.8);
  border-radius: 12px;
}

.modal-content {
  width: min(700px, 100%);
  padding: 24px;
}

.feedback {
  margin-top: 12px;
  min-height: 1.3rem;
  color: var(--color-accent-orange);
}

.card-secondary {
  border-color: rgba(250,65,5,0.12);
}

.card-primary {
  border-color: rgba(78,138,36,0.16);
}

.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.grid-3 {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
}

.fieldset-inline {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  border: 1px solid var(--color-border);
  border-radius: 18px;
  padding: 16px;
}

.fieldset-inline legend {
  padding: 0 8px;
  font-weight: 700;
}

.fieldset-inline label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
}

.nominal-values {
  display: grid;
  gap: 12px;
}

.note {
  color: var(--color-brand-blue);
  font-weight: 600;
}

.table-responsive {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  min-width: 100%;
}

.data-table th,
.data-table td {
  text-align: left;
  padding: 14px 12px;
  border-bottom: 1px solid var(--color-border);
  vertical-align: middle;
}

.data-table thead {
  background: rgba(9,8,156,0.08);
}

.data-table tbody tr:hover {
  background: rgba(78,138,36,0.06);
}

.data-table input {
  border: 1px solid var(--color-border);
}

.row-outside-range {
  border: 2px solid var(--color-accent-orange);
}

.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(180px, 1fr));
  gap: 18px;
}

.kpi-card {
  padding: 24px;
}

.kpi-card p {
  font-size: 2rem;
  margin: 12px 0 0;
}

.graph-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.chart-card {
  padding: 18px;
}

.bar-graph {
  display: grid;
  gap: 14px;
  margin-top: 14px;
}

.bar-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 16px;
  align-items: center;
}

.bar-track {
  height: 18px;
  border-radius: 999px;
  background: var(--color-border);
  overflow: hidden;
}

.bar-fill {
  height: 100%;
  border-radius: 999px;
  background: var(--color-primary-green);
}

.user-table button {
  border: none;
  background: transparent;
  cursor: pointer;
  color: var(--color-brand-blue);
  font-weight: 700;
}

.modal {
  position: fixed;
  inset: 0;
  background: rgba(30,41,59,0.55);
  display: none;
  align-items: center;
  justify-content: center;
  padding: 20px;
  z-index: 50;
}

.modal.active {
  display: flex;
}

.modal-content {
  width: min(600px, 100%);
  position: relative;
}

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  border: none;
  background: transparent;
  color: var(--color-text-dark);
  font-size: 1.6rem;
  cursor: pointer;
}

.hidden {
  display: none !important;
}

@media (max-width: 1024px) {
  .page-shell {
    gap: 20px;
  }
  .grid-3,
  .kpi-grid,
  .graph-grid,
  .grid-2 {
    grid-template-columns: 1fr;
  }
  .app-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .top-nav {
    width: 100%;
    justify-content: flex-start;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 520px) {
  .brand-logo {
    flex-direction: column;
    align-items: flex-start;
  }
  .brand-logo img {
    width: 52px;
    height: 52px;
  }
  .top-nav {
    gap: 10px;
  }
  .button,
  .nav-link {
    width: 100%;
  }
  .actions-row {
    flex-direction: column;
    align-items: stretch;
  }
  .fieldset-inline {
    flex-direction: column;
    gap: 8px;
  }
  .fieldset-inline legend {
    margin-bottom: 8px;
  }
  .panel,
  .card,
  .auth-card,
  .auth-info {
    padding: 18px;
  }
}
