/* Allix Corporate Identity — Tokens aus MARKENGUIDE.md (allix-switzerland/allix-web) */
:root {
  --ax-red: #A22E43;
  --ax-red-dark: #8C283C;
  --ax-red-light: #B64558;
  --ax-red-tint: #F7ECEF;
  --ax-slate: #344149;
  --ax-slate-deep: #232C32;
  --ax-slate-muted: #5C6B74;
  /* Semantisches Grün für Erfolgsmeldungen — kein Markenton, aber Weinrot
     signalisiert «Fehler»; Erfolge müssen sich davon klar abheben. */
  --ax-green-dark: #2C6E49;
  --ax-green-light: #5C9971;
  --ax-green-tint: #ECF5EF;
  --ax-gray: #F1F1F1;
  --ax-border: #E3E6E8;
  --ax-white: #FFFFFF;

  --radius-btn: 10px;
  --radius-card: 16px;
  --shadow-card: 0 1px 2px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.08);
  --container-page: 1240px;

  --font-sans: "Source Sans 3", system-ui, -apple-system, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.65;
  color: var(--ax-slate);
  background: var(--ax-gray);
  /* Kein «Wischen = zurück/vorwärts» auf Touchpad/Touchscreen: eine horizontale
     Wischgeste (z. B. nach dem Öffnen der Kamera oder des Datei-Dialogs im
     Arbeitsrapport) darf nicht versehentlich zur vorherigen Seite navigieren
     und den halbfertigen Rapport verwerfen. */
  overscroll-behavior-x: none;
}

h1, h2, h3 { font-weight: 400; letter-spacing: -0.01em; color: var(--ax-slate); margin: 0 0 0.5em; }
h1 { font-size: clamp(1.75rem, 3vw, 2.5rem); }
h2 { font-size: 1.5rem; }
a { color: var(--ax-red); text-decoration: none; }
a:hover { text-decoration: underline; }

.ax-eyebrow {
  font-size: 0.8125rem; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--ax-red);
}

/* Buttons */
.ax-btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.5rem;
  padding: 0.6rem 1.2rem; border-radius: var(--radius-btn); border: 1px solid transparent;
  font: inherit; font-weight: 600; cursor: pointer; transition: background 0.15s, border-color 0.15s;
}
.ax-btn-primary { background: var(--ax-red); color: var(--ax-white); }
.ax-btn-primary:hover:not(:disabled) { background: var(--ax-red-dark); text-decoration: none; }
.ax-btn-primary:disabled { opacity: 0.55; cursor: default; }
.ax-btn-ghost { background: transparent; border-color: var(--ax-border); color: var(--ax-slate); }
.ax-btn-ghost:hover { background: var(--ax-gray); text-decoration: none; }

/* Cards */
.ax-card {
  background: var(--ax-white); border: 1px solid var(--ax-border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-card); padding: 1.5rem;
}

/* Inputs */
.ax-field { display: block; margin-bottom: 1rem; }
.ax-field label { display: block; font-size: 0.875rem; color: var(--ax-slate-muted); margin-bottom: 0.35rem; }
.ax-input {
  width: 100%; padding: 0.6rem 0.75rem; font: inherit;
  border: 1px solid var(--ax-border); border-radius: var(--radius-btn); background: var(--ax-white);
}
.ax-input:focus { outline: none; border-color: var(--ax-red); box-shadow: 0 0 0 3px var(--ax-red-tint); }

/* Tabelle */
.ax-table { width: 100%; border-collapse: collapse; background: var(--ax-white); }
.ax-table th, .ax-table td { text-align: left; padding: 0.7rem 0.9rem; border-bottom: 1px solid var(--ax-border); }
.ax-table th { font-size: 0.8125rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--ax-slate-muted); }
.ax-table tbody tr:hover { background: var(--ax-gray); }

.ax-chip {
  display: inline-block; padding: 0.15rem 0.6rem; border-radius: 999px;
  background: var(--ax-red-tint); color: var(--ax-red); font-size: 0.8125rem; font-weight: 600;
}

.ax-alert-error {
  background: var(--ax-red-tint); color: var(--ax-red-dark);
  border: 1px solid var(--ax-red-light); border-radius: var(--radius-btn); padding: 0.7rem 1rem; margin-bottom: 1rem;
}

.ax-alert-success {
  background: var(--ax-green-tint); color: var(--ax-green-dark);
  border: 1px solid var(--ax-green-light); border-radius: var(--radius-btn); padding: 0.7rem 1rem; margin-bottom: 1rem;
}

