/* Shared Counter surfaces and responsive rows. */
.page-head {
  margin-bottom: 20px;
  gap: 16px;
}
.page-head h1 {
  font-size: 24px;
  margin: 0;
}
.page-head p {
  margin: 6px 0 0;
  color: var(--text-muted);
}
.card {
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface);
  padding: 20px 24px;
  margin-bottom: 20px;
  min-width: 0;
}
.card h2 {
  font-size: 18px;
  margin: 0 0 16px;
}
.table-wrap {
  padding: 0;
}
table {
  width: 100%;
  border-collapse: collapse;
}
th,
td {
  padding: 14px 16px;
  text-align: right;
  border-bottom: 1px solid var(--divider);
  vertical-align: middle;
}
th {
  background: var(--surface-muted);
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 500;
}
td small {
  display: block;
  font-size: 12px;
  color: var(--text-muted);
}
.btn,
.btn--sm,
.icon-btn,
button,
select,
input:not([type='checkbox']):not([type='radio']) {
  min-height: 44px;
}
.btn {
  border-radius: 8px;
  font-size: 14px;
  padding: 8px 16px;
}
button,
.icon-btn {
  min-width: 44px;
}
.order-number {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  min-width: 44px;
}
[data-order-status='refunded'],
[data-order-status='refunded_manual'],
[data-order-status='expired'] {
  background: var(--danger-surface);
  color: var(--danger);
}
.btn--primary {
  background: var(--action);
  color: var(--text);
  border: 1px solid var(--action);
}
.btn--ghost {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
}
.btn:disabled,
button:disabled {
  opacity: 0.48;
  cursor: not-allowed;
}
input,
select,
textarea {
  max-width: 100%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  border-radius: 8px;
  padding: 9px 12px;
  font: inherit;
}
label {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 14px;
  font-weight: 500;
  min-width: 0;
}
label:has(input[type='checkbox']),
label:has(input[type='radio']) {
  min-height: 44px;
  flex-direction: row;
  align-items: center;
}
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: end;
  margin-bottom: 16px;
}
.toolbar label {
  flex: 1 1 150px;
}
.tag {
  display: inline-block;
  border-radius: 6px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 500;
  white-space: normal;
}
.tag--green {
  background: var(--success-surface);
  color: var(--success);
}
.tag--red {
  background: var(--danger-surface);
  color: var(--danger);
}
.tag--sun {
  background: var(--warning-surface);
  color: var(--warning);
}
.tag--grey {
  background: var(--neutral-surface);
  color: var(--neutral);
}
[data-order-status='partially_refunded'] {
  background: var(--info-surface);
  color: var(--info);
}
.technical-reference {
  display: inline-block;
  max-width: 170px;
  overflow-wrap: anywhere;
  font-size: 12px;
  color: var(--text-muted);
}
.order-number {
  font-weight: 600;
  text-decoration: none;
}
.order-pending {
  background: #fffcf4;
}
@media (min-width: 861px) {
  #ordersTable {
    table-layout: fixed;
  }
  #ordersTable th,
  #ordersTable td {
    padding: 12px 8px;
    font-size: 13px;
  }
  #ordersTable .order-col-number {
    width: 48px;
  }
  #ordersTable .order-col-date,
  #ordersTable .order-col-device,
  #ordersTable .order-col-paid {
    width: 112px;
  }
  #ordersTable .order-col-method {
    width: 56px;
  }
  #ordersTable .order-col-amount {
    width: 126px;
  }
  #ordersTable .order-col-status {
    width: 146px;
  }
  #ordersTable .order-col-reference {
    width: 110px;
  }
  #ordersTable .order-col-actions {
    width: 156px;
  }
  #ordersTable .order-date,
  #ordersTable .order-device,
  #ordersTable .order-amount,
  #ordersTable .order-paid-time,
  #ordersTable .order-method {
    white-space: nowrap;
  }
  #ordersTable .order-device,
  #ordersTable .order-items-text,
  #ordersTable .technical-reference,
  #ordersTable .tag,
  #ordersTable td small {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 100%;
  }
  #ordersTable .order-items-text {
    display: block;
  }
  #ordersTable .order-actions-cell .btn {
    font-size: 12px;
    padding: 6px 8px;
    white-space: nowrap;
    max-width: 100%;
  }
}
@media (max-width: 860px) {
  #ordersTable colgroup {
    display: none;
  }
}
.order-detail-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 20px;
}
.order-timeline {
  padding: 0;
  list-style: none;
}
.order-timeline li {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 12px;
  margin: 8px 0;
  font-size: 14px;
}
.order-timeline bdi {
  display: inline-block;
  white-space: nowrap;
  font-size: 12px;
  color: var(--text-muted);
}
.order-detail-grid tfoot td,
.order-detail-grid tfoot th {
  background: transparent;
  font-weight: 700;
  border-top: 1px solid var(--border);
  color: var(--text);
}
.order-payment [data-refund] {
  background: var(--action);
  border-color: var(--action);
  color: var(--action-ink);
}
.order-payment dl {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.order-payment dd {
  margin: 0;
  text-align: left;
}
.refund-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.period-presets,
.status-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.period-presets button,
.status-chips button {
  background: transparent;
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 8px 14px;
  color: var(--text-muted);
  font: inherit;
}
.period-presets [aria-pressed='true'],
.status-chips [aria-pressed='true'] {
  border-color: var(--brand);
  color: var(--brand);
  background: var(--brand-soft);
}
dialog {
  width: min(560px, calc(100vw - 32px));
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  background: var(--surface);
  color: var(--text);
  max-height: calc(100dvh - 32px);
  overflow: auto;
}
dialog::backdrop {
  background: var(--overlay);
}
dialog form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
dialog h2 {
  margin: 0;
  font-size: 20px;
}
.refund-summary {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 12px;
}
.refund-notice {
  background: var(--alert-surface);
  border: 1px solid var(--alert-border);
  border-radius: 8px;
  padding: 12px;
}
.sales-chart {
  display: flex;
  align-items: end;
  gap: 12px;
  min-height: 180px;
  overflow: auto;
  padding: 16px 0;
}
.sales-chart-day {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: end;
  flex: 1;
  min-width: 70px;
  gap: 8px;
  font-size: 12px;
}
.sales-chart-bar {
  width: 100%;
  max-width: 56px;
  background: var(--brand);
  border-radius: 6px 6px 0 0;
}
.sales-chart-bar.is-highest {
  background: var(--action);
}
@media (max-width: 860px) {
  .main {
    padding: 20px 16px 36px;
  }
  .card {
    padding: 16px;
  }
  .table-wrap {
    padding: 0;
    overflow: visible;
  }
  .responsive-table {
    min-width: 0 !important;
    table-layout: fixed;
  }
  .responsive-table thead {
    display: none;
  }
  .responsive-table tbody,
  .responsive-table tfoot {
    display: block;
  }
  .responsive-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr);
    padding: 12px 16px;
    border-bottom: 1px solid var(--divider);
  }
  .responsive-table td,
  .responsive-table th {
    display: block;
    min-width: 0;
    border: 0;
    padding: 5px 0;
    overflow-wrap: anywhere;
  }
  .responsive-table td::before {
    content: attr(data-label);
    display: inline-block;
    color: var(--text-muted);
    font-size: 12px;
    margin-left: 12px;
  }
  .responsive-table td[colspan]::before {
    content: none;
  }
  .responsive-table td .btn {
    margin: 4px;
  }
  .order-detail-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .order-payment dl {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
  .technical-reference {
    max-width: 100%;
  }
}

