:root {
  color-scheme: dark;
  --bg: #08111f;
  --panel: #111c2f;
  --panel-2: #18243a;
  --text: #f6f8fb;
  --muted: #99a7bc;
  --line: rgba(255, 255, 255, 0.09);
  --accent: #8b5cf6;
  --accent-2: #22d3ee;
  --danger: #fb7185;
  --warn: #fbbf24;
  --good: #34d399;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(139, 92, 246, 0.24), transparent 34rem),
    radial-gradient(circle at bottom right, rgba(34, 211, 238, 0.16), transparent 28rem),
    var(--bg);
  color: var(--text);
}

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

button { cursor: pointer; }

.app-shell {
  width: min(100%, 520px);
  min-height: 100vh;
  margin: 0 auto;
  padding: max(18px, env(safe-area-inset-top)) 16px 92px;
}

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

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

h1 { font-size: 28px; letter-spacing: -0.04em; }
h2 { font-size: 25px; letter-spacing: -0.04em; margin-top: 4px; }
h3 { font-size: 18px; letter-spacing: -0.02em; }

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

.muted { color: var(--muted); line-height: 1.45; }

.pill-button, .text-button, .back-button, .primary-button {
  border: 0;
  border-radius: 999px;
  color: var(--text);
}

.pill-button {
  padding: 10px 14px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--line);
}

.text-button {
  padding: 6px 0;
  background: transparent;
  color: var(--accent-2);
  font-weight: 700;
}

.back-button {
  background: rgba(255, 255, 255, 0.08);
  padding: 10px 14px;
  margin-bottom: 12px;
}

.primary-button {
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  font-weight: 800;
  box-shadow: 0 16px 36px rgba(34, 211, 238, 0.16);
}

.view { display: none; }
.view.active { display: block; animation: rise 160ms ease-out; }

@keyframes rise {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.hero-card, .panel, .task-card, .detail-card, .metric-card {
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255,255,255,0.08), rgba(255,255,255,0.04));
  box-shadow: 0 20px 60px rgba(0,0,0,0.25);
  backdrop-filter: blur(14px);
}

.hero-card {
  padding: 22px;
  border-radius: 28px;
  margin-bottom: 14px;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.metric-card {
  border-radius: 20px;
  padding: 16px;
  color: inherit;
  text-align: left;
}

.metric-button {
  position: relative;
  width: 100%;
  min-height: 92px;
  transition: transform 140ms ease, border-color 140ms ease, background 140ms ease;
}

.metric-button:active {
  transform: scale(0.98);
}

.metric-button:focus-visible {
  outline: 2px solid var(--accent-2);
  outline-offset: 3px;
}

.metric-button:hover {
  border-color: rgba(34, 211, 238, 0.42);
  background: linear-gradient(180deg, rgba(34,211,238,0.14), rgba(255,255,255,0.05));
}

.mini-copy {
  margin-top: 4px;
  font-size: 12px;
}

.metric-card strong {
  display: block;
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}

.metric-card span {
  color: var(--muted);
  font-size: 13px;
}

.panel {
  border-radius: 24px;
  padding: 16px;
  margin-bottom: 14px;
}

.section-heading, .toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.toolbar {
  align-items: stretch;
  flex-direction: column;
}

.search-box, .form-stack label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input, textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--text);
  padding: 13px 14px;
  outline: none;
}

textarea { resize: vertical; }
option { color: #111827; }

.card-list { display: grid; gap: 10px; }

.task-folder {
  display: grid;
  gap: 10px;
  border: 1px solid var(--line);
  border-radius: 24px;
  padding: 12px;
  background: rgba(255, 255, 255, 0.04);
}

.folder-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 2px 2px 4px;
}

.folder-heading h3 {
  margin-top: 2px;
  font-size: 16px;
  line-height: 1.2;
}

.folder-count {
  display: grid;
  place-items: center;
  min-width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.13);
  color: #a5f3fc;
  font-weight: 900;
}

