:root {
  --ink: #16332d;
  --muted: #70807a;
  --green: #235b46;
  --bg: #f4f6f2;
  --line: #dfe5dd;
  --gold: #dff28a;
  --red: #a13e32;
  font-family:
    Inter,
    Segoe UI,
    Arial,
    sans-serif;
  color: var(--ink);
  font-size: 14px;
}
* {
  box-sizing: border-box;
}
body {
  margin: 0;
  background: var(--bg);
}
button,
input,
select,
textarea {
  font: inherit;
}
button,
a,
input,
select,
textarea {
  outline-offset: 4px;
}
button {
  cursor: pointer;
}
button:disabled {
  cursor: wait;
  opacity: 0.5;
}
a {
  color: var(--green);
}
button {
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  padding: 11px 16px;
  color: var(--ink);
  font-weight: 600;
  transition: background 0.15s;
}
button:hover {
  background: #eaf0e7;
}
.primary {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.primary:hover {
  background: #173e30;
}
.danger {
  color: var(--red);
}
.ghost {
  background: transparent;
}
.small {
  padding: 7px 10px;
  font-size: 12px;
}
.shell {
  display: grid;
  grid-template-columns: 236px 1fr;
  min-height: 100vh;
}
.sidebar {
  background: #122c28;
  color: #eaf1e9;
  padding: 32px 20px;
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.brand {
  font-size: 25px;
  letter-spacing: -1px;
  font-weight: 750;
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  display: inline-grid;
  place-items: center;
  width: 35px;
  height: 35px;
  border-radius: 10px;
  background: var(--gold);
  color: #122c28;
  font-size: 23px;
}
.brand small {
  font-size: 10px;
  letter-spacing: 2px;
  display: block;
  font-weight: 400;
  margin-top: 4px;
  color: #a4b8ae;
}
.workspace {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.8px;
  color: #8da79c;
  margin: 45px 13px 14px;
}
nav {
  display: grid;
  gap: 7px;
}
nav button {
  text-align: left;
  border: 0;
  color: #bbccc3;
  background: transparent;
  padding: 13px 15px;
  font-weight: 500;
}
nav button.active {
  background: #2c473d;
  color: var(--gold);
}
nav button:hover {
  background: #243d34;
}
nav .ico {
  display: inline-block;
  width: 27px;
  font-size: 17px;
}
.side-bottom {
  margin-top: auto;
  border-top: 1px solid #355047;
  padding: 22px 10px 0;
}
.side-bottom small {
  display: block;
  color: #9db2a7;
  margin: 7px 0 15px;
}
.side-bottom button {
  color: #c5d5ca;
  border-color: #355047;
}
.main {
  min-width: 0;
}
.topbar {
  height: 81px;
  border-bottom: 1px solid var(--line);
  padding: 0 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #fafbf8;
}
.topbar span {
  font-size: 12px;
  color: var(--muted);
}
.avatar {
  background: #e4eadc;
  color: var(--green);
  width: 33px;
  height: 33px;
  border-radius: 50%;
  display: inline-grid;
  place-items: center;
  font-weight: 700;
}
.content {
  max-width: 1450px;
  margin: auto;
  padding: 37px 42px 60px;
}
.eyebrow {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 2px;
  color: var(--green);
  text-transform: uppercase;
}
h1 {
  font-size: 31px;
  letter-spacing: -1.2px;
  margin: 9px 0 10px;
  font-weight: 650;
}
h2 {
  font-size: 18px;
  letter-spacing: -0.4px;
  margin: 0 0 8px;
}
h3 {
  font-size: 15px;
  margin: 0;
}
p {
  line-height: 1.65;
}
.muted {
  color: var(--muted);
}
.page-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  margin-bottom: 29px;
}
.page-head p {
  margin: 0;
  color: var(--muted);
}
.card {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 14px;
  padding: 24px;
}
.stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin: 25px 0;
}
.stat {
  position: relative;
  min-height: 137px;
}
.stat:first-child {
  background: #eaf0dd;
}
.stat label {
  display: block;
  color: #65765e;
  font-size: 12px;
}
.stat strong {
  font-size: 31px;
  font-weight: 650;
  letter-spacing: -1px;
  display: block;
  margin: 17px 0 8px;
}
.stat small {
  color: var(--muted);
}
.stat-icon {
  position: absolute;
  right: 20px;
  top: 19px;
  font-size: 19px;
  color: var(--green);
}
.banner {
  background: #e9eee2;
  border: 1px solid #dce5d4;
  border-radius: 14px;
  padding: 28px 30px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  margin-bottom: 25px;
}
.banner p {
  margin: 6px 0 0;
  color: #66745c;
}
.banner h2 {
  font-size: 23px;
}
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 20px;
}
.table-wrap {
  overflow: auto;
}
table {
  width: 100%;
  border-collapse: collapse;
  white-space: nowrap;
}
th {
  text-align: left;
  color: #7b877e;
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
  background: #f7f9f4;
  padding: 14px 12px;
  font-weight: 650;
}
td {
  padding: 16px 12px;
  border-bottom: 1px solid #edf0e9;
  font-size: 13px;
}
tr:last-child td {
  border: 0;
}
td.name {
  white-space: normal;
  min-width: 170px;
}
.right {
  text-align: right;
}
.badge {
  font-size: 10px;
  border-radius: 5px;
  display: inline-block;
  padding: 5px 8px;
  background: #edf3e7;
  color: #456c3e;
}
.badge.off {
  background: #f3eae5;
  color: #9c6650;
}
.badge.tax {
  background: #edf0f6;
  color: #647390;
}
.number {
  font-variant-numeric: tabular-nums;
}
.empty {
  padding: 45px 20px;
  text-align: center;
  color: var(--muted);
  white-space: normal;
}
.toolbar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  align-items: center;
  flex-wrap: wrap;
}
.toolbar input {
  max-width: 360px;
}
.toolbar label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
}
input,
select,
textarea {
  border: 1px solid #d9e1d6;
  border-radius: 8px;
  padding: 11px 12px;
  width: 100%;
  background: #fff;
  color: var(--ink);
  min-width: 0;
}
input:focus,
select:focus,
textarea:focus {
  outline: 2px solid #b8cead;
}
input[type="checkbox"] {
  width: auto;
  accent-color: var(--green);
}
label.field {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 17px;
}
.full {
  grid-column: 1/-1;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 25px;
}
.check {
  display: flex;
  gap: 9px;
  align-items: center;
  font-weight: 400 !important;
}
.invoice-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 305px;
  gap: 22px;
  align-items: start;
}
.invoice-grid .card {
  margin-bottom: 20px;
}
.step {
  display: inline-grid;
  place-items: center;
  width: 24px;
  height: 24px;
  border: 1px solid #cbd8bc;
  border-radius: 50%;
  margin-right: 8px;
  font-size: 12px;
  color: var(--green);
}
.summary {
  position: sticky;
  top: 20px;
}
.summary h2 {
  margin-bottom: 25px;
}
.summary-row {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  margin: 17px 0;
  font-size: 12px;
  color: #65736a;
}
.summary-row.total {
  border-top: 1px dashed #cbd6c5;
  padding-top: 20px;
  margin-top: 22px;
  align-items: center;
  color: var(--ink);
  font-weight: 600;
}
.total strong {
  font-size: 27px;
}
.summary .primary {
  width: 100%;
  margin-top: 12px;
}
.note {
  font-size: 11px;
  color: var(--muted);
  line-height: 1.65;
}
.catalog {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  max-height: 310px;
  overflow: auto;
}
.product {
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.product small {
  display: block;
  color: var(--muted);
  font-size: 10px;
  margin: 6px 0;
}
.product strong {
  font-size: 13px;
}
.product button {
  padding: 7px 11px;
}
.qty {
  width: 70px;
  padding: 7px;
}
.remove {
  border: 0;
  color: #aa6655;
  padding: 5px 9px;
  background: transparent;
}
dialog {
  width: min(620px, calc(100% - 30px));
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px;
  color: var(--ink);
  max-height: 90vh;
}
dialog::backdrop {
  background: #122c2870;
  backdrop-filter: blur(3px);
}
dialog h2 {
  margin-bottom: 22px;
}
#toast {
  position: fixed;
  bottom: 25px;
  left: 50%;
  transform: translateX(-50%);
  background: #16382c;
  color: white;
  padding: 13px 22px;
  border-radius: 10px;
  box-shadow: 0 8px 30px #0002;
  max-width: 90%;
  z-index: 20;
  display: none;
}
#toast.error {
  background: #8e352d;
}
.login {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 1.15fr 1fr;
}
.login-art {
  padding: 60px 70px;
  background: #122c28;
  color: white;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  overflow: hidden;
  position: relative;
}
.login-art h1 {
  font-size: 57px;
  line-height: 1.12;
  max-width: 500px;
  font-weight: 500;
}
.login-art p {
  color: #adbdac;
  max-width: 400px;
  font-size: 16px;
}
.login-art .eyebrow {
  color: var(--gold);
}
.login-art footer {
  color: #a2b39f;
  font-size: 11px;
}
.login-panel {
  display: grid;
  place-items: center;
  padding: 35px;
}
.login-panel form {
  width: 100%;
  max-width: 350px;
}
.login-panel h2 {
  font-size: 30px;
}
.login-panel .field {
  margin-top: 20px;
}
.login-panel .primary {
  width: 100%;
  margin-top: 25px;
}
.login-symbol {
  font-size: 130px;
  line-height: 1;
  color: var(--gold);
  position: absolute;
  right: 35px;
  bottom: 60px;
  opacity: 0.14;
}
.error-text {
  color: var(--red);
  font-size: 13px;
  margin-top: 17px;
  line-height: 1.6;
}
.loading {
  padding: 60px;
  text-align: center;
  color: var(--muted);
}
.pdf {
  width: 100%;
  height: 70vh;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: white;
}
.success {
  display: flex;
  align-items: center;
  gap: 12px;
}
.success-mark {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  background: #e7efdc;
  border-radius: 50%;
  font-size: 20px;
}
.link-button {
  text-decoration: none;
  display: inline-block;
  padding: 11px 16px;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: white;
  font-weight: 600;
  font-size: 13px;
}
.details-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 25px;
  margin: 25px 0;
}
.details-info p {
  font-size: 12px;
  margin: 4px 0;
}
.split {
  display: grid;
  grid-template-columns: 1.5fr 1fr;
  gap: 20px;
}
.hint {
  padding: 15px;
  background: #f4f6ef;
  border-radius: 8px;
  font-size: 12px;
  line-height: 1.8;
}
.inline-error {
  color: var(--red);
  font-size: 12px;
  margin-top: 15px;
}
button:focus-visible,
a:focus-visible {
  outline: 3px solid #a3c377;
}
@media (min-width: 1500px) {
  .content {
    padding-top: 50px;
  }
}
@media (max-width: 1050px) {
  .sidebar {
    padding: 25px 12px;
  }
  .shell {
    grid-template-columns: 195px 1fr;
  }
  .content {
    padding: 25px;
  }
  .topbar {
    padding: 0 25px;
  }
  .invoice-grid {
    grid-template-columns: 1fr;
  }
  .summary {
    position: static;
  }
  .catalog {
    grid-template-columns: 1fr 1fr;
  }
  .login-art {
    padding: 45px;
  }
  .login-art h1 {
    font-size: 43px;
  }
}
@media (max-width: 700px) {
  .shell {
    display: block;
  }
  .sidebar {
    position: static;
    height: auto;
    padding: 17px;
  }
  .brand {
    font-size: 21px;
  }
  .workspace,
  .side-bottom {
    display: none;
  }
  nav {
    display: flex;
    overflow: auto;
    margin-top: 20px;
    gap: 3px;
  }
  nav button {
    white-space: nowrap;
    padding: 10px;
    font-size: 11px;
  }
  nav .ico {
    display: none;
  }
  .topbar {
    height: 60px;
    padding: 0 20px;
  }
  .content {
    padding: 25px 17px;
  }
  .page-head {
    align-items: flex-start;
  }
  h1 {
    font-size: 26px;
  }
  .stats {
    grid-template-columns: 1fr;
    gap: 10px;
  }
  .stat {
    min-height: 100px;
    padding: 18px;
  }
  .stat strong {
    font-size: 25px;
    margin: 10px 0;
  }
  .banner {
    padding: 22px;
    align-items: flex-start;
  }
  .banner h2 {
    font-size: 19px;
  }
  .banner button {
    font-size: 12px;
  }
  .card {
    padding: 18px;
  }
  .form-grid,
  .split,
  .catalog {
    grid-template-columns: 1fr;
  }
  .login {
    display: block;
  }
  .login-art {
    padding: 25px;
  }
  .login-art > div:not(.brand),
  .login-art footer,
  .login-symbol {
    display: none;
  }
  .login-panel {
    padding: 50px 25px;
  }
  .details-info {
    grid-template-columns: 1fr;
  }
  .toolbar input {
    max-width: none;
  }
  .page-head .actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  .topbar .user-name {
    display: none;
  }
}

