/* The order manager is a local view, with no authentication or remote inbox. */
#conteudo[hidden],
.footer[hidden],
#painel-loja[hidden],
.admin-panel [hidden],
.admin-order-dialog [hidden],
.checkout-local-confirmation[hidden] {
  display: none !important;
}

.admin-panel,
.admin-order-dialog {
  --admin-panel: #181e16;
  --admin-soft: #20271b;
  --admin-border: #cbd9b92b;
  --admin-muted: #acb8a0;
  --admin-success: #badb9e;
  --admin-error: #ffc19e;
  color: var(--text);
}

.admin-panel {
  padding-block: 62px 70px;
  min-height: 75dvh;
}

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

.admin-heading .eyebrow {
  font-size: 11px;
}

.admin-heading h1 {
  margin-top: 14px;
  font-size: clamp(34px, 4vw, 49px);
  line-height: 1.15;
  letter-spacing: -1.8px;
}

.admin-heading h1:focus {
  outline: 0;
}

.admin-heading h1 + p {
  margin-top: 16px;
  color: var(--admin-muted);
  font-size: 16px;
  line-height: 1.7;
}

.admin-back,
.admin-export,
.admin-details-button,
.admin-secondary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 43px;
  padding: 10px 16px;
  border: 1px solid var(--admin-border);
  border-radius: 7px;
  background: transparent;
  color: var(--text);
  font: 14px var(--font);
  line-height: 1.5;
  text-align: center;
}

.admin-back {
  flex-shrink: 0;
}

:is(.admin-back, .admin-export, .admin-details-button, .admin-secondary):hover:not(:disabled) {
  border-color: #ff8a4c88;
  background: #ff631c0a;
}

.admin-export:disabled {
  opacity: .4;
  cursor: default;
}

.admin-local-banner {
  margin-top: 29px;
  padding: 15px 18px;
  background: #ffc36f0a;
  border: 1px solid #edbb5c35;
  border-radius: 8px;
  color: #d4c5aa;
  font-size: 14px;
  line-height: 1.8;
}

.admin-local-banner strong {
  color: #f0d79a;
  font-weight: 600;
}

.admin-message {
  margin-top: 18px;
  padding: 12px 15px;
  background: #a6d3750b;
  border: 1px solid #b2d08a36;
  border-radius: 7px;
  color: var(--admin-success);
  font-size: 14px;
  line-height: 1.7;
  overflow-wrap: anywhere;
}

.admin-message.is-error {
  background: #f7a76b0b;
  color: var(--admin-error);
  border-color: #df966443;
}

.admin-kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 17px;
  margin-top: 26px;
}

.admin-kpis article {
  min-width: 0;
  padding: 23px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 12px;
}

.admin-kpis span,
.admin-kpis small {
  display: block;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-kpis strong {
  display: block;
  margin-block: 13px 9px;
  font-family: var(--heading);
  font-size: clamp(24px, 2.5vw, 34px);
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -.8px;
  overflow-wrap: anywhere;
  font-variant-numeric: tabular-nums;
}

.admin-orders-panel {
  margin-top: 28px;
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 13px;
  overflow: hidden;
}

.admin-filters {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 205px auto;
  align-items: end;
  gap: 16px;
  padding: 25px;
}

.admin-filters > div,
.admin-order-fields > div {
  min-width: 0;
}

.admin-filters label,
.admin-order-form label {
  display: block;
  margin-bottom: 8px;
  font-size: 14px;
  line-height: 1.5;
  font-weight: 500;
}

.admin-filters :is(input, select),
.admin-order-form :is(select, textarea) {
  display: block;
  width: 100%;
  min-height: 45px;
  padding: 11px 12px;
  background: var(--admin-soft);
  color: var(--text);
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  font: 14px var(--font);
  line-height: 1.5;
}

.admin-filters input::placeholder,
.admin-order-form textarea::placeholder {
  color: var(--admin-muted);
  opacity: .8;
}

.admin-filters :is(input, select):focus-visible,
.admin-order-form :is(select, textarea):focus-visible {
  outline: 2px solid var(--orange);
  outline-offset: 3px;
}

.admin-export {
  min-height: 45px;
  padding-inline: 18px;
  white-space: nowrap;
}

.admin-list-caption {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 25px;
  border-top: 1px solid var(--admin-border);
  border-bottom: 1px solid var(--admin-border);
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.6;
}

.admin-list-caption p {
  color: var(--text);
  font-size: 14px;
}

.admin-table-wrap {
  overflow: auto;
  overscroll-behavior-x: contain;
}

.admin-orders-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 14px;
  line-height: 1.6;
}

