:root {
  --bg: #f6f8f5;
  --surface: #ffffff;
  --surface-strong: #eef4f2;
  --text: #172221;
  --muted: #62706d;
  --border: #d8e1dc;
  --primary: #113f46;
  --primary-2: #1c6670;
  --accent: #d95f3c;
  --success: #27724a;
  --warning: #b28516;
  --danger: #b73535;
  --shadow: 0 18px 46px rgb(17 63 70 / 12%);
  color-scheme: light;
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

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

body {
  min-height: 100svh;
  margin: 0;
  background:
    linear-gradient(180deg, rgb(238 244 242 / 92%) 0, rgb(246 248 245 / 100%) 380px),
    var(--bg);
  color: var(--text);
  letter-spacing: 0;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

svg {
  display: block;
  width: 1.2rem;
  height: 1.2rem;
  fill: none;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2.2;
}

[hidden] {
  display: none !important;
}

.app-shell {
  min-height: 100svh;
  padding: max(20px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
    max(28px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
}

.auth-view,
.todo-view {
  width: min(100%, 720px);
  margin: 0 auto;
}

.auth-view {
  min-height: calc(100svh - 48px);
  display: grid;
  align-content: center;
  gap: 18px;
}

.auth-brand {
  display: flex;
  justify-content: center;
}

.brand-mark {
  display: grid;
  width: 64px;
  height: 64px;
  place-items: center;
  border: 1px solid rgb(255 255 255 / 72%);
  border-radius: 8px;
  background: var(--primary);
  color: #fff;
  box-shadow: var(--shadow);
}

.brand-mark svg {
  width: 34px;
  height: 34px;
  stroke-width: 2.6;
}

.auth-panel,
.compose-panel,
.todo-item,
.account-sheet,
.summary-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
}

.auth-panel {
  padding: 22px;
  box-shadow: var(--shadow);
}

.auth-heading {
  margin-bottom: 18px;
}

.eyebrow {
  margin: 0 0 6px;
  color: var(--accent);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

h1,
h2,
p {
  overflow-wrap: anywhere;
}

h1,
h2 {
  margin: 0;
  line-height: 1.06;
}

h1 {
  font-size: 2.15rem;
}

h2 {
  font-size: 1.35rem;
}

.auth-tabs,
.filter-row,
.segmented-control {
  display: grid;
  padding: 4px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.auth-tabs {
  grid-template-columns: 1fr 1fr;
  margin-bottom: 18px;
}

.tab-button,
.filter-button,
.segmented-control span {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--muted);
  font-weight: 750;
}

.tab-button.is-active,
.filter-button.is-active,
.segmented-control input:checked + span {
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 1px 8px rgb(23 34 33 / 9%);
}

.auth-form,
.compose-panel,
.sheet-actions {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 700;
}

input {
  width: 100%;
  min-height: 46px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: #fff;
  color: var(--text);
  padding: 0 13px;
  outline: none;
}

input:focus-visible,
button:focus-visible {
  outline: 3px solid rgb(217 95 60 / 30%);
  outline-offset: 2px;
}

.primary-button,
.secondary-button,
.danger-button {
  min-height: 46px;
  border: 0;
  border-radius: 8px;
  padding: 0 16px;
  font-weight: 800;
}

.primary-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  background: var(--primary);
  color: #fff;
}

.primary-button:hover {
  background: var(--primary-2);
}

.secondary-button {
  border: 1px solid var(--border);
  background: var(--surface-strong);
  color: var(--text);
}

.danger-button {
  background: #fdebea;
  color: var(--danger);
}

.form-message {
  min-height: 22px;
  margin: 14px 0 0;
  color: var(--danger);
  font-weight: 700;
}

.topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin: 12px 0 18px;
}

.muted {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.94rem;
}

.icon-button {
  display: inline-grid;
  width: 46px;
  height: 46px;
  flex: 0 0 auto;
  place-items: center;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--primary);
}

.icon-button:hover {
  border-color: var(--primary-2);
}

.icon-button.small {
  width: 38px;
  height: 38px;
}

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

.compose-panel {
  padding: 14px;
}

.task-field span {
  color: var(--muted);
}

.compose-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
}

