/* FJN System — E0 component styles: app layout: shell, sidebar, top bar, popovers, notifications.
   Loaded after fjn-content.css (see templates/base.html); order matters. */
/* ---------- App layout (E0-10) ----------
   Desktop ≥ 1280: 232 px sidebar. Tablet 768–1279: 88 px icon rail [D5].
   Phone < 768: 56 px header + 64 px bottom menu [D4]. Top bar 64 px [D15]. */

.fjn-skip {
  position: absolute; left: var(--fjn-sp-2); top: -60px; z-index: 100; padding: var(--fjn-sp-2) var(--fjn-sp-3);
  background: var(--fjn-surface); border-radius: var(--fjn-r-md); box-shadow: var(--fjn-shadow-2);
}
.fjn-skip:focus { top: var(--fjn-sp-2); }

.fjn-app { display: flex; min-height: 100vh; }
.fjn-app__main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.fjn-app__content { flex: 1; min-width: 0; }
.fjn-app__content:focus { outline: none; box-shadow: none; }
.fjn-app__messages { display: flex; flex-direction: column; gap: var(--fjn-sp-2); padding: var(--fjn-sp-4) var(--fjn-sp-8) 0; }

/* Sidebar: graphite, 64 px black logo bar with a 3 px red line [D14] */
.fjn-sidebar {
  position: sticky; top: 0; height: 100vh; width: var(--fjn-sidebar-w); flex: none;
  display: flex; flex-direction: column; padding: 0 var(--fjn-sp-3) var(--fjn-sp-4);
  background: var(--fjn-nav-bg); color: var(--fjn-nav-text);
}
/* 4.15.1: a long menu (e.g. Kierownik on a tablet held landscape, 1024 × 768) scrolls instead of
   hiding its last items below the screen */
.fjn-sidebar { overflow-y: auto; overscroll-behavior: contain; }
.fjn-sidebar > * { flex-shrink: 0; }
.fjn-sidebar__brand {
  display: flex; align-items: center; justify-content: center; flex: none;
  height: var(--fjn-topbar-h); margin: 0 calc(-1 * var(--fjn-sp-3)) 14px;
  background: var(--fjn-nav-logo-bg); border-bottom: 3px solid var(--fjn-nav-active-bg);
}
.fjn-sidebar__logo { height: 40px; width: auto; max-width: 200px; }
.fjn-sidebar__mark { display: none; width: 40px; height: 44px; object-fit: contain; }
.fjn-sidebar__list { display: flex; flex-direction: column; gap: 2px; margin: 0; padding: 0; list-style: none; }
.fjn-sidebar__item {
  display: flex; align-items: center; gap: var(--fjn-sp-3); height: 42px; padding: 0 10px;
  border-radius: var(--fjn-r-md); color: var(--fjn-nav-text); font-size: var(--fjn-fs-body); font-weight: var(--fjn-fw-regular);
}
.fjn-sidebar__item:hover { background: var(--fjn-nav-hover); color: var(--fjn-nav-text); text-decoration: none; }
.fjn-sidebar__item[aria-current="page"] { background: var(--fjn-nav-active-bg); color: var(--fjn-nav-active-text); font-weight: var(--fjn-fw-bold); }
.fjn-sidebar__item:focus-visible { box-shadow: 0 0 0 2px var(--fjn-nav-bg), 0 0 0 4px var(--fjn-nav-text); }
.fjn-sidebar__short { display: none; }
.fjn-sidebar__footer {
  margin-top: auto; padding: 10px; border-top: 1px solid var(--fjn-nav-divider);
  font-size: var(--fjn-fs-label); line-height: var(--fjn-lh-label); color: var(--fjn-border-strong);
}

/* Top bar */
.fjn-topbar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: var(--fjn-sp-4);
  height: var(--fjn-topbar-h); padding: 0 var(--fjn-sp-6);
  background: var(--fjn-surface); border-bottom: 1px solid var(--fjn-border);
}
.fjn-topbar__search { flex: 1; max-width: 520px; }
.fjn-topbar__spacer { flex: 1; }
.fjn-kbd {
  align-self: center; margin-right: var(--fjn-sp-3); padding: 1px 6px;
  border: 1px solid var(--fjn-border); border-radius: var(--fjn-r-sm);
  font: 12px var(--fjn-font-mono); color: var(--fjn-text-3);
}

