:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #63707a;
  --line: #d8dee3;
  --soft: #f3f6f8;
  --paper: #ffffff;
  --brand: #146c5f;
  --brand-dark: #0c4f45;
  --accent: #c44f2e;
  --gold: #c8992b;
  --blue: #2c6d9c;
  --shadow: 0 16px 40px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--soft);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
  display: grid;
  grid-template-columns: 260px 1fr;
}

body.locked .sidebar,
body.locked .shell {
  filter: blur(3px);
  pointer-events: none;
  user-select: none;
}

.hidden {
  display: none !important;
}

.login-screen {
  position: fixed;
  inset: 0;
  z-index: 20;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, rgba(6, 35, 71, 0.92), rgba(255, 100, 15, 0.88));
  padding: 20px;
}

.login-card {
  width: min(420px, 100%);
  background: #fff;
  border: 1px solid rgba(255, 255, 255, 0.45);
  border-radius: 8px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.24);
  padding: 28px;
  display: grid;
  gap: 16px;
  text-align: center;
}

.login-card label {
  text-align: left;
}

.login-logo {
  width: 150px;
  justify-self: center;
}

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

.sidebar {
  background: #18252b;
  color: #f6fafb;
  min-height: 100vh;
  padding: 22px 18px;
  position: sticky;
  top: 0;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 30px;
}

.brand-logo {
  width: 62px;
  height: 62px;
  object-fit: contain;
  background: #fff;
  border-radius: 8px;
  padding: 5px;
}

.brand-mark {
  width: 46px;
  height: 46px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--brand);
  font-weight: 800;
}

.brand small,
.topbar p,
.section-head p,
.panel-head span,
.card small {
  color: var(--muted);
}

.sidebar .brand small {
  color: #aec1c9;
}

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

.nav-item {
  display: block;
  text-decoration: none;
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  text-align: left;
  color: #dce7eb;
  background: transparent;
  cursor: pointer;
}

.nav-item.active,
.nav-item:hover {
  background: #263941;
  color: #ffffff;
}

.shell {
  min-width: 0;
  padding: 26px;
}

.topbar,
.section-head,
.panel-head,
.modal-head,
.modal-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.topbar {
  margin-bottom: 24px;
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
}

h2 {
  font-size: 20px;
}

.topbar p,
.section-head p {
  margin-top: 6px;
}

.topbar-actions,
.toolbar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  background: #fff;
  color: var(--brand-dark);
  font-weight: 700;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.primary-btn,
.secondary-btn,
.danger-btn,
.icon-btn {
  border: 1px solid transparent;
  border-radius: 8px;
  min-height: 40px;
  padding: 0 14px;
  cursor: pointer;
}

.primary-btn {
  background: var(--brand);
  color: #fff;
}

.primary-btn:hover {
  background: var(--brand-dark);
}

.secondary-btn {
  background: #fff;
  border-color: var(--line);
  color: var(--ink);
}

