/* ============================================================
   Orbita Publishing Portal – App shell
   Navy sidebar · glass topbar · light workspace
   ============================================================ */

body { display: flex; min-height: 100vh; min-height: 100dvh; }

/* -- Sidebar ---------------------------------------------- */
/* orbita:redesign - the panel is white now. A navy slab down the left of every
   screen made the whole product read as blue; the identity lives in the mark,
   the active pill and the call to action instead. */

.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  color: var(--slate-700);
  background: #FFFFFF;
  border-right: 1px solid var(--border);
  z-index: 40;
  overflow: hidden;
  isolation: isolate;
}

/* a whisper of colour at the top and bottom so the white is not flat */
.sidebar::before {
  content: "";
  position: absolute;
  inset: 0;
  background:
    radial-gradient(360px 220px at -20% -8%, rgba(42, 91, 255, 0.10), transparent 62%),
    radial-gradient(300px 260px at 120% 108%, rgba(34, 195, 240, 0.10), transparent 62%);
  pointer-events: none;
  z-index: -1;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 22px 22px 18px;
}

.sidebar-logo .brand-mark {
  width: 40px;
  height: 40px;
  /* The tile sits in a row with the wordmark. Without this it gives way when
     the text needs room: 40 px tall, less than 40 wide, and a 50% radius turns
     that into an ellipse. Square first, then round. */
  flex: none;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: linear-gradient(140deg, var(--navy-900), var(--blue-700) 70%, var(--blue-600));
  box-shadow: 0 10px 24px -12px rgba(31, 73, 217, 0.85), inset 0 1px 0 rgba(255, 255, 255, 0.22);
  color: #fff;
  transition: transform var(--dur) var(--ease-spring), box-shadow var(--dur) var(--ease-out);
}
.sidebar-logo:hover .brand-mark {
  transform: rotate(-6deg) scale(1.05);
  box-shadow: 0 14px 30px -12px rgba(31, 73, 217, 1);
}
/* orbita:redesign - the mark is 2.16:1 (viewBox 125.86 x 58.2). Squeezed
   into a square it lost half its height and the book inside became a
   smudge. Given its own ratio it reads at this size. */
.sidebar-logo .brand-mark svg { width: 27px; height: 13px; }

.sidebar-logo .brand {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.02rem;
  letter-spacing: -0.015em;
  color: var(--navy-900);
  line-height: 1.1;
}
.sidebar-logo .brand span { color: var(--blue-600); }
.sidebar-logo .sub {
  font-size: 0.79rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-400);
  margin-top: 3px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 6px 14px 12px;
  scrollbar-color: var(--slate-200) transparent;
}

.sidebar-section {
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--slate-400);
  padding: 18px 12px 8px;
}

.sidebar-link {
  position: relative;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  margin: 2px 0;
  border-radius: 11px;
  color: var(--slate-700);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.2;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease,
              transform var(--dur) var(--ease-out);
  width: 100%;
  text-align: left;
  cursor: pointer;
}
.sidebar-link .icon {
  width: 20px;
  height: 20px;
  display: inline-grid;
  place-items: center;
  flex-shrink: 0;
  color: var(--slate-400);
  transition: color var(--dur-fast) ease, transform var(--dur) var(--ease-spring);
}
.sidebar-link .icon svg { width: 18px; height: 18px; }
.sidebar-link:hover { background: var(--blue-50); color: var(--navy-900); transform: translateX(2px); }
.sidebar-link:hover .icon { color: var(--blue-600); transform: scale(1.08); }

.sidebar-link.active {
  background: linear-gradient(90deg, var(--blue-100), rgba(226, 234, 255, 0.25));
  color: var(--navy-900);
  font-weight: 700;
}
.sidebar-link.active .icon { color: var(--blue-600); }
.sidebar-link.active::before {
  content: "";
  position: absolute;
  left: -14px;
  top: 7px;
  bottom: 7px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--blue-600), var(--cyan-500));
  animation: growY var(--dur) var(--ease-out) both;
}

.sidebar-link .count {
  margin-left: auto;
  min-width: 20px;
  height: 20px;
  padding: 0 7px;
  border-radius: 999px;
  display: inline-grid;
  place-items: center;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.79rem;
  font-weight: 800;
}

.badge-unread {
  display: inline-grid;
  place-items: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  margin-left: auto;
  border-radius: 999px;
  background: var(--blue-600);
  color: #fff;
  font-size: 0.79rem;
  font-weight: 800;
}

