/* Madmin agency pages (design/agency/source/madmin/ and madmin_m/). Loaded only in Madmin
   (config/initializers/madmin.rb). Colours follow Madmin's light/dark scheme. */

.ma-header { align-items: flex-end; }
.ma-section { margin-top: 2rem; }
.ma-eyebrow { font-size: 12px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--light-text-color); }
.ma-mono { font-family: "JetBrains Mono", ui-monospace, Menlo, monospace; font-size: 12.5px; }
.ma-nowrap { white-space: nowrap; }
.ma-empty { color: var(--light-text-color); padding: 0.75rem 0; }
.ma-warn-text { color: light-dark(#8F5A15, #E2B26A); }

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

/* Status filters */
.ma-filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 1rem 0 0.75rem; }
.ma-filter {
  display: inline-flex; align-items: center; min-height: 32px; padding: 6px 12px; border-radius: 6px;
  background: var(--hover-color); color: var(--text-color); font-size: 13px; text-decoration: none;
}
.ma-filter:hover { text-decoration: none; }
.ma-filter.is-on { background: var(--text-color); color: var(--surface-color); font-weight: 500; }

/* Status pills */
.ma-pill { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.ma-pill-ok   { background: light-dark(#EFF3EB, #22331F); color: light-dark(#4F7A4A, #9CC596); }
.ma-pill-info { background: light-dark(#EEF3FB, #1C2A45); color: light-dark(#244380, #9DB8E8); }
.ma-pill-warn { background: light-dark(#F8F0E0, #3A2C14); color: light-dark(#8F5A15, #E2B26A); }
.ma-pill-off  { background: var(--hover-color); color: var(--light-text-color); }

/* Households used against the cap */
.ma-bar { display: inline-block; width: 64px; height: 4px; border-radius: 999px; background: var(--border-color); overflow: hidden; vertical-align: middle; margin-right: 8px; }
.ma-bar i { display: block; height: 4px; background: var(--primary-color); }
.ma-bar-warn i { background: #B8741F; }

/* Phone cards */
.ma-cards { list-style: none; margin: 0; padding: 0; border: 1px solid var(--border-color); border-radius: 12px; overflow: hidden; }
.ma-cards > li + li { border-top: 1px solid var(--border-color); }
.ma-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; min-height: 44px; color: var(--text-color); text-decoration: none; }
.ma-card:hover { background: var(--hover-color); text-decoration: none; }
.ma-card-head { display: flex; align-items: center; gap: 8px; }
.ma-card-title { flex: 1; font-size: 15px; font-weight: 600; }
.ma-card-sub { color: var(--light-text-color); font-size: 13px; }
.ma-card-usage { display: flex; align-items: center; gap: 8px; }
.ma-card-usage .ma-bar { flex: 1; width: auto; }

/* One layout per screen width (Madmin's own breakpoint) */
@media (max-width: 767px) {
  .ma-desktop-only { display: none !important; }
  .ma-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .ma-filters .ma-filter { flex: 1; justify-content: center; }
}
@media (min-width: 768px) {
  .ma-phone-only { display: none !important; }
}

/* Sidebar: count of inquiries waiting */

/* Agency detail */
.ma-back { margin: 0 0 0.25rem; }
.ma-back a { text-decoration: none; font-weight: 500; }
.ma-muted { color: var(--light-text-color); }
.ma-summary { margin-bottom: 1.5rem; }
.ma-summary th.label { width: 14rem; }
.ma-box { border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem 1.5rem; }
.ma-box-title { font-size: 17px; font-weight: 600; margin: 0 0 1rem; }
.ma-limits { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; }
.ma-limits .form-input { width: 100%; font-size: 16px; }
.ma-radios { border: 0; padding: 0; margin: 0.5rem 0 1.25rem; display: flex; flex-direction: column; gap: 10px; }
.ma-radios legend { font-weight: 600; margin-bottom: 0.5rem; }
.ma-radio { display: flex; align-items: center; gap: 10px; min-height: 44px; cursor: pointer; }
.ma-radio input { width: 18px; height: 18px; margin: 0; }
.ma-radio-hint { color: var(--light-text-color); }

/* Trial agency (#366): "Trial so far" tiles (number first) and the Mark as paying dialog */
.ma-section-title { font-size: 17px; font-weight: 600; margin: 0.5rem 0 0.75rem; }
.ma-trial-so-far { margin-bottom: 1.5rem; }
.ma-trial-so-far .metric { display: flex; flex-direction: column; gap: 4px; }
.ma-trial-so-far .metric p { font-size: 24px; font-weight: 600; margin: 0; }
.ma-trial-so-far .metric h4 { font-weight: 400; color: var(--light-text-color); margin: 0; }
.ma-check { display: flex; align-items: center; gap: 10px; min-height: 44px; margin: 0.75rem 0; cursor: pointer; }
.ma-check input { width: 18px; height: 18px; margin: 0; }
.ma-dialog {
  width: min(640px, calc(100vw - 32px)); padding: 1.5rem; border: 1px solid var(--border-color); border-radius: 12px;
  background: var(--surface-color); color: var(--text-color);
}
.ma-dialog::backdrop { background: rgba(14, 22, 38, 0.4); }
.ma-dialog .ma-limits { margin: 1rem 0 0.25rem; }
.ma-dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 1rem; }
.ma-card-more { align-items: center; color: var(--link-color); font-weight: 500; }
.ma-phone-actions { display: flex; gap: 12px; margin-top: 1.5rem; }
.ma-phone-actions form, .ma-phone-actions .btn { flex: 1; }
.ma-phone-actions .btn { width: 100%; min-height: 44px; }

@media (max-width: 767px) {
  .ma-sep { display: none; }
  .ma-stack-on-phone { display: block; }
  .ma-summary th.label { width: 7rem; }
  .ma-limits { grid-template-columns: 1fr; gap: 1rem; }
  .ma-box { border: 0; padding: 0; }
  .ma-radio { border: 1px solid var(--border-color); border-radius: 12px; padding: 12px 16px; align-items: flex-start; }
  .ma-radio > span { display: flex; flex-direction: column; gap: 2px; }
  .ma-submit { width: 100%; min-height: 44px; }
}

/* New agency */
.ma-new { display: grid; grid-template-columns: minmax(0, 1fr) 20rem; gap: 1.5rem; align-items: start; }
.ma-new-form { display: flex; flex-direction: column; gap: 1.5rem; grid-row: 1; }
.ma-inquiry { grid-column: 2; grid-row: 1; border: 1px solid var(--border-color); border-radius: 12px; padding: 1.25rem 1.5rem; background: var(--surface-color); }
.ma-inquiry dl { display: grid; grid-template-columns: auto 1fr; gap: 6px 12px; margin: 0 0 0.75rem; }
.ma-inquiry dt { color: var(--light-text-color); }
.ma-inquiry dd { margin: 0; overflow-wrap: anywhere; }
.ma-inquiry-message { margin: 0; color: var(--light-text-color); white-space: pre-line; }
.ma-form-actions { display: flex; gap: 12px; }
.ma-actions-cell { text-align: right; white-space: nowrap; }
.ma-visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ma-card-row { display: flex; align-items: center; gap: 12px; }
.ma-card-row .ma-card { flex: 1; min-width: 0; }
.ma-card-row .ma-card-action { margin-right: 16px; min-height: 44px; display: inline-flex; align-items: center; }

@media (max-width: 767px) {
  .ma-new { display: flex; flex-direction: column; }
  .ma-inquiry { padding: 1rem; }
  .ma-form-actions { flex-direction: column; }
}
.ma-inline-form { display: inline-block; margin-left: 8px; }
.ma-inline-button { min-height: 32px; padding: 4px 12px; }
@media (max-width: 767px) { .ma-inline-form { display: block; margin: 8px 0 0; } .ma-inline-button { min-height: 44px; } }
