/* ── Theme variables ─────────────────────────────────────── */
:root {
  --bg:                #f1f1f3;
  --card:              #ffffff;
  --accent:            #7c5cbf;
  --accent-tint-bg:    #f0ebf8;
  --accent-tint-border:#d4c5ef;
  --accent-hover:      #6a4dab;
  --text:              #1c1c1e;
  --subtext:           #6e6e73;
  --line:              #e5e5ea;
  --ref-bg:            #f7f5fb;
  --danger:            #d93025;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
}

[data-theme="fresh"] {
  --accent:            #3a7d44;
  --accent-tint-bg:    #eaf3eb;
  --accent-tint-border:#b8d9bd;
  --accent-hover:      #2d6235;
  --bg:                #f2f4f1;
  --ref-bg:            #eff4f0;
}

[data-theme="warm"] {
  --accent:            #c0622a;
  --accent-tint-bg:    #faf0ea;
  --accent-tint-border:#f0cdb8;
  --accent-hover:      #a85222;
  --bg:                #f5f1ee;
  --ref-bg:            #f8f3ef;
}

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

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

/* ── Shared card ─────────────────────────────────────────── */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.05);
  padding: 20px;
}

/* ── Shared form elements ────────────────────────────────── */
label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: var(--subtext);
  letter-spacing: 0.03em;
  text-transform: uppercase;
  margin-bottom: 6px;
}

input[type="text"],
select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--card);
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus,
select:focus {
  border-color: var(--accent);
}

/* ── Shared button ───────────────────────────────────────── */
.btn-primary {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--accent);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 15px;
  font-weight: 600;
  padding: 11px 22px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-primary:hover { background: var(--accent-hover); }

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-tint-bg);
  color: var(--accent);
  border: 1px solid var(--accent-tint-border);
  border-radius: 10px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 7px 14px;
  cursor: pointer;
  transition: background 0.15s;
}
.btn-secondary:hover { background: var(--accent-tint-border); }

/* ── Toggle switch ───────────────────────────────────────── */
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.toggle-row .toggle-label {
  font-size: 15px;
  font-weight: 500;
  color: var(--text);
  text-transform: none;
  letter-spacing: 0;
  margin: 0;
}
.switch {
  position: relative;
  width: 44px;
  height: 26px;
  flex-shrink: 0;
}
.switch input { opacity: 0; width: 0; height: 0; }
.switch-track {
  position: absolute;
  inset: 0;
  background: var(--line);
  border-radius: 13px;
  cursor: pointer;
  transition: background 0.2s;
}
.switch input:checked + .switch-track { background: var(--accent); }
.switch-track::after {
  content: '';
  position: absolute;
  left: 3px;
  top: 3px;
  width: 20px;
  height: 20px;
  background: #fff;
  border-radius: 50%;
  transition: transform 0.2s;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
}
.switch input:checked + .switch-track::after { transform: translateX(18px); }

/* ── Monogram circle ─────────────────────────────────────── */
.monogram {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.03em;
  flex-shrink: 0;
  user-select: none;
}

/* ── Avatar / monogram wrap ──────────────────────────────── */
.avatar-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  flex-shrink: 0;
  cursor: pointer;
}
.avatar-wrap .monogram {
  width: 100%;
  height: 100%;
}
.avatar-img {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  object-fit: cover;
  display: block;
}
.avatar-overlay {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(0,0,0,0.38);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
}
.avatar-wrap:hover .avatar-overlay { opacity: 1; }

/* ── Section divider ─────────────────────────────────────── */
.section-divider {
  height: 1px;
  background: var(--line);
  margin: 24px 0;
}

/* ── Font preference ─────────────────────────────────────── */
[data-font="serif"] {
  --font: Georgia, "Times New Roman", Times, serif;
}

/* ── Text size ───────────────────────────────────────────── */
/* Applied via data-size="large" on <html>; bumps primary content text 2pt */
[data-size="large"] input[type="text"],
[data-size="large"] select,
[data-size="large"] .toggle-label,
[data-size="large"] .btn-primary,
[data-size="large"] .btn-secondary { font-size: 17px; }
[data-size="large"] label { font-size: 14px; }

/* ── Toast notification ──────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 28px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: #1c1c1e;
  color: #fff;
  font-size: 14px;
  font-weight: 500;
  padding: 10px 20px;
  border-radius: 20px;
  opacity: 0;
  transition: transform 0.25s ease, opacity 0.25s ease;
  z-index: 999;
  white-space: nowrap;
}
.toast.show {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
}