/* Botón para mostrar u ocultar la contraseña del login. */
.password-field {
  display: grid;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
}
.password-control {
  position: relative;
}
.password-control input {
  padding-right: 52px;
}
.password-toggle {
  position: absolute;
  right: 3px;
  top: 2px;
  bottom: 2px;
  width: 42px;
  padding: 0;
  display: grid;
  place-items: center;
  border: 0;
  background: transparent;
  color: var(--green);
}
.password-toggle:hover {
  background: #eaf0e7;
}
.password-toggle .eye-slash {
  display: none;
}
.password-toggle.is-visible .eye-slash {
  display: block;
}
.password-control input::-ms-reveal {
  display: none;
}

/* Búsqueda de clientes y catálogo de cuatro productos por página. */
.customer-search-field {
  flex: 1;
  min-width: 220px;
}
.toolbar .customer-search-field input {
  max-width: none;
}
#catalog {
  height: 250px;
  max-height: 250px;
  overflow-y: auto;
  align-content: start;
  scrollbar-gutter: stable;
}
#catalog .product {
  min-height: 110px;
  min-width: 0;
}
#catalog .product > div {
  min-width: 0;
  overflow-wrap: anywhere;
}
#catalog .product button {
  flex-shrink: 0;
}
#catalog .empty {
  grid-column: 1/-1;
}
.catalog-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}
.catalog-page-buttons {
  display: flex;
  gap: 8px;
}
.catalog-page-buttons button:disabled {
  cursor: default;
}
@media (max-width: 700px) {
  .customer-search-field {
    min-width: 0;
    width: 100%;
    flex-basis: 100%;
  }
}

