.usage-meter {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin: 8px 0;
  flex-shrink: 0;
}
.usage-meter-heading {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  font-size: 12px;
  color: var(--navy);
}
#profile-usage-percent {
  font-weight: 600;
}
#profile-usage-meter {
  height: 8px;
  background: #e9edf6;
  border-radius: 8px;
  overflow: hidden;
  margin: 10px 0 8px;
}
#profile-usage-fill {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7c91bf, #26315c);
  border-radius: inherit;
  transition: width 0.3s ease;
}
#profile-usage-meter.usage-exhausted #profile-usage-fill {
  background: #b54542;
}
.usage-meter #profile-daily-usage {
  margin: 0;
  font-size: 11px;
  line-height: 1.5;
  color: var(--muted);
}
#admin-plans-panel {
  overflow-y: auto;
  padding: 2px;
}
.admin-heading-actions {
  display: flex;
  gap: 6px;
}
#admin-dialog #admin-plans-open {
  font-size: 12px;
  padding: 8px 12px;
}
.usage-plan-toolbar {
  display: flex;
  gap: 8px;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
}
.usage-plan-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.usage-plan-card strong,
.usage-plan-card small {
  display: block;
  overflow-wrap: anywhere;
}
.usage-plan-card small {
  font-size: 12px;
  color: var(--muted);
  margin-top: 5px;
}
.usage-plan-card button {
  flex-shrink: 0;
}
#usage-plan-form {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #f8f9fc;
}
#usage-plan-form[hidden] {
  display: none;
}
#usage-plan-form label {
  margin: 10px 0 6px;
  font-size: 12px;
}
#usage-plan-products {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  font: inherit;
  font-size: 13px;
}
.usage-plan-actions {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
#admin-user-usage {
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  margin: 12px 0;
}
#admin-user-usage h4 {
  margin: 0 0 8px;
  font-size: 14px;
}
#admin-user-usage label {
  margin: 10px 0 6px;
  font-size: 12px;
}
#admin-user-plan-save {
  margin-top: 10px;
}
#admin-user-usage p {
  font-size: 12px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}
@media (max-width: 600px) {
  #admin-dialog .admin-heading h2 {
    font-size: 18px;
  }
  #admin-dialog .admin-heading-actions button {
    padding: 8px;
    font-size: 11px;
  }
  .usage-meter {
    padding: 10px 12px;
  }
}
@media (max-height: 480px) {
  #admin-dialog .admin-heading-actions {
    position: absolute;
    top: 16px;
    right: 56px;
  }
  #admin-dialog #admin-overview-open {
    position: static;
    min-height: 44px;
  }
  #admin-dialog #admin-plans-open {
    min-height: 44px;
    padding: 8px 10px;
  }
  #admin-dialog .config-tabs {
    margin-right: 200px;
  }
}
@media (prefers-reduced-motion: reduce) {
  #profile-usage-fill {
    transition: none;
  }
}

@media (max-width: 600px) {
  #admin-dialog .admin-heading h2 {
    font-size: 16px;
  }
  #admin-dialog #admin-plans-open,
  #admin-dialog #admin-overview-open {
    font-size: 11px;
    padding: 8px;
  }
}

