/*
 * lavitto ag corporate identity: primary #333F48, inverted #D0D3D4 (dark surfaces),
 * secondary #279989 (accent only). Fira Sans is self-hosted, see /fonts/OFL.txt.
 */

/* Absolute paths on purpose: /fonts/ is a plain public/ directory, not part
   of the asset mapper's managed paths, so it must not be rewritten. */
@font-face {
    font-family: "Fira Sans";
    font-weight: 300;
    font-style: normal;
    font-display: swap;
    src: url("/fonts/FiraSans-Light.woff2") format("woff2");
}

@font-face {
    font-family: "Fira Sans";
    font-weight: 400;
    font-style: normal;
    font-display: swap;
    src: url("/fonts/FiraSans-Regular.woff2") format("woff2");
}

@font-face {
    font-family: "Fira Sans";
    font-weight: 600;
    font-style: normal;
    font-display: swap;
    src: url("/fonts/FiraSans-SemiBold.woff2") format("woff2");
}

:root {
    color-scheme: light;

    --color-ink: #333f48;
    --color-ink-soft: #5e6a73;
    --color-accent: #279989;
    --color-accent-ink: #1f7a6e;
    /* Filled badges with white 12px text: #279989 reaches only 3.5:1, this 5.2:1
       (WCAG AA 4.5:1). The same in dark mode - the text sits on the badge, not on
       the page. */
    --color-badge-strong: #1f7a6e;
    --color-success-bg: #e6f4f1;
    --color-page: #f6f7f7;
    --color-panel: #ffffff;
    --color-panel-alt: #fafbfb;
    --color-border: #dde0e1;
    --color-danger: #b3261e;
    --color-danger-bg: #fbe9e7;
    --color-warning: #8a6100;
    --color-warning-bg: #fff4d6;
    --color-action: #333f48;
    --color-action-hover: #242d34;
    --color-action-ink: #ffffff;

    --shell-header-height: 3.25rem;
    --shell-tabbar-height: 4rem;
    --content-max-width: 68rem;
}

@media (prefers-color-scheme: dark) {
    :root {
        color-scheme: dark;
        --color-ink: #e4e7e8;
        --color-ink-soft: #a3adb3;
        --color-accent-ink: #4fc3b1;
        --color-success-bg: #1d3633;
        --color-page: #1c2328;
        --color-panel: #242d34;
        --color-panel-alt: #2a343c;
        --color-border: #3a4750;
        --color-danger: #ff8a80;
        --color-danger-bg: #3b2323;
        --color-warning: #ffcf5c;
        --color-warning-bg: #453711;
        --color-action: #d0d3d4;
        --color-action-hover: #ffffff;
        --color-action-ink: #1c2328;
    }
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    -webkit-text-size-adjust: 100%;
}

body {
    margin: 0;
    font: 300 15px/1.55 "Fira Sans", system-ui, sans-serif;
    color: var(--color-ink);
    background: var(--color-page);
    /* Any word longer than its line breaks instead of widening the page – with every
       text size and page zoom a phone may use (decision Philipp, 23.09.2026). */
    overflow-wrap: break-word;
}

h1,
h2,
h3,
strong,
th {
    font-weight: 600;
}

h1 {
    margin: 0 0 0.3rem;
    font-size: 1.6rem;
    line-height: 1.25;
    /* A customer name like "Kirchgemeindeverband" is one word wider than a phone:
       unbroken, it widened the whole page (measured 23.09.2026, 352px at 320/360). */
    overflow-wrap: break-word;
    hyphens: auto;
}

a {
    color: var(--color-accent-ink);
    text-decoration: none;
}

a:hover {
    text-decoration: underline;
}

/* Text for screen readers only — it must stay in the flow, so no display: none. */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    margin: -1px;
    padding: 0;
    overflow: hidden;
    clip-path: inset(50%);
    white-space: nowrap;
}