.admin-orders-table :is(th, td) {
  padding: 18px 15px;
  border-bottom: 1px solid var(--admin-border);
  vertical-align: middle;
}

.admin-orders-table :is(th, td):first-child {
  padding-left: 25px;
}

.admin-orders-table :is(th, td):last-child {
  padding-right: 25px;
}

.admin-orders-table th {
  padding-block: 13px;
  color: var(--admin-muted);
  background: #ffffff02;
  font-size: 12px;
  font-weight: 500;
}

.admin-orders-table tbody tr:last-child td {
  border-bottom: 0;
}

.admin-orders-table tbody tr:hover {
  background: #b3cd9405;
}

.admin-order-identity,
.admin-order-customer {
  overflow-wrap: anywhere;
}

.admin-order-identity {
  width: 20%;
  min-width: 150px;
}

.admin-order-customer {
  width: 27%;
  max-width: 270px;
}

.admin-orders-table :is(.admin-order-identity, .admin-order-customer) strong {
  display: block;
  font-weight: 500;
}

.admin-orders-table :is(.admin-order-identity, .admin-order-customer) small {
  display: block;
  margin-top: 4px;
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-order-quantity,
.admin-order-subtotal {
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.admin-status-badge {
  display: inline-flex;
  align-items: center;
  padding: 5px 9px;
  color: #b8c7a8;
  background: #aec88c0c;
  border: 1px solid #aec88c36;
  border-radius: 20px;
  font-size: 12px;
  line-height: 1.5;
  white-space: nowrap;
}

.admin-status-badge[data-status="new"] {
  color: #f3c09e;
  background: #f3925910;
  border-color: #f3925940;
}

.admin-status-badge[data-status="production"] {
  color: #f0d48e;
  background: #ebbc4b0d;
  border-color: #ebbc4b36;
}

.admin-status-badge[data-status="shipped"] {
  color: #aecce8;
  background: #8cc1ee0b;
  border-color: #8cc1ee36;
}

.admin-status-badge[data-status="completed"] {
  color: #bcdda6;
  background: #a5d17310;
  border-color: #a5d17340;
}

.admin-status-badge[data-status="cancelled"] {
  color: #c3b9b3;
  background: #c3b9b309;
  border-color: #c3b9b32f;
}

.admin-order-action {
  text-align: right;
}

.admin-details-button {
  min-height: 40px;
  padding: 8px 11px;
  font-size: 12px;
  white-space: nowrap;
}

.admin-empty {
  padding: 65px 25px 70px;
  text-align: center;
}

.admin-empty-symbol {
  display: grid;
  place-items: center;
  width: 49px;
  height: 49px;
  margin: 0 auto 21px;
  color: #b8cb9e;
  background: #b2cd9110;
  border: 1px solid #b2cd9136;
  border-radius: 12px;
  font-size: 25px;
}

.admin-empty h2 {
  font-size: 25px;
  letter-spacing: -.7px;
  line-height: 1.4;
}

.admin-empty p {
  max-width: 430px;
  margin: 12px auto 0;
  color: var(--admin-muted);
  font-size: 14px;
  line-height: 1.8;
}

.admin-empty a {
  display: inline-flex;
  margin-top: 23px;
  min-height: 40px;
  align-items: center;
  color: #ffa16d;
  font-size: 14px;
  text-decoration: underline;
  text-underline-offset: 5px;
}

.admin-bottom-note {
  max-width: 780px;
  margin-top: 22px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.8;
}

.admin-order-dialog {
  width: min(980px, calc(100vw - 32px));
  max-height: 92dvh;
  padding: 0;
  overflow: auto;
  overscroll-behavior: contain;
  color: var(--text);
  background: var(--admin-panel);
  border: 1px solid var(--admin-border);
  border-radius: 15px;
  box-shadow: 0 35px 110px #0009;
  font-family: var(--font);
}

.admin-order-dialog::backdrop {
  background: #030805c9;
  backdrop-filter: blur(8px);
}

.admin-dialog-header {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 2;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 25px 30px;
  background: var(--admin-panel);
  border-bottom: 1px solid var(--admin-border);
}

.admin-dialog-header .eyebrow {
  font-size: 10px;
}

.admin-dialog-header h2 {
  margin-top: 8px;
  font-size: 30px;
  letter-spacing: -.9px;
  line-height: 1.3;
  overflow-wrap: anywhere;
}

.admin-dialog-header h2 + p {
  margin-top: 8px;
  color: var(--admin-muted);
  font-size: 12px;
  line-height: 1.7;
}

.admin-dialog-header > button {
  display: grid;
  place-items: center;
  flex-shrink: 0;
  width: 41px;
  height: 41px;
  padding: 0;
  background: #ffffff04;
  color: inherit;
  border: 1px solid var(--admin-border);
  border-radius: 7px;
  font-size: 27px;
}

.admin-dialog-body {
  padding: 28px 30px 30px;
}

.admin-detail-columns {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, .9fr);
  gap: 32px;
}

.admin-dialog-body h3 {
  margin: 0 0 18px;
  font-size: 19px;
  line-height: 1.5;
  letter-spacing: -.5px;
}

.admin-detail-item {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: start;
  gap: 13px;
  padding: 16px 0;
  border-bottom: 1px solid var(--admin-border);
  font-size: 14px;
}

.admin-detail-item:first-child {
  padding-top: 0;
}

.admin-detail-image {
  width: 52px;
  height: 65px;
  border-radius: 5px;
  object-fit: cover;
  object-position: center;
}

.admin-item-placeholder {
  display: grid;
  place-items: center;
  background: var(--admin-soft);
  color: var(--admin-muted);
  border: 1px solid var(--admin-border);
  font-size: 20px;
}

.admin-detail-item h4 {
  margin: 0;
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
}

.admin-detail-item p {
  margin-top: 6px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.7;
}

.admin-detail-item > strong {
  font-size: 14px;
  font-weight: 500;
  line-height: 1.6;
  white-space: nowrap;
}

.admin-data-list {
  margin: 0;
  font-size: 14px;
  line-height: 1.7;
}

.admin-data-list > div {
  margin-bottom: 13px;
}

.admin-data-list dt {
  color: var(--admin-muted);
  font-size: 12px;
}

.admin-data-list dd {
  margin: 3px 0 0;
  overflow-wrap: anywhere;
}

.admin-detail-totals {
  margin-top: 22px;
}

.admin-detail-totals > div {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 20px;
  margin-bottom: 11px;
}

.admin-detail-totals dt,
.admin-detail-totals dd {
  margin: 0;
  font-size: 14px;
}

.admin-detail-totals dd {
  text-align: right;
  font-variant-numeric: tabular-nums;
}

.admin-payment-note {
  margin-top: 17px;
  padding: 12px 14px;
  border: 1px solid var(--admin-border);
  border-radius: 6px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.7;
}

.admin-detail-history {
  margin-top: 28px;
  padding-top: 23px;
  border-top: 1px solid var(--admin-border);
}

.admin-detail-history ol {
  display: flex;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin: 0;
  padding-left: 20px;
  color: var(--admin-muted);
  font-size: 13px;
  line-height: 1.7;
}

.admin-detail-history li strong,
.admin-detail-history li span {
  display: block;
  font-size: 13px;
  line-height: 1.7;
}

.admin-detail-history li strong {
  color: var(--text);
  font-weight: 500;
}

.admin-detail-history > p {
  color: var(--admin-muted);
  font-size: 14px;
}

.admin-order-form {
  margin-top: 27px;
  padding-top: 25px;
  border-top: 1px solid var(--admin-border);
}

.admin-order-fields {
  display: grid;
  grid-template-columns: minmax(170px, .65fr) minmax(0, 1.35fr);
  gap: 24px;
  align-items: start;
}

.admin-order-form label small,
.admin-order-fields > div > small {
  color: var(--admin-muted);
  font-size: 12px;
  font-weight: 400;
  line-height: 1.7;
}

.admin-order-fields > div > small {
  display: block;
  margin-top: 7px;
}

.admin-order-form textarea {
  min-height: 115px;
  resize: vertical;
}

.admin-order-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 22px;
}

