/* mx-it Design-Tokens — folgt mx-it_design.md v2.0 */

/* Sane defaults: padding/border zaehlen zur width, sonst sprengt jeder Input mit
   padding seinen Grid-Cell. Universell, da das nicht-default-Verhalten in heutigen
   Layouts immer der Quell von Bugs ist. */
*, *::before, *::after {
    box-sizing: border-box;
}

/* Inline-Hilfe per <details>/<summary>. Safari rendert sonst ein Default-Dreieck. */
details.info-toggle summary { outline: none; }
details.info-toggle summary::-webkit-details-marker { display: none; }
details.info-toggle summary::marker { content: ""; }

:root {
    --color-navy:       #151d32;
    --color-bg-light:   #f3f6fb;
    --color-white:      #ffffff;
    --color-grey:       #f2f2f2;
    --color-black:      #121212;
    --color-signal:     #476cf2;
    --gradient-primary: linear-gradient(135deg, #476cf2, #151d32);

    --color-teal:       #c4e3e5;
    --color-peach:      #f8dbad;
    --color-yellow:     #fafcc3;
    --color-pink:       #e79eb9;
    --color-sky:        #c3eeff;
    --color-lavender:   #d8b7de;

    --font-headlines: 'Poppins', system-ui, sans-serif;
    --font-body:      'Arimo', system-ui, sans-serif;
}

html, body {
    background-color: var(--color-bg-light);
    color: var(--color-navy);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6,
.font-poppins,
.btn,
.label,
.badge {
    font-family: var(--font-headlines);
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    font-weight: 500;
    font-size: 0.875rem;
    border-radius: 8px;
    padding: 0.625rem 1.25rem;
    border: none;
    cursor: pointer;
    transition: background 120ms ease, transform 80ms ease, box-shadow 120ms ease;
    text-decoration: none;
}
.btn-primary {
    background: var(--color-signal);
    color: var(--color-white);
}
.btn-primary:hover {
    background: #3a5cdb;
    box-shadow: 0 4px 16px rgba(71,108,242,0.35);
}
.btn-primary:active { transform: translateY(1px); }

.btn-secondary {
    background: var(--color-white);
    color: var(--color-navy);
    border: 1px solid rgba(21,29,50,0.12);
}
.btn-secondary:hover {
    background: var(--color-grey);
}

.btn-ghost {
    background: transparent;
    color: var(--color-navy);
}
.btn-ghost:hover {
    background: rgba(21,29,50,0.06);
}

/* Cards */
.card-light {
    background: var(--color-white);
    border-radius: 16px;
    padding: 1.5rem;
    box-shadow: 0 2px 12px rgba(21,29,50,0.08);
}
.card-dark {
    background: var(--color-navy);
    color: var(--color-white);
    border-radius: 16px;
    padding: 1.5rem;
}
.card-lg {
    border-radius: 24px;
    padding: 2rem;
}

/* Form */
.field-label {
    display: block;
    font-family: var(--font-headlines);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(21,29,50,0.7);
    margin-bottom: 0.375rem;
}
.field-input {
    display: block;
    width: 100%;
    padding: 0.625rem 0.875rem;
    background: var(--color-white);
    border: 1px solid rgba(21,29,50,0.16);
    border-radius: 8px;
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-navy);
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.field-input:focus {
    outline: none;
    border-color: var(--color-signal);
    box-shadow: 0 0 0 3px rgba(71,108,242,0.15);
}
.field-input::placeholder { color: rgba(21,29,50,0.4); }

textarea.field-input {
    resize: vertical;
    min-height: 6rem;
}

/* Badges */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    background: var(--color-signal);
    color: var(--color-white);
    font-size: 0.625rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    border-radius: 6px;
    padding: 0.25rem 0.625rem;
}
.badge-muted {
    background: rgba(21,29,50,0.08);
    color: var(--color-navy);
}
.badge-success { background: #2f9e6b; }
.badge-warning { background: #d98a1f; }

/* Akzentstreifen */
.accent-rule {
    height: 3px;
    background: var(--color-signal);
    border: none;
    margin: 1rem 0;
    width: 64px;
    border-radius: 2px;
}

/* Hero-Background (Login-Seiten) */
.hero-navy {
    background: var(--color-navy);
    background-image:
        radial-gradient(circle at 12% 18%, rgba(71,108,242,0.22) 0, transparent 40%),
        radial-gradient(circle at 88% 82%, rgba(196,227,229,0.10) 0, transparent 40%);
    color: var(--color-white);
}

/* Flash-Messages */
.flash {
    border-radius: 8px;
    padding: 0.75rem 1rem;
    font-size: 0.875rem;
    font-family: var(--font-body);
}
.flash-error {
    background: #fde7e7;
    color: #8a2020;
    border: 1px solid #f4b1b1;
}
.flash-success {
    background: #e3f5ec;
    color: #1f6b48;
    border: 1px solid #b6e0c8;
}
.flash-info {
    background: #e6edff;
    color: #1d3b9c;
    border: 1px solid #b9c8f4;
}

/* Sidebar / Nav */
.nav-link {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0.75rem;
    border-radius: 8px;
    color: rgba(255,255,255,0.72);
    font-family: var(--font-headlines);
    font-weight: 500;
    font-size: 0.875rem;
    text-decoration: none;
    transition: background 120ms ease, color 120ms ease;
}
.nav-link:hover {
    background: rgba(255,255,255,0.06);
    color: var(--color-white);
}
.nav-link.is-active {
    background: var(--color-signal);
    color: var(--color-white);
}

/* Tabellen */
.table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.9rem;
}
.table th {
    text-align: left;
    font-family: var(--font-headlines);
    font-weight: 500;
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(21,29,50,0.6);
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(21,29,50,0.08);
}
.table td {
    padding: 0.875rem 1rem;
    border-bottom: 1px solid rgba(21,29,50,0.06);
}
.table tr:last-child td { border-bottom: none; }
.table tr:hover td { background: rgba(71,108,242,0.04); }

/* Status-Pills */
.status-created    { background: rgba(21,29,50,0.08); color: var(--color-navy); }
.status-in_progress{ background: var(--color-yellow); color: #6b5b00; }
.status-submitted  { background: var(--color-sky); color: #114766; }
.status-imported   { background: #d4edda; color: #155724; }
.status-archived   { background: rgba(21,29,50,0.05); color: rgba(21,29,50,0.55); }

.status-pill {
    display: inline-flex;
    align-items: center;
    font-family: var(--font-headlines);
    font-size: 0.7rem;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    padding: 0.25rem 0.625rem;
    border-radius: 999px;
}

/* Toggle-Switch (Checkbox in schick) */
.toggle-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.625rem 0;
    border-bottom: 1px solid rgba(21,29,50,0.05);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row label {
    font-family: var(--font-body);
    font-size: 0.9rem;
    color: var(--color-navy);
    cursor: pointer;
    flex: 1;
}
.toggle-row .toggle-hint {
    display: block;
    font-size: 0.75rem;
    color: rgba(21,29,50,0.55);
    margin-top: 2px;
}
.toggle {
    position: relative;
    flex-shrink: 0;
    width: 38px;
    height: 22px;
    appearance: none;
    background: rgba(21,29,50,0.18);
    border-radius: 999px;
    transition: background 120ms ease;
    cursor: pointer;
}
.toggle::after {
    content: "";
    position: absolute;
    top: 2px; left: 2px;
    width: 18px; height: 18px;
    background: white;
    border-radius: 50%;
    box-shadow: 0 1px 3px rgba(0,0,0,0.18);
    transition: transform 140ms cubic-bezier(0.34, 1.56, 0.64, 1);
}
.toggle:checked { background: var(--color-signal); }
.toggle:checked::after { transform: translateX(16px); }
.toggle:disabled { opacity: 0.5; cursor: not-allowed; }

/* Inline-Hilfe: "?"-Icon mit Tooltip.
   Sichtbar bei Hover, Tastatur-Fokus und (per JS gesetzter) .show-Klasse fuer Tap.
   Tooltip oeffnet nach unten-rechts vom Icon → keine Beschneidung am Kartenrand. */
.help {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 16px;
    height: 16px;
    margin-left: 6px;
    border-radius: 50%;
    background: rgba(21,29,50,0.12);
    color: rgba(21,29,50,0.7);
    font-family: var(--font-headlines);
    font-weight: 700;
    font-size: 0.7rem;
    line-height: 1;
    cursor: help;
    user-select: none;
    vertical-align: middle;
    position: relative;
}
.help:hover, .help:focus { background: var(--color-signal); color: #fff; outline: none; }
.help::after {
    content: attr(data-tip);
    position: absolute;
    left: 0;
    top: calc(100% + 9px);
    width: max-content;
    max-width: 240px;
    background: var(--color-navy);
    color: #fff;
    font-family: var(--font-body);
    font-weight: 400;
    font-size: 0.78rem;
    line-height: 1.4;
    text-align: left;
    text-transform: none;
    letter-spacing: normal;
    white-space: normal;
    padding: 8px 11px;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(21,29,50,0.28);
    opacity: 0;
    visibility: hidden;
    transform: translateY(-3px);
    transition: opacity 0.12s ease, transform 0.12s ease;
    z-index: 60;
    pointer-events: none;
}
.help::before {
    content: "";
    position: absolute;
    left: 5px;
    top: calc(100% + 3px);
    border: 6px solid transparent;
    border-bottom-color: var(--color-navy);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.12s ease;
    z-index: 60;
}
.help:hover::after, .help:focus::after, .help.show::after,
.help:hover::before, .help:focus::before, .help.show::before {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}
/* Im "?"-Tooltip soll der toggle-row-Cursor nicht den help-Cursor ueberschreiben */
.toggle-row label .help { cursor: help; }

/* Section-Sub-Header innerhalb einer Card */
.subsection-header {
    font-family: var(--font-headlines);
    font-weight: 500;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: rgba(21,29,50,0.55);
    margin: 1.25rem 0 0.5rem 0;
    padding-bottom: 0.375rem;
    border-bottom: 1px solid rgba(21,29,50,0.08);
}

/* Kategorie-Grid */
.cat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 0.5rem 1.25rem;
}
.cat-row {
    display: flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(21,29,50,0.04);
}
.cat-row label {
    font-size: 0.9rem;
    cursor: pointer;
    flex: 1;
    color: var(--color-navy);
}
.cat-row .optional-tag {
    font-family: var(--font-headlines);
    font-size: 9px;
    text-transform: uppercase;
    color: rgba(21,29,50,0.5);
    letter-spacing: 0.05em;
}

/* ----- Onboarding-Layout mit Ansprechpartner-Sidebar -------------------- */
.onboarding-layout {
    display: grid;
    gap: 24px;
    grid-template-columns: 1fr;
    max-width: 1200px;
    margin: 0 auto;
}
.content-col   { min-width: 0; max-width: 720px; }
.contact-aside { min-width: 0; }

/* Ab Tablet-Portrait aufwaerts: 2-Spalten mit sticky Sidebar.
   Form-Spalte ist hart auf 720px begrenzt, sodass die Felder auf grossen
   Screens nicht ueber die ganze Breite gestreckt werden. Das Gesamt-Grid
   wird im Container zentriert. */
@media (min-width: 768px) {
    .onboarding-layout {
        grid-template-columns: minmax(0, 720px) 260px;
        justify-content: center;
    }
    .content-col   { grid-column: 1; grid-row: 1; max-width: none; }
    .contact-aside { grid-column: 2; grid-row: 1; }
    .contact-aside .contact-card { position: sticky; top: 80px; }
}

.contact-card {
    background: var(--color-white);
    border-radius: 12px;
    padding: 16px;
    box-shadow: 0 1px 3px rgba(21,29,50,0.06);
    border: 1px solid rgba(21,29,50,0.06);
}
.contact-card-title {
    font-family: var(--font-headlines);
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(21,29,50,0.55);
    margin: 0 0 12px;
}
.contact-team {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px 12px;
    margin-bottom: 12px;
}
.contact-person {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    text-align: center;
}
.contact-person img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    object-fit: cover;
    background: rgba(21,29,50,0.06);
}
.contact-person span {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--color-navy);
}
@media (min-width: 1024px) {
    .contact-team {
        grid-template-columns: 1fr;
        gap: 0;
        margin-bottom: 0;
    }
    .contact-person {
        flex-direction: row;
        align-items: center;
        gap: 14px;
        text-align: left;
        padding: 10px 0;
        border-bottom: 1px solid rgba(21,29,50,0.06);
    }
    .contact-person:last-child { border-bottom: none; }
    /* Im Desktop-Sidebar-Layout Foto + Name groesser darstellen — hier hat der
       Kunde beim Ausfuellen den (meist einzigen, zugewiesenen) Techniker im Blick. */
    .contact-person img { width: 80px; height: 80px; }
    .contact-person span { font-size: 1.1rem; }
}
.contact-channels {
    border-top: 1px solid rgba(21,29,50,0.06);
    padding-top: 10px;
    margin-top: 4px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.contact-link {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    padding: 4px 0;
}
.contact-link:hover .contact-link-value {
    text-decoration: underline;
}
.contact-link-label {
    font-family: var(--font-headlines);
    font-size: 0.65rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: rgba(21,29,50,0.5);
    margin-bottom: 2px;
}
.contact-link-value {
    font-size: 0.85rem;
    color: var(--color-signal);
    font-weight: 500;
}

/* WLAN-Slot */
.wifi-slot {
    background: rgba(21,29,50,0.03);
    border-radius: 12px;
    padding: 1rem;
    border: 1px solid rgba(21,29,50,0.06);
}
.wifi-slot + .wifi-slot { margin-top: 0.75rem; }

/* Sticky Save-Statusleiste oben */
.save-bar {
    position: sticky;
    top: 0;
    z-index: 30;
    background: var(--color-bg-light);
    border-bottom: 1px solid rgba(21,29,50,0.06);
    padding: 0.625rem 1.25rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
}
.save-bar .save-status {
    font-family: var(--font-body);
    font-size: 0.8rem;
    color: rgba(21,29,50,0.55);
}
.htmx-request .save-bar .save-status::before {
    content: "Speichere …";
    color: var(--color-signal);
}
.htmx-request .save-bar .save-status > * { display: none; }

/* Footer */
.site-footer {
    color: rgba(21,29,50,0.55);
    font-size: 0.75rem;
    font-family: var(--font-body);
    text-align: center;
    padding: 1.5rem 1rem;
}
.site-footer a { color: inherit; text-decoration: underline; }