.usage-plan-card > div {
  min-width: 0;
}
@media (max-width: 600px) {
  #usage-plan-form input,
  #usage-plan-products,
  #admin-user-plan {
    font-size: 16px;
  }
}
/* Keep the usage meter and account actions visible even on a small iPhone. */
#account-dialog {
  overflow: hidden;
}
#account-dialog .config-tabs {
  flex-wrap: nowrap;
  margin-bottom: 12px;
}
#account-dialog .account-card {
  flex-shrink: 0;
}
#account-dialog .profile-actions,
#account-dialog .config-legal,
#account-dialog h2 {
  flex-shrink: 0;
}
#account-dialog .profile-actions {
  margin-top: 8px;
}
#account-dialog .config-legal {
  margin-top: 10px;
  padding-top: 0;
}
@media (max-width: 550px) {
  #account-dialog {
    padding: 18px 14px;
  }
  #account-dialog .account-card {
    display: grid;
    grid-template-columns: 36px minmax(0, 1fr);
    gap: 3px 10px;
    padding: 10px 12px;
  }
  #account-dialog .account-card-avatar {
    grid-row: span 2;
    width: 36px;
    height: 36px;
  }
  #account-dialog .account-card-id strong {
    font-size: 14px;
    line-height: 1.25;
    overflow-wrap: anywhere;
  }
  #account-dialog .account-pill {
    grid-column: 2;
    justify-self: start;
    font-size: 10px;
    padding: 2px 6px;
  }
  .config-dialog .usage-meter {
    margin: 8px 0 0;
  }
}
@media (max-height: 480px) {
  #account-dialog {
    padding: 12px 14px;
  }
  #account-dialog .config-tabs {
    margin-bottom: 6px;
  }
  #account-dialog h2 {
    font-size: 17px;
    margin: 0 0 6px;
  }
  #account-dialog .account-card {
    padding: 8px 12px;
  }
  #account-dialog .account-card-id strong {
    font-size: 14px;
  }
  #account-dialog .account-card-avatar {
    flex-basis: 32px;
    height: 32px;
    font-size: 12px;
  }
  .config-dialog .usage-meter {
    padding: 8px 12px;
    margin: 6px 0 0;
  }
  #account-dialog .config-legal {
    display: none;
  }
}

