/* Applied Security -- Komponenten-CSS, portiert aus dem High-Fidelity-
   Referenz-Prototyp design_handoff_applied_security/reference/IS-Service.dc.html
   (dort: Inline-Styles, hier: wiederverwendbare Klassen, identische Werte).
   Setzt tokens.css voraus (--bg/--surface/--accent/... + [data-theme]). */

*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent); }
button { font-family: inherit; }

/* --- Buttons --- */
.btn {
  border: 0;
  border-radius: var(--r-md);
  padding: 13px 24px;
  font-weight: 600;
  font-size: 15px;
  cursor: pointer;
}
.btn-primary { background: var(--accent); color: var(--accentInk); }
.btn-secondary { background: none; color: var(--text); border: 1px solid var(--line); font-weight: 500; }
.btn-sm { padding: 6px 12px; font-size: 13px; font-weight: 400; border-radius: var(--r-sm); background: none; color: var(--text); border: 1px solid var(--line); }
.btn-full { width: 100%; padding: 12px; }

/* --- Top-Nav (Landingpage, Login) --- */
.topbar {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 16px 40px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 5;
}
.topbar-nav { display: flex; gap: 22px; margin-left: 24px; font-size: 14px; color: var(--mute); }
.topbar-spacer { flex: 1; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 600; font-size: 17px; letter-spacing: -.01em; }
.brand-mark {
  width: 30px; height: 30px; border-radius: var(--r-sm);
  background: var(--accent); color: var(--accentInk);
  display: grid; place-items: center; flex: none;
}
.brand-mark.sm { width: 28px; height: 28px; border-radius: 7px; }
.icon-btn {
  background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); width: 34px; height: 32px; padding: 0;
  display: grid; place-items: center; cursor: pointer; flex: none;
}
.icon-btn:hover { border-color: var(--accent); color: var(--accent); }
.lang-btn {
  background: none; border: 1px solid var(--line); color: var(--text);
  border-radius: var(--r-sm); padding: 7px 11px;
  font: 500 12px var(--font-mono); cursor: pointer;
}

/* --- Hero (Landingpage) --- */
.hero {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(380px, 1fr));
  gap: 48px;
  align-items: center;
  padding: 80px 40px 72px;
  max-width: 1240px;
  margin: 0 auto;
}
.eyebrow {
  font: 500 12px var(--font-mono);
  color: var(--accent);
  letter-spacing: .08em;
  text-transform: uppercase;
  margin-bottom: 20px;
}
.hero h1 { font-size: 54px; line-height: 1.05; letter-spacing: -.03em; margin: 0 0 22px; font-weight: 600; text-wrap: balance; }
.hero h1 .accent { color: var(--accent); }
.hero-sub { font-size: 18px; line-height: 1.55; color: var(--mute); max-width: 520px; margin: 0 0 32px; text-wrap: pretty; }
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

.preview-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 18px; box-shadow: var(--shadow);
}
.preview-dots { display: flex; gap: 6px; margin-bottom: 14px; }
.preview-dots i { width: 9px; height: 9px; border-radius: 50%; background: var(--line); display: block; }
.preview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.preview-tile {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r-md); padding: 14px;
  display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 500;
}
.preview-tile svg { color: var(--accent); flex: none; }

/* --- Risiko-Trio --- */
.section { max-width: 1240px; margin: 0 auto; padding: 0 40px 72px; }
.section h2 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 20px; font-weight: 600; }
.risk-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 16px; }
.risk-item { border-top: 2px solid var(--accent); padding: 16px 0 0; }
.risk-item .h { font-weight: 600; margin-bottom: 6px; }
.risk-item .d { font-size: 14px; color: var(--mute); line-height: 1.5; }

/* --- Bausteine-Grid (Landingpage + Dashboard teilen das Kartenformat) --- */
.section-head { display: flex; justify-content: space-between; align-items: end; margin-bottom: 28px; gap: 24px; flex-wrap: wrap; }
.section-head h2 { font-size: 32px; margin: 0; }
.section-head p { margin: 0; color: var(--mute); max-width: 440px; text-wrap: pretty; }
.mod-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }

.mod-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-lg); padding: 22px;
}
.mod-card .mod-icon-tile { width: 44px; height: 44px; border-radius: 11px; background: var(--accentSoft); display: grid; place-items: center; margin-bottom: 16px; }
.mod-card .mod-icon-tile svg { color: var(--accent); }
.mod-card .mod-no { font: 500 11px var(--font-mono); color: var(--accent); margin-bottom: 6px; }
.mod-card .mod-name { font-weight: 600; font-size: 16px; margin-bottom: 6px; }
.mod-card .mod-desc { font-size: 14px; line-height: 1.5; color: var(--mute); }

/* Dashboard-Variante: klickbar, Icon+Sperre oben, Kennzahl, Beschreibung, Fuss */
.mod-card.dash {
  cursor: pointer; display: flex; flex-direction: column; gap: 12px; min-height: 168px;
}
.mod-card.dash.locked { opacity: .55; }
.mod-card.dash .mod-top { display: flex; justify-content: space-between; align-items: center; }
.mod-card.dash .mod-stat { font: 500 22px var(--font-mono); }
.mod-card.dash .mod-lock { display: flex; align-items: center; gap: 5px; font: 500 11px var(--font-mono); color: var(--mute); }
.mod-card.dash .mod-lock svg { width: 13px; height: 13px; }
.mod-card.dash .mod-fill { flex: 1; }
.mod-card.dash .mod-stat-label { font-size: 12px; color: var(--mute); }

.footer {
  border-top: 1px solid var(--line); padding: 24px 40px;
  display: flex; justify-content: space-between; color: var(--mute);
  font-size: 13px; flex-wrap: wrap; gap: 12px;
}

/* --- Login --- */
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; position: relative; }
.login-back { position: absolute; top: 24px; left: 32px; background: none; border: 0; color: var(--mute); font-size: 14px; cursor: pointer; }
.login-toggles { position: absolute; top: 20px; right: 32px; display: flex; gap: 8px; }
.login-card {
  width: 100%; max-width: 400px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-xl); padding: 36px; box-shadow: var(--shadow);
}
.login-card .brand-mark { width: 40px; height: 40px; border-radius: var(--r-md); margin-bottom: 22px; }
.login-card h1 { margin: 0 0 6px; font-size: 24px; letter-spacing: -.02em; font-weight: 600; }
.login-card .sub { margin: 0 0 24px; color: var(--mute); font-size: 14px; }
.field label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; }
.field input {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-sm);
  padding: 11px 12px; color: var(--text); font: inherit; margin-bottom: 16px; outline: none;
}
.field input:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
.login-divider { display: flex; align-items: center; gap: 12px; margin: 18px 0; color: var(--mute); font-size: 12px; }
.login-divider .line { flex: 1; height: 1px; background: var(--line); }

/* --- App-Shell (Arbeitsbereich: Sidebar + Topbar + Workspace) --- */
.app-shell { height: 100vh; display: flex; overflow: hidden; }
.sidebar {
  width: 236px; flex: none; background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; padding: 16px 12px; gap: 2px;
}
.sidebar .brand { padding: 4px 8px 18px; }
.sidebar-group-label {
  font: 500 11px var(--font-mono); color: var(--mute); letter-spacing: .08em;
  text-transform: uppercase; padding: 16px 10px 6px;
}
.sidebar-item {
  display: flex; align-items: center; gap: 11px; padding: 8px 10px; border-radius: var(--r-sm);
  font-size: 14px; cursor: pointer; color: var(--text);
}
.sidebar-item.muted { color: var(--mute); }
.sidebar-item.active { background: var(--accentSoft); color: var(--accent); font-weight: 500; }
.sidebar-item.locked { opacity: .45; }
.sidebar-item .label { flex: 1; }
.sidebar-fill { flex: 1; }

