/* EMNA · acabado visual compartido. Sin cambios de comportamiento ni de impresión. */
@media screen {
  :root {
    --ink: #1c2b45;
    --muted: #61718a;
    --line: #e2e8f1;
    --bg: #f4f6fb;
    --emna-heading: #172943;
    --emna-surface-shadow: 0 4px 20px rgb(24 44 78 / 4%);
    --emna-font: "Segoe UI", -apple-system, BlinkMacSystemFont, Arial, sans-serif;
  }
  body { font-family: var(--emna-font); color: var(--ink); background: var(--bg); line-height: 1.55; letter-spacing: 0; -webkit-font-smoothing: antialiased; }
  h1, h2, h3, .stats strong, .grand-total strong, table { font-family: var(--emna-font); }
  h1 { color: var(--emna-heading); font-weight: 700; font-size: clamp(1.55rem, 2.2vw, 2.1rem); line-height: 1.2; letter-spacing: -.035em; }
  h2 { color: var(--emna-heading); font-weight: 650; line-height: 1.35; font-size: 1.12rem; letter-spacing: -.02em; }
  h3 { color: var(--emna-heading); line-height: 1.4; }
  .content { padding: 32px 36px 48px; }
  .page-title { margin-bottom: 26px; gap: 18px 24px; }
  .page-title h1 { margin: 6px 0 8px; }
  .page-title small { display: block; max-width: 72ch; color: var(--muted); font-size: .85rem; line-height: 1.6; }
  .eyebrow { font-size: .67rem; font-weight: 700; letter-spacing: .13em; color: #426442; }

  /* Navegación: contraste claro, estado actual reconocible y geometría estable. */
  .sidebar { background: linear-gradient(170deg, #223b68 0%, #152744 100%); box-shadow: 4px 0 24px rgb(18 36 64 / 7%); }
  .sidebar-head { border-bottom-color: #ffffff12; }
  .sidebar-nav { padding: 16px 14px 22px; }
  .sidebar .sidebar-nav a { border: 1px solid transparent; font-size: .82rem; font-weight: 550; padding: 10px 12px; }
  .sidebar .sidebar-nav a:hover { transform: none; background: #ffffff0c; border-color: #ffffff12; }
  .sidebar .sidebar-nav a.active { background: #ffffff13; border-color: #ffffff1a; box-shadow: inset 3px 0 #b3d881; color: #fff; }
  .sidebar-nav .nav-label { color: #aec2dd; font-size: .6rem; letter-spacing: .14em; margin-top: 20px; }
  .sidebar-profile { border-top-color: #ffffff12; background: #0e1c342e; }
  .brand-copy small { color: #c0cfe2; }
  .topbar { background: #fff; border-bottom: 1px solid var(--line); box-shadow: 0 2px 12px rgb(24 44 78 / 2%); }
  .topbar-context strong { color: var(--emna-heading); font-size: .82rem; font-weight: 650; }
  .topbar-context small { font-size: .72rem; }

  /* Superficies y cifras. */
  .panel, .stats article { border: 1px solid var(--line); background: #fff; box-shadow: var(--emna-surface-shadow); border-radius: 16px; }
  .panel-head { padding: 20px 22px; border-bottom-color: var(--line); background: #fff; gap: 16px; }
  .panel-head h2 { margin-top: 4px; }
  .panel-head small { color: var(--muted); }
  .stats { gap: 18px; margin-bottom: 24px; }
  .stats article { padding: 22px; }
  .stats article:hover { transform: none; border-color: #d2ddeb; box-shadow: var(--emna-surface-shadow); }
  .stats strong, .grand-total, .payment-amount strong, td { font-variant-numeric: tabular-nums; }
  .dashboard-stats strong { color: var(--emna-heading); font-weight: 700; letter-spacing: -.035em; }
  .dashboard-stats span { color: #4e5f77; font-size: .78rem; font-weight: 600; }
  .dashboard-stats small { color: var(--muted); font-size: .72rem; line-height: 1.5; }
  .dashboard-grid { gap: 22px; }
  .welcome-card { padding: 28px 30px; border: 1px solid #263e65; border-radius: 18px; background: radial-gradient(ellipse at 95% 0, #365980 0, transparent 65%), #1d3455; box-shadow: 0 8px 26px rgb(21 44 76 / 10%); }
  .welcome-card h1 { color: #fff; }
  .welcome-card .eyebrow { color: #c7e5a3; }
  .welcome-card p:last-child { color: #d3deed; font-size: .85rem; }
  .welcome-card .btn.btn-primary { --button-bg: #fff; --button-fg: #233c65; --button-border: #fff; --button-hover-bg: #eaf0fa; --button-hover-border: #eaf0fa; --button-shadow: 0 3px 12px #10274630; }
  .welcome-card .cash-pill { background: #ffffff12; border-color: #ffffff2b; color: #e2edfa; }
  .welcome-card .cash-pill.open { color: #e1f1ce; background: #c2e8a518; border-color: #c2e8a533; }
  .quick-links > a { padding: 17px 20px; border-bottom-color: #edf1f6; }
  .quick-links > a:hover { background: #f5f8fd; transform: none; }
  .quick-links > a > span { background: #eff4fc; border-color: #e0e8f7; color: #3d5bb3; }
  .quick-links strong { font-size: .84rem; font-weight: 600; color: var(--emna-heading); }
  .quick-links small { font-size: .73rem; line-height: 1.5; color: var(--muted); }

  /* Formularios: un campo, un borde; etiquetas ligeras. */
  .form-panel { padding: 28px; }
  .record-form { gap: 22px; padding: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; }
  .record-form label, .sale-fields label, .login-card label { padding: 0; margin: 0; border: 0; border-radius: 0; background: transparent; box-shadow: none; color: #34465f; font-size: .82rem; font-weight: 600; line-height: 1.5; }
  :is(.record-form, .sale-fields, .report-filter, .search, .login-card) :is(input, select, textarea):not(:where([type=checkbox], [type=radio], [type=hidden], [type=file])) {
    min-height: 46px; padding: 11px 13px; border: 1px solid #d9e1ec; border-radius: 10px; color: var(--ink); background: #fbfcfe; box-shadow: 0 1px 2px rgb(24 44 78 / 2%); font-family: var(--emna-font); font-size: .875rem; font-weight: 400;
  }
  :is(.record-form, .sale-fields, .report-filter, .search, .login-card) :is(input, select, textarea):hover { border-color: #b6c5db; }
  :is(.record-form, .sale-fields, .report-filter, .search, .login-card) :is(input, select, textarea):focus { background: #fff; border-color: #3d5bb3; box-shadow: 0 0 0 3px #3d5bb318; }
  input::placeholder, textarea::placeholder { color: #75839a; opacity: 1; font-weight: 400; }
  .record-form small { font-weight: 400; color: var(--muted); }
  .form-actions { margin-top: 2px; padding-top: 22px; border-top-color: var(--line); }
  .form-section p, .panel-intro p { line-height: 1.65; }
  .search, .report-filter { padding: 14px; border: 1px solid var(--line); border-radius: 14px; background: #fff; box-shadow: 0 2px 12px rgb(24 44 78 / 3%); }
  .search:focus-within { border-color: #b6c7e4; box-shadow: 0 0 0 3px #3d5bb30a; }
  .product-form-intro { background: #f5f8fd; border-bottom-color: var(--line); }
  .settings-links a { padding: 24px; text-decoration: none; }
  .settings-links a:hover { background: #fafcff; border-color: #bdcce3; }
  .danger-zone { border-color: #edcbd0; background: #fffafb; }
  .danger-zone h2 { color: #922f38; }

  /* Tablas: lectura, espacio y alineación de cifras. */
  table { font-size: .875rem; line-height: 1.55; color: #34465f; background: #fff; }
  .table-wrap table:has(thead tr > :nth-child(6)) { min-width: 960px; }
  .sort-column { display: inline-flex; align-items: center; min-height: 32px; }
  th { padding: 14px 20px; background: #f7f9fc; color: #536580; font-size: .69rem; font-weight: 650; letter-spacing: .055em; border-bottom: 1px solid #e3eaf3; }
  td { padding: 16px 20px; border-bottom-color: #edf1f6; }
  td strong { color: #233750; font-weight: 600; }
  td small { color: var(--muted); font-size: .72rem; margin-top: 4px; }
  tbody tr:hover { background: #f7faff; }
  tbody tr:last-child td { border-bottom: 0; }
  body[data-view=facturas] td:first-child, body[data-view=ventas] td:first-child { white-space: nowrap; }
  .badge { display: inline-flex; align-items: center; min-height: 27px; padding: 4px 10px; border: 1px solid transparent; border-radius: 999px; font-family: var(--emna-font); font-size: .72rem; line-height: 1.4; font-weight: 600; }
  .badge.success-badge { border-color: #d4e8c7; }
  .badge.warning { border-color: #f1ddb0; }
  .badge.danger-badge { border-color: #f0d0cf; }
  .table-pagination { background: #fcfdff; border-top-color: var(--line); padding: 16px 20px; color: var(--muted); }
  .table-pagination select { background: #fff; border-color: #d9e1ec; border-radius: 8px; }
  .empty { color: var(--muted); padding: 42px 22px; font-size: .86rem; line-height: 1.7; }

  /* Punto de venta: mismo lenguaje, sin mover los controles. */
  .pos-catalog, .pos-cart { border-color: var(--line); box-shadow: var(--emna-surface-shadow); }
  .catalog-heading, .cart-heading { background: #fff; border-bottom-color: var(--line); }
  .catalog-heading h2, .cart-heading h2 { color: var(--emna-heading); }
  .pos-toolbar { background: #f9fbff; border-bottom: 1px solid #e9eef6; }
  .pos-toolbar .pos-search { background: #fff; border: 1px solid #d9e2ef; border-radius: 11px; box-shadow: none; }
  .pos-toolbar .pos-search input { border: 0; padding: 0; background: transparent; box-shadow: none; }
  .pos-toolbar .pos-search input:focus { box-shadow: none; background: transparent; }
  .pos-product-card { border-color: #e2e9f2; box-shadow: 0 2px 6px #1d345505; }
  .pos-product-card:hover { border-color: #a2b6db; box-shadow: 0 5px 18px #263d6c12; }
  .product-visual { background: #f1f5fc; }
  .product-visual > span { background: #fff; color: #3b598c; box-shadow: 0 3px 9px #233b6410; }
  .pos-product-card > strong { color: var(--emna-heading); }
  .pos-totals .grand-total { border-radius: 12px; background: #243e65; }
  .pos-session-pill, .cash-pill { font-family: var(--emna-font); }
  .checkout-note { font-size: .73rem; line-height: 1.5; color: var(--muted); }

  /* Documentos y avisos: presentación cuidada, estados conservados. */
  .receipt { padding: 30px; }
  .receipt-brand h1 { font-size: 1.65rem; }
  .receipt-meta { gap: 18px 24px; }
  .receipt-meta span { font-size: .73rem; letter-spacing: .01em; }
  .receipt-meta strong { color: #263a55; font-weight: 600; font-size: .9rem; }
  .invoice-status { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 16px; padding: 14px 16px; margin-bottom: 24px; border: 1px solid #dfe7f2; border-radius: 10px; background: #f6f9fe; font-size: .82rem; }
  .invoice-status span { color: var(--muted); }
  .receipt-footer { font-size: .77rem; line-height: 1.7; }
  .message { box-shadow: 0 8px 28px #182c4e10; }

  /* Acceso: identidad EMNA, sin servicios ni fuentes externas. */
  .login-shell { background: #f8faff; }
  .login-visual { padding: clamp(36px, 5vw, 76px); background: radial-gradient(ellipse at 5% 0, #365b83 0, transparent 70%), linear-gradient(155deg, #1f395f, #12243f); }
  .login-mark > span { color: #edf4ff; }
  .login-kicker { border-color: #ffffff2b; color: #d1e6b5; background: #ffffff08; font-weight: 600; }
  .login-message h1 { color: #fff; font-weight: 650; line-height: 1.08; font-size: clamp(2.3rem, 3.7vw, 4rem); }
  .login-message p { color: #c9d7e8; font-weight: 400; line-height: 1.75; font-size: .95rem; }
  .login-card { background: #fff; border: 1px solid var(--line); border-radius: 22px; box-shadow: 0 12px 44px #19345c0b; padding: 38px; }
  .login-card h2 { font-size: 1.9rem; letter-spacing: -.04em; }
  .login-card .input-wrap input { padding-left: 42px; }
  .login-card .primary { border-radius: 11px; }
  .login-help { color: var(--muted); font-size: .72rem; }
  .book-shapes i { background: #c5d8eb35; border-radius: 4px 4px 1px 1px; }
  .book-shapes i:nth-child(2) { background: #b9d89380; }

  .error-page { min-height: 100dvh; display: grid; place-items: center; padding: 32px 18px; }
  .error-card { width: min(100%, 560px); padding: 40px; border: 1px solid var(--line); border-radius: 20px; background: #fff; box-shadow: 0 12px 40px #1a34590a; }
  .error-brand { display: flex; align-items: center; gap: 12px; text-decoration: none; color: var(--emna-heading); font-weight: 650; }
  .error-brand img { width: 44px; height: 44px; object-fit: contain; }
  .error-code { margin: 26px 0 8px; color: #58709a; font-size: 3rem; font-weight: 700; line-height: 1; letter-spacing: -.05em; }
  .error-card h1 { font-size: 1.55rem; }
  .error-card > p:not(.error-code) { color: var(--muted); line-height: 1.75; margin-bottom: 24px; }

  @media (prefers-reduced-motion: reduce) {
    .content, .login-card { animation: none; }
  }
  @media (max-width: 1180px) {
    .content { padding: 26px 24px 40px; }
    .welcome-card { padding: 24px; }
  }
  @media (max-width: 850px) {
    .content { padding: 24px 18px 40px; }
    .page-title { gap: 16px; margin-bottom: 22px; }
    .login-card { margin: 24px auto; width: min(480px, calc(100% - 32px)); padding: 30px; }
  }
  @media (max-width: 650px) {
    .content { padding: 22px 14px 36px; }
    .panel-head { padding: 18px; flex-wrap: wrap; }
    .form-panel, .receipt { padding: 22px 18px; }
    .welcome-card { padding: 24px 20px; }
    .stats article { padding: 20px; }
    .dashboard-grid { gap: 18px; }
    .search { padding: 12px; gap: 10px; }
    th, td { padding: 13px 14px; }
    .sort-column { min-height: 44px; }
    :is(.record-form, .sale-fields, .report-filter, .search, .login-card) :is(input, select, textarea):not(:where([type=checkbox], [type=radio], [type=hidden], [type=file])) { font-size: 1rem; }
    .record-form { gap: 19px; }
    .receipt-meta { gap: 16px; }
    .login-card { padding: 26px 22px; }
    .error-card { padding: 28px 22px; }
  }
}

/* Diagnóstico FEL: claves largas y formularios dentro de tablas. */
.fel-operation-code { max-width: 250px; overflow-wrap: anywhere; }
.fel-review-form { display: grid; gap: 12px; min-width: 220px; }
.fel-review-form label { display: grid; gap: 6px; }
.fel-review-form .check-filter { white-space: normal; }

.fel-metrics article { display: grid; gap: 8px; align-content: start; }
.fel-conciliation .check-filter { white-space: normal; align-items: flex-start; }
.fel-conciliation .table-wrap table { min-width: 1000px; }
.fel-review-form input:not([type=checkbox]) { width: 100%; min-height: 44px; padding: 10px 12px; border-radius: 10px; font: inherit; }

/* 1.0.17: espacio de uso, conservando identidad y temas existentes. */
.action-row, .document-filters, .form-actions { gap: 12px; flex-wrap: wrap; }
.record-form, .sale-fields { gap: 18px 20px; }
.search, .report-filter { gap: 14px 18px; flex-wrap: wrap; align-items: end; }
.record-form label, .report-filter label, .search label { min-width: 0; gap: 8px; }
.record-form select, .sale-fields select, .report-filter select, .search select { min-height: 44px; padding-right: 34px; max-width: 100%; }
.table-wrap td .btn { margin: 3px 4px 3px 0; white-space: nowrap; }
.flow-filter { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.report-list { padding: 18px 24px; }
@media (max-width: 850px) { .flow-filter { grid-template-columns: repeat(2,minmax(0,1fr)); } }
@media (max-width: 520px) {
  .flow-filter { grid-template-columns: minmax(0,1fr); }
  .page-title .action-row, .form-actions { width: 100%; }
  .action-row .btn { flex-shrink: 0; }
  .search > label, .search > select, .report-filter > label { width: 100%; }
}

.flow-report > .panel { margin-top: 22px; }
.flow-report .document-review { padding: 22px 24px; }
.flow-report .document-review li { margin: 8px 0; }