/* Navegación agrupada y ancho flexible en formularios, pedidos y listas. */
.sidebar {
  overflow-y: auto;
}
.menu-toggle {
  display: none;
}
.menu-toggle:hover {
  background: #355447;
}
.pdf-viewer .toolbar button {
  padding: 9px;
  font-size: 12px;
}
.nav-group {
  min-width: 0;
  border-bottom: 1px solid #355047;
  padding: 5px 0;
}
.nav-group summary {
  cursor: pointer;
  padding: 13px 15px;
  color: #eaf1e9;
  font-weight: 600;
}
.nav-group > div {
  display: grid;
  padding-left: 12px;
}
.nav-group button {
  font-size: 12px;
  white-space: normal;
}
.nav-group summary:focus-visible {
  outline: 3px solid var(--gold);
}
nav {
  margin-top: 24px;
}
.side-bottom {
  margin-top: 24px;
}
.invoice-grid > *,
.card,
.split > *,
.form-grid > *,
.details-info > *,
.page-head > *,
.banner > * {
  min-width: 0;
}
.content {
  overflow-wrap: anywhere;
}
.invoice-grid {
  grid-template-columns: minmax(0, 1fr) minmax(0, 305px);
}
.pdf-viewer {
  width: 100%;
  min-width: 0;
  margin-top: 20px;
}
.pdf-viewer canvas {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
}
.pdf-viewer .toolbar {
  justify-content: space-between;
}
.report-grid {
  display: grid;
  gap: 20px;
}
.report-grid .toolbar {
  margin: 20px 0 0;
}
.account-form {
  max-width: 850px;
}
#import-form {
  margin-top: 24px;
}
pre {
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  background: var(--bg);
  padding: 16px;
  border-radius: 8px;
  font-size: 12px;
}
@media (max-width: 1050px) {
  .invoice-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
@media (max-width: 700px) {
  .sidebar {
    overflow: visible;
    display: block;
  }
  .menu-toggle {
    display: block;
    width: 100%;
    margin-top: 16px;
    text-align: left;
    background: #2c473d;
    color: var(--gold);
    border-color: #355047;
    min-height: 44px;
  }
  #main-nav {
    display: none;
    overflow: visible;
    margin-top: 12px;
  }
  #main-nav.mobile-open {
    display: grid;
  }
  #main-nav button {
    white-space: normal;
    min-height: 44px;
    font-size: 14px;
    text-align: left;
    width: 100%;
  }
  .nav-group > div {
    padding-left: 16px;
  }
  .nav-group summary {
    min-height: 44px;
  }
  .page-head,
  .banner {
    flex-direction: column;
    align-items: stretch;
  }
  .card-head,
  .form-actions {
    flex-wrap: wrap;
  }
  .form-actions button {
    flex: 1;
  }
  .table-wrap {
    overflow: visible;
  }
  table,
  tbody,
  tr,
  td {
    display: block;
    width: 100%;
    white-space: normal;
  }
  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    clip-path: inset(50%);
    overflow: hidden;
  }
  tbody tr {
    padding: 12px 0;
    border-bottom: 1px solid var(--line);
  }
  td,
  td.name {
    min-width: 0;
    padding: 8px 0;
    border: 0;
    text-align: left;
    overflow-wrap: anywhere;
  }
  td[data-label] {
    display: grid;
    grid-template-columns: minmax(0, 90px) minmax(0, 1fr);
    column-gap: 12px;
  }
  td[data-label]::before {
    content: attr(data-label);
    font-size: 11px;
    font-weight: 600;
    color: var(--muted);
    grid-column: 1;
    grid-row: 1 / span 8;
  }
  td[data-label] > * {
    grid-column: 2;
    max-width: 100%;
  }
  td[data-label] br {
    display: none;
  }
  td[data-label="Acciones"] {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }
  td[data-label="Acciones"]::before {
    display: none;
  }
  td button {
    min-height: 44px;
  }
  .qty {
    width: 100%;
    max-width: 110px;
    min-height: 44px;
  }
  .topbar {
    padding: 0 17px;
    gap: 10px;
  }
  dialog {
    padding: 20px;
    max-width: calc(100% - 24px);
  }
}
/* Acciones claras, resultados de búsqueda y proveedores. */
.danger-button,
.remove.danger-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  color: #a52929;
  background: #fff0f0;
  border: 1px solid #e6aaaa;
  border-radius: 9px;
  padding: 11px 18px;
  font-weight: 650;
  min-height: 44px;
}
.danger-button:hover,
.remove.danger-button:hover {
  background: #fbdcdc;
  color: #842020;
}
.cart-remove-cell {
  text-align: center;
}
.customer-search-field {
  margin-top: 20px;
}
.customer-matches {
  margin: 10px 0;
  border: 1px solid var(--line);
  border-radius: 9px;
  background: #f8fbf5;
  padding: 12px;
}
.customer-matches summary {
  cursor: pointer;
  color: var(--green);
  font-weight: 600;
  min-height: 24px;
}
.customer-option {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 5px;
  width: 100%;
  margin-top: 8px;
  text-align: left;
  overflow-wrap: anywhere;
  white-space: normal;
}
.customer-option span {
  font-size: 12px;
  color: var(--muted);
}
.customer-actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  margin: 16px 0;
}
.selected-customer {
  background: #eef5e8;
  padding: 14px;
  border-radius: 9px;
  overflow-wrap: anywhere;
}
.selected-customer p {
  margin: 5px 0;
  font-size: 12px;
}
.customer-result,
.supplier-card {
  padding: 18px;
  background: #eff6eb;
  border: 1px solid #d4e2cc;
  border-left: 4px solid #448659;
  border-radius: 10px;
  margin: 14px 0;
  overflow-wrap: anywhere;
}
.customer-result h3,
.supplier-card h2,
.report-grid h2 {
  color: #18532f;
}
.customer-result p {
  font-size: 13px;
}
.supplier-card .toolbar {
  margin: 16px 0 0;
}
.supplier-card summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--green);
  padding: 10px 0;
}
.supplier-filter {
  margin-bottom: 18px;
}
.report-grid .card {
  background: #edf5e8;
  border-left: 5px solid #448659;
}
@media (max-width: 700px) {
  #cart-table td.cart-remove-cell {
    display: flex;
    justify-content: center;
    width: 100%;
    padding: 14px 0;
  }
  #cart-table td.cart-remove-cell::before {
    display: none;
  }
  .customer-actions {
    align-items: stretch;
  }
  .customer-actions .small {
    align-self: flex-start;
  }
}
