:root {
  color-scheme: dark;
  --bg: #111314;
  --surface: #1a1d1d;
  --surface-2: #222625;
  --line: #303635;
  --text: #f4f2ec;
  --muted: #aaa69b;
  --soft: #d9d0bd;
  --green: #55d17d;
  --blue: #79b8ff;
  --yellow: #f1c766;
  --danger: #ff786f;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.28);
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--bg);
}

body {
  min-height: 100%;
  margin: 0;
  background:
    linear-gradient(180deg, rgba(121, 184, 255, 0.09), transparent 260px),
    var(--bg);
  color: var(--text);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

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

.topbar {
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  gap: 12px;
  align-items: center;
  padding: 16px 0 12px;
}

.topbar h1,
.section-heading h2,
.hero-panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: 26px;
  line-height: 1.05;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.muted {
  color: var(--muted);
}

.icon-button {
  display: grid;
  width: 44px;
  height: 44px;
  place-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(26, 29, 29, 0.82);
  color: var(--text);
  box-shadow: var(--shadow);
}

.icon-button > span:first-child {
  display: grid;
  width: 28px;
  height: 28px;
  place-items: center;
  border-radius: 50%;
  background: var(--soft);
  color: #151515;
  font-weight: 800;
}

.status-ok > span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 0 5px rgba(85, 209, 125, 0.13);
}

.status-warn > span {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--yellow);
  box-shadow: 0 0 0 5px rgba(241, 199, 102, 0.13);
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.hero-panel,
.section-block,
.drop-zone,
.notice,
.settings-list {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(26, 29, 29, 0.9);
  box-shadow: var(--shadow);
}

.hero-panel {
  display: grid;
  gap: 22px;
  padding: 20px;
}

.hero-panel h2 {
  font-size: 31px;
  line-height: 1.05;
}

.hero-panel p:last-child {
  margin-bottom: 0;
}

.hero-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.primary-action,
.secondary-action,
.small-button,
.text-button {
  min-height: 42px;
  border-radius: 8px;
  border: 1px solid transparent;
  font-weight: 750;
}

.primary-action {
  background: var(--text);
  color: #151515;
}

.secondary-action,
.small-button {
  border-color: var(--line);
  background: var(--surface-2);
  color: var(--text);
}

.text-button {
  min-height: 34px;
  padding: 0 10px;
  border-color: transparent;
  background: transparent;
  color: var(--blue);
}

.quick-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 12px 0;
}

.metric-card {
  min-height: 126px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

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

.metric-card strong {
  display: block;
  margin: 13px 0 7px;
  font-size: 25px;
}

.section-block {
  padding: 16px;
}

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

.section-heading h2 {
  font-size: 22px;
}

.sticky-heading {
  position: sticky;
  top: 0;
  z-index: 4;
  padding: 10px 0;
  background: linear-gradient(180deg, var(--bg) 76%, rgba(17, 19, 20, 0));
}

.activity-list,
.task-list,
.file-list,
.chat-thread {
  display: grid;
  gap: 10px;
}

.activity-item,
.task-item,
.file-item,
.message,
.empty-chat {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface);
}

.activity-item,
.task-item,
.file-item {
  padding: 14px;
}

.activity-item {
  display: grid;
  grid-template-columns: 10px 1fr;
  gap: 12px;
}

.activity-dot {
  width: 10px;
  height: 10px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--blue);
}

.activity-item h3,
.task-item h3,
.file-item h3,
.drop-zone h3 {
  margin: 0 0 5px;
  font-size: 16px;
}

.activity-item p,
.task-item p,
.file-item p,
.drop-zone p,
.notice p {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.chat-thread {
  min-height: calc(100dvh - 230px);
  align-content: end;
  padding-bottom: 12px;
}

.empty-chat {
  align-self: end;
  padding: 20px;
}

.empty-chat h3 {
  margin: 0 0 8px;
  font-size: 24px;
  line-height: 1.1;
}

.empty-chat p:last-child {
  margin: 0;
  color: var(--muted);
  line-height: 1.45;
}

.message {
  width: fit-content;
  max-width: 86%;
  padding: 13px 14px;
  line-height: 1.4;
}

.message.agent {
  background: var(--surface);
}

.message.user {
  justify-self: end;
  background: #ecdfc4;
  color: #171717;
}

.message.pending {
  color: var(--muted);
}

.message-meta {
  display: block;
  margin-bottom: 4px;
  color: var(--yellow);
  font-size: 12px;
  font-weight: 800;
}

.composer {
  position: sticky;
  bottom: calc(74px + env(safe-area-inset-bottom));
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 10px;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(26, 29, 29, 0.96);
  box-shadow: var(--shadow);
}

.composer input,
.settings-list input,
.settings-list select {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101212;
  color: var(--text);
  outline: none;
}

.composer input {
  height: 46px;
  padding: 0 14px;
}

.send-button {
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 8px;
  background: var(--green);
  color: #111;
  font-size: 22px;
  font-weight: 900;
}

.task-item {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  align-items: center;
}

.task-pill {
  padding: 7px 9px;
  border-radius: 999px;
  background: rgba(85, 209, 125, 0.12);
  color: var(--green);
  font-size: 12px;
  font-weight: 800;
}

.drop-zone {
  display: grid;
  place-items: center;
  min-height: 230px;
  padding: 24px;
  text-align: center;
}

.upload-symbol {
  display: grid;
  width: 56px;
  height: 56px;
  margin-bottom: 14px;
  place-items: center;
  border-radius: 8px;
  background: var(--surface-2);
  color: var(--yellow);
  font-size: 32px;
}

.file-list {
  margin-top: 12px;
}

.settings-list {
  display: grid;
  gap: 12px;
  padding: 14px;
}

.settings-list label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
}

.settings-list input,
.settings-list select {
  width: 100%;
  min-height: 44px;
  padding: 0 12px;
}

.toggle-row {
  grid-template-columns: 1fr auto;
  align-items: center;
}

.toggle-row input {
  width: 22px;
  min-height: 22px;
}

.notice {
  margin-top: 12px;
  padding: 16px;
}

.notice strong {
  display: block;
  margin-bottom: 6px;
}

.bottom-nav {
  position: fixed;
  right: max(12px, calc((100vw - 520px) / 2 + 12px));
  bottom: max(10px, env(safe-area-inset-bottom));
  left: max(12px, calc((100vw - 520px) / 2 + 12px));
  z-index: 10;
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 4px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(21, 23, 23, 0.94);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.bottom-nav button {
  display: grid;
  min-width: 0;
  min-height: 54px;
  place-items: center;
  border: 0;
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}

.bottom-nav button.active {
  background: var(--surface-2);
  color: var(--text);
}

.bottom-nav span {
  font-size: 11px;
  font-weight: 750;
}

@media (min-width: 760px) {
  .app-shell {
    padding-top: 24px;
  }

  .hero-panel {
    grid-template-columns: 1.35fr 0.8fr;
    align-items: end;
  }
}
