/* Neuordnung der Bedienung (docs/plan-neuordnung.md). Bausteine aus src/ui.js
   mit Präfix n-, Werte aus den Token in web/style.css. Vorlage ist die
   Mockup-Welt docs/design/neuordnung/welt/quelle.html. */

/* ------------------------------------------------------------ Zeilen */
.n-h2 { font-size: 13px; font-weight: 600; color: var(--text-still); text-transform: uppercase; letter-spacing: .06em; margin: 26px 0 8px; }
.n-h2:first-child { margin-top: 0; }
.n-satz { color: var(--text-leise); margin: -2px 0 10px; font-size: 13.5px; }
.n-liste { border: 1px solid var(--linie); border-radius: var(--r-l); overflow: hidden; background: var(--grund); }
.n-zeile { display: flex; align-items: center; gap: var(--a-3); padding: 11px 14px; min-height: 56px; border-top: 1px solid var(--linie);
  text-decoration: none; color: var(--text); width: 100%; text-align: left; background: none; font: inherit; box-sizing: border-box; }
.n-liste > .n-zeile:first-child, .n-liste > :first-child .n-zeile { border-top: 0; }
a.n-zeile:hover { background: var(--flaeche); color: var(--text); }
.n-zeile .n-text { min-width: 0; flex: 1; display: flex; flex-direction: column; }
.n-titel { font-weight: 550; font-size: 14.5px; overflow-wrap: anywhere; }
.n-art { font-weight: 400; color: var(--text-still); font-size: 12.5px; margin-left: 6px; }
.n-sub { color: var(--text-leise); font-size: 13px; overflow-wrap: anywhere; }
.n-sub .warn { color: var(--wartet); }
.n-wert { color: var(--text); font-size: 13.5px; text-align: right; flex: none; font-weight: 500; }
.n-wert small { display: block; font-size: 12px; font-weight: 400; color: var(--wartet); }
.n-wert small.leise { color: var(--text-still); }
.n-wert.leise { color: var(--text-leise); font-weight: 400; }
.n-pfeil { color: var(--text-still); flex: none; }
.n-zeile.still { color: var(--text-leise); }
.n-zeile.n-neu { color: var(--akzent); font-weight: 500; min-height: 48px; }
.n-plus { width: 36px; display: grid; place-items: center; font-size: 20px; flex: none; }
.n-logo { width: 36px; height: 36px; border-radius: 9px; border: 1px solid var(--linie); background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.n-logo img { width: 22px; height: 22px; }
.n-logo.ini { background: oklch(40% 0.03 260); color: #fff; font-weight: 700; border: 0; }
.n-avatar { width: 36px; height: 36px; border-radius: 50%; background: var(--flaeche-2); display: grid; place-items: center; font-weight: 600; color: var(--text-leise); flex: none; font-size: 14px; }
.n-avatar.firma { border-radius: 9px; background: var(--akzent-hell); color: var(--akzent-dunkel); font-size: 11px; }
.n-agentsym { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: #fff; font-weight: 700; flex: none;
  background: oklch(52% 0.13 var(--ton, 275)); }
.n-agentsym.schnell { background: var(--flaeche-2); color: var(--akzent); }

/* ------------------------------------------------------------ Punkt, Tag, Kürzel */
.n-punkt { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-leise); }
.n-punkt::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--ruht); flex: none; }
.n-punkt.laeuft::before { background: var(--laeuft); }
.n-punkt.wartet::before { background: var(--wartet); }
.n-punkt.fehler::before { background: var(--fehler); }
.n-tags { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px; }
.n-tag { font-size: 11.5px; padding: 0 7px; line-height: 18px; border-radius: 999px; background: var(--akzent-hell); color: var(--akzent-dunkel); border: 0; }
button.n-tag { cursor: pointer; font: inherit; font-size: 11.5px; }
button.n-tag[aria-pressed="true"] { background: var(--akzent); color: #fff; }
.n-kuerzel { display: inline-grid; place-items: center; min-width: 22px; height: 18px; padding: 0 5px; border-radius: 999px; background: var(--flaeche-2);
  color: var(--text-leise); font-size: 10.5px; font-weight: 650; letter-spacing: .02em; vertical-align: 1px; margin-left: 4px; }
.n-kuerzel.gross { height: 24px; min-width: 24px; font-size: 11px; border: 2px solid var(--grund); }

/* ------------------------------------------------------------ Segment, Schalter */
.n-segment { display: flex; background: var(--flaeche-2); border-radius: 10px; padding: 3px; gap: 2px; margin: 0; }
.n-segment button { flex: 1; border: 0; background: transparent; padding: 7px 10px; border-radius: 8px; cursor: pointer; font: inherit; font-size: 13.5px; color: var(--text-leise); min-height: 36px; }
.n-segment button[aria-pressed="true"] { background: var(--grund); color: var(--text); font-weight: 550; box-shadow: 0 1px 3px oklch(0% 0 0 / .1); }
.n-segment button:disabled { cursor: default; opacity: .55; }
.n-schalter-form { margin: 0; display: inline-flex; }
.n-schalter { width: 44px; height: 26px; border-radius: 999px; border: 0; background: var(--linie-stark); position: relative; cursor: pointer; flex: none; transition: background var(--zeit); padding: 0; }
.n-schalter::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px oklch(0% 0 0 / .25); transition: transform var(--zeit); }
.n-schalter[aria-checked="true"] { background: var(--laeuft); }
.n-schalter[aria-checked="true"]::after { transform: translateX(18px); }
.n-schalter:disabled { opacity: .45; cursor: default; }