#account-dialog .account-details-scroll {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 2px;
}
#account-dialog .account-boxes {
  display: grid;
  overflow: visible;
  min-height: auto;
  flex: none;
}
#admin-dialog button:not(.config-tab):not(.dialog-close) {
  min-height: 44px;
}
.usage-plan-offers {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px 12px;
  margin: 14px 0 0;
}
.usage-plan-offers legend {
  font-size: 12px;
  color: var(--navy);
  padding: 0 4px;
}
#usage-plan-offers-status {
  margin: 0 0 4px;
}
.usage-plan-offer {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin: 0;
  padding: 8px 0;
  min-height: 44px;
  font-size: 12px;
  line-height: 1.4;
  cursor: pointer;
}
.usage-plan-offer + .usage-plan-offer {
  border-top: 1px solid var(--line);
}
.usage-plan-offer input {
  appearance: auto;
  width: 20px;
  height: 20px;
  flex: 0 0 20px;
  margin: 1px 0;
  accent-color: #20284b;
}
.usage-plan-offer small {
  display: block;
  color: var(--muted);
  font-size: 11px;
}
.usage-plan-offer.is-taken {
  cursor: not-allowed;
  opacity: 0.6;
}
.usage-plan-advanced {
  margin-top: 10px;
  font-size: 12px;
}
.usage-plan-advanced summary {
  cursor: pointer;
  color: var(--blue);
  min-height: 32px;
  display: flex;
  align-items: center;
}
.config-usage {
  margin: 10px 0 4px;
  flex-shrink: 0;
}
.config-usage-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  font-size: 11px;
  color: var(--muted);
}
.config-usage-head strong {
  color: var(--navy);
  font-weight: 600;
}
.config-usage-track {
  height: 6px;
  margin-top: 6px;
  background: #e9edf6;
  border-radius: 6px;
  overflow: hidden;
}
.config-usage-track span {
  display: block;
  width: 0;
  height: 100%;
  background: linear-gradient(90deg, #7c91bf, #26315c);
  border-radius: inherit;
  transition: width 0.3s ease;
}
.config-usage.usage-low .config-usage-track span {
  background: #b54542;
}
.config-usage.usage-low .config-usage-head strong {
  color: #b54542;
}
#plans-dialog {
  width: min(560px, calc(100vw - 32px));
}
.plan-option {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px 14px;
  margin-top: 8px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.plan-option.is-current {
  border-color: var(--navy);
  background: #f4f6fb;
}
.plan-option strong,
.plan-option span,
.plan-option small {
  display: block;
  overflow-wrap: anywhere;
}
.plan-option span {
  font-size: 13px;
  color: var(--navy);
  margin-top: 2px;
}
.plan-option small {
  font-size: 11px;
  color: var(--muted);
  margin-top: 4px;
}
#plans-dialog .plan-option .gold-button {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
.plans-note {
  font-size: 12px;
  margin: 14px 0 0;
}
#plan-change h3 {
  margin: 4px 0 10px;
}
.plan-change-quote {
  margin: 0;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 4px 14px;
}
.plan-change-quote div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  font-size: 13px;
}
.plan-change-quote div + div {
  border-top: 1px solid var(--line);
}
.plan-change-quote div:last-child dd {
  font-weight: 700;
  color: var(--navy);
}
.plan-change-quote dt {
  color: var(--muted);
}
.plan-change-quote dd {
  margin: 0;
  text-align: right;
}
#plan-change-pix {
  text-align: center;
  margin-top: 12px;
}
#plan-change-qr {
  width: min(200px, 60vw);
  height: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 6px;
  background: #fff;
}
#plan-change-pix label {
  text-align: left;
}
.plan-change-copy {
  display: flex;
  gap: 8px;
}
.plan-change-copy input {
  flex: 1;
  min-width: 0;
  font-size: 12px;
}
.plan-change-copy button {
  min-height: 44px;
  flex-shrink: 0;
}
.plan-change-actions {
  display: grid;
  gap: 8px;
  margin-top: 12px;
}
#plans-dialog .plan-change-actions .gold-button {
  margin: 0;
  min-height: 44px;
}
.plan-change-actions .outline-button {
  min-height: 44px;
}
#plans-dialog .plan-option button.gold-button {
  width: auto;
  margin: 0;
  flex-shrink: 0;
  min-height: 44px;
  padding: 0 18px;
}
#plans-dialog .plan-change-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 12px 0 0;
  text-decoration: none;
}
#plans-dialog .plan-change-pay[hidden] {
  display: none;
}
#plans-dialog .plan-change-pay {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  margin: 12px 0 0;
  text-decoration: none;
}
#plans-dialog .plan-change-pay[hidden] {
  display: none;
}
.login-payment-note {
  background: #eef6ee;
  border: 1px solid #b9dcb9;
  border-radius: 10px;
  padding: 10px 12px;
  color: #1f5a2a;
}
#payment-dialog {
  width: min(440px, calc(100vw - 32px));
  text-align: center;
}
#payment-dialog .gold-button {
  margin-top: 16px;
  min-height: 44px;
}
.payment-mark {
  width: 64px;
  height: 64px;
  margin: 16px auto 8px;
  border-radius: 50%;
  border: 4px solid #e9edf6;
  border-top-color: var(--navy);
  animation: payment-spin 0.9s linear infinite;
}
.payment-mark[data-state='done'] {
  animation: none;
  border-color: #2e8b57;
  background: no-repeat center / 30px
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232e8b57' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12l5 5L20 7'/%3E%3C/svg%3E");
}
.payment-mark[data-state='pending'] {
  animation: none;
  border-color: var(--gold);
}
@keyframes payment-spin {
  to {
    transform: rotate(360deg);
  }
}
@media (prefers-reduced-motion: reduce) {
  .payment-mark {
    animation: none;
  }
}
#quota-dialog {
  width: min(440px, calc(100vw - 32px));
}
#quota-dialog .gold-button {
  width: 100%;
  min-height: 44px;
  margin: 8px 0 0;
}
#quota-dialog .plan-option .gold-button {
  width: auto;
  flex-shrink: 0;
  margin: 0;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
#quota-plans {
  margin: 4px 0 8px;
}
#usage-reset-mine {
  margin: 6px 12px 0 0;
  padding: 0;
  font-size: 12px;
}
/* Meter actions stay compact text links side by side, so the meter never crowds out the account
   details above it (admins see one more link). */
