:root {
  color-scheme: dark;
  --bg: #0c1013;
  --panel: #151b20;
  --panel-2: #20292f;
  --line: #2b363e;
  --text: #eef3f5;
  --muted: #94a1aa;
  --green: #35c07b;
  --amber: #e7b752;
  --red: #ec6a5e;
  --blue: #4ba3ff;
  --white: #ffffff;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.35);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  background:
    linear-gradient(135deg, rgba(75, 163, 255, 0.1), transparent 34%),
    linear-gradient(315deg, rgba(53, 192, 123, 0.07), transparent 26%),
    var(--bg);
  color: var(--text);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
  touch-action: manipulation;
}

.app-shell {
  display: block;
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  z-index: 15;
  display: grid;
  grid-template-columns: auto minmax(260px, 360px);
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 14px 22px;
  border-bottom: 1px solid var(--line);
  background: rgba(14, 17, 20, 0.94);
  backdrop-filter: blur(18px);
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-mark {
  display: grid;
  width: 48px;
  height: 48px;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 8px;
  background: linear-gradient(145deg, var(--panel-2), #11161a);
  color: var(--green);
  font-weight: 900;
  box-shadow: var(--shadow);
}

.image-mark {
  display: block;
  object-fit: cover;
  padding: 0;
}

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

h1 {
  font-size: 1rem;
}

.brand p,
.eyebrow,
.metric span,
.quick-command label,
.connection-box span {
  color: var(--muted);
  font-size: 0.78rem;
  line-height: 1.3;
}

.nav-item,
.ghost-btn,
.danger-btn,
.small-btn,
.primary-btn,
.voice-btn,
.action-grid button,
.item-action {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--text);
  background: var(--panel);
}

.nav-item {
  width: 100%;
  padding: 0 10px;
  text-align: center;
  font-weight: 750;
}

.nav-item.active,
.nav-item:hover,
.action-grid button:hover {
  border-color: rgba(75, 163, 255, 0.55);
  background: #1d2832;
}

.quick-command {
  display: grid;
  gap: 10px;
}

.quick-command label,
.inline-voice {
  display: none;
}

textarea,
input,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161a;
  color: var(--text);
  outline: none;
}

textarea {
  min-height: 110px;
  padding: 12px;
  resize: vertical;
}

input,
select {
  min-height: 44px;
  padding: 0 12px;
}

textarea:focus,
input:focus,
select:focus {
  border-color: var(--blue);
}

.primary-btn {
  border-color: rgba(53, 192, 123, 0.55);
  background: #153226;
  color: #dffbec;
  font-weight: 800;
}

.voice-btn {
  border-color: rgba(75, 163, 255, 0.62);
  background: #13283b;
  color: #d9efff;
  font-weight: 900;
}

.voice-btn.large {
  width: 100%;
  min-height: 64px;
  margin-top: 16px;
  font-size: 1.05rem;
}

.voice-btn.listening {
  border-color: rgba(236, 106, 94, 0.72);
  background: #3a1715;
  color: #ffe1de;
}

.bottom-dock {
  position: fixed;
  z-index: 30;
  right: 14px;
  left: 50%;
  bottom: max(12px, env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 1fr 82px 1fr 1fr;
  align-items: center;
  gap: 8px;
  width: min(680px, calc(100vw - 28px));
  min-height: 72px;
  padding: 8px;
  transform: translateX(-50%);
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(12, 16, 19, 0.96);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.48);
  backdrop-filter: blur(18px);
}

.bottom-dock .nav-item {
  min-height: 52px;
  border-radius: 12px;
}

.floating-voice-btn {
  width: 74px;
  height: 74px;
  border: 3px solid rgba(75, 163, 255, 0.72);
  border-radius: 999px;
  background: radial-gradient(circle at 35% 25%, #4ba3ff, #153955 70%);
  color: #eff9ff;
  box-shadow: 0 10px 28px rgba(0, 0, 0, 0.42), 0 0 0 7px rgba(75, 163, 255, 0.1);
  font-size: 0.92rem;
  font-weight: 950;
}

.floating-voice-btn.listening {
  border-color: rgba(236, 106, 94, 0.82);
  background: radial-gradient(circle at 35% 25%, #ff8176, #4a1715 72%);
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.45), 0 0 0 10px rgba(236, 106, 94, 0.13);
}

.voice-status,
.voice-readout {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161a;
  color: var(--muted);
  padding: 10px 12px;
  font-size: 0.86rem;
  line-height: 1.35;
}

.voice-readout {
  margin-top: 12px;
  color: var(--text);
}

.ghost-btn,
.small-btn,
.item-action {
  padding: 0 14px;
}

.danger-btn {
  padding: 0 14px;
  border-color: rgba(236, 106, 94, 0.5);
  background: #341816;
  color: #ffe3e0;
}

.main {
  min-width: 0;
  padding: 22px 22px 124px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 24px;
}

.topbar h2 {
  margin-top: 2px;
  font-size: clamp(1.8rem, 4vw, 3rem);
  letter-spacing: 0;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

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

.metric,
.panel,
.venture-card,
.task-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(23, 28, 32, 0.92);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.26);
}