/* ------------------------------------------------------------ Hinweise im Blatt */
.n-wirkt { padding: 10px 12px; border-radius: var(--r-m); background: var(--flaeche); font-size: 13.5px; }
.n-wirkt.ab { background: color-mix(in oklch, var(--wartet) 12%, white); }
.n-wirkt b { font-weight: 550; }
.n-trenn { border: 0; border-top: 1px solid var(--linie); margin: 4px 0; }
.n-feldzeile { display: flex; align-items: center; gap: 12px; }
.n-feldzeile .n-text { flex: 1; }
.n-knopf-breit { width: 100%; min-height: 44px; justify-content: center; }
.n-hinweis { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-l); background: var(--flaeche); border: 1px solid var(--linie); margin-bottom: 12px; }
.n-hinweis.akzent { background: var(--akzent-hell); border-color: var(--akzent-linie); }
.n-hinweis.warn { background: color-mix(in oklch, var(--wartet) 10%, white); border-color: color-mix(in oklch, var(--wartet) 30%, white); }
.n-hinweis .n-text { flex: 1; min-width: 0; }
.n-hinweis .n-text b { font-weight: 550; display: block; }
.n-hinweis .n-text span { color: var(--text-leise); font-size: 13px; }

/* ------------------------------------------------------------ Statuszeile */
.n-statuszeile { display: flex; align-items: flex-start; gap: 10px; padding: 8px 16px; font-size: 13px; margin: calc(-1 * var(--a-5)) calc(-1 * var(--a-6)) var(--a-4);
  background: color-mix(in oklch, var(--wartet) 10%, white); border-bottom: 1px solid color-mix(in oklch, var(--wartet) 25%, white); }
.n-statuszeile .n-punkt { color: var(--text); }
.n-statuszeile .n-zu { margin-left: auto; border: 0; background: none; cursor: pointer; color: var(--text-leise); font-size: 16px; }

/* ------------------------------------------------------------ Kacheln */
.n-raster { display: grid; grid-template-columns: repeat(auto-fill, minmax(112px, 1fr)); gap: 22px 14px; }
.n-kachel { display: flex; flex-direction: column; align-items: center; gap: 8px; text-decoration: none; color: var(--text); text-align: center; padding: 6px; border-radius: var(--r-l); }
.n-kachel:hover { background: var(--flaeche); color: var(--text); }
.n-appsym { width: 64px; height: 64px; border-radius: 16px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 26px; position: relative;
  background: linear-gradient(160deg, oklch(64% 0.14 var(--ton, 275)), oklch(50% 0.15 var(--ton, 275))); box-shadow: 0 2px 6px oklch(0% 0 0 / .12); }
