:root {
  color-scheme: light;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  background: #f3f6f8;
  color: #17212b;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
}

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

.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  min-height: 100vh;
}

.admin-layout.wide {
  grid-template-columns: minmax(0, 1fr) 360px;
}

.admin-layout.clean {
  grid-template-columns: minmax(760px, 1fr) 340px;
  background: #eef3f6;
}

.admin-main,
.admin-side {
  display: grid;
  align-content: start;
  gap: 18px;
  padding: 28px;
}

.admin-layout.clean .admin-main {
  gap: 14px;
  padding: 24px;
}

.admin-layout.clean .admin-side {
  gap: 14px;
  padding: 24px 18px;
}

.admin-side {
  background: #17232d;
}

.page-header,
.section-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.header-actions {
  display: flex;
  gap: 10px;
}

.eyebrow {
  margin: 0 0 6px;
  color: #16846f;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 34px;
}

h2 {
  font-size: 20px;
}

.admin-topbar h1 {
  font-size: 30px;
}

.surface {
  display: grid;
  gap: 16px;
  border: 1px solid #d8e1e8;
  border-radius: 8px;
  background: #fff;
  padding: 18px;
}

.compact-surface {
  gap: 14px;
  padding: 16px 18px;
}

.compact-surface h2,
.config-card h2 {
  font-size: 18px;
}

.surface.dark {
  border-color: #2d4050;
  background: #202f3b;
  color: #edf5f8;
}

.product-form,
.customer-form {
  display: grid;
  gap: 14px;
}

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}

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

.product-edit-grid {
  grid-template-columns: minmax(220px, 1.2fr) minmax(150px, 0.6fr) minmax(220px, 1fr);
}

.link-grid {
  grid-template-columns: minmax(280px, 1fr) 110px 140px 140px;
}

label {
  display: grid;
  gap: 7px;
}

label span {
  color: #627283;
  font-size: 12px;
  font-weight: 800;
}

.required-label::after {
  content: " *";
  color: #d33b3b;
}

.dark label span {
  color: #afc0cc;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid #cbd6df;
  border-radius: 7px;
  background: #fbfcfd;
  color: #17212b;
  padding: 11px 12px;
  outline: none;
}

textarea {
  resize: vertical;
}

input:focus,
textarea:focus,
select:focus {
  border-color: #18a784;
  box-shadow: 0 0 0 3px rgba(24, 167, 132, 0.12);
}

button,
.ghost-link,
.pay-link {
  border-radius: 7px;
  cursor: pointer;
  font-weight: 800;
}

.small-btn {
  padding: 8px 10px;
  font-size: 13px;
}

.primary {
  border: 0;
  background: #18a784;
  color: #fff;
  padding: 12px 15px;
}

.secondary,
.ghost-link {
  border: 1px solid #cbd6df;
  background: #fff;
  color: #233140;
  padding: 10px 12px;
  text-decoration: none;
}

.danger {
  border: 1px solid #f1b5b5;
  background: #fff5f5;
  color: #b72c2c;
  padding: 10px 12px;
}

.hidden {
  display: none !important;
}

.dark-btn {
  border-color: #3a4f60;
  background: #2c4050;
  color: #edf5f8;
}

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

.product-row {
  display: grid;
  grid-template-columns: 96px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border: 1px solid #dde6ec;
  border-radius: 8px;
  padding: 12px;
}

.product-row img {
  width: 96px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #eef3f5;
}

.product-row p {
  color: #5f7080;
  line-height: 1.5;
  margin: 5px 0 8px;
}

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

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

.status-list div {
  display: grid;
  gap: 5px;
  border-bottom: 1px solid #344858;
  padding-bottom: 10px;
}

.status-list span {
  color: #afc0cc;
  font-size: 12px;
  font-weight: 800;
}

.status-list strong {
  word-break: break-word;
}

