:root {
  --billing-navy: #06275c;
  --billing-navy-strong: #041d45;
  --billing-blue: #1463ad;
  --billing-blue-dark: #0d4d8a;
  --billing-page: #ffffff;
  --billing-surface: #ffffff;
  --billing-border: #dddddd;
  --billing-text: #243247;
  --billing-muted: #6c7888;
  --billing-success: #197448;
  --billing-warning: #9a5d00;
  --billing-danger: #aa2c31;
  --billing-radius: 0px;
  --billing-shadow: none;
}

* { box-sizing: border-box; }

body.billing-admin {
  min-width: 320px;
  margin: 0;
  color: var(--billing-text);
  background: var(--billing-page);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 14px;
  line-height: 1.45;
}

.billing-topbar {
  color: #fff;
  background: var(--billing-navy);
  border-bottom: 1px solid rgb(255 255 255 / 18%);
}

.billing-topbar__inner,
.billing-page {
  width: calc(100% - 32px);
  margin: 0 auto;
}

.billing-topbar__inner {
  display: flex;
  min-height: 54px;
  align-items: center;
  gap: 18px;
}

.billing-brand {
  flex: 0 0 auto;
  color: #fff;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.03em;
  text-decoration: none;
}

.billing-nav { display: flex; flex: 1; align-self: stretch; align-items: stretch; gap: 4px; }
.billing-nav a,
.billing-merchant a { display: inline-flex; align-items: center; color: rgb(255 255 255 / 83%); padding: 0 10px; text-decoration: none; }
.billing-nav a:hover, .billing-nav a:focus-visible, .billing-nav a[aria-current="page"] { color: #fff; background: rgb(255 255 255 / 12%); }
.billing-merchant { display: flex; align-items: center; gap: 8px; color: rgb(255 255 255 / 75%); font-size: 13px; }

.billing-page { padding: 24px 0 48px; }
.billing-page__heading { display: flex; align-items: start; justify-content: space-between; gap: 24px; margin-bottom: 20px; }
.billing-page h1 { margin: 0; font-size: 26px; font-weight: 500; line-height: 1.2; }
.billing-page h2 { margin: 0; font-size: 18px; font-weight: 500; }
.billing-page__description { margin: 5px 0 0; color: var(--billing-muted); }

.billing-card { padding: 18px; background: var(--billing-surface); border: 1px solid var(--billing-border); border-radius: var(--billing-radius); box-shadow: var(--billing-shadow); }
.billing-card + .billing-card { margin-top: 18px; }
.billing-product-form-guard { margin: 0; padding: 0; border: 0; min-width: 0; }
.billing-card__header { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 14px; }

.billing-filter-bar, .billing-actions, .billing-field-row { display: flex; flex-wrap: wrap; align-items: end; gap: 12px; }
.billing-filter-bar { padding: 14px 16px; margin-bottom: 18px; background: #edf1f5; border: 1px solid var(--billing-border); }
.billing-field { display: grid; gap: 4px; min-width: 150px; }
.billing-field label { color: #4e5c6e; font-size: 12px; font-weight: 700; }
.billing-field input, .billing-field select, .billing-field textarea { width: 100%; padding: 7px 8px; color: var(--billing-text); background: #fff; border: 1px solid #b9c4d0; border-radius: 3px; font: inherit; }
.billing-field textarea { min-height: 84px; resize: vertical; }
.billing-field input:focus, .billing-field select:focus, .billing-field textarea:focus, .billing-button:focus-visible, .billing-link:focus-visible { outline: 3px solid rgb(20 99 173 / 35%); outline-offset: 1px; }

.billing-button { display: inline-flex; min-height: 33px; align-items: center; justify-content: center; padding: 6px 11px; color: #fff; background: var(--billing-blue); border: 1px solid var(--billing-blue-dark); border-radius: 3px; cursor: pointer; font: inherit; font-weight: 700; text-decoration: none; }
.billing-button:hover { background: var(--billing-blue-dark); }
.billing-button--secondary { color: var(--billing-blue-dark); background: #fff; border-color: #aebdcc; }
.billing-button--secondary:hover { background: #edf3f8; }
.billing-button--danger { background: var(--billing-danger); border-color: #842126; }
.billing-button[disabled] { cursor: not-allowed; opacity: .55; }
.billing-link { color: var(--billing-blue); text-decoration: none; }
.billing-link:hover { color: var(--billing-blue-dark); text-decoration: underline; }
.billing-product-actions { display: flex; align-items: center; justify-content: flex-end; gap: 3px; white-space: nowrap; }
.billing-product-actions form { display: inline-flex; margin: 0; }
.billing-icon-action { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; padding: 5px; border: 0; border-radius: 2px; background: transparent; color: #555; cursor: pointer; text-decoration: none; flex: 0 0 auto; }
.billing-icon-action:hover { background: #edf0f2; color: var(--billing-blue); }
.billing-icon-action:focus-visible { outline: 2px solid var(--billing-blue); outline-offset: 2px; }
.billing-action-icon { display: block; width: 18px; height: 18px; }

.billing-metrics { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 18px; }
.billing-metric { min-height: 112px; padding: 16px; background: var(--billing-surface); border: 1px solid var(--billing-border); border-top: 3px solid var(--billing-blue); box-shadow: var(--billing-shadow); }
.billing-metric__label { color: var(--billing-muted); font-size: 12px; font-weight: 700; text-transform: uppercase; }
.billing-metric__value { margin-top: 10px; font-size: 26px; font-weight: 500; }
.billing-grid { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: 18px; }
.billing-chart { min-height: 250px; display: grid; align-items: end; gap: 8px; grid-template-columns: repeat(12, minmax(10px, 1fr)); padding: 28px 16px 16px; border-left: 1px solid var(--billing-border); border-bottom: 1px solid var(--billing-border); background: linear-gradient(to top, transparent 24%, #e9eef3 25%, transparent 26%, transparent 49%, #e9eef3 50%, transparent 51%, transparent 74%, #e9eef3 75%, transparent 76%); }
.billing-chart__bar { min-height: 3px; background: linear-gradient(180deg, #4388c5, var(--billing-blue)); }

.billing-tabs { display: flex; flex-wrap: wrap; gap: 2px; margin-bottom: 16px; border-bottom: 1px solid var(--billing-border); }
.billing-tabs a { display: inline-flex; padding: 9px 13px; color: #556273; border: 1px solid transparent; border-bottom: 0; text-decoration: none; }
.billing-tabs a:hover, .billing-tabs a:focus-visible { color: var(--billing-blue); }
.billing-tabs a[aria-current="page"] { position: relative; bottom: -1px; color: var(--billing-blue-dark); background: #fff; border-color: var(--billing-border); font-weight: 700; }

.billing-table-wrap { overflow-x: auto; border: 1px solid var(--billing-border); }
.billing-price-items { min-width: 0; }
.billing-contract-change .billing-grid > article { min-width: 0; }
.billing-contract-change article > pre { max-width: 100%; overflow-x: auto; }
.billing-table { width: 100%; border-collapse: collapse; background: #fff; white-space: nowrap; }
.billing-table th, .billing-table td { padding: 10px 12px; text-align: left; border-bottom: 1px solid #e1e6ec; vertical-align: top; }
.billing-table th { color: #4d5a6b; background: #f5f7fa; font-size: 12px; font-weight: 700; }
.billing-table tr:last-child td { border-bottom: 0; }
.billing-table td:last-child { text-align: right; }
.billing-status { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 700; }
.billing-status::before { width: 7px; height: 7px; border-radius: 50%; background: currentColor; content: ""; }
.billing-status--success { color: var(--billing-success); }
.billing-status--warning { color: var(--billing-warning); }
.billing-status--danger { color: var(--billing-danger); }
.billing-status--muted { color: var(--billing-muted); }
.billing-empty { padding: 32px 20px; color: var(--billing-muted); text-align: center; border: 1px dashed #bac5d0; background: #fbfcfd; }
.billing-flash { padding: 10px 14px; margin-bottom: 18px; border: 1px solid; border-radius: 3px; }
.billing-flash--notice { color: #145d3b; background: #e8f6ef; border-color: #add8c0; }
.billing-flash--alert { color: #862328; background: #fcebed; border-color: #e9b7ba; }
.billing-error-summary { padding: 14px; margin-bottom: 16px; color: #862328; background: #fcebed; border: 1px solid #e9b7ba; }
.billing-definition-list { display: grid; grid-template-columns: minmax(140px, 220px) minmax(0, 1fr); margin: 0; border-top: 1px solid var(--billing-border); }
.billing-definition-list dd { min-width: 0; overflow-wrap: anywhere; }
.billing-card > pre { max-width: 100%; overflow-x: auto; }
.billing-definition-list dt, .billing-definition-list dd { padding: 10px 12px; margin: 0; border-bottom: 1px solid var(--billing-border); }
.billing-definition-list dt { color: #566477; background: #f7f9fb; font-weight: 700; }

@media (max-width: 850px) {
  .billing-topbar__inner { align-items: stretch; flex-wrap: wrap; gap: 0; }
  .billing-brand { display: flex; min-height: 52px; align-items: center; margin-right: 12px; }
  .billing-nav { order: 3; width: 100%; overflow-x: auto; border-top: 1px solid rgb(255 255 255 / 12%); }
  .billing-nav a { min-height: 42px; }
  .billing-merchant { margin-left: auto; }
  .billing-metrics, .billing-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .billing-topbar__inner, .billing-page { width: min(100% - 24px, 1440px); }
  .billing-page { padding-top: 20px; }
  .billing-page__heading { display: block; }
  .billing-page__heading .billing-actions { margin-top: 14px; }
  .billing-metrics { gap: 10px; }
  .billing-field { width: 100%; }
  .billing-filter-bar .billing-button { width: 100%; }
  .billing-definition-list { grid-template-columns: 1fr; }
  .billing-definition-list dt { padding-bottom: 3px; border-bottom: 0; }
  .billing-definition-list dd { padding-top: 3px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

/* Compact navigation and dashboard geometry observed in Transform. */
.billing-nav { gap: 0; }
.billing-nav a { position: relative; font-size: 16px; padding: 0 18px; }
.billing-nav a[aria-current="page"] { color: #d7f300; background: transparent; font-weight: 700; }
.billing-nav a[aria-current="page"]::after { content: ""; height: 3px; position: absolute; left: 0; right: 0; bottom: 0; background: #d7f300; }
.billing-brand { display: inline-flex; align-items: center; letter-spacing: -.6px; }
.billing-user-tools { display: flex; gap: 18px; align-items: center; }
.billing-icon-link, .billing-user-menu > summary { display: inline-flex; align-items: center; color: #fff; cursor: pointer; list-style: none; }
.billing-user-menu > summary::-webkit-details-marker { display: none; }
.billing-user-menu { position: relative; }
.billing-user-menu__panel { position: absolute; z-index: 10; right: 0; top: 32px; width: 280px; padding: 16px; background: #fff; color: var(--billing-text); border: 1px solid #ddd; box-shadow: 0 4px 10px #0002; }
.billing-user-menu__panel a { display: block; color: #38658a; padding: 8px 0; }
.billing-user-menu__panel strong { display: block; overflow-wrap: anywhere; }
.billing-user-menu__panel form { margin-top: 8px; }
.billing-user-menu__panel button { color: #38658a; }
.billing-settings-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 24px; }
.billing-settings-grid fieldset { min-width: 0; border: 0; margin: 0; padding: 0; }
.billing-settings-grid fieldset.billing-card { border: 1px solid #ddd; padding: 14px; margin: 12px 0; }
.billing-settings-grid .billing-field-row { align-items: start; }
.billing-settings-grid .billing-field-row > fieldset { flex: 1 1 260px; }
.billing-dashboard-controls { display: flex; align-items: end; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.billing-dashboard-controls .billing-field { min-width: 105px; }
.billing-date-shortcuts { display: flex; }
.billing-date-shortcuts a { padding: 6px 10px; border: 1px solid #ccc; background: linear-gradient(#fff,#eee); color: #444; text-decoration: none; margin-left: -1px; font-size: 12px; }
.billing-dashboard-main { display: grid; grid-template-columns: 200px minmax(0, 1fr); gap: 0; }
.billing-dashboard-metrics { display: flex; flex-direction: column; gap: 0; }
.billing-dashboard-metric { background: #f8f8f8; border-bottom: 1px solid #fff; border-left: 4px solid transparent; padding: 10px 12px; min-height: 65px; }
.billing-dashboard-metric.is-selected { border-left-color: #38658a; }
.billing-dashboard-metric__label { color: #38658a; font-size: 13px; font-weight: 700; display: flex; justify-content: space-between; }
.billing-dashboard-metric__value { color: #111; text-align: right; font-size: 16px; font-weight: 700; padding-top: 4px; }
.billing-dashboard-metric__pair { display: flex; justify-content: space-between; color: #777; margin-top: 3px; }
.billing-dashboard-metric__pair strong { color: #111; }
.billing-area-chart { min-height: 380px; border: 1px solid #ddd; padding: 14px 16px 6px; }
.billing-area-chart svg { display: block; width: 100%; height: auto; min-height: 310px; }
.billing-area-chart h2 { font-size: 13px; text-align: right; margin-bottom: 8px; }
.billing-chart-grid { stroke: #e5e5e5; stroke-width: 1; }
.billing-chart-axis { fill: #333; font-size: 11px; font-family: Arial, sans-serif; }
.billing-dashboard-bottom { margin-top: 55px; display: grid; grid-template-columns: 1.2fr 1fr; gap: 10%; }
.billing-dashboard-bottom h2 { font-weight: 700; font-size: 16px; }
.billing-dashboard-bottom article { margin-bottom: 20px; }
.billing-dashboard-notice { margin-top: 16px; background: #eff9fd; border: 1px solid #ddd; color: #777; padding: 12px 14px; }
.billing-import-section { margin: 14px 0; }
.billing-import-section summary { cursor: pointer; padding: 9px 0; color: #38658a; }
@media (max-width: 1000px) { .billing-nav a { padding: 0 10px; font-size: 14px; } }
@media (max-width: 700px) { .billing-settings-grid { grid-template-columns: 1fr; } .billing-dashboard-main { grid-template-columns: 1fr; } .billing-dashboard-metrics { display: grid; grid-template-columns: repeat(2,minmax(0,1fr)); } .billing-dashboard-bottom { grid-template-columns: 1fr; gap: 15px; margin-top: 24px; } .billing-user-tools { margin-left: auto; } }
body.billing-admin [hidden] { display: none !important; }
@media (max-width: 850px) {
  .billing-nav { flex: 0 0 100%; min-height: 44px; }
  .billing-user-tools { margin-left: auto; min-height: 54px; }
  .billing-area-chart { overflow-x: auto; }
  .billing-area-chart svg { min-width: 700px; min-height: 0; }
}
@media (max-width: 560px) {
  .billing-field input, .billing-field select, .billing-field textarea { font-size: 16px; min-height: 40px; }
  .billing-button { min-height: 42px; }
}
.billing-chart-data { margin-top: 12px; }
.billing-chart-data summary { cursor: pointer; color: #38658a; }

.billing-dashboard-bottom > *, .billing-dashboard-bottom article { min-width: 0; }
.billing-dashboard-emails td:first-child { white-space: normal; overflow-wrap: anywhere; }
.billing-chart-scroll-hint { display: none; }
@media (max-width: 850px) { .billing-chart-scroll-hint { display: block; color: #38658a; font-size: 12px; margin: 8px 0; } }

/* Log navigation is independent of product and price-list tabs. */
.billing-log-nav__title { flex-basis: 100%; padding: 0 13px 6px; font-size: 12px; font-weight: 700; }
@media (min-width: 1000px) {
  .billing-page:has(> .billing-log-nav) { position: relative; padding-left: 195px; min-height: 540px; }
  .billing-page > .billing-log-nav { position: absolute; top: 24px; left: 0; width: 180px; display: flex; flex-direction: column; gap: 3px; border: 0; }
  .billing-log-nav__title { flex-basis: auto; padding: 0 12px 8px; }
  .billing-log-nav a { display: block; padding: 8px 12px; border: 0; border-left: 3px solid transparent; font-size: 13px; }
  .billing-log-nav a[aria-current="page"] { bottom: auto; background: #f1f0f5; border-color: #3986ce; font-weight: 400; }
  .billing-page:has(> .billing-log-nav) > * { min-width: 0; }
}
.billing-page:has(> .billing-log-nav) > .billing-filter-bar { padding: 0; background: transparent; border: 0; margin-bottom: 24px; }
.billing-page:has(> .billing-log-nav) > .billing-card:has(> .billing-table-wrap) { padding: 0; border: 0; }
.billing-page:has(> .billing-log-nav) .billing-table-wrap { border: 0; }
.billing-page:has(> .billing-log-nav) .billing-table th { color: #222; background: #fff; }
.billing-page:has(> .billing-log-nav) .billing-table tbody tr:nth-child(odd) { background: #f8f8f8; }
.billing-page:has(> .billing-log-nav) .billing-filter-bar label:has(input[type="checkbox"]) { display: inline-flex; align-items: center; gap: 8px; min-height: 40px; }
.billing-page:has(> .billing-log-nav) .billing-filter-bar input[type="checkbox"] { width: 18px; height: 18px; min-height: 18px; flex: 0 0 18px; margin: 0; padding: 0; }

/* Document navigation follows the source desktop sidebar while preserving mobile tabs. */
.billing-document-nav__title { flex-basis: 100%; padding: 0 13px 6px; font-size: 12px; font-weight: 700; }
@media (min-width: 1000px) {
  .billing-page:has(> .billing-document-nav) { display: flow-root; min-height: 540px; }
  .billing-page > .billing-document-nav { float: left; width: 180px; margin-right: 15px; display: flex; flex-direction: column; gap: 3px; border: 0; }
  .billing-document-nav__title { flex-basis: auto; padding: 0 12px 8px; }
  .billing-document-nav a { display: block; padding: 8px 12px; border: 0; border-left: 3px solid transparent; font-size: 13px; line-height: 1.35; white-space: normal; overflow-wrap: anywhere; }
  .billing-document-nav a[aria-current="page"] { bottom: auto; background: #f1f0f5; border-color: #3986ce; font-weight: 400; }
  .billing-page > .billing-document-nav ~ * { margin-left: 195px; min-width: 0; }
  .billing-page:has(> .billing-document-nav) > .billing-filter-bar .billing-field { flex: 1 1 320px; width: auto; min-width: 0; }
  .billing-page:has(> .billing-document-nav) > .billing-filter-bar .billing-button { flex: 0 0 auto; }
}
.billing-page:has(> .billing-document-nav) > .billing-filter-bar { padding: 0; background: transparent; border: 0; margin-bottom: 24px; }
.billing-page:has(> .billing-document-nav) > .billing-card:has(> .billing-table-wrap) { padding: 0; border: 0; }
.billing-page:has(> .billing-document-nav) .billing-table-wrap { border: 0; }
.billing-page:has(> .billing-document-nav) .billing-table th { color: #222; background: #fff; }
.billing-page:has(> .billing-document-nav) .billing-table tbody tr:nth-child(odd) { background: #f8f8f8; }

/* Email details use the source's compact standalone form layout. */
.billing-email-detail { max-width: 1170px; margin: 0 auto; }
.billing-email-detail h1, .billing-email-detail h2 { font-size: 18px; font-weight: 700; margin: 0 0 12px; }
.billing-email-detail .billing-page__heading { margin-bottom: 12px; }
.billing-email-detail .billing-page__heading h1 { margin-bottom: 0; }
.billing-email-detail .billing-card { padding: 0; border: 0; box-shadow: none; }
.billing-email-detail__fields { grid-template-columns: 180px minmax(0, 1fr); border: 0; margin-bottom: 16px; }
.billing-email-detail__fields dt, .billing-email-detail__fields dd { padding: 1px 0; border: 0; background: transparent; line-height: 1.35; color: inherit; }
.billing-email-detail__fields dt { text-align: right; padding-right: 20px; }
.billing-email-detail .billing-table-wrap { border: 0; }
.billing-email-detail .billing-table th { background: white; color: #222; }
.billing-email-detail .billing-table tbody tr:nth-child(odd) { background: #f8f8f8; }
.billing-email-detail details { margin: 16px 0; }
.billing-email-detail__actions { margin-top: 20px; padding: 18px 0 18px 180px; border-top: 1px solid #e5e5e5; background: #fcfcfc; }
.billing-attachments { align-items: start; }
.billing-attachments > section.billing-card { padding: 0 12px; border: 0; box-shadow: none; min-width: 0; }
.billing-attachments h2 { font-size: 22px; font-weight: 700; margin-bottom: 18px; }
.billing-attachments .billing-table-wrap { border: 0; }
.billing-attachments .billing-table th { color: #222; background: #fff; }
.billing-attachments .billing-table tbody tr:nth-child(odd) { background: #f8f8f8; }
.billing-attachments .billing-table td { overflow-wrap: anywhere; }
.billing-attachment-form { margin-top: 16px; }
.billing-attachment-form .billing-field { max-width: 680px; }
.billing-attachment-form .billing-field:first-of-type { display: grid; grid-template-columns: 145px minmax(0, 260px); gap: 8px 18px; align-items: center; }
.billing-attachment-form .billing-field:first-of-type label { text-align: right; margin: 0; }
.billing-attachment-form .billing-field:first-of-type small { grid-column: 2; }
.billing-attachment-form .billing-dashboard-notice { color: #425866; background: #eff8fc; border: 1px solid #d6e5eb; padding: 10px 14px; }
.billing-attachment-file { margin: 16px 0; }
.billing-attachment-form > .billing-actions { margin-top: 20px; }
.billing-attachment-delete { min-width: 0; }
.billing-attachment-delete summary { cursor: pointer; color: #38658a; }
.billing-attachment-delete form { margin-top: 8px; max-width: 280px; }
.billing-attachment-delete label { display: flex; align-items: start; gap: 8px; overflow-wrap: anywhere; margin-bottom: 8px; }
.billing-attachment-delete input[type="checkbox"] { width: 16px; height: 16px; flex: 0 0 16px; margin-top: 2px; }
.billing-simulation { max-width: 1200px; margin: 0 auto; }
.billing-simulation h2 { margin-bottom: 12px; }
.billing-simulation__notice { border-left: 4px solid #287c94; background: #f1f9fb; }
.billing-simulation__notice p:last-child { margin-bottom: 0; }
.billing-simulation__summary { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(0, 2fr); gap: 10px 20px; }
.billing-simulation__summary dt { font-weight: 600; }
.billing-simulation__summary dd { margin: 0; overflow-wrap: anywhere; }
.billing-simulation__email { padding: 18px 0; border-top: 1px solid var(--billing-border); }
.billing-simulation__email h3 { margin: 0 0 10px; }
.billing-simulation__email dl { display: grid; grid-template-columns: 70px minmax(0, 1fr); gap: 6px 12px; }
.billing-simulation__email dd { margin: 0; overflow-wrap: anywhere; }
.billing-simulation__mail-body { white-space: pre-wrap; overflow-wrap: anywhere; padding: 14px; background: #f5f7fa; border: 1px solid var(--billing-border); font: inherit; }
@media (max-width: 560px) {
  .billing-simulation__summary { grid-template-columns: minmax(0, 1fr); gap: 5px; }
  .billing-simulation__summary dd { margin-bottom: 10px; }
  .billing-attachments > section.billing-card { padding: 0; }
  .billing-attachment-form .billing-field:first-of-type { display: block; }
  .billing-attachment-form .billing-field:first-of-type label { text-align: left; margin-bottom: 6px; }
  .billing-email-detail__fields { grid-template-columns: 1fr; }
  .billing-email-detail__fields dt { text-align: left; padding: 8px 0 2px; }
  .billing-email-detail__fields dd { padding-bottom: 4px; }
  .billing-email-detail__actions { padding-left: 0; }
}
