:root {
  color-scheme: dark;
  --bg: #101214;
  --panel: #181b1e;
  --panel-2: #202428;
  --line: #343a40;
  --text: #f4f0e8;
  --muted: #a8b0ad;
  --green: #53d18f;
  --amber: #efb64c;
  --red: #ef6c67;
  --blue: #6ea8fe;
  --ink: #070809;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  background:
    linear-gradient(180deg, rgba(110, 168, 254, 0.08), transparent 34rem),
    radial-gradient(circle at 12% 8%, rgba(83, 209, 143, 0.18), transparent 16rem),
    var(--bg);
}

button {
  font: inherit;
}

svg {
  display: block;
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.shell {
  width: min(100%, 460px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(1rem, env(safe-area-inset-top)) 1rem max(1rem, env(safe-area-inset-bottom));
}

.topbar,
.section_head,
.console_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.topbar {
  padding: 0.35rem 0 0.85rem;
}

.eyebrow,
.label {
  margin: 0;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin: 0;
}

h1 {
  margin-top: 0.08rem;
  font-size: 1.38rem;
  line-height: 1.05;
}

.brand_title_row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-width: 0;
}

.brand_logo {
  display: block;
  width: 2.35rem;
  height: 2.35rem;
  object-fit: contain;
  flex: 0 0 auto;
  border-radius: 7px;
}

h2 {
  margin-top: 0.15rem;
  font-size: 1.65rem;
  line-height: 1.05;
}

h3 {
  margin-top: 0.12rem;
  font-size: 1rem;
}

.icon_button,
.text_button,
.tab,
.segmented button,
.query_controls select,
.query_controls input,
.command_card button,
.project_card button,
.switch_control {
  border: 1px solid var(--line);
  color: var(--text);
  background: var(--panel-2);
  cursor: pointer;
}

.icon_button {
  display: grid;
  width: 2.65rem;
  height: 2.65rem;
  place-items: center;
  border-radius: 8px;
}

.text_button,
.command_card button,
.project_card button {
  min-height: 2.25rem;
  padding: 0 0.8rem;
  border-radius: 8px;
  font-weight: 800;
}

.hero_panel {
  position: relative;
  display: grid;
  grid-template-columns: 5.5rem 1fr;
  gap: 1rem;
  min-height: 8.4rem;
  padding: 1rem;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: linear-gradient(135deg, rgba(24, 27, 30, 0.96), rgba(32, 36, 40, 0.92));
}

.radar {
  position: relative;
  width: 5rem;
  height: 5rem;
  align-self: center;
  border: 1px solid rgba(83, 209, 143, 0.75);
  border-radius: 50%;
  background:
    linear-gradient(90deg, transparent 49%, rgba(83, 209, 143, 0.32) 50%, transparent 51%),
    linear-gradient(0deg, transparent 49%, rgba(83, 209, 143, 0.32) 50%, transparent 51%);
}

.radar span {
  position: absolute;
  inset: 16%;
  border: 1px solid rgba(83, 209, 143, 0.38);
  border-radius: 50%;
}

.radar span:nth-child(2) {
  inset: 31%;
}

.radar span:nth-child(3) {
  inset: 46%;
  background: var(--green);
}

.hero_copy {
  min-width: 0;
  align-self: center;
}

.hero_copy p:last-child {
  margin-top: 0.45rem;
  color: var(--muted);
  font-size: 0.88rem;
  line-height: 1.35;
}

.state_stack {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.pill,
.scope_badge {
  display: inline-flex;
  align-items: center;
  min-height: 1.7rem;
  padding: 0 0.58rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.pill.good {
  border-color: rgba(83, 209, 143, 0.45);
  color: var(--green);
}

.pill.warn {
  border-color: rgba(239, 182, 76, 0.55);
  color: var(--amber);
}

.pill.danger {
  border-color: rgba(239, 108, 103, 0.6);
  color: var(--red);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.65rem;
  margin: 0.8rem 0;
}

.metrics article,
.command_card,
.project_card,
.task_item,
.memory_item,
.review_item,
.console {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.metrics article {
  min-height: 4.55rem;
  padding: 0.72rem;
}

.metrics span {
  display: block;
  font-size: 1.18rem;
  font-weight: 900;
}

.metrics p {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.tabbar {
  position: sticky;
  top: 0.5rem;
  z-index: 4;
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(4.15rem, 1fr);
  gap: 0.25rem;
  padding: 0.25rem;
  margin: 0.85rem 0;
  overflow-x: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(16, 18, 20, 0.92);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
}

.tab {
  display: grid;
  min-width: 0;
  min-height: 3.15rem;
  place-items: center;
  gap: 0.15rem;
  padding: 0.35rem 0.1rem;
  border-radius: 6px;
  color: var(--muted);
  font-size: 0.68rem;
  font-weight: 900;
  touch-action: pan-x;
  user-select: none;
}

.tab.active {
  color: var(--ink);
  border-color: transparent;
  background: var(--green);
}

.tab.dragging {
  opacity: 0.58;
  outline: 2px solid rgba(83, 209, 143, 0.65);
  outline-offset: 2px;
}

.panel {
  display: none;
  padding-bottom: 1.5rem;
}

.panel.active {
  display: block;
}

.ai_dock {
  display: grid;
  gap: 0.65rem;
  margin: -0.15rem 0 0.85rem;
  padding: 0.75rem;
  border: 1px solid rgba(83, 209, 143, 0.45);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.96);
}

.ai_dock_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.ai_dock_form {
  display: grid;
  grid-template-columns: 1fr 2.65rem;
  gap: 0.45rem;
}

.ai_dock_form label {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.ai_dock_form input {
  min-width: 0;
  min-height: 2.65rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}

.ai_dock_form button {
  display: grid;
  min-width: 0;
  min-height: 2.65rem;
  place-items: center;
  border: 1px solid transparent;
  border-radius: 8px;
  color: var(--ink);
  background: var(--green);
  cursor: pointer;
}

.command_grid,
.ai_messages,
.plan_timeline,
.library_list,
.comm_channel_list,
.comm_token_list,
.project_list,
.query_results,
.task_list,
.memory_list,
.review_list {
  display: grid;
  gap: 0.65rem;
  margin-top: 0.75rem;
  max-height: min(24rem, 46vh);
  padding-right: 0.15rem;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.command_grid::-webkit-scrollbar,
.ai_messages::-webkit-scrollbar,
.plan_timeline::-webkit-scrollbar,
.library_list::-webkit-scrollbar,
.comm_channel_list::-webkit-scrollbar,
.comm_token_list::-webkit-scrollbar,
.project_list::-webkit-scrollbar,
.query_results::-webkit-scrollbar,
.task_list::-webkit-scrollbar,
.memory_list::-webkit-scrollbar,
.review_list::-webkit-scrollbar,
#auditLog::-webkit-scrollbar {
  width: 0.45rem;
}

.command_grid::-webkit-scrollbar-thumb,
.ai_messages::-webkit-scrollbar-thumb,
.plan_timeline::-webkit-scrollbar-thumb,
.library_list::-webkit-scrollbar-thumb,
.comm_channel_list::-webkit-scrollbar-thumb,
.comm_token_list::-webkit-scrollbar-thumb,
.project_list::-webkit-scrollbar-thumb,
.query_results::-webkit-scrollbar-thumb,
.task_list::-webkit-scrollbar-thumb,
.memory_list::-webkit-scrollbar-thumb,
.review_list::-webkit-scrollbar-thumb,
#auditLog::-webkit-scrollbar-thumb {
  border-radius: 999px;
  background: rgba(168, 176, 173, 0.34);
}

.command_card,
.ai_message,
.plan_item,
.library_item,
.comm_channel_item,
.comm_token_item,
.project_card,
.query_item,
.task_item,
.memory_item,
.review_item {
  padding: 0.85rem;
}

.command_card {
  display: grid;
  grid-template-columns: 2.4rem 1fr auto;
  align-items: center;
  gap: 0.75rem;
}

.glyph {
  display: grid;
  width: 2.4rem;
  height: 2.4rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--blue);
  background: #111417;
}

.command_card p,
.ai_message p,
.plan_item p,
.library_item p,
.comm_channel_item p,
.comm_token_item p,
.project_card p,
.query_item p,
.task_item p,
.memory_item p,
.review_item p {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.command_card h4,
.ai_message h4,
.plan_item h4,
.library_item h4,
.comm_channel_item h4,
.comm_token_item h4,
.project_card h4,
.query_item h4,
.task_item h4,
.memory_item h4,
.review_item h4 {
  margin: 0 0 0.2rem;
  font-size: 0.94rem;
}

.console {
  margin-top: 0.85rem;
  overflow: hidden;
}

.ai_surface {
  display: grid;
  gap: 0.75rem;
  margin-top: 0.75rem;
}

.ai_messages {
  margin-top: 0;
}

.ai_message {
  display: grid;
  gap: 0.35rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.ai_message.user {
  border-color: rgba(110, 168, 254, 0.55);
}

.ai_message.assistant {
  border-color: rgba(83, 209, 143, 0.46);
}

.ai_message h4 {
  color: var(--text);
}

.ai_message ul {
  display: grid;
  gap: 0.35rem;
  margin: 0;
  padding-left: 1.1rem;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.ai_quick_actions {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
}

.ai_quick_actions button,
.ai_composer button {
  min-height: 2.35rem;
  padding: 0 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font-weight: 900;
  cursor: pointer;
  white-space: nowrap;
}

.ai_composer {
  display: grid;
  gap: 0.45rem;
}

.ai_composer label,
.ai_note {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.ai_composer textarea {
  width: 100%;
  min-height: 5.5rem;
  resize: vertical;
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel-2);
  font: inherit;
}

.ai_composer button {
  justify-self: end;
  min-width: 5.25rem;
  color: var(--ink);
  border-color: transparent;
  background: var(--green);
}

.plan_overview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.plan_overview article {
  min-height: 4rem;
  padding: 0.72rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.plan_overview span {
  display: block;
  font-size: 1.1rem;
  font-weight: 900;
}

.plan_overview p {
  margin-top: 0.2rem;
  color: var(--muted);
  font-size: 0.75rem;
}

.plan_item {
  display: grid;
  grid-template-columns: 2.25rem 1fr;
  gap: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.plan_item.done {
  border-color: rgba(83, 209, 143, 0.42);
}

.plan_item.active {
  border-color: rgba(239, 182, 76, 0.55);
}

.plan_marker {
  position: relative;
  display: grid;
  justify-items: center;
}

.plan_marker::after {
  content: "";
  width: 1px;
  min-height: 100%;
  background: var(--line);
}

.plan_marker span {
  display: grid;
  width: 2rem;
  height: 2rem;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 50%;
  color: var(--ink);
  background: var(--green);
  font-size: 0.78rem;
  font-weight: 900;
}

.plan_item_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.25rem;
}

.library_item {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.comm_channel_list,
.comm_token_list {
  max-height: min(17rem, 34vh);
}

.comm_channel_item,
.comm_token_item,
.voice_surface {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.comm_channel_item {
  border-color: rgba(110, 168, 254, 0.36);
}

.comm_token_item {
  border-color: rgba(83, 209, 143, 0.36);
}

.comm_item_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.comm_stakeholders {
  color: var(--text);
  font-weight: 800;
}

.voice_surface {
  margin-top: 0.75rem;
  max-height: min(25rem, 48vh);
  overflow-y: auto;
  padding: 0.85rem;
  overscroll-behavior: contain;
}

.voice_button {
  display: grid;
  grid-template-columns: 1.25rem 1fr;
  align-items: center;
  justify-content: center;
  gap: 0.55rem;
  min-height: 3.2rem;
  padding: 0 1rem;
  border: 1px solid rgba(83, 209, 143, 0.55);
  border-radius: 8px;
  color: var(--ink);
  background: var(--green);
  font-weight: 900;
  cursor: pointer;
}

.voice_button:disabled {
  color: var(--muted);
  border-color: var(--line);
  background: var(--panel-2);
  cursor: not-allowed;
}

.voice_button.listening {
  border-color: rgba(239, 182, 76, 0.85);
  background: var(--amber);
}

.voice_status,
.voice_transcript {
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1.35;
}

.voice_transcript {
  padding: 0.75rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-2);
}

.voice_transcript p:last-child {
  margin-top: 0.3rem;
  color: var(--text);
  font-weight: 800;
}

.library_item_head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
}

.library_item a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.console_head {
  padding: 0.65rem 0.75rem;
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  text-transform: uppercase;
}

#auditLog {
  display: grid;
  gap: 0.4rem;
  max-height: 13rem;
  margin: 0;
  padding: 0.8rem 0.8rem 0.9rem 1.85rem;
  overflow: auto;
  color: #d8dfdc;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.74rem;
  line-height: 1.35;
}

.project_card {
  display: grid;
  gap: 0.75rem;
}

.project_card.active_project {
  border-color: rgba(83, 209, 143, 0.72);
}

.project_meta,
.task_meta,
.review_meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.segmented {
  display: flex;
  padding: 0.18rem;
  border: 1px solid var(--line);
  border-radius: 8px;
}

.segmented button {
  min-width: 3rem;
  min-height: 1.9rem;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  background: transparent;
  font-size: 0.78rem;
  font-weight: 900;
}

.segmented button.active {
  color: var(--ink);
  background: var(--amber);
}

.switch_control {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  min-height: 2.15rem;
  padding: 0 0.65rem;
  border-radius: 8px;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 900;
}

.switch_control input {
  width: 1rem;
  height: 1rem;
  accent-color: var(--amber);
}

.query_controls {
  display: grid;
  grid-template-columns: 7.5rem 1fr;
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.query_controls label {
  display: grid;
  gap: 0.35rem;
  min-width: 0;
}

.query_controls span,
.query_summary {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
  text-transform: uppercase;
}

.query_controls select,
.query_controls input {
  width: 100%;
  min-height: 2.55rem;
  padding: 0 0.7rem;
  border-radius: 8px;
  font: inherit;
}

.query_summary {
  margin-top: 0.75rem;
}

.query_item {
  display: grid;
  gap: 0.55rem;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(24, 27, 30, 0.94);
}

.query_item a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
  overflow-wrap: anywhere;
}

.blocked_path {
  color: var(--muted);
  font-weight: 800;
  overflow-wrap: anywhere;
}

.query_meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}

.task_item {
  display: grid;
  gap: 0.55rem;
}

.memory_item a {
  color: var(--blue);
  font-weight: 800;
  text-decoration: none;
}

@media (min-width: 760px) {
  .shell {
    width: min(100%, 980px);
  }

  .hero_panel {
    grid-template-columns: 6.25rem 1fr auto;
  }

  .state_stack {
    grid-column: auto;
    align-self: center;
    justify-content: flex-end;
  }

  .command_grid,
  .project_list,
  .query_results,
  .library_list,
  .comm_channel_list,
  .comm_token_list,
  .task_list,
  .memory_list,
  .review_list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    max-height: min(30rem, 52vh);
  }

  .console {
    grid-column: 1 / -1;
  }
}