.segmented-control {
  grid-template-columns: 1fr 1fr;
}

.segmented-control label {
  display: block;
  font-size: 0.92rem;
}

.segmented-control input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.segmented-control span {
  display: grid;
  min-width: 88px;
  place-items: center;
  padding: 0 12px;
}

.add-button {
  min-width: 104px;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin: 14px 0;
}

.summary-card {
  min-height: 76px;
  padding: 12px;
}

.summary-card span {
  display: block;
  color: var(--primary);
  font-size: 1.6rem;
  font-weight: 850;
  line-height: 1;
}

.summary-card p {
  margin: 7px 0 0;
  color: var(--muted);
  font-size: 0.86rem;
  font-weight: 750;
}

.filter-row {
  grid-template-columns: repeat(4, 1fr);
  gap: 4px;
  margin-bottom: 14px;
}

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

.todo-item {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  min-height: 76px;
  padding: 12px;
}

.todo-item.is-complete {
  background: #f9fbfa;
}

.check-button {
  display: grid;
  width: 38px;
  height: 38px;
  place-items: center;
  border: 2px solid var(--border);
  border-radius: 50%;
  background: #fff;
  color: transparent;
}

.todo-item.is-complete .check-button {
  border-color: var(--success);
  background: var(--success);
  color: #fff;
}

.todo-content {
  min-width: 0;
}

.todo-title {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  font-weight: 800;
  line-height: 1.25;
}

.todo-item.is-complete .todo-title {
  color: var(--muted);
  text-decoration: line-through;
  text-decoration-thickness: 2px;
}

.todo-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}

.badge {
  display: inline-flex;
  align-items: center;
  min-height: 24px;
  border-radius: 999px;
  padding: 0 9px;
  background: #edf2ef;
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 800;
}

.badge.success {
  background: #e7f5ec;
  color: var(--success);
}

.todo-actions {
  display: flex;
  gap: 7px;
}

.edit-form {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 8px;
}

.edit-form input {
  min-height: 38px;
}

.empty-state {
  margin: 24px 0 0;
  color: var(--muted);
  text-align: center;
  font-weight: 750;
}

.account-sheet {
  position: fixed;
  right: max(16px, env(safe-area-inset-right));
  bottom: max(16px, env(safe-area-inset-bottom));
  left: max(16px, env(safe-area-inset-left));
  z-index: 10;
  width: min(420px, calc(100% - 32px));
  margin-left: auto;
  padding: 16px;
  box-shadow: var(--shadow);
}

.sheet-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 16px;
}

.profile-block {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  padding: 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface-strong);
}

.profile-initial {
  display: grid;
  width: 44px;
  height: 44px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 8px;
  background: var(--accent);
  color: #fff;
  font-weight: 900;
}

.profile-name {
  margin: 0;
  font-weight: 850;
}

.sheet-actions {
  margin-top: 14px;
}

@media (max-width: 560px) {
  .app-shell {
    padding-top: max(14px, env(safe-area-inset-top));
  }

  h1 {
    font-size: 1.85rem;
  }

  .compose-row,
  .todo-item,
  .edit-form {
    grid-template-columns: 1fr;
  }

  .todo-actions {
    justify-content: flex-end;
  }

  .check-button {
    justify-self: start;
  }

  .add-button {
    width: 100%;
  }
}

@media (min-width: 860px) {
  .auth-view {
    grid-template-columns: 220px minmax(0, 420px);
    align-items: center;
    justify-content: center;
  }

  .auth-brand {
    justify-content: flex-end;
  }
}

@media (min-width: 980px) {
  .todo-view {
    width: min(100%, 960px);
  }

  .todo-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .todo-item {
    min-height: 110px;
  }
}
