:root {
  --bg: #f5f7f8;
  --surface: #ffffff;
  --surface-soft: #eef4f3;
  --text: #1f2933;
  --muted: #5f6f7a;
  --line: #d9e1e5;
  --primary: #0f5f59;
  --primary-strong: #0a4844;
  --navy: #17324d;
  --gold: #c99b2e;
  --danger: #b42318;
  --warning: #a15c07;
  --success: #18794e;
  --radius: 8px;
  --shadow: 0 16px 40px rgba(23, 50, 77, .08);
  font-family: Inter, "Segoe UI", Roboto, Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

a {
  color: inherit;
}

.login-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(340px, 460px);
}

.login-identity {
  position: relative;
  display: flex;
  align-items: center;
  padding: 48px clamp(28px, 6vw, 84px);
  color: var(--navy);
  background: #fff;
  overflow: hidden;
}

.login-identity::before {
  content: "";
  position: absolute;
  top: clamp(18px, 4vw, 52px);
  right: clamp(8px, 3vw, 40px);
  width: min(70vw, 980px);
  height: min(34vw, 360px);
  background: url("assets/servitaxi-tenesur.svg") right top / contain no-repeat;
  opacity: .24;
  pointer-events: none;
}

.login-identity::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 12px;
  background: linear-gradient(90deg, var(--gold), #ffffff, var(--primary));
}

.identity-copy {
  position: relative;
  z-index: 1;
  max-width: 690px;
}

.login-logos {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 24px;
  flex-wrap: wrap;
}

.identity-copy img {
  width: 112px;
  height: 126px;
  object-fit: contain;
  filter: drop-shadow(0 18px 28px rgba(23, 50, 77, .14));
}

.identity-copy h1 {
  margin: 0 0 18px;
  font-size: clamp(2rem, 4vw, 4.4rem);
  line-height: 1.02;
  letter-spacing: 0;
}

.identity-copy p {
  max-width: 620px;
  margin: 0;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.65;
}

.login-panel {
  display: flex;
  align-items: center;
  padding: 32px;
  background: var(--surface);
}

.auth-box {
  width: 100%;
}

.auth-box h2,
.auth-box p {
  margin-top: 0;
}

.auth-box p {
  color: var(--muted);
  line-height: 1.55;
}

.demo-access {
  margin-top: 20px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  color: var(--muted);
}

.remember-login {
  display: flex;
  align-items: center;
  gap: 9px;
  margin: 12px 0 8px;
  color: var(--navy);
  font-weight: 650;
}

.remember-login input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.login-hint {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: .88rem;
}

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 282px minmax(0, 1fr);
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid #161b22;
  background: #05070a;
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 22px;
  border-bottom: 1px solid #1f2933;
}

.brand img {
  width: 64px;
  height: 74px;
  object-fit: contain;
  flex: 0 0 auto;
}

.brand strong {
  display: block;
  color: #f8fafc;
  line-height: 1.18;
}

.brand span {
  display: block;
  margin-top: 4px;
  color: #a8b3bd;
  font-size: .83rem;
}

.nav {
  display: grid;
  gap: 4px;
  padding: 16px 12px;
}

.nav button,
.mobile-nav button {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 42px;
  padding: 10px 12px;
  border-radius: var(--radius);
  background: transparent;
  color: #b7c2cc;
  text-align: left;
}

.nav button.active,
.nav button:hover {
  background: #121923;
  color: #ffffff;
}

.mobile-nav button.active,
.mobile-nav button:hover {
  background: var(--surface-soft);
  color: var(--primary-strong);
}

.nav svg,
.mobile-nav svg,
.btn svg,
.icon-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}

.sidebar-footer {
  margin-top: auto;
  padding: 18px;
  border-top: 1px solid #1f2933;
  color: #a8b3bd;
  font-size: .88rem;
}

.sidebar-footer strong {
  color: #ffffff;
}

.main {
  min-width: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-height: 74px;
  padding: 14px clamp(18px, 3vw, 34px);
  border-bottom: 1px solid var(--line);
  background: rgba(245, 247, 248, .92);
  backdrop-filter: blur(12px);
}

.page-title h1 {
  margin: 0;
  color: var(--navy);
  font-size: clamp(1.45rem, 2vw, 2rem);
  letter-spacing: 0;
}

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

.content {
  padding: 24px clamp(18px, 3vw, 34px) 42px;
}

.mobile-nav {
  display: none;
  gap: 6px;
  overflow-x: auto;
  padding: 10px 18px;
  border-bottom: 1px solid var(--line);
  background: #fbfcfd;
}

.toolbar,
.form-actions,
.table-actions,
.row-actions,
.filters,
.inline-fields {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar {
  justify-content: space-between;
  margin-bottom: 18px;
}

.btn,
.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  padding: 9px 14px;
  background: var(--primary);
  color: #fff;
  font-weight: 650;
}

.btn.secondary,
.icon-btn.secondary {
  background: var(--surface);
  border-color: var(--line);
  color: var(--navy);
}

.btn.danger {
  background: var(--danger);
}

.icon-btn {
  width: 40px;
  padding: 0;
}

.btn:disabled {
  opacity: .55;
  cursor: not-allowed;
}

.grid {
  display: grid;
  gap: 16px;
}