.app-shell {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header, variant B: brand on a light panel, accent rule underneath. */
.app-header {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    padding: 0.7rem 1.5rem;
    padding-top: max(0.7rem, env(safe-area-inset-top));
    background: var(--color-panel);
    border-bottom: 3px solid var(--color-accent);
    position: sticky;
    top: 0;
    z-index: 10;
    /* With a large text size brand and "Abmelden" no longer fit side by side:
       the logout moves to a second line instead of out of the screen. */
    flex-wrap: wrap;
    row-gap: 0.4rem;
}

.app-brand {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    color: var(--color-ink);
    font-weight: 600;
}

.app-brand:hover {
    text-decoration: none;
}

/* Official lavitto wordmark (see templates/partials/_brand_mark.html.twig);
   the <picture> element swaps in the light-on-dark colour variant itself. */
.app-brand-mark {
    display: block;
    height: 26px;
    width: auto;
}

.app-brand-suffix {
    white-space: nowrap;
}

.app-nav {
    display: flex;
    gap: 1.5rem;
    margin-left: auto;
}

.app-nav a {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--color-ink);
    white-space: nowrap;
}

.app-nav a[aria-current="page"] {
    color: var(--color-accent-ink);
    font-weight: 600;
}

.app-nav-icon {
    display: none;
    width: 22px;
    height: 22px;
    fill: currentColor;
}

.app-nav-label-short {
    display: none;
}

.app-logout {
    margin: 0;
}

.app-logout button {
    background: none;
    border: 0;
    padding: 0;
    font: inherit;
    color: var(--color-ink-soft);
    cursor: pointer;
}

.app-logout button:hover {
    text-decoration: underline;
}

.app-main {
    flex: 1;
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1.75rem 1.5rem;
}

.app-flash {
    padding: 0.7rem 1rem;
    margin: 0 0 1.25rem;
    border-left: 4px solid var(--color-ink);
    background: var(--color-panel);
}

.app-flash-error {
    border-color: var(--color-danger);
    background: var(--color-danger-bg);
}

/* Success and info differ in colour and in a leading sign, so the difference
   does not rest on colour alone. The sign is decoration: empty alt text. */
.app-flash-success {
    border-color: var(--color-accent);
    background: var(--color-success-bg);
}

.app-flash-success::before {
    content: "✓ " / "";
    font-weight: 600;
    color: var(--color-accent-ink);
}

.app-flash-info {
    border-color: var(--color-ink-soft);
}

.app-flash-info::before {
    content: "i " / "";
    font-weight: 600;
    font-style: italic;
    color: var(--color-ink-soft);
}

/* Authentication pages: centred card, no chrome. */
.auth-card {
    max-width: 24rem;
    margin: 10vh auto;
    padding: 2rem;
    background: var(--color-panel);
    border-top: 4px solid var(--color-accent);
}

.auth-card h1 {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    font-size: 1.15rem;
    margin-bottom: 1.25rem;
}

.auth-card h1 .app-brand-mark {
    height: 22px;
}

/* On the login card the name may wrap ("Kunden-/Cockpit") – the header keeps it on one line. */
.auth-card h1 .app-brand-suffix {
    white-space: normal;
    min-width: 0;
    overflow-wrap: anywhere;
}

.auth-card p {
    color: var(--color-ink-soft);
}

form label {
    display: block;
    margin: 0.9rem 0 0.3rem;
}

input[type="text"],
input[type="email"],
input[type="password"] {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
}

input:focus-visible,
button:focus-visible,
a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.btn {
    display: inline-block;
    margin-top: 1.1rem;
    padding: 0.6rem 1.2rem;
    min-height: 44px;
    border: 0;
    border-radius: 3px;
    background: var(--color-action);
    color: var(--color-action-ink);
    font: inherit;
    font-weight: 600;
    cursor: pointer;
    /* Never wider than the screen, even with a very large text size. */
    max-width: 100%;
    overflow-wrap: anywhere;
}

.btn:hover {
    background: var(--color-action-hover);
}

