:root {
  --bg: #f5f7fb;
  --surface: #ffffff;
  --surface-soft: #eef3f8;
  --ink: #1b2030;
  --muted: #6d7485;
  --line: #dfe5ee;
  --sidebar: #121521;
  --sidebar-2: #1a2031;
  --orange: #ff6b35;
  --green: #13a77b;
  --blue: #2f80ed;
  --purple: #7a5af8;
  --yellow: #f6b93b;
  --red: #e05252;
  --teal: #00a6a6;
  --shadow: 0 18px 45px rgba(29, 39, 67, 0.12);
  --radius: 8px;
  --radius-sm: 6px;
  --font: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  font-family: var(--font);
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.8), rgba(245, 247, 251, 0.95)),
    var(--bg);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 0;
  cursor: pointer;
}

button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible {
  outline: 3px solid rgba(47, 128, 237, 0.25);
  outline-offset: 2px;
}

.is-hidden {
  display: none !important;
}

.muted {
  color: var(--muted);
}

.eyebrow,
.mini-label {
  margin: 0 0 6px;
  color: var(--orange);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(320px, 1.1fr) minmax(320px, 0.9fr);
  background:
    radial-gradient(circle at 18% 12%, rgba(255, 107, 53, 0.22), transparent 30%),
    linear-gradient(135deg, #151926 0%, #23293b 52%, #f5f7fb 52%);
}

.login-hero {
  min-height: 100vh;
  padding: clamp(32px, 7vw, 82px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #ffffff;
}

.brand-mark {
  width: 62px;
  height: 62px;
  display: grid;
  place-items: center;
  margin-bottom: 28px;
  color: #ffffff;
  font-weight: 900;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--orange), var(--green));
  box-shadow: 0 16px 35px rgba(0, 0, 0, 0.22);
}

.brand-mark.small {
  width: 42px;
  height: 42px;
  margin: 0;
  font-size: 0.9rem;
  overflow: hidden;
}

.brand-mark img,
.ticket-logo img,
.image-preview img,
.product-photo img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.login-hero h1 {
  max-width: 610px;
  margin: 0 0 18px;
  font-size: clamp(3rem, 7vw, 5.8rem);
  line-height: 0.95;
}

.login-hero p:not(.eyebrow) {
  max-width: 570px;
  margin: 0;
  color: rgba(255, 255, 255, 0.78);
  font-size: 1.05rem;
  line-height: 1.7;
}

.login-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 34px;
}

.login-stats span {
  min-width: 136px;
  padding: 14px 16px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.08);
}

.login-stats strong {
  display: block;
  margin-bottom: 3px;
  color: #ffffff;
  font-size: 1.35rem;
}

.login-panel {
  align-self: center;
  width: min(520px, calc(100% - 44px));
  margin: 32px auto;
  padding: 30px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, 0.96);
  box-shadow: var(--shadow);
}

.login-panel h2 {
  margin: 0 0 8px;
  font-size: 2rem;
}

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

.login-form {
  display: grid;
  gap: 14px;
  margin-top: 24px;
}

.form-error {
  min-height: 20px;
  margin: 0;
  color: var(--red);
  font-size: 0.86rem;
  font-weight: 800;
}

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

.credential-chip {
  min-height: 64px;
  padding: 11px 12px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.credential-chip strong,
.credential-chip span {
  display: block;
}

.credential-chip span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 0.78rem;
}

.credential-chip small {
  display: inline-flex;
  margin-top: 8px;
  padding: 4px 7px;
  color: #155b44;
  font-size: 0.7rem;
  font-weight: 900;
  border-radius: 999px;
  background: #e6f9f3;
}

.role-card {
  min-height: 142px;
  padding: 18px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
  transition: transform 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease;
}

.role-card:hover {
  transform: translateY(-3px);
  border-color: rgba(255, 107, 53, 0.45);
  box-shadow: 0 16px 32px rgba(29, 39, 67, 0.1);
}

.role-card strong {
  display: block;
  margin: 12px 0 6px;
  font-size: 1.05rem;
}

.role-card span {
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.4;
}