.n-abzeichen { position: absolute; top: -4px; right: -4px; min-width: 20px; height: 20px; border-radius: 10px; background: var(--wartet); border: 2px solid var(--grund); font-size: 11px; display: grid; place-items: center; }
.n-kachelname { font-size: 13.5px; font-weight: 500; }
.n-kachelunter { font-size: 12px; color: var(--text-still); margin-top: -6px; }

/* ------------------------------------------------------------ Matrix */
.n-matrix { border-collapse: separate; border-spacing: 0; width: 100%; border: 1px solid var(--linie); border-radius: var(--r-l); overflow: hidden; }
.n-matrix th, .n-matrix td { padding: 10px 12px; border-top: 1px solid var(--linie); text-align: left; font-size: 13.5px; vertical-align: top; }
.n-matrix thead th { border-top: 0; background: var(--flaeche); font-weight: 550; font-size: 12.5px; color: var(--text-leise); vertical-align: bottom; }
.n-matrix thead th small { display: block; font-weight: 400; color: var(--text-still); }
.n-matrix tbody th { font-weight: 550; }
.n-matrix tbody th .n-sub { display: block; font-weight: 400; }
.n-zelle { display: block; padding: 4px 8px; margin: -4px -8px; border-radius: 6px; color: var(--text); text-decoration: none; }
a.n-zelle:hover { background: var(--akzent-hell); color: var(--text); }
.n-zelle.leer { color: var(--text-still); }
.n-zelle.std { color: var(--text-leise); }
.n-zelle small { display: block; color: var(--wartet); font-size: 11.5px; }
.n-zelle small.leise { color: var(--text-still); }
.n-handyliste { display: none; }

/* ------------------------------------------------------------ Blatt (Sheet) */
dialog.n-blatt { position: fixed; inset: 0 0 0 auto; margin: 0; width: 440px; max-width: 100%; height: 100%; max-height: 100%; border: 0; padding: 0;
  background: var(--grund); box-shadow: var(--schatten-dialog); display: flex; flex-direction: column; }
dialog.n-blatt:not([open]) { display: none; }
dialog.n-blatt::backdrop { background: oklch(20% 0.02 275 / .28); }
dialog.n-blatt[open] { animation: n-rein .2s ease-out; }
.n-blatt-kopf { display: flex; align-items: center; gap: 10px; padding: 16px 18px 10px; }
.n-blatt-kopf h2 { margin: 0; font-size: 17px; flex: 1; line-height: 1.3; }
.n-blatt-kopf button { border: 0; background: var(--flaeche-2); width: 30px; height: 30px; border-radius: 50%; cursor: pointer; font-size: 16px; color: var(--text-leise); }
.n-blatt-rumpf { padding: 4px 18px 22px; overflow: auto; flex: 1; }
.n-blatt-inhalt { display: grid; gap: 14px; align-content: start; }
dialog .n-nur-seite { display: none; }
.n-blatt-titel { font-size: var(--s-titel); margin: 0; }
.n-zurueck { color: var(--text-leise); text-decoration: none; font-size: 13px; }
.n-griff { display: none; }
.n-laden { display: grid; place-items: center; padding: 40px 0; color: var(--text-leise); }

/* Rückmeldung nach dem Speichern */
.n-toast { position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%); background: oklch(24% .012 275); color: #fff; border-radius: 12px; padding: 10px 14px;
  display: flex; gap: 14px; align-items: center; z-index: 1000; font-size: 13.5px; box-shadow: var(--schatten-schwebend); max-width: calc(100% - 32px); animation: n-hoch .2s ease-out; }
.n-toast[hidden] { display: none; }
.n-toast button { background: none; border: 0; color: oklch(82% 0.08 275); cursor: pointer; font-weight: 600; font: inherit; }

@keyframes n-rein { from { transform: translateX(24px); opacity: .6; } }
@keyframes n-hoch { from { transform: translate(-50%, 10px); opacity: 0; } }
@keyframes n-unten { from { transform: translateY(40px); opacity: .5; } }
@media (prefers-reduced-motion: reduce) { dialog.n-blatt[open], .n-toast { animation: none; } .n-schalter, .n-schalter::after { transition: none; } }