.modal__card {
  border-radius: 12px;
  border: 1px solid var(--border);
  width: min(520px, 100%);
}
.modal--drawer {
  display: flex;
  justify-content: flex-end;
  padding: 0;
  overflow: hidden;
}
.modal--drawer .modal__card {
  width: min(560px, 100%);
  height: 100dvh;
  max-height: 100dvh;
  border-radius: 0;
}
.modal--drawer .form-grid {
  grid-template-columns: minmax(0, 1fr);
}
.modal__head {
  padding: 20px 24px;
}
.modal__foot {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}
.picker {
  background: var(--surface-muted);
  border: 1px dashed var(--border-strong);
}
.picker img {
  background: transparent;
  padding: 0;
}
.file-field {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.file-picker {
  position: relative;
  align-self: flex-start;
  cursor: pointer;
}
.file-picker-input {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0 !important;
  padding: 0;
  border: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  clip-path: inset(50%);
  white-space: nowrap;
}
.file-picker:focus-within .file-picker-button {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.file-name {
  font-size: 12px;
  color: var(--text-muted);
  overflow-wrap: anywhere;
}
.editor-delete {
  color: var(--danger);
  justify-self: start;
}
.btn.btn--danger,
.icon-btn.icon-btn--danger {
  border: 1px solid var(--danger);
  background: var(--surface);
  color: var(--danger);
}
.btn.btn--danger:hover,
.icon-btn.icon-btn--danger:hover {
  background: var(--danger-surface);
}
.note {
  background: var(--surface-muted);
  border: 1px solid var(--border);
  color: var(--text-muted);
}
.card__head {
  flex-wrap: wrap;
  padding: 0 0 16px;
  gap: 16px;
}
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.chip {
  min-height: 44px;
  border-radius: 8px;
  background: var(--surface);
  color: var(--text-muted);
  border: 1px solid var(--border);
}
.chip.is-on {
  color: var(--brand);
  border-color: var(--brand);
  background: var(--brand-soft);
}
.banners {
  grid-template-columns: repeat(auto-fit, minmax(min(100%, 330px), 1fr));
}
.banner {
  padding: 0;
}
.banner__preview {
  height: 180px;
  padding: 20px;
}
.banner__preview.green {
  background: #e3f1e8;
  color: var(--text);
}
.banner__preview.berry {
  background: #faf3e2;
  color: var(--text);
}
.banner__preview.amber {
  background: #1e5b38;
  color: #fff;
}
.banner__preview p {
  opacity: 1;
}
.banner__body {
  padding: 16px 20px;
}
.switch-row {
  flex-wrap: wrap;
}
.switch {
  min-width: 44px;
}
/* Keep the hit area independent from the visible track. Logical insets mirror in RTL. */
label.switch {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  padding: 0;
  gap: 0;
  flex: 0 0 44px;
}
.switch input {
  inset: 0;
  width: 44px;
  height: 44px;
  min-height: 0;
  margin: 0;
  padding: 0;
  border: 0;
}
.switch > span {
  position: relative;
  inset: auto;
  display: block;
  width: 44px;
  height: 24px;
  flex: 0 0 44px;
  border-radius: 12px;
}
.switch > span::after {
  top: 3px;
  left: auto;
  right: auto;
  inset-inline-start: 3px;
  width: 18px;
  height: 18px;
  transform: none;
}
.switch input:checked + span::after {
  left: auto;
  right: auto;
  inset-inline-start: 23px;
}
.switch input:focus-visible + span {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
@media (max-width: 860px) {
  .form-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .picker {
    flex-wrap: wrap;
  }
  .modal__head,
  #modalBody {
    padding: 16px;
  }
  .card__head .search {
    width: 100%;
  }
  .modal--drawer {
    justify-content: flex-start;
  }
}

.reports-strip {
  margin-bottom: 20px;
}
.reports-strip .counter-cell-value {
  font-size: 24px;
}
.grid2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 20px;
}
.grid2 > div {
  min-width: 0;
}
.page-head > .toolbar {
  margin: 0;
}
.tag--fib,
.tag--card {
  background: var(--neutral-surface);
  color: var(--neutral);
}
@media (max-width: 860px) {
  .grid2 {
    grid-template-columns: minmax(0, 1fr);
  }
  .reports-strip .counter-cell-value {
    font-size: 20px;
  }
}

.payment-settings-row {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 0;
  border-top: 1px solid var(--divider);
}
.payment-settings-row p {
  margin: 4px 0;
  color: var(--text-muted);
  font-size: 14px;
}
.device-create {
  display: flex;
  gap: 16px;
  align-items: end;
  flex-wrap: wrap;
}
.device-create label {
  flex: 1 1 240px;
}
.revoked-devices summary {
  min-height: 44px;
  color: var(--text-muted);
  cursor: pointer;
}
.system-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px;
}
.system-card {
  padding: 20px 24px;
}
.log-filter {
  max-width: 320px;
  margin-bottom: 16px;
}
details summary {
  min-height: 44px;
  cursor: pointer;
}
pre,
.log-stack {
  max-width: 100%;
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  word-break: break-word;
}
.form-grid {
  gap: 16px;
}
.system-alert {
  background: var(--alert-surface);
  border: 1px solid var(--alert-border);
  border-radius: 8px;
  padding: 16px;
  color: var(--text);
}
@media (max-width: 860px) {
  .system-grid {
    grid-template-columns: minmax(0, 1fr);
  }
  .payment-settings-row {
    flex-wrap: wrap;
  }
  .system-card {
    padding: 16px;
  }
}

