/* LAI shell: navigation, global controls, and view spacing.
   Component styles remain in app.css; this file owns the page layout. */

:root {
  --bg: #0e1118;
  --panel: #171b25;
  --panel-2: #222735;
  --line: #303747;
  --text: #f0f2f7;
  --muted: #a2aabd;
  --accent: #9384ff;
  --accent-2: #ae8aff;
  --accent-soft: #9384ff26;
  --user-bubble: #242638;
  --shadow: 0 18px 48px #0007;
  --shadow-sm: 0 5px 18px #0004;
}

@media (prefers-color-scheme: light) {
  :root:not([data-theme="dark"]) {
    --bg: #f5f6f9;
    --panel: #fff;
    --panel-2: #eff1f6;
    --line: #dfe3ec;
    --text: #202432;
    --muted: #636c7d;
    --accent: #6759db;
    --accent-2: #8a64dc;
    --accent-soft: #6759db16;
    --user-bubble: #ebebfb;
    --shadow: 0 18px 48px #26315320;
    --shadow-sm: 0 5px 18px #26315314;
  }
}

:root[data-theme="light"] {
  --bg: #f5f6f9;
  --panel: #fff;
  --panel-2: #eff1f6;
  --line: #dfe3ec;
  --text: #202432;
  --muted: #636c7d;
  --accent: #6759db;
  --accent-2: #8a64dc;
  --accent-soft: #6759db16;
  --user-bubble: #ebebfb;
  --shadow: 0 18px 48px #26315320;
  --shadow-sm: 0 5px 18px #26315314;
}