/* Drop-down panels in the top bar (<details>) */
.fjn-popover { position: relative; }
.fjn-popover > summary { list-style: none; cursor: pointer; }
.fjn-popover > summary::-webkit-details-marker { display: none; }
.fjn-popover__panel {
  position: absolute; z-index: 50; top: calc(100% + 6px); right: 0; min-width: 300px;
  background: var(--fjn-surface); border: 1px solid var(--fjn-border); border-radius: var(--fjn-r-lg); box-shadow: var(--fjn-shadow-2);
  overflow: hidden;
}

.fjn-menu-item {
  display: flex; align-items: center; gap: var(--fjn-sp-3); width: 100%; min-height: 40px; padding: 0 10px;
  border: 0; border-radius: var(--fjn-r-md); background: none;
  color: var(--fjn-text); font-size: var(--fjn-fs-body); font-weight: var(--fjn-fw-regular); text-align: left; cursor: pointer;
}
.fjn-menu-item:hover { background: var(--fjn-brand-50); color: var(--fjn-text); text-decoration: none; }
.fjn-menu-item--danger, .fjn-menu-item--danger:hover { color: var(--fjn-danger-700); font-weight: var(--fjn-fw-bold); }
.fjn-menu-item__sub { display: block; }
.fjn-menu-item__check { margin-left: auto; color: var(--fjn-brand-600); }
.fjn-menu-item[aria-current="true"] { font-weight: var(--fjn-fw-bold); }

/* Branch: plain text or a switcher [D18] */
.fjn-branch--static { display: inline-flex; align-items: center; gap: 6px; font-size: 14px; color: var(--fjn-text-2); white-space: nowrap; }
.fjn-branch--static b, .fjn-branch__button b { color: var(--fjn-text); }
.fjn-branch__button {
  display: flex; align-items: center; gap: var(--fjn-sp-2); height: var(--fjn-ctl-md); padding: 0 var(--fjn-sp-3);
  border: 1px solid var(--fjn-border-strong); border-radius: var(--fjn-r-md); font-size: 14px; white-space: nowrap;
}
.fjn-branch[open] .fjn-branch__button { border-color: var(--fjn-brand-600); box-shadow: var(--fjn-focus); }
.fjn-branch__panel { padding: 6px; min-width: 260px; }

/* User */
.fjn-avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--fjn-brand-100); color: var(--fjn-brand-700); font-size: 14px; font-weight: var(--fjn-fw-bold);
}
.fjn-avatar--sm { width: 32px; height: 32px; font-size: 12px; }
.fjn-usermenu__button { display: flex; align-items: center; gap: 10px; padding: 4px 4px 4px var(--fjn-sp-2); border-radius: var(--fjn-r-md); color: var(--fjn-text-2); }
.fjn-usermenu__button:hover { background: var(--fjn-surface-2); }
.fjn-usermenu__who { display: flex; flex-direction: column; line-height: 17px; white-space: nowrap; }
.fjn-usermenu__who b { font-size: 14px; color: var(--fjn-text); }
.fjn-usermenu__who span { font-size: var(--fjn-fs-label); color: var(--fjn-text-3); }
.fjn-usermenu__rolesline { max-width: 220px; overflow: hidden; text-overflow: ellipsis; } /* D129 */
.fjn-usermenu__panel { width: 300px; padding: 6px; }
.fjn-usermenu__head {
  display: flex; flex-direction: column; gap: 4px; margin: -6px -6px 6px; padding: 14px var(--fjn-sp-4);
  border-bottom: 1px solid var(--fjn-surface-2);
}
.fjn-usermenu__roles { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 4px; }
.fjn-usermenu__logout { margin-top: 6px; padding-top: 6px; border-top: 1px solid var(--fjn-surface-2); }