.workspace-col { flex: 1; display: flex; flex-direction: column; min-width: 0; }
.workspace-topbar { height: 58px; flex: none; border-bottom: 1px solid var(--line); display: flex; align-items: center; gap: 12px; padding: 0 24px; }
.search-box {
  display: flex; align-items: center; gap: 8px; background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--r-sm); padding: 7px 12px; width: 300px; color: var(--mute); font-size: 14px;
}
.avatar {
  width: 34px; height: 34px; border-radius: 50%; background: var(--accentSoft); color: var(--accent);
  display: grid; place-items: center; font-weight: 600; font-size: 13px;
}
.workspace { flex: 1; position: relative; overflow: hidden; }
.workspace-scroll { position: absolute; inset: 0; overflow: auto; padding: 32px 32px 48px; }
.workspace-scroll h1 { margin: 0 0 4px; font-size: 28px; letter-spacing: -.02em; font-weight: 600; }
.workspace-scroll > p.sub { margin: 0 0 28px; color: var(--mute); }

.entitlements-demo { margin-top: 32px; background: var(--surface); border: 1px dashed var(--line); border-radius: var(--r-lg); padding: 20px; }
.entitlements-demo .title { font-weight: 600; margin-bottom: 2px; }
.entitlements-demo .sub { font-size: 13px; color: var(--mute); margin-bottom: 16px; }
.entitlements-pills { display: flex; flex-wrap: wrap; gap: 10px; }
.toggle-pill {
  display: flex; align-items: center; gap: 9px; border: 1px solid var(--line); border-radius: 999px;
  padding: 6px 12px 6px 7px; font-size: 13px; cursor: pointer; background: none; color: var(--text);
}
.toggle-sw { width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative; display: block; }
.toggle-sw.on { background: var(--accent); }
.toggle-sw i { position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; display: block; transition: left .15s; }
.toggle-sw.on i { left: 14px; }

/* --- Fenster (Window-Manager, siehe window-manager.js) --- */
.win {
  position: absolute; background: var(--surface); border: 1px solid var(--lineStrong);
  border-radius: 12px; box-shadow: var(--shadowWin); display: flex; flex-direction: column; overflow: hidden;
}
.win-header {
  height: 44px; flex: none; display: flex; align-items: center; gap: 10px; padding: 0 8px 0 14px;
  border-bottom: 1px solid var(--line); cursor: move; user-select: none; background: var(--bg);
}
.win-header svg { color: var(--accent); flex: none; }
.win-header .title { flex: 1; font-weight: 600; font-size: 14px; }
.win-header .win-btn {
  width: 28px; height: 28px; display: grid; place-items: center; border-radius: 6px; cursor: pointer; color: var(--mute);
  background: none; border: 0;
}
.win-header .win-btn:hover { background: var(--line); }
.win-body { flex: 1; overflow: auto; padding: 20px; display: flex; flex-direction: column; gap: 18px; }
.win-body .desc { font-size: 13px; color: var(--mute); }
.win-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.win-stats .stat { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-md); padding: 12px; }
.win-stats .stat .v { font: 500 22px var(--font-mono); }
.win-stats .stat .l { font-size: 12px; color: var(--mute); }
.win-rows .row { display: flex; align-items: center; gap: 10px; padding: 10px 2px; border-top: 1px solid var(--line); font-size: 14px; }
.win-rows .row .a { flex: 1; }
.win-rows .row .b { font: 400 12px var(--font-mono); color: var(--mute); }
.win-resize { position: absolute; right: 0; bottom: 0; width: 20px; height: 20px; cursor: nwse-resize; display: grid; place-items: end; padding: 4px; color: var(--mute); }
.win.maximized { border-radius: 0; }

/* --- Statuspunkte (Ampel) -- NUR fuer Befund-Status, nicht als Akzent --- */
.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; display: inline-block; }
.dot.ok { background: var(--ok); }
.dot.warn { background: var(--warn); }
.dot.bad { background: var(--bad); }

/* --- Responsive: Fenster unter ~800px als Vollbild (siehe README) --- */
@media (max-width: 800px) {
  .win { left: 0 !important; top: 0 !important; width: 100% !important; height: 100% !important; border-radius: 0; }
  .sidebar { width: 200px; }
  .search-box { width: auto; flex: 1; }
}
