﻿:root {
  color-scheme: light;
  --ink: #111827;
  --muted: #667085;
  --line: #d8dee8;
  --panel: #ffffff;
  --bg: #f4f6f9;
  --brand: #0f766e;
  --brand-dark: #115e59;
  --warn: #b42318;
  --soft: #e8f4f2;
  --gold: #8a5b00;
  --sidebar: #0f172a;
  --sidebar-soft: #1e293b;
  --shadow: 0 12px 32px rgba(15, 23, 42, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-width: 320px;
  background: var(--bg);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

button,
input,
select {
  font: inherit;
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  gap: 26px;
  padding: 26px 18px;
  background: var(--sidebar);
  color: #ffffff;
}

.brand-block {
  padding: 4px 8px 18px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-block .eyebrow {
  color: #99f6e4;
}

.brand-block h1 {
  max-width: none;
  color: #ffffff;
  font-size: 24px;
}

.workspace {
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  align-items: center;
  padding: 22px 28px;
  background: #ffffff;
  border-bottom: 1px solid var(--line);
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--brand-dark);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1,
h2 {
  margin: 0;
}

h1 {
  max-width: 720px;
  font-size: 28px;
  line-height: 1.18;
}

h2 {
  font-size: 18px;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: flex-end;
}

button,
.file-button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
  padding: 9px 13px;
  font-weight: 700;
}

.file-button,
.small-file-button {
  position: relative;
  display: inline-flex;
  align-items: center;
  background: var(--brand);
  color: #ffffff;
  border-color: var(--brand);
}

.small-file-button {
  justify-content: center;
  min-height: 38px;
  border: 1px solid var(--brand);
  border-radius: 6px;
  padding: 8px 11px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 700;
}

.file-button input,
.small-file-button input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

button:hover,
.file-button:hover {
  border-color: var(--brand);
}

button:disabled,
select:disabled,
input:disabled {
  cursor: not-allowed;
  opacity: 0.58;
}

button.danger {
  color: var(--warn);
}

main {
  width: 100%;
  margin: 0;
  padding: 24px 28px 36px;
}

.module-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.dashboard-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 10px;
}

.dashboard-filters label {
  display: grid;
  gap: 5px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.dashboard-filters input {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 8px 10px;
  background: #ffffff;
}

.dashboard-plates {
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.dashboard-table {
  margin-bottom: 0;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(160px, 1fr));
  gap: 12px;
  margin-bottom: 18px;
}

.summary-grid article {
  position: relative;
  overflow: hidden;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.summary-grid article::before {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  width: 4px;
  background: var(--brand);
}

.summary-grid span {
  display: block;
  color: var(--muted);
  font-size: 13px;
}

.summary-grid strong {
  display: block;
  margin-top: 6px;
  font-size: 22px;
  line-height: 1.16;
}

.tabs {
  display: grid;
  gap: 8px;
}

.tab {
  width: 100%;
  justify-content: flex-start;
  border: 1px solid transparent;
  border-radius: 8px;
  background: transparent;
  color: #cbd5e1;
  text-align: left;
}

.tab.active {
  background: var(--sidebar-soft);
  color: #ffffff;
  border-color: rgba(255, 255, 255, 0.12);
  box-shadow: inset 4px 0 0 var(--brand);
}

.tab:hover {
  border-color: rgba(255, 255, 255, 0.14);
  color: #ffffff;
}

.status {
  margin-bottom: 16px;
  padding: 12px 14px;
  border: 1px solid #b8dbd7;
  background: var(--soft);
  border-radius: 8px;
  color: var(--brand-dark);
}

.panel {
  display: none;
}

.panel.active {
  display: block;
}

.panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.panel-head input,
.panel-head select {
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  background: #ffffff;
}

.table-wrap {
  overflow: auto;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.plate-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px;
  border-bottom: 1px solid var(--line);
  background: #f8fbfb;
}

.plate-controls:empty {
  display: none;
}

.plate-controls label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 30px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #ffffff;
  color: #344054;
  font-size: 13px;
  font-weight: 700;
}

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

th,
td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

#invoices th:first-child,
#invoices td:first-child {
  min-width: 150px;
  white-space: nowrap;
}

th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: #475467;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  z-index: 1;
}

.sort-button {
  min-height: auto;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: inherit;
  text-transform: inherit;
  cursor: pointer;
}

.sort-button:hover {
  color: var(--brand-dark);
  border-color: transparent;
}

tbody tr:hover {
  background: #f8fbfb;
}

.money,
.number {
  text-align: right;
  white-space: nowrap;
}

.muted {
  margin-top: 4px;
  color: var(--warn);
  font-size: 12px;
  font-weight: 700;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

.badge.paid {
  background: #dcfce7;
  color: #166534;
}

.badge.pending {
  background: #fff7d6;
  color: var(--gold);
}

.payment-layout {
  display: grid;
  grid-template-columns: minmax(280px, 360px) 1fr;
  gap: 16px;
  align-items: start;
}

.payment-head-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.payment-tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fafc;
}

.payment-tab {
  min-height: 34px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
}