/* Hilfe-Wiki: Baum-Navigation links, Inhalt rechts */
.hilfe-layout { display: flex; gap: 1.25rem; align-items: flex-start; }
.hilfe-nav { width: 280px; flex-shrink: 0; position: sticky; top: 1rem; padding: 1rem; }
.hilfe-nav .kapitel {
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ax-slate-muted); margin: 0.9rem 0 0.25rem;
}
.hilfe-nav a { display: block; padding: 0.3rem 0.5rem; border-radius: 6px; color: var(--ax-slate); font-size: 0.9375rem; }
.hilfe-nav a:hover { background: var(--ax-gray); text-decoration: none; }
.hilfe-nav a.aktiv { background: var(--ax-red-tint); color: var(--ax-red-dark); font-weight: 600; }
.hilfe-inhalt { flex: 1; min-width: 0; }
.hilfe-brotkrumen { font-size: 0.8125rem; color: var(--ax-slate-muted); margin-bottom: 0.75rem; }
.hilfe-blaettern {
  display: flex; justify-content: space-between; gap: 1rem;
  margin-top: 1.5rem; border-top: 1px solid var(--ax-border); padding-top: 0.75rem;
}
@media (max-width: 900px) {
  .hilfe-layout { flex-direction: column; }
  .hilfe-nav { position: static; width: 100%; }
}

/* Layout */
.ax-shell { display: flex; min-height: 100vh; }
.ax-sidebar { width: 240px; background: var(--ax-slate-deep); color: var(--ax-white); padding: 1.5rem 1rem; flex-shrink: 0; }
.ax-sidebar .brand { font-size: 1.25rem; font-weight: 400; margin-bottom: 2rem; color: var(--ax-white); }
.ax-sidebar .brand b { color: var(--ax-red-light); font-weight: 600; }
.ax-nav a { display: block; color: #C7CDD1; padding: 0.5rem 0.75rem; border-radius: var(--radius-btn); margin-bottom: 0.25rem; }
.ax-nav a:hover, .ax-nav a.active { background: rgba(255,255,255,0.08); color: var(--ax-white); text-decoration: none; }
/* Ausklappbare Navigations-Gruppen (Stammdaten, Backoffice) */
.ax-nav-gruppe {
  display: flex; align-items: center; justify-content: space-between; width: 100%;
  background: none; border: 0; cursor: pointer; font: inherit;
  color: #C7CDD1; padding: 0.5rem 0.75rem; border-radius: var(--radius-btn); margin-bottom: 0.25rem;
}
.ax-nav-gruppe:hover { background: rgba(255,255,255,0.08); color: var(--ax-white); }
.ax-nav-gruppe .pfeil { font-size: 0.75rem; color: #8A929A; }
.ax-nav-untermenue a { padding-left: 1.6rem; font-size: 0.9375rem; }
/* min-width:0: Flex-Kinder dürfen sonst nicht unter ihre Inhaltsbreite schrumpfen —
   breite Tabellen würden die Seite sprengen, statt in der Karte zu scrollen. */
.ax-main { flex: 1; min-width: 0; padding: 2rem; max-width: var(--container-page); }
.ax-center { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1rem; }
.ax-login-card { width: 100%; max-width: 400px; }
.ax-muted { color: var(--ax-slate-muted); }
.ax-row { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-bottom: 1.5rem; }

/* Reports: Parameter + Format-Knöpfe in einer umbruchfähigen Zeile */
.report-zeile { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; }
.report-zeile select, .report-zeile input { padding: 0.5rem 0.6rem; border: 1px solid var(--ax-border); border-radius: var(--radius-btn); font: inherit; }

/* Modaler Dialog (z. B. Bemerkungen gross bearbeiten) */
.ax-modal-backdrop { position: fixed; inset: 0; background: rgba(35, 44, 50, 0.45); z-index: 90; }
.ax-modal {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%);
  z-index: 91; width: min(680px, calc(100vw - 2rem));
  background: var(--ax-white); border-radius: var(--radius-card);
  box-shadow: 0 18px 48px rgba(35, 44, 50, 0.28); padding: 1.25rem;
}

/* Modell-Auswahlliste (Einstellungen → KI-Profile): Combobox mit Filter */
.modell-auswahl { position: relative; }
.modell-backdrop { position: fixed; inset: 0; z-index: 60; }
.modell-panel {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 61;
  width: min(30rem, calc(100vw - 2rem));
  background: var(--ax-white); border: 1px solid var(--ax-border);
  border-radius: 10px; box-shadow: 0 10px 28px rgba(35, 44, 50, 0.16);
  padding: 0.6rem;
}
.modell-liste { max-height: 16rem; overflow-y: auto; margin-top: 0.45rem; display: flex; flex-direction: column; }
.modell-eintrag {
  text-align: left; background: none; border: none; cursor: pointer;
  font: inherit; color: var(--ax-slate);
  padding: 0.3rem 0.45rem; border-radius: 6px;
}
.modell-eintrag:hover { background: var(--ax-red-tint); }
.modell-status { font-size: 0.8125rem; margin-top: 0.45rem; }

/* Arbeitsrapport (Kap. 13.1): Kundenmodus-Overlay — Vollbild ohne Navigation,
   solange der Kunde das Gerät hält; Canvas für die Unterschrift. */
.unterschrift-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: var(--ax-white);
  display: flex; flex-direction: column;
  overflow-y: auto;
}
.unterschrift-kopf {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 0.9rem 1.25rem;
  border-bottom: 1px solid var(--ax-border);
}
.unterschrift-inhalt {
  flex: 1; width: 100%; max-width: 760px; margin: 0 auto;
  padding: 1rem 1.25rem 2rem;
}
.unterschrift-canvas {
  width: 100%; height: min(38vh, 280px);
  border: 2px dashed var(--ax-border); border-radius: var(--radius-card);
  background: var(--ax-white);
  touch-action: none; /* Finger zeichnet, statt zu scrollen */
  cursor: crosshair;
}

