@import url("/assets/css/friendly-unified-ui.css?v=1.0.0-audit169");

/* Shared authenticated shell: Platform Admin + Cabinet + Workspace. */
.app-body:not([data-runtime-ready="true"]) {
  min-height: 100vh;
  overflow: hidden;
  background: #f7f8fa;
}

.app-body:not([data-runtime-ready="true"]) .app-shell {
  visibility: hidden;
}

.app-body:not([data-runtime-ready="true"])::before {
  content: "Kontrum";
  position: fixed;
  z-index: 1000;
  top: 50%;
  left: 50%;
  min-height: 42px;
  padding-left: 54px;
  display: flex;
  align-items: center;
  color: #0f172a;
  background: url("/assets/brand/kontrum-mark.svg") left center / 42px 42px no-repeat;
  font: 750 22px/1.1 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: -.035em;
  transform: translate(-50%, -68%);
}

.app-body:not([data-runtime-ready="true"])::after {
  content: "";
  position: fixed;
  z-index: 1000;
  top: calc(50% + 32px);
  left: 50%;
  width: 108px;
  height: 3px;
  border-radius: 999px;
  background: linear-gradient(90deg, #dbe7fb 0 18%, #126bff 42% 58%, #dbe7fb 82% 100%);
  background-size: 220% 100%;
  animation: kontrum-initial-runtime 1.15s linear infinite;
  transform: translateX(-50%);
}

html[data-theme="dark"] .app-body:not([data-runtime-ready="true"]) {
  background: #0d1420;
}

html[data-theme="dark"] .app-body:not([data-runtime-ready="true"])::before {
  color: #f4f7fb;
}

html[data-theme="dark"] .app-body:not([data-runtime-ready="true"])::after {
  background: linear-gradient(90deg, #243249 0 18%, #6f9fff 42% 58%, #243249 82% 100%);
  background-size: 220% 100%;
}

@keyframes kontrum-initial-runtime {
  to { background-position-x: -220%; }
}

@media (prefers-reduced-motion: reduce) {
  .app-body:not([data-runtime-ready="true"])::after {
    animation: none;
  }
}

.app-shell > .navigation-loading-mask {
  position: fixed;
  z-index: 40;
  top: var(--topbar);
  right: 0;
  bottom: 0;
  left: var(--app-sidebar-width);
  display: grid;
  align-content: center;
  justify-items: center;
  gap: 12px;
  background: var(--bg);
  pointer-events: none;
}

.main-scroll[aria-busy="true"] > .page,
.main-scroll[aria-busy="true"] > .cc-real-page {
  visibility: hidden !important;
}

.navigation-loading-spinner {
  width: 32px;
  height: 32px;
  border: 3px solid var(--line);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: kontrum-navigation-loading .72s linear infinite;
}

.navigation-loading-label {
  color: var(--muted);
  font-size: 14px;
  font-weight: 650;
}

@keyframes kontrum-navigation-loading {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .navigation-loading-spinner {
    animation: none;
  }
}

.app-shell {
  --app-shell-gutter: clamp(16px, 1.25vw, 24px);
  --app-sidebar-expanded: 236px;
  --app-sidebar-collapsed: 72px;
  --app-sidebar-width: var(--app-sidebar-expanded);
}

.app-shell .sidebar,
.app-shell .sidebar-brand,
.app-shell .sidebar-bottom,
.app-shell .topbar {
  border: 0;
}

.sidebar-brand,
.sidebar-bottom {
  position: relative;
}

@media (min-width: 781px) {
  .sidebar,
  .topbar {
    position: relative;
  }
}

.sidebar::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  right: 0;
  bottom: 0;
  width: 1px;
  background: linear-gradient(180deg, rgba(189, 204, 225, .08), rgba(189, 204, 225, .78) 18%, rgba(189, 204, 225, .58) 82%, rgba(189, 204, 225, .08));
  pointer-events: none;
}

.sidebar-brand::after,
.sidebar-bottom::before,
.topbar::after {
  content: "";
  position: absolute;
  z-index: 2;
  right: 0;
  bottom: 0;
  left: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(189, 204, 225, .72) 18%, rgba(189, 204, 225, .72) 82%, transparent);
  pointer-events: none;
}

.sidebar-bottom::before {
  top: 0;
  bottom: auto;
}

.sidebar-collapse-toggle {
  position: absolute;
  z-index: 6;
  top: 18px;
  right: -14px;
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border: 1px solid rgba(189, 204, 225, .82);
  border-radius: 9px;
  background: rgba(255, 255, 255, .98);
  box-shadow: 0 5px 16px rgba(25, 58, 112, .12);
  color: #60738e;
  transition: color .18s ease, border-color .18s ease, box-shadow .18s ease, transform .2s ease;
}

.sidebar-collapse-toggle:hover {
  border-color: #a9c2ea;
  box-shadow: 0 7px 20px rgba(25, 58, 112, .18);
  color: var(--blue);
}

.sidebar-collapse-toggle svg {
  width: 15px;
  height: 15px;
}

