.orders-shell {
  max-width: 1360px;
}

.orders-page .hero-subtitle {
  max-width: 820px;
  color: var(--text);
  font-size: 21px;
  font-weight: 600;
  line-height: 1.4;
}

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

.orders-sidebar {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 8px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.order-nav-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 70px;
  border: 0;
  border-radius: 12px;
  padding: 12px;
  background: transparent;
  text-align: left;
}

.order-nav-item:hover {
  background: #f5f5f7;
}

.order-nav-item--active {
  background: #1d1d1f;
  color: #fff;
}

.order-nav-item span,
.order-nav-item strong,
.order-nav-item em,
.order-nav-item small {
  display: block;
}

.order-nav-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.order-nav-item em {
  margin-top: 3px;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.order-nav-item small {
  flex: 0 0 auto;
  color: var(--soft);
  font-size: 12px;
}

.order-nav-item--active em,
.order-nav-item--active small {
  color: #ffffffb8;
}

.orders-detail-pane {
  min-width: 0;
}

.orders-page-stack {
  display: grid;
  gap: 16px;
}

.orders-console {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  gap: 18px;
  align-items: start;
}

.console-sidebar {
  position: sticky;
  top: 72px;
  display: grid;
  gap: 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.console-sidebar-head {
  display: grid;
  gap: 4px;
  padding: 6px 4px 10px;
  border-bottom: 1px solid var(--line);
}

.console-sidebar-head strong {
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

.console-sidebar-head span {
  color: var(--muted);
  font-size: 12px;
}

.console-nav,
.console-nav-group {
  display: grid;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
}

.console-nav-group {
  padding-top: 4px;
}

.console-nav-group > span {
  padding: 0 4px;
  color: var(--soft);
  font-size: 12px;
}

.console-nav-item {
  box-sizing: border-box;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  min-height: 58px;
  border: 1px solid transparent;
  border-radius: 12px;
  padding: 10px 11px;
  color: var(--text);
  background: transparent;
  text-align: left;
}

.console-nav-item:hover {
  background: #f5f5f7;
}

.console-nav-item--active {
  border-color: #1d1d1f;
  color: #fff;
  background: #1d1d1f;
}

.console-nav-item span,
.console-nav-item strong,
.console-nav-item em {
  display: block;
  min-width: 0;
}

.console-nav-item strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: 0;
}

.console-nav-item em {
  margin-top: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.console-nav-item small {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-width: 22px;
  height: 22px;
  border-radius: 999px;
  color: var(--muted);
  background: #f1f2f4;
  font-size: 12px;
}

.console-nav-item--active em,
.console-nav-item--active small {
  color: #ffffffbd;
}

.console-nav-item--active small {
  background: #ffffff21;
}

.console-detail {
  min-width: 0;
}

.console-main-stack {
  display: grid;
  gap: 16px;
}

.console-hero-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(360px, 1fr);
  gap: 16px;
  align-items: stretch;
}

.console-hero-panel--key-only {
  grid-template-columns: minmax(0, 1fr);
}

.console-hero-copy {
  display: grid;
  align-content: center;
  gap: 8px;
  min-height: 150px;
  padding: 6px 2px;
}

.console-hero-copy span,
.console-panel-head span,
.console-master-card span,
.entitlement-card span {
  color: var(--muted);
  font-size: 13px;
}

.console-hero-copy strong {
  color: var(--text);
  font-size: 34px;
  line-height: 1.15;
  letter-spacing: 0;
}

.console-hero-copy p,
.console-master-card p {
  margin: 0;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.console-master-card,
.console-panel,
.entitlement-card {
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.console-master-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  min-width: 0;
  min-height: 76px;
  padding: 16px 18px;
}

.console-master-main,
.console-master-card div {
  min-width: 0;
}

.console-master-main {
  display: flex;
  align-items: center;
  gap: 14px;
  flex: 1 1 auto;
}

.console-master-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex: 0 0 auto;
}

.console-master-title span {
  flex: 0 0 auto;
  white-space: nowrap;
}

.console-master-card code {
  display: block;
  flex: 1 1 auto;
  margin: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: #1d3f91;
  font-size: 18px;
}

.console-master-actions,
.console-key-actions,
.entitlement-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
}

.console-master-actions {
  flex: 0 0 auto;
}

.console-key-actions {
  flex: 0 0 auto;
  justify-content: flex-end;
  padding-top: 0;
  white-space: nowrap;
}

.console-key-actions .copy-inline {
  min-width: 74px;
}

.console-key-actions .copy-inline:first-child {
  min-width: 92px;
}

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

.key-status-pill {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  border-radius: 8px;
  padding: 0 10px;
  color: var(--muted);
  background: #f5f5f7;
  font-size: 12px;
}

.key-status-pill--paused {
  color: var(--orange);
  background: #ff95001a;
}

.console-buy-link,
.service-buy-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
}

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

