:root {
  --page: #f4f7fb;
  --shell: #0b1437;
  --shell-2: #121c47;
  --panel: #ffffff;
  --panel-soft: #f8fafc;
  --line: #e3e8f2;
  --line-strong: #cfd8e8;
  --ink: #172033;
  --muted: #667085;
  --blue: #3264ff;
  --blue-2: #1239c5;
  --green: #168a4a;
  --red: #c0342b;
  --amber: #b76a00;
  --shadow: 0 18px 45px rgba(16, 24, 40, .08);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
}

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

a {
  color: var(--blue);
  text-decoration: none;
}

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

button,
.button-link {
  min-height: 38px;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 8px 12px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-weight: 700;
  font-size: 13px;
}

button:hover,
.button-link:hover {
  border-color: var(--blue);
}

button.primary,
.button-link.primary {
  background: var(--blue);
  border-color: var(--blue);
  color: #fff;
}

button.good {
  color: var(--green);
}

button.bad {
  color: var(--red);
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 11px;
}

textarea {
  min-height: 96px;
  resize: vertical;
  line-height: 1.45;
}

input[type=file] {
  padding: 7px;
}

.app-shell {
  display: grid;
  grid-template-columns: 288px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: linear-gradient(180deg, var(--shell), var(--shell-2));
  color: #e8edff;
  padding: 22px 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: auto;
}

.brand {
  display: grid;
  gap: 4px;
  padding: 4px 4px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, .12);
  margin-bottom: 16px;
}

.brand-mark {
  width: 38px;
  height: 38px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: #fff;
  color: var(--shell);
  font-weight: 900;
  margin-bottom: 8px;
}

.brand-title {
  font-size: 18px;
  font-weight: 850;
}

.brand-subtitle {
  color: #aab6e8;
  font-size: 12px;
  line-height: 1.4;
}

.nav-group {
  display: grid;
  gap: 8px;
  margin: 16px 0;
}

.nav-item {
  display: grid;
  grid-template-columns: 26px 1fr;
  gap: 10px;
  align-items: center;
  min-height: 42px;
  padding: 8px 10px;
  color: #dfe6ff;
  border-radius: 8px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, .04);
}

.nav-item.active,
.nav-item:hover {
  background: rgba(255, 255, 255, .1);
  border-color: rgba(255, 255, 255, .12);
  color: #fff;
}

.nav-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(255, 255, 255, .12);
  display: grid;
  place-items: center;
  font-size: 13px;
}

.sidebar-note {
  margin-top: 18px;
  padding: 12px;
  border: 1px solid rgba(255, 255, 255, .14);
  background: rgba(255, 255, 255, .07);
  border-radius: 8px;
  color: #cdd6ff;
  font-size: 12px;
  line-height: 1.45;
}

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

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

.eyebrow {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .06em;
}

h1,
h2,
h3 {
  margin: 0;
  letter-spacing: 0;
}

h1 {
  font-size: 25px;
  line-height: 1.18;
}

h2 {
  font-size: 16px;
}

.muted {
  color: var(--muted);
  font-size: 12px;
}

.card,
.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel {
  padding: 16px;
  margin-bottom: 16px;
}

.head {
  min-height: 45px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  font-weight: 850;
  font-size: 13px;
  background: #fff;
}

.body {
  padding: 14px;
}

.grid {
  display: grid;
  gap: 10px;
}

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

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

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

.stat-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.stat {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 13px;
  box-shadow: var(--shadow);
  min-height: 82px;
}

.stat .value {
  font-size: 20px;
  font-weight: 850;
  margin-top: 6px;
}

.project-form {
  display: grid;
  grid-template-columns: 1fr 130px 130px auto;
  gap: 10px;
}

.project-list {
  display: grid;
  gap: 8px;
}

.project-row {
  display: grid;
  grid-template-columns: 1fr 130px 120px 120px;
  gap: 12px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.project-row:hover {
  border-color: var(--blue);
}

.badge,
.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  padding: 3px 8px;
  color: var(--muted);
  background: #fff;
  font-size: 11px;
  font-weight: 800;
}