.log-box {
  max-height: 420px;
  overflow: auto;
  margin: 0;
  color: #cfe0ea;
  white-space: pre-wrap;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.table-wrap {
  width: 100%;
  overflow: auto;
  border: 1px solid #dfe8ee;
  border-radius: 8px;
}

table {
  width: 100%;
  min-width: 860px;
  border-collapse: collapse;
  background: #fff;
}

.admin-table {
  min-width: 760px;
}

.product-table {
  min-width: 720px;
}

.product-table-wrap {
  overflow-x: visible;
}

th,
td {
  padding: 10px 12px;
  border-bottom: 1px solid #e6eef3;
  text-align: left;
  vertical-align: middle;
  font-size: 13px;
}

.index-cell {
  width: 58px;
  color: #697a89;
  font-weight: 800;
}

.table-thumb {
  width: 54px;
  aspect-ratio: 1;
  border-radius: 6px;
  object-fit: cover;
  background: #eef3f5;
}

.selected-product-preview {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  border: 1px solid #dce6ed;
  border-radius: 8px;
  background: #f7fafb;
  padding: 10px;
}

.selected-product-preview img {
  width: 64px;
  aspect-ratio: 1;
  border-radius: 7px;
  object-fit: cover;
  background: #eef3f5;
}

.selected-product-preview div {
  display: grid;
  gap: 4px;
}

.selected-product-preview span,
.muted {
  color: #627283;
  font-size: 13px;
}

.description-cell {
  max-width: 360px;
  color: #627283;
  line-height: 1.45;
}

.remark-cell {
  max-width: 180px;
  color: #526575;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.row-actions {
  display: flex;
  gap: 8px;
  white-space: nowrap;
}

.empty-cell {
  color: #637585;
  padding: 18px;
  text-align: center;
}

th {
  color: #526575;
  background: #f7fafb;
  font-weight: 900;
}

td code {
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  font-weight: 900;
}

.badge.paid {
  background: #e8f8f1;
  color: #127a56;
}

.badge.pending {
  background: #fff4d9;
  color: #8a5d00;
}

.badge.failed {
  background: #ffe9e9;
  color: #b72c2c;
}

.empty-state {
  color: #637585;
  padding: 18px;
  border: 1px dashed #cad5de;
  border-radius: 8px;
}

.form-status {
  min-height: 22px;
  color: #5f7080;
  line-height: 1.5;
  word-break: break-word;
}

.form-status.success {
  color: #127a56;
  font-weight: 800;
}

.form-status.error {
  color: #b72c2c;
  font-weight: 800;
}

.form-status.pending {
  color: #8a5d00;
  font-weight: 800;
}

.pay-layout {
  display: grid;
  min-height: 100vh;
  place-items: center;
  padding: 24px;
}

.pay-card {
  display: grid;
  grid-template-columns: minmax(280px, 420px) minmax(320px, 420px);
  width: min(900px, 100%);
  overflow: hidden;
  border: 1px solid #dce5eb;
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 18px 60px rgba(23, 33, 43, 0.08);
}

.pay-image {
  width: 100%;
  height: 100%;
  min-height: 520px;
  object-fit: cover;
  background: #eef3f5;
}

.pay-content {
  display: grid;
  align-content: center;
  gap: 16px;
  padding: 28px;
}

.pay-content p {
  color: #607182;
  line-height: 1.6;
}

.price {
  font-size: 36px;
  font-weight: 900;
}

.payment-result {
  min-height: 24px;
  color: #516474;
  line-height: 1.6;
}

.payment-result.success {
  display: grid;
  gap: 10px;
  color: #12634f;
}

.payment-result.error {
  color: #ba2f2f;
}

.pay-link {
  display: inline-flex;
  justify-content: center;
  background: #18a784;
  color: #fff;
  padding: 12px 14px;
  text-decoration: none;
}

.qr {
  width: min(260px, 100%);
  aspect-ratio: 1;
  object-fit: contain;
}

.payment-result textarea {
  min-height: 120px;
  font-family: "Cascadia Code", Consolas, monospace;
  font-size: 12px;
}

.skeleton {
  width: 100%;
  min-height: 260px;
  background: linear-gradient(90deg, #edf2f5, #f8fafb, #edf2f5);
}

.checkout-page {
  background: #f5f7f9;
}

.checkout-shell {
  width: min(1180px, 100%);
  margin: 0 auto;
  padding: 42px 22px;
}

.checkout-header {
  margin-bottom: 24px;
}

.checkout-header h1 {
  font-size: 36px;
}

.checkout-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 390px;
  gap: 24px;
  align-items: start;
}

.checkout-panel {
  display: grid;
  gap: 18px;
  border: 1px solid #d8e1e8;
  border-radius: 8px;
  background: #fff;
  padding: 24px;
  box-shadow: 0 14px 44px rgba(23, 33, 43, 0.05);
}

.order-summary {
  position: sticky;
  top: 22px;
}

.summary-product {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  border-bottom: 1px solid #e5edf2;
  padding-bottom: 16px;
}

.summary-product img {
  width: 92px;
  aspect-ratio: 1;
  object-fit: cover;
  border-radius: 8px;
  background: #edf3f6;
}

.summary-product p,
.summary-product span,
.payment-method p {
  color: #627283;
  line-height: 1.5;
}

.summary-lines {
  display: grid;
  gap: 12px;
}

.summary-lines div {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  color: #526575;
}

.summary-lines strong {
  color: #17212b;
}

.summary-total {
  border-top: 1px solid #e5edf2;
  padding-top: 14px;
  font-size: 20px;
  font-weight: 900;
}

.payment-method {
  display: grid;
  gap: 7px;
  border: 1px solid #d8e1e8;
  border-radius: 8px;
  background: #f7fafb;
  padding: 14px;
}

.phone-field {
  display: grid;
  grid-template-columns: 62px minmax(0, 1fr);
}

.phone-prefix {
  display: grid;
  place-items: center;
  border: 1px solid #cbd6df;
  border-right: 0;
  border-radius: 7px 0 0 7px;
  background: #eef4f7;
  color: #17212b;
  font-weight: 900;
}

.phone-field input {
  border-radius: 0 7px 7px 0;
}

.pix-method {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #17212b;
  font-weight: 900;
}

.pix-icon {
  display: inline-grid;
  place-items: center;
  width: 42px;
  height: 28px;
  border-radius: 6px;
  background: #18a784;
  color: #fff;
  font-size: 11px;
  letter-spacing: 0;
}

.place-order {
  width: 100%;
}

.admin-shell {
  display: grid;
  gap: 16px;
  min-height: 100vh;
  background: #eef3f6;
  padding: 24px;
}

.admin-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.admin-header h1 {
  font-size: 30px;
}

.admin-tabs {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid #d4dfe7;
}

.tab-button {
  border: 0;
  border-bottom: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: #526575;
  padding: 12px 16px;
  font-weight: 900;
}

.tab-button.active {
  border-bottom-color: #18a784;
  color: #17212b;
}

.tab-panel {
  display: none;
  gap: 14px;
}

.tab-panel.active {
  display: grid;
}

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

.light-list div {
  border-bottom-color: #dce6ed;
}

.light-list span {
  color: #627283;
}

.light-log {
  color: #17212b;
  background: #f7fafb;
  border: 1px solid #dce6ed;
  border-radius: 8px;
  padding: 12px;
}

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  background: rgba(12, 22, 31, 0.58);
  padding: 22px;
}

