:root {
  --shell-bg: #090a0c;
  --shell-surface: #121417;
  --shell-raised: #191b1f;
  --shell-border: rgba(255,255,255,.09);
  --shell-muted: #969ba4;
  --shell-accent: #aa74d4;
  --shell-header-height: 62px;
  --shell-nav-width: 232px;
}

html { background: var(--shell-bg); }
body {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: var(--shell-nav-width) minmax(0, 1fr);
  grid-template-rows: var(--shell-header-height) minmax(0, 1fr);
  grid-template-areas: "header header" "nav content";
  background: linear-gradient(180deg, #0d0f12 0, var(--shell-bg) 36%);
  background-attachment: fixed;
  overflow-x: clip;
}

body > .app-header {
  grid-area: header;
  min-height: var(--shell-header-height);
  padding: max(9px, env(safe-area-inset-top)) 18px 9px;
  background: rgba(11,12,15,.88);
  border-bottom: 1px solid var(--shell-border);
  backdrop-filter: saturate(135%) blur(20px);
  -webkit-backdrop-filter: saturate(135%) blur(20px);
  box-shadow: none;
}
.app-header .brand { gap: 9px; }
.app-header .brand img { width: 33px; height: 33px; }
.app-header .brand span { font-size: 1.02rem; letter-spacing: -.03em; }
.app-header .brand span b { color: #bb89df; }
.app-current-view {
  margin-left: 18px;
  padding-left: 18px;
  border-left: 1px solid var(--shell-border);
  color: #b8bcc4;
  font-size: .8rem;
  font-weight: 600;
}
.app-account-summary {
  max-width: 190px;
  overflow: hidden;
  color: #a7abb3;
  font-size: .72rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.app-header .btn {
  min-height: 34px;
  padding: 7px 12px;
  border-radius: 9px;
  background: rgba(255,255,255,.035);
  border-color: var(--shell-border);
  box-shadow: none;
  font-family: Inter, sans-serif;
  font-size: .75rem;
}
.app-header .btn:hover { transform: none; background: rgba(255,255,255,.075); }
.app-header .btn-accent {
  color: #f0e8f5;
  background: rgba(170,116,212,.13);
  border: 1px solid rgba(187,137,223,.34);
}
.app-nav-toggle { display: none; }

body > .tabs-bar {
  grid-area: nav;
  position: sticky;
  top: var(--shell-header-height);
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  height: calc(100dvh - var(--shell-header-height));
  margin: 0;
  padding: 20px 12px max(20px, env(safe-area-inset-bottom));
  overflow: auto;
  white-space: normal;
  border: 0;
  border-right: 1px solid var(--shell-border);
  border-radius: 0;
  background: rgba(13,14,17,.75);
}
.app-nav-heading {
  padding: 0 10px;
  color: #e7e9ec;
  font-family: Outfit, sans-serif;
  font-size: .9rem;
  font-weight: 700;
}
.app-nav-group { display: flex; flex-direction: column; gap: 3px; }
.app-nav-group:not(:has(.tab-btn:not([style*="display:none"]))) { display: none; }
.app-nav-label {
  padding: 0 10px 5px;
  color: #9297a0;
  font-size: .62rem;
  font-weight: 750;
  letter-spacing: .1em;
  text-transform: uppercase;
}
body > .tabs-bar .tab-btn {
  justify-content: flex-start;
  width: 100%;
  min-height: 38px;
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 9px;
  color: #969ba4;
  font-family: Inter, sans-serif;
  font-size: .77rem;
  font-weight: 570;
}
body > .tabs-bar .tab-btn > span {
  width: 18px;
  color: #777c85;
  font-size: .86rem;
  text-align: center;
}
body > .tabs-bar .tab-btn:hover {
  color: #e4e6e9;
  background: rgba(255,255,255,.035);
}
body > .tabs-bar .tab-btn.active {
  color: #f2edf5;
  background: rgba(170,116,212,.12);
  border-color: rgba(187,137,223,.25);
}
body > .tabs-bar .tab-btn.active > span { color: #c590e4; }
.app-nav-scrim { display: none; }

body > main {
  grid-area: content;
  width: 100%;
  max-width: none;
  min-width: 0;
  margin: 0;
  padding: 22px clamp(16px, 2.5vw, 38px) 72px;
}
body > main > .active-staff-info {
  min-height: 38px;
  margin: 0 0 16px;
  padding: 8px 12px;
  background: rgba(255,255,255,.025);
  border: 1px solid var(--shell-border);
  border-radius: 10px;
}
body > main > .active-staff-info .btn { display: none; }

body > main > .view-pane > .card,
body > main > .view-pane .card {
  border-color: var(--shell-border);
  border-radius: 14px;
  background: rgba(20,22,25,.92);
  box-shadow: 0 18px 55px rgba(0,0,0,.16);
}
body > main > .view-pane > .card:hover,
body > main > .view-pane .card:hover { transform: none; }
body > main > .view-pane h2 { letter-spacing: -.02em; }

#pane-catalog > .card { padding: clamp(16px, 2.2vw, 28px); }
#pane-catalog #smartSearchBox {
  border-color: rgba(255,255,255,.11);
  background: rgba(255,255,255,.035);
  border-radius: 11px;
}
#pane-catalog .category-tabs {
    flex-wrap: nowrap;
    align-items: center;
    gap: 7px;
    margin-bottom: 16px;
    padding-bottom: 10px;
    overflow-x: auto;
    scrollbar-width: none;
}
#pane-catalog .category-tabs::-webkit-scrollbar { display: none; }
#pane-catalog .category-tabs .tab-btn {
  flex: 0 0 auto;
  width: auto !important;
  min-height: 32px;
  height: auto !important;
  padding: 6px 10px !important;
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 5px;
  white-space: nowrap !important;
  color: #9fa4ac;
  background: rgba(255,255,255,.025);
  border: 1px solid rgba(255,255,255,.08);
  border-radius: 9px;
  font-size: .7rem !important;
  line-height: 1.2;
}
#pane-catalog .category-tabs .tab-btn.active {
  color: #f1edf4;
  background: rgba(170,116,212,.12);
  border-color: rgba(187,137,223,.32);
  box-shadow: none;
}