.role-icon,
.module-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
  border-radius: var(--radius-sm);
  background: var(--role-color, var(--blue));
}

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

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 22px 16px;
  color: #ffffff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.035), rgba(255, 255, 255, 0)),
    var(--sidebar);
  overflow-y: auto;
}

.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 6px 22px;
}

.sidebar-brand strong {
  display: block;
  font-size: 1rem;
}

.sidebar-brand span {
  color: rgba(255, 255, 255, 0.56);
  font-size: 0.78rem;
}

.side-nav {
  display: grid;
  gap: 7px;
}

.nav-item {
  position: relative;
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 10px 12px;
  color: rgba(255, 255, 255, 0.75);
  text-align: left;
  border-radius: var(--radius-sm);
  background: transparent;
}

.nav-item:hover,
.nav-item.is-active {
  color: #ffffff;
  background: linear-gradient(90deg, rgba(255, 107, 53, 0.28), rgba(255, 255, 255, 0.08));
}

.nav-item.is-active::before {
  content: "";
  position: absolute;
  left: 0;
  top: 9px;
  bottom: 9px;
  width: 4px;
  border-radius: 999px;
  background: var(--orange);
}

.nav-icon {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  flex: 0 0 28px;
  color: rgba(255, 255, 255, 0.88);
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.1);
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nav-item.is-active .nav-icon {
  color: #111827;
  background: #ffffff;
}

.sidebar-card {
  margin-top: 26px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius);
  background: var(--sidebar-2);
}

.sidebar-card .mini-label {
  margin-bottom: 9px;
}

.sidebar-card strong,
.sidebar-card small {
  display: block;
}

.sidebar-card small {
  margin-top: 5px;
  color: rgba(255, 255, 255, 0.58);
}

.main-area {
  min-width: 0;
}

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

.topbar h2 {
  margin: 0;
  font-size: clamp(1.35rem, 2.5vw, 2rem);
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 10px;
}

.branch-control {
  width: min(220px, 22vw);
  position: relative;
}

.branch-control label {
  position: absolute;
  left: 14px;
  top: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.branch-control select {
  width: 100%;
  min-height: 48px;
  padding: 20px 34px 7px 14px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.global-search {
  width: min(340px, 28vw);
  position: relative;
}

.global-search label {
  position: absolute;
  left: 14px;
  top: 7px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 800;
  text-transform: uppercase;
}

.global-search input {
  width: 100%;
  min-height: 48px;
  padding: 20px 14px 7px;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.ghost-button,
.primary-button,
.danger-button,
.soft-button,
.role-badge,
.chip-button,
.qty-button,
.icon-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  border-radius: var(--radius-sm);
  font-weight: 800;
  white-space: nowrap;
}

.primary-button {
  color: #ffffff;
  background: var(--orange);
}

.primary-button:hover {
  background: #f05f2b;
}

.danger-button {
  color: #ffffff;
  background: var(--red);
}

.soft-button,
.ghost-button,
.chip-button {
  color: var(--ink);
  border: 1px solid var(--line);
  background: #ffffff;
}

.soft-button:hover,
.ghost-button:hover,
.chip-button:hover,
.chip-button.is-active {
  border-color: rgba(47, 128, 237, 0.35);
  background: #eef5ff;
}

.role-badge {
  color: #ffffff;
  background: var(--ink);
}

.icon-button {
  width: 42px;
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
}

.icon-button span {
  width: 18px;
  height: 2px;
  display: block;
  background: var(--ink);
}

.mobile-only {
  display: none;
}

.view-root {
  padding: clamp(18px, 3vw, 34px);
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 16px;
}

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

.metric-card,
.panel,
.order-card,
.product-card,
.payroll-card,
.delivery-card,
.expense-row,
.report-card {
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 10px 26px rgba(29, 39, 67, 0.06);
}

.metric-card {
  width: 100%;
  min-height: 136px;
  grid-column: span 2;
  padding: 18px;
  color: inherit;
  text-align: left;
  position: relative;
  overflow: hidden;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.metric-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 16px 32px rgba(29, 39, 67, 0.12);
}

.metric-card.is-clickable {
  cursor: pointer;
}

.metric-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto;
  height: 4px;
  background: var(--dot, var(--blue));
}

.metric-top {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 12px;
}

.metric-card h3 {
  margin: 0;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-top: 12px;
  font-size: clamp(1.45rem, 3vw, 2.2rem);
}

.metric-card small {
  display: block;
  margin-top: 8px;
  color: var(--muted);
}

.metric-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 3px;
  background: var(--dot, var(--blue));
}