/* Cloudflare Turnstile: landscape (65px high) across the card, compact square
   (150 x 140px) only below 300px card width - see assets/scripts/turnstile.js.
   The space is reserved before the widget is drawn, so the buttons do not jump. */
.cf-turnstile {
    margin-top: 1.1rem;
    min-height: 65px;
    width: 100%;
    max-width: 100%;
}

.cf-turnstile-compact {
    min-height: 140px;
}

/* Footer on every page: contact and legal links, quiet, wrapping on a phone. */
.app-footer {
    width: 100%;
    max-width: var(--content-max-width);
    margin: 0 auto;
    padding: 1rem 1.5rem 1.5rem;
    border-top: 1px solid var(--color-border);
    font-size: 0.82rem;
    color: var(--color-ink-soft);
}

.app-footer-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 1.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.app-footer-links li {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Keeps the screen reader text of an external link inside the link. */
.app-footer-links a {
    position: relative;
    color: var(--color-ink-soft);
}

/* Primary action plus a light secondary one side by side; they wrap below each
   other when the card is too narrow. */
.form-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.6rem;
    margin-top: 1.1rem;
}

.form-actions .btn {
    margin-top: 0;
}

.btn-secondary {
    background: transparent;
    color: var(--color-accent-ink);
    border: 1px solid var(--color-border);
    font-weight: 400;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
}

.btn-secondary:hover {
    background: var(--color-panel-alt);
    text-decoration: none;
}

/* Turnstile could not load (no JavaScript, blocker): a visible warning, not an error
   - the form is still there. */
.turnstile-hint {
    margin: 0.6rem 0 0;
    padding: 0.5rem 0.75rem;
    border-left: 4px solid var(--color-warning);
    background: var(--color-warning-bg);
    font-size: 0.9rem;
}

.turnstile-hint[hidden] {
    display: none;
}

/* Secondary link below an auth form ("Kein Login?", "Zurück zur Anmeldung"). */
.auth-alt {
    margin: 1.25rem 0 0;
}

/* Login / onboarding details. */
.auth-step {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.totp-qr {
    display: block;
    width: 240px;
    max-width: 100%;
    height: auto;
    margin: 1rem auto;
    background: #fff;
}

.totp-secret {
    font-family: ui-monospace, monospace;
    font-size: 0.95rem;
    word-spacing: 0.2em;
    overflow-wrap: anywhere;
}

.auth-cancel {
    margin-top: 1.25rem;
}

.auth-cancel button {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-ink-soft);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
}

/* Customer pages. */
.page-intro,
.import-date,
.muted {
    color: var(--color-ink-soft);
}

.import-date {
    margin: 0 0 1.5rem;
    font-size: 0.9rem;
}

h2 {
    margin: 0 0 0.8rem;
    font-size: 1.15rem;
}

h3 {
    margin: 0 0 0.6rem;
    font-size: 1rem;
}

.panel {
    margin: 0 0 1.5rem;
    padding: 1.25rem 1.5rem;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-radius: 3px;
}

.managed-servers > h2 {
    margin-top: 0.5rem;
}

.facts,
.hosting-facts {
    display: grid;
    gap: 0.5rem 1.5rem;
    margin: 0;
}

/* min(…, 100%): a column is never wider than its panel, whatever the text size –
   a bare rem minimum grew with the font and pushed the page sideways. */
.facts {
    grid-template-columns: repeat(auto-fit, minmax(min(14rem, 100%), 1fr));
}

.hosting-facts {
    grid-template-columns: repeat(auto-fit, minmax(min(9.5rem, 100%), 1fr));
    margin-top: 0.5rem;
}

.facts dt,
.hosting-facts dt {
    font-size: 0.8rem;
    color: var(--color-ink-soft);
}

.facts > div,
.hosting-facts > div {
    min-width: 0;
}

/* Data fields hold mail addresses, package names and host names: break anywhere. */
.facts dd,
.hosting-facts dd {
    margin: 0;
    overflow-wrap: anywhere;
}

.address-line {
    display: block;
}