/* Color choices apply across both day and night surfaces. */
:root[data-accent="ocean"] { --accent: #71b8ff; --accent-2: #7bd5ef; --accent-ink: #101824; --accent-soft: #71b8ff26; --user-bubble: #1c2b3e; }
:root[data-accent="forest"] { --accent: #64d8aa; --accent-2: #a0e2a5; --accent-ink: #102017; --accent-soft: #64d8aa25; --user-bubble: #1d302c; }
:root[data-accent="coral"] { --accent: #ffa0a4; --accent-2: #ffc18a; --accent-ink: #241418; --accent-soft: #ffa0a426; --user-bubble: #352731; }
:root[data-accent="amber"] { --accent: #f1bf69; --accent-2: #ffd890; --accent-ink: #271b0c; --accent-soft: #f1bf6926; --user-bubble: #342d24; }

:root[data-theme="light"][data-accent="ocean"] { --accent: #1768ac; --accent-2: #0087ab; --accent-ink: #fff; --accent-soft: #1768ac17; --user-bubble: #e5f1fb; }
:root[data-theme="light"][data-accent="forest"] { --accent: #13745b; --accent-2: #4c8a4d; --accent-ink: #fff; --accent-soft: #13745b17; --user-bubble: #e5f3ec; }
:root[data-theme="light"][data-accent="coral"] { --accent: #ad4255; --accent-2: #bc6643; --accent-ink: #fff; --accent-soft: #ad425517; --user-bubble: #faebed; }
:root[data-theme="light"][data-accent="amber"] { --accent: #925500; --accent-2: #af7618; --accent-ink: #fff; --accent-soft: #92550017; --user-bubble: #f8efde; }

@media (prefers-color-scheme: light) {
  :root:not([data-theme])[data-accent="ocean"] { --accent: #1768ac; --accent-2: #0087ab; --accent-ink: #fff; --accent-soft: #1768ac17; --user-bubble: #e5f1fb; }
  :root:not([data-theme])[data-accent="forest"] { --accent: #13745b; --accent-2: #4c8a4d; --accent-ink: #fff; --accent-soft: #13745b17; --user-bubble: #e5f3ec; }
  :root:not([data-theme])[data-accent="coral"] { --accent: #ad4255; --accent-2: #bc6643; --accent-ink: #fff; --accent-soft: #ad425517; --user-bubble: #faebed; }
  :root:not([data-theme])[data-accent="amber"] { --accent: #925500; --accent-2: #af7618; --accent-ink: #fff; --accent-soft: #92550017; --user-bubble: #f8efde; }
}

body {
  grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
  min-height: 100dvh;
  padding: 22px 14px 14px;
  background: var(--panel);
}

.sidebar .brand {
  padding: 0 10px 24px;
}

.sidebar .brand strong {
  font-size: 18px;
  letter-spacing: -.035em;
}

.sidebar .brand small {
  font-size: 10px;
  letter-spacing: .02em;
}

.new-chat-row {
  margin-bottom: 17px;
}

.new-chat {
  min-height: 44px;
  font-size: 13px;
  box-shadow: none;
}

.primary-nav {
  gap: 3px;
  margin: 0 0 16px;
}

.primary-nav .nav-item {
  min-height: 39px;
  padding: 8px 12px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 560;
}

.primary-nav .nav-item.active {
  background: var(--accent-soft);
  color: var(--accent);
}

.search-box {
  border-top: 1px solid var(--line);
  padding-top: 16px;
  margin: 0 3px 0;
}

.search-box svg.i {
  top: calc(50% + 8px);
}

.search-box input {
  min-height: 39px;
  background: var(--bg);
  border: 1px solid var(--line);
}

.sidebar-history-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 18px 11px 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 650;
  letter-spacing: .055em;
  text-transform: uppercase;
}

.sidebar-history-head .history-label {
  margin: 0;
  font-weight: 500;
  letter-spacing: 0;
  text-transform: none;
}

.history-group {
  margin-top: 14px;
  opacity: .8;
}

.history-row {
  border-radius: 9px;
}

.history-item {
  padding: 8px 10px;
}

.sidebar-footer {
  padding-top: 12px;
  margin-top: 14px;
}

.user-button {
  min-height: 48px;
}

main {
  min-height: 100dvh;
  background: var(--bg);
}

header.app-header {
  height: auto;
  padding: 0;
  display: block;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 #00000008;
}

.header-main {
  min-height: 72px;
  padding: 10px 28px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.header-title {
  flex: 1 1 auto;
}

.header-title h1 {
  font-size: 19px;
  line-height: 1.25;
  letter-spacing: -.035em;
  font-weight: 660;
}

.header-title small {
  font-size: 11px;
  margin-top: 3px;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.header-actions .active-model:not([hidden]) {
  display: block;
  max-width: 168px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  background: var(--bg);
  border-radius: 10px;
  font-weight: 590;
}

.header-actions .active-model::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 7px;
  border-radius: 50%;
  background: var(--ok);
  vertical-align: 1px;
}

.header-actions .active-model.none::before { background: var(--muted); }

.gpu-quick {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 38px;
  padding: 0 11px;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--text);
  cursor: pointer;
  white-space: nowrap;
  font-size: 12px;
}

.gpu-quick:hover, .gpu-quick.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.gpu-quick-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--ok);
  box-shadow: 0 0 0 3px var(--ok-soft);
}

.gpu-quick.unavailable .gpu-quick-dot {
  background: var(--muted);
  box-shadow: none;
}

.gpu-quick-label {
  color: var(--muted);
  font-weight: 600;
}

.gpu-quick strong {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.gpu-quick small {
  padding-left: 7px;
  border-left: 1px solid var(--line);
  color: var(--muted);
  font-size: 11px;
  font-variant-numeric: tabular-nums;
}

.theme-quick {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
}

.theme-quick .theme-option {
  flex: none;
  min-height: 30px;
  padding: 4px 8px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  white-space: nowrap;
}

.theme-quick .theme-option.active {
  background: var(--panel-2);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.color-options {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.color-option {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 37px;
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  cursor: pointer;
  font: inherit;
  font-size: 12px;
}

.color-option:hover, .color-option.active {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.color-option:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.color-swatch {
  width: 15px;
  height: 15px;
  flex: none;
  border-radius: 50%;
  background: var(--swatch);
  box-shadow: inset 0 0 0 1px #0002;
}

.color-option[data-theme-color="violet"] { --swatch: #8371e8; }
.color-option[data-theme-color="ocean"] { --swatch: #367fc6; }
.color-option[data-theme-color="forest"] { --swatch: #238d6c; }
.color-option[data-theme-color="coral"] { --swatch: #d96877; }
.color-option[data-theme-color="amber"] { --swatch: #c98621; }

.header-nav-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 38px;
  padding: 0 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg);
  color: var(--muted);
  cursor: pointer;
  font-size: 12px;
  font-weight: 620;
}

.header-nav-button:hover, .header-nav-button.active {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.header-nav-button svg.i {
  width: 16px;
  height: 16px;
}

.context-toolbar {
  min-height: 48px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 28px;
  border-top: 1px solid var(--line);
  background: var(--panel);
}

.context-toolbar-label {
  margin-right: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  font-size: 12px;
}

.context-toolbar-label svg.i {
  width: 15px;
  height: 15px;
}

.context-toolbar .chat-actions {
  gap: 8px;
}

.context-toolbar .ghost-button {
  min-height: 34px;
  padding: 6px 10px;
  background: var(--bg);
  font-size: 12px;
}

.context-toolbar .telemetry-toggle:not([hidden]) {
  display: inline-flex;
}

.context-toolbar #chat-menu-button {
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 9px;
}

.header-status .music-runtime {
  white-space: nowrap;
}

.chat {
  padding-top: 40px;
  padding-bottom: 28px;
}

.composer {
  padding-top: 12px;
}

.composer-box {
  border-radius: 16px;
  box-shadow: var(--shadow-sm);
}

.skills-view, .agents-view, .admin-view, .automations-view {
  width: 100%;
  max-width: 1230px;
  margin-inline: auto;
  padding: 34px 36px;
}

.skills-toolbar {
  margin-bottom: 26px;
}

.skills-toolbar h2 {
  font-size: 24px;
  letter-spacing: -.035em;
}

.skill-card, .agent-card, .automation-card {
  border-radius: 14px;
  box-shadow: 0 1px 1px #00000008;
}

@media (max-width: 1250px) {
  .header-main {
    flex-wrap: wrap;
    row-gap: 8px;
    padding: 12px 22px;
  }

  .header-title {
    flex: 1 1 200px;
  }

  .header-actions {
    width: 100%;
    justify-content: flex-end;
  }

  .context-toolbar {
    padding-inline: 22px;
  }
}

@media (min-width: 721px) and (max-width: 1100px) {
  .header-actions .active-model:not([hidden]) { max-width: 125px; }
  .gpu-quick small, .theme-quick .theme-option span, .header-nav-button span { display: none; }
  .theme-quick .theme-option { padding-inline: 7px; font-size: 13px; }
  .header-nav-button { padding-inline: 9px; }
}

@media (max-width: 720px) {
  body { grid-template-columns: minmax(0, 1fr); }

  .sidebar { width: min(280px, 85vw); }

  .header-main {
    gap: 8px;
    padding: 10px 14px;
  }

  .header-main #menu { display: grid; }

  .header-title h1 { font-size: 17px; }

  .header-status { display: flex; }

  .hud {
    top: 154px;
    left: 12px;
    right: 12px;
    max-height: calc(100dvh - 166px);
    overflow: auto;
  }

  .header-actions {
    justify-content: space-between;
    gap: 5px;
  }

  .header-actions .active-model:not([hidden]) {
    display: block !important;
    max-width: 106px;
    min-width: 0;
    font-size: 11px;
    padding: 8px;
  }

  .gpu-quick {
    padding: 0 8px;
    gap: 5px;
  }

  .gpu-quick small { display: none; }

  .theme-quick .theme-option {
    padding-inline: 7px;
    font-size: 11px;
  }

  .theme-quick .theme-option[data-theme-mode="auto"] { display: none; }

  .header-nav-button { padding: 0 9px; }

  .header-nav-button span { display: none; }

  .context-toolbar {
    padding: 6px 14px;
  }

  .context-toolbar-label { display: none; }

  .context-toolbar .chat-actions { margin-right: auto; }

  .context-toolbar .ghost-button span { display: inline; }

  .skills-view, .agents-view, .admin-view, .automations-view {
    padding: 24px 16px;
  }
}

@media (max-width: 380px) {
  .header-actions .active-model:not([hidden]) { display: none !important; }
  .context-toolbar .ghost-button { padding-inline: 8px; }
}
