:root {
  --bg: #f4f7fb;
  --app-dark: #07111f;
  --app-dark-soft: #0d1b31;
  --surface: #ffffff;
  --surface-strong: #f3f7fc;
  --ink: #102038;
  --muted: #5c6980;
  --line: rgba(16, 32, 56, 0.1);
  --primary: #00c2ff;
  --primary-dark: #0a84ff;
  --accent: #ff8a00;
  --danger: #be123c;
  --ok: #0a84ff;
  --warning: #ff8a00;
  --shadow: 0 18px 40px rgba(7, 17, 31, 0.12);
  --radius: 8px;
  --sidebar-width: 268px;
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  font-family: Inter, "Segoe UI", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

html {
  width: 100%;
  overflow-x: hidden;
}

body {
  margin: 0;
  width: 100%;
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  scroll-padding-top: var(--safe-top);
  color: var(--ink);
  background:
    linear-gradient(180deg, rgba(7, 17, 31, 0.08), transparent 280px),
    var(--bg);
}

button,
input,
select,
textarea {
  max-width: 100%;
  font: inherit;
}

button {
  cursor: pointer;
  min-width: 0;
}

[hidden] {
  display: none !important;
}

.login-screen {
  position: relative;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding:
    calc(20px + var(--safe-top))
    calc(20px + var(--safe-right))
    calc(20px + var(--safe-bottom))
    calc(20px + var(--safe-left));
  background:
    linear-gradient(115deg, rgba(7, 17, 31, 0.94) 0%, rgba(7, 17, 31, 0.78) 48%, rgba(7, 17, 31, 0.9) 100%),
    url("fundo.jpg") center / cover no-repeat;
}

.login-screen::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    linear-gradient(90deg, rgba(0, 194, 255, 0.14), transparent 35%),
    linear-gradient(0deg, rgba(0, 0, 0, 0.36), transparent 45%);
  pointer-events: none;
}

.login-card {
  position: relative;
  z-index: 1;
  width: min(430px, 100%);
  display: grid;
  gap: 16px;
  padding: 24px;
  color: #f8fbff;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.14), rgba(255, 255, 255, 0.06)),
    rgba(13, 27, 49, 0.78);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
  box-shadow: 0 32px 80px rgba(7, 17, 31, 0.42);
  backdrop-filter: blur(18px);
}

.login-brand {
  margin-bottom: 4px;
}

.login-title {
  display: grid;
  gap: 6px;
}

.login-title p,
.login-hint {
  color: rgba(248, 251, 255, 0.72);
}

.login-card .form-field label {
  color: rgba(248, 251, 255, 0.72);
}

.login-card .input {
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.16);
}

.login-card .input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 194, 255, 0.18);
}

.login-card .primary-button {
  width: 100%;
}

.app-shell {
  width: 100%;
  max-width: 100vw;
  display: grid;
  grid-template-columns: var(--sidebar-width) minmax(0, 1fr);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  height: 100dvh;
  display: flex;
  flex-direction: column;
  padding:
    calc(18px + var(--safe-top))
    calc(18px + var(--safe-right))
    calc(18px + var(--safe-bottom))
    calc(18px + var(--safe-left));
  color: #f8fbf9;
  background:
    linear-gradient(180deg, rgba(13, 27, 49, 0.98), rgba(7, 17, 31, 0.99)),
    var(--app-dark);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 52px;
  margin-bottom: 24px;
}

.brand strong,
.brand small {
  display: block;
}

.brand small {
  color: rgba(248, 251, 255, 0.72);
  margin-top: 2px;
}

.brand-mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: var(--radius);
  background: linear-gradient(135deg, rgba(0, 194, 255, 0.95), rgba(10, 132, 255, 0.95));
  color: #04101d;
  box-shadow: 0 18px 40px rgba(0, 194, 255, 0.22);
}

.brand-mark svg,
.icon svg {
  width: 20px;
  height: 20px;
  display: block;
  fill: currentColor;
}

.nav-list {
  display: grid;
  gap: 6px;
}

.nav-item,
.ghost-button,
.primary-button,
.danger-button,
.icon-button,
.chip-button {
  border: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border-radius: var(--radius);
  transition: background .18s ease, border-color .18s ease, color .18s ease, transform .18s ease;
}