.login--entry {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.login__layout {
  width: 100%;
  max-width: 400px;
  display: block;
  margin: 0;
}
.login__card {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  background: var(--surface);
}
.login__card h1 {
  font-size: 24px;
  margin: 0;
  text-align: center;
}
.login__card > .muted {
  text-align: center;
  margin: 0;
}
.login-mark {
  align-self: center;
  width: 44px;
  height: 44px;
  font-family: var(--font-heading);
  font-size: 20px;
}
.login__card .btn--primary {
  background: var(--brand);
  border-color: var(--brand);
  color: #fff;
}
.login__card .login__note {
  margin: 0;
  font-size: 12px;
  text-align: center;
  color: var(--text-muted);
}
.login__card.is-locked label {
  opacity: 0.55;
}
.shell--restricted .counter-header,
.shell--restricted #environmentFooter {
  display: none;
}
.shell--restricted {
  min-height: 100dvh;
  display: grid;
  place-items: center;
}
.shell--restricted .main {
  width: min(488px, 100%);
  padding: 24px;
}
.shell--restricted .grid2 {
  grid-template-columns: minmax(0, 1fr);
}
.shell--restricted .page-head h1 {
  font-size: 22px;
}
.shell--restricted .card {
  padding: 24px;
}
@media (max-width: 860px) {
  .login--entry {
    padding: 16px;
  }
  .login__card {
    padding: 24px 20px;
  }
  .shell--restricted .main {
    padding: 16px;
  }
}