.console-metrics--compact {
  grid-template-columns: repeat(5, minmax(0, 1fr));
}

.console-metrics div {
  display: grid;
  gap: 6px;
  min-height: 82px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: #fff;
  box-shadow: var(--shadow);
}

.console-metrics--compact div {
  min-height: 70px;
  box-shadow: none;
}

.console-metrics span {
  color: var(--muted);
  font-size: 12px;
}

.console-metrics strong {
  align-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 20px;
  letter-spacing: 0;
}

.console-panel {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.console-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.console-panel-head strong {
  display: block;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.console-panel-head span {
  display: block;
  margin-top: 4px;
}

.service-summary-grid,
.entitlement-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.service-summary-card {
  display: grid;
  gap: 6px;
  min-height: 128px;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px;
  color: var(--text);
  background: #fafafa;
  text-align: left;
}

.service-summary-card--empty {
  align-content: start;
}

.service-summary-card:hover {
  border-color: #1d1d1f;
  background: #fff;
}

.service-summary-card span,
.service-summary-card em,
.service-summary-card small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.service-summary-card strong {
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.service-summary-card em,
.service-summary-card small {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.service-buy-btn {
  width: max-content;
  margin-top: 8px;
  color: #fff;
}

.entitlement-card {
  display: grid;
  gap: 12px;
  padding: 14px;
  box-shadow: none;
}

.entitlement-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.entitlement-card-head div {
  min-width: 0;
}

.entitlement-card-head strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 16px;
  letter-spacing: 0;
}

.entitlement-status {
  flex: 0 0 auto;
  border-radius: 999px;
  padding: 5px 9px;
  color: #6b7280;
  background: #f3f4f6;
  font-style: normal;
  font-size: 12px;
}

.entitlement-status--ok {
  color: #237044;
  background: #eaf8ee;
}

.entitlement-card-body {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.entitlement-card-body div {
  display: grid;
  gap: 3px;
  min-width: 0;
  min-height: 58px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #fafafa;
}

.entitlement-card-body strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 13px;
}

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

.order-history-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  min-height: 62px;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  color: var(--text);
  background: #fff;
  text-align: left;
}

.order-history-row--active,
.order-history-row:hover {
  border-color: #1d1d1f;
}

.order-history-row span,
.order-history-row strong,
.order-history-row em {
  display: block;
  min-width: 0;
}

.order-history-row strong {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
  letter-spacing: 0;
}

.order-history-row em,
.order-history-row small {
  color: var(--muted);
  font-style: normal;
  font-size: 12px;
}

.order-key-block {
  align-items: end;
}

.key-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  margin-top: 10px;
}

.copy-inline--light {
  color: var(--text);
  background: #f5f5f7;
}

.order-key-block code {
  font-size: 14px;
}

.order-meta-grid strong {
  font-size: 13px;
  line-height: 1.25;
}

.order-meta-grid div {
  display: grid;
  place-items: center;
  min-height: 66px;
  text-align: center;
}

.order-meta-grid div span,
.order-meta-grid div strong {
  max-width: 100%;
}

.order-meta-grid div:nth-child(3) strong {
  font-size: 12px;
  white-space: nowrap;
  line-height: 1.2;
  overflow: hidden;
  text-overflow: ellipsis;
}

.codex-command-block pre {
  max-height: 260px;
}

.usage-window-section {
  display: grid;
  gap: 10px;
  padding-top: 2px;
}

.usage-window-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
}

.usage-window-head strong {
  font-size: 13px;
  letter-spacing: 0;
}