.link-btn {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.notice {
  border-radius: 8px;
  padding: 10px;
  text-align: left;
}

.notice.ok {
  background: #e8f2ef;
  color: var(--brand-dark);
}

.notice.error {
  background: #fdece7;
  color: #9e341b;
}

.install-body {
  display: block;
}

.danger-btn {
  background: #fff;
  border-color: #e8c2b8;
  color: #9e341b;
}

.icon-btn {
  width: 36px;
  padding: 0;
  background: #eef2f4;
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(150px, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.stat,
.panel,
.card,
.table-wrap,
.modal-card {
  background: var(--paper);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.stat {
  padding: 18px;
}

.stat span {
  color: var(--muted);
  font-size: 13px;
}

.stat strong {
  display: block;
  font-size: 28px;
  margin-top: 8px;
}

.work-grid {
  display: grid;
  grid-template-columns: 1.2fr 0.8fr;
  gap: 18px;
}

.panel {
  padding: 18px;
  min-width: 0;
}

.activity-list,
.compact-list,
.cards-grid {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.activity-item,
.compact-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  display: flex;
  justify-content: space-between;
  gap: 14px;
}

.activity-item p,
.compact-item p,
.card p {
  color: var(--muted);
  margin-top: 4px;
}

.section-head {
  margin-bottom: 14px;
}

.toolbar {
  margin-bottom: 14px;
}

input,
select,
textarea {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
  background: #fff;
  color: var(--ink);
}

textarea {
  padding: 10px 11px;
  resize: vertical;
}

.toolbar input {
  flex: 1 1 280px;
}

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

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

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

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

.status {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  border-radius: 999px;
  padding: 0 10px;
  font-size: 12px;
  font-weight: 700;
  background: #e8f2ef;
  color: var(--brand-dark);
}

.status.warn {
  background: #fff5d9;
  color: #886511;
}

.status.alert {
  background: #fdece7;
  color: #9e341b;
}

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

.row-actions button {
  border: 1px solid var(--line);
  background: #fff;
  border-radius: 8px;
  min-height: 34px;
  padding: 0 10px;
  cursor: pointer;
}

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

.lane {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f5;
  min-height: 260px;
  padding: 12px;
}

.lane h3 {
  margin: 0 0 12px;
  font-size: 14px;
  color: var(--muted);
}

.shipment-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}

.shipment-card strong {
  display: block;
}

.shipment-card p {
  margin: 6px 0 0;
  color: var(--muted);
}

.cards-grid {
  grid-template-columns: repeat(3, minmax(180px, 1fr));
}

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

.card {
  padding: 16px;
}

.record-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.record-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

dl {
  display: grid;
  grid-template-columns: repeat(2, minmax(120px, 1fr));
  gap: 10px;
  margin: 0;
}

dt {
  color: var(--muted);
  font-size: 12px;
}

dd {
  margin: 3px 0 0;
  font-weight: 700;
}

.tabs,
.summary-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.tab {
  text-decoration: none;
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 40px;
  padding: 0 16px;
  cursor: pointer;
}

.tab.active {
  background: var(--brand);
  color: #fff;
  border-color: var(--brand);
}

.summary-strip span {
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 0 10px;
}

.summary-strip.compact {
  margin: 12px 0;
}

.invoice-layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 18px;
  align-items: start;
}

.invoice-preview {
  min-width: 0;
}

.invoice-paper {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
}

.invoice-top {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  border-bottom: 2px solid var(--brand);
  padding-bottom: 14px;
  margin-bottom: 14px;
}

.invoice-logo {
  width: 120px;
  display: block;
  margin-bottom: 8px;
}

.invoice-lines {
  display: grid;
  grid-template-columns: repeat(2, minmax(180px, 1fr));
  gap: 8px 16px;
  margin-bottom: 16px;
}

.invoice-table {
  margin: 14px 0;
}

.signature-line {
  border-top: 1px solid var(--ink);
  width: 220px;
  text-align: center;
  padding-top: 8px;
  margin-top: 42px;
}

.invoice-note {
  margin-top: 16px;
  color: #9e341b;
  font-weight: 700;
}

.invoice-actions {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

.list-button {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  min-height: 58px;
  padding: 10px;
  display: grid;
  gap: 4px;
  text-align: left;
  cursor: pointer;
}

.list-button.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(20, 108, 95, 0.14);
}

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

.mini-list span {
  display: block;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  padding: 10px;
}

.modal-card.wide {
  width: min(980px, calc(100vw - 30px));
}

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

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

label input,
label select {
  color: var(--ink);
  width: 100%;
}

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

.modal {
  border: 0;
  padding: 0;
  background: transparent;
}

.modal::backdrop {
  background: rgba(12, 22, 28, 0.45);
}

.modal-card {
  width: min(720px, calc(100vw - 30px));
  padding: 20px;
}

.modal-head {
  margin-bottom: 18px;
}

.modal-actions {
  margin-top: 18px;
  justify-content: flex-end;
}

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  background: #172026;
  color: #fff;
  padding: 12px 14px;
  border-radius: 8px;
  opacity: 0;
  transform: translateY(10px);
  pointer-events: none;
  transition: 0.2s ease;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

.message-list,
.timeline {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.message,
.timeline article {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fff;
}

.message.cliente {
  border-left: 4px solid var(--accent);
}

.message.empleado {
  border-left: 4px solid var(--brand);
}

.message p,
.timeline p {
  margin-top: 6px;
  color: var(--muted);
}

.message-form {
  display: grid;
  gap: 12px;
  margin-top: 14px;
}

.customer-portal {
  display: block;
  background: #eef3f5;
}

.portal-shell {
  width: min(1100px, calc(100% - 32px));
  margin: 0 auto;
  padding: 28px 0;
}

.portal-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 18px;
}

.portal-hero img {
  width: 110px;
  height: 110px;
  object-fit: contain;
}

@media (max-width: 980px) {
  body {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    min-height: auto;
  }

  .nav {
    grid-template-columns: repeat(5, minmax(110px, 1fr));
    overflow-x: auto;
  }

  .work-grid,
  .stats-grid,
  .kanban,
  .cards-grid,
  .records-grid,
  .rules-grid,
  .invoice-layout {
    grid-template-columns: 1fr 1fr;
  }
}

@media (max-width: 680px) {
  body {
    font-size: 16px;
  }

  .shell {
    padding: 14px;
  }

  .sidebar {
    padding: 14px;
  }

  .brand {
    margin-bottom: 14px;
  }

  .brand-logo {
    width: 54px;
    height: 54px;
  }

  .nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    padding-bottom: 4px;
    scroll-snap-type: x proximity;
  }

  .nav-item {
    flex: 0 0 auto;
    min-height: 44px;
    min-width: 116px;
    text-align: center;
    scroll-snap-align: start;
  }

  .topbar,
  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .stats-grid,
  .work-grid,
  .kanban,
  .cards-grid,
  .records-grid,
  .rules-grid,
  .invoice-layout,
  .invoice-lines,
  dl,
  .settings-grid,
  .form-grid {
    grid-template-columns: 1fr;
  }

  .table-wrap {
    overflow-x: auto;
    border-radius: 8px;
  }

  table {
    min-width: 860px;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .icon-btn,
  .row-actions button,
  .link-btn {
    min-height: 46px;
  }

  .row-actions {
    justify-content: flex-start;
  }

  .record-card,
  .panel,
  .invoice-paper,
  .card {
    padding: 14px;
  }

  .portal-shell {
    width: min(100% - 20px, 1100px);
    padding: 12px 0;
  }

  .portal-hero {
    align-items: flex-start;
    flex-direction: column;
    padding: 16px;
  }

  .portal-hero img {
    width: 92px;
    height: 92px;
  }

  .portal-hero h1 {
    font-size: 26px;
  }

  .toolbar {
    display: grid;
    grid-template-columns: 1fr;
  }

  .toolbar input,
  .toolbar select,
  .toolbar button {
    width: 100%;
  }

  .login-card {
    padding: 20px;
  }

  .login-logo {
    width: 124px;
  }
}

/* OPS mobile operations redesign */
:root {
  --ink: #12212a;
  --muted: #687783;
  --line: #d7e1e7;
  --soft: #eef4f5;
  --paper: #ffffff;
  --brand: #0c6b67;
  --brand-dark: #092f3d;
  --accent: #ff6a21;
  --gold: #f2bd3d;
  --blue: #0f4e83;
  --shadow: 0 18px 44px rgba(12, 35, 50, 0.10);
}

body {
  background:
    radial-gradient(circle at 94% 2%, rgba(255, 106, 33, 0.10), transparent 26rem),
    linear-gradient(135deg, #eef4f5 0%, #f8fbfc 42%, #edf6f3 100%);
}

.sidebar {
  background: linear-gradient(180deg, #092f3d 0%, #123d4a 56%, #092932 100%);
  box-shadow: 10px 0 32px rgba(8, 30, 42, 0.12);
}

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

.brand strong {
  display: block;
  font-size: 18px;
  letter-spacing: 0;
}

.brand-logo {
  box-shadow: 0 10px 24px rgba(0, 0, 0, 0.18);
}

.nav {
  gap: 6px;
  scrollbar-width: none;
}

.nav::-webkit-scrollbar {
  display: none;
}

.nav-item {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 7px;
  font-weight: 700;
}

.nav-item.active {
  background: linear-gradient(135deg, rgba(255, 106, 33, 0.95), rgba(255, 132, 53, 0.95));
  color: #fff;
  box-shadow: 0 12px 24px rgba(255, 106, 33, 0.20);
}

.nav-item:hover {
  background: rgba(255, 255, 255, 0.10);
}

.shell {
  padding: 24px;
}

.topbar {
  background: #fff;
  border: 1px solid rgba(215, 225, 231, 0.9);
  border-left: 5px solid var(--accent);
  border-radius: 8px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
  padding: 16px 18px;
}

h1 {
  color: var(--brand-dark);
  font-size: 28px;
}

.user-pill {
  background: #f7fafb;
  border-color: #cddae0;
  color: var(--brand-dark);
}

.panel,
.card,
.record-card,
.invoice-paper,
.portal-hero {
  border: 1px solid rgba(205, 218, 224, 0.95);
  border-radius: 8px;
  box-shadow: 0 12px 30px rgba(12, 35, 50, 0.08);
}

.panel-head,
.section-head {
  border-bottom: 1px solid rgba(215, 225, 231, 0.78);
  margin-bottom: 14px;
  padding-bottom: 12px;
}

.primary-btn,
button.primary-btn,
.secondary-btn,
.danger-btn,
.row-actions button,
.link-btn {
  border-radius: 7px;
  font-weight: 800;
}

.primary-btn {
  background: linear-gradient(135deg, var(--brand), #15958f);
  border-color: var(--brand);
  box-shadow: 0 12px 22px rgba(12, 107, 103, 0.18);
}

.secondary-btn,
.row-actions button,
.link-btn {
  background: #fff;
  border-color: #cbd9df;
  color: var(--brand-dark);
}

.danger-btn {
  background: #fff1ec;
  border-color: #ffc3ad;
  color: #a43d17;
}

.ops-actionbar {
  align-items: center;
  background: linear-gradient(135deg, #092f3d, #0c6b67);
  border-radius: 8px;
  box-shadow: 0 16px 34px rgba(9, 47, 61, 0.22);
  color: #fff;
  display: flex;
  justify-content: space-between;
  margin: 0 0 18px;
  padding: 13px 14px;
}

.ops-actionbar span {
  color: #bceae8;
  display: block;
  font-size: 12px;
  font-weight: 900;
}

.ops-actionbar strong {
  display: block;
  font-size: 18px;
}

.ops-tools {
  display: flex;
  gap: 8px;
}

.icon-action {
  align-items: center;
  border: 0;
  border-radius: 7px;
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  font-size: 24px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  line-height: 1;
  text-decoration: none;
  width: 42px;
}

.icon-action.add {
  background: #18a86f;
}

.icon-action.edit {
  background: #f2bd3d;
  color: #102632;
}

.icon-action.delete {
  background: #ff5b45;
}

.form-grid label,
.settings-form label {
  color: #344752;
  font-weight: 800;
}

input,
select,
textarea {
  border-color: #cbd9df;
  border-radius: 7px;
}

input:focus,
select:focus,
textarea:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(12, 107, 103, 0.14);
  outline: none;
}

.status {
  background: #e8f8f4;
  border: 1px solid #b6e7db;
  color: #07564c;
  font-weight: 900;
}

.status.alert {
  background: #fff2ee;
  border-color: #ffc4b1;
  color: #9e3916;
}

.settings-form {
  display: grid;
  gap: 14px;
  margin-bottom: 18px;
}

.settings-block {
  background: #fff;
  border: 1px solid rgba(205, 218, 224, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  padding: 18px;
}

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

.check-row {
  align-items: center;
  background: #f7fafb;
  border: 1px solid #d7e1e7;
  border-radius: 8px;
  display: flex;
  gap: 10px;
  padding: 12px;
}

.check-row input {
  width: auto;
}

.terminal-admin,
.print-toolbar {
  background: #fff;
  border: 1px solid rgba(205, 218, 224, 0.95);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 16px;
}

.terminal-limit-label {
  background: #fff3df;
  border: 1px solid #ffd593;
  border-radius: 7px;
  color: #7a4b00;
  font-weight: 900;
  padding: 9px 12px;
}

.print-toolbar {
  align-items: center;
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
}

.table-wrap {
  border: 1px solid rgba(205, 218, 224, 0.95);
  border-radius: 8px;
}

th {
  background: #e8f0f3;
  color: #213746;
}

tbody tr:hover {
  background: #f8fcfc;
}

.invoice-paper {
  background:
    linear-gradient(#fff, #fff) padding-box,
    linear-gradient(135deg, rgba(12, 107, 103, 0.35), rgba(255, 106, 33, 0.35)) border-box;
}

.customer-portal {
  background:
    radial-gradient(circle at 15% 0%, rgba(12, 107, 103, 0.10), transparent 26rem),
    linear-gradient(145deg, #f5faf9, #eef4f5);
}

.portal-hero {
  align-items: center;
  background: linear-gradient(135deg, #ffffff 0%, #eff8f7 100%);
  border-left: 5px solid var(--accent);
}

.portal-hero h1 {
  font-size: 34px;
}

@media (max-width: 980px) {
  .sidebar {
    border-radius: 0 0 8px 8px;
  }

  .brand {
    margin-bottom: 12px;
  }

  .nav {
    display: flex;
    overflow-x: auto;
    padding-bottom: 5px;
  }

  .nav-item {
    flex: 0 0 auto;
    min-width: 132px;
    text-align: center;
  }
}

@media (max-width: 680px) {
  .shell {
    padding: 12px;
  }

  .sidebar {
    padding: 12px;
  }

  .topbar {
    gap: 12px;
    padding: 14px;
  }

  h1 {
    font-size: 23px;
  }

  h2 {
    font-size: 18px;
  }

  .topbar-actions {
    display: grid;
    grid-template-columns: 1fr auto;
    width: 100%;
  }

  .user-pill {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .ops-actionbar {
    align-items: stretch;
    gap: 12px;
    padding: 12px;
  }

  .ops-actionbar strong {
    font-size: 16px;
  }

  .icon-action {
    height: 46px;
    width: 46px;
  }

  .settings-block,
  .print-toolbar {
    grid-template-columns: 1fr;
  }

  .print-toolbar {
    align-items: stretch;
    display: grid;
  }

  table {
    min-width: 0;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    background: #fff;
    border: 1px solid #d7e1e7;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(12, 35, 50, 0.06);
    margin: 0 0 12px;
    padding: 10px;
  }

  .table-wrap td {
    border: 0;
    display: block;
    gap: 8px;
    padding: 7px 0;
  }

  .table-wrap td[data-label] {
    display: grid;
    grid-template-columns: minmax(92px, 34%) 1fr;
  }

  .table-wrap td[data-label]::before {
    color: #60727d;
    content: attr(data-label);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .row-actions {
    display: grid;
    grid-template-columns: 1fr 1fr;
    width: 100%;
  }

  .row-actions form,
  .row-actions .link-btn,
  .row-actions button {
    width: 100%;
  }

  #devicesTable td:nth-child(1)::before { content: "Equipo"; }
  #devicesTable td:nth-child(2)::before { content: "Estado"; }
  #devicesTable td:nth-child(3)::before { content: "Usuario"; }
  #devicesTable td:nth-child(4)::before { content: "IP"; }
  #devicesTable td:nth-child(5)::before { content: "Terminal"; }
  #devicesTable td:nth-child(6)::before { content: "Impresora"; }

  .portal-hero h1 {
    font-size: 25px;
  }
}

@media (max-width: 760px) {
  html,
  body {
    max-width: 100%;
    overflow-x: hidden;
  }

  body {
    grid-template-columns: minmax(0, 1fr);
  }

  .sidebar,
  .shell,
  .topbar,
  .panel,
  .ops-actionbar,
  .terminal-admin,
  .invoice-paper,
  .table-wrap {
    max-width: 100%;
    min-width: 0;
  }

  .shell {
    padding: 12px;
  }

  .topbar,
  .section-head,
  .panel-head {
    align-items: flex-start;
    flex-direction: column;
  }

  .ops-actionbar {
    align-items: center;
  }

  .form-grid,
  .settings-block,
  .invoice-layout,
  .records-grid,
  .cards-grid,
  .rules-grid,
  .stats-grid,
  .work-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  input,
  select,
  textarea {
    min-width: 0;
    width: 100%;
  }
}

/* Phone/tablet operations mode: designed for people walking with the device. */
@media (max-width: 1024px), (pointer: coarse) {
  :root {
    --mobile-ink: #13262f;
    --mobile-page: #eef3f5;
    --mobile-header: #092f3d;
    --mobile-card: #ffffff;
  }

  html {
    background: var(--mobile-page);
    overflow-x: hidden;
    text-size-adjust: 100%;
  }

  body {
    display: block;
    min-height: 100vh;
    overflow-x: hidden;
    background: var(--mobile-page);
    color: var(--mobile-ink);
    font-size: 18px;
    line-height: 1.35;
    padding-bottom: 86px;
  }

  .sidebar {
    background: linear-gradient(180deg, #082e3b 0%, #063f48 100%);
    border-bottom: 4px solid var(--accent);
    border-radius: 0;
    box-shadow: 0 10px 26px rgba(8, 34, 44, 0.24);
    color: #fff;
    min-height: 0;
    overflow: hidden;
    padding: 12px 12px 10px;
    position: sticky;
    top: 0;
    z-index: 20;
  }

  .brand {
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    display: grid;
    gap: 10px;
    grid-template-columns: 58px minmax(0, 1fr);
    margin: 0 0 10px;
    padding: 0 0 10px;
  }

  .brand-logo {
    border-radius: 10px;
    height: 58px;
    padding: 4px;
    width: 58px;
  }

  .brand strong {
    color: #fff;
    display: block;
    font-size: 22px;
    line-height: 1.05;
  }

  .brand small {
    color: #c9ecea;
    display: block;
    font-size: 14px;
    margin-top: 3px;
  }

  .nav {
    display: grid;
    gap: 8px;
    grid-auto-columns: minmax(128px, 1fr);
    grid-auto-flow: column;
    overflow-x: auto;
    padding: 1px 0 4px;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
  }

  .nav::-webkit-scrollbar {
    display: none;
  }

  .nav-item {
    align-items: center;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: 10px;
    color: #ecfbfb;
    display: flex;
    font-size: 17px;
    font-weight: 900;
    justify-content: center;
    min-height: 50px;
    min-width: 128px;
    padding: 0 12px;
    scroll-snap-align: start;
    text-align: center;
    white-space: nowrap;
  }

  .nav-item.active {
    background: linear-gradient(135deg, #ff6a21, #ff8a3d);
    border-color: transparent;
    color: #fff;
    box-shadow: 0 10px 20px rgba(255, 106, 33, 0.22);
  }

  .shell {
    min-width: 0;
    padding: 12px;
  }

  .topbar {
    align-items: stretch;
    background: var(--mobile-card);
    border: 1px solid #d9e4e9;
    border-left: 5px solid var(--accent);
    border-radius: 10px;
    box-shadow: 0 8px 20px rgba(12, 35, 50, 0.08);
    display: grid;
    gap: 12px;
    margin: 0 0 12px;
    padding: 14px;
  }

  .topbar h1 {
    color: #092f3d;
    font-size: clamp(28px, 6.2vw, 42px);
    line-height: 1.02;
  }

  .topbar p {
    color: #50616b;
    font-size: 17px;
    line-height: 1.25;
    margin-top: 7px;
  }

  .topbar-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .user-pill,
  .topbar .link-btn {
    border-radius: 9px;
    font-size: 16px;
    min-height: 48px;
  }

  .user-pill {
    align-items: center;
    display: flex;
    overflow: hidden;
    padding: 0 12px;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  .topbar .link-btn {
    justify-content: center;
    padding: 0 14px;
  }

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

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

  .stat {
    background: #fff;
    border: 1px solid #d9e4e9;
    border-left: 5px solid #0c6b67;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(12, 35, 50, 0.06);
    min-height: 96px;
    padding: 14px;
  }

  .stat span {
    color: #53646d;
    display: block;
    font-size: 15px;
    font-weight: 900;
  }

  .stat strong {
    color: #092f3d;
    display: block;
    font-size: clamp(30px, 8vw, 42px);
    line-height: 1;
    margin-top: 8px;
  }

  .stat:nth-child(2),
  .stat:nth-child(5) {
    border-left-color: #ff6a21;
  }

  .stat:nth-child(3),
  .stat:nth-child(7) {
    border-left-color: #0f4e83;
  }

  .work-grid,
  .records-grid,
  .cards-grid,
  .rules-grid,
  .invoice-layout,
  .kanban {
    display: grid;
    gap: 12px;
    grid-template-columns: minmax(0, 1fr);
  }

  .panel,
  .card,
  .record-card,
  .invoice-paper,
  .terminal-admin,
  .settings-block,
  .table-wrap {
    background: #fff;
    border: 1px solid #d9e4e9;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(12, 35, 50, 0.06);
    max-width: 100%;
    min-width: 0;
  }

  .panel,
  .card,
  .record-card,
  .invoice-paper,
  .terminal-admin,
  .settings-block {
    padding: 14px;
  }

  .panel-head,
  .section-head {
    align-items: flex-start;
    border-bottom: 1px solid #e2ebef;
    display: grid;
    gap: 6px;
    margin-bottom: 12px;
    padding-bottom: 12px;
  }

  .panel-head h2,
  .section-head h2 {
    color: #092f3d;
    font-size: 23px;
    line-height: 1.08;
  }

  .panel-head span,
  .section-head p {
    color: #5b6c74;
    font-size: 16px;
  }

  .activity-list,
  .compact-list {
    display: grid;
    gap: 10px;
    margin-top: 0;
  }

  .activity-item,
  .compact-item,
  .list-button {
    background: #f8fbfc;
    border: 1px solid #dce7ec;
    border-radius: 10px;
    display: grid;
    gap: 8px;
    padding: 13px;
  }

  .activity-item strong,
  .compact-item strong,
  .list-button strong {
    color: #092f3d;
    font-size: 18px;
  }

  .activity-item p,
  .compact-item p,
  .list-button span {
    color: #53646d;
    font-size: 16px;
    margin-top: 4px;
  }

  .status {
    border-radius: 999px;
    font-size: 14px;
    font-weight: 900;
    min-height: 32px;
    padding: 0 12px;
    width: max-content;
  }

  .ops-actionbar {
    align-items: center;
    background: linear-gradient(135deg, #092f3d, #0c6b67);
    border-radius: 10px;
    box-shadow: 0 10px 24px rgba(9, 47, 61, 0.18);
    display: grid;
    gap: 10px;
    grid-template-columns: minmax(0, 1fr) auto;
    margin: 0 0 12px;
    padding: 12px;
  }

  .ops-actionbar span {
    color: #bdecea;
    font-size: 13px;
    font-weight: 900;
  }

  .ops-actionbar strong {
    color: #fff;
    font-size: 20px;
    line-height: 1.1;
  }

  .ops-tools {
    display: flex;
    gap: 8px;
  }

  .icon-action {
    border-radius: 10px;
    font-size: 28px;
    height: 52px;
    width: 52px;
  }

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

  .form-grid label,
  .settings-form label {
    color: #2f424d;
    font-size: 16px;
    font-weight: 900;
  }

  input,
  select,
  textarea {
    border: 1px solid #c5d5dc;
    border-radius: 10px;
    font-size: 18px;
    min-height: 54px;
    min-width: 0;
    padding: 12px 13px;
    width: 100%;
  }

  textarea {
    min-height: 106px;
  }

  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .icon-btn,
  .row-actions button,
  .link-btn,
  button {
    border-radius: 10px;
    font-size: 17px;
    font-weight: 900;
    min-height: 52px;
  }

  .modal-actions,
  .toolbar,
  .print-toolbar {
    display: grid;
    gap: 9px;
    grid-template-columns: minmax(0, 1fr);
  }

  .row-actions {
    display: grid;
    gap: 8px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
  }

  .row-actions form,
  .row-actions .link-btn,
  .row-actions button {
    width: 100%;
  }

  .table-wrap {
    background: transparent;
    border: 0;
    box-shadow: none;
    overflow: visible;
  }

  .table-wrap table,
  .table-wrap thead,
  .table-wrap tbody,
  .table-wrap tr,
  .table-wrap td {
    display: block;
    width: 100%;
  }

  .table-wrap thead {
    display: none;
  }

  .table-wrap tr {
    background: #fff;
    border: 1px solid #d9e4e9;
    border-radius: 10px;
    box-shadow: 0 8px 18px rgba(12, 35, 50, 0.06);
    margin: 0 0 12px;
    padding: 12px;
  }

  .table-wrap td {
    border: 0;
    color: #1b303b;
    font-size: 16px;
    padding: 8px 0;
  }

  .table-wrap td[data-label] {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(96px, 32%) 1fr;
  }

  .table-wrap td[data-label]::before {
    color: #60727d;
    content: attr(data-label);
    font-size: 12px;
    font-weight: 900;
    text-transform: uppercase;
  }

  .screen-dashboard .topbar {
    background:
      linear-gradient(135deg, rgba(9, 47, 61, 0.95), rgba(12, 107, 103, 0.92)),
      #092f3d;
    border: 0;
    border-radius: 0 0 18px 18px;
    box-shadow: 0 12px 28px rgba(9, 47, 61, 0.22);
    color: #fff;
    margin: -12px -12px 12px;
    padding: 18px 14px 16px;
  }

  .screen-dashboard .topbar h1,
  .screen-dashboard .topbar p {
    color: #fff;
  }

  .screen-dashboard .user-pill,
  .screen-dashboard .topbar .link-btn {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.22);
    color: #fff;
  }

  .mobile-quick-actions {
    display: grid;
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 12px;
  }

  .mobile-quick-actions a {
    background: #fff;
    border: 1px solid #d9e4e9;
    border-radius: 12px;
    box-shadow: 0 8px 18px rgba(12, 35, 50, 0.07);
    color: #092f3d;
    display: grid;
    gap: 4px;
    min-height: 112px;
    padding: 13px;
    text-decoration: none;
  }

  .mobile-quick-actions span {
    align-items: center;
    background: #e8f8f4;
    border-radius: 10px;
    color: #07564c;
    display: inline-flex;
    font-size: 25px;
    font-weight: 900;
    height: 42px;
    justify-content: center;
    width: 42px;
  }

  .mobile-quick-actions a:nth-child(1) span {
    background: #e9fbf1;
    color: #10814e;
  }

  .mobile-quick-actions a:nth-child(2) span {
    background: #eef5ff;
    color: #0f4e83;
  }

  .mobile-quick-actions a:nth-child(3) span {
    background: #fff4df;
    color: #8c5a00;
  }

  .mobile-quick-actions a:nth-child(4) span {
    background: #fff0ec;
    color: #a43d17;
  }

  .mobile-quick-actions strong {
    display: block;
    font-size: 18px;
    line-height: 1.08;
  }

  .mobile-quick-actions small {
    color: #657782;
    font-size: 14px;
    font-weight: 800;
  }
}

/* OPS Control Center visual system */
:root {
  --primary: #0b3d4a;
  --primary-dark: #062c36;
  --accent: #ff6b2c;
  --accent-soft: #fff0e9;
  --success: #009879;
  --warning: #f5a623;
  --danger: #e74c3c;
  --info: #1d72b8;
  --bg: #f4f7f9;
  --card: #ffffff;
  --text: #0f2d38;
  --muted: #6b7c86;
  --border: #dce6ea;
}

body {
  background:
    radial-gradient(circle at 82% 0%, rgba(255, 107, 44, 0.10), transparent 28rem),
    linear-gradient(135deg, #f4f7f9 0%, #eef5f6 100%);
  color: var(--text);
  font-family: "Segoe UI", Arial, Helvetica, sans-serif;
}

.sidebar {
  background: linear-gradient(180deg, var(--primary-dark), #093744 58%, #071f27);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 12px 0 36px rgba(6, 44, 54, 0.14);
}

.brand {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 14px;
  margin-bottom: 18px;
  padding: 12px;
}

.brand-logo {
  border-radius: 12px;
}

.brand strong {
  color: #fff;
  font-size: 19px;
}

.sidebar .brand small {
  color: #aee6df;
}

.nav {
  gap: 7px;
}

.nav-item {
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  display: flex;
  gap: 10px;
  min-height: 46px;
  padding: 0 12px;
}

.nav-icon {
  align-items: center;
  background: rgba(255, 255, 255, 0.10);
  border-radius: 10px;
  color: #dff8f5;
  display: inline-flex;
  flex: 0 0 32px;
  font-size: 13px;
  font-weight: 900;
  height: 32px;
  justify-content: center;
  width: 32px;
}

.nav-item.active {
  background: linear-gradient(135deg, var(--accent), #ff8b4d);
  border-color: transparent;
  box-shadow: 0 12px 26px rgba(255, 107, 44, 0.28);
}

.nav-item.active .nav-icon {
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}

.shell {
  padding: 24px;
}

.topbar {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 12px 30px rgba(15, 45, 56, 0.08);
  margin-bottom: 18px;
  padding: 18px 20px;
}

.page-kicker {
  color: var(--accent);
  display: block;
  font-size: 13px;
  font-weight: 900;
  margin-bottom: 5px;
  text-transform: uppercase;
}

.topbar h1 {
  color: var(--text);
  font-size: 30px;
  line-height: 1.05;
}

.topbar p {
  color: var(--muted);
  font-size: 15px;
}

.dashboard-grid,
.stats-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  margin-bottom: 18px;
}

.action-card,
.card,
.panel,
.record-card,
.stat,
.table-wrap,
.invoice-paper,
.terminal-admin,
.settings-block {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 18px;
  box-shadow: 0 10px 30px rgba(15, 45, 56, 0.08);
  transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.action-card:hover,
.card:hover,
.record-card:hover,
.stat:hover {
  box-shadow: 0 16px 38px rgba(15, 45, 56, 0.14);
  transform: translateY(-3px);
}

.action-card {
  color: var(--text);
  min-height: 150px;
  padding: 18px;
  text-decoration: none;
}

.action-icon {
  align-items: center;
  background: var(--accent-soft);
  border-radius: 14px;
  color: var(--accent);
  display: flex;
  font-size: 24px;
  font-weight: 900;
  height: 48px;
  justify-content: center;
  margin-bottom: 14px;
  width: 48px;
}

.action-card strong {
  display: block;
  font-size: 21px;
  line-height: 1.1;
}

.action-card small {
  color: var(--muted);
  display: block;
  font-size: 14px;
  font-weight: 800;
  margin-top: 7px;
}

.metric-card {
  min-height: 118px;
  padding: 18px;
  position: relative;
}

.metric-card::after {
  background: var(--accent-soft);
  border-radius: 999px;
  content: "";
  height: 42px;
  position: absolute;
  right: 16px;
  top: 16px;
  width: 42px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.metric-card strong {
  color: var(--text);
  display: block;
  font-size: 34px;
  line-height: 1;
  margin-top: 14px;
}

.badge {
  border-radius: 999px;
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  min-height: 30px;
  padding: 7px 12px;
  width: max-content;
}

.badge.success {
  background: #e7fff8;
  border: 1px solid #b5f1df;
  color: var(--success);
}

.badge.warning {
  background: #fff7e6;
  border: 1px solid #ffe0a3;
  color: #a96b00;
}

.badge.info {
  background: #edf6ff;
  border: 1px solid #bddbff;
  color: var(--info);
}

.badge.danger {
  background: #fff0ed;
  border: 1px solid #ffc5bc;
  color: var(--danger);
}

.work-grid {
  align-items: start;
  display: grid;
  gap: 18px;
  grid-template-columns: minmax(0, 1.45fr) minmax(360px, 0.55fr);
}

.logistics-panel,
.delivery-panel {
  padding: 18px;
}

.logistics-timeline {
  display: grid;
  gap: 12px;
  margin-top: 14px;
  position: relative;
}

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

.timeline-dot {
  background: var(--accent);
  border: 4px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 2px #ffd4c3;
  height: 18px;
  margin-top: 18px;
  width: 18px;
}

.timeline-card,
.delivery-card {
  align-items: center;
  background: #fbfdfe;
  border: 1px solid var(--border);
  border-radius: 16px;
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  padding: 14px;
}

.timeline-card strong,
.delivery-card strong {
  color: var(--text);
  font-size: 16px;
}

.timeline-card p,
.delivery-card p {
  color: var(--muted);
  margin-top: 4px;
}

.timeline-card small {
  color: var(--muted);
  grid-column: 1 / -1;
}

.search-hero {
  background: linear-gradient(135deg, var(--primary), #0f5c68);
  border-radius: 18px;
  box-shadow: 0 18px 42px rgba(6, 44, 54, 0.18);
  color: #fff;
  display: grid;
  gap: 16px;
  margin-bottom: 18px;
  padding: 18px;
}

.search-hero span {
  color: #bdeee8;
  display: block;
  font-size: 13px;
  font-weight: 900;
  text-transform: uppercase;
}

.search-hero strong {
  display: block;
  font-size: 24px;
}

.search-box-row {
  display: grid;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.search-box-row input {
  border: 0;
  min-height: 54px;
}

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

.premium-record-card {
  padding: 18px;
}

.premium-record-card .record-head {
  align-items: start;
  display: grid;
  gap: 12px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.premium-record-card .record-head .badge {
  align-self: start;
  line-height: 1.15;
  max-width: 180px;
  min-height: 0;
  text-align: center;
  white-space: normal;
}

.record-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

@media (max-width: 1100px) {
  .dashboard-grid,
  .stats-grid,
  .premium-records {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 900px) {
  .sidebar {
    display: block;
  }

  .shell {
    padding: 14px;
  }
}

@media (max-width: 620px), (pointer: coarse) and (max-width: 760px) {
  .dashboard-grid,
  .stats-grid,
  .premium-records {
    grid-template-columns: 1fr;
  }

  .topbar {
    border-radius: 18px;
    padding: 16px;
  }

  .topbar h1 {
    font-size: 26px;
  }

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

  .timeline-card,
  .delivery-card {
    grid-template-columns: 1fr;
  }
}

/* Package action legend and subtle row controls */
.records-heading {
  align-items: center;
}

.action-guide {
  align-items: center;
  background: rgba(255, 255, 255, 0.78);
  border: 1px solid var(--border);
  border-radius: 999px;
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 6px;
}

.action-guide span {
  align-items: center;
  color: var(--muted);
  display: inline-flex;
  font-size: 12px;
  font-weight: 800;
  gap: 5px;
  padding: 4px 8px;
}

.action-guide b {
  align-items: center;
  background: #eef5f6;
  border-radius: 8px;
  color: var(--primary);
  display: inline-flex;
  font-size: 13px;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.selected-actionbar {
  align-items: center;
  background: rgba(255, 255, 255, 0.82);
  border: 1px solid var(--border);
  border-radius: 18px;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px;
}

#selectedPackageLabel {
  color: var(--muted);
  font-size: 13px;
  font-weight: 900;
  padding: 0 8px;
}

.selected-action-form {
  display: inline-flex;
  margin: 0;
}

.selected-action {
  align-items: center;
  background: #f7fbfc;
  border: 1px solid #d7e4e9;
  border-radius: 12px;
  color: var(--primary);
  display: inline-flex;
  font-size: 13px;
  font-weight: 900;
  gap: 6px;
  min-height: 38px;
  padding: 0 11px;
  text-decoration: none;
}

.selected-action b {
  align-items: center;
  background: #eef5f6;
  border-radius: 9px;
  display: inline-flex;
  height: 24px;
  justify-content: center;
  width: 24px;
}

.selected-action[disabled],
.selected-action[aria-disabled="true"] {
  cursor: not-allowed;
  opacity: 0.45;
  pointer-events: none;
}

.selected-action.ready {
  background: #fff;
}

.selected-action.danger {
  color: var(--danger);
}

.selectable-row {
  cursor: pointer;
}

.selectable-row.selected {
  background: #f4fbfa;
  box-shadow: inset 4px 0 0 var(--accent);
}

.package-selector {
  accent-color: var(--accent);
  cursor: pointer;
  min-height: 0;
  width: 18px;
}

.row-icon-actions {
  align-items: center;
  display: flex;
  flex-wrap: nowrap;
  gap: 7px;
  justify-content: flex-end;
}

.row-icon-actions form {
  display: inline-flex;
  margin: 0;
}

.row-icon-btn,
.row-icon-actions .row-icon-btn,
.row-icon-actions button.row-icon-btn {
  align-items: center;
  background: #fff;
  border: 1px solid #d7e4e9;
  border-radius: 10px;
  box-shadow: none;
  color: var(--primary);
  display: inline-flex;
  font-size: 17px;
  font-weight: 900;
  height: 36px;
  justify-content: center;
  line-height: 1;
  min-height: 36px;
  padding: 0;
  text-decoration: none;
  width: 36px;
}

.row-icon-btn:hover {
  background: #f6fbfc;
  border-color: #b9d0d8;
}

.row-icon-btn.next {
  color: var(--info);
}

.row-icon-btn.box {
  color: var(--success);
}

.row-icon-btn.remove {
  color: var(--danger);
}

.new-package-pill {
  align-items: center;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.22);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 14px;
  font-weight: 900;
  gap: 8px;
  min-height: 40px;
  padding: 0 14px 0 8px;
  text-decoration: none;
}

.new-package-pill span {
  align-items: center;
  background: var(--accent);
  border-radius: 999px;
  color: #fff;
  display: inline-flex;
  font-size: 18px;
  height: 28px;
  justify-content: center;
  line-height: 1;
  width: 28px;
}

@media (max-width: 760px), (pointer: coarse) {
  .records-heading {
    align-items: stretch;
    display: grid;
    gap: 10px;
  }

  .action-guide {
    border-radius: 14px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .selected-actionbar {
    align-items: stretch;
    border-radius: 14px;
    display: grid;
    grid-template-columns: 1fr 1fr;
  }

  #selectedPackageLabel {
    grid-column: 1 / -1;
  }

  .selected-action-form,
  .selected-action {
    width: 100%;
  }

  .selected-action {
    justify-content: center;
    min-height: 46px;
  }

  .row-icon-actions {
    justify-content: flex-start;
  }

  .row-icon-btn,
  .row-icon-actions .row-icon-btn,
  .row-icon-actions button.row-icon-btn {
    height: 44px;
    min-height: 44px;
    width: 44px;
  }

  .new-package-pill {
    justify-content: center;
    min-height: 46px;
    width: 100%;
  }
}

@media (max-width: 430px), (pointer: coarse) and (max-width: 560px) {
  body {
    font-size: 17px;
  }

  .sidebar {
    padding: 9px 9px 8px;
  }

  .brand {
    grid-template-columns: 48px minmax(0, 1fr);
  }

  .brand-logo {
    height: 48px;
    width: 48px;
  }

  .brand strong {
    font-size: 19px;
  }

  .brand small {
    font-size: 12px;
  }

  .nav-item {
    font-size: 15px;
    min-height: 44px;
    min-width: 104px;
  }

  .shell {
    padding: 10px;
  }

  .topbar h1 {
    font-size: 28px;
  }

  .topbar p {
    font-size: 15px;
  }

  .stats-grid {
    gap: 8px;
  }

  .stat {
    min-height: 86px;
    padding: 11px;
  }

  .stat span {
    font-size: 13px;
  }

  .stat strong {
    font-size: 30px;
  }

  .panel,
  .card,
  .record-card,
  .invoice-paper,
  .terminal-admin,
  .settings-block {
    padding: 12px;
  }

  input,
  select,
  textarea,
  .primary-btn,
  .secondary-btn,
  .danger-btn,
  .icon-btn,
  .row-actions button,
  .link-btn,
  button {
    font-size: 16px;
    min-height: 50px;
  }

  .icon-action {
    height: 48px;
    width: 48px;
  }
}

@media print {
  body {
    display: block;
    background: #fff;
  }

  .sidebar,
  .topbar,
  .panel,
  .section-head,
  .invoice-actions,
  .login-screen {
    display: none !important;
  }

  .shell {
    padding: 0;
  }

  .view {
    display: none !important;
  }

  #billing {
    display: block !important;
  }

  .invoice-layout {
    display: block;
  }

  .invoice-paper {
    border: 0;
    box-shadow: none;
  }
}

/* OPS Pro Mobile final layer */
.mobile-tabbar {
  display: none;
}

.customer-grid {
  margin-top: 14px;
}

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

.customer-card-top strong {
  display: block;
  font-size: 20px;
}

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

.customer-facts div {
  background: #f7fafb;
  border: 1px solid #dce7ec;
  border-radius: 8px;
  padding: 9px;
}

.customer-facts dt {
  color: #657782;
  font-size: 12px;
  font-weight: 900;
  text-transform: uppercase;
}

.customer-facts dd {
  margin: 4px 0 0;
  overflow-wrap: anywhere;
}

.scan-input-row {
  display: grid;
  gap: 8px;
  grid-template-columns: minmax(0, 1fr) auto;
}

.scan-id-btn {
  white-space: nowrap;
}

.scan-modal {
  align-items: center;
  background: rgba(7, 22, 31, 0.76);
  display: flex;
  inset: 0;
  justify-content: center;
  padding: 16px;
  position: fixed;
  z-index: 60;
}

.scan-box {
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0, 0, 0, 0.36);
  max-width: 520px;
  overflow: hidden;
  width: 100%;
}

.scan-head {
  align-items: flex-start;
  border-bottom: 1px solid #dce7ec;
  display: flex;
  gap: 12px;
  justify-content: space-between;
  padding: 14px;
}

.scan-head strong {
  color: #092f3d;
  display: block;
  font-size: 20px;
}

.scan-video {
  background: #000;
  display: block;
  max-height: 58vh;
  object-fit: cover;
  width: 100%;
}

.scan-status {
  color: #50616b;
  font-weight: 800;
  padding: 12px 14px 16px;
}

.receipt80-body {
  background: #f3f5f2;
  display: block;
}

.receipt80 {
  background: #fff;
  color: #111;
  font-family: "Courier New", Consolas, monospace;
  font-size: 12px;
  line-height: 1.25;
  margin: 18px auto;
  padding: 8px;
  width: 80mm;
}

.receipt-center {
  display: grid;
  gap: 2px;
  justify-items: center;
  text-align: center;
}

.receipt-logo {
  height: 42px;
  object-fit: contain;
  width: 58px;
}

.receipt-line {
  border-top: 1px dashed #111;
  margin: 7px 0;
}

.receipt-row {
  display: flex;
  justify-content: space-between;
}

.receipt-items {
  width: 100%;
}

.receipt-items td {
  border: 0;
  padding: 2px 0;
}

.receipt-items td:last-child {
  text-align: right;
}

.receipt-total td {
  border-top: 1px dashed #111;
  font-size: 14px;
  font-weight: 900;
  padding-top: 5px;
}

.receipt-note {
  font-size: 11px;
  text-align: center;
}

.receipt-sign {
  border-top: 1px solid #111;
  margin: 24px auto 8px;
  padding-top: 4px;
  text-align: center;
  width: 70%;
}

.receipt-print {
  margin-top: 10px;
  width: 100%;
}

.photo-capture-panel {
  background: linear-gradient(135deg, #f7fbfc, #eef7f5);
  border: 1px solid #d6e5e9;
  border-radius: 10px;
  display: grid;
  gap: 12px;
  padding: 14px;
}

.photo-capture-panel strong {
  color: #092f3d;
  display: block;
  font-size: 20px;
}

.photo-capture-panel p {
  color: #5b6c74;
  margin-top: 4px;
}

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

.photo-picker {
  align-items: center;
  background: #fff;
  border: 2px dashed #9cc7c2;
  border-radius: 10px;
  color: #0b5b63;
  cursor: pointer;
  display: flex;
  font-weight: 900;
  justify-content: center;
  min-height: 72px;
  padding: 12px;
  text-align: center;
}

.photo-picker input {
  display: none;
}

.package-gallery {
  display: grid;
  gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
}

.package-gallery a {
  background: #fff;
  border: 1px solid #d6e5e9;
  border-radius: 10px;
  color: #092f3d;
  display: grid;
  font-size: 12px;
  font-weight: 900;
  gap: 6px;
  overflow: hidden;
  padding: 6px;
  text-decoration: none;
}

.package-gallery img {
  aspect-ratio: 1.18;
  border-radius: 7px;
  object-fit: cover;
  width: 100%;
}

@media (max-width: 1024px), (pointer: coarse) {
  body {
    padding-bottom: 86px;
  }

  .sidebar {
    border-bottom: 4px solid var(--accent);
    position: sticky;
    top: 0;
  }

  .sidebar .nav {
    display: none !important;
  }

  .brand {
    border-bottom: 0;
    margin-bottom: 0;
    padding-bottom: 0;
  }

  .mobile-tabbar {
    align-items: center;
    background: rgba(255, 255, 255, 0.97);
    border-top: 1px solid #cddce3;
    bottom: 0;
    box-shadow: 0 -12px 32px rgba(8, 34, 44, 0.16);
    display: grid;
    gap: 4px;
    grid-template-columns: repeat(5, minmax(0, 1fr));
    left: 0;
    padding: 7px 7px max(7px, env(safe-area-inset-bottom));
    position: fixed;
    right: 0;
    z-index: 50;
  }

  .mobile-tabbar a,
  .mobile-more summary {
    align-items: center;
    border-radius: 11px;
    color: #50616b;
    display: grid;
    font-size: 12px;
    font-weight: 900;
    gap: 2px;
    justify-items: center;
    min-height: 58px;
    padding: 5px 2px;
    text-decoration: none;
  }

  .mobile-tabbar a span,
  .mobile-more summary span {
    align-items: center;
    background: #eef4f5;
    border-radius: 9px;
    color: #092f3d;
    display: flex;
    font-size: 11px;
    height: 28px;
    justify-content: center;
    min-width: 34px;
    padding: 0 5px;
  }

  .mobile-tabbar a.active {
    background: #fff0e8;
    color: #092f3d;
  }

  .mobile-tabbar a.active span {
    background: #ff6a21;
    color: #fff;
  }

  .mobile-more {
    position: relative;
  }

  .mobile-more summary {
    cursor: pointer;
    list-style: none;
  }

  .mobile-more summary::-webkit-details-marker {
    display: none;
  }

  .mobile-more-panel {
    background: #fff;
    border: 1px solid #cddce3;
    border-radius: 14px;
    bottom: 72px;
    box-shadow: 0 18px 52px rgba(8, 34, 44, 0.24);
    display: none;
    gap: 8px;
    min-width: 220px;
    padding: 9px;
    position: absolute;
    right: 0;
  }

  .mobile-more[open] .mobile-more-panel {
    display: grid;
  }

  .mobile-more-panel a {
    border: 1px solid #dce7ec;
    display: flex;
    justify-content: flex-start;
    min-height: 44px;
    padding: 0 12px;
  }

  .scan-input-row {
    grid-template-columns: minmax(0, 1fr) 112px;
  }

  .customer-facts {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-upload-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .photo-picker {
    min-height: 84px;
  }

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

@media print {
  @page {
    margin: 0;
    size: 80mm auto;
  }

  .receipt80-body {
    background: #fff;
    padding: 0;
  }

  .receipt80 {
    margin: 0;
    width: 80mm;
  }

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

/* OPS finish layer: desktop and mobile polish */
.mobile-quick-actions {
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(4, minmax(170px, 1fr));
  margin: 0 0 18px;
}

.mobile-quick-actions a {
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.98), rgba(246, 251, 250, 0.98));
  border: 1px solid #d4e2e7;
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(12, 35, 50, 0.08);
  color: #092f3d;
  display: grid;
  gap: 8px;
  min-height: 118px;
  overflow: hidden;
  padding: 16px;
  position: relative;
  text-decoration: none;
}

.mobile-quick-actions a::after {
  background: #ff6a21;
  content: "";
  height: 4px;
  left: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.mobile-quick-actions span {
  align-items: center;
  background: #e8f8f4;
  border-radius: 8px;
  color: #07564c;
  display: inline-flex;
  font-size: 22px;
  font-weight: 900;
  height: 42px;
  justify-content: center;
  min-width: 46px;
  padding: 0 8px;
  width: max-content;
}

.mobile-quick-actions strong {
  display: block;
  font-size: 20px;
  line-height: 1.05;
}

.mobile-quick-actions small {
  color: #5c6e79;
  display: block;
  font-size: 14px;
  font-weight: 800;
}

.stat {
  border-left: 5px solid #0c6b67;
  border-radius: 8px;
}

.stat:nth-child(2),
.stat:nth-child(5) {
  border-left-color: #ff6a21;
}

.stat:nth-child(3),
.stat:nth-child(7) {
  border-left-color: #0f4e83;
}

.empty-state-action {
  align-items: center;
  background: linear-gradient(135deg, #092f3d, #0c6b67);
  border-radius: 8px;
  box-shadow: 0 14px 30px rgba(9, 47, 61, 0.18);
  color: #fff;
  display: flex;
  gap: 18px;
  justify-content: space-between;
  margin-bottom: 18px;
  padding: 18px;
}

.empty-state-action strong {
  display: block;
  font-size: 22px;
}

.empty-state-action p {
  color: #d7f1ef;
  margin-top: 4px;
}

.empty-state-action .primary-btn {
  background: #ff6a21;
  color: #fff;
  flex: 0 0 auto;
}

.entry-form-panel {
  border-top: 4px solid #ff6a21;
}

.row-actions {
  gap: 6px;
}

.row-actions button,
.row-actions .link-btn {
  font-size: 13px;
  min-height: 34px;
  padding: 0 10px;
}

.screen-messages .topbar h1::after {
  content: " interno";
}

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

.settings-shortcuts a {
  background: #fff;
  border: 1px solid #d4e2e7;
  border-left: 5px solid #ff6a21;
  border-radius: 8px;
  box-shadow: 0 10px 24px rgba(12, 35, 50, 0.07);
  color: #092f3d;
  display: grid;
  gap: 5px;
  padding: 15px;
  text-decoration: none;
}

.settings-shortcuts strong {
  font-size: 20px;
}

.settings-shortcuts span {
  color: #60727d;
}

@media (max-width: 1024px), (pointer: coarse) {
  .mobile-quick-actions {
    gap: 10px;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    margin: 0 0 12px;
  }

  .mobile-quick-actions a {
    min-height: 112px;
    padding: 13px;
  }

  .mobile-quick-actions strong {
    font-size: 18px;
  }

  .empty-state-action {
    align-items: stretch;
    display: grid;
    gap: 12px;
  }

  .empty-state-action .primary-btn {
    justify-content: center;
    width: 100%;
  }

  .row-actions button,
  .row-actions .link-btn {
    font-size: 14px;
    min-height: 44px;
  }

  .settings-shortcuts {
    grid-template-columns: 1fr;
  }

  .premium-records {
    grid-template-columns: 1fr;
  }

  .premium-record-card .record-head {
    grid-template-columns: 1fr;
  }
}
