/**
 * Akilli System — Shared shell / top chrome
 * Used by order-system panel + Apps admin.
 */

.ak-shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--ak-canvas);
}

.ak-shell__top {
  position: sticky;
  top: 0;
  z-index: 80;
  height: var(--ak-shell-h);
  display: flex;
  align-items: center;
  gap: var(--ak-s-3);
  padding: 0 var(--ak-pad-x);
  background: rgba(247, 247, 245, 0.86);
  border-bottom: 1px solid var(--ak-line);
  backdrop-filter: blur(12px) saturate(140%);
  -webkit-backdrop-filter: blur(12px) saturate(140%);
}

.ak-shell__brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  text-decoration: none;
  color: var(--ak-ink);
  flex-shrink: 0;
}

.ak-shell__brand img {
  height: 24px;
  width: auto;
}

.ak-shell__brand-text {
  font-size: var(--ak-fs-sm);
  font-weight: var(--ak-fw-bold);
  letter-spacing: -0.02em;
}

/* Product switcher */
.ak-product-switch {
  display: inline-flex;
  align-items: center;
  padding: 0.18rem;
  border-radius: var(--ak-r-full);
  background: var(--ak-surface-2);
  border: 1px solid var(--ak-line);
  gap: 0.1rem;
  flex-shrink: 0;
}

.ak-product-switch a {
  display: inline-flex;
  align-items: center;
  min-height: 1.85rem;
  padding: 0 0.75rem;
  border-radius: var(--ak-r-full);
  font-size: var(--ak-fs-xs);
  font-weight: var(--ak-fw-semibold);
  color: var(--ak-ink-3);
  text-decoration: none;
  transition: background var(--ak-t-fast), color var(--ak-t-fast);
}

.ak-product-switch a:hover {
  color: var(--ak-ink);
  text-decoration: none;
}

.ak-product-switch a.is-active {
  background: var(--ak-surface);
  color: var(--ak-ink);
  box-shadow: var(--ak-shadow-xs);
}

.ak-shell__grow {
  flex: 1 1 auto;
  min-width: 0;
}

.ak-shell__actions {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  margin-left: auto;
  flex-shrink: 0;
}

.ak-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: var(--ak-r-md);
  border: 1px solid transparent;
  background: transparent;
  color: var(--ak-ink-2);
  text-decoration: none;
  cursor: pointer;
  transition: background var(--ak-t-fast), color var(--ak-t-fast), border-color var(--ak-t-fast);
}

.ak-icon-btn:hover {
  background: var(--ak-accent-subtle);
  color: var(--ak-ink);
  text-decoration: none;
}

.ak-avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--ak-r-full);
  background: var(--ak-ink);
  color: #fff;
  font-size: var(--ak-fs-xs);
  font-weight: var(--ak-fw-bold);
}

.ak-shell__context {
  padding: 0.55rem var(--ak-pad-x);
  border-bottom: 1px solid var(--ak-line);
  font-size: var(--ak-fs-xs);
  font-weight: var(--ak-fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ak-ink-3);
  background: var(--ak-surface);
}

.ak-shell__nav {
  display: flex;
  gap: 0.2rem;
  padding: 0.45rem var(--ak-pad-x);
  overflow-x: auto;
  border-bottom: 1px solid var(--ak-line);
  background: var(--ak-surface);
}

.ak-shell__nav a {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--ak-r-md);
  color: var(--ak-ink-3);
  font-size: var(--ak-fs-sm);
  font-weight: var(--ak-fw-medium);
  text-decoration: none;
  white-space: nowrap;
  transition: background var(--ak-t-fast), color var(--ak-t-fast);
}

.ak-shell__nav a:hover {
  background: var(--ak-accent-subtle);
  color: var(--ak-ink);
  text-decoration: none;
}

.ak-shell__nav a.is-active {
  background: var(--ak-accent-subtle);
  color: var(--ak-ink);
  font-weight: var(--ak-fw-semibold);
}

.ak-shell__content {
  width: min(var(--ak-content-max), 100%);
  margin: 0 auto;
  padding: var(--ak-pad-y) var(--ak-pad-x) var(--ak-s-12);
  flex: 1 1 auto;
  animation: ak-fade-up var(--ak-t-base) both;
}

.ak-shell__content--wide {
  width: min(var(--ak-content-wide), 100%);
}

.ak-shell__content--full {
  width: 100%;
  max-width: none;
}

/* Bridge existing Apps shell classes → system look */
.shell-body,
.portal-body,
.app-body,
.auth-body {
  background: var(--ak-canvas) !important;
  color: var(--ak-ink);
  font-family: var(--ak-font);
}

.shell {
  min-height: 100vh;
  background: var(--ak-canvas);
}

.shell-topbar {
  position: sticky;
  top: 0;
  z-index: 80;
  display: flex;
  align-items: center;
  gap: var(--ak-s-3);
  min-height: var(--ak-shell-h);
  padding: 0.55rem var(--ak-pad-x);
  background: rgba(247, 247, 245, 0.9);
  border-bottom: 1px solid var(--ak-line);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.shell-brand {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
}

.shell-brand img {
  height: 26px;
  width: auto;
}

.shell-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin-left: auto;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.shell-icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: var(--ak-r-md);
  color: var(--ak-ink-2);
  text-decoration: none;
  border: 1px solid transparent;
}

