/* Retenra v2 application shell.
   The collapsible desktop sidebar, the theme control, and the
   command palette. Below the sidebar breakpoint the sidebar is
   gone and the existing bottom navigation carries the app, so
   no page ever shows two competing navigation systems. */

.app-side {
  display: none;
}

@media (min-width: 1120px) {
  .app-side {
    display: flex;
    flex-direction: column;
    position: fixed;
    left: 0;
    top: 0;
    bottom: 0;
    width: 268px;
    z-index: 60;
    background: var(--grad-navy);
    color: #E7EEF5;
    padding: var(--space-5) var(--space-4);
    overflow-y: auto;
    overscroll-behavior: contain;
  }
  body.has-side {
    padding-left: 268px;
  }
  body.has-side.side-collapsed {
    padding-left: 78px;
  }
  body.side-collapsed .app-side {
    width: 78px;
    padding: var(--space-5) var(--space-3);
  }
  body.side-collapsed .app-side .side-label,
  body.side-collapsed .app-side .side-word {
    display: none;
  }
  .app-side .side-brand {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    color: #fff;
    font-weight: 800;
    font-size: var(--text-body-lg);
    text-decoration: none;
    padding: 0 var(--space-2) var(--space-4);
  }
  .app-side .side-group {
    margin-top: var(--space-5);
  }
  .app-side .side-cap {
    font-size: var(--text-caption);
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #8FA5BC;
    padding: 0 var(--space-3);
    margin: 0 0 var(--space-2);
  }
  .app-side a.side-link {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--tap-min);
    padding: var(--space-2) var(--space-3);
    border-radius: var(--radius-sm);
    color: #C9D6E4;
    text-decoration: none;
    font-size: var(--text-body);
    font-weight: 600;
  }
  .app-side a.side-link:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
  }
  .app-side a.side-link.active {
    background: rgba(45, 212, 191, 0.16);
    color: #fff;
    box-shadow: inset 3px 0 0 var(--teal-electric);
  }
  .app-side .side-dot {
    flex: none;
    width: 9px;
    height: 9px;
    border-radius: 50%;
    background: #54708C;
  }
  .app-side a.side-link.active .side-dot {
    background: var(--teal-electric);
  }
  .app-side .side-tools {
    margin-top: auto;
    padding-top: var(--space-5);
    display: grid;
    gap: var(--space-2);
  }
  .app-side .side-tool {
    display: flex;
    align-items: center;
    gap: var(--space-3);
    min-height: var(--tap-min);
    padding: var(--space-2) var(--space-3);
    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: var(--radius-sm);
    background: transparent;
    color: #C9D6E4;
    font: inherit;
    font-size: var(--text-body);
    font-weight: 600;
    cursor: pointer;
    text-align: left;
  }
  .app-side .side-tool:hover {
    background: rgba(255, 255, 255, 0.07);
    color: #fff;
  }
}

/* A slim search trigger in the header bar on smaller screens,
   where there is no sidebar. */
.palette-btn {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-pill);
  background: var(--surface);
  color: var(--muted);
  font: inherit;
  font-size: var(--text-small);
  font-weight: 600;
  cursor: pointer;
}
@media (min-width: 1120px) {
  body.has-side .palette-btn {
    display: none;
  }
}

/* Command palette */
.palette-veil {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: rgba(11, 20, 38, 0.55);
  display: grid;
  place-items: start center;
  padding: 10vh var(--space-4) var(--space-4);
}
.palette-veil[hidden] {
  display: none;
}
.palette-box {
  width: min(620px, 100%);
  background: var(--surface);
  color: var(--ink);
  border-radius: var(--radius-lg);
  box-shadow: var(--elev-4);
  overflow: hidden;
}
.palette-input {
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: var(--text-body-lg);
  padding: var(--space-4) var(--space-5);
  outline: none;
}
.palette-list {
  max-height: 46vh;
  overflow-y: auto;
  padding: var(--space-2);
}
.palette-item {
  display: flex;
  align-items: baseline;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--ink);
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.palette-item .p-kind {
  flex: none;
  font-size: var(--text-caption);
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--blue);
  min-width: 74px;
}
.palette-item .p-sub {
  color: var(--muted);
  font-size: var(--text-small);
}
.palette-item.sel {
  background: var(--blue-soft);
}
.palette-empty {
  padding: var(--space-4) var(--space-5);
  color: var(--muted);
}
.palette-hint {
  padding: var(--space-2) var(--space-5) var(--space-3);
  color: var(--faint);
  font-size: var(--text-caption);
}

/* Onboarding card */
.onboard-card {
  border: 1px solid var(--line);
  border-left: 6px solid var(--blue);
}
.onboard-grid {
  display: grid;
  gap: var(--space-4);
}
@media (min-width: 720px) {
  .onboard-grid {
    grid-template-columns: 1fr 1fr 1fr;
  }
}
.onboard-grid .field label {
  display: block;
  font-weight: 700;
  margin-bottom: var(--space-2);
}
.onboard-grid .field input,
.onboard-grid .field select {
  width: 100%;
  min-height: 48px;
  font: inherit;
  padding: 0 var(--space-3);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
}

.lib-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  padding: var(--space-3) var(--space-2);
  border-bottom: 1px solid var(--line);
  color: var(--ink);
  text-decoration: none;
  font-weight: 600;
}
.lib-row:hover { color: var(--blue); }
.lib-row:last-child { border-bottom: 0; }
