:root {
  --bg: #14091f;
  --surface: #1f1230;
  --surface-2: #2a1a40;
  --accent: #9d5cff;
  --accent-2: #f972a5;
  --text: #f3edfb;
  --text-dim: #b6a8ce;
  --border: #382653;
  --danger: #ff6b6b;
  --success: #4ade80;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  min-height: 100vh;
  -webkit-text-size-adjust: 100%;
}

#app {
  max-width: 560px;
  margin: 0 auto;
  padding-bottom: env(safe-area-inset-bottom, 0);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: calc(env(safe-area-inset-top, 0) + 14px) 16px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.topbar h1 {
  font-size: 1.1rem;
  margin: 0;
  flex: 1;
}

.back-btn {
  background: none;
  border: none;
  color: var(--accent-2);
  font-size: 1rem;
  padding: 4px 0;
  cursor: pointer;
}

.tabs {
  display: flex;
  gap: 4px;
  padding: 8px 16px;
  border-bottom: 1px solid var(--border);
}

.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: 10px;
  color: var(--text-dim);
  background: none;
  border: none;
  font-size: 0.95rem;
  cursor: pointer;
}

.tab.active {
  background: var(--surface-2);
  color: var(--text);
  font-weight: 600;
}

main {
  flex: 1;
  padding: 12px 16px 40px;
}

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

.card.clickable {
  cursor: pointer;
}

.card .name {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 4px;
}

.card .preview {
  color: var(--text-dim);
  font-size: 0.92rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.card .meta {
  color: var(--text-dim);
  font-size: 0.78rem;
  margin-top: 6px;
}

.badge {
  background: var(--accent-2);
  color: #1b0f2e;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 999px;
  padding: 2px 9px;
}

.empty-state {
  text-align: center;
  color: var(--text-dim);
  padding: 60px 20px;
}

.login-screen {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 24px;
  gap: 16px;
}

.login-screen h1 { margin-bottom: 4px; }

input[type="password"], input[type="text"], textarea, input[type="search"] {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  width: 100%;
  font-family: inherit;
}

textarea {
  min-height: 140px;
  resize: vertical;
  line-height: 1.4;
}

button.primary, button.secondary, button.danger {
  border: none;
  border-radius: 12px;
  padding: 13px 16px;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
}

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

button.danger {
  background: transparent;
  color: var(--danger);
  border: 1px solid var(--danger);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

.btn-row {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
  margin: 22px 0 8px;
}

.msg-line {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.92rem;
}

.msg-line:last-child { border-bottom: none; }

.msg-line .who {
  font-weight: 600;
  margin-right: 6px;
}

.msg-line .year-tag {
  color: var(--accent-2);
  font-weight: 700;
  margin-right: 6px;
}

.error-text {
  color: var(--danger);
  font-size: 0.9rem;
  min-height: 1.2em;
}

.status-pill {
  display: inline-block;
  font-size: 0.75rem;
  padding: 2px 10px;
  border-radius: 999px;
  font-weight: 700;
}

.status-pill.sent { background: rgba(74, 222, 128, 0.15); color: var(--success); }
.status-pill.skipped { background: rgba(255, 107, 107, 0.15); color: var(--danger); }

.notif-banner {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.notif-banner button {
  width: auto;
  padding: 8px 14px;
  font-size: 0.85rem;
}

.search-row {
  margin-bottom: 12px;
}

/* option picker, banners, birthdays screen */
.seg {
  display: flex;
  gap: 6px;
  margin-bottom: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 4px;
}

.seg-btn {
  flex: 1;
  background: none;
  border: none;
  color: var(--text-dim);
  font-size: 0.95rem;
  padding: 9px 4px;
  border-radius: 9px;
  cursor: pointer;
}

.seg-btn.active {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 700;
}

.warn-banner {
  background: rgba(255, 107, 107, 0.12);
  border: 1px solid var(--danger);
  border-radius: 12px;
  padding: 12px 14px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  line-height: 1.35;
}

.hint {
  color: var(--text-dim);
  font-size: 0.88rem;
  line-height: 1.4;
  margin: 0 0 12px;
}

details.card summary {
  cursor: pointer;
  font-weight: 600;
}

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

.add-form select, .add-form input[type="number"] {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 1rem;
  width: 100%;
}

.row2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.link-danger {
  background: none;
  border: none;
  color: var(--danger);
  font-size: 0.85rem;
  padding: 8px 0 0;
  cursor: pointer;
}

.tab { font-size: 0.85rem; padding: 8px 4px; }

.warn-banner { overflow-wrap: anywhere; }