.panel {
  padding: 18px;
}

.panel.wide {
  grid-column: span 4;
}

.panel.narrow {
  grid-column: span 2;
}

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

.scope-panel {
  min-height: auto;
  background: linear-gradient(135deg, #ffffff, #eef6ff);
}

.scope-panel h3 {
  margin: 0 0 4px;
  font-size: 1.15rem;
}

.scope-panel p:last-child {
  margin: 0;
  color: var(--muted);
}

.panel-header,
.toolbar,
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}

.panel-header h3,
.section-header h3 {
  margin: 0;
  font-size: 1.05rem;
}

.panel-header p,
.section-header p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.88rem;
}

.status-pill,
.type-pill,
.active-pill,
.payment-pill {
  min-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 5px 9px;
  color: var(--pill-ink, #ffffff);
  font-size: 0.75rem;
  font-weight: 900;
  border-radius: 999px;
  background: var(--pill-bg, var(--blue));
}

.status-recibido {
  --pill-bg: #e7f0ff;
  --pill-ink: #1d66d2;
}

.status-en_preparacion {
  --pill-bg: #fff2da;
  --pill-ink: #b76d00;
}

.status-listo {
  --pill-bg: #e6f9f3;
  --pill-ink: #0d805d;
}

.status-en_reparto {
  --pill-bg: #ece8ff;
  --pill-ink: #6743d8;
}

.status-entregado {
  --pill-bg: #e6f7eb;
  --pill-ink: #287c45;
}

.status-cancelado {
  --pill-bg: #ffe8e8;
  --pill-ink: #bd3434;
}

.status-pagado,
.status-activo {
  --pill-bg: #e6f9f3;
  --pill-ink: #0d805d;
}

.status-pendiente,
.status-inactivo {
  --pill-bg: #f0f2f5;
  --pill-ink: #667085;
}

.status-marcado_para_pago {
  --pill-bg: #e8f1ff;
  --pill-ink: #1d66d2;
}

.status-por_pagar {
  --pill-bg: #fff2da;
  --pill-ink: #a45f00;
}

.status-vencido {
  --pill-bg: #ffe8e8;
  --pill-ink: #bd3434;
}

.status-en_proceso {
  --pill-bg: #e8f1ff;
  --pill-ink: #1d66d2;
}

.branch-badge,
.delivery-pay-badge,
.action-status {
  min-height: 26px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 4px 8px;
  color: #26566f;
  font-size: 0.72rem;
  font-weight: 900;
  border-radius: 999px;
  background: #e7f5fb;
}

.delivery-pay-badge.pendiente {
  color: #a45f00;
  background: #fff2da;
}

.delivery-pay-badge.marcado_para_pago {
  color: #1d66d2;
  background: #e7f0ff;
}

.delivery-pay-badge.pagado,
.action-status.success {
  color: #0d805d;
  background: #e6f9f3;
}

.action-status.danger {
  color: #bd3434;
  background: #ffe8e8;
}

.type-salon {
  --pill-bg: #eef5ff;
  --pill-ink: #1d66d2;
}

.type-llevar {
  --pill-bg: #fff2da;
  --pill-ink: #a45f00;
}

.type-delivery {
  --pill-bg: #ece8ff;
  --pill-ink: #6743d8;
}

.type-whatsapp {
  --pill-bg: #e6f9f3;
  --pill-ink: #0d805d;
}

.table-wrap {
  width: 100%;
  overflow-x: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
}

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

th {
  color: var(--muted);
  font-size: 0.74rem;
  text-transform: uppercase;
}

td {
  font-size: 0.9rem;
}

tbody tr:hover {
  background: #f8fafc;
}

.mini-list {
  display: grid;
  gap: 10px;
}

.mini-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.mini-item strong {
  display: block;
}

.mini-item span {
  color: var(--muted);
  font-size: 0.8rem;
}

.progress-bar {
  height: 10px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8edf5;
}

.progress-fill {
  height: 100%;
  width: var(--w, 40%);
  border-radius: inherit;
  background: var(--c, var(--blue));
}

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

.module-grid > .panel {
  grid-column: 1 / -1;
}

.toolbar {
  flex-wrap: wrap;
}

.toolbar-left,
.toolbar-right,
.segmented {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.crud-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(300px, 380px);
  gap: 16px;
}

.product-crud-layout {
  grid-template-columns: minmax(0, 1.2fr) minmax(300px, 360px);
}

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

.form-grid.compact {
  gap: 10px;
}

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

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

.control label,
.field label {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.control input,
.control select,
.field input,
.field select,
.field textarea {
  min-height: 42px;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 16px;
}

.product-card {
  overflow: hidden;
}

.product-photo {
  position: relative;
  min-height: 138px;
  overflow: hidden;
  background:
    radial-gradient(circle at 70% 35%, rgba(255, 255, 255, 0.72) 0 9%, transparent 10%),
    linear-gradient(135deg, var(--photo-a), var(--photo-b));
}

.product-photo.has-image {
  background: #101828;
}

.product-photo.has-image::before,
.product-photo.has-image::after {
  display: none;
}

.image-preview {
  width: 100%;
  min-height: 148px;
  display: grid;
  place-items: center;
  color: var(--muted);
  font-weight: 900;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-soft);
  overflow: hidden;
}

.image-preview.logo-preview {
  width: 156px;
  min-height: 156px;
}

.image-preview.has-image {
  border-style: solid;
  background: #ffffff;
}

.product-photo::before,
.product-photo::after {
  content: "";
  position: absolute;
  border-radius: 999px;
}

.product-photo::before {
  width: 112px;
  height: 44px;
  left: 24px;
  top: 48px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 18px 0 rgba(27, 32, 48, 0.12);
}

.product-photo::after {
  width: 74px;
  height: 74px;
  right: 26px;
  bottom: -16px;
  background: rgba(27, 32, 48, 0.18);
}

.product-photo span {
  position: absolute;
  left: 18px;
  bottom: 14px;
  z-index: 1;
  color: #ffffff;
  font-weight: 900;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.22);
}