.order-modal {
  display: grid;
  gap: 16px;
  width: min(920px, 100%);
  max-height: min(760px, calc(100vh - 44px));
  overflow: auto;
  border-radius: 8px;
  background: #fff;
  padding: 20px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.order-detail {
  display: grid;
  gap: 14px;
}

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

.detail-grid section {
  display: grid;
  gap: 10px;
  border: 1px solid #dce6ed;
  border-radius: 8px;
  padding: 14px;
}

.detail-grid h3 {
  font-size: 15px;
}

.detail-row {
  display: grid;
  grid-template-columns: 92px minmax(0, 1fr);
  gap: 10px;
  align-items: start;
}

.detail-row span {
  color: #637585;
  font-size: 12px;
  font-weight: 800;
}

.detail-row strong {
  overflow-wrap: anywhere;
  font-size: 13px;
}

.pix-logo-box {
  display: grid;
  place-items: center;
  width: 48px;
  aspect-ratio: 1;
  border: 1px solid #dbe6ed;
  border-radius: 8px;
  background: #fff;
}

.pix-logo-box img {
  width: 38px;
  height: 38px;
  object-fit: contain;
}

.admin-console {
  display: grid;
  grid-template-columns: 230px minmax(0, 1fr);
  min-height: 100vh;
  background: #eef3f6;
}

.side-nav {
  display: grid;
  align-content: start;
  gap: 22px;
  border-right: 1px solid #d7e2e9;
  background: #fff;
  padding: 24px 16px;
}

.brand-block h1 {
  font-size: 26px;
}

.side-tabs {
  display: grid;
  gap: 6px;
}

.side-tab {
  width: 100%;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: #526575;
  padding: 12px 14px;
  text-align: left;
  font-weight: 900;
}

.side-tab.active {
  background: #e8f7f2;
  color: #127a56;
}

.console-main {
  display: grid;
  align-content: start;
  gap: 16px;
  padding: 24px;
}

.console-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.console-header h2 {
  font-size: 28px;
}

.compact-modal {
  width: min(680px, 100%);
}

@media (max-width: 980px) {
  .admin-layout,
  .admin-layout.clean,
  .admin-console,
  .pay-card,
  .checkout-grid,
  .config-grid {
    grid-template-columns: 1fr;
  }

  .order-summary {
    position: static;
  }

  .product-row {
    grid-template-columns: 80px 1fr;
  }

  .link-tools {
    grid-column: 1 / -1;
  }

  .product-table-wrap {
    overflow-x: auto;
  }

  .product-edit-grid,
  .link-grid {
    grid-template-columns: 1fr 1fr;
  }

  .pay-image {
    min-height: auto;
    aspect-ratio: 1;
  }
}

@media (max-width: 640px) {
  .admin-main,
  .admin-side,
  .pay-layout,
  .checkout-shell,
  .admin-shell {
    padding: 16px;
  }

  .console-main,
  .side-nav {
    padding: 16px;
  }

  .admin-header,
  .console-header,
  .admin-tabs {
    flex-direction: column;
    align-items: stretch;
  }

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

  .form-grid,
  .form-grid.three,
  .product-edit-grid,
  .link-grid,
  .page-header,
  .section-title,
  .link-tools {
    grid-template-columns: 1fr;
    flex-direction: column;
    align-items: stretch;
  }
}
