:root {
  color-scheme: dark;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: #07162f;
  color: #edf7ff;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(135deg, rgba(11, 46, 103, 0.96), rgba(6, 20, 44, 0.98) 58%, rgba(11, 78, 132, 0.86));
}

button, input { font: inherit; }

.app-shell {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto 1fr;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 10;
  height: 64px;
  padding: 0 18px;
  display: grid;
  grid-template-columns: 44px 1fr auto;
  align-items: center;
  gap: 14px;
  background: rgba(6, 26, 58, 0.76);
  border-bottom: 1px solid rgba(137, 205, 255, 0.2);
  backdrop-filter: blur(18px);
}

.menu-button, .drawer-close {
  width: 40px;
  height: 40px;
  border: 1px solid rgba(164, 218, 255, 0.26);
  border-radius: 8px;
  background: rgba(11, 62, 122, 0.46);
  color: #edf7ff;
  cursor: pointer;
}

.menu-button { display: grid; place-content: center; gap: 5px; }
.menu-button span {
  display: block;
  width: 18px;
  height: 2px;
  border-radius: 999px;
  background: #d9f2ff;
}

.brand-mark, .drawer-brand {
  font-weight: 750;
  letter-spacing: 0;
  font-size: 1.15rem;
}

.status-pill {
  border: 1px solid rgba(85, 223, 255, 0.28);
  color: #bdefff;
  background: rgba(2, 86, 135, 0.3);
  border-radius: 999px;
  padding: 8px 12px;
  font-size: 0.85rem;
}

.drawer-backdrop {
  position: fixed;
  inset: 0;
  z-index: 18;
  background: rgba(2, 10, 25, 0.46);
  backdrop-filter: blur(4px);
}

.nav-drawer {
  position: fixed;
  inset: 0 auto 0 0;
  z-index: 20;
  width: min(344px, calc(100vw - 28px));
  transform: translateX(-105%);
  visibility: hidden;
  transition: transform 180ms ease, visibility 0s linear 180ms;
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 20px;
  padding: 18px;
  background:
    linear-gradient(155deg, rgba(9, 74, 148, 0.92), rgba(7, 28, 68, 0.92) 48%, rgba(4, 79, 131, 0.82));
  border-right: 1px solid rgba(184, 229, 255, 0.24);
  box-shadow: 28px 0 70px rgba(0, 10, 30, 0.45);
  backdrop-filter: blur(22px);
}

.nav-drawer.open {
  transform: translateX(0);
  visibility: visible;
  transition: transform 180ms ease;
}

.drawer-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.primary-nav-action, .nav-item, .action, .choice {
  border: 1px solid rgba(172, 224, 255, 0.2);
  color: #eef9ff;
  background: rgba(18, 87, 154, 0.34);
  border-radius: 8px;
  padding: 11px 12px;
  cursor: pointer;
}

.primary-nav-action {
  text-align: left;
  background: rgba(50, 184, 255, 0.18);
}

.drawer-nav {
  display: grid;
  align-content: start;
  gap: 8px;
}

.nav-item {
  width: 100%;
  text-align: left;
  background: transparent;
}

.nav-item:hover, .nav-item.active, .action:hover, .choice:hover {
  background: rgba(90, 190, 255, 0.2);
  border-color: rgba(180, 231, 255, 0.42);
}

.drawer-foot {
  color: #c8eaff;
  border-top: 1px solid rgba(172, 224, 255, 0.18);
  padding-top: 16px;
  font-size: 0.9rem;
}

.workspace {
  min-height: calc(100vh - 64px);
  outline: none;
}

.page-view {
  display: none;
  min-height: calc(100vh - 64px);
}

.page-view.active { display: block; }

#ai-page {
  position: relative;
  padding: 28px clamp(16px, 4vw, 56px) 110px;
}

.messages {
  width: min(920px, 100%);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.message {
  display: grid;
  gap: 12px;
}

.message.user { justify-items: end; }
.message.assistant { justify-items: start; }

.bubble {
  max-width: min(720px, 100%);
  padding: 14px 16px;
  border-radius: 12px;
  line-height: 1.5;
  color: #effaff;
  background: rgba(10, 50, 101, 0.58);
  border: 1px solid rgba(170, 225, 255, 0.17);
}

.message.user .bubble {
  background: rgba(31, 128, 205, 0.62);
  border-color: rgba(194, 238, 255, 0.24);
}

.artifact, .glass-card {
  width: min(720px, 100%);
  padding: 16px;
  border-radius: 8px;
  background: rgba(10, 53, 108, 0.48);
  border: 1px solid rgba(179, 229, 255, 0.18);
  box-shadow: 0 18px 44px rgba(0, 12, 35, 0.23);
  backdrop-filter: blur(18px);
}

.artifact h3, #secondary-page h1 {
  margin: 0 0 12px;
  font-size: 1rem;
  letter-spacing: 0;
}

.artifact p { color: #c8e7fa; line-height: 1.5; }

.data-list, .page-list {
  display: grid;
  gap: 10px;
}

.data-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: baseline;
  padding: 10px 0;
  border-bottom: 1px solid rgba(170, 225, 255, 0.12);
}

.data-row span, .data-row em {
  color: #b9daf1;
  min-width: 0;
}

.data-row strong {
  text-align: right;
  font-weight: 700;
}

.data-row em {
  grid-column: 1 / -1;
  font-style: normal;
  font-size: 0.84rem;
}

.actions, .choice-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.action.consent {
  background: rgba(50, 184, 255, 0.24);
  border-color: rgba(119, 220, 255, 0.44);
}

.action.execute { display: none; }

.composer {
  position: fixed;
  left: 50%;
  bottom: max(16px, env(safe-area-inset-bottom));
  transform: translateX(-50%);
  width: min(920px, calc(100vw - 28px));
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: 12px;
  background: rgba(6, 37, 83, 0.78);
  border: 1px solid rgba(185, 231, 255, 0.2);
  box-shadow: 0 18px 54px rgba(0, 12, 35, 0.38);
  backdrop-filter: blur(20px);
}

.composer input {
  min-width: 0;
  border: 0;
  outline: none;
  color: #f1fbff;
  background: transparent;
  padding: 12px;
}

.composer input::placeholder { color: #a9d5ee; }
.composer button {
  border: 0;
  border-radius: 8px;
  background: #61d2ff;
  color: #042340;
  font-weight: 800;
  padding: 0 16px;
  cursor: pointer;
}

#secondary-page {
  width: min(980px, 100%);
  margin: 0 auto;
  padding: 32px clamp(16px, 4vw, 56px);
}

@media (max-width: 680px) {
  .app-header {
    height: 58px;
    padding: 0 12px;
    grid-template-columns: 42px 1fr auto;
  }
  .status-pill { padding: 7px 10px; font-size: 0.78rem; }
  #ai-page { padding: 18px 12px 104px; }
  .bubble, .artifact, .glass-card { width: 100%; }
  .data-row { grid-template-columns: 1fr; }
  .data-row strong { text-align: left; }
  .composer { width: calc(100vw - 18px); }
}