.product-body {
  padding: 14px;
}

.product-title-row,
.product-meta,
.cart-row,
.order-actions,
.delivery-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.product-title-row h3 {
  margin: 0;
  font-size: 1rem;
}

.product-meta {
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.84rem;
}

.product-prices {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0 14px;
}

.price-box {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.price-box span {
  display: block;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
}

.price-box strong {
  display: block;
  margin-top: 3px;
}

.pos-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(320px, 0.75fr);
  gap: 16px;
}

.pos-products {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(156px, 1fr));
  gap: 12px;
}

.pos-product {
  min-height: 118px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: space-between;
  padding: 14px;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.pos-product:hover {
  border-color: rgba(255, 107, 53, 0.45);
  box-shadow: 0 12px 24px rgba(29, 39, 67, 0.08);
}

.pos-product strong {
  font-size: 0.95rem;
}

.pos-product span {
  color: var(--muted);
  font-size: 0.78rem;
}

.cart-panel {
  position: static;
}

.cart-list {
  display: grid;
  gap: 10px;
  margin-bottom: 14px;
}

.cart-row {
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.cart-row strong {
  display: block;
  margin-bottom: 2px;
}

.cart-row small {
  color: var(--muted);
}

.qty-control {
  display: grid;
  grid-template-columns: 32px 32px 32px;
  align-items: center;
  gap: 5px;
}

.qty-button {
  min-height: 32px;
  width: 32px;
  padding: 0;
  border: 1px solid var(--line);
  background: #ffffff;
}

.qty-number {
  text-align: center;
  font-weight: 900;
}

.total-box {
  display: grid;
  gap: 9px;
  margin: 14px 0;
  padding: 14px;
  border-radius: var(--radius);
  background: var(--surface-soft);
}

.total-line {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
}

.total-line.strong {
  color: var(--ink);
  font-size: 1.16rem;
  font-weight: 900;
}

.checkout-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-top: 12px;
}

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

.empty-state {
  min-height: 160px;
  display: grid;
  place-items: center;
  padding: 28px;
  color: var(--muted);
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.orders-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.order-card,
.delivery-card,
.payroll-card,
.report-card {
  padding: 14px;
}

.order-card h3,
.delivery-card h3,
.payroll-card h3 {
  margin: 0;
  font-size: 1rem;
}

.order-meta,
.delivery-meta {
  display: grid;
  gap: 7px;
  margin: 12px 0;
  color: var(--muted);
  font-size: 0.85rem;
}

.order-items {
  margin: 12px 0;
  padding: 11px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.order-items span {
  display: block;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.5;
}

.order-actions {
  flex-wrap: wrap;
  justify-content: flex-start;
}

.icon-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.icon-action,
.action-button {
  position: relative;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  color: var(--ink);
  font-size: 0.82rem;
  font-weight: 900;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.icon-action {
  width: 36px;
  min-width: 36px;
}

.action-button {
  min-width: 0;
  padding: 0 10px;
}

.action-button span {
  min-width: 22px;
  min-height: 22px;
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  border-radius: 5px;
  background: var(--surface-soft);
}

.icon-action:hover,
.action-button:hover {
  border-color: rgba(47, 128, 237, 0.38);
  background: #eef5ff;
}

.icon-action.danger,
.action-button.danger {
  color: var(--red);
}

.action-button.success {
  color: #0d805d;
  border-color: rgba(19, 167, 123, 0.28);
  background: #effbf7;
}

.action-button.warning {
  color: #a45f00;
  border-color: rgba(246, 185, 59, 0.36);
  background: #fff8eb;
}

.icon-action::after,
.action-button::after {
  content: attr(data-tooltip);
  position: absolute;
  left: 50%;
  bottom: calc(100% + 8px);
  z-index: 60;
  width: max-content;
  max-width: 190px;
  padding: 7px 9px;
  color: #ffffff;
  font-size: 0.72rem;
  line-height: 1.25;
  text-align: center;
  border-radius: 5px;
  background: var(--ink);
  box-shadow: 0 10px 20px rgba(29, 39, 67, 0.18);
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 4px);
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.icon-action:hover::after,
.icon-action:focus-visible::after,
.action-button:hover::after,
.action-button:focus-visible::after {
  opacity: 1;
  transform: translate(-50%, 0);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 14px;
}

.kanban-column {
  min-height: 420px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: linear-gradient(180deg, #ffffff, #f8fafc);
}

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

.kanban-header h3 {
  margin: 0;
  font-size: 0.95rem;
}

.kanban-count {
  min-width: 28px;
  min-height: 28px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-weight: 900;
  border-radius: 999px;
  background: var(--ink);
}

.kanban-list {
  display: grid;
  gap: 10px;
}

.kanban-card {
  padding: 12px;
  border: 1px solid var(--line);
  border-left: 5px solid var(--state-color, var(--blue));
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.kanban-card.time-warn {
  background: #fffaf0;
}

.kanban-card.time-delay {
  background: #fff5f5;
}

.kanban-card-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}

.time-badge {
  display: inline-flex;
  margin-bottom: 10px;
  padding: 5px 8px;
  font-size: 0.72rem;
  font-weight: 900;
  border-radius: 999px;
}

.time-badge.normal {
  color: #0d805d;
  background: #e6f9f3;
}

.time-badge.warn {
  color: #a45f00;
  background: #fff2da;
}

.time-badge.delay {
  color: #bd3434;
  background: #ffe8e8;
}

.kanban-card h4 {
  margin: 0 0 8px;
}

.kanban-card p {
  margin: 0 0 10px;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.kanban-card .order-actions {
  margin-top: 12px;
}

.delivery-layout,
.finance-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
}

.delivery-list,
.payroll-grid,
.report-grid {
  display: grid;
  gap: 14px;
}

.delivery-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 14px;
  border-left: 5px solid #cbd5e1;
}

.delivery-card.delivery-pendiente {
  border-left-color: var(--yellow);
  background: linear-gradient(90deg, rgba(255, 242, 218, 0.68), #ffffff 34%);
}

.delivery-card.delivery-marcado_para_pago {
  border-left-color: var(--blue);
  background: linear-gradient(90deg, rgba(231, 240, 255, 0.72), #ffffff 34%);
}

.delivery-card.delivery-pagado {
  border-left-color: var(--green);
  background: linear-gradient(90deg, rgba(230, 249, 243, 0.72), #ffffff 34%);
}

.driver-pay {
  min-width: 150px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.driver-pay.pendiente {
  background: #fff2da;
}

.driver-pay.marcado_para_pago {
  background: #e7f0ff;
}

.driver-pay.pagado {
  background: #e6f9f3;
}

.driver-pay span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: uppercase;
}

.expense-list {
  display: grid;
  gap: 9px;
}

.expense-row {
  display: grid;
  grid-template-columns: 1fr auto auto;
  align-items: center;
  gap: 12px;
  padding: 12px;
}

.expense-row strong,
.expense-row span {
  display: block;
}

.expense-row span {
  color: var(--muted);
  font-size: 0.82rem;
}

.finance-form {
  display: grid;
  gap: 11px;
}

.payroll-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.payroll-card {
  display: grid;
  gap: 12px;
}

.payroll-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.payroll-numbers {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 9px;
}

.payroll-numbers div {
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.payroll-numbers span {
  display: block;
  color: var(--muted);
  font-size: 0.7rem;
  font-weight: 800;
  text-transform: uppercase;
}

.payroll-numbers strong {
  display: block;
  margin-top: 3px;
}

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

.report-card {
  min-height: 126px;
}

.report-card span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.report-card strong {
  display: block;
  margin-top: 12px;
  font-size: 1.45rem;
}

.report-card.profit {
  color: #ffffff;
  background: linear-gradient(135deg, var(--ink), #2b3347);
}

.report-card.profit span {
  color: rgba(255, 255, 255, 0.66);
}

.chart {
  display: grid;
  gap: 12px;
}

.chart-row {
  display: grid;
  grid-template-columns: 120px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 10px;
}

.chart-label {
  color: var(--muted);
  font-size: 0.86rem;
}

.chart-value {
  text-align: right;
  font-weight: 900;
}

.role-permission-grid,
.branch-grid,
.client-grid,
.report-chip-grid {
  display: grid;
  gap: 14px;
}

.role-permission-grid {
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
}

.role-card {
  min-height: 0;
  border-left: 5px solid var(--role-color, var(--blue));
}

.role-card-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}

.role-card-head > span {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  flex: 0 0 42px;
  color: #ffffff;
  font-weight: 900;
  border-radius: var(--radius-sm);
  background: var(--role-color, var(--blue));
}

.role-card h3,
.role-card p {
  margin: 0;
}

.permission-tags,
.role-flags,
.client-stats,
.notification-summary,
.chart-legend {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.permission-tags span,
.client-stats span,
.report-chip {
  padding: 7px 9px;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  border-radius: 999px;
  background: var(--surface-soft);
}

.branch-grid {
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
}

.branch-card,
.client-card,
.notification-item,
.timeline-item {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: #ffffff;
}

.branch-card {
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 12px;
}

.branch-card.is-disabled {
  opacity: 0.62;
}

.branch-logo {
  width: 54px;
  height: 54px;
  display: grid;
  place-items: center;
  overflow: hidden;
  color: #ffffff;
  font-weight: 900;
  border-radius: var(--radius-sm);
  background: linear-gradient(135deg, var(--orange), var(--blue));
}

.branch-logo img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.branch-card p,
.client-card p,
.notification-item p {
  margin: 6px 0;
  color: var(--muted);
  font-size: 0.85rem;
  line-height: 1.45;
}

.product-ingredients {
  min-height: 38px;
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.45;
}

.status-line-vencido {
  background: #fff5f5;
}

.status-line-por_pagar {
  background: #fffaf0;
}

.multi-chart {
  display: grid;
  gap: 12px;
}

.multi-chart-row {
  display: grid;
  grid-template-columns: 72px minmax(0, 1fr) 96px;
  align-items: center;
  gap: 10px;
}

.multi-chart-row > span,
.multi-chart-row strong {
  color: var(--muted);
  font-size: 0.82rem;
}

.multi-bars {
  display: grid;
  gap: 5px;
}

.multi-bars i {
  width: var(--w);
  min-width: 5px;
  height: 8px;
  border-radius: 999px;
  background: var(--c);
}

.chart-legend {
  margin-top: 8px;
}

.chart-legend span {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
}

.chart-legend i {
  width: 10px;
  height: 10px;
  display: inline-block;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--c);
}

.client-grid {
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
}

.client-card {
  display: grid;
  gap: 8px;
}

.report-chip-grid {
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}

.report-chip {
  display: grid;
  gap: 6px;
  border-radius: var(--radius-sm);
}

.report-chip strong {
  color: var(--ink);
  font-size: 1.2rem;
}

.timeline {
  display: grid;
  gap: 12px;
}

.timeline-item {
  display: grid;
  grid-template-columns: 20px minmax(0, 1fr);
  gap: 12px;
}

.timeline-dot {
  width: 14px;
  height: 14px;
  margin-top: 4px;
  border: 3px solid #ffffff;
  border-radius: 50%;
  background: var(--blue);
  box-shadow: 0 0 0 3px rgba(47, 128, 237, 0.2);
}

.notification-summary {
  margin-bottom: 16px;
}

.notification-summary div {
  min-width: 130px;
  padding: 12px;
  border-radius: var(--radius-sm);
  background: var(--surface-soft);
}

.notification-summary strong,
.notification-summary span {
  display: block;
}

.notification-summary strong {
  font-size: 1.4rem;
}

.notification-list {
  display: grid;
  gap: 10px;
}

.notification-item {
  display: grid;
  grid-template-columns: 42px minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  border-left: 5px solid var(--blue);
}

.notification-item.warning {
  border-left-color: var(--yellow);
  background: #fffaf0;
}

.notification-item.critical {
  border-left-color: var(--red);
  background: #fff5f5;
}

.notice-icon {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 0.72rem;
  font-weight: 900;
  border-radius: var(--radius-sm);
  background: var(--ink);
}

.toast {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 40;
  max-width: 360px;
  padding: 14px 16px;
  color: #ffffff;
  border-radius: var(--radius);
  background: var(--ink);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(18px);
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

.payment-mode-hint {
  margin: 0 0 10px;
  padding: 10px 12px;
  color: #26566f;
  font-size: 0.84rem;
  font-weight: 800;
  border-radius: var(--radius-sm);
  background: #e7f5fb;
}

.modal {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(18, 21, 33, 0.62);
}

.modal-panel {
  width: min(980px, 100%);
  max-height: min(92vh, 920px);
  overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: 0 28px 80px rgba(0, 0, 0, 0.28);
}

.voucher-modal {
  width: min(640px, 100%);
}

.order-editor-modal {
  width: min(940px, 100%);
}

.modal-header {
  position: sticky;
  top: 0;
  z-index: 2;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  padding: 18px;
  border-bottom: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.96);
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: 18px;
}

.modal-actions,
.voucher-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 16px;
}

.checkout-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 300px;
  gap: 16px;
}

.payment-rows,
.edit-items {
  display: grid;
  gap: 10px;
  margin: 12px 0;
}

.payment-row,
.edit-item-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 130px 40px;
  gap: 9px;
  align-items: center;
}

.payment-row select,
.payment-row input,
.edit-item-row select,
.edit-item-row input {
  min-height: 42px;
  padding: 9px 10px;
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: #ffffff;
}

.total-line.ok {
  color: var(--green);
}

.total-line.bad {
  color: var(--red);
}

.section-header.tight {
  margin-top: 18px;
  margin-bottom: 8px;
}

.voucher-body {
  display: grid;
  justify-items: center;
}

.ticket-80 {
  width: 302px;
  padding: 14px 12px;
  color: #111111;
  font-family: "Courier New", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12px;
  line-height: 1.35;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #ffffff;
}

.ticket-80 h2 {
  margin: 6px 0 4px;
  text-align: center;
  font-size: 17px;
}

.ticket-80 p {
  margin: 3px 0;
}

.ticket-80 hr {
  border: 0;
  border-top: 1px dashed #111111;
  margin: 8px 0;
}

.ticket-80 table {
  font-size: 12px;
}

.ticket-80 td {
  padding: 3px 0;
  border: 0;
}

.ticket-80 td:last-child {
  text-align: right;
}

.ticket-line {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.ticket-line.total {
  font-size: 14px;
  font-weight: 900;
}

.ticket-logo {
  width: 58px;
  height: 58px;
  display: grid;
  place-items: center;
  margin: 0 auto 6px;
  color: #ffffff;
  font-weight: 900;
  border-radius: 6px;
  background: #111111;
  overflow: hidden;
}

.ticket.thanks {
  margin-top: 10px;
  text-align: center;
  font-weight: 900;
}

@media (max-width: 1180px) {
  .metric-card {
    grid-column: span 3;
  }

  .panel.wide,
  .panel.narrow {
    grid-column: 1 / -1;
  }

  .kanban {
    grid-template-columns: repeat(2, minmax(220px, 1fr));
  }

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

@media (max-width: 980px) {
  .login-screen {
    grid-template-columns: 1fr;
    background: var(--bg);
  }

  .login-hero {
    min-height: auto;
    padding: 34px 24px;
    background: #151926;
  }

  .login-panel {
    align-self: start;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 30;
    width: 280px;
    transform: translateX(-105%);
    transition: transform 0.22s ease;
  }

  .sidebar.is-open {
    transform: translateX(0);
  }

  .mobile-only {
    display: inline-flex;
  }

  .topbar {
    align-items: flex-start;
    flex-wrap: wrap;
  }

  .topbar-actions {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .global-search {
    width: min(100%, 420px);
  }

  .branch-control {
    width: min(100%, 260px);
  }

  .pos-grid,
  .delivery-layout,
  .finance-layout,
  .crud-layout,
  .product-crud-layout,
  .checkout-modal-grid {
    grid-template-columns: 1fr;
  }

  .cart-panel {
    position: static;
  }
}

@media (max-width: 720px) {
  .view-root {
    padding: 16px;
  }

  .role-grid,
  .credential-list,
  .checkout-fields {
    grid-template-columns: 1fr;
  }

  .form-grid,
  .payment-row,
  .edit-item-row {
    grid-template-columns: 1fr;
  }

  .dashboard-grid,
  .module-grid {
    display: grid;
    grid-template-columns: 1fr;
  }

  .metric-card,
  .panel,
  .panel.wide,
  .panel.narrow {
    grid-column: auto;
  }

  .kanban,
  .report-grid {
    grid-template-columns: 1fr;
  }

  .delivery-card,
  .expense-row,
  .notification-item,
  .multi-chart-row {
    grid-template-columns: 1fr;
  }

  .chart-row {
    grid-template-columns: 1fr;
  }

  .branch-grid,
  .client-grid,
  .role-permission-grid,
  .report-chip-grid {
    grid-template-columns: 1fr;
  }

  .chart-value {
    text-align: left;
  }

  .topbar-actions > button,
  .branch-control,
  .global-search,
  .primary-button,
  .ghost-button,
  .soft-button,
  .danger-button {
    width: 100%;
  }

  .icon-action {
    width: 38px;
  }
}

@media print {
  body * {
    visibility: hidden !important;
  }

  .print-area,
  .print-area * {
    visibility: visible !important;
  }

  .print-area {
    position: absolute;
    left: 0;
    top: 0;
    width: 80mm;
    border: 0;
    border-radius: 0;
  }

  .no-print {
    display: none !important;
  }
}