.nav-item {
  width: 100%;
  justify-content: flex-start;
  padding: 11px 12px;
  color: #d7e0db;
  background: transparent;
}

.nav-item:hover,
.nav-item.is-active {
  background: rgba(255, 255, 255, 0.08);
  color: #ffffff;
}

.nav-item.is-active {
  box-shadow: inset 3px 0 0 var(--primary);
}

.side-footer {
  display: grid;
  gap: 12px;
  margin-top: auto;
  padding-top: 18px;
  color: rgba(248, 251, 255, 0.72);
}

.side-footer small {
  line-height: 1.35;
}

.session-card {
  display: grid;
  gap: 3px;
  padding: 10px;
  color: #f8fbf9;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: var(--radius);
}

.session-card small {
  color: rgba(248, 251, 255, 0.72);
}

.workspace {
  width: 100%;
  min-width: 0;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  overflow-x: hidden;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 16px;
  min-height: calc(78px + var(--safe-top));
  padding:
    calc(16px + var(--safe-top))
    max(clamp(16px, 3vw, 34px), var(--safe-right))
    16px
    max(clamp(16px, 3vw, 34px), var(--safe-left));
  color: #f8fbff;
  background: rgba(7, 17, 31, 0.9);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  backdrop-filter: blur(16px);
}

.page-heading {
  min-width: 0;
}

.eyebrow {
  display: block;
  margin-bottom: 3px;
  color: var(--primary);
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1.1;
}

.top-actions {
  display: flex;
  gap: 10px;
  margin-left: auto;
}

.content {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 22px;
  padding:
    24px
    max(clamp(16px, 3vw, 34px), var(--safe-right))
    calc(36px + var(--safe-bottom))
    max(clamp(16px, 3vw, 34px), var(--safe-left));
}

.primary-button {
  min-width: 112px;
  padding: 0 14px;
  color: #03101e;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  font-weight: 700;
  box-shadow: 0 18px 35px rgba(0, 194, 255, 0.22);
}

