/* Main interface of AIMS: sidebar with the apps, header, views and app pages. Colours, font and depth come from the variables of
   frontend/theme.css (loaded before this file), so the same rules draw the light and the dark theme; 8-px grid.
   Look: a dark sidebar („cockpit“) in both themes, a header of frosted glass, cards with soft shadows, primary buttons with the red
   gradient and a faint glow. */
:root{
  font-synthesis:none;
  /* Safe area of phones (viewport-fit=cover in index.html): the strips at the edges of the screen under the camera, the rounded corners
     and the home bar; 0 on screens without them (every desktop). The main interface keeps header, drawer, pages and the frames of the
     apps inside it: header and sidebar draw their background into the strips, their content and the pages stay clear of them.
     App pages can see the same values in their frame (Chrome passes them on), but the frame already lies inside the safe area – apps
     never add them again. */
  --safe-top:env(safe-area-inset-top,0px);--safe-right:env(safe-area-inset-right,0px);--safe-bottom:env(safe-area-inset-bottom,0px);
  --safe-left:env(safe-area-inset-left,0px);
  /* Widths of the sidebar and of the folded rail at the left edge, each with the strip of the safe area before its content. */
  --sidebar:calc(264px + var(--safe-left));--rail:calc(72px + var(--safe-left));--topbar:60px;--ease:cubic-bezier(.2,.7,.2,1);
  --band-line:var(--line);                                   /* frame of buttons in the header (frontend/weather.css) */
  --glass:color-mix(in srgb,var(--bg) 76%,transparent);      /* the header: the page shines through, blurred */
}
*{box-sizing:border-box}
/* Heights in dvh (the visible height): on phones vh is the height with the browser bars hidden, so a page of 100vh reached under the bar
   at the bottom. Every browser of the minimum knows dvh (docs/Projektregeln/browser-minimum.md), no fallback needed. */
