:root {
  --bg: #f7f7f4;
  --panel: #ffffff;
  --panel-soft: #fbfaf7;
  --text: #111111;
  --muted: #646464;
  --line: #dedbd2;
  --accent: #f6821f;
  --accent-dark: #b85d12;
  --shadow: 0 12px 30px rgba(17, 17, 17, 0.08);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

button,
input,
textarea {
  font: inherit;
}

button {
  border: 1px solid #111111;
  border-radius: 6px;
  background: #111111;
  color: #ffffff;
  padding: 0.7rem 0.9rem;
  cursor: pointer;
  font-weight: 650;
}

button:hover {
  transform: translateY(-1px);
}

button.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--line);
}

input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--text);
  padding: 0.78rem 0.85rem;
  outline: none;
}

input:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(246, 130, 31, 0.16);
}

.shell {
  display: grid;
  grid-template-columns: 286px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  border-right: 1px solid var(--line);
  background: #ffffff;
  padding: 1.2rem;
}

.brand {
  display: flex;
  gap: 0.85rem;
  align-items: center;
  padding: 0.4rem 0.2rem 1.15rem;
  border-bottom: 1px solid var(--line);
}

.mark {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border-radius: 8px;
  background: #111111;
  color: #ffffff;
  font-weight: 800;
}

.brand h1 {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.2;
}

.brand p,
.muted,
.eyebrow,
.brain,
.meta {
  color: var(--muted);
}

.brand p {
  margin: 0.15rem 0 0;
  font-size: 0.82rem;
}

.nav {
  display: grid;
  gap: 0.2rem;
  padding: 1rem 0;
}

.nav-item {
  width: 100%;
  text-align: left;
  border: 0;
  border-left: 3px solid transparent;
  border-radius: 0;
  background: transparent;
  color: var(--text);
  padding: 0.72rem 0.72rem;
  font-weight: 650;
}

.nav-item:hover,
.nav-item.active {
  transform: none;
  background: #fff4ea;
  border-left-color: var(--accent);
  color: var(--accent-dark);
}

.sidebar-footer {
  margin-top: auto;
  display: grid;
  gap: 0.75rem;
}

.status-dot {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-dot::before {
  content: "";
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: #18a058;
}

.content {
  min-width: 0;
  padding: 1.5rem clamp(1rem, 3vw, 2.5rem) 2rem;
}

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  border-bottom: 1px solid var(--line);
  padding-bottom: 1.2rem;
  margin-bottom: 1.2rem;
}

.eyebrow {
  margin: 0 0 0.25rem;
  text-transform: uppercase;
  font-size: 0.76rem;
  font-weight: 800;
}

.topbar h2 {
  margin: 0;
  font-size: clamp(1.65rem, 2.2vw, 2.2rem);
  line-height: 1.12;
}

.brain {
  max-width: 360px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 0.65rem 0.75rem;
  font-size: 0.9rem;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.chat-layout {
  display: grid;
  grid-template-rows: minmax(420px, calc(100vh - 220px)) auto;
  gap: 0.9rem;
}

.chat-log {
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 1rem;
}

.message {
  max-width: 840px;
  margin: 0 0 0.8rem;
  padding: 0.82rem 0.95rem;
  border-radius: 8px;
  line-height: 1.5;
  white-space: pre-wrap;
}

.message.assistant {
  background: var(--panel-soft);
  border: 1px solid var(--line);
}

.message.user {
  margin-left: auto;
  background: #111111;
  color: #ffffff;
}

.message.system {
  border-color: #d44;
  color: #8a1f1f;
}

.chat-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 0.7rem;
}

.metrics {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
  margin-bottom: 1rem;
}

.metric,
.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric {
  padding: 1rem;
}

.metric span {
  display: block;
  color: var(--muted);
  font-size: 0.86rem;
  margin-bottom: 0.45rem;
}

.metric strong {
  display: block;
  font-size: 1.18rem;
  overflow-wrap: anywhere;
}

.two-column {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
}

.panel {
  padding: 1rem;
}

.panel.full,
.panel.narrow {
  margin-top: 1rem;
}

.panel.narrow {
  max-width: 780px;
}

.panel h3 {
  margin: 0 0 0.8rem;
  font-size: 1rem;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1rem;
}

.panel-heading h3 {
  margin-bottom: 0.25rem;
}

.panel-heading p {
  margin: 0;
}

.stack {
  display: grid;
  gap: 0.7rem;
}

.action-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.7rem;
}

.launch-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.8rem;
  margin-bottom: 1rem;
}

.launch-btn {
  min-height: 58px;
  background: #111111;
}

.usage-panel {
  margin-top: 0;
  margin-bottom: 1rem;
}

.usage-cards {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.9rem;
}

.usage-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 1rem;
}

.usage-card-top {
  display: flex;
  justify-content: space-between;
  gap: 0.8rem;
  align-items: flex-start;
}