/* ------------------------------------------------------------ Handy */
@media (max-width: 860px) {
  dialog.n-blatt { inset: auto 0 0 0; width: 100%; height: auto; max-height: 88%; border-radius: 18px 18px 0 0; }
  dialog.n-blatt[open] { animation: n-unten .22s ease-out; }
  .n-griff { display: block; width: 38px; height: 5px; border-radius: 3px; background: var(--linie-stark); margin: 8px auto 0; }
  .n-zeile { min-height: 60px; }
  .n-matrix { display: none; }
  .n-handyliste { display: grid; gap: 14px; }
  .n-raster { grid-template-columns: repeat(3, 1fr); gap: 18px 6px; }
  .n-hinweis { flex-direction: column; align-items: stretch; }
  .n-statuszeile { margin: 0 0 var(--a-3); }
  .n-toast { bottom: 84px; }
}

/* ------------------------------------------------------------ Seitenkopf der neuen Seiten */
.kopf-neu { display: flex; align-items: flex-start; gap: var(--a-3); margin: 0 0 var(--a-4); }
.kopf-neu h1 { font-size: var(--s-titel); line-height: 1.25; margin: 0; letter-spacing: -.01em; }
.kopf-neu .unter { color: var(--text-leise); margin: 4px 0 0; }
.kopf-neu .aktion { margin-left: auto; flex: none; }
.kopf-neu .n-logo { width: 44px; height: 44px; }
.n-details { margin-top: 18px; }
.n-details > summary { cursor: pointer; color: var(--text-leise); font-size: 13px; }
.n-dl { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 13px; margin: 10px 0; }
.n-dl dt { color: var(--text-leise); }
.n-dl dd { margin: 0; font-family: var(--mono); font-size: 12.5px; overflow-wrap: anywhere; }
.n-zeile.n-gefahr .n-titel { color: var(--fehler); }
.n-auswahl { border: 1px solid var(--linie-stark); border-radius: var(--r-m); padding: 6px 8px; font: inherit; font-size: 13.5px; background: var(--grund); }
.n-form, .n-form-zeile { margin: 0; }
.n-form-zeile + .n-form-zeile .n-zeile { border-top: 1px solid var(--linie); }
button.n-zeile { cursor: pointer; border: 0; }
button.n-zeile:hover { background: var(--flaeche); }
.n-logo .dz { width: 36px; height: 36px; display: block; }
.n-logo .dz-logo { display: grid; place-items: center; }
.kopf-neu .n-logo .dz { width: 44px; height: 44px; }
@media (max-width: 860px) {
  .kopf-neu { flex-wrap: wrap; }
  .kopf-neu .aktion { margin-left: 0; width: 100%; }
  .kopf-neu .aktion .knopf { width: 100%; justify-content: center; min-height: 44px; }
}
.n-feldzeile .n-text { display: flex; flex-direction: column; min-width: 0; }
.n-feldzeile select { flex: none; width: auto; }
a.n-link, a.n-link:hover { text-decoration: none; color: inherit; }
a.n-link .n-titel { color: var(--text); }
.n-pfeil-link { color: var(--text-still); text-decoration: none; font-size: 20px; padding: 0 4px; }
.n-agentsym.gross { width: 44px; height: 44px; font-size: 18px; border-radius: 12px; }