.shell-icon-btn:hover {
  background: var(--ak-accent-subtle);
  color: var(--ak-ink);
}

.shell-avatar {
  display: inline-grid;
  place-items: center;
  width: 2rem;
  height: 2rem;
  border-radius: var(--ak-r-full);
  background: var(--ak-ink);
  color: #fff;
  font-size: var(--ak-fs-xs);
  font-weight: var(--ak-fw-bold);
}

.shell-context {
  padding: 0.55rem var(--ak-pad-x);
  border-bottom: 1px solid var(--ak-line);
  background: var(--ak-surface);
  font-size: var(--ak-fs-xs);
  font-weight: var(--ak-fw-semibold);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ak-ink-3);
}

.shell-nav {
  display: flex;
  gap: 0.2rem;
  padding: 0.45rem var(--ak-pad-x);
  overflow-x: auto;
  border-bottom: 1px solid var(--ak-line);
  background: var(--ak-surface);
}

.shell-nav-link {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  min-height: 2rem;
  padding: 0 0.75rem;
  border-radius: var(--ak-r-md);
  color: var(--ak-ink-3);
  font-size: var(--ak-fs-sm);
  font-weight: var(--ak-fw-medium);
  text-decoration: none;
  white-space: nowrap;
}

.shell-nav-link:hover,
.shell-nav-link.is-active {
  background: var(--ak-accent-subtle);
  color: var(--ak-ink);
  text-decoration: none;
}

.shell-content {
  width: min(var(--ak-content-max), 100%);
  margin: 0 auto;
  padding: var(--ak-pad-y) var(--ak-pad-x) var(--ak-s-12);
}

.shell-content-auth {
  width: min(440px, 100%);
}

.shell-auth .shell-topbar {
  justify-content: center;
  background: transparent;
  border-bottom: 0;
  backdrop-filter: none;
}

.shell-store-select,
.shell-app-select,
.shell-controls label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: var(--ak-fs-xs);
  color: var(--ak-ink-3);
  font-weight: var(--ak-fw-semibold);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.shell-controls select {
  min-height: 2rem;
  padding: 0 0.55rem;
  border: 1px solid var(--ak-line-strong);
  border-radius: var(--ak-r-md);
  background: var(--ak-surface);
  color: var(--ak-ink);
  font-size: var(--ak-fs-sm);
  text-transform: none;
  letter-spacing: 0;
  font-weight: var(--ak-fw-medium);
}

/* Order-system topnav bridge → system look */
.topbar-v3,
.topbar-v3__shell,
.layout-topnav .topbar-v3 {
  background: rgba(247, 247, 245, 0.92) !important;
  border-bottom: 1px solid var(--ak-line) !important;
  box-shadow: none !important;
  backdrop-filter: blur(12px);
}

.topbar-v3__shell {
  min-height: var(--ak-shell-h);
  padding: 0 var(--ak-pad-x);
  display: flex;
  align-items: center;
  gap: var(--ak-s-3);
}

.topnav-main a,
.topnav-dd__trigger,
.topnav-cmd-chip,
.topnav-logout-btn {
  border-radius: var(--ak-r-md) !important;
  font-family: var(--ak-font) !important;
}

.topbar-profile__avatar {
  background: var(--ak-ink) !important;
  color: #fff !important;
}

.layout,
.layout-topnav,
.main-content,
.content-wrap {
  background: var(--ak-canvas) !important;
  font-family: var(--ak-font);
  color: var(--ak-ink);
}

/* Soften legacy cards / buttons across panel */
.button,
.btn,
button.button,
a.button,
.set-btn,
.sy-btn,
.vault-btn,
.aci-btn-primary,
.ac-btn-primary {
  border-radius: var(--ak-r-md) !important;
  font-family: var(--ak-font) !important;
}

.card,
.table-card,
.set-card,
.sy-card,
.vault-card,
.pick-card,
.auth-shell .card {
  border: 1px solid var(--ak-line) !important;
  border-radius: var(--ak-r-lg) !important;
  box-shadow: var(--ak-shadow-xs) !important;
  background: var(--ak-surface) !important;
}

.page-header h1,
.set-hero__title,
.sy-hero__title,
.data-title {
  letter-spacing: -0.03em;
  font-family: var(--ak-font);
}

.flash {
  border-radius: var(--ak-r-md);
  border: 1px solid var(--ak-line);
  background: var(--ak-info-bg);
  color: var(--ak-info);
  padding: 0.75rem 0.95rem;
  margin-bottom: var(--ak-s-4);
  font-size: var(--ak-fs-sm);
}

@media (max-width: 860px) {
  .ak-product-switch a {
    padding: 0 0.55rem;
  }

  .shell-controls label span,
  .topnav-cmd-chip__text,
  .topnav-cmd-chip__key {
    display: none;
  }
}