.hosting-list,
.customer-picker {
    list-style: none;
    margin: 0;
    padding: 0;
}

.hosting-group + .hosting-group,
.hosting-list > li + li {
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.hosting-title {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
}

/* A flex item never shrinks below its longest word by default – and an instance or
   server name is one long word. Let it shrink and break instead of widening the page. */
.hosting-title > *,
.back-links a,
.admin-subnav a,
.admin-list a,
.admin-list strong,
.admin-list span,
.admin-assign-form label {
    min-width: 0;
    overflow-wrap: anywhere;
}

.hosting-link {
    font-weight: 600;
    overflow-wrap: anywhere;
}

.hosting-server {
    font-size: 0.8rem;
    color: var(--color-ink-soft);
}

.hosting-domains {
    list-style: none;
    margin: 0.3rem 0 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem 0.9rem;
    font-size: 0.85rem;
}

.hosting-domains a {
    overflow-wrap: anywhere;
}

.tech-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.tech-list li {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.4rem;
}

.tech-support {
    font-size: 0.8rem;
    color: var(--color-ink-soft);
}

.server-specs {
    margin: 0.2rem 0 0.8rem;
    font-size: 0.85rem;
    color: var(--color-ink-soft);
}

.badge {
    display: inline-block;
    padding: 0.05rem 0.45rem;
    border-radius: 3px;
    font-size: 0.75rem;
    font-weight: 600;
    line-height: 1.5;
    vertical-align: middle;
}

.env-badge {
    background: var(--color-panel-alt);
    border: 1px solid var(--color-border);
    color: var(--color-ink-soft);
    letter-spacing: 0.04em;
}

.footnote-mark {
    margin-left: 0.1em;
    color: var(--color-ink-soft);
}

.level-footnote {
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--color-ink-soft);
}

