/* The SMS customer page's own styles (docs/architecture.md §19.11). The look is the admin website's: admin.css (loaded before this
   file) has the --mi-* tokens, the NeoUI bridge, the building blocks (.mi-card, .mi-table, .mi-stats, .mi-form …) and the charts.
   Here is only what that file keeps in a component's scoped CSS (the header bar, the one-time secret) and the page's few own parts
   (sp-*). Colours only through the tokens; NeoUI's components are never re-sized or re-coloured (docs/ui.md "NeoUI"). */

/* The header bar, as the admin website's MainLayout: the page's background with a thin border under it; one row, also on a phone. */
.mi-header { border-bottom: 1px solid var(--mi-border); background: var(--mi-bg); }
.mi-header__bar {
  position: relative; display: flex; flex-wrap: wrap; align-items: center; gap: var(--mi-space-2) var(--mi-space-3);
  min-height: var(--mi-header-height, 3.5rem); max-width: var(--mi-container-max); margin: 0 auto; padding: var(--mi-space-2) var(--mi-container-pad);
}
.mi-header__right { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--mi-space-2) var(--mi-space-3); margin-left: auto; min-width: 0; }
.mi-nav__phone { display: flex; align-items: center; }

/* Who is logged in and for which customer: the customer over the name, both quiet. */
.sp-who { display: grid; justify-items: end; min-width: 0; line-height: 1.25; }
.sp-who__customer { font-weight: 500; white-space: nowrap; }
.sp-who__name { max-width: 16rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--mi-text-muted); font-size: var(--mi-text-hint); }
.sp-who__switch { font-size: var(--mi-text-hint); white-space: nowrap; }
@media (max-width: 767.98px) {
  .mi-header__bar { gap: var(--mi-space-1) var(--mi-space-2); padding-block: var(--mi-space-1); }
  .mi-header__bar > .mi-brand { flex: 0 1 auto; min-width: 0; }
  .sp-who__name { display: none; }
}
@media (max-width: 479.98px) {
  /* The brand's name gives its place to the customer and "Log ud"; its mark stays. */
  .mi-header__bar > .mi-brand { font-size: 0; gap: 0; }
}

/* The login pages (static rendering: plain fields in NeoUI's Input look, admin.css ".mi-field > input"). */
.mi-login .mi-field > label { font-weight: 500; }
.mi-login .mi-alertbar { margin: 0; }
.sp-login__hint { margin: var(--mi-space-4) 0 0; }
.sp-code { font-family: var(--mi-font-mono); font-size: 1.25rem; letter-spacing: 0.3em; text-align: center; }

/* Two-factor login (docs/auth.md "Two-factor login"): the QR code with its key, on the login's set-up step and on "Indstillinger".
   The QR code is black on white in light and in dark (the two colours have no dark values, on purpose): that is what a phone's
   camera reads. Its size is the component's: four CSS pixels per module, so every module is a whole number of device pixels (crisp,
   and all the same size); narrower only where the page is. */