#blazor-error-ui {
  background: #fff3cd; bottom: 0; box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
  display: none; left: 0; padding: 0.6rem 1.25rem; position: fixed; width: 100%; z-index: 1000;
}
#blazor-error-ui .dismiss { cursor: pointer; position: absolute; right: 0.75rem; top: 0.5rem; }

/* App-Splash: sichtbarer Ladezustand vom ersten Byte an — geteilt von index.html
   (WASM-Boot), App.razor (Anmeldeprüfung) und den Authentication-Seiten. */
.app-splash {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 1rem;
}
.app-splash-wort {
  font-size: 0.9375rem; font-weight: 600; letter-spacing: 0.28em;
  text-transform: uppercase; color: var(--ax-slate-muted);
}
.app-splash-wort b { color: var(--ax-red); font-weight: 700; }
.app-splash-spinner {
  width: 34px; height: 34px; border-radius: 50%;
  border: 3px solid var(--ax-border); border-top-color: var(--ax-red);
  animation: app-splash-drehen 0.9s linear infinite;
}
.app-splash-text { font-size: 0.9375rem; color: var(--ax-slate-muted); }
@keyframes app-splash-drehen { to { transform: rotate(360deg); } }

/* Boot-Fehler-Fallback (index.html): wird per JS eingeblendet, wenn Blazor.start scheitert. */
#start-fehler {
  display: none; min-height: 100vh; flex-direction: column;
  align-items: center; justify-content: center; gap: 0.9rem;
  color: var(--ax-slate); text-align: center; padding: 1rem;
}
#start-fehler button {
  padding: 0.6rem 1.2rem; border-radius: var(--radius-btn); border: 1px solid transparent;
  background: var(--ax-red); color: var(--ax-white); font: inherit; font-weight: 600; cursor: pointer;
}

/* Responsive (Pflichtenheft: mobile Nutzung der Web-App) — unter 900 px gibt es
   eine fixe Topbar mit Hamburger; die Navigation wird zum einschiebbaren Drawer. */
.ax-topbar { display: none; }
.ax-backdrop { display: none; }

@media (max-width: 900px) {
  .ax-shell { flex-direction: column; }

  .ax-topbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    display: flex; align-items: center; justify-content: space-between;
    height: 56px; padding: 0 1rem; background: var(--ax-slate-deep);
  }
  .ax-topbar img { height: 30px; display: block; }
  .ax-hamburger {
    background: none; border: 0; color: var(--ax-white);
    font-size: 1.7rem; line-height: 1; cursor: pointer;
    padding: 0.3rem 0.45rem; position: relative;
  }
  .ax-hamburger-punkt {
    position: absolute; top: 1px; right: 1px; width: 10px; height: 10px;
    border-radius: 999px; background: var(--ax-red-light);
  }

  .ax-backdrop {
    display: block; position: fixed; top: 56px; left: 0; right: 0; bottom: 0;
    background: rgb(35 44 50 / 0.5); z-index: 50;
  }

  /* Sidebar wird zum Drawer: links eingeschoben, scrollbar, über dem Backdrop */
  .ax-sidebar {
    position: fixed; top: 56px; left: 0; bottom: 0; z-index: 55;
    width: min(300px, 85vw);
    transform: translateX(-105%); transition: transform 0.2s ease;
    overflow-y: auto;
  }
  .ax-sidebar.offen { transform: translateX(0); }
  .ax-sidebar .brand { display: none; } /* das Logo sitzt mobil in der Topbar */

  .ax-main { padding: calc(56px + 1rem) 1rem 1rem; }
  .ax-card { padding: 1rem; }
  .ax-row { flex-wrap: wrap; }
  /* Tabellen scrollen horizontal statt das Layout zu sprengen */
  .ax-card:has(> .ax-table) { overflow-x: auto; }
  .ax-table { min-width: 560px; }
  h1 { font-size: 1.5rem; }
}

@media (max-width: 520px) {
  .ax-btn { padding: 0.5rem 0.85rem; }
  .ax-main { padding: calc(56px + 0.75rem) 0.75rem 0.75rem; }
}
