:root {
  --ink: #13201d;
  --muted: #64706d;
  --brand: #0f766e;
  --brand-dark: #143c3c;
  --line: #d8dfdc;
  --paper: #f6f8f7;
  --surface: #ffffff;
}

body {
  background: var(--paper);
  color: var(--ink);
}

.app-nav {
  background: var(--brand-dark);
}

.page-heading,
.section-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

h1 {
  font-size: clamp(1.8rem, 2.5vw, 2.6rem);
  font-weight: 750;
}

h2 {
  font-size: 1.2rem;
  font-weight: 720;
}

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

.eyebrow {
  color: var(--brand);
  font-size: 0.78rem;
  text-transform: uppercase;
  font-weight: 750;
  letter-spacing: 0;
  margin-bottom: 0.2rem;
}

.btn-primary {
  background: var(--brand);
  border-color: var(--brand);
}

.btn-primary:hover {
  background: #115e59;
  border-color: #115e59;
}

.surface,
.empty-state,
.login-panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1.25rem;
  box-shadow: 0 10px 30px rgba(19, 32, 29, 0.06);
}

.narrow {
  max-width: 780px;
}

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

.kpi {
  min-height: 112px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
}

.kpi span {
  color: var(--muted);
  display: block;
  font-size: 0.9rem;
}

.kpi strong {
  display: block;
  font-size: 1.55rem;
  margin-top: 1.2rem;
}

.detail-grid {
  display: grid;
  grid-template-columns: 1.35fr 1fr;
  gap: 1rem;
}

.signal {
  border-radius: 8px;
  margin-bottom: 0.75rem;
  padding: 0.85rem 1rem;
  font-weight: 700;
}

.signal.green { background: #dcfce7; color: #166534; }
.signal.yellow { background: #fef9c3; color: #854d0e; }
.signal.red { background: #fee2e2; color: #991b1b; }

.recommendation {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 1rem;
  min-height: 110px;
  margin-bottom: 1rem;
}

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

.tutorial-card {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tutorial-media {
  aspect-ratio: 16 / 9;
  background: #0f172a;
  border-radius: 8px;
  overflow: hidden;
}

.tutorial-media video,
.tutorial-media iframe {
  border: 0;
  display: block;
  height: 100%;
  width: 100%;
}

.upload-guidance {
  border-bottom: 1px solid var(--line);
  margin-bottom: 1.25rem;
  padding-bottom: 1.25rem;
}

.upload-guidance p {
  color: var(--muted);
}

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

.guidance-grid ul {
  margin-bottom: 0;
  padding-left: 1.15rem;
}

.guidance-note {
  background: #fef9c3;
  border: 1px solid #fde68a;
  border-radius: 8px;
  color: #854d0e;
  margin: 1rem 0 0;
  padding: 0.85rem 1rem;
}

.chat-context {
  border-bottom: 1px solid var(--line);
  color: var(--muted);
  margin-bottom: 1rem;
  padding-bottom: 1rem;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  max-height: 58vh;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.chat-message {
  display: flex;
  flex-direction: column;
  max-width: min(760px, 92%);
}

.chat-message.user {
  align-self: flex-end;
}

.chat-message.assistant {
  align-self: flex-start;
}

.chat-meta {
  color: var(--muted);
  font-size: 0.78rem;
  margin-bottom: 0.25rem;
}

.chat-bubble {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.85rem 1rem;
}

.chat-message.user .chat-bubble {
  background: var(--brand);
  border-color: var(--brand);
  color: white;
}

.chat-message.assistant .chat-bubble {
  background: #f8faf9;
}

.chat-form {
  border-top: 1px solid var(--line);
  margin-top: 1.25rem;
  padding-top: 1.25rem;
}

.empty-chat {
  color: var(--muted);
  padding: 1.25rem 0;
}

.login-shell {
  min-height: calc(100vh - 110px);
  display: grid;
  place-items: center;
}

.login-panel {
  width: min(920px, 100%);
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 2rem;
}

.logo-brand {
  display: inline-flex;
  align-items: center;
  min-height: 64px;
  padding: 0;
}

.logo-brand img {
  display: block;
  height: 78px;
  width: auto;
  max-width: 280px;
  object-fit: contain;
}

.login-logo {
  display: block;
  width: min(360px, 100%);
  height: auto;
  margin: 0.45rem 0 1rem;
}

@media (max-width: 900px) {
  .kpi-grid,
  .detail-grid,
  .guidance-grid,
  .tutorial-grid,
  .login-panel {
    grid-template-columns: 1fr;
  }

  .page-heading,
  .section-head {
    align-items: flex-start;
    flex-direction: column;
  }
}