:root { --sp-qr-paper: #ffffff; --sp-qr-ink: #000000; }
.sp-twofactor { display: grid; justify-items: center; gap: var(--mi-space-2); margin: 0 0 var(--mi-space-4); }
.sp-twofactor__code { display: block; max-width: 100%; height: auto; aspect-ratio: 1; border: 1px solid var(--mi-border); border-radius: var(--mi-radius); shape-rendering: crispEdges; }
.sp-twofactor__paper { fill: var(--sp-qr-paper); }
.sp-twofactor__modules { fill: var(--sp-qr-ink); }
.sp-twofactor .mi-hint { margin: 0; text-align: center; }
.sp-twofactor__secret { padding: 0.25rem 0.5rem; border: 1px solid var(--mi-border); border-radius: var(--mi-radius); background: var(--mi-bg); color: var(--mi-text); font-family: var(--mi-font-mono); font-size: var(--mi-text-hint); letter-spacing: 0.04em; text-align: center; overflow-wrap: anywhere; user-select: all; }
.sp-choose { display: grid; gap: var(--mi-space-2); margin: 0; padding: 0; list-style: none; }

/* The connection to the server was lost (Blazor toggles the components-reconnect-* classes on this element). */
.sp-reconnect { display: none; position: fixed; inset: auto 0 0 0; z-index: 1000; padding: 0.75rem 1rem; border-top: 2px solid var(--mi-warn); background: var(--mi-warn-bg); color: var(--mi-text); }
.sp-reconnect.components-reconnect-show, .sp-reconnect.components-reconnect-failed, .sp-reconnect.components-reconnect-rejected { display: block; }
.sp-reconnect__text { margin: 0; }
.sp-reconnect__text--lost { display: none; }
.sp-reconnect.components-reconnect-failed .sp-reconnect__text--trying, .sp-reconnect.components-reconnect-rejected .sp-reconnect__text--trying { display: none; }
.sp-reconnect.components-reconnect-failed .sp-reconnect__text--lost, .sp-reconnect.components-reconnect-rejected .sp-reconnect__text--lost { display: block; }

/* A secret shown once: a warning box with the value to select. */
.sp-secret { margin: 0 0 var(--mi-space-4); padding: 0.75rem 1rem; border: 2px solid var(--mi-warn); border-radius: var(--mi-radius); background: var(--mi-warn-bg); color: var(--mi-text); }
.sp-secret .mi-secret__title { display: flex; align-items: center; gap: 0.4rem; margin: 0 0 0.5rem; font-size: var(--mi-text-h2); }
.sp-secret .mi-secret__value code { display: block; padding: 0.6rem; border: 1px solid var(--mi-border); border-radius: var(--mi-radius); background: var(--mi-bg); font-family: var(--mi-font-mono); overflow-wrap: anywhere; user-select: all; }
.sp-secret .mi-copy-status { margin: var(--mi-space-2) 0 0; min-height: 1.25rem; }

/* How much of a limit is used: a track with a bar; the state is also said in words beside the name. */
.sp-meter { display: grid; gap: var(--mi-space-2); min-width: 0; }
.sp-meter__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mi-space-2); margin: 0; }
.sp-meter__label { font-weight: 500; }
.sp-meter__track { height: 0.5rem; border-radius: 999px; background: var(--mi-surface-2); overflow: hidden; }
.sp-meter__bar { display: block; height: 100%; min-width: 2px; border-radius: 999px; background: var(--mi-chart-good, var(--mi-ok)); }
.sp-meter__bar--warn { background: var(--mi-warn); }
.sp-meter__bar--reached { background: var(--mi-error); }
.sp-meter__text { margin: 0; font-variant-numeric: tabular-nums; }
.sp-meter .mi-hint { margin: 0; }

/* Tables of figures: numbers to the right, in tabular digits; a foot row for the total. */
.sp-table--figures .mi-num, .mi-table th.mi-num, .mi-table td.mi-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.mi-table tfoot th, .mi-table tfoot td { border-bottom: 0; border-top: 2px solid var(--mi-border); font-weight: 600; }
.mi-table tr[aria-current="true"] { background: var(--mi-surface); }
@media (max-width: 767.98px) {
  .sp-table--figures .mi-num, .mi-table th.mi-num, .mi-table td.mi-num { text-align: left; }
  .mi-table tfoot { display: block; }
}
.sp-prefix { font-family: var(--mi-font-mono); font-size: var(--mi-text-hint); color: var(--mi-text-muted); white-space: nowrap; }
.sp-note { display: block; }
.mi-table th .sp-prefix { margin-left: var(--mi-space-2); font-weight: 400; }
.sp-rowactions { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: var(--mi-space-1) var(--mi-space-2); }
@media (max-width: 767.98px) { .sp-rowactions { justify-content: flex-start; } }