@media (min-width: 781px) {
  .app-shell {
    --sidebar: var(--app-sidebar-width);
    grid-template-columns: var(--app-sidebar-width) minmax(0, 1fr);
    transition: grid-template-columns .2s ease;
  }

  .app-shell.sidebar-collapsed {
    --app-sidebar-width: var(--app-sidebar-collapsed);
  }

  .app-shell .sidebar {
    width: var(--app-sidebar-width);
    transition: width .2s ease;
  }

  .app-shell .topbar,
  .app-shell .main-scroll {
    grid-column: 2;
  }

  .app-shell .main-scroll > .page,
  .app-shell .main-scroll > .page.wide,
  .app-shell .main-scroll > .cc-real-page {
    width: calc(100% - (var(--app-shell-gutter) * 2));
    max-width: none;
    margin-right: auto;
    margin-left: auto;
  }

  .app-shell.sidebar-collapsed .sidebar-brand {
    justify-content: center;
    padding-right: 10px;
    padding-left: 10px;
  }

  .app-shell.sidebar-collapsed .sidebar-brand .logo-copy,
  .app-shell.sidebar-collapsed .nav-section,
  .app-shell.sidebar-collapsed .sidebar-scroll > .nav-item > span,
  .app-shell.sidebar-collapsed .sidebar-scroll > .nav-item .count,
  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card > b,
  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card > small {
    display: none;
  }

  .app-shell.sidebar-collapsed .sidebar-brand .logo {
    min-width: 0;
  }

  .app-shell.sidebar-collapsed .sidebar-scroll {
    padding-right: 10px;
    padding-left: 10px;
    overflow-x: visible;
  }

  .app-shell.sidebar-collapsed .sidebar-scroll > .nav-item {
    width: 44px;
    min-height: 44px;
    justify-content: center;
    margin: 4px auto;
    padding: 0;
  }

  .app-shell.sidebar-collapsed .sidebar-scroll > .nav-item svg {
    width: 20px;
    height: 20px;
  }

  .app-shell.sidebar-collapsed .sidebar-bottom {
    display: grid;
    place-items: center;
    padding: 12px 10px;
  }

  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card {
    position: relative;
    width: 42px;
    height: 42px;
    min-height: 42px;
    border-radius: 13px;
    padding: 0;
  }

  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card::before {
    top: 50%;
    left: 50%;
    width: 10px;
    height: 10px;
    transform: translate(-50%, -50%);
  }

  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card:not([data-workspace-status])::before {
    content: "";
    position: absolute;
    border-radius: 50%;
    background: #94a3b8;
    box-shadow: 0 0 0 5px rgba(148, 163, 184, .12);
  }

  .app-shell.sidebar-collapsed .sidebar-bottom .sync-card[data-sidebar-status-tone="ready"]::before {
    background: var(--green);
    box-shadow: 0 0 0 5px rgba(18, 134, 92, .12);
  }

  .app-shell.sidebar-collapsed .nav-sub.sidebar-flyout {
    position: fixed;
    z-index: 180;
    top: var(--sidebar-flyout-top, 80px);
    left: calc(var(--app-sidebar-collapsed) + 10px);
    display: none;
    width: min(270px, calc(100vw - var(--app-sidebar-collapsed) - 28px));
    max-height: min(520px, calc(100vh - 24px));
    gap: 2px;
    overflow: auto;
    margin: 0;
    padding: 8px;
    border: 1px solid rgba(189, 204, 225, .84);
    border-radius: 15px;
    background: rgba(255, 255, 255, .98);
    box-shadow: 0 18px 46px rgba(25, 58, 112, .18);
    backdrop-filter: blur(18px);
  }

  .app-shell.sidebar-collapsed .nav-sub.sidebar-flyout.open {
    display: grid;
  }

  .app-shell.sidebar-collapsed .nav-sub.sidebar-flyout .sidebar-flyout-title {
    display: block;
    padding: 8px 10px 7px;
    color: #8594a9;
    font-size: 9px;
    font-weight: 900;
    letter-spacing: .1em;
    text-transform: uppercase;
  }

  .app-shell.sidebar-collapsed .nav-sub.sidebar-flyout .nav-item {
    width: 100%;
    min-height: 38px;
    margin: 0;
    padding: 8px 10px;
  }

  .app-shell.sidebar-collapsed .nav-sub.sidebar-flyout .nav-item > span {
    display: inline;
  }
}

.sidebar-flyout-title {
  display: none;
}

.sidebar-flyout-parent {
  display: none;
}

@media (min-width: 781px) {
  .app-shell.sidebar-collapsed .sidebar-flyout-parent {
    display: flex;
  }
}

@media (min-width: 781px) and (max-width: 1100px) {
  .app-shell {
    --app-sidebar-expanded: 220px;
  }
}

@media (max-width: 780px) {
  .app-shell > .navigation-loading-mask {
    left: 0;
  }

  .app-shell .sidebar {
    position: fixed;
  }

  .app-shell .topbar,
  .app-shell .main-scroll {
    position: fixed;
  }

  .sidebar-collapse-toggle {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .app-shell,
  .app-shell .sidebar,
  .sidebar-collapse-toggle {
    transition: none;
  }
}