/* Admin submenu */
.sidebar-submenu { display: none; padding-left: 10px; }
.sidebar-submenu.is-open { display: block; animation: fadeIn var(--dur) ease both; }
.sidebar-sublink { font-size: 0.85rem; font-weight: 500; padding: 8px 12px 8px 22px; }
.sidebar-submenu-chevron {
  margin-left: auto;
  font-size: 0.86rem;
  transition: transform var(--dur) var(--ease-out);
  color: var(--slate-400);
}
.sidebar-submenu-toggle.is-open .sidebar-submenu-chevron { transform: rotate(90deg); }

.sidebar-bottom {
  padding: 14px 16px 18px;
  border-top: 1px solid var(--border);
  background: linear-gradient(180deg, #FFFFFF, var(--slate-50));
}

.sidebar-bottom .btn-cta {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  height: 44px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.86rem;
  color: #fff;
  background: linear-gradient(100deg, var(--blue-700), var(--blue-600) 60%, var(--cyan-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 12px 26px -12px rgba(42, 91, 255, 0.9);
  transition: transform var(--dur-fast) var(--ease-out), filter var(--dur-fast) ease,
              box-shadow var(--dur-fast) ease;
  margin-bottom: 12px;
}
.sidebar-bottom .btn-cta:hover {
  transform: translateY(-1px);
  filter: brightness(1.05);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.22), 0 16px 32px -12px rgba(42, 91, 255, 1);
}
.sidebar-bottom .btn-cta svg { width: 16px; height: 16px; }

.profile-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px;
  border-radius: 12px;
  color: inherit;
  transition: background var(--dur-fast) ease;
}
.profile-row:hover { background: var(--blue-50); color: inherit; }

.avatar {
  width: 36px;
  height: 36px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  overflow: hidden;
  flex-shrink: 0;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 0.86rem;
  color: #fff;
  background: linear-gradient(140deg, var(--blue-600), var(--cyan-500));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28);
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }

.profile-info { min-width: 0; flex: 1; }
.profile-name {
  font-size: 0.86rem;
  font-weight: 700;
  color: var(--navy-900);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.profile-email {
  font-size: 0.79rem;
  color: var(--slate-400);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bottom-links { display: flex; justify-content: flex-end; padding: 6px 8px 0; }
.bottom-link {
  font-size: 0.83rem;
  color: var(--slate-400);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 8px;
  border-radius: 8px;
  transition: background var(--dur-fast) ease, color var(--dur-fast) ease;
}
.bottom-link:hover { color: var(--blue-700); background: var(--blue-50); }
.bottom-link svg { width: 14px; height: 14px; }

/* orbita:ui - account menu (components/profile_menu.html). The name row is
   a button now; it opens a small menu upwards, inside the sidebar, so the
   sidebar's overflow:hidden never clips it. Opening and closing fade and
   scale from 95 %, 200 ms; the script keeps the panel visible until the
   closing transition has run. */
.profile-menu { position: relative; }
.profile-menu .profile-row {
  width: 100%; border: 0; background: transparent; font: inherit; text-align: left;
  cursor: pointer;
}
.profile-menu .profile-row:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--ring); }
.profile-menu .profile-row[aria-expanded="true"] { background: var(--blue-50); }
.profile-menu .profile-info { display: block; }
.profile-menu .profile-info > span { display: block; }
.profile-menu-chevron {
  width: 16px; height: 16px; flex: none; color: var(--slate-400);
  transform: rotate(-90deg); transition: transform 200ms var(--ease-out);
}
.profile-row[aria-expanded="true"] .profile-menu-chevron { transform: rotate(90deg); }

