/* ================================================================
   BE:KI Base – App-Styles
   Farben aus Logo. Layout: Header + Sidebar/Main + Footer (no scroll).
   Pinnwand-Dashboard im Suite-Stil.
   ================================================================ */

/* ── Logo-Palette (überschreibt beki-base.css Variablen) ────── */
:root {
  --navy:   #1648a6;
  --navy-d: #0f3683;
  --teal:   #23b5a0;
  --teal-d: #1c9583;
  --sky:    #15a7ce;
  --yellow: #fdbc28;
  --pink:   #fd5e90;
  --bg:     #f3f5f9;
  --card:   #ffffff;
  --line:   #e1e6ee;
  --text:   #1a2740;
  --muted:  #6b7a8d;
  --soft:   #f4f7fb;
  --radius: 14px;
}

/* ── Body Layout (no scroll) ──────────────────────────────────── */
body {
  height: 100vh;
  overflow: hidden;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  flex-direction: column;
}

/* ── Header (Suite-Stil, Logo füllt Höhe) ─────────────────────── */
#header {
  background: #fff;
  display: flex;
  align-items: center;
  padding: 6px 22px 6px 11px;
  flex-shrink: 0;
  border-bottom: 3px solid var(--navy);
  box-shadow: 0 2px 12px rgba(22, 72, 166, 0.10);
  gap: 10px;
  height: 96px;
  box-sizing: border-box;
}

.header-logo-img {
  height: 88px;
  max-height: 100%;
  object-fit: contain;
  cursor: pointer;
}

.header-div {
  width: 2px;
  height: 44px;
  background: var(--line);
  margin: 0 14px;
  flex-shrink: 0;
}

#header-breadcrumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 16px;
  font-weight: 600;
  color: #4b5a6e;
}

.bc-root {
  color: var(--navy);
  font-weight: 700;
  font-size: 18px;
  cursor: pointer;
}

.bc-sep, .bc-active {
  color: var(--navy);
  font-weight: 700;
}

.bc-hidden { display: none !important; }

#header-user-area {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 10px;
}

#header-user-block {
  text-align: right;
  line-height: 1.25;
}

#header-user-name {
  font-size: 14px;
  font-weight: 700;
  color: var(--text);
}

#header-user-roles {
  font-size: 11.5px;
  color: var(--muted);
}

.role-switcher-btn {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  border: 1.5px solid var(--line);
  background: #fff;
  color: var(--navy);
  font-size: 14px;
  cursor: pointer;
  transition: all .15s;
}

.role-switcher-btn:hover {
  border-color: var(--navy);
  background: var(--soft);
}

#header-user-divider {
  width: 1px;
  height: 50px;
  background: var(--line);
  margin: 0 18px;
  flex-shrink: 0;
}

#header-institut {
  height: 70px;
  object-fit: contain;
  opacity: .95;
  mix-blend-mode: multiply;
  flex-shrink: 0;
}

/* ── Layout: Sidebar + Main ───────────────────────────────────── */
#layout {
  flex: 1;
  display: flex;
  min-height: 0;
}

#sidebar {
  width: 232px;
  flex-shrink: 0;
  background: linear-gradient(160deg, #0d2557 0%, var(--navy) 58%, #1a7a6a 100%);
  display: flex;
  flex-direction: column;
  padding: 8px 0 12px;
  overflow-y: auto;
  overflow-x: hidden;
  box-shadow: 3px 0 18px rgba(13, 35, 71, .26);
  position: relative;
  z-index: 5;
}

.nav-section {
  padding: 12px 16px 4px;
  font-size: 9.5px;
  font-weight: 700;
  color: rgba(255, 255, 255, .55);
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.nav-item {
  width: 100%;
  background: none;
  border: none;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  color: rgba(255, 255, 255, .72);
  font-size: 13px;
  font-weight: 600;
  font-family: inherit;
  text-align: left;
  transition: background .12s, color .12s, border-color .12s;
  border-left: 3px solid transparent;
  white-space: nowrap;
  user-select: none;
}

.nav-item:hover {
  background: rgba(255, 255, 255, .09);
  color: #fff;
  border-left-color: rgba(122, 220, 176, .55);
}

.nav-item.active {
  background: rgba(255, 255, 255, .14);
  color: #fff;
  border-left-color: rgba(122, 220, 176, .8);
}

.nav-icon {
  font-size: 14px;
  width: 18px;
  text-align: center;
  flex-shrink: 0;
  opacity: .9;
}

.nav-badge {
  margin-left: auto;
  background: var(--pink);
  color: #fff;
  font-size: 10.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
  min-width: 20px;
  text-align: center;
}

.nav-badge.warn { background: var(--yellow); color: #6a4a00; }

/* ── Main Content ─────────────────────────────────────────────── */
#main {
  flex: 1;
  overflow-y: auto;
  padding: 18px 22px;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.page-loader {
  color: var(--muted);
  font-size: 14px;
}

.page-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 14px;
  gap: 16px;
  flex-wrap: wrap;
  flex-shrink: 0;
}

.page-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 2px;
}

