*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --green: #16a34a;
  --green-light: #dcfce7;
  --red: #dc2626;
  --red-light: #fee2e2;
  --blue: #2563eb;
  --purple: #7c3aed;
  --amber: #d97706;
  --bg: #f3f4f6;
  --card: #ffffff;
  --border: #e5e7eb;
  --text: #111827;
  --muted: #6b7280;
  --radius: 14px;
  --nav-h: 66px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --shadow: 0 1px 4px rgba(0,0,0,.08), 0 4px 16px rgba(0,0,0,.06);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.08);
}

html, body {
  min-height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: var(--bg);
  color: var(--text);
}

body {
  overflow-x: hidden;
  overflow-y: auto;
}

.form-group { margin-bottom: 14px; }

.form-group label {
  display: block;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 6px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .4px;
}

.form-group input,
.form-group textarea,
.form-group select {
  width: 100%;
  padding: 13px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: 15px;
  outline: none;
  transition: border .2s, box-shadow .2s;
  background: var(--bg);
  color: var(--text);
}

.form-group input:focus,
.form-group textarea:focus,
.form-group select:focus {
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
  background: white;
}

.btn {
  width: 100%;
  padding: 14px;
  background: var(--text);
  color: white;
  border: none;
  border-radius: var(--radius);
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: .2px;
}

.btn:hover { opacity: .88; transform: translateY(-1px); }
.btn:active { transform: translateY(0); }

.btn-outline {
  background: none;
  color: var(--text);
  border: 2px solid var(--border);
}

.btn-outline:hover {
  border-color: var(--text);
  background: none;
}

.btn-sm {
  width: auto;
  padding: 9px 18px;
  font-size: 13px;
}

.btn-danger { background: var(--red); }

.error-msg {
  color: var(--red);
  font-size: 13px;
  margin-top: 8px;
  min-height: 18px;
  font-weight: 500;
}

.page-title {
  font-size: 32px;
  font-weight: 900;
  color: var(--text);
  margin-bottom: 20px;
  letter-spacing: -.5px;
  line-height: 1.06;
}

.char-count {
  font-size: 12px;
  color: var(--muted);
  text-align: right;
  margin-top: 5px;
}

.profile-note {
  font-size: 13px;
  line-height: 1.6;
  color: var(--muted);
  margin-bottom: 12px;
}

#toast {
  position: fixed;
  bottom: calc(82px + var(--safe-bottom));
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: #1f2937;
  color: white;
  padding: 12px 22px;
  border-radius: 22px;
  font-size: 14px;
  font-weight: 600;
  opacity: 0;
  transition: all .3s;
  pointer-events: none;
  z-index: 999;
  white-space: nowrap;
  box-shadow: 0 4px 16px rgba(0,0,0,.25);
}

#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.analysis-empty,
.notes-empty,
.habit-manage-empty {
  color: var(--muted);
}