.badge.blue {
  color: var(--blue-2);
  background: #eef3ff;
  border-color: #cfdbff;
}

.badge.green {
  color: var(--green);
  background: #eefaf3;
  border-color: #ccefd9;
}

.badge.amber {
  color: var(--amber);
  background: #fff7e8;
  border-color: #ffe2ad;
}

.project-layout {
  display: grid;
  grid-template-columns: 330px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.rail {
  display: grid;
  gap: 12px;
  position: sticky;
  top: 16px;
}

.main-stack {
  display: grid;
  gap: 12px;
  min-width: 0;
}

.stage {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 9px;
  padding: 9px 10px;
  border-bottom: 1px solid #edf1f7;
}

.dot {
  width: 24px;
  height: 24px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  display: grid;
  place-items: center;
  font-size: 12px;
  color: var(--muted);
  font-weight: 850;
}

.active .dot {
  background: var(--blue);
  color: #fff;
  border-color: var(--blue);
}

.done .dot {
  background: var(--green);
  color: #fff;
  border-color: var(--green);
}

.chat {
  display: grid;
  gap: 9px;
}

.msg {
  padding: 10px 11px;
  border-radius: 8px;
  background: var(--panel-soft);
  border: 1px solid var(--line);
  font-size: 13px;
  line-height: 1.45;
}

.msg.user {
  background: #eef3ff;
  border-color: #d7e1ff;
}

.msg.sys {
  background: #fff;
}

.flow-card {
  border: 1px solid #cfdcff;
  background: #f7f9ff;
  border-radius: 8px;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.gate {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px;
  align-items: center;
  border-bottom: 1px solid #edf1f7;
  padding: 10px;
}

.gate:last-child {
  border-bottom: 0;
}

.gate.approved {
  background: #f0fbf4;
}

.gate.needs_work {
  background: #fff5f4;
}

.check {
  display: grid;
  grid-template-columns: 34px 1fr;
  gap: 8px;
  font-size: 12px;
  padding: 6px 0;
}

.ok {
  color: var(--green);
  font-weight: 900;
}

.warn {
  color: var(--red);
  font-weight: 900;
}

.ideas {
  display: grid;
  gap: 8px;
}

.idea {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  background: #fff;
}

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

.links a {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 9px;
  color: var(--blue);
  text-decoration: none;
  font-size: 12px;
  font-weight: 800;
  background: white;
}

.timeline {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
  gap: 12px;
}

.tl {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  overflow: hidden;
}

.tl.drop {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(50, 100, 255, .16);
}

.tl img {
  width: 100%;
  aspect-ratio: 16 / 9;
  object-fit: contain;
  background: #fff;
  display: block;
}

.empty-frame {
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  background: #f3f6fb;
}

.tlBody {
  padding: 10px;
  font-size: 12px;
  display: grid;
  gap: 7px;
}

.caption {
  font-size: 13px;
  font-weight: 800;
  line-height: 1.35;
}

.log {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  background: #0f1720;
  color: #e8edf5;
  border-radius: 8px;
  padding: 11px;
  max-height: 290px;
  overflow: auto;
}

video {
  width: 100%;
  max-height: 460px;
  background: #000;
  border-radius: 8px;
}

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

.auth-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background: linear-gradient(180deg, #f5f7fc, #eef3fb);
}

.auth-card {
  width: min(100%, 430px);
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
  padding: 24px;
  display: grid;
  gap: 16px;
}

.auth-card .brand-mark {
  margin: 0;
}

.auth-card h1 {
  font-size: 24px;
}

.auth-footer {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
}

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

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

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

  .project-layout {
    grid-template-columns: 1fr;
  }

  .rail {
    position: static;
  }
}

@media (max-width: 800px) {
  .workspace {
    padding: 14px;
  }

  .topbar,
  .project-form,
  .project-row,
  .two,
  .three,
  .four,
  .stat-grid,
  .nav-group {
    grid-template-columns: 1fr;
  }

  .topbar {
    display: grid;
  }
}