/* A link that downloads a file, in the look of NeoUI's small outline button. */
.sp-download { display: inline-flex; align-items: center; gap: 0.375rem; height: 2rem; padding: 0 0.75rem; border: 1px solid var(--mi-input); border-radius: var(--mi-radius); background: var(--mi-bg); color: var(--mi-text); font-weight: 500; text-decoration: none; white-space: nowrap; }
.sp-download:hover { background: var(--mi-surface); }

/* A value with its copy button (a list's id). */
.sp-copy { display: inline-flex; align-items: center; gap: var(--mi-space-1); min-width: 0; }
.sp-copy code { font-family: var(--mi-font-mono); font-size: var(--mi-text-hint); overflow-wrap: anywhere; }

.sp-card__note { margin: var(--mi-space-3) 0 0; }
.sp-back { margin: 0 0 var(--mi-space-2); }
.sp-back a { display: inline-flex; align-items: center; gap: 0.25rem; }
.sp-facts { margin: 0 0 var(--mi-space-4); }
.sp-more { margin: var(--mi-space-3) 0 0; }
.sp-file { max-width: 100%; font-size: var(--mi-text-body); }
.sp-inline-icon { display: inline-block; margin-left: 0.25rem; vertical-align: -0.125em; }

/* "Indstillinger": a field with its button on the same row; under each other on a phone. */
.sp-settings { max-width: 56rem; }
.sp-inline-form { display: flex; flex-wrap: wrap; align-items: flex-start; gap: var(--mi-space-3); }
.sp-inline-form > :first-child { flex: 1 1 18rem; min-width: 0; }
.sp-inline-form > button { margin-top: 1.75rem; }
@media (max-width: 599.98px) { .sp-inline-form > button { margin-top: 0; } }
.sp-callback-actions { margin-top: var(--mi-space-3); }
.sp-status { display: block; margin: var(--mi-space-2) 0 0; min-height: 1.25rem; }
.sp-status[data-error="true"] { color: var(--mi-error); }

/* "Tofaktor-login" on "Indstillinger": the state, then one step at a time (the QR code and a code, or a code to switch it off). */
.sp-twofactor-state { margin: 0 0 var(--mi-space-2); font-weight: 500; }
.sp-twofactor-step { display: grid; gap: var(--mi-space-3); max-width: 28rem; }
.sp-twofactor-step .mi-prose { margin: 0; }
.sp-twofactor-step .sp-twofactor { justify-items: start; margin: 0; }
.sp-twofactor-step .sp-twofactor .mi-hint, .sp-twofactor-step .sp-twofactor__secret { text-align: left; }
.sp-twofactor-step .mi-form__actions { margin: 0; }

/* A muted remark inside a row heading ("(indtil nu)", a list's note) is not bold. */
.mi-table th .mi-meta { font-weight: 400; }
.mi-table th .mi-meta:not(.sp-note) { margin-left: 0.375rem; }

/* "Samtaler" (docs/architecture.md §19.22): the conversations on the left, the open one on the right; below 900 px they take turns
   (data-chat-open). Their messages are bubbles: theirs on the left on the quiet surface, ours on the right in the accent colour, with the
   state beside the time. A text keeps its line breaks and breaks a long word rather than the page. */
