:root {
  --bg: #f7f7fb;
  --surface: #ffffff;
  --surface-2: #f1f1f8;
  --border: #e4e4ec;
  --text: #1a1a2e;
  --text-muted: #6b6b80;
  --accent: #6366f1;
  --accent-hover: #4f46e5;
  --accent-soft: #eef0ff;
  --danger: #ef4444;
  --success: #22c55e;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(20, 20, 40, 0.04), 0 8px 24px rgba(20, 20, 40, 0.06);
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Roboto, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f0f17;
    --surface: #171721;
    --surface-2: #1e1e2b;
    --border: #2a2a3a;
    --text: #f0f0f5;
    --text-muted: #9797ad;
    --accent: #818cf8;
    --accent-hover: #a5b0fb;
    --accent-soft: #23233a;
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.2), 0 8px 24px rgba(0, 0, 0, 0.35);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.wrap {
  max-width: 640px;
  margin: 0 auto;
  padding: 24px 20px 80px;
}

/* Auth screen (login) */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.auth-card {
  width: 100%;
  max-width: 380px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 36px 32px;
  text-align: center;
}

.logo {
  font-size: 32px;
  margin-bottom: 4px;
}

.auth-card h1 {
  font-size: 20px;
  margin: 8px 0 4px;
}

.auth-card p {
  color: var(--text-muted);
  font-size: 14px;
  margin: 0 0 24px;
}

/* Top bar */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 0 28px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 700;
  font-size: 16px;
}

.topbar .user-email {
  color: var(--text-muted);
  font-size: 13px;
}

/* Cards */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  margin-bottom: 20px;
}

.card h2 {
  font-size: 15px;
  margin: 0 0 4px;
}

.card .hint {
  color: var(--text-muted);
  font-size: 13px;
  margin: 0 0 18px;
}

/* Forms */
input[type="email"],
input[type="text"] {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
}

input:focus {
  outline: none;
  border-color: var(--accent);
}

label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 6px;
  color: var(--text-muted);
}

.field { margin-bottom: 16px; }

textarea {
  width: 100%;
  padding: 11px 14px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--text);
  font-size: 14px;
  font-family: inherit;
  resize: vertical;
  min-height: 60px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: 10px;
  border: none;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: background 0.15s ease, transform 0.05s ease;
}

.btn:active { transform: scale(0.98); }

.btn-primary {
  background: var(--accent);
  color: white;
  width: 100%;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
}
.btn-secondary:hover { background: var(--border); }

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  padding: 6px 10px;
  font-size: 13px;
}
.btn-ghost:hover { color: var(--text); }

/* Package picker */
.packages {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

@media (max-width: 520px) {
  .packages { grid-template-columns: 1fr; }
}

.package {
  border: 2px solid var(--border);
  border-radius: 12px;
  padding: 18px 14px;
  text-align: center;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.1s ease;
  background: var(--surface-2);
}

.package:hover { border-color: var(--accent); transform: translateY(-2px); }
.package.selected { border-color: var(--accent); background: var(--accent-soft); }

.package .name { font-weight: 700; font-size: 15px; margin-bottom: 4px; }
.package .price { color: var(--text-muted); font-size: 13px; margin-bottom: 10px; }
.package .desc { color: var(--text-muted); font-size: 12px; line-height: 1.5; }

/* Outlook connect */
.connect-box {
  text-align: center;
  padding: 20px 10px;
}
.connect-box .icon { font-size: 40px; margin-bottom: 12px; }

/* Categories */
.category-list { display: flex; flex-direction: column; gap: 10px; }

.category-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--surface-2);
}

.color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 0 3px rgba(0,0,0,0.03);
}

.category-info { flex: 1; min-width: 0; }
.category-name { font-weight: 600; font-size: 14px; display: flex; align-items: center; gap: 6px; }
.category-desc { color: var(--text-muted); font-size: 12.5px; margin-top: 2px; }

.badge {
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 6px;
  border-radius: 5px;
}

/* Toggle switch */
.switch {
  position: relative;
  width: 42px;
  height: 24px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  inset: 0;
  background: var(--border);
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.2s ease;
}
.slider::before {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  left: 3px;
  top: 3px;
  background: white;
  border-radius: 50%;
  transition: transform 0.2s ease;
  box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.switch input:checked + .slider { background: var(--accent); }
.switch input:checked + .slider::before { transform: translateX(18px); }

/* Add category form */
.color-swatches {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.color-swatch {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  border: 2px solid transparent;
}
.color-swatch.selected { border-color: var(--text); }

.divider {
  border: none;
  border-top: 1px solid var(--border);
  margin: 18px 0;
}

.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--text);
  color: var(--bg);
  padding: 12px 20px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: var(--shadow);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
}
.toast.show { opacity: 1; }

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