/* ASW account, company and subscription views. */
.platform-page,
.platform-form,
.company-picker {
  --platform-primary: var(--asw-primary, #2866bd);
  --platform-ink: var(--asw-ink, #14283f);
  --platform-muted: var(--asw-muted, #5c6b80);
  --platform-border: var(--asw-border, #e0e7ef);
  font-size: 14px;
  line-height: 1.6;
  color: var(--platform-ink);
}
.platform-page { min-width: 0; }
.platform-heading .eyebrow { margin-bottom: 7px; }
.platform-heading .subtitle { max-width: 720px; }
.platform-page .btn { min-height: 44px; gap: 8px; }
.platform-page .btn > span,
.platform-form .btn > span { display: inline-flex; align-items: center; }
.company-picker { min-width: 0; width: 100%; }
.company-picker label { display: block; margin: 0 0 6px; color: var(--platform-muted); font-size: 12px; font-weight: 600; }
.company-picker select { width: 100%; min-width: 0; min-height: 44px; padding: 10px 29px 10px 11px; border: 1px solid #cad9ec; border-radius: 8px; background: #f5f9ff; color: #315880; font-size: 13px; text-overflow: ellipsis; }
.company-picker small { display: block; margin-top: 5px; color: var(--platform-muted); font-size: 11px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.topbar .company-picker { width: clamp(190px, 20vw, 290px); }
.topbar .company-picker label { font-size: 11px; }
.topbar .company-picker select { min-height: 40px; padding-block: 8px; }
.topbar .company-picker small { display: none; }
.sidebar .company-picker { margin-top: 12px; }

.platform-summary { display: grid; grid-template-columns: 1fr 1fr 1.6fr; gap: 20px; margin-bottom: 24px; padding: 21px 24px; border: 1px solid var(--platform-border); border-radius: 12px; background: #fff; }
.platform-summary > div { min-width: 0; }
.platform-summary > div + div { border-left: 1px solid var(--platform-border); padding-left: 22px; }
.platform-summary span { display: block; color: var(--platform-muted); font-size: 12px; }
.platform-summary strong { display: block; margin-top: 5px; color: #294a73; font-size: 25px; font-weight: 650; line-height: 1.35; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.platform-summary .platform-summary-context strong { margin-top: 8px; font-size: 16px; line-height: 1.5; }
.company-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 290px), 1fr)); align-items: stretch; gap: 20px; }
.company-card { display: flex; flex-direction: column; min-width: 0; padding: 22px; border: 1px solid var(--platform-border); border-radius: 13px; background: #fff; box-shadow: 0 3px 14px #18375504; }
.company-card.is-selected { border-color: #9bbce5; box-shadow: 0 0 0 1px #dce9fa; }
.company-card-top { display: flex; justify-content: space-between; align-items: center; gap: 14px; margin-bottom: 17px; }
.company-card-icon { display: grid; place-items: center; width: 40px; height: 40px; border-radius: 10px; color: #4879b6; background: #edf4fd; }
.company-card-icon > span { display: inline-flex; }
.company-card-icon svg { width: 20px; height: 20px; }
.company-card h2 { margin: 0 0 5px; color: #233f62; font-size: 17px; font-weight: 650; line-height: 1.5; overflow-wrap: anywhere; }
.company-document { margin: 0 0 19px; color: var(--platform-muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.company-card-facts { display: grid; gap: 12px; margin: 0 0 21px; }
.company-card-facts > div { display: flex; justify-content: space-between; align-items: baseline; gap: 15px; }
.company-card-facts dt { flex: 0 1 45%; color: var(--platform-muted); font-size: 12px; }
.company-card-facts dd { flex: 1 1 55%; margin: 0; color: #405c7b; font-size: 13px; font-weight: 500; text-align: right; overflow-wrap: anywhere; }
.company-card-actions { margin-top: auto; padding-top: 17px; border-top: 1px solid #e8eef5; }
.company-card-actions .btn { width: 100%; }
.company-card-actions .btn:disabled { color: #486a90; background: #f2f7fd; opacity: 1; cursor: default; }
.platform-badge { display: inline-flex; align-items: center; flex-shrink: 0; gap: 6px; padding: 5px 9px; border: 1px solid #dce4ee; border-radius: 6px; color: #60738d; background: #f3f6fa; font-size: 11px; font-weight: 600; line-height: 1.5; white-space: nowrap; }
.platform-badge::before { content: ''; width: 5px; height: 5px; border-radius: 50%; background: currentColor; }
.platform-badge.success { border-color: #cfe4d8; color: #276849; background: #eff8f2; }
.platform-badge.info { border-color: #cbdcf3; color: #315e9a; background: #eef5ff; }
.platform-badge.warning { border-color: #e9ddba; color: #7e5d17; background: #fff9e9; }
.platform-badge.danger { border-color: #edcec7; color: #96483b; background: #fff2ee; }
.platform-empty { display: flex; flex-direction: column; align-items: center; justify-content: center; min-height: 225px; padding: 43px 24px; border: 1px solid var(--platform-border); border-radius: 12px; background: #fff; text-align: center; }
.platform-empty > span { display: inline-flex; margin-bottom: 14px; color: #7799c2; }
.platform-empty > span svg { width: 30px; height: 30px; }
.platform-empty h2 { margin: 0 0 9px; color: #3c587b; font-size: 17px; font-weight: 600; }
.platform-empty p { max-width: 430px; margin: 0; color: var(--platform-muted); font-size: 14px; }
.platform-empty .actions { margin-top: 20px; }
.platform-panel { min-width: 0; border: 1px solid var(--platform-border); border-radius: 12px; background: #fff; overflow: hidden; }
.platform-panel > .platform-empty { border: 0; }
.platform-panel-heading { display: flex; justify-content: space-between; align-items: flex-start; gap: 15px; padding: 22px 23px 18px; }
.platform-panel-heading h2 { margin: 0 0 5px; color: #2b486b; font-size: 16px; font-weight: 650; }
.platform-panel-heading p { margin: 0; color: var(--platform-muted); font-size: 12px; }

.platform-notice { display: flex; align-items: flex-start; gap: 12px; margin: 0 0 21px; padding: 16px 19px; border: 1px solid #e6dabd; border-radius: 10px; background: #fffbf2; color: #795e21; }
.platform-notice > span { display: inline-flex; flex: 0 0 auto; margin-top: 2px; }
.platform-notice strong { display: block; color: inherit; font-size: 14px; font-weight: 650; }
.platform-notice p { margin: 3px 0 0; color: inherit; font-size: 13px; line-height: 1.65; }
.platform-notice.info { color: #3f6491; border-color: #d0dff3; background: #f3f8ff; }
.platform-notice.success { color: #376b52; border-color: #d1e4d9; background: #f3faf5; }
.billing-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; align-items: start; gap: 22px; }
.billing-layout > * { min-width: 0; }
.billing-company-context { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 14px; margin: 0 0 20px; }
.billing-company-context > div { min-width: 0; }
.billing-company-context span:not(.platform-badge) { display: block; color: var(--platform-muted); font-size: 12px; }
.billing-company-context strong { display: block; margin-top: 4px; color: #294b76; font-size: 18px; font-weight: 650; overflow-wrap: anywhere; }
.billing-company-context small { display: block; margin-top: 3px; color: var(--platform-muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.billing-selection-note { margin: 0 0 18px; padding: 12px 14px; border-left: 3px solid #5c8bc7; background: #f1f7ff; color: #4a698e; font-size: 13px; line-height: 1.7; }
.plan-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 13px; }
.plan-grid > .platform-empty { grid-column: 1 / -1; }
.plan-card { display: flex; flex-direction: column; min-width: 0; padding: 20px 17px; border: 1px solid var(--platform-border); border-radius: 11px; background: #fff; }
.plan-card.is-selected { border-color: #97b9e4; box-shadow: 0 0 0 1px #e2edfc; }
.plan-card-top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-height: 30px; }
.plan-card-top h3 { margin: 0; color: #3a5577; font-size: 15px; font-weight: 650; }
.plan-card .platform-badge { padding: 3px 6px; font-size: 10px; }
.plan-price { margin: 19px 0 20px; }
.plan-price strong { display: block; color: #214b81; font-size: clamp(22px, 1.8vw, 27px); font-weight: 650; letter-spacing: -.7px; line-height: 1.3; font-variant-numeric: tabular-nums; white-space: nowrap; }
.plan-price > span { display: block; margin-top: 4px; color: var(--platform-muted); font-size: 12px; }
.plan-features { display: grid; gap: 12px; list-style: none; margin: 0 0 22px; padding: 0; color: #546b87; font-size: 12px; line-height: 1.6; }
.plan-features li { display: flex; align-items: flex-start; gap: 8px; }
.plan-features li > span:first-child { display: inline-flex; flex-shrink: 0; margin-top: 2px; color: #7595bd; }
.plan-features svg { width: 15px; height: 15px; }
.plan-features strong { color: #3b587b; font-weight: 600; }
.plan-card > .btn { margin-top: auto; padding-inline: 10px; font-size: 12px; white-space: normal; }
.platform-help { color: var(--platform-muted); font-size: 12px; line-height: 1.7; }
.billing-plan-help { margin: 15px 0 24px; }
.platform-table { width: 100%; min-width: 540px; font-size: 13px; }
.platform-table th { padding: 13px 16px; color: #617691; background: #f8fafd; font-size: 10px; }
.platform-table td { padding: 17px 16px; vertical-align: top; color: #415e80; white-space: normal; overflow-wrap: anywhere; }
.platform-table td > strong { display: block; max-width: 220px; color: #385475; font-size: 13px; font-weight: 600; }
.platform-table small { display: block; margin-top: 5px; color: var(--platform-muted); font-size: 11px; line-height: 1.6; }
.license-table { min-width: 630px; }
.license-table td:first-child { width: 27%; }
.license-usage { min-width: 132px; max-width: 220px; font-variant-numeric: tabular-nums; }
.license-usage > span { display: block; color: #355b8a; font-size: 12px; }
.license-usage progress { display: block; width: 100%; height: 6px; margin-top: 8px; border: 0; border-radius: 8px; background: #e6edf7; accent-color: #5083c5; overflow: hidden; }
.license-usage progress::-webkit-progress-bar { border-radius: 8px; background: #e6edf7; }
.license-usage progress::-webkit-progress-value { border-radius: 8px; background: #5083c5; }
.license-usage progress::-moz-progress-bar { border-radius: 8px; background: #5083c5; }
.billing-consolidated { position: sticky; top: 97px; padding: 0 21px 21px; }
.billing-consolidated .platform-panel-heading { padding: 20px 0 17px; border-bottom: 1px solid #e1e9f2; }
.billing-total { padding: 20px 0; }
.billing-total > span { color: var(--platform-muted); font-size: 12px; }
.billing-total strong { display: block; margin: 7px 0; color: #244b7c; font-size: 28px; font-weight: 650; line-height: 1.3; letter-spacing: -.5px; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.billing-total small { color: var(--platform-muted); font-size: 12px; }
.billing-items { margin-bottom: 17px; padding-bottom: 13px; border-bottom: 1px solid #e4ebf4; }
.billing-items > div { display: flex; justify-content: space-between; align-items: baseline; gap: 13px; padding: 7px 0; }
.billing-items > div > span { color: #496a92; font-size: 13px; }
.billing-items small { display: block; margin-top: 3px; color: var(--platform-muted); font-size: 11px; }
.billing-items strong { flex-shrink: 0; color: #345b88; font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; }
.billing-subscription-state { margin: 0 0 12px; color: var(--platform-muted); font-size: 12px; }
.billing-consolidated > .btn { width: 100%; margin-top: 6px; }
.billing-checkout-note { margin: 14px 0 0; padding: 11px 12px; border-radius: 7px; color: #586f8b; background: #f1f5fb; font-size: 12px; font-weight: 500; text-align: center; }
.platform-form .platform-help { margin: 0 0 17px; }
.platform-form .form-grid + .platform-help { margin-top: 14px; }
.platform-form .form-grid input,
.platform-form .form-grid select { min-height: 44px; }
.platform-form-message { margin: 18px 0 0; padding: 13px 15px; border: 1px solid #d5e2f2; border-radius: 8px; color: #486990; background: #f3f8ff; font-size: 13px; line-height: 1.7; }
.platform-form .form-grid + .platform-form-message { margin-bottom: 15px; }

@media (max-width: 1250px) {
  .billing-layout { grid-template-columns: minmax(0, 1fr); }
  .billing-consolidated { position: static; max-width: none; }
  .billing-consolidated > .btn { width: auto; min-width: 240px; }
  .billing-items { max-width: 540px; }
}
@media (max-width: 980px) {
  .topbar .company-picker { width: 195px; }
  .platform-summary { grid-template-columns: 1fr 1fr; gap: 17px; }
  .platform-summary-context { grid-column: 1 / -1; border-left: 0 !important; padding: 15px 0 0 !important; border-top: 1px solid var(--platform-border); }
}
@media (max-width: 680px) {
  .company-picker small { font-size: 12px; }
  .topbar .company-picker { width: 155px; }
  .topbar .company-picker select { min-height: 44px; padding-left: 8px; font-size: 12px; }
  .platform-heading .actions { width: 100%; }
  .platform-heading .actions > .btn { flex: 1 1 auto; }
  .platform-summary { padding: 18px; gap: 15px; }
  .platform-summary > div + div { padding-left: 16px; }
  .company-grid { grid-template-columns: minmax(0, 1fr); gap: 16px; }
  .company-card { padding: 20px; }
  .platform-notice { padding: 15px; }
  .platform-notice p { font-size: 12px; }
  .plan-grid { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .plan-card { display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 14px; padding: 20px; }
  .plan-card-top { align-self: start; }
  .plan-price { margin: 0; text-align: right; }
  .plan-price strong { font-size: 26px; }
  .plan-features { grid-column: 1 / -1; gap: 9px; margin: 0; }
  .plan-card > .btn { grid-column: 1 / -1; width: 100%; margin-top: 4px; font-size: 13px; }
  .platform-panel-heading { padding: 20px 18px 16px; }
  .billing-company-context strong { font-size: 17px; }
  .billing-consolidated { padding: 0 18px 20px; }
  .billing-consolidated > .btn { width: 100%; min-width: 0; }
  .platform-table th,
  .platform-table td { padding-left: 14px; padding-right: 14px; }
  .platform-form .form-grid { grid-template-columns: minmax(0, 1fr); }
}
/* The active CNPJ and environment remain visible when the shell gets narrow. */
@media screen {
  .topbar:has(.company-picker) .breadcrumb { flex: 1 1 auto; }
  .topbar:has(.company-picker) .breadcrumb b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .topbar:has(.company-picker) .topbar-right { flex: 0 1 auto; }
  .topbar:has(.company-picker) .company-picker { flex: 0 1 260px; }
  .topbar:has(.company-picker) .environment-switch { flex-shrink: 0; }
  .topbar:has(.company-picker) .userbox strong { display: block; max-width: 145px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
}
@media screen and (max-width: 1450px) {
  .topbar:has(.company-picker) .institutional-link { display: none; }
}
@media screen and (max-width: 1180px) {
  .topbar:has(.company-picker) .userbox { padding-left: 10px; }
  .topbar:has(.company-picker) .userbox > div:not(.avatar) { display: none; }
  .topbar:has(.company-picker) .breadcrumb > span { display: none; }
  .topbar:has(.company-picker) .company-picker { flex-basis: 200px; }
}
@media screen and (max-width: 800px) and (min-width: 681px) {
  .topbar:has(.company-picker) { flex-wrap: wrap; height: auto; min-height: 112px; padding-block: 12px; row-gap: 9px; }
  .topbar:has(.company-picker) .breadcrumb { flex-basis: 100%; }
  .topbar:has(.company-picker) .topbar-right { width: 100%; justify-content: space-between; }
  .topbar:has(.company-picker) .company-picker { flex: 1 1 auto; max-width: 280px; }
  .topbar:has(.company-picker) .environment-switch { display: block; }
}
@media screen and (max-width: 680px) {
  .topbar:has(.company-picker) { display: grid; grid-template-columns: minmax(0, 1fr); height: auto; min-height: 122px; padding: 8px 16px 12px; gap: 5px; }
  .topbar:has(.company-picker) .breadcrumb { width: 100%; min-height: 32px; }
  .topbar:has(.company-picker) .breadcrumb .menu-toggle { min-height: 36px; padding-block: 5px; }
  .topbar:has(.company-picker) .topbar-right { width: 100%; display: grid; grid-template-columns: minmax(0, 1fr) 128px; align-items: end; gap: 10px; }
  .topbar:has(.company-picker) .company-picker { width: 100%; }
  .topbar:has(.company-picker) .company-picker label { margin-bottom: 4px; font-size: 11px; }
  .topbar:has(.company-picker) .environment-switch { display: block; margin: 0; font-size: 11px; line-height: 1.6; }
  .topbar:has(.company-picker) .environment-switch select { display: block; width: 100%; max-width: none; min-height: 44px; margin-top: 4px; font-size: 12px; }
  .topbar:has(.company-picker) .userbox { display: none; }
}
@media print {
  .company-picker,
  .platform-page .actions,
  .platform-page .btn { display: none !important; }
}