.outdated-badge {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.unmaintained-badge {
    background: var(--color-panel-alt);
    border: 1px solid var(--color-border);
    color: var(--color-ink-soft);
}

.is-unknown {
    color: var(--color-ink-soft);
    font-style: italic;
}

/* Service levels: the keyword comparison, then one collapsible block per
   level. Stacked, not side by side — an opened block would otherwise stretch
   its neighbours to its height. */
.level-texts {
    display: grid;
    /* minmax(0, 1fr), not auto: an opened block must not widen the column to its
       longest word at a large text size (found once layout-check measured the
       blocks opened, 30.09.2026). */
    grid-template-columns: minmax(0, 1fr);
    gap: 0.5rem;
    margin: 1.25rem 0 0;
}

.level-common {
    margin: 1.25rem 0 0;
    max-width: 42rem;
}

.level-common h3 {
    margin: 0 0 0.25rem;
    font-size: 1rem;
}

.level-common p {
    margin: 0;
}

.level-description {
    padding-left: 0.8rem;
    border-left: 3px solid var(--color-border);
}

.level-description summary {
    display: flex;
    flex-wrap: wrap;
    align-items: baseline;
    gap: 0.2rem 0.5rem;
    padding: 0.2rem 0;
    cursor: pointer;
    list-style: none;
}

.level-description summary::-webkit-details-marker {
    display: none;
}

/* Our own marker, so it sits in line with the wrapping title on every browser. */
.level-description summary::before {
    content: "▸";
    color: var(--color-ink-soft);
    transition: transform 0.15s ease;
}

.level-description[open] summary::before {
    transform: rotate(90deg);
}

.level-description summary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.level-name {
    font-weight: 600;
}

.level-description summary > *,
.level-details-text {
    min-width: 0;
    overflow-wrap: anywhere;
}

.level-summary {
    color: var(--color-ink-soft);
}

.level-text {
    margin: 0.15rem 0 0;
    color: var(--color-ink-soft);
}

.level-details-text {
    margin: 0.15rem 0 0.4rem;
    max-width: 42rem;
}

/* The table scrolls sideways when a screen is too narrow for four columns.
   Keyboard users reach the scroll area itself, hence the focus ring. */
.level-scroller {
    /* Containing block for the screen-reader notes in the body cells: without it
       their absolute boxes escaped the scroll area and widened the page to 401px. */
    position: relative;
    overflow-x: auto;
    overscroll-behavior-x: contain;
}

.level-scroller:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.level-table {
    width: 100%;
    /* Separate borders on purpose: a sticky cell loses its border under
       border-collapse, and the first column is sticky while scrolling. */
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.9rem;
}

.level-table th,
.level-table td {
    padding: 0.4rem 0.6rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
    vertical-align: top;
}

.level-table thead th {
    font-size: 0.95rem;
    white-space: nowrap;
    /* Holds the screen-reader-only note inside the cell: an absolute box at its
       static position would otherwise widen the whole document by its 1px. */
    position: relative;
}

.level-table td.level-column,
.level-table thead th.level-column {
    text-align: center;
    width: 6.5rem;
}

.level-table tbody th {
    font-weight: 400;
    color: var(--color-ink-soft);
}

.level-table th:first-child {
    position: sticky;
    left: 0;
    min-width: 11rem;
    /* Opaque, so scrolled cells pass behind it; the rule marks the edge they
       disappear at. */
    background: var(--color-panel);
    border-right: 1px solid var(--color-border);
}

/* The one place colour carries meaning in the table: what a level includes. */
.level-table .is-included {
    color: var(--color-accent-ink);
    font-weight: 600;
}

.level-table .is-excluded {
    color: var(--color-ink-soft);
}

/* Shown only where the table really does scroll (see the phone breakpoint). */
.level-scroll-hint {
    display: none;
    margin: 0.4rem 0 0;
    font-size: 0.8rem;
    color: var(--color-ink-soft);
}

.customer-picker li + li {
    margin-top: 0.6rem;
}

.customer-picker a {
    display: flex;
    flex-direction: column;
    padding: 0.9rem 1.2rem;
    min-height: 44px;
    background: var(--color-panel);
    border: 1px solid var(--color-border);
    border-left: 4px solid var(--color-accent);
    border-radius: 3px;
    color: var(--color-ink);
}

.customer-picker a:hover {
    text-decoration: none;
    border-color: var(--color-accent);
}

.customer-number {
    font-size: 0.85rem;
    color: var(--color-ink-soft);
}

.back-links {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    margin-bottom: 0.8rem;
    font-size: 0.9rem;
}

.back-links a::before {
    content: "← ";
}

.error-page h1 {
    font-size: 1.15rem;
}

/* Switcher between the customers of one user: a secondary control, so it sits
   quietly in one line above the title instead of claiming the page's width. */
.customer-switcher {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-end;
    align-items: center;
    gap: 0.3rem 0.5rem;
    margin: 0 0 0.6rem;
    font-size: 0.82rem;
}

.customer-switcher-label {
    color: var(--color-ink-soft);
}

.customer-switcher select {
    flex: 0 1 12rem;
    min-width: 0;
    /* WebKit (every iOS browser) counts the selected option's full text as overflow
       even when the box is narrower: a long customer name widened the page to 554px at
       390px (23.09.2026). overflow: hidden has no effect on a select there; paint
       containment clips the text to the box like Chromium does. The full name stays
       in the option list and in the heading below. */
    contain: paint;
    font: inherit;
    font-size: 0.82rem;
    padding: 0.25rem 0.4rem;
    min-height: 32px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
}

.customer-switcher button {
    padding: 0.25rem 0.7rem;
    min-height: 32px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
    font: inherit;
    font-size: 0.82rem;
    cursor: pointer;
}

.customer-switcher button:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
}

/* Admin area. */
textarea {
    width: 100%;
    font: inherit;
    font-size: 16px;
    padding: 0.55rem 0.65rem;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
    resize: vertical;
}

.admin-subnav {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem 0.6rem;
    margin: 0 0 1.25rem;
    font-size: 0.9rem;
}

