/**
 * System-wide SaaS surface — extends hub visual language into shell pages.
 * Scoped under .app-shell.gk-saas so the modules hub stays independent.
 */

@keyframes gk-saas-rise {
  from { opacity: 0; transform: translateY(10px) scale(0.985); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.app-shell.gk-saas {
  --gk-saas-shadow:
    0 1px 2px rgba(15, 23, 42, 0.05),
    0 8px 20px rgba(15, 23, 42, 0.06);
  --gk-saas-shadow-hover:
    0 4px 12px rgba(15, 23, 42, 0.07),
    0 16px 32px rgba(15, 23, 42, 0.1);
  background: #e8eef5;
}

.app-shell.gk-saas .app-content {
  background: #e8eef5;
}

.app-shell.gk-saas .main {
  background: transparent;
}

.app-shell.gk-saas .page-body {
  padding: 1rem 1.15rem 1.5rem;
  max-width: 1280px;
  margin: 0 auto;
  width: 100%;
  box-sizing: border-box;
}

/* ── Hero topbar ── */
.app-shell.gk-saas .content-topbar {
  position: relative;
  isolation: isolate;
  overflow: visible;
  z-index: 20;
  margin: 0.75rem 0.85rem 0;
  padding: 0.95rem 1.1rem;
  border: 1px solid rgba(148, 163, 184, 0.28);
  border-radius: 16px;
  border-bottom: 1px solid rgba(148, 163, 184, 0.28);
  background: transparent;
  box-shadow: var(--gk-saas-shadow);
  gap: 0.85rem;
  opacity: 0;
  animation: gk-saas-rise 0.42s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-shell.gk-saas .content-topbar-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  clip-path: inset(0 round 16px);
  background: url("/images/hub/hub-header-campus.jpg?v=20260926e") center 40% / cover no-repeat;
  transform: scale(1.03);
  animation: gk-saas-ken 20s ease-in-out infinite alternate;
}

.app-shell.gk-saas .content-topbar-veil {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  border-radius: inherit;
  clip-path: inset(0 round 16px);
  background:
    linear-gradient(105deg,
      rgba(232, 238, 243, 0.95) 0%,
      rgba(232, 238, 243, 0.9) 42%,
      rgba(232, 238, 243, 0.58) 72%,
      rgba(15, 118, 110, 0.2) 100%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.28), rgba(232, 238, 243, 0.45));
}

.app-shell.gk-saas .content-topbar > *:not(.content-topbar-bg):not(.content-topbar-veil) {
  position: relative;
  z-index: 2;
}

.app-shell.gk-saas .content-topbar .user-menu {
  position: relative;
  z-index: 30;
}

.app-shell.gk-saas .content-topbar .user-menu-panel {
  z-index: 120;
}

@keyframes gk-saas-ken {
  from { transform: scale(1.03) translate3d(0, 0, 0); }
  to { transform: scale(1.07) translate3d(-1%, -0.5%, 0); }
}

.app-shell.gk-saas .content-title {
  margin: 0;
  font-size: clamp(1.15rem, 2vw, 1.4rem);
  font-weight: 750;
  letter-spacing: -0.025em;
  color: #0f172a;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.35);
}

.app-shell.gk-saas .content-subtitle {
  margin: 0.2rem 0 0;
  font-size: 0.88rem;
  color: #475569;
}

.app-shell.gk-saas .content-topbar .user-avatar-btn,
.app-shell.gk-saas .content-topbar .btn-icon,
.app-shell.gk-saas .content-topbar .sidebar-toggle {
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(148, 163, 184, 0.4);
  box-shadow: 0 1px 2px rgba(15, 23, 42, 0.05);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease, color 0.18s ease;
}

.app-shell.gk-saas .content-topbar .user-avatar-btn:hover,
.app-shell.gk-saas .content-topbar .btn-icon:hover,
.app-shell.gk-saas .content-topbar .sidebar-toggle:hover {
  transform: translateY(-1px);
  border-color: color-mix(in srgb, var(--teal-primary, #0f766e) 35%, #94a3b8);
  color: var(--teal-primary, #0f766e);
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.08);
}

/* ── Cards / panels ── */
.app-shell.gk-saas .card,
.app-shell.gk-saas .home-section-actions,
.app-shell.gk-saas .finance-desk-head,
.app-shell.gk-saas .finance-desk-panel,
.app-shell.gk-saas .settings-card,
.app-shell.gk-saas .luxe-card,
.app-shell.gk-saas .panel-card {
  background: #fff !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  border-radius: 16px !important;
  box-shadow: var(--gk-saas-shadow) !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease, border-color 0.2s ease;
}

.app-shell.gk-saas .card:hover,
.app-shell.gk-saas .finance-desk-panel:hover {
  box-shadow: var(--gk-saas-shadow-hover) !important;
}

.app-shell.gk-saas .page-body > *,
.app-shell.gk-saas .home-page > *,
.app-shell.gk-saas .agency-home-page > *,
.app-shell.gk-saas .admin-module-page > *,
.app-shell.gk-saas .finance-desk-page > * {
  opacity: 0;
  animation: gk-saas-rise 0.4s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.app-shell.gk-saas .page-body > *:nth-child(1),
.app-shell.gk-saas .home-page > *:nth-child(1) { animation-delay: 40ms; }
.app-shell.gk-saas .page-body > *:nth-child(2),
.app-shell.gk-saas .home-page > *:nth-child(2) { animation-delay: 90ms; }
.app-shell.gk-saas .page-body > *:nth-child(3),
.app-shell.gk-saas .home-page > *:nth-child(3) { animation-delay: 140ms; }
.app-shell.gk-saas .page-body > *:nth-child(4),
.app-shell.gk-saas .home-page > *:nth-child(4) { animation-delay: 180ms; }
.app-shell.gk-saas .page-body > *:nth-child(n+5),
.app-shell.gk-saas .home-page > *:nth-child(n+5) { animation-delay: 220ms; }

/* ── KPI / home stats → light SaaS ── */
.app-shell.gk-saas .home-stats,
.app-shell.gk-saas .agency-stats,
.app-shell.gk-saas .lf-home-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.app-shell.gk-saas .home-stat,
.app-shell.gk-saas .home-stat-in,
.app-shell.gk-saas .home-stat-wait,
.app-shell.gk-saas .home-stat-tools,
.app-shell.gk-saas .home-stat-reports,
.app-shell.gk-saas .home-stat-dark {
  background: #fff !important;
  color: #0f172a !important;
  border: 1px solid rgba(148, 163, 184, 0.22) !important;
  box-shadow: var(--gk-saas-shadow) !important;
  border-radius: 14px !important;
  padding: 0.95rem 1rem !important;
}

.app-shell.gk-saas .home-stat:hover {
  transform: translateY(-2px);
  box-shadow: var(--gk-saas-shadow-hover) !important;
  border-color: color-mix(in srgb, var(--teal-primary, #0f766e) 28%, #cbd5e1) !important;
}

.app-shell.gk-saas .home-stat-n,
.app-shell.gk-saas .home-stat-value {
  color: #0f172a !important;
  font-size: 1.35rem !important;
  font-weight: 750 !important;
}

.app-shell.gk-saas .home-stat-l,
.app-shell.gk-saas .home-stat-label {
  color: #64748b !important;
  opacity: 1 !important;
  text-transform: none !important;
  letter-spacing: -0.01em !important;
  font-size: 0.75rem !important;
  font-weight: 600 !important;
}

.app-shell.gk-saas .home-stat-icon {
  width: 2.35rem !important;
  height: 2.35rem !important;
  border-radius: 10px !important;
  background: var(--teal-primary, #0f766e) !important;
  color: #fff !important;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--teal-primary, #0f766e) 32%, transparent) !important;
}

.app-shell.gk-saas .home-stat-icon svg,
.app-shell.gk-saas .home-stat-icon .home-action-svg,
.app-shell.gk-saas .home-stat-icon .home-stat-svg {
  width: 1.15rem !important;
  height: 1.15rem !important;
  color: #fff !important;
  stroke: #fff !important;
}

.app-shell.gk-saas .home-stat-in .home-stat-icon { background: #0f766e !important; }
.app-shell.gk-saas .home-stat-wait .home-stat-icon { background: #a16207 !important; box-shadow: 0 4px 10px color-mix(in srgb, #a16207 32%, transparent) !important; }
.app-shell.gk-saas .home-stat-reports .home-stat-icon { background: #6d28d9 !important; box-shadow: 0 4px 10px color-mix(in srgb, #6d28d9 32%, transparent) !important; }
.app-shell.gk-saas .home-stat-tools .home-stat-icon { background: #0369a1 !important; box-shadow: 0 4px 10px color-mix(in srgb, #0369a1 32%, transparent) !important; }

.app-shell.gk-saas .home-stat-notify {
  border-color: color-mix(in srgb, var(--accent-danger, #dc2626) 35%, #cbd5e1) !important;
}

/* ── Action / module tiles (ops-desk: white, clear icon, accent rail) ── */
.app-shell.gk-saas .home-actions,
.app-shell.gk-saas .home-action-grid,
.app-shell.gk-saas .agency-tile-grid,
.app-shell.gk-saas .admin-module-grid,
.app-shell.gk-saas .modules-grid.admin-module-grid {
  display: grid !important;
  grid-template-columns: repeat(auto-fill, minmax(158px, 1fr)) !important;
  gap: 0.7rem !important;
  align-items: stretch;
}

.app-shell.gk-saas .home-action-card,
.app-shell.gk-saas .agency-tile,
.app-shell.gk-saas .module-tile,
.app-shell.gk-saas .admin-module-tile {
  --tile-accent: var(--teal-primary, #0f766e);
  position: relative;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-start !important;
  justify-content: flex-start !important;
  gap: 0.65rem !important;
  min-height: 7.75rem !important;
  height: 100% !important;
  aspect-ratio: auto !important;
  padding: 0.9rem 0.95rem 0.95rem 1.05rem !important;
  border-radius: 12px !important;
  border: 1px solid rgba(148, 163, 184, 0.32) !important;
  background: #fff !important;
  color: #0f172a !important;
  text-decoration: none !important;
  box-shadow:
    0 1px 2px rgba(15, 23, 42, 0.06),
    0 4px 10px rgba(15, 23, 42, 0.06),
    0 14px 28px rgba(15, 23, 42, 0.08) !important;
  overflow: hidden !important;
  transition: transform 0.2s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.2s ease, border-color 0.2s ease !important;
}

.app-shell.gk-saas .home-action-card::before,
.app-shell.gk-saas .agency-tile::before,
.app-shell.gk-saas .module-tile::before,
.app-shell.gk-saas .admin-module-tile::before {
  content: "" !important;
  position: absolute !important;
  inset-inline-start: 0 !important;
  top: 0.85rem !important;
  bottom: 0.85rem !important;
  width: 3px !important;
  background: var(--tile-accent) !important;
  opacity: 1 !important;
  z-index: 3 !important;
  border-radius: 999px !important;
  height: auto !important;
}

/* No decorative blobs / pastel motifs */
.app-shell.gk-saas .home-action-card::after,
.app-shell.gk-saas .agency-tile::after,
.app-shell.gk-saas .module-tile::after,
.app-shell.gk-saas .admin-module-tile::after {
  content: none !important;
  display: none !important;
}

.app-shell.gk-saas .home-action-card:hover,
.app-shell.gk-saas .agency-tile:hover,
.app-shell.gk-saas .module-tile:hover,
.app-shell.gk-saas .admin-module-tile:hover {
  transform: translateY(-3px) !important;
  border-color: color-mix(in srgb, var(--tile-accent) 42%, #cbd5e1) !important;
  box-shadow:
    0 2px 4px rgba(15, 23, 42, 0.06),
    0 10px 20px rgba(15, 23, 42, 0.1),
    0 22px 40px rgba(15, 23, 42, 0.12) !important;
  background: #fff !important;
}

.app-shell.gk-saas .home-action-deco,
.app-shell.gk-saas .tile-bg {
  display: none !important;
}

.app-shell.gk-saas .home-action-icon-wrap,
.app-shell.gk-saas .module-tile-icon {
  position: relative !important;
  z-index: 2 !important;
  width: 2.35rem !important;
  height: 2.35rem !important;
  border-radius: 10px !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  background: var(--tile-accent) !important;
  color: #fff !important;
  border: 0 !important;
  box-shadow: 0 4px 10px color-mix(in srgb, var(--tile-accent) 35%, transparent) !important;
  backdrop-filter: none !important;
  transition: transform 0.18s ease, box-shadow 0.18s ease !important;
}

.app-shell.gk-saas .home-action-card:hover .home-action-icon-wrap,
.app-shell.gk-saas .module-tile:hover .module-tile-icon {
  transform: scale(1.05) !important;
  box-shadow: 0 6px 14px color-mix(in srgb, var(--tile-accent) 42%, transparent) !important;
}

.app-shell.gk-saas .home-action-icon-wrap svg,
.app-shell.gk-saas .home-action-icon-wrap .home-action-svg,
.app-shell.gk-saas .module-tile-icon svg,
.app-shell.gk-saas .module-tile-icon .home-action-svg {
  width: 1.1rem !important;
  height: 1.1rem !important;
  color: #fff !important;
  stroke: #fff !important;
}

.app-shell.gk-saas .home-action-title,
.app-shell.gk-saas .module-tile-title {
  position: relative;
  z-index: 2;
  margin-top: auto;
  font-size: 0.9rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.02em !important;
  line-height: 1.3 !important;
  color: #0f172a !important;
  text-align: start !important;
}

.app-shell.gk-saas .agency-tile-desc,
.app-shell.gk-saas .module-tile-desc,
.app-shell.gk-saas .muted.agency-tile-desc {
  position: relative;
  z-index: 2;
  font-size: 0.72rem !important;
  line-height: 1.35 !important;
  color: #64748b !important;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  text-align: start !important;
}

.app-shell.gk-saas .module-tile-body {
  padding: 0 !important;
  gap: 0.2rem !important;
  justify-content: flex-end !important;
  margin-top: auto;
  width: 100%;
}

.app-shell.gk-saas .module-tile-foot {
  margin-top: 0.45rem;
  padding-top: 0.45rem !important;
  border-top: 1px solid rgba(148, 163, 184, 0.22) !important;
  width: 100%;
}

.app-shell.gk-saas .module-tile-open {
  color: #64748b !important;
  font-size: 0.68rem !important;
}

.app-shell.gk-saas .module-tile-arrow {
  background: color-mix(in srgb, var(--tile-accent) 12%, #f8fafc) !important;
  color: var(--tile-accent) !important;
  width: 1.5rem !important;
  height: 1.5rem !important;
  font-size: 0.85rem !important;
}

.app-shell.gk-saas .home-action-card .pending-badge,
.app-shell.gk-saas .home-action-card .pending-badge-tile,
.app-shell.gk-saas .module-tile .pending-badge,
.app-shell.gk-saas .module-tile .pending-badge-tile {
  z-index: 4 !important;
}

/* Accent map — solid icon + rail color per function */
.app-shell.gk-saas [data-action="form"],
.app-shell.gk-saas [data-action="log"] { --tile-accent: #0f766e; }
.app-shell.gk-saas [data-action="gatekeeper"],
.app-shell.gk-saas [data-action="gate"],
.app-shell.gk-saas [data-action="kiosk"] { --tile-accent: #0e7490; }
.app-shell.gk-saas [data-action="gatepass"] { --tile-accent: #1d4ed8; }
.app-shell.gk-saas [data-action="returns"],
.app-shell.gk-saas [data-action="unclaimed"] { --tile-accent: #b45309; }
.app-shell.gk-saas [data-action="approvals"],
.app-shell.gk-saas [data-action="claims"],
.app-shell.gk-saas [data-action="deptApprovals"] { --tile-accent: #a16207; }
.app-shell.gk-saas [data-action="lostfound"],
.app-shell.gk-saas [data-action="inventory"],
.app-shell.gk-saas [data-action="lost"] { --tile-accent: #c2410c; }
.app-shell.gk-saas [data-action="reports"] { --tile-accent: #6d28d9; }
.app-shell.gk-saas [data-action="scanner"],
.app-shell.gk-saas [data-action="badges"] { --tile-accent: #0369a1; }
.app-shell.gk-saas [data-action="message"] { --tile-accent: #047857; }
.app-shell.gk-saas [data-action="settings"],
.app-shell.gk-saas [data-action="enterprise"],
.app-shell.gk-saas [data-action="license"] { --tile-accent: #475569; }
.app-shell.gk-saas [data-action="finance"] { --tile-accent: #115e59; }
.app-shell.gk-saas [data-action="form"].agency-tile,
.app-shell.gk-saas [data-action="approvals"].agency-tile { --tile-accent: #0e7490; }
.app-shell.gk-saas [data-action="deptApprovals"].agency-tile { --tile-accent: #1d4ed8; }
.app-shell.gk-saas [data-action="reports"].agency-tile { --tile-accent: #6d28d9; }
.app-shell.gk-saas [data-action="badges"].agency-tile { --tile-accent: #0369a1; }
.app-shell.gk-saas [data-action="finance"].agency-tile { --tile-accent: #115e59; }

.app-shell.gk-saas .home-section-title {
  font-size: 1rem !important;
  font-weight: 700 !important;
  letter-spacing: -0.01em !important;
  color: #0f172a !important;
}

.app-shell.gk-saas .home-section-dot {
  width: 0.45rem !important;
  height: 0.45rem !important;
  border-radius: 999px !important;
  background: var(--teal-primary, #0f766e) !important;
  box-shadow: none !important;
}

.app-shell.gk-saas .home-section-actions {
  padding: 1.05rem 1.1rem 1.15rem !important;
}

/* Tables / toolbars inside shell */
.app-shell.gk-saas .table-wrap,
.app-shell.gk-saas .data-table-wrap,
.app-shell.gk-saas .toolbar-card {
  background: #fff;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 14px;
  box-shadow: var(--gk-saas-shadow);
}

.app-shell.gk-saas .btn-primary:not(.gk-btn):hover,
.app-shell.gk-saas .btn-outline:hover {
  transform: translateY(-1px);
}

/* Sidebar polish */
.app-shell.gk-saas .sidebar {
  box-shadow: 4px 0 24px rgba(15, 23, 42, 0.04);
}

.app-shell.gk-saas .sidebar .nav-link.active {
  box-shadow: inset 3px 0 0 var(--teal-primary, #0f766e);
}

/* Dark mode */
html[data-theme="dark"] .app-shell.gk-saas,
html[data-theme="dark"] .app-shell.gk-saas .app-content {
  background: #0f172a;
}

html[data-theme="dark"] .app-shell.gk-saas .content-topbar-veil {
  background:
    linear-gradient(105deg,
      rgba(15, 23, 42, 0.94) 0%,
      rgba(15, 23, 42, 0.84) 45%,
      rgba(15, 23, 42, 0.55) 72%,
      rgba(15, 118, 110, 0.28) 100%);
}

html[data-theme="dark"] .app-shell.gk-saas .content-title {
  color: #f8fafc;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.35);
}

html[data-theme="dark"] .app-shell.gk-saas .content-subtitle {
  color: #cbd5e1;
}

html[data-theme="dark"] .app-shell.gk-saas .card,
html[data-theme="dark"] .app-shell.gk-saas .home-section-actions,
html[data-theme="dark"] .app-shell.gk-saas .home-stat,
html[data-theme="dark"] .app-shell.gk-saas .finance-desk-panel {
  background: #1e293b !important;
  border-color: rgba(148, 163, 184, 0.25) !important;
}

html[data-theme="dark"] .app-shell.gk-saas .home-stat-n,
html[data-theme="dark"] .app-shell.gk-saas .home-stat-value,
html[data-theme="dark"] .app-shell.gk-saas .home-action-title,
html[data-theme="dark"] .app-shell.gk-saas .module-tile-title,
html[data-theme="dark"] .app-shell.gk-saas .home-section-title,
html[data-theme="dark"] .app-shell.gk-saas .content-title {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .app-shell.gk-saas .home-action-card,
html[data-theme="dark"] .app-shell.gk-saas .module-tile,
html[data-theme="dark"] .app-shell.gk-saas .agency-tile,
html[data-theme="dark"] .app-shell.gk-saas .admin-module-tile {
  background: #1e293b !important;
  border-color: rgba(148, 163, 184, 0.28) !important;
  color: #f1f5f9 !important;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2) !important;
}

html[data-theme="dark"] .app-shell.gk-saas .home-action-card:hover,
html[data-theme="dark"] .app-shell.gk-saas .module-tile:hover,
html[data-theme="dark"] .app-shell.gk-saas .agency-tile:hover,
html[data-theme="dark"] .app-shell.gk-saas .admin-module-tile:hover {
  background: #1e293b !important;
  border-color: color-mix(in srgb, var(--tile-accent) 45%, #64748b) !important;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.28) !important;
}

html[data-theme="dark"] .app-shell.gk-saas .home-action-icon-wrap,
html[data-theme="dark"] .app-shell.gk-saas .module-tile-icon {
  background: var(--tile-accent) !important;
  color: #fff !important;
  box-shadow: 0 4px 12px color-mix(in srgb, var(--tile-accent) 45%, transparent) !important;
}

html[data-theme="dark"] .app-shell.gk-saas [data-action="reports"] {
  background: #1e293b !important;
}

@media (prefers-reduced-motion: reduce) {
  .app-shell.gk-saas .content-topbar,
  .app-shell.gk-saas .page-body > *,
  .app-shell.gk-saas .home-page > *,
  .app-shell.gk-saas .agency-home-page > *,
  .app-shell.gk-saas .admin-module-page > *,
  .app-shell.gk-saas .finance-desk-page > * {
    opacity: 1;
    animation: none;
  }
  .app-shell.gk-saas .content-topbar-bg { animation: none; }
  .app-shell.gk-saas .home-action-card:hover,
  .app-shell.gk-saas .module-tile:hover,
  .app-shell.gk-saas .home-stat:hover {
    transform: none !important;
  }
}

@media (max-width: 720px) {
  .app-shell.gk-saas .content-topbar {
    margin: 0.55rem 0.55rem 0;
    padding: 0.8rem 0.85rem;
  }
  .app-shell.gk-saas .page-body {
    padding: 0.85rem 0.7rem 1.25rem;
  }
}