.usage-label {
  display: block;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.usage-card-top strong {
  display: block;
  margin-top: 0.15rem;
  font-size: clamp(1.8rem, 4vw, 2.6rem);
  line-height: 1;
}

.usage-badge {
  border-radius: 999px;
  padding: 0.28rem 0.55rem;
  font-size: 0.76rem;
  font-weight: 800;
}

.usage-bar {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #e8e5dc;
  margin: 1rem 0;
}

.usage-bar span {
  display: block;
  height: 100%;
  border-radius: inherit;
}

.usage-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
}

.usage-stats div {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0.62rem;
}

.usage-stats span {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
}

.usage-stats strong {
  display: block;
  margin-top: 0.18rem;
  overflow-wrap: anywhere;
}

.usage-card.plenty {
  border-color: #9ad8b6;
}

.usage-card.plenty .usage-badge {
  background: #ddf8e9;
  color: #10643a;
}

.usage-card.plenty .usage-bar span {
  background: #18a058;
}

.usage-card.watch {
  border-color: #efcf84;
}

.usage-card.watch .usage-badge {
  background: #fff4d6;
  color: #805a00;
}

.usage-card.watch .usage-bar span {
  background: #d69b08;
}

.usage-card.low {
  border-color: #e4a1a1;
}

.usage-card.low .usage-badge {
  background: #ffe4e4;
  color: #9b1c1c;
}

.usage-card.low .usage-card-top strong {
  color: #9b1c1c;
}

.usage-card.low .usage-bar span {
  background: #d63232;
}

.usage-card.unknown .usage-badge {
  background: #eeeeee;
  color: #555555;
}

.usage-card.unknown .usage-bar span {
  background: #8a8a8a;
}

.result-panel {
  display: grid;
  gap: 0.8rem;
}

.result-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel-soft);
  padding: 1rem;
}

.result-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: flex-start;
}

.result-head strong {
  display: block;
  margin-top: 0.15rem;
  font-size: clamp(1.45rem, 3vw, 2rem);
  line-height: 1.05;
}

.result-note {
  margin: 0.8rem 0 0;
  color: var(--muted);
  line-height: 1.5;
}

.result-facts,
.check-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.65rem;
  margin-top: 1rem;
}

.result-facts div,
.check-pill {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0.62rem;
}

.result-facts span,
.check-pill span {
  display: block;
  color: var(--muted);
  font-size: 0.75rem;
  overflow-wrap: anywhere;
}

.result-facts strong,
.check-pill strong {
  display: block;
  margin-top: 0.18rem;
  overflow-wrap: anywhere;
}

.result-card.plenty {
  border-color: #9ad8b6;
}

.result-card.plenty .usage-badge,
.check-pill.plenty {
  background: #ddf8e9;
  color: #10643a;
}

.result-card.watch {
  border-color: #efcf84;
}

.result-card.watch .usage-badge {
  background: #fff4d6;
  color: #805a00;
}

.result-card.low {
  border-color: #e4a1a1;
}

.result-card.low .usage-badge,
.check-pill.low {
  background: #ffe4e4;
  color: #9b1c1c;
}

.result-card.unknown .usage-badge {
  background: #eeeeee;
  color: #555555;
}

.event-list {
  display: grid;
  gap: 0.65rem;
  margin-top: 1rem;
}

.event-card,
.empty-state,
.xbox-advice {
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  padding: 0.75rem;
}

.event-card strong {
  display: block;
  overflow-wrap: anywhere;
}

.empty-state {
  color: var(--muted);
}

.xbox-advice p {
  margin: 0.25rem 0 0;
  color: var(--muted);
  line-height: 1.45;
}

.xbox-game-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  margin-top: 1rem;
}

.xbox-game-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  padding: 0.85rem;
}

.xbox-game-card strong {
  display: block;
  margin-top: 0.2rem;
  font-size: 1.2rem;
  overflow-wrap: anywhere;
}

.xbox-game-card .usage-bar {
  margin: 0.75rem 0;
}

.xbox-game-card .usage-bar span {
  background: #18a058;
}

.json-details {
  margin-top: 1rem;
}

.json-details summary {
  cursor: pointer;
  color: var(--muted);
  font-weight: 700;
}

.json-details pre {
  margin-bottom: 0;
}

.list {
  display: grid;
  gap: 0.65rem;
}

.process,
.memory {
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.75rem;
  background: var(--panel-soft);
}

.meta {
  margin-top: 0.28rem;
  font-size: 0.82rem;
}

.memory button {
  margin-top: 0.65rem;
  padding: 0.45rem 0.65rem;
  background: transparent;
  color: #8a1f1f;
  border-color: #e0b6b6;
}

pre {
  white-space: pre-wrap;
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #141414;
  color: #f7f7f4;
  padding: 1rem;
}

@media (max-width: 920px) {
  .shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: static;
    height: auto;
  }

  .nav {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .metrics,
  .two-column,
  .launch-grid,
  .usage-cards,
  .xbox-game-grid,
  .result-facts,
  .check-grid,
  .chat-form {
    grid-template-columns: 1fr;
  }

  .panel-heading,
  .usage-card-top,
  .result-head {
    align-items: stretch;
    flex-direction: column;
  }

  .usage-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
