:root {
  --bg: #0b0f17;
  --card: #131a26;
  --border: #232c3d;
  --border-subtle: rgba(255, 255, 255, 0.06);
  --text: #e8ecf3;
  --text-muted: #8b95a7;
  --accent: #4f8cff;
  --success: #2e9e5b;
  --danger: #e5484d;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Arial, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app {
  max-width: 480px;
  margin: 0 auto;
  padding: 20px 16px 80px;
  min-height: 100vh;
}

h1 {
  font-size: 20px;
  margin: 4px 0 20px;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px;
  margin-bottom: 14px;
}

.login-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 60px;
}

input[type="text"], input[type="password"], input[type="number"] {
  background: #0e141f;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 10px 12px;
  font-size: 15px;
  width: 100%;
}

input[type="number"] {
  width: 60px;
  text-align: center;
}

button {
  font-family: inherit;
  cursor: pointer;
}

.btn {
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  font-weight: 600;
}

.btn-outline {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 14px;
}

.error-text {
  color: var(--danger);
  font-size: 14px;
  min-height: 18px;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.routine-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 0;
}
.routine-row + .routine-row {
  border-top: 1px solid var(--border-subtle);
}

.routine-check {
  position: relative;
  flex: 0 0 auto;
  width: 26px;
  height: 26px;
  padding: 0;
  border-radius: 50%;
  border: 2px solid var(--border);
  background: transparent;
  color: transparent;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease, transform 0.1s ease;
}
.routine-check::before {
  content: "";
  position: absolute;
  inset: -9px;
}
.routine-check:active { transform: scale(0.92); }
.routine-check.is-done {
  background: var(--success);
  border-color: transparent;
  color: #fff;
}
.routine-check svg { width: 14px; height: 14px; display: block; }

.routine-main { flex: 1; min-width: 0; }
.routine-name {
  font-weight: 600;
  font-size: 15px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.week-row {
  display: flex;
  gap: 6px;
  margin-top: 6px;
}
.week-day {
  position: relative;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1.5px solid var(--border);
  background: transparent;
  color: transparent;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 9px;
}
.week-day::before {
  content: "";
  position: absolute;
  inset: -6px;
}
.week-day.is-done {
  background: var(--success);
  border-color: transparent;
}
.week-day.is-today { border-color: var(--accent); }
.week-day.is-future {
  opacity: 0.35;
  cursor: default;
}
.week-day-label {
  position: absolute;
  bottom: -15px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 9px;
  color: var(--text-muted);
}

.badge {
  flex: 0 0 auto;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 3px 9px;
  font-size: 12px;
  color: var(--text-muted);
}
.badge.is-goal {
  background: var(--success);
  color: #fff;
  border-color: transparent;
}

.empty-state {
  color: var(--text-muted);
  font-size: 14px;
  text-align: center;
  padding: 20px 0;
}

.edit-row {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
}
.edit-row + .edit-row { border-top: 1px solid var(--border-subtle); }
.edit-row input[type="text"] { flex: 1; min-width: 0; }

.add-form {
  display: flex;
  gap: 8px;
  margin-top: 12px;
}
.add-form input[type="text"] { flex: 1; min-width: 0; }

.icon-btn {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  border-radius: 8px;
  width: 34px;
  height: 34px;
  font-size: 18px;
  line-height: 1;
}