.stats-grid {
  grid-template-columns: repeat(4, minmax(150px, 1fr));
}

.two-col {
  grid-template-columns: minmax(0, 1.3fr) minmax(320px, .7fr);
  align-items: start;
}

.card,
.stat,
.table-panel,
.form-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

.stat {
  padding: 16px;
}

.stat span {
  color: var(--muted);
  font-size: .9rem;
}

.stat strong {
  display: block;
  margin-top: 8px;
  color: var(--navy);
  font-size: 1.9rem;
  line-height: 1;
}

.stat small {
  display: block;
  margin-top: 10px;
  color: var(--muted);
}

.card,
.form-panel {
  padding: 18px;
}

.card h2,
.form-panel h2,
.table-panel h2 {
  margin: 0 0 14px;
  color: var(--navy);
  font-size: 1.12rem;
}

.table-panel {
  overflow: hidden;
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--line);
}

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

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 760px;
}

th,
td {
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

th {
  color: var(--muted);
  font-size: .82rem;
  font-weight: 750;
  text-transform: uppercase;
}

td {
  color: var(--text);
}

tr:last-child td {
  border-bottom: 0;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  background: var(--surface-soft);
  color: var(--navy);
  font-size: .8rem;
  font-weight: 700;
  white-space: nowrap;
}

.badge.success {
  background: #e7f5ef;
  color: var(--success);
}

.badge.warning {
  background: #fff4df;
  color: var(--warning);
}

.badge.danger {
  background: #ffe9e6;
  color: var(--danger);
}

.badge.info {
  background: #e8f2ff;
  color: #175cd3;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.field {
  display: grid;
  gap: 6px;
}

.field.full {
  grid-column: 1 / -1;
}

.field label {
  color: var(--navy);
  font-size: .9rem;
  font-weight: 700;
}

.field input,
.field select,
.field textarea {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 9px 11px;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 112px;
  resize: vertical;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
  outline: 3px solid rgba(15, 95, 89, .16);
  border-color: var(--primary);
}

.section-title {
  grid-column: 1 / -1;
  margin: 10px 0 0;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  color: var(--primary-strong);
  font-weight: 800;
}

.empty {
  padding: 28px;
  color: var(--muted);
  text-align: center;
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 20;
  max-width: min(420px, calc(100vw - 40px));
  border-radius: var(--radius);
  padding: 13px 16px;
  background: var(--navy);
  color: #fff;
  box-shadow: 0 20px 45px rgba(0,0,0,.18);
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(31, 41, 51, .46);
}

.modal {
  width: min(980px, 100%);
  max-height: calc(100vh - 44px);
  overflow: auto;
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 25px 70px rgba(0,0,0,.25);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
}

.modal-header h2 {
  margin: 0;
  color: var(--navy);
}

.modal-body {
  padding: 18px;
}

.detail-list {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.detail-list div {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.detail-list .full {
  grid-column: 1 / -1;
}

.detail-list span {
  display: block;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: .78rem;
  text-transform: uppercase;
  font-weight: 750;
}

.history {
  display: grid;
  gap: 9px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.history li {
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.history li:last-child {
  border-bottom: 0;
}

.qr-grid,
.statement-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.qr-card,
.statement-panel,
.public-panel {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fbfcfd;
}

.qr-card {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 14px;
  padding: 12px;
}

.qr-box {
  width: 112px;
  height: 112px;
  display: grid;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #fff;
  color: var(--muted);
  font-size: .78rem;
  text-align: center;
}

.qr-box img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.qr-card h3,
.statement-panel h3 {
  margin: 0;
  color: var(--navy);
  font-size: 1rem;
}

.qr-card p {
  margin: 7px 0;
  color: var(--muted);
  line-height: 1.45;
}

.qr-card a {
  display: block;
  color: var(--primary);
  font-size: .8rem;
  overflow-wrap: anywhere;
}

.statement-panel {
  padding: 14px;
}

.statement-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}

.public-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: var(--bg);
}

.public-panel {
  width: min(820px, 100%);
  padding: 24px;
  box-shadow: var(--shadow);
}

.public-panel > img {
  width: 92px;
  height: 108px;
  object-fit: contain;
  display: block;
  margin-bottom: 16px;
}

.public-panel h1 {
  margin: 0 0 8px;
  color: var(--navy);
}

.public-panel p {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.55;
}

.notice {
  margin-bottom: 14px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.muted-note {
  background: #fff;
  color: var(--muted);
}

.hidden {
  display: none !important;
}

@media (max-width: 1020px) {
  .app-shell,
  .login-shell,
  .two-col {
    grid-template-columns: 1fr;
  }

  .login-identity {
    min-height: 42vh;
  }

  .sidebar {
    display: none;
  }

  .mobile-nav {
    display: flex;
  }

  .stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .qr-grid,
  .statement-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .topbar,
  .toolbar,
  .table-header {
    align-items: stretch;
    flex-direction: column;
  }

  .form-grid,
  .detail-list,
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .content {
    padding-inline: 14px;
  }

  .login-panel {
    padding: 24px 18px 34px;
  }

  .identity-copy img {
    width: 96px;
    height: 96px;
  }

  .qr-card {
    grid-template-columns: 1fr;
  }
}
