* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: "Google Sans", Roboto, Arial, sans-serif;
  background: #f0f4f9;
  color: #1f1f1f;
}
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 20px;
  background: #fff;
  border-bottom: 1px solid #e0e3e7;
}
.brand { font-size: 15px; font-weight: 500; }
.badge {
  font-size: 11px;
  background: #e8f0fe;
  color: #1967d2;
  padding: 2px 8px;
  border-radius: 999px;
  margin-left: 8px;
}
.pill {
  font-size: 12px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #f1f3f4;
}
.pill-running { background: #fef7e0; color: #b06000; }
.pill-waiting { background: #e8f0fe; color: #1967d2; }
.pill-done { background: #e6f4ea; color: #137333; }
.pill-error { background: #fce8e6; color: #c5221f; }
.layout {
  display: grid;
  grid-template-columns: 320px 1fr;
  min-height: calc(100vh - 49px);
}
.sidebar {
  padding: 20px;
  background: #fff;
  border-right: 1px solid #e0e3e7;
}
.sidebar h2 { margin: 0 0 16px; font-size: 16px; font-weight: 500; }
.field { display: block; margin-bottom: 12px; }
.field span { display: block; font-size: 12px; color: #5f6368; margin-bottom: 4px; }
.field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #dadce0;
  border-radius: 8px;
  font-size: 14px;
}
.btn-row { display: flex; gap: 8px; margin: 16px 0; }
.btn {
  border: 1px solid #dadce0;
  background: #fff;
  border-radius: 8px;
  padding: 10px 14px;
  cursor: pointer;
  font-size: 13px;
}
.btn:disabled { opacity: 0.5; cursor: default; }
.btn.primary { background: #1a73e8; color: #fff; border-color: #1a73e8; }
.meta { font-size: 12px; color: #5f6368; word-break: break-all; }
.log {
  margin-top: 16px;
  max-height: 220px;
  overflow: auto;
  font-size: 11px;
  line-height: 1.4;
  color: #444;
  background: #f8f9fa;
  border-radius: 8px;
  padding: 10px;
}
.log div { margin-bottom: 6px; }
.stage { background: #131314; padding: 0; position: relative; }
.shell-error {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 32px;
  text-align: center;
  background: #131314;
  color: #e8eaed;
  font-family: "Google Sans", Roboto, Arial, sans-serif;
}
.shell-error[hidden] { display: none !important; }
.shell-error h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 500;
  color: #f28b82;
}
.shell-error p {
  margin: 0;
  max-width: 420px;
  font-size: 14px;
  line-height: 1.5;
  color: #9aa0a6;
}
.shell-error-hint {
  margin: 8px 0 0;
  max-width: 520px;
  width: 100%;
  padding: 12px 14px;
  border-radius: 8px;
  background: #1e1f20;
  color: #e8eaed;
  font-size: 12px;
  line-height: 1.45;
  text-align: left;
  white-space: pre-wrap;
  overflow-x: auto;
}
.shell-error .btn.primary {
  margin-top: 8px;
  background: #8ab4f8;
  color: #202124;
  border-color: #8ab4f8;
}
#pageFrame {
  width: 100%;
  height: calc(100vh - 49px);
  border: 0;
  background: #131314;
  color-scheme: dark;
  opacity: 1;
  transition: opacity 0.14s ease;
}
#pageFrame.frame-hide {
  opacity: 0;
  pointer-events: none;
}
.done-panel {
  margin-top: 16px;
  padding: 12px;
  background: #e6f4ea;
  border-radius: 8px;
}
.done-panel h3 { margin: 0 0 8px; font-size: 14px; }
.hidden { display: none; }

/* Default: full-screen Gmail flow (puppy-style). Add ?dev=1 for debug sidebar. */
body:not(.dev-mode) {
  background: #131314;
  color-scheme: dark;
}
body:not(.dev-mode) .sidebar { display: none; }
.layout.fullscreen {
  grid-template-columns: 1fr;
  min-height: 100vh;
  background: #131314;
}
.layout.fullscreen #pageFrame {
  height: 100vh;
}

@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  #pageFrame { height: 70vh; }
}