.admin-order-actions > .button {
  min-height: 44px;
  padding: 12px 19px;
  border: 0;
  font-size: 14px;
}

.footer-store-tools {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-left: auto;
}

.store-management-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px 20px;
  margin-top: 18px;
}

.store-management-actions .cart-trigger {
  margin-top: 0;
}

.shop-admin-link {
  min-height: 42px;
  padding: 7px 0;
  color: var(--muted);
  background: transparent;
  border: 0;
  font: 14px var(--font);
  line-height: 1.5;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-align: left;
}

.shop-admin-link:hover {
  color: var(--orange);
}

.footer-store-tools [data-open-admin] {
  min-height: 40px;
  padding: 7px 10px;
  color: inherit;
  background: transparent;
  border: 1px solid var(--line);
  border-radius: 5px;
  font: 12px var(--font);
}

.footer-store-tools [data-open-admin]:hover {
  color: var(--orange);
  border-color: #ff631c60;
}

.checkout-local-order-status {
  margin-top: 17px;
  color: var(--checkout-muted);
  font-size: 14px;
  line-height: 1.7;
}

.checkout-local-confirmation {
  margin-top: 23px;
  padding: 24px;
  background: #9bc6740b;
  border: 1px solid #a7ca7b4a;
  border-radius: 9px;
}