/* ------------------------------------------------------------ App-Kacheln auf /apps */
.n-appkachel { display: flex; flex-direction: column; align-items: center; gap: 2px; }
.n-kachelwege { font-size: 12px; color: var(--text-leise); text-align: center; }
.n-kachelwege a { color: var(--text-leise); }
.n-zustandpunkt { position: absolute; right: -3px; bottom: -3px; width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--grund); background: var(--ruht); }
.n-zustandpunkt.laeuft { background: var(--laeuft); }
.n-zustandpunkt.wartet { background: var(--wartet); }
.n-zustandpunkt.fehler { background: var(--fehler); }
.apps-abschnitt .n-raster { margin: 8px 0 18px; }
.n-plakette { position: absolute; right: -6px; top: -6px; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px; background: var(--fehler); color: #fff; font-size: 13px; font-weight: 700; line-height: 20px; text-align: center; border: 2px solid var(--grund); }

/* ------------------------------------------------------------ Freigabeseite als Auswahlliste (L11) */
.fk-inhalt fieldset.wahlgruppe { border: 0; padding: 0; margin: 4px 0 0; width: 100%; min-width: 0; }
.fk-inhalt fieldset.wahlgruppe legend { padding: 0; margin-bottom: 6px; font-size: 13px; font-weight: 600; color: var(--text); }
.fk-inhalt fieldset.wahlgruppe label.zeile { display: flex; align-items: flex-start; gap: 10px; width: 100%; padding: 10px 12px; margin: 0;
  border: 1px solid var(--linie); border-radius: 0; background: var(--grund); color: var(--text); font-size: 14px; cursor: pointer; }
.fk-inhalt fieldset.wahlgruppe label.zeile + label.zeile { border-top: 0; }
.fk-inhalt fieldset.wahlgruppe label.zeile:first-of-type { border-radius: 10px 10px 0 0; }
.fk-inhalt fieldset.wahlgruppe label.zeile:last-of-type { border-radius: 0 0 10px 10px; }
.fk-inhalt fieldset.wahlgruppe label.zeile:only-of-type { border-radius: 10px; }
.fk-inhalt fieldset.wahlgruppe label.zeile input { margin: 2px 0 0; flex: none; width: 18px; height: 18px; accent-color: var(--akzent); }
.fk-inhalt fieldset.wahlgruppe label.zeile:has(input:checked) { background: var(--akzent-hell); }
.fk-inhalt fieldset.wahlgruppe .hilfe { display: block; margin-top: 6px; font-size: 12.5px; color: var(--text-leise); }
.n-appkachel { width: 100%; min-width: 0; }
.apps-abschnitt .n-raster { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
@media (max-width: 860px) { .apps-abschnitt .n-raster { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.fk-inhalt fieldset.wahlgruppe label.zeile { flex-wrap: nowrap; }
.fk-inhalt .fk-text { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.fk-inhalt .fk-text .klein { display: block; margin-top: 2px; }

/* ------------------------------------------------------------ Reiter „Apps“ im Agenten */
.n-appkarte { margin: 0 0 22px; }
.n-appkopf { display: flex; align-items: center; gap: 14px; margin-bottom: 10px; }
.n-appkopf .n-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.n-appkopf .n-text b { font-size: 17px; }
.n-appsym.klein { width: 48px; height: 48px; border-radius: 12px; font-size: 20px; flex: none; }

/* ------------------------------------------------------------ Chats: Schnellchat neben „Neuer Chat“ */
.z-kopfknoepfe { display: inline-flex; align-items: center; gap: 10px; flex: none; }
.z-schnell { font-size: 13px; color: var(--text-leise); text-decoration: none; padding: 6px 10px; border-radius: 8px; border: 1px solid var(--linie); }
.z-schnell:hover { color: var(--text); background: var(--akzent-hell); }

/* ------------------------------------------------------------ „Heute“ über der Chatliste (L10) */
.z-heute { flex: none; margin: 0 12px 10px; padding: 10px 12px; border: 1px solid var(--linie); border-radius: 12px; background: var(--grund); }
.z-heute h2 { margin: 0 0 6px; font-size: 12px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--text-leise); }
.z-heute-zeile { display: flex; gap: 10px; align-items: flex-start; padding: 7px 0; text-decoration: none; color: var(--text); }
.z-heute-zeile + .z-heute-zeile { border-top: 1px solid var(--linie); }
.z-heute-zeile > span:last-child { display: flex; flex-direction: column; min-width: 0; font-size: 13px; }
.z-heute-zeile > span:last-child b { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.z-heute-zeile > span:last-child span { color: var(--text-leise); }
.z-heute-zeichen { flex: none; width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 700; background: var(--akzent-hell); color: var(--akzent); }
.z-heute-konto .z-heute-zeichen { background: var(--fehler); color: #fff; }
.z-heute-zeile:hover b { text-decoration: underline; }