.metric {
  padding: 18px;
}

.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 2.2rem;
  line-height: 1;
}

.dashboard-grid,
.phone-layout {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.profile-panel {
  grid-column: 1 / -1;
}

.profile-list {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 10px;
  margin-top: 14px;
}

.profile-list div {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161a;
  padding: 12px;
}

.profile-list span {
  display: block;
  margin-bottom: 5px;
  color: var(--muted);
  font-size: 0.78rem;
}

.profile-list strong {
  font-size: 0.92rem;
  line-height: 1.25;
}

.panel {
  padding: 18px;
}

.split-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(320px, 0.85fr);
  gap: 18px;
}

.sync-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 18px;
}

.panel-head,
.connection-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.task-list {
  display: grid;
  gap: 10px;
  margin-top: 14px;
}

.empty {
  border: 1px dashed var(--line);
  border-radius: 8px;
  padding: 18px;
  color: var(--muted);
  text-align: center;
}

.input-grid {
  display: grid;
  grid-template-columns: 1.3fr 1fr 1fr 1fr auto;
  gap: 10px;
  margin-bottom: 18px;
}

.stack-form {
  display: grid;
  gap: 10px;
  margin: 14px 0;
}

.button-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.button-row button {
  flex: 1 1 140px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}

.venture-card,
.task-card {
  display: grid;
  gap: 10px;
  padding: 16px;
}

.card-title {
  font-weight: 850;
  line-height: 1.25;
}

.card-meta {
  color: var(--muted);
  font-size: 0.9rem;
}

.badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #253039;
  color: #c9d4da;
  font-size: 0.78rem;
  font-weight: 800;
}

.badge.green {
  background: rgba(53, 192, 123, 0.16);
  color: #8ff0bd;
}

.badge.amber {
  background: rgba(231, 183, 82, 0.15);
  color: #f5d486;
}

.badge.red {
  background: rgba(236, 106, 94, 0.16);
  color: #ffb2aa;
}

.item-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding-top: 4px;
}

.item-action {
  min-height: 34px;
  color: var(--muted);
}

.kanban {
  display: grid;
  grid-template-columns: repeat(5, minmax(170px, 1fr));
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}

.kanban-column {
  min-height: 420px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(17, 22, 26, 0.82);
  padding: 12px;
}

.kanban-column h3 {
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.pair-code {
  display: grid;
  min-height: 118px;
  margin-top: 18px;
  place-items: center;
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: #101519;
  color: var(--green);
  font-size: clamp(2.3rem, 7vw, 5rem);
  font-weight: 950;
  letter-spacing: 0;
}

.action-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 16px;
}

.voice-panel {
  grid-column: 1 / -1;
}

.hidden {
  display: none !important;
}

.advanced-sync {
  display: none;
}

.voice-command-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.voice-command-grid span {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #11161a;
  color: var(--muted);
  padding: 10px;
  font-size: 0.82rem;
}

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

  .quick-command {
    margin-top: 0;
  }

  .metrics-grid,
  .profile-list,
  .split-grid,
  .sync-grid,
  .voice-command-grid,
  .card-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

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

@media (max-width: 680px) {
  body {
    padding-bottom: 0;
    background: var(--bg);
  }

  .sidebar,
  .main {
    padding: 16px;
  }

  .sidebar {
    gap: 14px;
    background: rgba(12, 16, 19, 0.96);
  }

  .brand-mark {
    width: 44px;
    height: 44px;
  }

  .quick-command {
    border: 1px solid var(--line);
    border-radius: 8px;
    background: rgba(21, 27, 32, 0.92);
    padding: 12px;
  }

  textarea {
    min-height: 82px;
  }

  .nav-item {
    width: 100%;
    min-height: 44px;
    padding: 0 8px;
    white-space: nowrap;
    text-align: center;
    font-size: 0.86rem;
  }

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

  .profile-list,
  .split-grid,
  .sync-grid,
  .voice-command-grid,
  .dashboard-grid,
  .phone-layout,
  .card-grid,
  .input-grid,
  .action-grid {
    grid-template-columns: 1fr;
  }

  .topbar,
  .top-actions,
  .panel-head,
  .connection-box {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions {
    width: 100%;
  }

  .top-actions .badge,
  .top-actions button {
    width: 100%;
    justify-content: center;
  }

  .metric {
    padding: 14px;
  }

  .metric strong {
    font-size: 1.9rem;
  }

  .panel,
  .venture-card,
  .task-card {
    padding: 14px;
  }

  .voice-btn.large {
    min-height: 76px;
    font-size: 1.15rem;
  }

  .bottom-dock {
    grid-template-columns: 1fr 1fr 72px 1fr 1fr;
    gap: 6px;
    width: calc(100vw - 16px);
    min-height: 68px;
    padding: 7px;
    border-radius: 16px;
  }

  .bottom-dock .nav-item {
    min-height: 48px;
    padding: 0 6px;
    font-size: 0.76rem;
  }

  .floating-voice-btn {
    width: 66px;
    height: 66px;
    font-size: 0.78rem;
  }

  .kanban {
    grid-template-columns: repeat(5, minmax(220px, 1fr));
  }
}
