:root {
  --bg: #eef3f7;
  --panel: #ffffff;
  --line: #d6e0ea;
  --text: #102033;
  --muted: #6b7b8d;
  --accent: #0f7792;
  --accent-dark: #07546a;
  --soft: #e8f5f8;
  --green: #dff3e7;
  --yellow: #fff5cf;
  --red: #ffe0e5;
  color: var(--text);
  font-family: Inter, "Segoe UI", "Microsoft YaHei", Arial, sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

button,
input,
textarea {
  font: inherit;
}

.hidden {
  display: none !important;
}

.mobile-shell {
  display: grid;
  grid-template-rows: auto minmax(0, 1fr);
  min-height: 100dvh;
  max-width: 720px;
  margin: 0 auto;
  background: #f8fbfd;
  box-shadow: 0 0 0 1px rgba(16, 32, 51, 0.06);
}

.mobile-topbar {
  position: sticky;
  top: 0;
  z-index: 7;
  background: var(--panel);
  box-shadow: 0 8px 18px rgba(16, 32, 51, 0.06);
}

.mobile-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: calc(14px + env(safe-area-inset-top)) 16px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.mobile-header h1 {
  margin: 0;
  font-size: 22px;
  letter-spacing: 0;
}

.mobile-header small {
  display: block;
  margin-top: 3px;
  color: var(--muted);
  font-weight: 650;
}

.eyebrow {
  margin: 0 0 2px;
  color: var(--accent-dark);
  font-size: 12px;
  font-weight: 850;
  text-transform: uppercase;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.mobile-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  padding: 10px 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
}

.checklist-tab-group {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 38px;
  gap: 4px;
}

.mobile-tab,
.ghost-button,
.primary-button {
  min-height: 38px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  color: var(--text);
  font-weight: 800;
  text-align: center;
}

.mobile-tab.active,
.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.dropdown-tab {
  padding: 0;
  font-size: 16px;
}

.ghost-button {
  min-height: 34px;
  padding: 0 10px;
  color: var(--accent-dark);
}

.message-stream {
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: auto;
  min-height: 0;
  padding: 14px 12px 104px;
  scroll-padding-top: 132px;
}

.bubble {
  width: min(92%, 620px);
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: 0 8px 20px rgba(16, 32, 51, 0.05);
}

.bubble.system,
.bubble.user {
  margin-left: auto;
}

.bubble.user {
  border-color: #b8dfe8;
  background: var(--soft);
}

.bubble.alert {
  border-color: #f2bcc8;
  background: var(--red);
}

.bubble-content {
  display: grid;
  gap: 8px;
  padding: 12px;
}

.bubble-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  font-weight: 900;
}

.bubble-meta {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}

.bubble-text {
  line-height: 1.55;
  white-space: pre-wrap;
  word-break: break-word;
}

.pill-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.pill {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #f6f9fb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 750;
}

.pill.green {
  border-color: #a8dbc0;
  background: var(--green);
  color: #16653b;
}

.pill.yellow {
  border-color: #efd26b;
  background: var(--yellow);
  color: #755100;
}

.pill.red {
  border-color: #f0aab7;
  background: var(--red);
  color: #8e1f32;
}

.project-card,
.checklist-card,
.trash-card {
  display: grid;
  gap: 8px;
}

.item-row {
  display: grid;
  gap: 6px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.item-row.done {
  background: var(--green);
}

.checklist-row {
  grid-template-columns: 28px minmax(0, 1fr);
  align-items: center;
}

.checklist-row input[type="checkbox"] {
  width: 20px;
  height: 20px;
  accent-color: var(--accent);
}

.checklist-row-body {
  display: grid;
  gap: 6px;
  min-width: 0;
}

.collapse-button,
.checklist-collapse-button {
  min-height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #f8fbfd;
  color: var(--accent-dark);
  font-weight: 850;
}

.mobile-composer {
  position: fixed;
  right: auto;
  bottom: 0;
  left: 50%;
  z-index: 8;
  width: min(720px, 100vw);
  transform: translateX(-50%);
  display: grid;
  grid-template-columns: minmax(0, 1fr) 72px;
  gap: 8px;
  padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
  background: var(--panel);
  border-top: 1px solid var(--line);
  box-shadow: 0 -12px 24px rgba(16, 32, 51, 0.08);
}

.mobile-composer textarea {
  width: 100%;
  max-height: 110px;
  min-height: 42px;
  resize: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 12px;
  background: #f8fbfd;
  color: var(--text);
}

.mobile-auth {
  position: fixed;
  inset: 0;
  z-index: 10;
  display: grid;
  place-items: center;
  padding: 18px;
  background: var(--bg);
}

.auth-card {
  display: grid;
  gap: 14px;
  width: min(420px, 100%);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 22px;
  background: var(--panel);
  box-shadow: 0 18px 42px rgba(16, 32, 51, 0.12);
}

.auth-card h1 {
  margin: 0;
  font-size: 26px;
}

.auth-card p {
  margin: 4px 0 0;
  color: var(--muted);
}

.auth-card label {
  display: grid;
  gap: 6px;
  font-weight: 800;
}

.auth-card input {
  min-height: 42px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 11px;
}

.auth-message {
  min-height: 20px;
  color: #9a2639 !important;
  font-weight: 750;
}

.empty-note {
  color: var(--muted);
  text-align: center;
}

@media (max-width: 420px) {
  .mobile-header {
    align-items: flex-start;
  }

  .header-actions {
    flex-direction: column;
  }

  .mobile-tabs {
    gap: 6px;
    padding-inline: 8px;
  }

  .mobile-tab {
    font-size: 14px;
  }
}