.admin-subnav a {
    padding: 0.3rem 0.7rem;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
}

.admin-subnav a[aria-current="page"] {
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
    font-weight: 600;
}

.admin-search {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
    margin: 0 0 1.25rem;
}

.admin-search label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-ink-soft);
}

.admin-search input {
    min-width: min(14rem, 100%);
}

.admin-search .btn,
.admin-list .btn {
    margin-top: 0;
}

.admin-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.admin-list > li {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--color-border);
}

.admin-list > li:last-child {
    border-bottom: 0;
}

.admin-list > li > a {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.5rem;
    color: var(--color-ink);
}

.admin-list > li:has(form) {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.8rem;
}

.admin-actions form,
.user-customers form {
    margin: 0;
}

.btn-danger {
    background: var(--color-danger);
}

.btn-link {
    padding: 0;
    border: 0;
    background: none;
    color: var(--color-ink-soft);
    font: inherit;
    text-decoration: underline;
    cursor: pointer;
    min-height: 44px;
}

.status-badge.status-active {
    background: var(--color-badge-strong);
    color: #fff;
}

.status-badge.status-invited {
    background: var(--color-panel-alt);
    border: 1px solid var(--color-border);
    color: var(--color-ink-soft);
}

.status-badge.status-locked {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

/* Access requests: the details column may shrink, the actions wrap below it. */
.access-request-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1 1 min(16rem, 100%);
    min-width: 0;
}

.status-badge.status-open {
    background: var(--color-panel-alt);
    border: 1px solid var(--color-border);
    color: var(--color-ink-soft);
}

.status-badge.status-handled {
    background: var(--color-badge-strong);
    color: #fff;
}

.admin-assign-form {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: 0.6rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--color-border);
}

.admin-assign-form label {
    margin: 0;
    font-size: 0.85rem;
    color: var(--color-ink-soft);
}

.admin-assign-form input {
    max-width: 12rem;
}

.invitation-url {
    font-family: ui-monospace, monospace;
    overflow-wrap: anywhere;
}

.admin-log-details {
    margin: 0.4rem 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.85rem;
    color: var(--color-ink-soft);
}

.admin-pagination {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1.25rem;
    font-size: 0.9rem;
}

/* Phones: bottom tab bar instead of a horizontal nav, compact header. */
@media (max-width: 760px) {
    .app-header {
        padding: 0.55rem 1rem;
        padding-top: max(0.55rem, env(safe-area-inset-top));
    }

    .app-header .app-brand-mark {
        height: 22px;
    }

    .app-header .app-brand-suffix {
        font-size: 0.9rem;
    }

    .app-logout {
        margin-left: auto;
    }

    .app-nav {
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 20;
        margin: 0;
        gap: 0;
        background: var(--color-panel);
        border-top: 1px solid var(--color-border);
        padding-bottom: env(safe-area-inset-bottom);
    }

    .app-nav a {
        flex: 1;
        flex-direction: column;
        justify-content: center;
        gap: 2px;
        min-height: var(--shell-tabbar-height);
        font-size: 0.72rem;
        color: var(--color-ink-soft);
        border-top: 2px solid transparent;
    }

    .app-nav a:hover {
        text-decoration: none;
    }

    .app-nav a[aria-current="page"] {
        border-top-color: var(--color-accent);
    }

    .app-nav-icon {
        display: block;
    }

    .app-nav-label-long {
        display: none;
    }

    .app-nav-label-short {
        display: inline;
    }

    /* The fixed tab bar covers the bottom of the page: the footer, the last
       element, keeps clear of it. */
    .app-shell.has-nav .app-footer {
        padding-bottom: calc(var(--shell-tabbar-height) + env(safe-area-inset-bottom) + 1rem);
    }

    .app-main {
        padding: 1rem;
    }

    .auth-card {
        margin: 1.5rem auto;
        padding: 1.5rem 1.25rem;
    }

    .panel {
        padding: 1rem;
    }

    /* 16px keeps iOS from zooming into the select on focus; the button needs no
       such treatment. Only the height grows, so the row stays one line. */
    .customer-switcher select {
        flex: 0 1 9rem;
        font-size: 16px;
        min-height: 36px;
    }

    .customer-switcher button {
        min-height: 36px;
    }

    .level-table {
        font-size: 0.85rem;
    }

    .level-table th,
    .level-table td {
        padding: 0.4rem 0.45rem;
    }

    .level-table th:first-child {
        min-width: 9.5rem;
    }

    .level-table td.level-column,
    .level-table thead th.level-column {
        width: 4.5rem;
    }
}