.primary-button:hover {
  background: linear-gradient(135deg, #23d6ff, var(--primary-dark));
}

.ghost-button,
.chip-button {
  padding: 0 13px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  font-weight: 700;
}

.sidebar .ghost-button {
  color: #f8fbf9;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.topbar .ghost-button,
.topbar .icon-button {
  color: #f8fbff;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.sidebar .ghost-button:hover,
.topbar .ghost-button:hover,
.topbar .icon-button:hover {
  background: rgba(255, 255, 255, 0.14);
}

.notification-action.is-enabled {
  color: #03101e;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-color: transparent;
}

.sidebar .notification-action.is-enabled,
.topbar .notification-action.is-enabled {
  color: #03101e;
}

.ghost-button:hover,
.chip-button:hover {
  background: #eaf7ff;
}

.danger-button {
  min-width: 104px;
  padding: 0 12px;
  color: #ffffff;
  background: var(--danger);
  font-weight: 700;
}

.icon-button {
  width: 40px;
  height: 40px;
  color: var(--ink);
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
}

.icon-button:hover {
  background: #eaf7ff;
}

.mobile-only {
  display: none;
}

.mobile-session-action {
  display: none;
}

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

.metric-card {
  min-height: 132px;
  display: grid;
  align-content: space-between;
  gap: 16px;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.metric-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-weight: 700;
}

.metric-icon {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: var(--radius);
  color: #03101e;
  background: rgba(0, 194, 255, 0.18);
}

.metric-icon.warning {
  color: #7a3d00;
  background: rgba(255, 138, 0, 0.16);
}

.metric-icon.danger {
  color: #881337;
  background: #ffe4e6;
}

.metric-value {
  display: block;
  font-size: clamp(24px, 3vw, 34px);
  line-height: 1;
  font-weight: 800;
}

.metric-note {
  color: var(--muted);
  font-size: 13px;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(0, .85fr);
  gap: 18px;
}

.panel {
  min-width: 0;
  padding: 18px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.panel-header,
.toolbar,
.section-title {
  min-width: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
}

.panel-header {
  margin-bottom: 14px;
}

.panel-title {
  min-width: 0;
  display: grid;
  gap: 4px;
}

.panel-title strong,
.section-title strong {
  font-size: 16px;
}

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

.toolbar {
  align-items: flex-end;
  justify-content: flex-start;
  flex-wrap: wrap;
  padding: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.toolbar-group {
  min-width: 0;
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}

.toolbar > .primary-button,
.toolbar > .ghost-button,
.toolbar > .danger-button {
  align-self: end;
}

.report-toolbar {
  display: grid;
  grid-template-columns: repeat(8, minmax(0, 1fr));
  align-items: end;
  gap: 10px;
}

.report-filter-grid {
  display: contents;
}

.report-toolbar .toolbar-group {
  display: contents;
}

.report-toolbar .field,
.report-toolbar .form-field,
.report-toolbar .search-input,
.report-toolbar .ghost-button,
.report-toolbar .primary-button {
  width: 100%;
  min-width: 0;
}

@media (min-width: 821px) {
  .report-toolbar .ghost-button,
  .report-toolbar .primary-button {
    align-self: start;
    margin-top: 21px;
  }
}

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

.field label,
.form-field label {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0;
}

.input,
.select,
.textarea {
  width: 100%;
  min-height: 40px;
  padding: 9px 11px;
  color: var(--ink);
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  outline: none;
}

.readonly-field {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 9px 11px;
  color: var(--muted);
  background: #f3f7fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 800;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(0, 194, 255, 0.16);
}

.textarea {
  min-height: 86px;
  resize: vertical;
}

.search-input {
  width: 360px;
  max-width: 100%;
  min-width: 0;
}

.table-wrap {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 900px;
  table-layout: auto;
}

.orders-table table {
  min-width: 0;
  table-layout: fixed;
}

.orders-table th:nth-child(1),
.orders-table td:nth-child(1) {
  width: 8.5%;
}

.orders-table th:nth-child(2),
.orders-table td:nth-child(2) {
  width: 12%;
}

.orders-table th:nth-child(3),
.orders-table td:nth-child(3) {
  width: 7.5%;
}

.orders-table th:nth-child(4),
.orders-table td:nth-child(4) {
  width: 5.5%;
}

.orders-table th:nth-child(5),
.orders-table td:nth-child(5) {
  width: 8%;
}

.orders-table th:nth-child(6),
.orders-table td:nth-child(6) {
  width: 17%;
}

.orders-table th:nth-child(7),
.orders-table td:nth-child(7) {
  width: 22%;
}

.orders-table th:nth-child(8),
.orders-table td:nth-child(8) {
  width: 19.5%;
}

.dashboard-table {
  overflow-x: hidden;
}

.dashboard-table table {
  min-width: 0;
  table-layout: fixed;
}

.dashboard-table th,
.dashboard-table td {
  padding-inline: 10px;
}

.dashboard-table .number-cell,
.dashboard-table .tag {
  white-space: normal;
}

.orders-table .number-cell,
.orders-table .tag,
.orders-table th,
.orders-table td:nth-child(3),
.orders-table td:nth-child(4),
.orders-table td:nth-child(5) {
  white-space: nowrap;
}

.orders-table .actions {
  min-width: 0;
  flex-wrap: wrap;
  align-items: stretch;
}

.orders-table .actions .ghost-button,
.orders-table .actions .primary-button,
.orders-table .actions .danger-button {
  flex: 1 1 92px;
  min-width: 0;
  min-height: 38px;
  padding-inline: 12px;
  white-space: nowrap;
}

.orders-table .checkout-summary span {
  white-space: normal;
}

.orders-table th,
.orders-table td {
  overflow-wrap: anywhere;
}

.order-items-table {
  overflow-x: hidden;
}

.order-items-table table {
  min-width: 0;
  table-layout: fixed;
}

.order-items-table th:first-child,
.order-items-table td:first-child {
  width: 48%;
}

.order-items-table th:nth-child(2),
.order-items-table td:nth-child(2) {
  width: 12%;
}

.order-items-table th:nth-child(3),
.order-items-table td:nth-child(3),
.order-items-table th:nth-child(4),
.order-items-table td:nth-child(4) {
  width: 20%;
}

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

th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0;
  background: #f3f7fc;
}

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

.row-title {
  display: grid;
  gap: 3px;
  min-width: 0;
}

.row-title strong {
  color: var(--ink);
  overflow-wrap: break-word;
}

.row-title span {
  color: var(--muted);
  font-size: 13px;
  overflow-wrap: break-word;
}

.actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: nowrap;
  min-width: 0;
}

.actions .ghost-button,
.actions .primary-button,
.actions .danger-button {
  flex: 0 0 auto;
  white-space: nowrap;
}

.row-expand-button {
  display: none;
}

.checkout-summary span {
  white-space: nowrap;
}

.checkout-timeline {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.checkout-step {
  min-height: 76px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 12px;
  background: #f3f7fc;
  border: 1px solid var(--line);
  border-left: 5px solid #cbd5e1;
  border-radius: var(--radius);
}

.checkout-step.ok {
  border-left-color: var(--primary);
}

.checkout-step.neutral {
  color: var(--muted);
}

.checkout-step span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.checkout-step strong {
  font-size: 14px;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 3px 8px;
  border-radius: 999px;
  color: #063b52;
  background: rgba(0, 194, 255, 0.16);
  font-size: 12px;
  font-weight: 800;
  white-space: nowrap;
}

.tag.warning {
  color: #7a3d00;
  background: rgba(255, 138, 0, 0.18);
}

.tag.danger {
  color: #881337;
  background: #ffe4e6;
}

.tag.ok {
  color: #063b52;
  background: rgba(0, 194, 255, 0.16);
}

.tag.neutral {
  color: #374151;
  background: #f3f4f6;
}

.tag.accent {
  color: #7a3d00;
  background: rgba(255, 138, 0, 0.18);
}

.status-stack {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr;
  gap: 7px;
  align-items: stretch;
}

.separation-late-tag {
  margin-left: 0;
}

.orders-table .status-stack .tag {
  width: 100%;
  justify-content: center;
  white-space: nowrap;
}

.separation-late-note {
  color: var(--danger);
  font-weight: 800;
}

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

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

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

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

.permission-item {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 10px;
  background: #f3f7fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  font-weight: 700;
}

.permission-item input {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
}

.settings-row {
  display: grid;
  grid-template-columns: minmax(180px, 260px) auto;
  gap: 12px;
  align-items: end;
}

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

.notification-option {
  min-width: 0;
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
  padding: 12px;
  background: #f3f7fc;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.notification-option input {
  width: 18px;
  height: 18px;
  margin: 2px 0 0;
  accent-color: var(--primary);
}

.notification-option span {
  min-width: 0;
  display: grid;
  gap: 3px;
}

.notification-option small {
  color: var(--muted);
  line-height: 1.35;
}

.modal {
  width: min(960px, calc(100vw - 32px));
  padding: 0;
  border: 0;
  border-radius: var(--radius);
  box-shadow: 0 24px 80px rgba(7, 17, 31, 0.24);
}

.modal::backdrop {
  background: rgba(7, 17, 31, 0.62);
}

.modal form {
  display: grid;
  max-height: min(86vh, 860px);
}

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

.modal-header h2 {
  font-size: 20px;
}

.modal-body {
  display: grid;
  gap: 16px;
  padding: 18px;
  overflow: auto;
}

.modal-footer {
  justify-content: flex-end;
  border-top: 1px solid var(--line);
  border-bottom: 0;
}

.order-line {
  display: grid;
  grid-template-columns: minmax(210px, 1fr) 88px 110px 110px 40px;
  gap: 10px;
  align-items: end;
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

.order-line:last-child {
  border-bottom: 0;
}

.totals {
  display: grid;
  gap: 8px;
  justify-items: end;
  padding-top: 8px;
}

.totals-row {
  min-width: 220px;
  display: flex;
  justify-content: space-between;
  gap: 16px;
}

.totals-row strong {
  font-size: 18px;
}

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

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

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

.chat-composer {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 132px;
  gap: 12px;
  align-items: end;
}

.chat-composer .form-field.full {
  grid-column: auto;
}

.chat-textarea {
  min-height: 40px;
  max-height: 132px;
}

.chat-user-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.chat-list {
  max-height: min(58vh, 620px);
  display: grid;
  gap: 12px;
  overflow: auto;
  padding-right: 4px;
}

.chat-message {
  width: min(720px, 94%);
  display: grid;
  gap: 8px;
  justify-self: start;
  padding: 12px;
  background: #f3f7fc;
  border: 1px solid var(--line);
  border-left: 5px solid var(--primary);
  border-radius: var(--radius);
}

.chat-message.is-mine {
  justify-self: end;
  background: #eaf7ff;
  border-left-color: var(--accent);
}

.chat-message-head,
.chat-message-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.chat-message-head span,
.chat-message-foot {
  color: var(--muted);
  font-size: 12px;
}

.chat-message p {
  margin: 0;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.chat-message-foot .ghost-button {
  min-height: 32px;
  padding-inline: 10px;
}

.bar-track {
  height: 12px;
  overflow: hidden;
  background: #e6edf6;
  border-radius: 999px;
}

.bar-fill {
  height: 100%;
  width: var(--value, 0%);
  background: linear-gradient(90deg, var(--primary), var(--accent));
}

.empty-state {
  display: grid;
  place-items: center;
  min-height: 170px;
  padding: 24px;
  color: var(--muted);
  text-align: center;
  background: var(--surface);
  border: 1px dashed rgba(10, 132, 255, 0.28);
  border-radius: var(--radius);
}

.toast {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 30;
  max-width: min(420px, calc(100vw - 40px));
  padding: 13px 16px;
  color: #ffffff;
  background: #07111f;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0;
  transform: translateY(12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}

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

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

.custom-boleto {
  min-width: 0;
  display: grid;
  gap: 14px;
  padding: 16px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.custom-boleto-head {
  min-width: 0;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 3px solid var(--app-dark);
}

.custom-boleto-brand {
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
}

.custom-boleto-mark {
  width: 52px;
  height: 52px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  color: #04101d;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  border-radius: var(--radius);
  font-weight: 800;
}

.custom-boleto-brand strong,
.custom-boleto-brand span,
.custom-boleto-grid span,
.custom-boleto-line span,
.custom-boleto-code span,
.custom-boleto-code small {
  display: block;
}

.custom-boleto-brand span,
.custom-boleto-grid span,
.custom-boleto-line span,
.custom-boleto-code span,
.custom-boleto-code small {
  color: var(--muted);
  font-size: 12px;
}

.custom-boleto-status {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.custom-boleto-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}

.custom-boleto-grid > div,
.custom-boleto-line > div,
.custom-boleto-instructions,
.custom-boleto-code {
  min-width: 0;
  padding: 10px;
  background: #f8fbff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.custom-boleto-grid strong,
.custom-boleto-line strong,
.custom-boleto-code strong {
  overflow-wrap: anywhere;
}

.custom-boleto-line {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 10px;
}

.custom-boleto-instructions {
  display: grid;
  gap: 5px;
  line-height: 1.35;
}

.custom-boleto-instructions span {
  color: var(--muted);
}

.custom-boleto-code {
  display: grid;
  gap: 8px;
}

.custom-boleto-barcode {
  width: 100%;
  height: 58px;
  display: block;
  border: 1px solid var(--line);
  border-radius: 4px;
}

.custom-boleto-actions {
  display: flex;
  justify-content: flex-end;
}

.pix-box {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

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

.pix-qr {
  display: block;
  width: 100%;
  height: auto;
}

.pix-copy {
  display: grid;
  gap: 8px;
  min-width: 0;
}

.copy-box {
  min-height: 126px;
  word-break: break-all;
  font-size: 12px;
}

.kbd-metric {
  display: inline-flex;
  align-items: center;
  min-height: 30px;
  padding: 4px 8px;
  border-radius: var(--radius);
  color: #063b52;
  background: rgba(0, 194, 255, 0.16);
  font-weight: 800;
}

.stock-low {
  color: var(--danger);
  font-weight: 800;
}

.number-cell {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

@media (max-width: 720px) {
  .panel-header,
  .toolbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .panel-header > .ghost-button,
  .panel-header > .primary-button,
  .panel-header > .danger-button,
  .section-title > .ghost-button,
  .section-title > .primary-button,
  .section-title > .danger-button {
    width: 100%;
  }

  .table-wrap {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  table,
  thead,
  tbody,
  tr,
  th,
  td {
    display: block;
  }

  table {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    border-collapse: separate;
  }

  thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  tbody {
    width: 100%;
    min-width: 0;
    display: grid;
    gap: 10px;
  }

  tr {
    position: relative;
    width: 100%;
    max-width: 100%;
    min-width: 0;
    overflow: hidden;
    background: var(--surface);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: 0 10px 26px rgba(7, 17, 31, 0.08);
  }

  tr::before {
    content: "";
    position: absolute;
    inset: 0 auto 0 0;
    width: 5px;
    background: linear-gradient(180deg, var(--primary), var(--accent));
  }

  tr:nth-child(3n + 2)::before {
    background: linear-gradient(180deg, #22c55e, var(--primary));
  }

  tr:nth-child(3n + 3)::before {
    background: linear-gradient(180deg, var(--accent), #f43f5e);
  }

  tr[data-tone="danger"]::before {
    background: linear-gradient(180deg, var(--danger), #fb7185);
  }

  tr[data-tone="ok"]::before {
    background: linear-gradient(180deg, #16a34a, var(--primary));
  }

  tr[data-tone="warning"]::before {
    background: linear-gradient(180deg, var(--accent), #facc15);
  }

  td {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    display: grid;
    grid-template-columns: 82px minmax(0, 1fr);
    gap: 10px;
    align-items: start;
    min-height: 42px;
    padding: 10px 12px 10px 16px;
    border-bottom: 1px solid var(--line);
    overflow-wrap: normal;
    word-break: normal;
  }

  td > * {
    min-width: 0;
  }

  .orders-table th,
  .orders-table td,
  .orders-table th:nth-child(n),
  .orders-table td:nth-child(n) {
    width: 100% !important;
  }

  .orders-table td.responsive-detail-cell {
    grid-template-columns: 82px minmax(0, 1fr);
  }

  .orders-table td:not(.responsive-main-cell):not(.responsive-actions-cell) {
    overflow: hidden;
  }

  .orders-table td:not(.responsive-main-cell):not(.responsive-actions-cell) > * {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .orders-table .checkout-summary span {
    white-space: nowrap;
  }

  .orders-table .tag {
    max-width: 100%;
    white-space: nowrap;
  }

  .orders-table .status-stack {
    width: 100%;
    display: grid;
    grid-template-columns: 1fr;
    gap: 7px;
    overflow: visible !important;
  }

  .orders-table .status-stack .tag {
    width: 100%;
    justify-content: center;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  tr:not(.is-expanded) td.responsive-detail-cell {
    display: none;
  }

  .responsive-main-cell {
    grid-template-columns: 1fr;
    gap: 8px;
    padding-top: 13px;
    padding-bottom: 13px;
  }

  .responsive-main-cell::before {
    content: attr(data-label);
  }

  .row-expand-button {
    width: auto !important;
    min-width: 136px;
    max-width: 100%;
    display: inline-flex;
    flex-wrap: nowrap;
    justify-self: start;
    margin-top: 8px;
    padding-inline: 12px;
    white-space: nowrap;
  }

  .row-expand-button .icon {
    flex: 0 0 auto;
  }

  .row-expand-text {
    display: inline-block;
    white-space: nowrap;
  }

  td::before {
    content: attr(data-label);
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

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

  td:empty {
    display: none;
  }

  td.responsive-actions-cell {
    display: block;
  }

  td.responsive-actions-cell::before {
    display: block;
    margin-bottom: 8px;
  }

  .responsive-actions-cell .actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
    justify-content: stretch;
  }

  .responsive-actions-cell .actions .ghost-button,
  .responsive-actions-cell .actions .primary-button,
  .responsive-actions-cell .actions .danger-button {
    width: 100%;
    min-width: 0;
    min-height: 42px;
    padding-inline: 8px;
    font-size: 14px;
    line-height: 1.15;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  .responsive-actions-cell .actions > :nth-child(3):last-child {
    grid-column: 1 / -1;
  }

  .number-cell {
    white-space: nowrap;
  }

  .separation-late-tag {
    width: fit-content;
    margin: 6px 0 0;
  }
}

@media (max-width: 1120px) {
  .report-toolbar {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }

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

@media (min-width: 821px) and (max-width: 1380px) {
  .orders-table {
    overflow: visible;
    border: 0;
    background: transparent;
    box-shadow: none;
  }

  .orders-table table,
  .orders-table thead,
  .orders-table tbody,
  .orders-table tr,
  .orders-table th,
  .orders-table td {
    display: block;
  }

  .orders-table table {
    min-width: 0;
  }

  .orders-table thead {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }

  .orders-table tbody {
    display: grid;
    gap: 12px;
  }

  .orders-table tr {
    display: grid;
    grid-template-columns: minmax(150px, 1fr) minmax(180px, 1.2fr) minmax(96px, .7fr) minmax(110px, .8fr);
    gap: 14px 16px;
    padding: 14px;
    background: var(--surface);
    border: 1px solid var(--line);
    border-left: 5px solid var(--primary);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
  }

  .orders-table tr:nth-child(2n) {
    border-left-color: var(--accent);
  }

  .orders-table th,
  .orders-table td {
    width: auto !important;
    min-width: 0;
    padding: 0;
    border-bottom: 0;
    white-space: normal;
  }

  .orders-table td::before {
    content: attr(data-label);
    display: block;
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 800;
    text-transform: uppercase;
  }

  .orders-table td:nth-child(6),
  .orders-table td:nth-child(7),
  .orders-table td:nth-child(8) {
    grid-column: span 2;
  }

  .orders-table .actions {
    flex-wrap: wrap;
    gap: 8px;
  }

  .orders-table .actions .ghost-button,
  .orders-table .actions .primary-button,
  .orders-table .actions .danger-button {
    flex: 1 1 128px;
    justify-content: center;
  }
}

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

  .sidebar {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 20;
    width: min(var(--sidebar-width), 86vw);
    height: 100dvh;
    overflow-y: auto;
    padding-top: calc(18px + var(--safe-top));
    padding-bottom: calc(88px + var(--safe-bottom));
    padding-left: calc(18px + var(--safe-left));
    padding-right: 18px;
    transform: translateX(-100%);
    transition: transform .2s ease;
  }

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

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

  .mobile-session-action {
    display: inline-flex;
  }

  .topbar {
    min-height: calc(70px + var(--safe-top));
  }

  .top-actions {
    display: none;
  }

  .metrics-grid,
  .dashboard-grid,
  .split-grid,
  .chat-grid,
  .report-toolbar,
  .form-grid,
  .form-grid.three {
    grid-template-columns: 1fr;
  }

  .chat-composer {
    grid-template-columns: 1fr;
  }

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

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

  .order-line {
    grid-template-columns: 1fr;
    padding: 12px;
    border: 1px solid var(--line);
    border-radius: var(--radius);
  }

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

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

  .custom-boleto-head,
  .custom-boleto-grid,
  .custom-boleto-line {
    display: grid;
    grid-template-columns: 1fr;
  }

  .custom-boleto-status,
  .custom-boleto-actions {
    justify-content: flex-start;
  }

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

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

@media (max-width: 520px) {
  .content {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  .topbar {
    padding-left: max(12px, var(--safe-left));
    padding-right: max(12px, var(--safe-right));
  }

  .toolbar,
  .panel,
  .metric-card {
    padding: 14px;
  }

  .toolbar-group,
  .toolbar-group > *,
  .search-input,
  .primary-button,
  .ghost-button,
  .danger-button {
    width: 100%;
  }

  .actions .ghost-button,
  .actions .primary-button,
  .actions .danger-button {
    width: auto;
  }

  .chat-message-foot .ghost-button {
    width: auto;
  }

  .row-expand-button {
    width: fit-content;
  }

  .checkout-timeline {
    grid-template-columns: 1fr;
  }
}