.payment-tab.active {
  background: #ffffff;
  color: var(--brand-dark);
  box-shadow: 0 1px 4px rgba(15, 23, 42, 0.12);
}

.payment-export-actions {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 8px;
}

.payment-export-actions button {
  min-height: 42px;
  background: #ffffff;
  color: var(--brand-dark);
}

.payment-panel {
  display: none;
}

.payment-panel.active {
  display: block;
}

.payment-form {
  display: grid;
  gap: 12px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: var(--shadow);
}

.payment-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.payment-form input,
.payment-form select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 11px;
  color: var(--ink);
}

.payment-form button {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.payment-form input[readonly] {
  background: #eef4f6;
  color: #344054;
}

.import-tools {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}

.import-tools button {
  min-height: 38px;
  padding: 8px 11px;
  background: #ffffff;
  color: var(--brand-dark);
}

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

.delete {
  min-height: 32px;
  padding: 5px 9px;
  color: var(--warn);
}

.description {
  max-width: 560px;
  min-width: 340px;
}

@media (max-width: 900px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
    gap: 14px;
    padding: 18px;
  }

  .tabs {
    grid-template-columns: repeat(4, minmax(120px, 1fr));
    overflow-x: auto;
  }

  .topbar,
  .panel-head,
  .payment-layout,
  .payment-head-actions,
  .module-head {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }

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

  h1 {
    font-size: 23px;
  }
}

@media (max-width: 560px) {
  main,
  .topbar,
  .sidebar {
    padding-left: 14px;
    padding-right: 14px;
  }

  .summary-grid {
    grid-template-columns: 1fr;
  }

  .tabs {
    grid-template-columns: 1fr 1fr;
  }

  .actions {
    justify-content: stretch;
  }

  .actions > * {
    flex: 1 1 100%;
    justify-content: center;
    text-align: center;
  }

  .payment-tabs,
  .payment-export-actions {
    width: 100%;
  }

  .payment-tab,
  .payment-export-actions button {
    flex: 1;
  }
}
/* Modal factura */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.62);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 200;
  padding: 22px;
}

.modal-card {
  width: min(1120px, 100%);
  max-height: 92vh;
  overflow-y: auto;
  display: grid;
  gap: 16px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.24);
}

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

.modal-header h2 {
  margin-top: 2px;
  font-size: 26px;
}

.modal-subtitle {
  max-width: 760px;
  margin: 6px 0 0;
  color: var(--muted);
  font-size: 14px;
  font-weight: 700;
  line-height: 1.35;
}

.modal-close {
  flex: 0 0 auto;
  width: 38px;
  min-height: 38px;
  padding: 0;
  border-radius: 999px;
  color: var(--muted);
  font-size: 16px;
}

.modal-section {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 15px;
}

.modal-summary {
  background: #f8fbfb;
}

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

.modal-section-title h3 {
  margin: 0;
  color: #344054;
  font-size: 13px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

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

.modal-info-grid,
.modal-totals-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.modal-info-grid > div,
.modal-totals-grid > div {
  min-width: 0;
  display: grid;
  gap: 4px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: #ffffff;
}

.modal-info-grid strong,
.modal-totals-grid strong {
  overflow-wrap: anywhere;
  color: var(--ink);
  font-size: 15px;
}

.modal-label {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.modal-total-big {
  color: var(--brand-dark) !important;
  font-size: 20px !important;
}

.modal-payment-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(180px, 1fr));
  gap: 12px;
}

.modal-payment-card {
  display: grid;
  gap: 10px;
  padding: 13px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.modal-payment-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
}

.modal-payment-card dl {
  display: grid;
  gap: 7px;
  margin: 0;
}

.modal-payment-card dl > div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.modal-payment-card dt {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.modal-payment-card dd {
  margin: 0;
  font-weight: 800;
  white-space: nowrap;
}

.modal-payment-total {
  align-content: center;
  background: var(--soft);
  border-color: #b8dbd7;
}

.modal-payment-total strong {
  color: var(--brand-dark);
  font-size: 22px;
}

.modal-lines-table table {
  min-width: 980px;
}

.modal-lines-table th,
.modal-lines-table td {
  font-size: 13px;
}

@media (max-width: 900px) {
  .modal-card {
    padding: 16px;
  }

  .modal-two-col,
  .modal-payment-grid,
  .modal-info-grid,
  .modal-totals-grid {
    grid-template-columns: 1fr;
  }
}
/* Pantalla de acceso */
.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at top left, rgba(15, 118, 110, 0.14), transparent 34%),
    linear-gradient(135deg, #f4f6f9 0%, #e8f4f2 100%);
}

.login-card {
  width: min(420px, 100%);
  display: grid;
  gap: 16px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 24px 64px rgba(15, 23, 42, 0.16);
}

.login-card h1 {
  font-size: 25px;
}

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.login-card input {
  width: 100%;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
}

.login-card button {
  background: var(--brand);
  border-color: var(--brand);
  color: #ffffff;
}

.login-error {
  margin: 0;
  color: var(--warn);
  font-size: 13px;
  font-weight: 700;
}

[hidden] {
  display: none !important;
}