/* Very narrow phones (320px, e.g. iPhone display zoom): brand, "Kunden-Cockpit" and
   "Abmelden" need 338px, so the suffix gives way; the logo still names the app. */
@media (max-width: 380px) {
    .app-header .app-brand-suffix {
        display: none;
    }
}

/* Below this width the comparison no longer fits next to its labels — measured
   22.09.2026: it scrolls at 414px and fits from 440px on. Only there does the
   hint appear, so it never announces a scroll that is not happening. */
@media (max-width: 430px) {
    .level-scroll-hint {
        display: block;
    }
}

/* Customer tabs: one page per tab, the open one marked with aria-current. */
.customer-tabs {
    margin: 0 0 1.25rem;
    border-bottom: 1px solid var(--color-border);
    overflow-x: auto;
}

.customer-tabs ul {
    display: flex;
    gap: 0.25rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.customer-tabs a {
    display: block;
    padding: 0.55rem 0.9rem;
    border-bottom: 3px solid transparent;
    color: var(--color-ink-soft);
    text-decoration: none;
    white-space: nowrap;
}

.customer-tabs a:hover {
    color: var(--color-ink);
}

.customer-tabs a[aria-current="page"] {
    border-bottom-color: var(--color-accent);
    color: var(--color-ink);
    font-weight: 600;
}

.customer-tabs a:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: -2px;
}

/* Hosting detail: open findings and "was wir gemacht haben". */
.hosting-status {
    margin: 0.25rem 0 0;
}

.findings-next {
    font-weight: 600;
}

.findings-details summary {
    cursor: pointer;
}

.findings-details ul,
.activity-list {
    padding-left: 1.2rem;
}

.activity-list {
    list-style: none;
    padding-left: 0;
}

/* Three aligned columns: when · hosting · what (the admin list adds the customers
   before the text). Fixed rem tracks instead of content-sized ones, so every row and
   every month group lines up the same. Which layout applies depends on the list's own
   width (container query, rem-based), so a large text size switches to the stacked
   layout just like a narrow phone does. */
.activity-list {
    container-type: inline-size;
}

.activity-item {
    display: grid;
    grid-template-columns: 9.5rem 13rem minmax(0, 1fr);
    column-gap: 0.75rem;
    row-gap: 0.1rem;
    align-items: baseline;
    padding: 0.35rem 0;
    border-top: 1px solid var(--color-border);
}

.activity-list--customers .activity-item {
    grid-template-columns: 9.5rem 11rem 11rem minmax(0, 1fr);
}

/* The hosting page lists one hosting only: date and text, no hosting column. */
.activity-list--no-hosting .activity-item {
    grid-template-columns: 9.5rem minmax(0, 1fr);
}

/* Grid items never shrink below their longest word on their own: long instance
   names, customer names and version strings wrap instead of widening the page. */
.activity-item > * {
    min-width: 0;
    overflow-wrap: anywhere;
}

.activity-item time,
.activity-item .activity-customers {
    color: var(--color-ink-soft);
}

/* A customer note written as points ("Shlink 4.4.2 → 4.4.6 · Sicherheitslücke
   geschlossen") - one line per point. */
.activity-points {
    margin: 0;
    padding-left: 1.1rem;
    list-style: disc;
}

/* "Alle Pakete (n)" under a customer note: folded, one line per package, the
   same marker as the level descriptions. */
