:root {
  color-scheme: light;
  --bg: #f4f1ea;
  --ink: #12201c;
  --muted: #66736d;
  --panel: #ffffff;
  --line: #d9ded8;
  --accent: #1f7a5a;
  --accent-strong: #14513c;
  --warn: #a66013;
  --danger: #9b2e2e;
  --shadow: 0 18px 48px rgba(18, 32, 28, 0.10);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

button,
input {
  font: inherit;
}

.app-shell {
  width: min(1080px, calc(100% - 32px));
  margin: 0 auto;
  padding: 24px 0 48px;
}

.topbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  padding: 12px 0 20px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 40px;
}

h2 {
  margin-bottom: 0;
  font-size: 22px;
}

.sync-status {
  min-width: 168px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.72);
  padding: 10px 12px;
  border-radius: 8px;
  color: var(--muted);
  text-align: center;
}

.sync-status.is-online {
  color: var(--accent-strong);
}

.sync-status.is-offline {
  color: var(--warn);
}

.panel {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  box-shadow: var(--shadow);
  margin-bottom: 18px;
}

.auth-panel {
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(320px, 1.1fr);
  gap: 22px;
  align-items: start;
}

.auth-copy p:last-child {
  color: var(--muted);
  margin-bottom: 0;
}

.auth-form,
.profile-actions {
  display: grid;
  gap: 12px;
}

.auth-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.form-message {
  min-height: 20px;
  color: var(--warn);
  margin: 0;
}

.profile-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(320px, 0.9fr);
  gap: 18px;
  align-items: end;
}

.profile-actions {
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: end;
}

.muted {
  color: var(--muted);
  margin-bottom: 0;
}

.habit-form {
  display: grid;
  grid-template-columns: 1.1fr 1fr auto;
  gap: 12px;
  align-items: end;
}

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

input {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 10px 12px;
  color: var(--ink);
}

button {
  min-height: 40px;
  border: 1px solid var(--accent);
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  padding: 9px 13px;
  cursor: pointer;
}

button.secondary {
  background: #fff;
  color: var(--accent-strong);
}

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

.habit-list {
  display: grid;
  gap: 12px;
}

.habit-item {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
}

.habit-main {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.habit-title {
  margin: 0 0 4px;
  font-size: 18px;
}

.habit-minimum {
  color: var(--muted);
  margin: 0;
}

.badge {
  border-radius: 999px;
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
  white-space: nowrap;
}

.badge.done {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.badge.partial,
.badge.reset {
  border-color: var(--warn);
  color: var(--warn);
}

.badge.skip {
  border-color: var(--danger);
  color: var(--danger);
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
}

.actions button {
  min-height: 36px;
}

.actions button:not(:first-child) {
  background: #fff;
  color: var(--accent-strong);
}

.note-row {
  margin-top: 12px;
}

.note-row input {
  width: 100%;
}

.empty-state {
  border: 1px dashed var(--line);
  border-radius: 8px;
  color: var(--muted);
  padding: 20px;
}

@media (max-width: 760px) {
  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: 32px;
  }

  .sync-status {
    width: 100%;
  }

  .habit-form {
    grid-template-columns: 1fr;
  }

  .auth-panel,
  .profile-panel,
  .profile-actions {
    grid-template-columns: 1fr;
  }

  .auth-actions {
    display: grid;
  }
}
