:root {
  --bg: #f7f5ef;
  --panel: #ffffff;
  --ink: #1f2933;
  --muted: #667085;
  --line: #d7d9df;
  --accent: #256f5d;
  --accent-soft: #dcefe8;
  --danger: #b42318;
  --shadow: 0 16px 50px rgba(31, 41, 51, 0.08);
  font-family: "Aptos", "Segoe UI", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    linear-gradient(90deg, rgba(31, 41, 51, 0.04) 1px, transparent 1px),
    linear-gradient(rgba(31, 41, 51, 0.04) 1px, transparent 1px),
    var(--bg);
  background-size: 32px 32px;
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

button {
  border: 1px solid var(--line);
  background: var(--panel);
  color: var(--ink);
  min-height: 38px;
  padding: 0 14px;
  cursor: pointer;
}

button:hover {
  border-color: var(--accent);
}

button[type="submit"],
.auth-actions button:first-child {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

input,
select {
  border: 1px solid var(--line);
  background: white;
  color: var(--ink);
  min-height: 38px;
  padding: 0 10px;
}

.shell {
  width: min(1180px, calc(100vw - 32px));
  margin: 0 auto;
  padding: 40px 0;
}

.hidden {
  display: none !important;
}

.auth-panel,
.app-view {
  background: rgba(255, 255, 255, 0.92);
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
}

.auth-panel {
  width: min(520px, 100%);
  margin: 10vh auto 0;
  padding: 28px;
}

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

h1 {
  margin: 0;
  font-size: 1.7rem;
  line-height: 1.1;
}

.auth-form {
  display: grid;
  gap: 14px;
  margin-top: 28px;
}

.auth-form label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 0.9rem;
}

.auth-actions,
.topbar-actions,
.habit-form {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.message {
  min-height: 22px;
  margin: 12px 0 0;
  color: var(--danger);
}

.app-view {
  min-height: calc(100vh - 80px);
  padding: 22px;
}

.topbar {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
  border-bottom: 1px solid var(--line);
  padding-bottom: 18px;
}

.habit-form {
  align-items: center;
  padding: 18px 0;
  border-bottom: 1px solid var(--line);
}

#habit-name {
  min-width: min(320px, 100%);
  flex: 1;
}

#habit-color {
  width: 48px;
  padding: 2px;
}

.weekday-picker {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  color: var(--muted);
  font-size: 0.85rem;
}

.weekday-picker label {
  display: flex;
  align-items: center;
  gap: 4px;
}

.summary-strip {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  margin: 18px 0;
}

.summary-strip div {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
}

.summary-strip div + div {
  border-left: 1px solid var(--line);
}

.summary-strip span {
  color: var(--muted);
}

.grid-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: white;
}

.habit-grid {
  min-width: 860px;
}

.grid-row {
  display: grid;
  grid-template-columns: 220px repeat(7, 86px) 160px 52px;
}

.grid-cell {
  min-height: 48px;
  border-right: 1px solid var(--line);
  border-bottom: 1px solid var(--line);
  display: grid;
  align-items: center;
  padding: 8px;
}

.grid-header {
  background: #f2f4f7;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
}

.habit-name {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
}

.color-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.check-cell {
  justify-items: center;
}

.check-cell input {
  width: 22px;
  height: 22px;
  min-height: 22px;
}

.off-day {
  background: repeating-linear-gradient(135deg, #f7f7f7, #f7f7f7 5px, #eeeeee 5px, #eeeeee 10px);
}

.progress {
  display: grid;
  gap: 6px;
}

.progress-track {
  height: 8px;
  background: #e6e8ee;
  border: 1px solid var(--line);
}

.progress-fill {
  height: 100%;
  background: var(--accent);
  width: 0;
}

.delete-button {
  width: 34px;
  min-height: 34px;
  padding: 0;
  color: var(--danger);
}

@media (max-width: 760px) {
  .shell {
    width: min(100vw - 20px, 1180px);
    padding: 10px 0;
  }

  .app-view,
  .auth-panel {
    padding: 16px;
  }

  .topbar {
    align-items: start;
    flex-direction: column;
  }

  .summary-strip {
    grid-template-columns: 1fr;
  }

  .summary-strip div + div {
    border-left: 0;
    border-top: 1px solid var(--line);
  }
}