#pane-crear-diseno iframe,
#pane-crear-diseno .embedded-design-frame {
  min-height: min(820px, calc(100dvh - 120px));
  height: calc(100dvh - 120px) !important;
}

@media (max-width: 820px) {
  :root { --shell-header-height: 58px; }
  body {
    display: block;
    min-height: 100dvh;
    padding: 0;
  }
  body > .app-header {
    position: sticky;
    top: 0;
    min-height: var(--shell-header-height);
    padding: max(8px, env(safe-area-inset-top)) 11px 8px;
  }
  .app-nav-toggle {
    width: 34px;
    height: 34px;
    flex: 0 0 34px;
    display: grid;
    place-content: center;
    gap: 4px;
    padding: 0;
    color: #fff;
    background: rgba(255,255,255,.04);
    border: 1px solid var(--shell-border);
    border-radius: 9px;
  }
  .app-nav-toggle span { width: 15px; height: 1.5px; background: #b8bcc4; border-radius: 2px; }
  .app-header .brand span { display: none; }
  .app-current-view {
    flex: 1;
    margin-left: 8px;
    padding-left: 10px;
    font-size: .78rem;
  }
  .app-account-summary, #installBtn { display: none !important; }
  .app-header .header-actions { gap: 6px; }
  .app-header #loginBtn, .app-header #logoutBtn {
    min-width: 34px;
    width: 34px;
    padding: 0;
    overflow: hidden;
    color: transparent;
    white-space: nowrap;
  }
  .app-header #loginBtn::before { content: "◎"; color: #d7d9dd; font-size: 1rem; }
  .app-header #logoutBtn::before { content: "↪"; color: #d7d9dd; font-size: 1rem; }
  body > .tabs-bar {
    position: fixed;
    z-index: 1200;
    top: 0;
    left: 0;
    width: min(82vw, 286px);
    height: 100dvh;
    padding: max(22px, env(safe-area-inset-top)) 12px max(22px, env(safe-area-inset-bottom));
    border-right: 1px solid rgba(255,255,255,.12);
    background: rgba(13,14,17,.985);
    transform: translateX(-104%);
    visibility: hidden;
    transition: transform .22s ease, visibility 0s linear .22s;
    box-shadow: 24px 0 70px rgba(0,0,0,.42);
  }
  body.app-nav-open > .tabs-bar {
    visibility: visible;
    transform: translateX(0);
    transition-delay: 0s;
  }
  .app-nav-scrim {
    position: fixed;
    inset: 0;
    z-index: 1190;
    display: block;
    visibility: hidden;
    opacity: 0;
    border: 0;
    background: rgba(0,0,0,.62);
    transition: opacity .22s ease, visibility .22s ease;
  }
  body.app-nav-open > .app-nav-scrim { visibility: visible; opacity: 1; }
  body > main {
    width: 100%;
    padding: 14px 11px max(70px, env(safe-area-inset-bottom));
  }
  body > main > .active-staff-info { margin-bottom: 10px; }
  #pane-crear-diseno iframe,
  #pane-crear-diseno .embedded-design-frame {
    min-height: calc(100dvh - 82px);
    height: calc(100dvh - 82px) !important;
  }
}

@media (max-width: 520px) {
  body > main > .view-pane > .card { padding: 14px; border-radius: 12px; }
  #pane-catalog #appCatalogGrid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  #pane-catalog .card { min-width: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}