/* Bell and notification list (E0-13, D26) */
.fjn-bell__button {
  position: relative; display: flex; align-items: center; justify-content: center;
  width: var(--fjn-ctl-md); height: var(--fjn-ctl-md); border-radius: var(--fjn-r-md); color: var(--fjn-text-2);
}
.fjn-bell__button:hover, .fjn-bell[open] .fjn-bell__button { background: var(--fjn-surface-2); color: var(--fjn-text); }
.fjn-bell__count {
  position: absolute; top: 4px; right: 3px; min-width: 18px; height: 18px; padding: 0 5px;
  border: 2px solid var(--fjn-surface); border-radius: var(--fjn-r-full);
  background: var(--fjn-red-600); color: var(--fjn-text-inverse);
  font: var(--fjn-fw-bold) 11px/14px var(--fjn-font-mono); text-align: center;
}
.fjn-bell__panel { width: 420px; }
.fjn-notices__head {
  display: flex; align-items: center; justify-content: space-between; gap: var(--fjn-sp-3);
  padding: 14px var(--fjn-sp-4); border-bottom: 1px solid var(--fjn-surface-2);
}
.fjn-notices__title { font-size: 17px; line-height: 24px; }
.fjn-notices__head .fjn-btn--text { height: 40px; padding: 0; font-size: 14px; white-space: nowrap; }
/* Desktop and tablet: 420 px panel at the right window edge, below the top bar [D26] */
.fjn-bell--top .fjn-bell__panel { position: fixed; top: calc(var(--fjn-topbar-h) + 6px); right: var(--fjn-sp-6); max-width: calc(100vw - 2 * var(--fjn-sp-6)); }
.fjn-bell__panel { display: flex; flex-direction: column; max-height: calc(100vh - 90px); }
.fjn-notices__list { flex: 1 1 auto; min-height: 0; margin: 0; padding: 0; overflow-y: auto; list-style: none; }
.fjn-notice {
  display: grid; grid-template-columns: 36px minmax(0, 1fr) 10px; gap: var(--fjn-sp-3); align-items: start;
  padding: var(--fjn-sp-3) var(--fjn-sp-4); border-bottom: 1px solid var(--fjn-surface-2);
  background: var(--fjn-surface); color: var(--fjn-text); font-weight: var(--fjn-fw-regular); text-decoration: none;
}
.fjn-notice--unread { background: var(--fjn-row-unread); }
.fjn-notice:hover { background: var(--fjn-brand-50); color: var(--fjn-text); text-decoration: none; }
.fjn-notice:focus-visible { box-shadow: inset 0 0 0 2px var(--fjn-focus-ring); }
.fjn-notice__icon { display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: var(--fjn-r-lg); }
.fjn-notice__icon--warning { background: var(--fjn-warning-100); color: var(--fjn-warning-700); }
.fjn-notice__icon--info { background: var(--fjn-info-100); color: var(--fjn-info-700); }
.fjn-notice__icon--danger { background: var(--fjn-danger-100); color: var(--fjn-danger-700); }
.fjn-notice__icon--neutral { background: var(--fjn-neutral-100); color: var(--fjn-neutral-700); }
.fjn-notice__text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.fjn-notice__title { font-size: 15px; line-height: 21px; }
.fjn-notice--unread .fjn-notice__title { font-weight: var(--fjn-fw-bold); }
.fjn-notice__body { font-size: var(--fjn-fs-small); line-height: 18px; color: var(--fjn-text-2); }
.fjn-notice__when { font-size: 12px; color: var(--fjn-text-3); }
.fjn-notice__dot { width: 10px; height: 10px; margin-top: 6px; border-radius: 50%; background: var(--fjn-brand-600); }
.fjn-notices__foot { padding: 10px var(--fjn-sp-4); background: var(--fjn-bg); font-size: var(--fjn-fs-small); color: var(--fjn-text-2); }
.fjn-notices__empty {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: var(--fjn-sp-10) var(--fjn-sp-6);
  text-align: center; font-size: 14px; line-height: 20px;
}
.fjn-notices__empty b { font-size: 16px; }
.fjn-notices__empty .fjn-empty__icon { width: 48px; height: 48px; border-radius: var(--fjn-r-lg); }