.checkout-local-confirmation .resource-label {
  color: #badb9e;
  font-size: 10px;
}

.checkout-local-confirmation h4 {
  margin: 12px 0 0;
  color: var(--checkout-text);
  font-size: 24px;
  font-weight: 500;
  line-height: 1.5;
  letter-spacing: -.5px;
}

.checkout-local-confirmation p {
  margin-top: 12px;
  color: var(--checkout-muted);
  font-size: 14px;
  line-height: 1.8;
}

.checkout-local-confirmation .button {
  min-height: 44px;
  margin-top: 20px;
  padding: 12px 17px;
  border: 0;
  font-size: 14px;
}

html[data-theme="light"] :is(.admin-panel, .admin-order-dialog) {
  --admin-panel: #fffefb;
  --admin-soft: #f1f4eb;
  --admin-border: #5d784b36;
  --admin-muted: #5a6b50;
  --admin-success: #426d29;
  --admin-error: #a24e20;
}

html[data-theme="light"] .admin-local-banner {
  color: #77633c;
  background: #fff7e4;
  border-color: #b9995145;
}

html[data-theme="light"] .admin-local-banner strong {
  color: #6f511d;
}

html[data-theme="light"] .admin-empty a {
  color: #a94813;
}

html[data-theme="light"] .admin-status-badge {
  color: #58703f;
}

html[data-theme="light"] .admin-status-badge[data-status="new"] {
  color: #a64d1a;
}

html[data-theme="light"] .admin-status-badge[data-status="production"] {
  color: #8b6b17;
}

html[data-theme="light"] .admin-status-badge[data-status="shipped"] {
  color: #3c6d98;
}

html[data-theme="light"] .admin-status-badge[data-status="completed"] {
  color: #4f7b31;
}

html[data-theme="light"] .admin-status-badge[data-status="cancelled"] {
  color: #75675d;
}

html[data-theme="light"] .admin-order-dialog {
  box-shadow: 0 35px 110px #172b1a44;
}

html[data-theme="light"] .checkout-local-confirmation {
  background: #edf4e4;
  border-color: #71964b55;
}

html[data-theme="light"] .checkout-local-confirmation .resource-label {
  color: #496f2c;
}

