/* ===== Reset & Base ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* Palette = Ethan's personal-app theme (design/DESIGN_IDENTITY.md):
   black/white/grey/cool-blue, grey primary buttons with dark text. */
:root {
  --primary: #C9CFD5;
  --primary-dark: #A9E8BB;
  --primary-light: #1E2124;
  --surface: #151719;
  --surface-alt: #0B0C0E;
  --raised: #1E2124;
  --border: #2B2F34;
  --text: #F2F4F6;
  --text-muted: #98A0A8;
  --text-faint: #7A828A;
  --accent-ice: #A9E8BB;
  --accent-steel: #6FCF93;
  --accent-deep: #3B9E62;
  --success: #6FCF93;
  --success-light: #1E2124;
  --warning: #A9E8BB;
  --warning-light: #1E2124;
  --danger: #C0564F;
  --danger-light: #241B1A;
  --radius: 12px;
  --radius-sm: 10px;
  --shadow: 0 1px 3px rgba(0,0,0,.3), 0 4px 16px rgba(0,0,0,.25);
  --shadow-lg: 0 8px 32px rgba(0,0,0,.45);
}

body {
  font-family: -apple-system, "SF Pro", "Segoe UI", system-ui, sans-serif;
  background: var(--surface-alt);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.5;
}

/* ===== Header ===== */
header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 100;
}

.header-inner {
  max-width: 760px;
  margin: 0 auto;
  padding: 0 20px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 18px;
  color: var(--text);
  text-decoration: none;
}

.logo-icon { display: flex; align-items: center; color: var(--accent-ice); }

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ===== Main ===== */
main {
  max-width: 760px;
  margin: 0 auto;
  padding: 40px 20px 80px;
}

.hero {
  text-align: center;
  margin-bottom: 32px;
}

.hero h1 {
  font-size: clamp(22px, 4vw, 32px);
  font-weight: 700;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}

.subtitle {
  font-size: 16px;
  color: var(--text-muted);
}

/* ===== Banner ===== */
.banner {
  border-radius: var(--radius-sm);
  padding: 12px 16px;
  font-size: 14px;
  margin-bottom: 20px;
}

.banner-warning {
  background: var(--warning-light);
  border: 1px solid var(--accent-steel);
  color: var(--accent-ice);
}

.banner a { color: inherit; font-weight: 600; }

/* ===== Card ===== */
.card {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  overflow: hidden;
}

/* ===== Tabs ===== */
.tab-bar {
  display: flex;
  border-bottom: 1px solid var(--border);
  background: var(--surface-alt);
}

.tab {
  flex: 1;
  padding: 14px 20px;
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.tab:hover { color: var(--text); background: var(--surface); }

.tab.active {
  color: var(--text);
  background: var(--surface);
  border-bottom-color: var(--accent-steel);
}

/* ===== Tab Content ===== */
.tab-content { display: none; padding: 28px; }
.tab-content.active { display: block; }

/* ===== Natural Language ===== */
.nl-textarea {
  width: 100%;
  font-family: inherit;
  font-size: 16px;
  color: var(--text);
  background: var(--surface-alt);
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
  resize: vertical;
  transition: border-color 0.15s, box-shadow 0.15s;
  line-height: 1.5;
}

.nl-area .label-hint {
  display: block;
  margin-top: 6px;
}

.nl-textarea:focus {
  outline: none;
  border-color: var(--accent-ice);
  box-shadow: 0 0 0 3px rgba(169, 232, 187, .15);
  background: var(--surface);
}

/* Parsed preview */
.nl-preview {
  background: var(--primary-light);
  border: 1px solid var(--accent-deep);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  margin-top: 12px;
  font-size: 14px;
}

.nl-preview .preview-row {
  display: flex;
  gap: 8px;
  margin-bottom: 4px;
}

.nl-preview .preview-row:last-child { margin-bottom: 0; }

.preview-label {
  font-weight: 600;
  color: var(--accent-ice);
  min-width: 60px;
}

.preview-val { color: var(--text); }

/* Guest email row */
.guest-email-row {
  margin-top: 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.guest-email-row label,
.form-group label {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* ===== Form ===== */
.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.form-group { display: flex; flex-direction: column; gap: 6px; }
.form-group.full-width { grid-column: 1 / -1; }

.label-hint {
  font-weight: 400;
  font-size: 12px;
  color: var(--text-faint);
}

input[type="email"],
input[type="text"],
input[type="date"],
input[type="time"],
select,
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 15px;
  color: var(--text);
  background: var(--surface-alt);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input[type="date"], input[type="time"] { color-scheme: dark; }

input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent-ice);
  box-shadow: 0 0 0 3px rgba(169, 232, 187, .15);
  background: var(--surface);
}

textarea { resize: vertical; }

/* ===== Buttons ===== */
.form-actions { margin-top: 20px; display: flex; justify-content: flex-end; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  border-radius: var(--radius-sm);
  padding: 11px 22px;
  border: none;
  cursor: pointer;
  transition: all 0.15s;
  text-decoration: none;
}

.btn-primary {
  background: var(--primary);
  color: #0B0C0E;
}

.btn-primary:hover { background: var(--primary-dark); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled { opacity: 0.55; cursor: not-allowed; transform: none; }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1.5px solid var(--border);
}

.btn-ghost:hover { background: var(--surface-alt); color: var(--text); }

.btn-sm { font-size: 13px; padding: 7px 14px; }

.btn.loading { opacity: 0.7; cursor: wait; }

.full-width { width: 100%; justify-content: center; }

/* ===== Toast ===== */
.toast {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  border-radius: var(--radius);
  padding: 16px 18px;
  margin-top: 20px;
  box-shadow: var(--shadow-lg);
  border: 1px solid;
  animation: slideIn 0.25s ease;
}

@keyframes slideIn {
  from { opacity: 0; transform: translateY(-8px); }
  to { opacity: 1; transform: translateY(0); }
}

.toast-success {
  background: var(--success-light);
  border-color: var(--accent-deep);
}

.toast-icon { font-size: 22px; flex-shrink: 0; }

.toast-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  font-size: 14px;
}