.profile-menu-panel {
  position: absolute; left: 0; right: 0; bottom: calc(100% + 8px); z-index: 5;
  padding: 6px; border-radius: 14px;
  background: #FFFFFF; border: 1px solid var(--border); box-shadow: var(--shadow-lg);
  opacity: 0; transform: scale(0.95); transform-origin: bottom center;
  transition: opacity 200ms var(--ease-out), transform 200ms var(--ease-out);
}
.profile-menu-panel.is-open { opacity: 1; transform: scale(1); }
.profile-menu-head { padding: 8px 10px 10px; margin-bottom: 4px; border-bottom: 1px solid var(--border); }
.profile-menu-head .profile-email { font-size: 0.8rem; }
.profile-menu-item {
  display: flex; align-items: center; gap: 10px; width: 100%; height: 40px; padding: 0 10px;
  border: 0; border-radius: 10px; background: transparent; font: inherit; text-align: left;
  font-size: 0.9rem; font-weight: 600; color: var(--text); text-decoration: none; cursor: pointer;
  transition: background 150ms ease, color 150ms ease;
}
.profile-menu-item svg { width: 16px; height: 16px; flex: none; color: var(--slate-500); }
/* neutral and opaque on hover, the same grey every menu of the portal uses */
.profile-menu-item:hover, .profile-menu-item:focus-visible { background: #F4F4F5; color: var(--text); outline: none; }
.profile-menu-meta {
  margin-left: auto; padding: 2px 8px; border-radius: 999px; background: var(--slate-50);
  border: 1px solid var(--border); font-family: var(--font-mono); font-size: 0.75rem; color: var(--text-muted);
}
.profile-menu-sep { height: 1px; margin: 4px 6px; background: var(--border); }
@media (prefers-reduced-motion: reduce) {
  .profile-menu-panel, .profile-menu-chevron { transition: none; }
}

/* Mobile toggle + backdrop */
.sidebar-toggle {
  position: fixed;
  top: 12px;
  left: 12px;
  z-index: 60;
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: var(--card);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
}
.sidebar-toggle-bar {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 2px;
  background: var(--navy-800);
  transition: transform var(--dur) var(--ease-out), opacity var(--dur) ease;
}
.sidebar-toggle.open .sidebar-toggle-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.sidebar-toggle.open .sidebar-toggle-bar:nth-child(2) { opacity: 0; }
.sidebar-toggle.open .sidebar-toggle-bar:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.sidebar-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 27, 61, 0.35);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--dur) ease;
  z-index: 35;
}
.sidebar-backdrop.open { opacity: 1; pointer-events: auto; }

/* ── Main column ─────────────────────────────────────────── */

.main-content {
  flex: 1;
  min-width: 0;
  margin-left: var(--sidebar-w);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
  background:
    radial-gradient(1000px 460px at 82% -12%, rgba(42, 91, 255, 0.045), transparent 62%),
    var(--background);
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  background: rgba(249, 250, 252, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid transparent;
  transition: border-color var(--dur) ease, box-shadow var(--dur) ease;
}
.topbar.is-scrolled { border-bottom-color: var(--border); box-shadow: 0 6px 20px -16px rgba(15, 27, 61, 0.25); }

.topbar-title { display: flex; flex-direction: column; min-width: 0; }
.topbar-title .crumbs { display: flex; align-items: center; gap: 6px; font-size: 0.83rem; color: var(--text-dim); font-weight: 600; letter-spacing: 0.02em; }
.topbar-title .crumbs svg { width: 12px; height: 12px; }
.topbar-title h1 { font-size: 1.05rem; font-weight: 600; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.topbar-actions { margin-left: auto; display: flex; align-items: center; gap: 8px; }

.topbar-icon {
  position: relative;
  width: 38px;
  height: 38px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  color: var(--text-muted);
  background: var(--card);
  border: 1px solid var(--border);
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.topbar-icon:hover { color: var(--primary); border-color: var(--blue-200); background: var(--blue-50); }
.topbar-icon svg { width: 18px; height: 18px; }
.topbar-icon .dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--error);
  border: 2px solid var(--card);
}

.topbar-pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 38px;
  padding: 0 12px;
  border-radius: 11px;
  background: var(--card);
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.86rem;
  font-weight: 600;
  transition: color var(--dur-fast) ease, border-color var(--dur-fast) ease, background var(--dur-fast) ease;
}
.topbar-pill:hover { color: var(--primary); border-color: var(--blue-200); background: var(--blue-50); }
.topbar-pill svg { width: 16px; height: 16px; }

.topbar .avatar { width: 34px; height: 34px; border-radius: 10px; }

main { flex: 1; }

.container,
.page-wrapper {
  width: 100%;
  max-width: var(--content-max);
  margin: 0 auto;
  padding: 28px 32px 40px;
}
.container.page-wrapper { padding: 28px 32px 40px; }

.page-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 24px;
}
.page-head .actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* Grids */
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
.grid-4 { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }

/* Footer */
.app-footer,
.main-content > footer {
  border-top: 1px solid var(--border);
  padding: 18px 32px;
  margin-top: 32px;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
  font-size: 0.83rem;
  color: var(--text-dim);
}
.app-footer a { color: var(--text-dim); font-weight: 600; }
.app-footer a:hover { color: var(--primary); }
.app-footer .footer-brand { display: inline-flex; align-items: center; gap: 8px; color: var(--text-muted); }
.app-footer .footer-brand svg { width: 16px; height: 16px; color: var(--navy-800); }
.app-footer .footer-links { display: flex; gap: 16px; align-items: center; flex-wrap: wrap; }
/* orbita:312k - der Kündigungslink sieht aus wie die Rechtslinks neben ihm,
   nicht schwächer und nicht als Knopf (siehe base.html). */
/* Die schmale Fassung auf den Seiten, die keine Fußzeile wollen (Anmeldung,
   Registrierung). Sie trägt nur die Rechtslinks und nimmt keinen Platz. */
.app-footer--schmal { justify-content: center; border-top: 0; padding-top: 4px; }

/* Announcements */
#ann-banner { padding: 16px 32px 0; }
.ann {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 16px;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--card);
  font-size: 0.88rem;
  color: var(--text);
  /* announcements are written with line breaks in the admin, so keep them */
  white-space: pre-line;
  margin-bottom: 8px;
  box-shadow: var(--shadow-xs);
  animation: fadeInUp var(--dur-slow) var(--ease-out) both;
}
.ann-warning { border-color: #F1C98C; background: var(--warning-soft); }
.ann-error { border-color: #F3B4B8; background: var(--error-soft); }
.ann-info { border-color: var(--blue-200); background: var(--blue-50); }

/* Public layout (login, landing) */
.public-page { min-height: 100vh; min-height: 100dvh; width: 100%; }
.site-header { padding: 18px 32px; display: flex; align-items: center; justify-content: space-between; }
.site-header .logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 700; color: var(--text); }

/* Admin shell reuses the sidebar; the admin layout wrapper simply fills the row */
.admin-layout { flex: 1; min-width: 0; display: flex; }
.admin-main { flex: 1; min-width: 0; margin-left: var(--sidebar-w); }
.admin-topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  height: var(--topbar-h);
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 0 32px;
  background: rgba(249, 250, 252, 0.78);
  backdrop-filter: saturate(160%) blur(14px);
  -webkit-backdrop-filter: saturate(160%) blur(14px);
  border-bottom: 1px solid var(--border);
}
/* orbita:redesign - the content used to stick to the left on a wide screen:
   max-width without margin auto leaves every spare pixel on the right. On a
   4700px display the page ended after a third of the width. Centred, and a
   little wider, is what dashboards do - the sidebar keeps its own edge. */
.admin-content {
  padding: 28px 32px 40px;
  width: 100%;
  max-width: 1680px;
  margin-inline: auto;
}
/* Tables with many columns earn the extra room; content pages do not. */
.admin-content--wide { max-width: 2100px; }


/* ── Notifications ────────────────────────────────────────────
   orbita:redesign - announcements were a full width bar above the page that
   pushed the content down on every view. Moved under the bell, where people
   look for notices, so the page starts with the page. */
.notif { position: relative; }
.notif .topbar-icon { background: none; border: 0; cursor: pointer; }
.notif-panel {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 32px));
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  z-index: 300;
  animation: fadeInUp var(--dur-fast) var(--ease-out) both;
}
.notif-head {
  padding: 13px 16px;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-dim);
  border-bottom: 1px solid var(--border);
}
.notif-body { max-height: min(420px, 60vh); overflow-y: auto; }
.notif-item {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  color: var(--text);
  text-decoration: none;
  font-size: 0.88rem;
  line-height: 1.5;
  /* pre-line: an announcement is written with its own line breaks, and they
     carry meaning - the Spanish market notice is three sentences, not one. */
  white-space: pre-line;
}
.notif-item:last-child { border-bottom: 0; }
a.notif-item:hover { background: var(--hover-row); }
.notif-item .ni-ico {
  width: 30px; height: 30px; border-radius: 9px;
  display: grid; place-items: center; flex-shrink: 0;
  background: var(--blue-50); color: var(--blue-600);
}
.notif-item .ni-ico svg { width: 15px; height: 15px; }
.notif-item.notif-warning .ni-ico { background: var(--warning-soft); color: var(--warning); }
.notif-item.notif-danger  .ni-ico { background: var(--danger-soft);  color: var(--danger); }
.notif-item .ni-text strong { display: block; font-weight: 600; margin-bottom: 2px; }
.notif-empty { padding: 22px 16px; text-align: center; color: var(--text-dim); font-size: 0.86rem; }