body{margin:0;min-height:100dvh;background:var(--bg);color:var(--ink)}
button,input,select,textarea{font:inherit}
button,a{-webkit-tap-highlight-color:transparent}
button{cursor:pointer}
button:disabled{opacity:.5;cursor:not-allowed}
button[aria-busy=true]{cursor:wait}
button:focus-visible,a:focus-visible,input:focus-visible,select:focus-visible,textarea:focus-visible{outline:3px solid var(--focus);outline-offset:4px}
.hidden{display:none!important}
.visually-hidden{position:absolute!important;width:1px;height:1px;margin:-1px;padding:0;border:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
/* Line symbols of the interface (sprite at the top of index.html): 24 × 24, drawn in the colour of the text. */
.icon{width:18px;height:18px;flex:none;fill:none;stroke:currentColor;stroke-width:1.7;stroke-linecap:round;stroke-linejoin:round;vertical-align:middle}
/* Logo of Superus ERP (docs/Projektregeln/design-superus-theme.md): the wordmark „superus“ (Medium, small s like the logo of the maker)
   „ERP“ (Light, red gradient) with the red AI seal raised, below it on the sign-in page the maker. The symbol frontend/logo.svg (the Superus horse above „ERP“) is never
   put in front of the wordmark: it is the browser icon and stands alone in the folded sidebar, where the wordmark does not fit.
   The flex container drops a space between the two words, so the margin of .brand-erp stands for it. */
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:var(--ink);font-size:26px;font-weight:600;letter-spacing:-.4px}
.brand-symbol{display:block;flex:none;width:36px;height:36px;border-radius:11px;box-shadow:0 8px 22px -8px rgba(210,26,70,.6)}
.brand-name{display:inline-flex;align-items:flex-start;white-space:nowrap;line-height:1;color:var(--ink)}
.brand-erp{font-weight:300;margin-left:.24em;background:linear-gradient(95deg,#ff4d76,#d01a45 45%,#990a2c);-webkit-background-clip:text;background-clip:text;color:transparent;
  -webkit-text-fill-color:transparent}
.brand-ai{margin:-.12em 0 0 .3em;padding:.14em .36em .16em;border-radius:.32em;font-size:.46em;font-weight:600;letter-spacing:.06em;line-height:1.15;color:#fff;
  -webkit-text-fill-color:#fff;background:linear-gradient(135deg,#ff3d6a,#c8173f 55%,#7a0820);box-shadow:inset 0 1px 0 rgba(255,255,255,.3),0 4px 12px -4px rgba(210,26,70,.8)}
.brand-text{display:grid;gap:7px}
.brand-maker{font-size:10px;font-weight:500;letter-spacing:.17em;text-transform:uppercase;color:var(--muted);white-space:nowrap}
.icon-button{display:inline-grid;place-items:center;flex:none;width:36px;height:36px;padding:0;border:1px solid transparent;border-radius:10px;background:none;color:var(--ink-soft);
  font-size:16px;line-height:1;transition:background .15s,color .15s,border-color .15s}
.icon-button:hover{background:var(--hover);color:var(--ink)}

/* ---------- Sidebar: dark in both themes ---------- */
/* The sidebar sets its own values of the variables, so everything inside – search field, entries, menu of the user – is drawn
   dark without rules of its own. A red glow behind the mark and a fine grid at the top are decoration only. On phones its padding keeps
   the content clear of the safe area (camera and rounded corners in landscape, the home bar below); the dark background fills it. */
.sidebar{position:fixed;inset:0 auto 0 0;z-index:30;width:var(--sidebar);display:flex;flex-direction:column;padding:var(--safe-top) 0 var(--safe-bottom) var(--safe-left);
  color-scheme:dark;--ink:#f2f2f4;--ink-soft:#b4b4bb;--muted:#86868d;--faint:#66666d;--line:rgba(255,255,255,.08);--line-2:rgba(255,255,255,.16);
  --hover:rgba(255,255,255,.06);--surface:#1d1d21;--surface-2:rgba(255,255,255,.045);--surface-3:rgba(255,255,255,.09);--input-bg:rgba(255,255,255,.05);
  --brand-text:#ff6b8a;--brand-soft:rgba(210,26,70,.24);--brand-line:rgba(255,92,127,.38);--focus:#9a9aa1;--shadow-2:0 24px 60px -12px rgba(0,0,0,.85);
  color:var(--ink);border-right:1px solid rgba(255,255,255,.06);
  background:radial-gradient(420px 260px at 0 0,rgba(153,10,44,.38),transparent 70%),radial-gradient(300px 300px at 100% 100%,rgba(153,10,44,.12),transparent 70%),
    linear-gradient(180deg,#18181b,#0e0e10);
  transition:width .2s var(--ease),transform .22s var(--ease),box-shadow .2s}
.sidebar::after{content:"";position:absolute;inset:0;z-index:0;pointer-events:none;
  background-image:linear-gradient(rgba(255,255,255,.028) 1px,transparent 1px),linear-gradient(90deg,rgba(255,255,255,.028) 1px,transparent 1px);background-size:24px 24px;
  -webkit-mask-image:linear-gradient(#000,transparent 260px);mask-image:linear-gradient(#000,transparent 260px)}
.sidebar>*{position:relative;z-index:1}
.sidebar :focus-visible{outline-offset:-3px}
/* As high as the header beside it (--topbar), so the brand and the header sit on one line. */
.sidebar-head{display:flex;align-items:center;gap:6px;min-height:var(--topbar);padding:4px 12px 4px 16px;flex:none}
.sidebar .brand{border:0;background:none;padding:4px;margin-right:auto;border-radius:10px;font-size:20px;min-width:0;color:#fff}
.sidebar .brand-symbol{display:none;width:34px;height:34px;border-radius:10px}
.sidebar .brand-name{color:#fff}
.sidebar .brand-erp{background-image:linear-gradient(95deg,#ff8aa3,#ff3d6a 50%,#d01a45)}
.sidebar .icon-button{color:var(--muted)}
.sidebar .icon-button:hover{color:var(--ink)}
.sidebar-close{display:none}
.sidebar-scroll{flex:1;min-height:0;overflow-x:hidden;overflow-y:auto;padding:4px 12px 16px;overscroll-behavior:contain;scrollbar-width:thin;scrollbar-color:var(--line-2) transparent}
/* Global search (frontend/search.js): the field at the top; with only symbols the button „Suchen“ opens the palette. */
.sidebar-search{margin:4px 0 10px}
.search-box{display:flex;align-items:center;gap:8px;padding:0 10px;border:1px solid var(--line);border-radius:10px;background:var(--input-bg);color:var(--faint);transition:border-color .15s,box-shadow .15s}
.search-box:focus-within{border-color:var(--line-2);box-shadow:0 0 0 3px rgba(154,154,161,.25)}
.search-box input{flex:1;min-width:0;border:0;outline:0;background:none;padding:9px 0;font-size:13px;color:var(--ink)}
.search-box input::placeholder{color:var(--faint);-webkit-text-fill-color:var(--faint)}
.search-box input:focus-visible{outline:0}
.nav-item.search-open{display:none}  /* only the folded sidebar shows „Suchen“ as a symbol; .nav-item below sets display:flex */
.nav-group{display:grid;grid-template-columns:minmax(0,1fr);gap:2px}
.nav-item{position:relative;display:flex;align-items:center;gap:12px;width:100%;min-height:38px;padding:7px 10px;border:1px solid transparent;border-radius:10px;background:none;color:var(--ink-soft);
  font-size:13px;font-weight:500;line-height:1.3;text-align:left;transition:background .15s,color .15s,border-color .15s}
.nav-item:hover{background:var(--hover);color:var(--ink)}
/* The chosen entry glows red: a translucent red band with a fine frame and a lit bar at the left edge. */
.nav-item.selected,.app-item.active .app-link{color:#fff;font-weight:600;background:linear-gradient(90deg,rgba(210,26,70,.32),rgba(153,10,44,.06) 85%);
  border-color:rgba(232,60,98,.3);box-shadow:0 0 24px -10px rgba(210,26,70,.85)}
.nav-item.selected::before,.app-item.active::before{content:"";position:absolute;left:-13px;top:9px;bottom:9px;width:3px;border-radius:0 3px 3px 0;background:#ff3d6a;
  box-shadow:0 0 10px 1px rgba(255,61,106,.85)}
.nav-icon{flex:none;width:22px;display:grid;place-items:center;font-size:17px;line-height:1;color:var(--muted)}
.nav-item:hover .nav-icon,.nav-item.selected .nav-icon,.user-menu .nav-icon{color:inherit}
.nav-text{flex:1;min-width:0;overflow-wrap:anywhere}
.count{flex:none;margin-left:auto;min-width:20px;padding:1px 6px;border-radius:10px;background:var(--surface-3);color:var(--ink-soft);font-size:11px;font-weight:600;line-height:18px;text-align:center}
/* Open tasks of the user: the counter in the red gradient. */
#nav-tasks-count{background-color:var(--brand);background-image:var(--brand-grad);color:#fff;box-shadow:0 0 12px -2px rgba(210,26,70,.8)}
.nav-heading{display:flex;align-items:center;justify-content:space-between;gap:8px;margin:18px 4px 6px 10px;min-height:26px}
.nav-label{font-size:10.5px;font-weight:600;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);overflow-wrap:anywhere}
.nav-tool{flex:none;border:0;border-radius:7px;background:none;padding:4px 8px;color:var(--brand-text);font-size:12px;font-weight:500;white-space:nowrap}
.nav-tool:hover{background:var(--brand-soft)}
.nav-tool[aria-pressed=true]{background:var(--brand);color:#fff}
.nav-hint{margin:2px 10px 8px;font-size:12px;line-height:1.5;color:var(--muted)}
.app-list{list-style:none;margin:0;padding:0;display:grid;grid-template-columns:minmax(0,1fr);gap:2px}
.app-item{position:relative;display:flex;align-items:center;gap:4px;min-width:0;border-radius:10px}
.app-link{display:flex;align-items:center;gap:11px;flex:1;min-width:0;min-height:38px;padding:4px 10px 4px 6px;border:1px solid transparent;border-radius:10px;background:none;color:var(--ink-soft);
  font-size:13px;font-weight:500;text-align:left;transition:background .15s,color .15s,border-color .15s}
.app-link:hover{background:var(--hover);color:var(--ink)}
/* Symbols of the apps: white two-letter symbol on one of ten colours (contrast at least 4.5:1), fixed by the app ID; a light from
   the top left and a highlight at the top edge make them look like small glossy tiles. */
.app-badge{flex:none;display:grid;place-items:center;width:28px;height:28px;border-radius:9px;color:#fff;font-size:11.5px;font-weight:600;line-height:1;letter-spacing:.01em;white-space:nowrap;
  background-image:linear-gradient(150deg,rgba(255,255,255,.26),rgba(255,255,255,0) 50%,rgba(0,0,0,.2));
  box-shadow:inset 0 1px 0 rgba(255,255,255,.25),inset 0 0 0 1px rgba(255,255,255,.08),0 4px 10px -5px rgba(0,0,0,.5)}
/* Long names end with „…“; the tooltip (title) shows the whole name. */
.app-label{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.app-list.arranging{gap:4px}
.app-list.arranging .app-item{padding:2px;border:1px dashed var(--line-2);background:var(--surface-2);transition:transform .15s var(--ease)}
.app-list.arranging .app-link{cursor:default;padding:4px 6px}
.app-list.arranging .app-link:hover{background:none}
.arrange-button{flex:none;display:grid;place-items:center;width:28px;height:28px;padding:0;border:1px solid var(--line);border-radius:7px;background:var(--surface);color:var(--ink-soft);font-size:13px;line-height:1}
.arrange-button:hover:not(:disabled){border-color:var(--brand-line);color:var(--brand-text)}
.drag-handle{cursor:grab;touch-action:none;border-color:transparent;background:none;font-size:15px}
.app-item.dragging{z-index:2;background:var(--surface);box-shadow:var(--shadow-2);transition:none}
.app-item.dragging .drag-handle{cursor:grabbing}
/* The colour of the area of an app (app.json "area") as the variable --tone: the symbol fills itself with it (background-color, so
   the light of .app-badge stays on top); rows and tiles of Start carry the class of their app as well and use it for lines and glows. */
.tone-sales{--tone:var(--area-sales)}.tone-operations{--tone:var(--area-operations)}.tone-people{--tone:var(--area-people)}
.tone-finance{--tone:var(--area-finance)}.tone-none{--tone:var(--area-none)}
.app-badge,.app-icon{background-color:var(--tone,var(--area-none))}
.sidebar-foot{position:relative;flex:none;display:grid;gap:8px;padding:12px;border-top:1px solid var(--line)}
.user-button{display:flex;align-items:center;gap:11px;width:100%;min-width:0;padding:8px;border:1px solid var(--line);border-radius:12px;background:var(--surface-2);color:var(--ink);text-align:left;transition:background .15s}
.user-button:hover,.user-button.selected,.user-button[aria-expanded=true]{background:var(--hover)}
/* The initial of the user in a ring of the brand colour. */
.user-initial{flex:none;display:grid;place-items:center;width:34px;height:34px;border-radius:50%;background:linear-gradient(140deg,#3a3a40,#232327);color:#fff;font-size:13px;font-weight:600;
  box-shadow:0 0 0 2px #121214,0 0 0 3.5px #c8163f}
.user-text{flex:1;min-width:0;display:grid;gap:1px}
.user-text strong,.user-text small{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.user-text strong{font-size:13px;font-weight:600}
.user-text small{font-size:11px;color:var(--muted)}
.user-caret{flex:none;color:var(--faint);font-size:12px}
.user-menu{position:absolute;left:12px;right:12px;bottom:calc(100% - 4px);z-index:5;display:grid;gap:2px;padding:6px;background:var(--surface);border:1px solid var(--line-2);border-radius:12px;box-shadow:var(--shadow-2)}
.user-menu button{display:flex;align-items:center;gap:10px;width:100%;padding:9px 10px;border:0;border-radius:8px;background:none;color:var(--ink);font-size:13px;text-align:left}
.user-menu button:hover,.user-menu button:focus-visible{background:var(--hover)}
.system-status{display:flex;flex-wrap:wrap;align-items:center;gap:6px 10px;padding:0 6px;font-size:11px;color:var(--muted)}
.mode-badge{font-size:9.5px;font-weight:600;letter-spacing:.14em;padding:2px 7px;border:1px solid var(--line-2);border-radius:6px;color:var(--ink-soft)}
.db-state{display:inline-flex;align-items:center;gap:7px;min-width:0}
/* Connection of the database: a glowing dot (green connected, amber a problem). */
.status-dot{display:inline-block;flex:none;width:7px;height:7px;border-radius:50%;background:#2fd39a;box-shadow:0 0 0 3px rgba(47,211,154,.16),0 0 10px rgba(47,211,154,.85)}
.status-dot.warn{background:#efb54a;box-shadow:0 0 0 3px rgba(239,181,74,.16),0 0 10px rgba(239,181,74,.8)}
/* Superus logo: maker of the software, in the sidebar always white (the sidebar is dark in both designs); opens Info. */
.maker-mark{display:flex;align-items:center;gap:8px;width:max-content;padding:2px 6px;border:0;border-radius:6px;background:none;color:var(--faint);font:inherit;font-size:10.5px;letter-spacing:.02em;cursor:pointer;opacity:.75;transition:opacity .15s}
.maker-mark:hover,.maker-mark:focus-visible{opacity:1}.maker-mark img{width:70px;height:auto}
/* Logos with a light and a dark version: the dark one only on the screen in the dark design (printing stays light). */
.for-dark{display:none}
@media screen{:root[data-theme=dark] .for-light{display:none}:root[data-theme=dark] .for-dark{display:inline}}
.sidebar-backdrop{display:none;position:fixed;inset:0;z-index:25;background:var(--backdrop)}
body.nav-open .sidebar-backdrop{display:block}
/* ---------- Header and page ---------- */
/* One header height for every view and width (--topbar): switching between Start and an app does not move the page. */
.main-shell{position:relative;isolation:isolate;margin-left:var(--sidebar);min-width:0;min-height:100dvh;display:flex;flex-direction:column;transition:margin-left .2s var(--ease)}
/* Behind the views: a faint grid of dots and a red glow in the upper corner, fading out downwards (decoration only). */
.main-shell::before{content:"";position:absolute;inset:0 0 auto 0;height:520px;z-index:-1;pointer-events:none;
  background:radial-gradient(640px 320px at 92% -40px,rgba(153,10,44,.09),transparent 70%),radial-gradient(var(--line-2) 1px,transparent 1.3px) 0 0/22px 22px;
  -webkit-mask-image:linear-gradient(#000 20%,transparent);mask-image:linear-gradient(#000 20%,transparent)}
:root[data-theme=dark] .main-shell::before{background:radial-gradient(720px 360px at 92% -60px,rgba(232,40,84,.18),transparent 70%),radial-gradient(var(--line-2) 1px,transparent 1.3px) 0 0/22px 22px}
/* Too old a browser (frontend/browser-check.js): amber like every hint, a note in the sign-in card and a bar above the header. Only
   properties that old browsers know (no inset, gap or color-mix): the note has to stand where the rest of the page fails. */
.browser-outdated{padding:10px 14px;border:1px solid var(--warn-line);border-radius:10px;background:var(--warn-bg);color:var(--warn-text);font-size:13px;line-height:1.55}
.browser-outdated strong{font-weight:600}
.login-card .browser-outdated{margin:16px 0 24px}
.main-shell>.browser-outdated{flex:none;padding:10px max(32px,var(--safe-right)) 10px 32px;border-width:0 0 1px;border-radius:0}
/* The header: frosted glass over the page, a hairline below. Its glass reaches into the safe area at the top of a phone, its content
   starts below it (the header stays --topbar high beside it); at the right it keeps clear of the camera in landscape. */
.topbar{position:sticky;top:0;z-index:20;display:flex;align-items:center;gap:12px;height:calc(var(--topbar) + var(--safe-top));
  padding:var(--safe-top) max(32px,var(--safe-right)) 0 32px;border-bottom:1px solid var(--line);
  background:var(--glass);-webkit-backdrop-filter:blur(18px) saturate(1.4);backdrop-filter:blur(18px) saturate(1.4)}
.nav-toggle{display:none}
/* No breadcrumb (user decision 2026-10-21): the actions stand at the right, the weather (frontend/weather.css) fills the room before them. */
.header-actions{display:flex;align-items:center;gap:8px;flex:none;margin-left:auto}
/* „Support / Hilfe anfordern“ (user wish 2026-10-20): a pill in the brand tint, first of the header actions, so it is in view on every
   page and beside every app (and below the sign-in card, frontend/access.css); since 2026-11-12 a button that opens the small dialog
   with the data of Info → Hersteller (frontend/information.js openSupport) instead of the vendor's website. The header gives it the short name on a tablet and only the symbol on a phone; the whole name stays the aria-label. */
.support-link{display:inline-flex;align-items:center;justify-content:center;gap:7px;flex:none;height:36px;padding:0 14px 0 11px;border:1px solid var(--brand-line);
  border-radius:999px;background:var(--brand-soft);color:var(--brand-text);font-family:inherit;font-size:12px;font-weight:600;line-height:1;white-space:nowrap;text-decoration:none;cursor:pointer;
  transition:background .15s,color .15s,border-color .15s,box-shadow .15s}
.support-link:hover{background-color:var(--brand);background-image:var(--brand-grad);border-color:transparent;color:var(--on-brand);box-shadow:var(--brand-glow)}
.support-link .icon{width:17px;height:17px}
.support-short{display:none}
/* „Empfiehl Superus ERP weiter“ (user request of 2026-11-18): a second pill right after the support hint, with its look
   (.support-link); it opens the window with the offer of the vendor (frontend/information.js openRecommend). The whole name stands only
   where the header has room for it (from 1600 px), „Weiterempfehlen“ from 1400 px and the gift symbol alone below – a 1280 px header
   with the own working time and the longer words of other languages has no room for more –, so the weather keeps its days and nothing
   is squeezed; the whole name stays the aria-label and the tooltip.
   A phone has no room for it beside the own working time (frontend/worktime.css) and none at all below 360 px: there the button leaves
   the header, the entry „Weiterempfehlen“ of the user menu opens the same window on every device. */
.recommend-long,.recommend-short{display:none}
.recommend-link{width:36px;padding:0}
@media (min-width:1400px){.recommend-short{display:inline}.recommend-link{width:auto;padding:0 14px 0 11px}}
@media (min-width:1600px){.recommend-long{display:inline}.recommend-short{display:none}}
@media (max-width:600px){.topbar:has(#work-time:not(.hidden)) .recommend-link{display:none}}
@media (max-width:359px){.topbar .recommend-link{display:none}}
/* „← Zurück zu …“ after a direct link from another app (frontend/app.js, N13); long names end with „…“, the tooltip has them whole. */
.back-button{display:inline-flex;align-items:center;gap:6px;flex:0 1 auto;min-width:0;max-width:40%;height:36px;padding:0 12px 0 10px;border:1px solid var(--line-2);border-radius:10px;
  background:var(--surface);color:var(--ink);font-size:12px;font-weight:600;white-space:nowrap;box-shadow:var(--shadow-1);transition:background .15s,border-color .15s}
.back-button:hover{background:var(--hover);border-color:var(--line-2)}
/* Buttons of the header (light/dark, tasks): white tiles with a fine frame. */
.header-button{border-color:var(--line-2);background:var(--surface);color:var(--ink-soft);box-shadow:var(--shadow-1)}
.header-button:hover{background:var(--hover);color:var(--ink)}
/* The power button, last of the header actions (user wish of 17.11.2026): signs out at once (frontend/auth.js). Round like a power switch,
   the symbol in the brand red; hover fills it. */
.power-off{border-radius:50%;border-color:var(--brand-line);color:var(--brand-text)}
.power-off:hover{background-color:var(--brand);background-image:var(--brand-grad);border-color:transparent;color:var(--on-brand);box-shadow:var(--brand-glow)}
/* Room for it in a narrow header: up to 900 px (tablet in portrait, phone in landscape) the weather shows only the current weather – the
   days stay in its details –, and a phone has no switch light/dark in the header (Mein Konto → Darstellung has it). */
@media (max-width:900px){
  .topbar .weather-days{display:none}
  .topbar .weather-button{gap:0}
}
@media (max-width:600px){
  .topbar .theme-toggle{display:none}
}
/* Light/dark: the moon offers the dark theme, the sun the light one. */
.theme-toggle .theme-light,:root[data-theme=dark] .theme-toggle .theme-dark{display:none}
:root[data-theme=dark] .theme-toggle .theme-light{display:block}
/* The symbol of folding points the other way while the sidebar is folded. */
.sidebar-collapse[aria-expanded=false] .icon{transform:scaleX(-1)}
.back-arrow .icon{width:16px;height:16px}
.user-caret .icon{width:14px;height:14px}
.back-arrow{flex:none;color:var(--brand-text);font-size:15px;line-height:1}
.back-label{min-width:0;overflow:hidden;text-overflow:ellipsis}
/* Margins of the pages: at the right and at the bottom at least the safe area of a phone (the sidebar covers the left one). */
main{flex:1;min-width:0;padding:32px max(40px,var(--safe-right)) max(32px,var(--safe-bottom)) 40px}
.page-heading{display:flex;justify-content:space-between;gap:20px;align-items:center;margin-bottom:32px}
/* Small line above a title: capitals with wide spacing after a short red line. */
.eyebrow{display:flex;align-items:center;gap:10px;font-size:11px;letter-spacing:.18em;text-transform:uppercase;color:var(--muted);font-weight:600;margin:0 0 10px}
.eyebrow::before{content:"";flex:none;width:22px;height:2px;border-radius:2px;background-color:var(--brand);background-image:var(--brand-grad);box-shadow:0 0 8px rgba(210,26,70,.55)}
h1{font-size:32px;letter-spacing:-.8px;margin:0 0 12px;color:var(--ink)}
h2{font-size:18px;letter-spacing:-.3px;font-weight:600;margin:0 0 12px;color:var(--ink)}
.page-heading p:not(.eyebrow){font-size:13px;color:var(--muted);margin:0}
.primary,.secondary{border:0;border-radius:10px;padding:11px 17px;font-size:12px;font-weight:600;white-space:nowrap;transition:background .15s,border-color .15s,box-shadow .15s,filter .15s}
/* Primary button: the red gradient (background-color stays the plain brand colour), a light top edge and a red glow. */
.primary{background-color:var(--brand);background-image:var(--brand-grad);color:var(--on-brand);box-shadow:inset 0 1px 0 rgba(255,255,255,.25),var(--brand-glow)}
.primary:hover{background-color:var(--brand-strong);filter:brightness(1.07)}
.secondary{border:1px solid var(--line-2);background:var(--surface);color:var(--ink);box-shadow:var(--shadow-1)}
.secondary:hover{background:var(--hover)}
.link-button{border:0;border-radius:7px;background:none;padding:4px 6px;color:var(--brand-text);font-size:13px;font-weight:600;white-space:nowrap}
.link-button:hover{background:var(--brand-soft)}
.toolbar{display:flex;justify-content:space-between;align-items:center;margin-bottom:22px;color:var(--muted);font-size:11px}
.search{display:flex;gap:10px;align-items:center;border:1px solid var(--line-2);background:var(--input-bg);border-radius:10px;padding:10px 13px;width:300px}
.search input{border:none;outline:none;background:none;font-size:12px;width:100%;color:var(--ink)}
.install-note{display:flex;gap:17px;padding:22px;border:1px solid var(--line);background:var(--surface-3);border-radius:10px;font-size:12px;line-height:1.7;margin-bottom:24px}
.install-note p{margin:4px 0 0;color:var(--muted);font-size:11px}
.note-icon{font-size:26px;color:var(--brand-text)}
code{font-size:11px}
.empty-catalog{text-align:center;padding:70px 20px}
.empty-catalog p{font-size:12px;color:var(--muted);text-align:center;line-height:1.9;margin:0 0 24px}
.connection,.registry-error{border:1px solid var(--warn-line);background:var(--warn-bg);color:var(--warn-text);padding:15px 20px;border-radius:8px;font-size:12px;line-height:1.7;margin-bottom:24px}
.toast{position:fixed;bottom:calc(30px + var(--safe-bottom));right:calc(30px + var(--safe-right));z-index:50;padding:16px 22px;background:#1d1d21;color:#fff;border:1px solid rgba(255,255,255,.08);border-radius:12px;font-size:12px;box-shadow:var(--shadow-2);max-width:480px}

/* ---------- Cards of „Apps verwalten“ and of „Benutzer & Rollen“ ---------- */
.app-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(230px,1fr));gap:18px;margin-top:20px}
.app-card{position:relative;padding:24px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);display:flex;flex-direction:column;box-shadow:var(--shadow-card)}
.app-card h2{margin:18px 0 8px}
.app-card p{font-size:12px;color:var(--muted);line-height:1.8;min-height:42px}
.app-card .card-description{margin:0;height:3.6em;min-height:0;overflow:hidden;display:-webkit-box;-webkit-box-orient:vertical;-webkit-line-clamp:2}
.app-card .help{min-height:0;margin:0}
.app-card-actions{margin-top:auto;display:grid;gap:8px}
.app-card-actions .primary{border:1px solid transparent}
.app-icon{display:grid;place-items:center;width:44px;height:44px;border-radius:13px;color:#fff;font-size:16px;font-weight:600;
  background-image:linear-gradient(150deg,rgba(255,255,255,.26),rgba(255,255,255,0) 50%,rgba(0,0,0,.2));box-shadow:inset 0 1px 0 rgba(255,255,255,.25),0 10px 22px -8px var(--tone,#5a5a5a)}
.card-meta{display:flex;justify-content:space-between;gap:8px;flex-wrap:wrap;margin:22px 0;font-size:10px;color:var(--muted)}
.app-card button{width:100%}
#install-message{white-space:pre-line}#install-list{margin:0;padding-left:20px}
/* The command for the console of the server (B7): selectable, never cut. */
.install-command{margin:0;padding:10px 12px;border:1px solid var(--line);border-radius:8px;background:var(--surface-3)}
.install-command code{font-family:ui-monospace,Consolas,monospace;font-size:13px;overflow-wrap:anywhere;user-select:all}
/* Required apps on the app card: small name tags that wrap instead of being cut off; missing apps in red, details in the tooltip. */
.card-requires{display:grid;gap:6px}.requires-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 6px;font-size:11px;line-height:1.4}
.requires-label{color:var(--muted);font-weight:600}.requires-tag{padding:1px 8px;border-radius:10px;background:var(--surface-3);color:var(--ink-soft);cursor:default;white-space:nowrap}
.requires-tag.missing{background:var(--err-bg);color:var(--err-text);font-weight:600}

/* ---------- Start ---------- */
/* The head of Start: a dark panel in both themes with orbit lines, a red light from below and a fine grid; the name in the red
   gradient. Beside it three figures of the task inbox (overdue, due today, open), each a button to „Aufgaben“. */
.start-hero{position:relative;overflow:hidden;display:flex;align-items:flex-end;gap:28px;margin-bottom:22px;padding:32px 34px 30px;border-radius:22px;color:#c9c9cf;
  border:1px solid rgba(255,255,255,.06);
  background:radial-gradient(520px 300px at 100% 120%,rgba(210,26,70,.55),transparent 70%),radial-gradient(380px 240px at 62% -30%,rgba(153,10,44,.35),transparent 70%),
    linear-gradient(135deg,#1c1c20,#141416 70%);
  box-shadow:inset 0 1px 0 rgba(255,255,255,.08),0 24px 50px -24px rgba(20,8,12,.55)}
:root[data-theme=dark] .start-hero{border-color:rgba(255,92,127,.18);background:radial-gradient(560px 320px at 100% 120%,rgba(232,40,84,.5),transparent 70%),
  radial-gradient(380px 240px at 62% -30%,rgba(153,10,44,.4),transparent 70%),linear-gradient(135deg,#1d1418,#120d10 70%)}
.start-hero::before{content:"";position:absolute;inset:0;pointer-events:none;background-image:linear-gradient(rgba(255,255,255,.045) 1px,transparent 1px),
  linear-gradient(90deg,rgba(255,255,255,.045) 1px,transparent 1px);background-size:32px 32px;
  -webkit-mask-image:radial-gradient(600px 300px at 80% 100%,#000,transparent 75%);mask-image:radial-gradient(600px 300px at 80% 100%,#000,transparent 75%)}
.start-hero::after{content:"";position:absolute;left:0;right:0;top:0;height:1px;background:linear-gradient(90deg,transparent,rgba(255,110,140,.6),transparent)}
.start-orbit{position:absolute;left:34%;top:-90px;width:1000px;height:380px;pointer-events:none}
.start-orbit ellipse,.start-orbit path{fill:none;stroke:rgba(255,255,255,.09);stroke-width:1}
.start-orbit .lit{stroke:url(#start-orbit-light);stroke-width:1.6;filter:drop-shadow(0 0 6px rgba(255,61,106,.9))}
.start-orbit circle{fill:#ff8aa3;filter:drop-shadow(0 0 6px #ff3d6a)}
.start-hero-text{position:relative;z-index:1;flex:1;min-width:0}
.start-hero .eyebrow{color:#9a9aa1}
.start-hero h1{margin:0 0 10px;font-size:44px;line-height:1.08;font-weight:300;letter-spacing:-1.3px;color:#fff;overflow-wrap:anywhere}
/* The name in the greeting: a red gradient as colour of the text. */
.start-name{background:linear-gradient(92deg,#ff7d98 0%,#ff3d6a 45%,#d01a45 100%);-webkit-background-clip:text;background-clip:text;color:transparent;-webkit-text-fill-color:transparent}
.start-summary{margin:0;font-size:15px;color:#b3b3b9;line-height:1.6}
.start-stats{position:relative;z-index:1;display:flex;gap:12px;flex:none}
.start-stat{display:grid;gap:8px;width:156px;padding:14px 16px 15px;border-radius:15px;text-align:left;color:#fff;
  background:rgba(255,255,255,.055);border:1px solid rgba(255,255,255,.1);-webkit-backdrop-filter:blur(8px);backdrop-filter:blur(8px);box-shadow:inset 0 1px 0 rgba(255,255,255,.07);
  transition:background .15s,border-color .15s}
.start-stat:hover{background:rgba(255,255,255,.09);border-color:rgba(255,255,255,.18)}
.start-stat:focus-visible{outline-color:#c4c4ca}
.start-stat-label{display:flex;align-items:center;gap:8px;font-size:12px;color:#adadb4;overflow-wrap:anywhere}
.start-stat-label::before{content:"";flex:none;width:8px;height:8px;border-radius:50%;background:var(--dot);box-shadow:0 0 10px var(--dot)}
.start-stat-value{font-size:34px;line-height:1;font-weight:300;letter-spacing:-1px;font-variant-numeric:tabular-nums}
.start-stat-bar{display:block;height:3px;border-radius:3px;background:rgba(255,255,255,.09);overflow:hidden}
.start-stat-bar>span{display:block;height:100%;width:var(--share,0%);border-radius:3px;background:var(--dot);box-shadow:0 0 10px var(--dot);transition:width .4s var(--ease)}
.start-stat.state-overdue{--dot:#ef6b54}.start-stat.state-today{--dot:#efb54a}.start-stat.state-open{--dot:#ff3d6a}

/* Cards of Start: a head with a symbol, the title and an action; a lit hairline at the top edge. */
.start-grid{display:grid;grid-template-columns:minmax(0,1.7fr) minmax(0,1fr);gap:22px;align-items:start}
.start-recent{grid-column:1/-1}
.start-card{position:relative;min-width:0;padding:18px 20px 20px;background:var(--surface);border:1px solid var(--line);border-radius:var(--radius-lg);box-shadow:var(--shadow-card)}
.start-card::before,.tile::before{content:"";position:absolute;left:24px;right:24px;top:-1px;height:1px;background:linear-gradient(90deg,transparent,var(--brand-line),transparent)}
.start-card-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin-bottom:14px}
.start-card-head .link-button{margin-left:auto}
.card-icon{flex:none;display:grid;place-items:center;width:30px;height:30px;border-radius:9px;background:var(--surface-2);border:1px solid var(--line);color:var(--ink-soft)}
.card-icon .icon{width:16px;height:16px}
.start-card h2{font-size:16px;letter-spacing:-.1px;margin:0;overflow-wrap:anywhere}
.start-setup{margin-bottom:22px}.start-setup .help{margin:0 0 16px}
.start-list,.start-apps{list-style:none;margin:0;padding:0;display:grid;gap:4px}
/* Rows of tasks and apps: the symbol of the app, title and line below, a counter or an arrow at the end. */
.start-task,.start-app{position:relative;display:flex;align-items:center;gap:14px;width:100%;min-width:0;padding:12px 14px;border:1px solid transparent;border-radius:13px;background:none;color:var(--ink);
  text-align:left;transition:background .15s,border-color .15s}
.start-task:hover,.start-app:hover{background:var(--surface-2);border-color:var(--line)}
.start-task .app-badge,.start-app .app-badge{width:36px;height:36px;border-radius:11px;font-size:12.5px}
/* A lit line at the left edge in the colour of the state: overdue red, due today amber. */
.start-task{padding-left:20px}
.start-task::before{content:"";position:absolute;left:5px;top:13px;bottom:13px;width:3px;border-radius:3px;background:var(--line-2)}
.start-task.state-overdue::before{background:var(--err);box-shadow:0 0 10px color-mix(in srgb,var(--err) 60%,transparent)}
.start-task.state-today::before{background:var(--warn);box-shadow:0 0 10px color-mix(in srgb,var(--warn) 50%,transparent)}
.start-task::after{content:"";flex:none;width:34px;height:34px;border-radius:10px;border:1px solid var(--line-2);background:var(--surface) center/16px no-repeat;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374747a' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12h13M13 6.5 18.5 12 13 17.5'/%3E%3C/svg%3E")}
.start-text{flex:1;min-width:0;display:grid;gap:4px}
.start-title{font-size:14px;font-weight:600;overflow-wrap:anywhere}
.start-meta{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:12.5px;color:var(--muted);overflow-wrap:anywhere}
/* The due date of a task as a chip in the colour of its state. */
.state-chip{display:inline-flex;align-items:center;gap:6px;min-height:22px;padding:2px 9px;border-radius:20px;font-size:11.5px;font-weight:600;line-height:1.3}
.state-chip::before{content:"";flex:none;width:6px;height:6px;border-radius:50%;background:currentColor}
.state-chip.state-overdue{background:var(--err-bg);color:var(--err-text)}
.state-chip.state-today{background:var(--warn-bg);color:var(--warn-text)}
.state-chip.state-later{background:var(--surface-3);color:var(--ink-soft)}
/* Apps with open tasks: the share of all open tasks as a bar in the colour of the app. */
.start-share{display:block;height:5px;margin-top:4px;border-radius:5px;background:var(--surface-3);overflow:hidden}
.start-share>span{display:block;height:100%;width:var(--share,0%);border-radius:5px;background:linear-gradient(90deg,color-mix(in srgb,var(--tone) 55%,#fff),var(--tone));
  box-shadow:0 0 10px color-mix(in srgb,var(--tone) 55%,transparent)}
.start-app .count{min-width:auto;padding:0;background:none;font-size:24px;font-weight:300;line-height:1;letter-spacing:-.5px;color:var(--ink)}
/* Apps opened last: tiles with a large symbol, a coloured line at the top and a glow below the symbol. */
.start-recent .start-apps{grid-template-columns:repeat(auto-fill,minmax(min(100%,190px),1fr));gap:14px}
.start-recent .start-app{flex-direction:column;align-items:flex-start;gap:14px;min-height:118px;padding:16px;border-color:var(--line);overflow:hidden;
  background:linear-gradient(160deg,var(--surface-2),var(--surface) 60%)}
.start-recent .start-app::before{content:"";position:absolute;left:16px;right:16px;top:0;height:2px;border-radius:0 0 2px 2px;background:linear-gradient(90deg,transparent,var(--tone),transparent);opacity:.8}
.start-recent .start-app:hover{border-color:var(--brand-line);box-shadow:0 0 0 4px var(--brand-soft)}
.start-recent .app-badge{width:40px;height:40px;border-radius:12px;font-size:13px;box-shadow:inset 0 1px 0 rgba(255,255,255,.28),0 10px 22px -6px color-mix(in srgb,var(--tone) 85%,transparent)}
.start-empty{margin:4px 0 0;font-size:13px;line-height:1.6;color:var(--muted)}
.start-more{margin:10px 0 0}
/* ---------- Tiles of Start (frontend/tiles.js): figures and charts of the apps, chosen by each user ---------- */
.start-tiles{margin-bottom:22px}
.start-section-head{display:flex;flex-wrap:wrap;align-items:center;gap:8px 12px;margin:0 2px 14px}
.start-section-head h2{margin:0;font-size:16px}
.start-section-head .icon-button{margin-left:auto;font-size:15px}
.start-tiles .form-status:empty{display:none}
.tile-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(min(100%,250px),1fr));gap:16px}
/* A tile: symbol and name, the figure in light large type with its unit, the line with period and deviation, the chart at the
   bottom edge. The colour of the app (--tone) tints the chart. Every tile follows the design of the user: light in the light one, dark
   in the dark one (user decision of 2026-10-21; only the head of Start stays dark in both). */
.tile{position:relative;overflow:hidden;display:flex;flex-direction:column;align-items:stretch;gap:2px;min-width:0;min-height:176px;padding:16px 18px 0;
  border:1px solid var(--line);border-radius:var(--radius-lg);background:var(--surface);box-shadow:var(--shadow-card);color:var(--ink);text-align:left;
  transition:border-color .15s,box-shadow .15s,transform .15s}
.tile:hover{border-color:var(--brand-line);box-shadow:var(--shadow-card),0 0 0 4px var(--brand-soft)}
.tile-head{display:flex;align-items:center;gap:10px;min-width:0}
.tile-head .app-badge{width:24px;height:24px;border-radius:7px;font-size:10px}
.tile-names{display:grid;min-width:0}
.tile-title{font-size:13px;font-weight:600;overflow-wrap:anywhere}
.tile-app{font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.tile-value{margin:12px 0 2px;font-size:28px;line-height:1.1;font-weight:300;letter-spacing:-.8px;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}
.tile-unit{margin-left:4px;font-size:16px;letter-spacing:0;color:var(--muted)}
.tile.state-ok .tile-value{color:var(--ok-text)}.tile.state-warn .tile-value{color:var(--warn-text)}.tile.state-error .tile-value{color:var(--err-text)}
.tile-line{display:flex;flex-wrap:wrap;align-items:center;gap:4px 10px;font-size:12px;color:var(--muted)}
.tile-caption{overflow-wrap:anywhere}
/* The deviation from the comparison: neutral, a deviation is no state. */
.tile-delta{display:inline-flex;align-items:center;min-height:20px;padding:1px 8px;border-radius:20px;border:1px solid var(--line);background:var(--surface-2);color:var(--ink-soft);
  font-size:11px;font-weight:600;white-space:nowrap}
.tile-problem{margin:14px 0 16px;font-size:12.5px;line-height:1.5;color:var(--warn-text);overflow-wrap:anywhere}
.tile-spark{position:relative;margin:auto -18px 0;padding-top:10px;height:72px;color:color-mix(in srgb,var(--tone,var(--brand)) 85%,var(--ink))}
.tile-spark svg{display:block;width:100%;height:100%;overflow:visible}
.tile-spark-line{fill:none;stroke:currentColor;stroke-width:1.8;stroke-linecap:round;vector-effect:non-scaling-stroke}
.tile-spark-dot{position:absolute;width:7px;height:7px;margin:-3px 0 0 -6px;border-radius:50%;background:currentColor;box-shadow:0 0 0 4px color-mix(in srgb,currentColor 20%,transparent)}
.tile-chart{margin:auto 0 14px;padding-top:12px}
.tile-bars{display:flex;align-items:flex-end;gap:4px;height:58px}
/* A bar is at most 36 px wide, so a week with only Monday so far does not fill the whole tile. */
.tile-bar{flex:1;min-width:3px;max-width:36px;height:var(--size);border-radius:4px 4px 2px 2px;background:linear-gradient(180deg,color-mix(in srgb,var(--tone,var(--brand)) 70%,#fff),var(--tone,var(--brand)));opacity:.9}
.tile-bar:last-child{opacity:1;box-shadow:0 0 12px color-mix(in srgb,var(--tone,var(--brand)) 55%,transparent)}
.tile-bar-labels{display:flex;gap:4px;margin-top:5px;font-size:10px;color:var(--faint)}
.tile-bar-labels span{flex:1;min-width:0;max-width:36px;overflow:visible;white-space:nowrap}
.tile-bar-labels span:last-child{text-align:right}
/* A course with comparison lines (tiles.js plot, Tile.lines): the course in the first chart colour and a little thicker, the comparison
   lines thin and grey – solid, dashed, dotted from the newest to the oldest, so they differ without relying on colour. Text keeps the
   text colours; the short line before a name carries colour and pattern. A wide tile takes two columns when the section has room for
   them (container query: on a phone it stays one column wide). */
.start-tiles{container-type:inline-size}
@container (min-width:540px){.tile.wide{grid-column:span 2}}
.tile-plot{display:block;margin:auto 0 0;padding-top:10px;container-type:inline-size}
.tile-legend{display:flex;flex-wrap:wrap;gap:2px 14px;margin-bottom:8px;font-size:11.5px;color:var(--ink-soft)}
/* A long name (e.g. a year that counts from a day on) wraps inside the tile; the short line stays at the first line of the name. */
.tile-key{display:inline-flex;align-items:flex-start;gap:6px;min-width:0;max-width:100%;font-variant-numeric:tabular-nums}
.tile-key>span{min-width:0;overflow-wrap:anywhere}
.tile-swatch{flex:none;width:16px;height:0;margin-top:.6em;border-top:3px solid var(--chart-1);border-radius:1px}
.tile-swatch[class*=other]{border-top:2px solid var(--chart-6)}.tile-swatch.other-2{border-top-style:dashed}.tile-swatch.other-3{border-top-style:dotted}
.tile-plot-box{position:relative;display:block;height:84px}
.tile.wide .tile-plot-box{height:124px}
.tile-plot-box svg{display:block;width:100%;height:100%;overflow:visible}
.tile-plot-zero{stroke:var(--chart-grid);stroke-width:1;vector-effect:non-scaling-stroke}
.tile-plot-line{fill:none;stroke:var(--chart-1);stroke-width:2.5;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke}
.tile-plot-line[class*=other]{stroke:var(--chart-6);stroke-width:1.5}.tile-plot-line.other-2{stroke-dasharray:6 5}.tile-plot-line.other-3{stroke-dasharray:.1 4.5}
/* The end of the course: a dot with a ring in the colour of the tile, so it stays readable on a line it crosses. */
.tile-plot-dot{position:absolute;width:8px;height:8px;margin:-4px 0 0 -4px;border-radius:50%;background:var(--chart-1);box-shadow:0 0 0 2px var(--surface)}
.tile-cross{position:absolute;top:0;bottom:0;width:1px;margin-left:-.5px;background:var(--chart-axis);pointer-events:none}
.tile-tip{position:absolute;top:0;z-index:1;display:grid;gap:2px;padding:6px 9px;border:1px solid var(--line);border-radius:8px;background:var(--surface);box-shadow:var(--shadow-1);
  font-size:11px;line-height:1.4;color:var(--ink);pointer-events:none}
.tile-tip strong{font-weight:600}
/* Labels of the axis: each centred below its point, the first and the last inside the chart. A narrow chart hides the ones marked minor. */
.tile-axis{position:relative;display:block;height:14px;margin:5px 0 12px;font-size:10px;color:var(--chart-text)}
.tile-axis span{position:absolute;top:0;transform:translateX(-50%);white-space:nowrap}
.tile-axis span.first{transform:none}.tile-axis span.last{transform:translateX(-100%)}
@container (max-width:420px){.tile-axis .minor{display:none}}
.tile-compare{flex-basis:100%}
/* No tile chosen yet: a dashed card with the way to the selection. */
.tiles-empty{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:12px 20px;padding:18px 20px;border:1px dashed var(--line-2);border-radius:var(--radius-lg);
  background:var(--surface-2)}
.tiles-empty p{flex:1 1 320px;margin:0;font-size:13px;line-height:1.6;color:var(--muted)}
/* Kacheln anpassen: chosen tiles in their order on the left, the offer of the apps on the right. */
.tiles-dialog{width:min(980px,calc(100% - 32px));background:var(--surface)}
.tiles-dialog[open]{display:flex;flex-direction:column}
.tiles-dialog form{display:flex;flex-direction:column;gap:12px;min-height:0}
.tiles-columns{display:grid;grid-template-columns:minmax(0,1fr) minmax(0,1.3fr);gap:20px;min-height:0}
.tiles-columns h3{margin:0 0 8px;font-size:13px;letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.tiles-count{margin:0 0 8px}
.tiles-chosen{list-style:none;margin:0;padding:0;display:grid;gap:6px}
.tiles-chosen-item{display:flex;align-items:center;gap:8px;padding:8px;border:1px solid var(--line);border-radius:var(--radius);background:var(--surface-2)}
.tiles-chosen-item .app-badge{width:26px;height:26px;font-size:10.5px}
.tiles-chosen-text{flex:1;min-width:0;display:grid}
.tiles-chosen-text strong{font-size:13px;overflow-wrap:anywhere}.tiles-chosen-text small{font-size:11px;color:var(--muted);overflow-wrap:anywhere}
.tiles-offer{display:grid;gap:14px;max-height:min(52dvh,520px);overflow:auto;padding-right:4px}
.tiles-app-head{display:flex;align-items:center;gap:8px;margin:0 0 6px;font-size:13px}
.tiles-app-head .app-badge{width:22px;height:22px;font-size:9.5px;border-radius:6px}
.tiles-option{display:flex;align-items:flex-start;gap:10px;padding:8px 10px;border-radius:10px;cursor:pointer}
.tiles-option:hover{background:var(--hover)}
.tiles-option input{flex:none;margin-top:3px;width:16px;height:16px;accent-color:var(--brand)}
.tiles-option-text{display:grid;gap:3px;min-width:0}
.tiles-option-text strong{font-size:13px;overflow-wrap:anywhere}
.tiles-option-text small{font-size:12px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.tiles-option-text .state-chip{justify-self:start}
.dialog-actions{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:10px}
@media (max-width:700px){.tiles-columns{grid-template-columns:minmax(0,1fr)}.tiles-offer{max-height:none}}

/* ---------- Protokoll → Ereignisse zwischen Apps ---------- */
.event-list{display:grid;gap:8px}
.event-row{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 16px;background:var(--surface);border:1px solid var(--line);border-left:4px solid var(--warn);border-radius:10px}
.event-row.state-failed{border-left-color:var(--err)}
.event-row.state-dismissed{border-left-color:var(--line-2);background:var(--surface-2)}
.event-row.focused{box-shadow:0 0 0 3px var(--focus)}
.event-row:focus{outline:0}
.event-main{flex:1 1 320px;min-width:0}
.event-title{display:block;font-family:ui-monospace,Consolas,monospace;font-size:12px;overflow-wrap:anywhere}
.event-state{margin:4px 0 0;font-size:12px;line-height:1.6;color:var(--muted);overflow-wrap:anywhere}
.state-failed .event-state{color:var(--err-text)}
.event-actions{display:flex;flex-wrap:wrap;gap:8px}
#audit-events-message{margin:0 0 10px}
.dismiss-subject{font-family:ui-monospace,Consolas,monospace;overflow-wrap:anywhere}
/* Protokoll → Abgleich zwischen Apps: last run of each app (backend/reconciliation.py). */
.reconcile-heading{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 16px;margin:36px 0 12px}
.reconcile-heading .audit-events-title{margin:0}
.reconcile-row.state-ok{border-left-color:var(--ok)}
.reconcile-row.state-error,.reconcile-row.state-timeout{border-left-color:var(--err)}
.reconcile-row.state-none,.reconcile-row.state-running{border-left-color:var(--line-2)}
.reconcile-title{display:block;font-size:13px;overflow-wrap:anywhere}
.reconcile-notes{margin:6px 0 0;padding-left:18px;font-size:12px;line-height:1.6;color:var(--ink-soft);overflow-wrap:anywhere}
#reconcile-message{margin:0 0 10px}
#reconcile-message.busy{color:var(--muted)}

/* ---------- Hits of the global search: beside the sidebar (placed by frontend/search.js) or in the palette ---------- */
.search-panel{position:fixed;z-index:40;display:flex;flex-direction:column;background:var(--surface);border:1px solid var(--line);border-radius:12px;box-shadow:var(--shadow-2);overflow:hidden}
.search-body{flex:1;min-height:0;display:flex;flex-direction:column}
.search-status{flex:none;margin:0;padding:10px 14px 2px;font-size:12px;line-height:1.5;color:var(--muted);overflow-wrap:anywhere}
.search-status:empty{display:none}
.search-results{flex:1;min-height:0;overflow-y:auto;padding:4px 6px 8px;overscroll-behavior:contain}
.search-results:empty{display:none}
.search-group{padding:4px 0}
.search-group+.search-group{margin-top:2px;padding-top:6px;border-top:1px solid var(--line)}
.search-group-head{display:flex;align-items:center;gap:8px;min-width:0;padding:4px 8px;font-size:11px;font-weight:650;letter-spacing:.06em;text-transform:uppercase;color:var(--muted);overflow-wrap:anywhere}
.search-group-head .app-badge{width:20px;height:20px;border-radius:6px;font-size:9px;letter-spacing:0}
.search-option{display:flex;align-items:center;gap:10px;min-height:40px;padding:6px 10px;border-radius:8px;color:var(--ink);cursor:pointer}
.search-option:hover{background:var(--hover)}
.search-option.active{background:var(--brand-soft);box-shadow:inset 3px 0 0 var(--brand)}
.search-text{flex:1;min-width:0;display:grid;gap:1px}
.search-title{font-size:13px;font-weight:600;overflow-wrap:anywhere}
.search-meta{font-size:12px;color:var(--muted);overflow-wrap:anywhere}
.search-problem{margin:0;padding:0 10px 6px 36px;font-size:12px;line-height:1.5;color:var(--warn-text);overflow-wrap:anywhere}
.search-keys{flex:none;margin:0;padding:7px 14px;border-top:1px solid var(--line);font-size:11px;color:var(--faint);overflow-wrap:anywhere}
.search-dialog{width:min(640px,calc(100% - 32px));max-height:min(80dvh,640px);margin:10dvh auto auto;padding:0;overflow:hidden}
.search-dialog[open]{display:flex;flex-direction:column}
.palette-box{flex:none;margin:12px;background:var(--surface)}
.palette-box input{padding:11px 0;font-size:15px}
.search-close{flex:none;padding:4px 8px;font-size:11px}

/* ---------- App pages (one frame per app, the hidden ones keep their state) ---------- */
/* The frame fills the visible height and ends above the home bar of a phone (safe area), so the buttons at the foot of an app page and
   of its dialogs stay reachable. */
body.app-open .main-shell{height:100dvh;min-height:0}
body.app-open main{display:flex;flex-direction:column;min-height:0;padding:12px max(16px,var(--safe-right)) max(12px,var(--safe-bottom)) 16px}
#app-view:not(.hidden){flex:1;display:flex;flex-direction:column;min-height:0}
.app-frames{flex:1;display:flex;min-height:0}
/* The frame follows the theme (color-scheme of the page), so the app page draws its own background without a white box. At least
   300 px high – on a phone in landscape at most half the visible height, so the frame never reaches below the screen or the home bar. */
.app-frame{flex:1;width:100%;min-height:min(300px,50dvh);border:1px solid var(--line);border-radius:14px;background:var(--bg);box-shadow:var(--shadow-card)}

/* ---------- Folded sidebar (rail of symbols): chosen on the desktop, while an app is open on a tablet ---------- */
@media (min-width:601px){
  body.sidebar-rail .main-shell{margin-left:var(--rail)}
  body.sidebar-rail:not(.nav-open) .sidebar{width:var(--rail)}
  body.sidebar-rail:not(.nav-open) .sidebar-head{flex-direction:column;gap:6px;padding:12px 0 6px}
  body.sidebar-rail:not(.nav-open) .sidebar .brand{margin:0}
  body.sidebar-rail:not(.nav-open) .sidebar .brand-symbol{display:block}
  body.sidebar-rail:not(.nav-open) :is(.brand-name,.nav-text,.nav-hint,.sidebar-search>.search-box,.app-label,.user-text,.user-caret,.mode-badge,#db-status,.maker-mark,.nav-heading>*){display:none!important}
  body.sidebar-rail:not(.nav-open) .search-open{display:flex}
  body.sidebar-rail:not(.nav-open) .sidebar-search{margin:0 0 2px}
  body.sidebar-rail:not(.nav-open) .sidebar-scroll{padding:4px 12px 12px}
  body.sidebar-rail:not(.nav-open) :is(.nav-item,.app-link){justify-content:center;padding:7px 0}
  body.sidebar-rail:not(.nav-open) .nav-heading{height:1px;min-height:0;margin:12px 6px;background:var(--line)}
  body.sidebar-rail:not(.nav-open) :is(.nav-item,.app-link) .count{position:absolute;top:2px;right:0;min-width:16px;padding:0 4px;font-size:9px;line-height:15px}
  body.sidebar-rail:not(.nav-open) :is(.nav-item.selected,.app-item.active)::before{left:-12px}
  body.sidebar-rail:not(.nav-open) .user-button{justify-content:center;padding:6px 0}
  body.sidebar-rail:not(.nav-open) .user-menu{left:calc(100% + 8px);right:auto;bottom:8px;width:230px}
  body.sidebar-rail:not(.nav-open) .system-status{justify-content:center;padding:0}
  body.sidebar-rail.nav-open .sidebar{box-shadow:var(--shadow-2)}
}
/* Tablet: narrower page margins; an open app gets the width (the rail opens as an overlay). */
@media (max-width:1100px){
  main{padding:28px max(24px,var(--safe-right)) max(28px,var(--safe-bottom)) 24px}
  .topbar,.main-shell>.browser-outdated{padding-left:20px;padding-right:max(20px,var(--safe-right))}
  .topbar .support-long{display:none}
  .topbar .support-short{display:inline}
  .page-heading{align-items:flex-start}
  h1{font-size:26px}
  /* Start: the figures go below the greeting, the cards below each other. */
  .start-hero{flex-direction:column;align-items:stretch;gap:22px}
  .start-stats{width:100%}.start-stat{flex:1 1 0;width:auto;min-width:0}
  .start-grid{grid-template-columns:minmax(0,1fr)}
  .start-orbit{left:10%}
}
/* Phone: the sidebar is a drawer behind „☰“; nothing beside it, so header and pages keep clear of the safe area at both sides. */
@media (max-width:600px){
  .sidebar{width:calc(min(304px,86vw) + var(--safe-left));transform:translateX(-100%);visibility:hidden;transition:transform .22s var(--ease),visibility 0s .22s,box-shadow .2s}
  body.nav-open .sidebar{transform:none;visibility:visible;box-shadow:var(--shadow-2);transition:transform .22s var(--ease),box-shadow .2s}
  .sidebar-collapse{display:none}
  .sidebar-close{display:inline-grid}
  .main-shell{margin-left:0}
  .nav-toggle{display:inline-grid}
  .topbar{padding:var(--safe-top) max(12px,var(--safe-right)) 0 max(12px,var(--safe-left));gap:8px}
  .main-shell>.browser-outdated{padding-left:max(12px,var(--safe-left));padding-right:max(12px,var(--safe-right))}
  .topbar .support-short{display:none}
  .topbar .support-link{width:36px;padding:0}
  .back-button{max-width:45%;height:36px;padding:0 10px 0 8px}
  main{padding:20px max(16px,var(--safe-right)) max(20px,var(--safe-bottom)) max(16px,var(--safe-left))}
  .page-heading{flex-direction:column;align-items:stretch;gap:16px;margin-bottom:24px}
  .eyebrow{font-size:10px}
  h1{font-size:24px}
  .start-hero{padding:22px 20px 20px;border-radius:18px;gap:18px}
  .start-hero h1{font-size:28px;letter-spacing:-.8px}
  .start-summary{font-size:14px}
  .start-stats{gap:8px}
  .start-stat{padding:10px 12px 12px;gap:6px}
  .start-stat-value{font-size:26px}
  .start-card{padding:16px}
  .start-task,.start-app{padding:10px;gap:12px}
  .start-task{padding-left:18px}
  .start-task::after{display:none}
  .toolbar{gap:15px}
  .search{width:65%}
  .toast{left:calc(16px + var(--safe-left));right:calc(16px + var(--safe-right));bottom:calc(16px + var(--safe-bottom))}
  body.app-open main{padding:8px max(8px,var(--safe-right)) max(8px,var(--safe-bottom)) max(8px,var(--safe-left))}
  /* Touch: no keyboard hints; the palette starts higher. */
  .search-keys{display:none}
  .search-dialog{margin-top:calc(4dvh + var(--safe-top))}
  /* Text fields in 16 px: Safari on the iPhone enlarges the whole page when a field with smaller type gets the focus, and the page stays
     enlarged afterwards. Search field, sign-in, Mein Konto, settings and dialogs set smaller sizes of their own, hence !important;
     checkboxes, radio buttons and the other kinds of input without text keep their size. */
  input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=button],[type=submit],[type=reset],[type=image]),select,textarea{font-size:16px!important}
}
/* Touch screens (a finger instead of a mouse; phones and tablets, any width): symbols and entries of the navigation at least 44 × 44 px
   (--touch-target of frontend/theme.css), so a finger hits them without zooming; the header keeps its height. The mouse keeps the
   smaller sizes above. */
@media (pointer:coarse){
  .icon-button{width:var(--touch-target);height:var(--touch-target)}
  .topbar .support-link,.topbar .weather-button,.back-button,.header-actions .tasks-bell{height:var(--touch-target)}
  @media (max-width:1399px){.topbar .recommend-link{width:var(--touch-target)}}
  .header-actions .tasks-bell{min-width:var(--touch-target)}
  .nav-item,.app-link,.user-menu button,.maker-mark,.nav-tool,.link-button,.search-option{min-height:var(--touch-target)}
  .arrange-button,.search-close{min-width:var(--touch-target);min-height:var(--touch-target)}
}
@media (pointer:coarse) and (max-width:600px){
  .topbar .support-link{width:var(--touch-target)}
}
/* Phone in landscape (package K12c): at 844 × 390 px the rule above does not match, the fields fell back to 12–13 px, and Safari enlarged the
   page on focus. The width cannot tell a phone in landscape from a tablet in portrait, the height can: every phone in landscape is at most
   600 px high, no tablet is (iPad mini 768 px); pointer:coarse leaves a low desktop window with a mouse unchanged. Same fields as above. */
@media (pointer:coarse) and (max-height:600px){
  input:not([type=checkbox],[type=radio],[type=range],[type=color],[type=file],[type=button],[type=submit],[type=reset],[type=image]),select,textarea{font-size:16px!important}
}
@media (prefers-reduced-motion:reduce){
  *,*::before,*::after{transition-duration:.01ms!important;animation-duration:.01ms!important;scroll-behavior:auto!important}
}