.page-sub {
  font-size: 13px;
  color: var(--muted);
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ── PINNWAND (desk surface, Suite-Stil) ──────────────────────── */
.desk-surface {
  position: relative;
  display: grid;
  grid-template-columns: 1.04fr .96fr .9fr;
  gap: 16px;
  padding: 18px;
  border-radius: 26px;
  background:
    radial-gradient(circle at top left, rgba(251,255,248,.88), transparent 30%),
    linear-gradient(180deg, rgba(255,255,255,.12), rgba(255,255,255,0)),
    radial-gradient(circle at 22% 26%, rgba(111,146,104,.08) 0 1px, transparent 1px 7px),
    radial-gradient(circle at 68% 62%, rgba(106,139,100,.06) 0 1px, transparent 1px 6px),
    radial-gradient(circle at 82% 34%, rgba(98,129,93,.05) 0 1px, transparent 1px 5px),
    linear-gradient(135deg, #dfead6 0%, #d2e2c8 24%, #c4d8bc 54%, #d7e5ce 78%, #e8f1df 100%);
  box-shadow:
    inset 0 2px 0 rgba(255,255,255,.36),
    inset 0 -10px 24px rgba(67,96,62,.08),
    0 16px 36px rgba(67,96,62,.12);
  flex-shrink: 0;
}

.desk-surface.fill { flex: 1; min-height: 0; display: grid; }

.desk-surface::before {
  content:''; position:absolute; inset:14px;
  border-radius:18px; border:1px solid rgba(255,255,255,.16);
  pointer-events:none;
}

.desk-surface::after {
  content:''; position:absolute; inset:0; border-radius:26px;
  pointer-events:none; opacity:.5;
  background:
    radial-gradient(circle at var(--stain-x1, 26%) var(--stain-y1, 24%),
      rgba(111,82,47,.12) 0, rgba(161,130,86,.07) 28%, transparent 55%),
    radial-gradient(circle at var(--stain-x2, 72%) var(--stain-y2, 66%),
      rgba(114,82,44,.10) 0, rgba(168,140,92,.05) 24%, transparent 50%);
  background-size: var(--stain-s1, 110px) var(--stain-s1, 110px),
                   var(--stain-s2, 88px) var(--stain-s2, 88px);
  background-repeat: no-repeat;
  filter: blur(.2px);
}

.desk-card {
  position: relative;
  background: #fff;
  border: 1px solid rgba(205,214,229,.96);
  border-radius: 16px;
  padding: 14px 14px 12px;
  box-shadow: 0 10px 22px rgba(30,61,115,.07), 0 3px 8px rgba(53,34,15,.08);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.desk-card-title {
  font-size: 13.5px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.desk-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.desk-card-date {
  font-size: 11px;
  color: #8a96a8;
  font-weight: 700;
}

.desk-card-pin {
  position: absolute; top: 10px; left: 50%;
  transform: translateX(-50%);
  width: 13px; height: 13px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #b7f0d0, var(--teal-d) 68%, #2f6e54 100%);
  box-shadow: 0 2px 5px rgba(0,0,0,.18);
}

.desk-card-clip {
  position: absolute; top: -12px; left: 50%;
  transform: translateX(-50%);
  width: 64px; height: 18px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(180deg, #dde3eb, #b4becd);
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
}

.desk-thumbtack {
  position: absolute; top: 9px; left: 50%; transform: translateX(-50%);
  width: 14px; height: 14px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fff, #f3f3f3 66%, #d8d8d8 100%);
  border: 1px solid rgba(160,160,160,.7);
  box-shadow: 0 2px 5px rgba(0,0,0,.16);
}

.desk-thumbtack::before {
  content:''; position:absolute; left:50%; top:10px; transform:translateX(-50%);
  width:2px; height:13px;
  background: linear-gradient(180deg, #8b8b8b, #d4d4d4);
  border-radius:2px; box-shadow: 0 1px 2px rgba(0,0,0,.12);
}

.desk-termine {
  background:
    linear-gradient(180deg, rgba(255,255,255,.98), rgba(251,253,255,.96)),
    repeating-linear-gradient(0deg, transparent 0 32px, rgba(30,61,115,.06) 32px 33px);
  padding-top: 22px;
}

.desk-aufgaben {
  background:
    linear-gradient(180deg, rgba(255,255,255,.88), rgba(255,255,255,.72)),
    linear-gradient(180deg, #d9ecfb 0 18px, #eef7fe 18px, #f7fbff 100%);
  transform: rotate(-1deg);
  padding-top: 14px;
}

.desk-fristen {
  background:
    linear-gradient(180deg, rgba(255,255,255,.96), rgba(247,250,252,.95)),
    repeating-linear-gradient(0deg, transparent 0 32px, rgba(30,61,115,.05) 32px 33px);
  padding-top: 22px;
}

.desk-sticky {
  grid-column: 1 / -1;
  background:
    linear-gradient(180deg, rgba(255,255,255,.94), rgba(255,255,255,.9)),
    linear-gradient(180deg, #fffef6 0%, #f9efc8 100%);
  transform: rotate(-.6deg);
}

.desk-sticky::before, .desk-sticky::after {
  content:''; position:absolute; top:-12px;
  width:64px; height:18px;
  border-radius: 10px 10px 6px 6px;
  background: linear-gradient(180deg, #dde3eb, #b4becd);
  box-shadow: 0 3px 8px rgba(0,0,0,.18);
}
.desk-sticky::before { left: 24px; transform: rotate(-7deg); }
.desk-sticky::after  { right: 24px; transform: rotate(7deg); }

.desk-letterhead {
  margin: -2px -2px 10px;
  padding: 6px 10px 8px;
  border-bottom: 1px solid rgba(30,61,115,.08);
  display: flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(180deg, rgba(236,242,250,.95), rgba(247,249,252,.65));
}

.desk-letterhead img {
  display: block;
  width: 44px; height: 44px;
  object-fit: contain;
  mix-blend-mode: multiply;
  flex-shrink: 0;
  filter: drop-shadow(0 2px 2px rgba(30,61,115,.08));
}

.desk-letterhead-text {
  font-size: 11.5px;
  line-height: 1.3;
  font-weight: 700;
  color: var(--navy);
  max-width: 240px;
}

/* Daten-Liste innerhalb einer desk-card */
.desk-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 8px;
  max-height: 180px;
  overflow-y: auto;
  padding-right: 4px;
}

.desk-item {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  padding: 7px 0;
  border-top: 1px dashed #d9e1ee;
}
.desk-item:first-child { border-top: none; padding-top: 2px; }

.desk-item-badge {
  min-width: 48px;
  border-radius: 10px;
  background: #f4f7fb;
  color: var(--navy);
  font-size: 10.5px;
  font-weight: 800;
  padding: 6px 8px;
  text-align: center;
  flex-shrink: 0;
}

.desk-item-badge.urgent { background: #ffe1ec; color: #b73166; }
.desk-item-badge.warn   { background: #fdf3d3; color: #a07c00; }

.desk-item-title {
  font-size: 12.5px;
  font-weight: 700;
  color: var(--navy);
  margin-bottom: 2px;
}

.desk-item-meta {
  font-size: 11px;
  line-height: 1.45;
  color: var(--muted);
}

.desk-item-empty {
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
  padding: 4px 0;
}

/* Schreibbereich (Pinnwand-Notiz) */
.desk-writing-area {
  width: 100%;
  border: none;
  outline: none;
  resize: none;
  border-radius: 10px;
  padding: 10px 12px 8px;
  font: 500 12.5px/24px "Segoe Print", "Bradley Hand ITC", "Comic Sans MS", cursive;
  color: #39465b;
  background:
    linear-gradient(180deg, transparent 0 23px, rgba(30,61,115,.10) 23px 24px),
    linear-gradient(90deg, rgba(199,79,61,.14) 0 1px, transparent 1px 100%),
    linear-gradient(180deg, rgba(255,255,255,.76), rgba(255,255,255,.76));
  background-size: 100% 24px, 100% 100%, 100% 100%;
  box-shadow: inset 0 1px 3px rgba(30,61,115,.05);
  flex: 1;
  min-height: 60px;
}

.desk-writing-area::placeholder {
  color: #8e8f96;
  font-style: italic;
}

.desk-writing-area:focus {
  box-shadow:
    inset 0 1px 3px rgba(30,61,115,.05),
    0 0 0 2px rgba(30,61,115,.08);
}

/* Layout des Dashboards: Pinnwand füllt verfügbare Höhe */
.dashboard-pinwand {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.dashboard-pinwand .desk-surface {
  flex: 1;
  grid-template-columns: 1fr 1fr;
  grid-template-rows: 1.35fr .85fr;
  grid-template-areas:
    "termine aufgaben"
    "sticky  sticky";
}

.dashboard-pinwand .desk-termine  { grid-area: termine; }
.dashboard-pinwand .desk-aufgaben { grid-area: aufgaben; }
.dashboard-pinwand .desk-sticky   { grid-area: sticky; }

/* ── Buttons (lokal) ──────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all .12s;
  font-family: inherit;
}

.btn-primary-sm {
  background: var(--navy);
  color: #fff;
  border-color: var(--navy);
}
.btn-primary-sm:hover { background: var(--navy-d); border-color: var(--navy-d); }

.btn-ghost {
  background: #fff;
  color: var(--navy);
  border-color: var(--line);
}
.btn-ghost:hover { border-color: var(--navy); background: var(--soft); }

/* ── Forbidden / Empty ────────────────────────────────────────── */
.notice {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 32px;
  text-align: center;
  color: var(--muted);
}

.notice-icon { font-size: 36px; margin-bottom: 8px; }
.notice-title { font-size: 16px; font-weight: 800; color: var(--text); margin-bottom: 4px; }

/* ── Modal ────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(10, 20, 50, 0.5);
  display: flex; align-items: center; justify-content: center;
  z-index: 1000;
}

.modal-card {
  background: #fff;
  border-radius: var(--radius);
  padding: 22px;
  width: min(440px, 92vw);
  max-height: 84vh;
  overflow-y: auto;
  box-shadow: 0 24px 60px rgba(8, 18, 50, 0.22);
}

.modal-title {
  font-size: 17px;
  font-weight: 800;
  color: var(--text);
  margin-bottom: 4px;
}

.modal-sub {
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 14px;
  line-height: 1.5;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
}

/* ── Role list (in modal) ─────────────────────────────────────── */
.role-option {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  margin-bottom: 7px;
  cursor: pointer;
  transition: all .12s;
}

.role-option:hover { border-color: var(--navy); background: var(--soft); }

.role-option.selected {
  border-color: var(--navy);
  background: #e9eefb;
}

.role-option-cb { margin-top: 2px; accent-color: var(--navy); }

.role-name { font-weight: 700; color: var(--text); font-size: 14px; }
.role-desc { font-size: 12px; color: var(--muted); line-height: 1.45; }

/* ── Stub-Page ─────────────────────────────────────────────────── */
.stub {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px dashed var(--line);
  padding: 36px;
  text-align: center;
  color: var(--muted);
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.stub-title {
  font-size: 18px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 8px;
}

.stub-list {
  display: inline-block;
  text-align: left;
  margin: 12px auto 0;
  font-size: 13px;
  line-height: 1.75;
  color: #4b5a6e;
}

.stub-list b { color: var(--navy); }

/* ── Footer (BE:KI-Standard) ──────────────────────────────────── */
#app-footer {
  background: #fff;
  border-top: 1px solid #dde3ec;
  padding: 7px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-shrink: 0;
  font-size: 11.5px;
  color: #9ba8bb;
}

.footer-copy { font-size: 11.5px; color: #9ba8bb; font-weight: 500; }
.footer-copy strong { color: #6b7a8d; }
.footer-version { font-size: 11px; color: #c8d0dc; }

/* Hinweise-Page (für Leitung) */
.hinweise-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
  flex: 1;
  overflow-y: auto;
}

.hinweis {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  background: #fff;
  border: 1px solid var(--line);
  border-left: 4px solid var(--muted);
  border-radius: 10px;
  padding: 12px 14px;
}

.hinweis.urgent { border-left-color: var(--pink); }
.hinweis.warn   { border-left-color: var(--yellow); }

.hinweis-icon { font-size: 18px; flex-shrink: 0; width: 24px; text-align: center; }
.hinweis-title { font-weight: 700; color: var(--text); font-size: 14px; }
.hinweis-meta  { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