.toast-body strong { font-size: 15px; color: var(--text); }
.toast-body span { color: var(--text-muted); }

.toast-close {
  background: none;
  border: none;
  font-size: 20px;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  flex-shrink: 0;
}

/* ===== Error ===== */
.error-msg {
  background: var(--danger-light);
  border: 1px solid var(--danger);
  color: #E8A9A4;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-size: 14px;
  margin-top: 12px;
  white-space: pre-line; /* multi-reminder errors list one failed line per row */
}

/* ===== Reminders List ===== */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 40px 0 16px;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
}

.reminders-list { display: flex; flex-direction: column; gap: 10px; }

.reminder-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,.05);
}

.reminder-card.sent { opacity: 0.5; }

.reminder-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--accent-steel);
  margin-top: 5px;
  flex-shrink: 0;
}

.reminder-card.sent .reminder-dot { background: var(--accent-deep); }

.reminder-info { flex: 1; min-width: 0; }

.reminder-subject {
  font-weight: 600;
  font-size: 15px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.reminder-meta {
  font-size: 13px;
  color: var(--text-muted);
  margin-top: 2px;
}

.reminder-actions { flex-shrink: 0; }

.btn-delete {
  background: none;
  border: none;
  color: var(--text-faint);
  font-size: 18px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 6px;
  transition: all 0.15s;
}

.btn-delete:hover { background: var(--danger-light); color: var(--danger); }

.loading-state, .empty-state {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
  font-size: 15px;
}

/* ===== Auth ===== */
.auth-user {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  color: var(--text-muted);
}

.auth-email { font-weight: 500; color: var(--text); }

/* ===== Modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, .65);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 100%;
  max-width: 420px;
  padding: 32px;
  position: relative;
}

.modal h2 { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
.modal > p { font-size: 14px; color: var(--text-muted); margin-bottom: 24px; }

.modal-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: none;
  border: none;
  font-size: 22px;
  color: var(--text-faint);
  cursor: pointer;
  line-height: 1;
  padding: 4px;
}

.code-hint {
  font-size: 14px;
  color: var(--text-muted);
  margin-bottom: 16px;
}

.code-input {
  font-size: 28px !important;
  font-weight: 700 !important;
  letter-spacing: 8px;
  text-align: center;
  padding: 16px !important;
}

/* ===== Suggestions FAB ===== */
.suggestions-fab {
  position: fixed;
  bottom: 28px;
  right: 28px;
  border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--border);
  box-shadow: var(--shadow-lg);
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  padding: 10px 18px 10px 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 9px;
  transition: all 0.15s;
  z-index: 50;
  color: var(--text);
}

.suggestions-fab .fab-bulb {
  font-size: 26px;
  line-height: 1;
}

.suggestions-fab .fab-text {
  text-align: left;
  line-height: 1.25;
}

.suggestions-fab:hover {
  transform: scale(1.1);
  box-shadow: 0 12px 40px rgba(0,0,0,.16);
}

/* ===== Responsive ===== */
@media (max-width: 560px) {
  .form-grid { grid-template-columns: 1fr; }
  .form-group.full-width { grid-column: 1; }
  .tab { font-size: 13px; padding: 12px 12px; }
  .tab-content { padding: 20px 16px; }
}
.guest-email-row a, .form-group a { color: var(--accent-ice); }