.folder-list {
  gap: 8px;
}

.task-card {
  border-radius: 22px;
  padding: 14px;
  text-align: left;
  color: inherit;
  width: 100%;
}

.task-card h4 {
  margin: 0 0 8px;
  font-size: 16px;
  line-height: 1.25;
}

.task-meta, .badge-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
}

.task-meta { color: var(--muted); font-size: 12px; margin-top: 10px; }

.badge {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 5px 9px;
  font-size: 12px;
  font-weight: 800;
  background: rgba(255,255,255,0.09);
  color: var(--text);
}

.badge.blocked { background: rgba(251, 113, 133, 0.16); color: #fecdd3; }
.badge.approval { background: rgba(251, 191, 36, 0.17); color: #fde68a; }
.badge.running { background: rgba(34, 211, 238, 0.15); color: #a5f3fc; }
.badge.ready { background: rgba(52, 211, 153, 0.14); color: #bbf7d0; }
.badge.done { background: rgba(148, 163, 184, 0.16); color: #cbd5e1; }

.detail-card {
  border-radius: 26px;
  padding: 18px;
}

.detail-card h2 { margin-bottom: 10px; }
.detail-section { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--line); }
.detail-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-top: 16px; }
.detail-actions button { padding: 12px; border-radius: 16px; border: 1px solid var(--line); background: rgba(255,255,255,0.08); color: var(--text); }

.form-stack { display: grid; gap: 14px; margin-top: 14px; }
code { color: #a5f3fc; }

.today-plan-card {
  border-color: rgba(34, 211, 238, 0.22);
  background:
    linear-gradient(180deg, rgba(34,211,238,0.12), rgba(139,92,246,0.08)),
    rgba(255,255,255,0.04);
}

.accomplished-card {
  border-color: rgba(52, 211, 153, 0.2);
  background:
    linear-gradient(180deg, rgba(52,211,153,0.1), rgba(255,255,255,0.04)),
    rgba(255,255,255,0.035);
}

.required-note {
  color: #fbbf24;
  font-size: 11px;
  font-weight: 900;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.plan-meta {
  margin: 8px 0 14px;
}

.plan-list {
  list-style: none;
  display: grid;
  gap: 10px;
  margin: 14px 0 0;
  padding: 0;
}

.compact-plan {
  margin-top: 10px;
}

.plan-list li {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  line-height: 1.35;
}

.plan-list li::before {
  content: "☐";
  color: var(--accent-2);
  font-weight: 900;
}

.plan-list strong {
  display: block;
  margin-bottom: 3px;
}

.plan-list span {
  color: var(--muted);
  font-size: 13px;
}

.plan-actions {
  display: grid;
  gap: 10px;
  margin-top: 16px;
}

.plan-actions .text-button {
  justify-self: start;
  padding-left: 2px;
}

.file-list {
  display: grid;
  gap: 9px;
  margin-top: 10px;
}

.file-link {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 10px;
  align-items: center;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: rgba(255,255,255,0.06);
  color: var(--text);
  text-decoration: none;
}

.file-link:active {
  transform: scale(0.99);
}

.file-link strong {
  display: block;
  line-height: 1.25;
}

.file-link small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-size: 12px;
}

.file-icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  border-radius: 999px;
  background: rgba(34, 211, 238, 0.14);
  color: #a5f3fc;
  font-weight: 900;
}

.chat-panel {
  min-height: calc(100vh - 150px);
  display: flex;
  flex-direction: column;
}

.quick-prompts {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 10px;
  margin-bottom: 6px;
}

.quick-prompts button {
  white-space: nowrap;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255,255,255,0.08);
  color: var(--text);
  padding: 9px 11px;
  font-size: 12px;
  font-weight: 800;
}

.chat-messages {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 300px;
  max-height: calc(100vh - 330px);
  overflow-y: auto;
  padding: 4px 0 12px;
}

.chat-bubble {
  width: fit-content;
  max-width: 88%;
  border-radius: 20px;
  padding: 11px 13px;
  line-height: 1.42;
  white-space: pre-wrap;
  border: 1px solid var(--line);
}

.chat-bubble.user {
  align-self: flex-end;
  background: linear-gradient(135deg, rgba(139,92,246,0.45), rgba(34,211,238,0.23));
}

.chat-bubble.assistant {
  align-self: flex-start;
  background: rgba(255,255,255,0.08);
}

.chat-bubble.system {
  align-self: center;
  color: var(--muted);
  font-size: 12px;
  background: rgba(255,255,255,0.05);
}

.chat-form, .comment-form {
  display: grid;
  gap: 10px;
}

.chat-form {
  grid-template-columns: 1fr auto;
  align-items: end;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.chat-form .primary-button {
  padding-inline: 18px;
}

.bottom-nav {
  position: fixed;
  left: 50%;
  bottom: 0;
  transform: translateX(-50%);
  width: min(100%, 520px);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
  padding: 10px 12px max(10px, env(safe-area-inset-bottom));
  background: rgba(8, 17, 31, 0.86);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.nav-item {
  border: 0;
  border-radius: 18px;
  background: transparent;
  color: var(--muted);
  display: grid;
  place-items: center;
  gap: 2px;
  padding: 9px 4px;
  font-size: 17px;
}

.nav-item span { font-size: 10px; font-weight: 800; }
.nav-item.active { background: rgba(139, 92, 246, 0.22); color: var(--text); }

.toast {
  position: fixed;
  left: 50%;
  bottom: calc(74px + max(10px, env(safe-area-inset-bottom)));
  transform: translate(-50%, 18px) scale(0.98);
  width: min(calc(100% - 32px), 488px);
  z-index: 20;
  pointer-events: none;
  opacity: 0;
  border: 1px solid rgba(52, 211, 153, 0.38);
  border-radius: 18px;
  padding: 13px 16px;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.95), rgba(34, 211, 238, 0.9));
  color: #03131f;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.38);
  font-weight: 900;
  text-align: center;
  transition: opacity 180ms ease, transform 180ms ease;
}

.toast.show {
  opacity: 1;
  transform: translate(-50%, 0) scale(1);
}

.login-screen,
.walkthrough {
  position: fixed;
  inset: 0;
  z-index: 30;
  display: grid;
  place-items: end center;
  padding: 18px 16px max(18px, env(safe-area-inset-bottom));
  background: rgba(3, 7, 18, 0.72);
  backdrop-filter: blur(12px);
}

.login-screen.hidden,
.walkthrough.hidden { display: none; }

.login-card,
.walkthrough-card {
  width: min(100%, 500px);
  max-height: calc(100vh - 40px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 28px;
  padding: 20px;
  background: linear-gradient(180deg, rgba(17, 28, 47, 0.98), rgba(8, 17, 31, 0.98));
  box-shadow: 0 28px 90px rgba(0, 0, 0, 0.55);
}

.login-card {
  display: grid;
  gap: 14px;
}

.login-card h2,
.walkthrough-card h2 { margin: 6px 0 10px; }

.login-card label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.login-error {
  min-height: 20px;
  color: #fecdd3;
  font-size: 13px;
  font-weight: 800;
}

.walkthrough-card {
  position: relative;
  z-index: 36;
}

.walkthrough-spotlight {
  position: fixed;
  z-index: 34;
  border: 2px solid rgba(34, 211, 238, 0.95);
  border-radius: 24px;
  pointer-events: none;
  box-shadow:
    0 0 0 9999px rgba(3, 7, 18, 0.58),
    0 0 34px rgba(34, 211, 238, 0.5);
  transition: left 180ms ease, top 180ms ease, width 180ms ease, height 180ms ease;
}

.tour-active .tour-highlight {
  position: relative;
  z-index: 35;
  outline: 2px solid rgba(34, 211, 238, 0.95);
  outline-offset: 6px;
  border-radius: 22px;
}

.walkthrough-shot {
  margin: 14px 0;
}

.shot-frame {
  border: 1px solid rgba(255, 255, 255, 0.11);
  border-radius: 22px;
  overflow: hidden;
  background: radial-gradient(circle at top left, rgba(139, 92, 246, 0.26), transparent 55%), #07111f;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.03), 0 16px 34px rgba(0, 0, 0, 0.28);
}

.shot-phone {
  min-height: 192px;
  padding: 12px;
  display: grid;
  gap: 9px;
}

.shot-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-size: 13px;
  font-weight: 900;
}

.shot-top b,
.shot-card em,
.shot-button {
  border-radius: 999px;
  padding: 6px 9px;
  background: rgba(34, 211, 238, 0.18);
  color: #a5f3fc;
  font-size: 11px;
  font-style: normal;
  font-weight: 900;
}

.shot-card,
.shot-task,
.shot-field,
.shot-input,
.shot-select,
.shot-callout {
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px;
  background: rgba(255, 255, 255, 0.08);
}

.shot-card small,
.shot-field small {
  display: block;
  color: var(--accent-2);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 9px;
  font-weight: 900;
}

.shot-card strong,
.shot-task strong,
.shot-field span {
  display: block;
  margin-top: 3px;
  color: var(--text);
  font-size: 13px;
}

.shot-card p,
.shot-task p,
.shot-card li,
.shot-callout,
.shot-input,
.shot-select {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.35;
}

.shot-card ul {
  margin: 8px 0 0;
  padding-left: 16px;
}

.shot-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}

.shot-grid div {
  min-height: 58px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 16px;
  padding: 10px;
  background: linear-gradient(180deg, rgba(34,211,238,0.17), rgba(255,255,255,0.07));
}

.shot-grid strong {
  display: block;
  font-size: 22px;
  line-height: 1;
}

.shot-grid span,
.shot-task footer,
.shot-nav span,
.shot-prompts span {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
}

.shot-task i {
  display: inline-block;
  margin: 0 4px 6px 0;
  border-radius: 999px;
  padding: 3px 6px;
  background: rgba(251, 191, 36, 0.17);
  color: #fde68a;
  font-size: 9px;
  font-style: normal;
  font-weight: 900;
}

.shot-task.compact {
  padding: 9px 10px;
}

.shot-prompts,
.shot-nav {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.shot-prompts span,
.shot-nav span {
  border-radius: 999px;
  padding: 6px 8px;
  background: rgba(255, 255, 255, 0.08);
}

.shot-bubble {
  width: fit-content;
  max-width: 82%;
  border-radius: 15px;
  padding: 8px 10px;
  font-size: 11px;
  line-height: 1.3;
}

.shot-bubble.user {
  justify-self: end;
  background: linear-gradient(135deg, rgba(139,92,246,0.55), rgba(34,211,238,0.25));
}

.shot-bubble.bot {
  background: rgba(255,255,255,0.1);
}

.shot-input.send {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.shot-field.required {
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 0 1px rgba(34, 211, 238, 0.18);
}

.shot-button {
  text-align: center;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #03131f;
}

.shot-button.secondary {
  background: rgba(255,255,255,0.08);
  color: var(--accent-2);
}

.walkthrough-progress {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 16px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 900;
}

#walkthroughDots {
  display: flex;
  gap: 5px;
}

.walkthrough-dot {
  width: 7px;
  height: 7px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
}

.walkthrough-dot.active {
  width: 18px;
  background: var(--accent-2);
}

.walkthrough-actions {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  margin-top: 16px;
}

.walkthrough-actions .primary-button {
  width: 100%;
}

.walkthrough-actions button:disabled {
  opacity: 0.35;
  cursor: default;
}

.empty-state {
  color: var(--muted);
  text-align: center;
  padding: 28px 12px;
}