.activity-packages summary {
    display: inline-flex;
    gap: 0.4rem;
    max-width: 100%;
    padding: 0.15rem 0;
    color: var(--color-ink-soft);
    cursor: pointer;
    list-style: none;
}

.activity-packages summary::-webkit-details-marker {
    display: none;
}

.activity-packages summary::before {
    content: "▸";
    transition: transform 0.15s ease;
}

.activity-packages[open] summary::before {
    transform: rotate(90deg);
}

.activity-packages summary:focus-visible {
    outline: 2px solid var(--color-accent);
    outline-offset: 2px;
}

.activity-packages ul {
    margin: 0;
    padding-left: 1.1rem;
    list-style: disc;
}

.activity-packages li {
    min-width: 0;
    overflow-wrap: anywhere;
}

/* Narrow: date and hosting on the first line, the text across the full width below.
   No staircase - every text starts at the left edge. */
@container (max-width: 40rem) {
    .activity-item,
    .activity-list--customers .activity-item,
    .activity-list--no-hosting .activity-item {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .activity-item .activity-customers,
    .activity-item .activity-text {
        grid-column: 1 / -1;
    }
}

@container (min-width: 40.01rem) and (max-width: 56rem) {
    .activity-list--customers .activity-item {
        grid-template-columns: max-content minmax(0, 1fr);
    }

    .activity-list--customers .activity-item .activity-customers,
    .activity-list--customers .activity-item .activity-text {
        grid-column: 1 / -1;
    }
}

/* Very narrow at a large text size: even date and hosting get a line each. */
@container (max-width: 20rem) {
    .activity-item,
    .activity-list--customers .activity-item,
    .activity-list--no-hosting .activity-item {
        grid-template-columns: minmax(0, 1fr);
    }
}

/* Colour is never the only signal — the severity label (hoch/mittel/tief) always
   accompanies it. */
.severity-high {
    background: var(--color-danger-bg);
    color: var(--color-danger);
}

.severity-medium {
    background: var(--color-warning-bg);
    color: var(--color-warning);
}

/* "Verlauf": month groups and the filter above them (24.09.2026). */
.activity-month + .activity-month {
    margin-top: 1rem;
}

.activity-month h2 {
    font-size: 1rem;
    margin: 0 0 0.3rem;
}

.activity-filter {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
    margin: 0 0 1rem;
}

.activity-filter select {
    flex: 0 1 16rem;
    min-width: 0;
    /* Same WebKit trap as the customer switcher: the selected option's text counts
       as overflow unless painting is contained to the box. */
    contain: paint;
    font: inherit;
    padding: 0.25rem 0.4rem;
    min-height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
}

.activity-filter button {
    max-width: 100%;
    padding: 0.25rem 0.7rem;
    min-height: 36px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    background: var(--color-panel);
    color: var(--color-ink);
    font: inherit;
    cursor: pointer;
}

.activity-filter button:hover {
    border-color: var(--color-accent);
    color: var(--color-accent-ink);
}

/* Measurement day under the disk usage, on its own line. */
.disk-usage-measured {
    display: block;
}

/* A link styled as a button (confirmation pages for account actions). */
a.btn {
    color: var(--color-action-ink);
    text-decoration: none;
}

a.btn:hover {
    color: var(--color-action-ink);
    text-decoration: none;
}

a.btn.btn-secondary,
a.btn.btn-secondary:hover {
    color: var(--color-accent-ink);
}

/* The delete stays apart from every other account action. */
.danger-zone {
    border-color: var(--color-danger);
}

.danger-zone > h2 {
    color: var(--color-danger);
}

.danger-zone p {
    margin: 0;
}

.user-confirm-account strong,
.requested-customer-number {
    overflow-wrap: anywhere;
}

.user-confirm-consequences {
    margin: 0 0 1rem;
    padding-left: 1.2rem;
}

.user-confirm-consequences li + li {
    margin-top: 0.4rem;
}

.user-confirm input[name="confirm_email"] {
    max-width: 100%;
}