.sp-chat { display: grid; grid-template-columns: minmax(15rem, 22rem) minmax(0, 1fr); gap: var(--mi-space-4); align-items: start; }
.sp-chat__list, .sp-chat__thread { min-width: 0; }
.sp-chat__list { display: grid; gap: var(--mi-space-3); align-content: start; }
.sp-chat__empty { margin: 0; }
.sp-chat__conversations { display: grid; gap: 0; margin: 0 calc(-1 * var(--mi-space-2)); padding: 0; list-style: none; max-height: min(70vh, 48rem); overflow-y: auto; }
.sp-chat__conversation {
  display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.125rem var(--mi-space-2); width: 100%; padding: var(--mi-space-2);
  border: 0; border-radius: var(--mi-radius); background: transparent; color: var(--mi-text); font: inherit; text-align: left; cursor: pointer;
}
.sp-chat__conversation:hover { background: var(--mi-surface); }
.sp-chat__conversation:focus-visible { outline: 2px solid var(--mi-focus); outline-offset: -2px; }
.sp-chat__conversation[aria-current="true"] { background: var(--mi-surface-2); }
.sp-chat__who { font-weight: 600; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-chat__when { color: var(--mi-text-muted); font-size: var(--mi-text-hint); white-space: nowrap; }
.sp-chat__last { grid-column: 1; color: var(--mi-text-muted); font-size: var(--mi-text-hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-chat__unread { grid-column: 2; justify-self: end; }
.sp-chat__via { grid-column: 1 / -1; color: var(--mi-text-muted); font-size: var(--mi-text-hint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sp-chat__thread { display: grid; gap: var(--mi-space-3); align-content: start; }
.sp-chat__head { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mi-space-2) var(--mi-space-3); padding-bottom: var(--mi-space-3); border-bottom: 1px solid var(--mi-border); }
.sp-chat__title { flex: 1 1 auto; min-width: 0; }
.sp-chat__title .mi-card__title { margin: 0; font-variant-numeric: tabular-nums; }
.sp-chat__title .mi-meta { margin: 0; }
.sp-chat__back { display: none; }
.sp-chat__messages { display: flex; flex-direction: column; gap: var(--mi-space-3); margin: 0; padding: 0; list-style: none; max-height: min(60vh, 40rem); overflow-y: auto; }
.sp-bubble { display: grid; gap: 0.25rem; max-width: min(36rem, 85%); }
.sp-bubble--in { align-self: flex-start; }
.sp-bubble--out { align-self: flex-end; justify-items: end; }
.sp-bubble__meta { display: flex; flex-wrap: wrap; gap: 0 var(--mi-space-2); margin: 0; color: var(--mi-text-muted); font-size: var(--mi-text-hint); }
.sp-bubble__status { font-weight: 500; }
.sp-bubble[data-status="delivered"] .sp-bubble__status { color: var(--mi-ok); }
.sp-bubble[data-status="undelivered"] .sp-bubble__status, .sp-bubble[data-status="failed"] .sp-bubble__status, .sp-bubble[data-status="refused"] .sp-bubble__status { color: var(--mi-error); }
.sp-bubble__text { margin: 0; padding: 0.5rem 0.75rem; border-radius: var(--mi-radius-card, var(--mi-radius)); white-space: pre-wrap; overflow-wrap: anywhere; }
.sp-bubble--in .sp-bubble__text { background: var(--mi-surface-2); color: var(--mi-text); border-bottom-left-radius: 0.25rem; }
.sp-bubble--out .sp-bubble__text { background: var(--mi-accent); color: var(--mi-on-accent); border-bottom-right-radius: 0.25rem; }
.sp-bubble__retry { justify-self: end; }
.sp-chat__compose { display: grid; gap: var(--mi-space-2); padding-top: var(--mi-space-3); border-top: 1px solid var(--mi-border); }
.sp-chat__compose-foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--mi-space-2) var(--mi-space-3); }
.sp-chat__compose-foot .sp-chat__count { flex: 1 1 12rem; }
.sp-chat__count { display: flex; flex-wrap: wrap; gap: 0 var(--mi-space-2); margin: 0; font-variant-numeric: tabular-nums; }
.sp-chat__key { display: inline-flex; align-items: center; gap: var(--mi-space-2); }
.sp-chat__key-label { color: var(--mi-text-muted); font-size: var(--mi-text-hint); }
.sp-chat__cannot { margin: 0; padding-top: var(--mi-space-3); border-top: 1px solid var(--mi-border); }
.sp-chat__none { max-width: 48rem; }
@media (max-width: 899.98px) {
  .sp-chat { grid-template-columns: minmax(0, 1fr); }
  .sp-chat[data-chat-open="true"] .sp-chat__list, .sp-chat[data-chat-open="false"] .sp-chat__thread { display: none; }
  .sp-chat__back { display: inline-flex; }
  .sp-bubble { max-width: 92%; }
}