@media (max-width: 980px) {
  .admin-kpis {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .admin-filters {
    grid-template-columns: minmax(0, 1fr) auto;
  }

  .admin-filter-search {
    grid-column: 1 / -1;
  }

  .admin-orders-table {
    min-width: 840px;
  }

  .admin-detail-columns {
    gap: 25px;
  }

  .admin-detail-item {
    grid-template-columns: 47px minmax(0, 1fr);
  }

  .admin-detail-image {
    width: 47px;
    height: 59px;
  }

  .admin-detail-item > strong {
    grid-column: 2;
  }
}

@media (max-width: 720px) {
  .admin-panel {
    padding-block: 38px 50px;
  }

  .admin-heading {
    align-items: start;
    flex-direction: column;
    gap: 19px;
  }

  .admin-heading h1 {
    font-size: 36px;
    letter-spacing: -1.2px;
  }

  .admin-heading h1 + p {
    font-size: 14px;
  }

  .admin-local-banner {
    margin-top: 24px;
    padding: 14px 16px;
  }

  .admin-kpis {
    gap: 12px;
    margin-top: 20px;
  }

  .admin-kpis article {
    padding: 19px 17px;
  }

  .admin-kpis strong {
    font-size: 26px;
  }

  .admin-kpis small {
    font-size: 12px;
  }

  .admin-orders-panel {
    margin-top: 22px;
  }

  .admin-filters {
    padding: 21px;
    gap: 15px;
  }

  .admin-filters :is(input, select),
  .admin-order-form :is(select, textarea) {
    font-size: 16px;
  }

  .admin-list-caption {
    flex-direction: column;
    align-items: start;
    gap: 3px;
    padding: 14px 21px;
    font-size: 12px;
  }

  .admin-orders-table {
    min-width: 0;
    display: block;
  }

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

  .admin-orders-table tbody {
    display: block;
  }

  .admin-orders-table tr {
    display: grid;
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    gap: 16px 20px;
    padding: 23px 21px;
    border-bottom: 1px solid var(--admin-border);
  }

  .admin-orders-table tr:last-child {
    border-bottom: 0;
  }

  .admin-orders-table td,
  .admin-orders-table td:first-child,
  .admin-orders-table td:last-child {
    display: block;
    min-width: 0;
    max-width: none;
    width: auto;
    padding: 0;
    border: 0;
  }

  .admin-orders-table td:nth-child(1),
  .admin-orders-table td:nth-child(2) {
    grid-column: 1 / -1;
  }

  .admin-orders-table td:nth-child(1) strong {
    font-size: 16px;
  }

  .admin-orders-table td:nth-child(2)::before,
  .admin-orders-table td:nth-child(3)::before,
  .admin-orders-table td:nth-child(4)::before,
  .admin-orders-table td:nth-child(5)::before {
    display: block;
    margin-bottom: 5px;
    color: var(--admin-muted);
    font-size: 12px;
  }

  .admin-orders-table td:nth-child(2)::before { content: 'Cliente'; }
  .admin-orders-table td:nth-child(3)::before { content: 'Broches'; }
  .admin-orders-table td:nth-child(4)::before { content: 'Subtotal'; }
  .admin-orders-table td:nth-child(5)::before { content: 'Status'; }

  .admin-order-action {
    display: flex !important;
    align-items: end;
    justify-content: end;
  }

  .admin-details-button {
    min-height: 42px;
    font-size: 14px;
  }

  .admin-empty {
    padding: 43px 22px 47px;
  }

  .admin-empty h2 {
    font-size: 23px;
  }

  .admin-order-dialog {
    width: calc(100vw - 24px);
    max-height: 94dvh;
    border-radius: 12px;
  }

  .admin-dialog-header {
    padding: 21px;
    gap: 14px;
  }

  .admin-dialog-header h2 {
    font-size: 25px;
  }

  .admin-dialog-body {
    padding: 24px 21px;
  }

  .admin-detail-columns,
  .admin-order-fields {
    grid-template-columns: minmax(0, 1fr);
    gap: 26px;
  }

  .admin-detail-customer {
    border-top: 1px solid var(--admin-border);
    padding-top: 24px;
  }

  .admin-detail-item {
    grid-template-columns: 47px minmax(0, 1fr) auto;
  }

  .admin-detail-item > strong {
    grid-column: auto;
  }

  .admin-data-list > div {
    margin-bottom: 12px;
  }

  .admin-order-fields {
    gap: 19px;
  }

  .admin-order-fields > div:first-child {
    max-width: 280px;
  }

  .admin-detail-history ol {
    flex-direction: column;
    gap: 13px;
  }

  .checkout-local-confirmation {
    padding: 20px;
  }
}

@media (max-width: 620px) {
  .footer-store-tools {
    grid-column: 1 / -1;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    margin-left: 0;
    gap: 15px;
  }

  .footer-store-tools [data-open-admin] {
    justify-self: start;
    font-size: 12px;
  }

  .footer .footer-store-tools small {
    font-size: 10px;
  }
}

@media (max-width: 430px) {
  .admin-filters {
    grid-template-columns: minmax(0, 1fr);
  }

  .admin-export {
    width: 100%;
  }

  .admin-kpis article {
    padding: 17px 14px;
  }

  .admin-kpis strong {
    font-size: 24px;
  }

  .admin-detail-item {
    grid-template-columns: 44px minmax(0, 1fr);
    gap: 8px 12px;
  }

  .admin-detail-image {
    width: 44px;
    height: 55px;
  }

  .admin-detail-item > strong {
    grid-column: 2;
  }

  .admin-order-actions > * {
    width: 100%;
  }
}
