:root {
  --ink: #101820;
  --muted: #66707b;
  --line: #d9ddd6;
  --paper: #f6f5ef;
  --surface: #ffffff;
  --accent: #0f766e;
  --accent-2: #b45309;
  --danger: #b42318;
  --blue: #2563eb;
  --shadow: 0 14px 36px rgba(16, 24, 32, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
}

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

button {
  border: 0;
  cursor: pointer;
}

#app {
  min-height: 100vh;
  padding: env(safe-area-inset-top) 0 calc(84px + env(safe-area-inset-bottom));
}

.locked {
  display: none;
}

.auth-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    linear-gradient(145deg, rgba(15, 118, 110, 0.13), transparent 44%),
    linear-gradient(315deg, rgba(180, 83, 9, 0.13), transparent 38%),
    var(--paper);
}

.auth-screen.locked {
  display: none;
}

.auth-panel {
  width: min(420px, 100%);
  display: grid;
  gap: 12px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.auth-panel h1 {
  font-size: 32px;
}

.auth-panel .primary {
  width: 100%;
}

.language-select {
  width: 78px;
  min-height: 38px;
  padding: 8px 10px;
  font-weight: 800;
}

.error {
  min-height: 20px;
  margin: -4px 0 0;
  color: var(--danger);
  font-size: 13px;
  font-weight: 700;
}

.auth-note {
  margin: 0;
  padding: 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef3f0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.35;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.auth-actions button,
.auth-actions a {
  min-height: 34px;
  padding: 0 10px;
  display: inline-grid;
  place-items: center;
  background: transparent;
  color: var(--accent);
  font-size: 13px;
  font-weight: 800;
  text-decoration: none;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: 44px 1fr 44px;
  align-items: center;
  gap: 12px;
  padding: 14px 16px 12px;
  background: rgba(246, 245, 239, 0.92);
  backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(217, 221, 214, 0.8);
}

.eyebrow {
  margin: 0;
  color: var(--accent);
  font-size: 12px;
  font-weight: 800;
}

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

h1 {
  margin-bottom: 0;
  font-size: 26px;
  line-height: 1.05;
}

.content {
  width: min(960px, 100%);
  margin: 0 auto;
  padding: 16px;
}

.grid {
  display: grid;
  gap: 12px;
}

.cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 2px 10px rgba(16, 24, 32, 0.04);
}

.stat {
  min-height: 92px;
}

.stat b {
  display: block;
  font-size: 24px;
}

.stat span,
.muted {
  color: var(--muted);
}

.row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.list {
  display: grid;
  gap: 8px;
}

.item {
  display: grid;
  grid-template-columns: 30px 1fr auto;
  gap: 10px;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px;
}

.item.done .title {
  color: var(--muted);
  text-decoration: line-through;
}

.item .meta {
  color: var(--muted);
  font-size: 12px;
}

.check {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--line);
  background: #fff;
}

.done .check {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

.chip-row {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.chip {
  flex: 0 0 auto;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: #fff;
  color: var(--ink);
}

.chip.active {
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.icon-button {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
}

.primary {
  min-height: 46px;
  padding: 0 14px;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-weight: 800;
}

.secondary {
  min-height: 38px;
  padding: 0 12px;
  border-radius: 8px;
  color: var(--ink);
  background: #eef3f0;
}

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

.tabs {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 8;
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
  padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
  background: rgba(255, 255, 255, 0.94);
  border-top: 1px solid var(--line);
  backdrop-filter: blur(18px);
}

.tabs button {
  display: grid;
  place-items: center;
  gap: 3px;
  min-width: 0;
  min-height: 54px;
  border-radius: 8px;
  color: var(--muted);
  background: transparent;
}

.tabs button.active {
  color: var(--ink);
  background: #eef3f0;
}

.tabs small {
  font-size: 11px;
  white-space: nowrap;
}

.money-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 12px;
}

.bar {
  height: 12px;
  overflow: hidden;
  border-radius: 999px;
  background: #e6e8df;
}

.bar > span {
  display: block;
  height: 100%;
  background: var(--accent);
}

.chat {
  display: grid;
  gap: 10px;
  padding-bottom: 12px;
}

.bubble {
  max-width: 86%;
  padding: 11px 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
  line-height: 1.4;
}

.bubble.user {
  justify-self: end;
  background: var(--ink);
  color: #fff;
  border-color: var(--ink);
}

.composer {
  position: sticky;
  bottom: 86px;
  display: grid;
  grid-template-columns: 1fr 46px;
  gap: 8px;
  padding-top: 8px;
  background: var(--paper);
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
  color: var(--ink);
  padding: 12px;
}

textarea {
  min-height: 94px;
  resize: vertical;
}

label {
  display: grid;
  gap: 6px;
  margin-bottom: 12px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

dialog {
  width: min(520px, calc(100% - 24px));
  border: 0;
  border-radius: 10px;
  padding: 0;
  background: transparent;
}

dialog::backdrop {
  background: rgba(16, 24, 32, 0.42);
}

.modal-card {
  background: var(--paper);
  border-radius: 10px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.modal-head {
  display: grid;
  grid-template-columns: 1fr 42px;
  gap: 12px;
  align-items: center;
  margin-bottom: 12px;
}

.modal-head h2 {
  margin: 0;
}

svg {
  width: 21px;
  height: 21px;
  stroke: currentColor;
  stroke-width: 2;
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.setup-page {
  padding-bottom: 32px;
}

.code-block {
  overflow-x: auto;
  margin: 0;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #101820;
  color: #f6f5ef;
  font: 13px/1.5 ui-monospace, SFMono-Regular, Consolas, monospace;
}

@media (min-width: 720px) {
  #app {
    padding-bottom: 0;
  }

  .tabs {
    left: 50%;
    right: auto;
    bottom: 18px;
    width: min(780px, calc(100% - 32px));
    transform: translateX(-50%);
    border: 1px solid var(--line);
    border-radius: 12px;
    box-shadow: var(--shadow);
  }

  .content {
    padding-bottom: 118px;
  }

  .composer {
    bottom: 100px;
  }
}