.config-dialog .usage-meter #usage-reset-mine {
  display: inline-flex;
  align-items: center;
  min-height: 44px;
  margin: 0 16px 0 0;
  padding: 0;
  font-size: 12px;
}
.config-dialog .usage-meter #usage-reset-mine[hidden] {
  display: none;
}
@media (max-height: 480px) {
  /* Phones in landscape: keep the account details reachable; the dialog scrolls if needed. */
  #account-dialog .account-details-scroll {
    min-height: 96px;
    flex-shrink: 0;
  }
}
/* Sign-in screen: a way in for people who are not students yet. */
#login-dialog .login-subscribe {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
  text-align: center;
}
#login-dialog .login-subscribe p {
  margin: 0 0 8px;
  color: var(--muted);
  font-size: 13px;
}
/* Subscribing stands out in green, like the upgrade calls, without competing with "Entrar". */
#login-dialog .login-subscribe .outline-button {
  width: 100%;
  min-height: 44px;
  border-color: #2f8a5f;
  background: #2f8a5f;
  color: var(--white);
  font-weight: 700;
}
#login-dialog .login-subscribe .outline-button:hover {
  background: #26734d;
}
#subscribe-dialog {
  width: min(480px, calc(100vw - 32px));
}
#subscribe-dialog #subscribe-status:empty {
  display: none;
}
#subscribe-dialog .plan-option .gold-button {
  width: auto;
  flex-shrink: 0;
  min-height: 44px;
  margin: 0;
  padding: 0 18px;
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}
#subscribe-dialog #subscribe-back {
  width: 100%;
  min-height: 44px;
  margin-top: 8px;
}
/* Placeholder cards while plans load, in the same size as the real ones. */
.plan-option.plan-skeleton div {
  flex: 1;
}
.plan-option.plan-skeleton i,
.plan-option.plan-skeleton b {
  display: block;
  border-radius: 6px;
  background: linear-gradient(90deg, #eceef4 0%, #f7f8fb 50%, #eceef4 100%);
  background-size: 200% 100%;
  animation: plan-skeleton 1.2s ease-in-out infinite;
}
.plan-option.plan-skeleton i {
  height: 12px;
  margin: 6px 0;
}
.plan-option.plan-skeleton i:nth-child(1) {
  width: 40%;
  height: 15px;
}
.plan-option.plan-skeleton i:nth-child(2) {
  width: 55%;
}
.plan-option.plan-skeleton i:nth-child(3) {
  width: 75%;
  height: 10px;
}
.plan-option.plan-skeleton b {
  width: 84px;
  height: 44px;
  border-radius: 8px;
}
@keyframes plan-skeleton {
  from {
    background-position: 100% 0;
  }
  to {
    background-position: -100% 0;
  }
}
@media (prefers-reduced-motion: reduce) {
  .plan-option.plan-skeleton i,
  .plan-option.plan-skeleton b {
    animation: none;
  }
}
/* Price summary placeholders while the quote is calculated. */
.plan-change-quote .quote-skeleton {
  display: flex;
  justify-content: space-between;
  gap: 16px;
}
.plan-change-quote .quote-skeleton i {
  display: block;
  height: 12px;
  margin: 4px 0;
  border-radius: 6px;
  background: linear-gradient(90deg, #eceef4 0%, #f7f8fb 50%, #eceef4 100%);
  background-size: 200% 100%;
  animation: plan-skeleton 1.2s ease-in-out infinite;
}
.plan-change-quote .quote-skeleton i:first-child {
  width: 38%;
}
.plan-change-quote .quote-skeleton i:last-child {
  width: 28%;
}
@media (prefers-reduced-motion: reduce) {
  .plan-change-quote .quote-skeleton i {
    animation: none;
  }
}
/* Plan change: the school's contact, when a card is refused or another one is needed. */
#plans-dialog .plan-change-contact {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 44px;
  margin: 4px 0 8px;
  text-decoration: none;
  overflow-wrap: anywhere;
}
#plans-dialog .plan-change-contact[hidden] {
  display: none;
}
/* The prompt opens on its title, so no button starts out highlighted. */
#quota-title:focus {
  outline: none;
}
/* A quiet close: no tile, a light gray mark, the same 44px tap area. */
#quota-dialog .dialog-close {
  background: none;
  color: #a9adb9;
}
#quota-dialog .dialog-close:hover {
  background: var(--paper);
  color: var(--muted);
}
#quota-dialog .dialog-close .icon {
  width: 18px;
  height: 18px;
}
