.agent-page {
  --agent-ink: #182840;
  --agent-muted: #718095;
  --agent-line: #e5e9ef;
  --agent-paper: #fff;
  --agent-canvas: #f2f4f7;
  --agent-gold: #ffb600;
  min-height: 100vh;
  background: var(--agent-canvas);
  color: var(--agent-ink);
  font-family: "DM Sans", "Segoe UI", sans-serif;
}

.agent-page a { color: inherit; text-decoration: none; }
.agent-page .dashboard-brand strong { color: #f09b00; }
.agent-page .dashboard-nav { display: flex; }
.agent-header-login,.agent-signout { padding: 10px 14px; border: 1px solid var(--agent-line); border-radius: 6px; background: white; color: var(--agent-ink); font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; }

.agent-join-shell { width: min(1080px, calc(100% - 40px)); margin: 28px auto 0; }
.agent-join-hero { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(240px, 0.7fr); gap: 30px; align-items: center; padding: 34px; border-radius: 12px; background: linear-gradient(112deg, #ffbf00, #ffa51a); box-shadow: 0 8px 22px rgba(100, 73, 0, 0.11); }
.agent-join-copy { max-width: 620px; }
.agent-eyebrow { margin: 0 0 8px; color: #89702e; font-size: 10px; font-weight: 800; }
.agent-join-hero h1 { max-width: 570px; margin: 0; color: var(--agent-ink); font-size: 38px; line-height: 1.08; font-weight: 800; }
.agent-join-copy > p:not(.agent-eyebrow) { max-width: 530px; margin-top: 12px; color: #594616; font-size: 14px; line-height: 1.6; }
.agent-benefits { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 22px; }
.agent-benefits span { padding: 8px 11px; border: 1px solid rgba(24,40,64,.14); border-radius: 5px; background: rgba(255,255,255,.34); color: #473814; font-size: 10px; font-weight: 700; }
.join-fee-panel { padding: 20px; border: 1px solid rgba(24,40,64,.12); border-radius: 8px; background: rgba(255,255,255,.7); }
.fee-label { display: block; color: #856000; font-size: 9px; font-weight: 800; }
.join-fee-panel > strong { display: block; margin-top: 8px; color: var(--agent-ink); font-size: 34px; font-weight: 800; }
.join-fee-panel p { margin-top: 7px; color: #5f6877; font-size: 11px; line-height: 1.55; }
.fee-link { display: inline-block; margin-top: 14px; color: #253855 !important; font-size: 12px; font-weight: 800; }

.agent-auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 19px; }
.agent-form-panel { padding: 24px; border: 1px solid var(--agent-line); border-radius: 9px; background: white; box-shadow: 0 3px 12px rgba(27,42,66,.035); }
.agent-section-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.agent-section-head h2 { margin: 0; color: var(--agent-ink); font-size: 20px; font-weight: 800; }
.agent-section-head .agent-eyebrow { color: #8b96a7; }
.step-chip { padding: 7px 10px; border-radius: 20px; background: #fff4d0; color: #896000; font-size: 11px; font-weight: 800; }
.agent-form-intro { margin: 8px 0 17px; color: var(--agent-muted); font-size: 12px; line-height: 1.55; }
.agent-form { display: grid; gap: 8px; }
.agent-form label,.sale-dialog label { margin: 4px 0 0; color: #58677c; font-size: 11px; font-weight: 700; }
.agent-form input,.sale-dialog input { width: 100%; min-height: 42px; padding: 10px 12px; border: 1px solid #dce2e9; border-radius: 6px; background: white; color: var(--agent-ink); font: inherit; font-size: 13px; }
.agent-form input:focus,.sale-dialog input:focus { outline: 2px solid rgba(255,182,0,.38); border-color: #d89b00; }
.agent-primary-button,.agent-secondary-button { min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 0 16px; border: 0; border-radius: 6px; background: var(--agent-ink); color: white; font: inherit; font-size: 12px; font-weight: 800; cursor: pointer; }
.agent-primary-button { background: #169d5a; }
.agent-primary-button:hover { background: #0e8148; }
.agent-primary-button:disabled,.agent-secondary-button:disabled { opacity: .55; cursor: not-allowed; }
.agent-secondary-button { margin-top: 9px; }
.agent-form-message { min-height: 15px; margin: 2px 0; color: #b03b38; font-size: 11px; }
.agent-form-message.is-success { color: #187d4b; }
.agent-small-note { margin-top: 12px; color: #8994a3; font-size: 10px; line-height: 1.5; }
.agent-help-note { display: flex; gap: 10px; margin-top: 20px; padding: 12px; border-radius: 6px; background: #f4f6f9; color: #69778b; font-size: 10px; line-height: 1.5; }
.agent-help-note > span { width: 17px; height: 17px; flex: 0 0 auto; display: grid; place-items: center; border-radius: 50%; background: #e5a800; color: white; font-size: 10px; font-weight: 800; }
.agent-setup-banner { margin: 16px 0; padding: 13px 15px; border: 1px solid #efcf7e; border-radius: 6px; background: #fff8df; color: #735500; font-size: 12px; }
.agent-setup-banner[hidden] { display: none; }
.agent-footer { display: flex; justify-content: space-between; gap: 12px; padding: 22px 4px 30px; color: #8b96a7; font-size: 10px; }
.agent-footer a { color: var(--agent-ink); font-weight: 800; }

.agent-dashboard-page { background: var(--agent-canvas); }
.agent-dashboard-shell { padding-bottom: 28px; }
.agent-name { color: #65738a; font-size: 11px; font-weight: 700; }
.agent-dashboard-welcome { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 24px 27px; border-radius: 10px; background: linear-gradient(110deg,#ffbf00,#ffa519); }
.agent-dashboard-welcome h1 { margin: 0; color: var(--agent-ink); font-size: 27px; font-weight: 800; }
.agent-dashboard-welcome p:not(.agent-eyebrow) { margin-top: 6px; color: #654c14; font-size: 12px; }
.agent-wallet-highlight { min-width: 205px; padding: 15px 17px; border: 1px solid rgba(24,40,64,.12); border-radius: 7px; background: rgba(255,255,255,.65); }
.agent-wallet-highlight span { display: block; color: #7c6126; font-size: 10px; font-weight: 700; }
.agent-wallet-highlight strong { display: block; margin: 5px 0; color: var(--agent-ink); font-size: 23px; font-weight: 800; }
.agent-wallet-highlight .wallet-note { font-size: 9px; font-weight: 500; }
.agent-dashboard-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; margin-top: 14px; }
.agent-dashboard-metrics article { padding: 14px 17px; border: 1px solid var(--agent-line); border-radius: 7px; background: white; }
.agent-dashboard-metrics span { display: block; color: var(--agent-muted); font-size: 10px; font-weight: 700; }
.agent-dashboard-metrics strong { display: block; margin-top: 5px; color: var(--agent-ink); font-size: 19px; font-weight: 800; }
.agent-view-tabs { display: flex; gap: 4px; margin-top: 20px; border-bottom: 1px solid #dce2e9; }
.agent-view-tabs button { padding: 11px 14px; border-radius: 6px 6px 0 0; background: transparent; color: #69778b; font: inherit; font-size: 11px; font-weight: 700; }
.agent-view-tabs button.is-active { background: var(--agent-ink); color: white; }
.agent-view { margin-top: 17px; padding: 22px; border: 1px solid var(--agent-line); border-radius: 8px; background: white; }
.agent-view[hidden] { display: none; }
.agent-content-heading { display: flex; align-items: end; justify-content: space-between; gap: 16px; margin-bottom: 16px; }
.agent-content-heading h2 { margin: 0; color: var(--agent-ink); font-size: 19px; font-weight: 800; }
.agent-content-heading > p,.agent-refresh-note { max-width: 420px; color: var(--agent-muted); font-size: 10px; line-height: 1.5; }
.agent-network-tabs { display: flex; flex-wrap: wrap; gap: 7px; margin-bottom: 14px; }
.agent-network-tabs button { min-height: 34px; padding: 0 13px; border: 1px solid var(--agent-line); border-radius: 5px; background: white; color: #58677c; font: inherit; font-size: 11px; font-weight: 700; }
.agent-network-tabs button.is-active { border-color: var(--agent-ink); background: var(--agent-ink); color: white; }
.agent-product-grid { display: grid; grid-template-columns: repeat(3,minmax(0,1fr)); gap: 10px; }
.agent-product-card { padding: 14px; border: 1px solid #e7ebf0; border-radius: 7px; background: #fbfcfd; }
.agent-product-card h3 { margin: 0; color: var(--agent-ink); font-size: 14px; font-weight: 800; }
.agent-product-meta { margin-top: 4px; color: #7d8999; font-size: 10px; }
.agent-base-price { margin-top: 12px; color: #627087; font-size: 10px; }
.agent-base-price strong { color: var(--agent-ink); }
.agent-price-row { display: grid; grid-template-columns: 1fr auto; gap: 7px; margin-top: 7px; }
.agent-price-row input { min-width: 0; height: 36px; padding: 7px 8px; border: 1px solid #dbe1e8; border-radius: 5px; font: inherit; font-size: 12px; }
.agent-price-save { padding: 0 10px; border: 1px solid #dbe1e8; border-radius: 5px; background: white; color: #354760; font: inherit; font-size: 10px; font-weight: 700; cursor: pointer; }
.agent-margin-preview { min-height: 14px; margin-top: 6px; color: #19834e; font-size: 10px; }
.agent-sell-button { width: 100%; min-height: 36px; margin-top: 9px; border-radius: 5px; background: #169d5a; color: white; font: inherit; font-size: 11px; font-weight: 800; }
.agent-sell-button:disabled { background: #b7c0ca; cursor: not-allowed; }
.agent-loading,.agent-empty { padding: 18px 8px; color: var(--agent-muted); font-size: 12px; }
.agent-table-wrap { overflow-x: auto; }
.agent-table { width: 100%; border-collapse: collapse; text-align: left; }
.agent-table th,.agent-table td { padding: 12px 9px; border-bottom: 1px solid #edf0f3; color: #526176; font-size: 10px; white-space: nowrap; }
.agent-table th { color: #8792a1; font-size: 9px; text-transform: uppercase; }
.agent-table td strong { color: var(--agent-ink); font-size: 11px; }
.agent-order-status { padding: 5px 8px; border-radius: 20px; background: #fff3d5; color: #8c6200; font-size: 9px; font-weight: 800; }
.agent-order-status--delivered { background: #e7f7ee; color: #16804a; }
.agent-order-status--failed { background: #ffeded; color: #b72f36; }
.agent-ledger-list { display: grid; gap: 1px; }
.agent-ledger-row { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 3px; border-bottom: 1px solid #edf0f3; }
.agent-ledger-row strong { color: var(--agent-ink); font-size: 12px; }
.agent-ledger-row span { display: block; margin-top: 4px; color: #8b95a3; font-size: 10px; }
.agent-ledger-amount { color: #16804a !important; font-size: 13px !important; font-weight: 800; white-space: nowrap; }
.agent-dashboard-message { min-height: 17px; margin-top: 12px; color: #aa3737; font-size: 11px; }
.sale-dialog { width: min(430px,calc(100vw - 24px)); max-width: none; max-height: min(90vh,760px); margin: auto; padding: 0; overflow: auto; border: 0; border-radius: 10px; background: transparent; color: var(--agent-ink); }
.sale-dialog::backdrop { background: rgba(15,25,40,.48); backdrop-filter: blur(2px); }
.sale-dialog__card { position: relative; display: grid; gap: 8px; padding: 24px; border-radius: 10px; background: white; }
.sale-dialog__card h2 { margin: 0 0 5px; font-size: 20px; }
.sale-dialog__close { position: absolute; top: 12px; right: 12px; width: 34px; height: 34px; padding: 0; border-radius: 5px; background: #f1f3f6; color: #394a60; font-size: 18px; }
.sale-price-summary { display: grid; grid-template-columns: 1fr auto; gap: 6px; margin: 4px 0; padding: 12px; border-radius: 6px; background: #f5f7fa; color: #738095; font-size: 10px; }
.sale-price-summary strong { color: var(--agent-ink); font-size: 11px; text-align: right; }
.sale-error { min-height: 15px; color: #b03b38; font-size: 10px; }
.agent-result-card { width: min(480px,calc(100% - 32px)); margin: 10vh auto; padding: 28px; border: 1px solid var(--agent-line); border-radius: 10px; background: white; box-shadow: 0 12px 35px rgba(24,40,64,.08); }
.agent-result-brand { display: inline-block; margin-bottom: 28px; color: #192b43 !important; font-size: 16px; font-weight: 800; }
.agent-result-card h1 { margin: 0; font-size: 24px; line-height: 1.2; }
.agent-result-card p:not(.agent-eyebrow) { margin: 10px 0 20px; color: #718095; font-size: 12px; line-height: 1.6; }
.agent-result-link { width: 100%; text-align: center; }
.agent-result-link[hidden] { display: none; }

@media (max-width: 760px) {
  .agent-join-hero { grid-template-columns: 1fr; padding: 25px; }
  .agent-join-hero h1 { font-size: 32px; }
  .join-fee-panel { max-width: none; }
  .agent-auth-grid { grid-template-columns: 1fr; }
  .agent-product-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .agent-dashboard-welcome { align-items: stretch; flex-direction: column; }
  .agent-wallet-highlight { min-width: 0; }
}

@media (max-width: 560px) {
  .agent-page .dashboard-header__inner { width: calc(100% - 24px); gap: 8px; }
  .agent-page .dashboard-nav { display: none; }
  .agent-header-login,.agent-signout { padding: 8px 9px; font-size: 10px; }
  .agent-join-shell,.agent-dashboard-shell { width: calc(100% - 24px); margin-top: 14px; }
  .agent-join-hero { gap: 18px; padding: 21px 17px; }
  .agent-join-hero h1 { font-size: 27px; }
  .agent-benefits { gap: 6px; }
  .agent-benefits span { font-size: 9px; }
  .agent-form-panel { padding: 19px 16px; }
  .agent-product-grid { grid-template-columns: 1fr; }
  .agent-view { padding: 16px 12px; }
  .agent-content-heading { align-items: start; flex-direction: column; gap: 6px; }
  .agent-dashboard-metrics { grid-template-columns: 1fr; gap: 7px; }
  .agent-dashboard-metrics article { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
  .agent-dashboard-metrics strong { margin: 0; }
  .agent-view-tabs button { flex: 1; padding: 10px 5px; font-size: 10px; }
  .agent-footer { flex-direction: column; }
  .agent-result-card { padding: 22px 18px; }
}

@media (max-width: 560px) {
  .agent-dashboard-page .dashboard-header__inner { width: calc(100% - 24px); min-width: 0; gap: 8px; }
  .agent-dashboard-page .dashboard-brand { min-width: 0; font-size: 14px; white-space: nowrap; }
  .agent-dashboard-page .header-actions { min-width: 0; gap: 6px; }
  .agent-dashboard-page .agent-name { max-width: 66px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .agent-dashboard-page .agent-signout { flex: 0 0 auto; }
}