.usage-window-head span {
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.usage-window-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.usage-window-card {
  display: grid;
  gap: 8px;
  min-width: 0;
  padding: 11px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.usage-window-title,
.usage-window-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.usage-window-title span,
.usage-window-meta span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.usage-window-title span {
  color: var(--muted);
  font-size: 12px;
}

.usage-window-title strong {
  color: var(--text);
  font-size: 15px;
  white-space: nowrap;
}

.usage-window-progress {
  height: 6px;
  overflow: hidden;
  border-radius: 999px;
  background: #e9e9ee;
}

.usage-window-progress span {
  display: block;
  height: 100%;
  border-radius: inherit;
  background: #1d1d1f;
}

.usage-window-meta {
  color: var(--soft);
  font-size: 11px;
}

.usage-records-card {
  display: grid;
  gap: 14px;
  padding: 18px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fff;
  box-shadow: var(--shadow);
}

.usage-records-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
}

.usage-records-head strong,
.usage-records-head span {
  display: block;
}

.usage-records-head strong {
  font-size: 18px;
  letter-spacing: 0;
}

.usage-records-head span {
  margin-top: 4px;
  color: var(--muted);
  font-size: 13px;
}

.usage-record-tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: thin;
}

.usage-record-tab {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0 11px;
  color: var(--muted);
  background: #fff;
  font-size: 13px;
}

.usage-record-tab span {
  color: var(--soft);
  font-size: 12px;
}

.usage-record-tab--active {
  border-color: #1d1d1f;
  color: #fff;
  background: #1d1d1f;
}

.usage-record-tab--active span {
  color: #ffffffb8;
}

.usage-record-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
}

.usage-record-stats div {
  display: grid;
  gap: 4px;
  min-height: 66px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fafafa;
}

.usage-record-stats span {
  color: var(--muted);
  font-size: 12px;
}

.usage-record-stats strong {
  align-self: end;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
  font-size: 18px;
  letter-spacing: 0;
}

.usage-record-message,
.usage-record-loading,
.usage-record-empty {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

.usage-record-loading,
.usage-record-empty {
  padding: 22px 10px;
  text-align: center;
}

.usage-record-table-wrap {
  max-height: 420px;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
}

.usage-record-table {
  width: 100%;
  min-width: 1120px;
  border-collapse: collapse;
  font-size: 13px;
}

.usage-record-table th,
.usage-record-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
}

.usage-record-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  color: var(--muted);
  background: #fff;
  font-weight: 600;
}

.usage-record-table td strong,
.usage-record-table td span {
  display: block;
}

.usage-record-table td span {
  margin-top: 3px;
  color: var(--soft);
  font-size: 12px;
}

.usage-record-table code {
  font-size: 12px;
  white-space: nowrap;
}

.usage-record-pagination {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.usage-record-pagination div {
  display: flex;
  gap: 8px;
}

@media (max-width: 900px) {
  .orders-console,
  .orders-workspace {
    grid-template-columns: 1fr;
  }

  .console-sidebar,
  .orders-sidebar {
    position: static;
  }

  .console-nav {
    display: flex;
    gap: 10px;
    overflow-x: auto;
    padding-bottom: 2px;
    scrollbar-width: none;
  }

  .console-nav-group {
    display: contents;
  }

  .console-nav-group > span {
    display: none;
  }

  .console-nav-item {
    flex: 0 0 min(250px, 78vw);
  }

  .orders-sidebar {
	  display: flex;
	  gap: 10px;
	  overflow-x: auto;
	  padding: 8px;
	  scrollbar-width: none;
  }

  .console-nav::-webkit-scrollbar,
  .orders-sidebar::-webkit-scrollbar {
    display: none;
  }

  .order-nav-item {
    flex: 0 0 min(280px, 82vw);
  }

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

  .usage-window-grid {
    grid-template-columns: 1fr;
  }

  .console-hero-panel,
  .service-summary-grid,
  .entitlement-grid {
    grid-template-columns: 1fr;
  }

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

  .entitlement-card-body {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 520px) {
  .key-actions {
    width: 100%;
  }

  .key-actions .copy-inline {
    flex: 1;
  }

  .usage-records-card {
    padding: 14px;
  }

  .console-master-card,
  .usage-records-head,
  .usage-window-head,
  .console-panel-head,
  .usage-record-pagination {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-window-head span {
    text-align: left;
  }

  .console-master-main {
    align-items: stretch;
    flex-direction: column;
    gap: 8px;
    width: 100%;
  }

  .console-master-title {
    align-items: stretch;
    flex-direction: column;
  }

  .console-key-actions {
    justify-content: flex-start;
    width: 100%;
  }

  .console-metrics {
    grid-template-columns: 1fr;
  }

  .entitlement-card-body {
    grid-template-columns: 1fr;
  }

  .usage-record-stats {
    grid-template-columns: 1fr;
  }

  .usage-record-pagination div {
    width: 100%;
  }

  .usage-record-pagination button {
    flex: 1;
  }
}
