:root {
  --ink: #0a0a0b;          /* near-black: text, primary buttons */
  --ink-2: #2b2b30;
  --muted: #6b6b73;        /* secondary text */
  --line: #e6e6ea;         /* borders */
  --bg: #ffffff;
  --bg-soft: #f6f6f7;      /* light section fill */
  --accent: #4f46e5;       /* one restrained indigo accent, used sparingly */
  --accent-soft: #eef0fd;
  --gold: #c79a3f;         /* tiny sparkle accent only */
  --ok-bg: #e9f7ef; --ok-ink: #146c43;
  --err-bg: #fdecec; --err-ink: #b42318;
}

* { box-sizing: border-box; }

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  letter-spacing: -0.011em;
}

/* ---------- top nav ---------- */
.nav { border-bottom: 1px solid #1d1d22; background: var(--ink); position: sticky; top: 0; z-index: 40; }
.nav-inner { max-width: 1080px; margin: 0 auto; height: 64px; display: flex; align-items: center;
             padding: 0 24px; }
.brand { display: inline-flex; align-items: center; gap: 9px; text-decoration: none; color: #fff; }
.brand .logo { width: 26px; height: 26px; color: #fff; }
.wordmark-wrap { position: relative; display: inline-flex; align-items: center; }
.wordmark-wrap .swish { position: absolute; left: -14px; top: 50%; transform: translateY(-50%);
                        width: 168px; height: 44px; z-index: 2; opacity: 0.55;
                        pointer-events: none; overflow: visible; }
.brand .wordmark { position: relative; z-index: 1; font-size: 21px; font-weight: 700; color: #fff;
                   letter-spacing: -0.02em; }
.brand .wordmark .dot { color: #9a9aa3; font-weight: 600; }
.nav-spacer { flex: 1; }

/* account avatar + dropdown */
.account-menu { position: relative; }
.avatar-btn { margin: 0; padding: 0; width: 38px; height: 38px; border-radius: 50%;
              background: #1c1c22; color: #fff; border: 1px solid #34343c;
              display: inline-flex; align-items: center; justify-content: center; cursor: pointer;
              overflow: hidden; transition: border-color .12s, background .12s; }
.avatar-btn:hover { background: #26262e; border-color: #4a4a54; }
.avatar-btn svg { width: 34px; height: 34px; display: block; }
.menu-pop { position: absolute; top: calc(100% + 10px); right: 0; min-width: 220px;
            background: #fff; border: 1px solid var(--line); border-radius: 12px;
            box-shadow: 0 18px 44px -16px rgba(0,0,0,.32); padding: 6px; z-index: 60;
            opacity: 0; visibility: hidden; transform: translateY(-4px);
            transition: opacity .12s, transform .12s; }
.account-menu.open .menu-pop { opacity: 1; visibility: visible; transform: none; }
.menu-pop .menu-email { padding: 9px 12px 8px; font-size: 12.5px; color: var(--muted);
                        font-weight: 600; border-bottom: 1px solid var(--line);
                        margin-bottom: 4px; overflow: hidden; text-overflow: ellipsis;
                        white-space: nowrap; }
.menu-pop a { display: block; padding: 9px 12px; border-radius: 8px; font-size: 14px;
              font-weight: 500; color: var(--ink); text-decoration: none; }
.menu-pop a:hover { background: var(--bg-soft); color: var(--ink); }

/* account settings view */
.back-link { display: inline-flex; align-items: center; gap: 5px; font-size: 14px;
             font-weight: 600; color: var(--muted); text-decoration: none; margin-bottom: 10px; }
.back-link:hover { color: var(--ink); }
.settings-list { margin: 16px 0; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; }
.settings-row { display: grid; grid-template-columns: 200px 1fr; gap: 16px; padding: 14px 18px;
                border-bottom: 1px solid var(--line); align-items: baseline; }
.settings-row:last-child { border-bottom: none; }
.settings-row dt { color: var(--muted); font-size: 13px; font-weight: 700;
                   text-transform: uppercase; letter-spacing: .03em; margin: 0; }
.settings-row dd { margin: 0; font-size: 15px; }
.settings-row dd .empty { color: #a3a3ad; }
@media (max-width: 540px) { .settings-row { grid-template-columns: 1fr; gap: 4px; } }

/* admin db table — full width */
.admin-wrap { width: 100vw; position: relative; left: 50%; right: 50%;
              margin-left: -50vw; margin-right: -50vw; padding: 0 24px 48px; }
.admin-table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 12px; }
table.admin { width: 100%; border-collapse: collapse; font-size: 13px; }
table.admin th, table.admin td { padding: 10px 14px; text-align: left; vertical-align: top;
                                 border-bottom: 1px solid var(--line); white-space: nowrap; }
table.admin th { background: var(--bg-soft); font-weight: 700; font-size: 12px;
                 text-transform: uppercase; letter-spacing: .03em; color: var(--muted);
                 position: sticky; top: 0; }
table.admin td.wrap-cell { white-space: normal; min-width: 200px; }
table.admin tr:last-child td { border-bottom: none; }
table.admin tbody tr:hover { background: #fafafb; }

/* ---------- layout ---------- */
.wrap { max-width: 600px; margin: 0 auto; padding: 40px 24px 72px; }
.card { background: #fff; }

h1 { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; margin: 0; }
h2 { font-size: 26px; font-weight: 800; letter-spacing: -0.03em; margin: 18px 0 6px; }
h3 { font-size: 17px; font-weight: 700; letter-spacing: -0.02em; margin: 18px 0 8px; }
.muted { color: var(--muted); font-size: 15px; }
a { color: var(--ink); text-decoration: underline; text-underline-offset: 2px; font-weight: 600; }
a:hover { color: var(--accent); }
code { background: var(--bg-soft); padding: 1px 6px; border-radius: 6px; font-size: 13px;
       font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- form controls ---------- */
label { display: block; margin: 16px 0 0; font-weight: 600; font-size: 14px; }
input, select, textarea {
  display: block; width: 100%; margin-top: 7px; padding: 13px 14px;
  font-family: inherit; font-size: 16px; font-weight: 400; color: var(--ink);
  border: 1px solid #cdcdd4; border-radius: 10px; background: #fff;
  transition: border-color .12s, box-shadow .12s;
}
input::placeholder, textarea::placeholder { color: #a3a3ad; }
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(10,10,11,.12);
}
textarea { font-family: ui-monospace, Menlo, monospace; font-size: 13px; }

button {
  font-family: inherit; margin-top: 20px; padding: 13px 22px; font-size: 16px; font-weight: 600;
  color: #fff; background: var(--ink); border: 1px solid var(--ink); border-radius: 10px; cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
button:hover { background: #2b2b30; border-color: #2b2b30; }
button.primary { width: 100%; padding: 15px; }
.button { display: inline-block; padding: 12px 20px; border-radius: 10px; color: #fff;
          background: var(--ink); font-weight: 600; text-decoration: none; }
.button:hover { background: #2b2b30; color: #fff; }
button.ghost { background: #fff; color: var(--ink); border: 1px solid #cdcdd4; }
button.ghost:hover { background: var(--bg-soft); border-color: #b6b6bf; }
button[disabled] { opacity: .4; cursor: not-allowed; }

fieldset { border: none; margin: 0; padding: 0; }
legend { font-weight: 800; font-size: 22px; letter-spacing: -0.02em; padding: 0; }

/* rows (people / shared calendars / recipients) */
.person-row, .extra-row, .recipient-row { display: flex; gap: 8px; align-items: center; margin-top: 10px; }
.person-row input, .extra-row input, .recipient-row input, .person-row select { margin-top: 0; }
.people-grid { display: grid; grid-template-columns: 1fr 170px 36px; gap: 8px; align-items: center; }
.extra-grid  { display: grid; grid-template-columns: 1fr 1.4fr 36px; gap: 8px; align-items: center; }

/* auto-discovered calendars (onboarding) */
.cal-row { display: grid; grid-template-columns: 1fr 170px; gap: 10px; align-items: center;
           padding: 11px 0; border-bottom: 1px solid var(--line); }
.cal-row:last-child { border-bottom: none; }
.cal-pick { display: flex; align-items: center; gap: 10px; margin: 0; font-weight: 500; cursor: pointer; }
.cal-pick input { width: auto; margin: 0; }
.cal-row .cal-owner { margin-top: 0; }
.row-headers { margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--muted);
               text-transform: uppercase; letter-spacing: .04em; }
.row-headers .muted { text-transform: none; letter-spacing: 0; font-weight: 400; }

button.add, button.link-button {
  background: #fff; color: var(--ink); border: 1px solid #cdcdd4; padding: 10px 14px; margin-top: 12px;
  font-size: 14px;
}
button.add:hover { background: var(--bg-soft); }
button.remove { flex: 0 0 auto; margin-top: 0; color: var(--muted); padding: 9px 11px;
                background: #fff; border: 1px solid var(--line); }
button.remove:hover { color: var(--err-ink); border-color: #f0c8c8; background: #fff; }
button.link-button { border: none; padding: 0; margin-top: 8px; text-decoration: underline; }

/* ---------- flashes ---------- */
.flashes { margin: 6px 0 12px; }
.flash { padding: 12px 16px; border-radius: 10px; margin-bottom: 8px; font-size: 14px; font-weight: 500; }
.flash-info { background: var(--ok-bg); color: var(--ok-ink); }
.flash-error { background: var(--err-bg); color: var(--err-ink); }

.topbar { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 13px; }
.inline-form { display: inline; }
.steps li { margin: 8px 0; }

.cta { margin: 18px 0; padding: 20px 22px; border-radius: 14px; background: var(--bg-soft);
       border: 1px solid var(--line); }
.cta h3 { margin-top: 0; }
.email-preview { width: 100%; height: 520px; border: 1px solid var(--line); border-radius: 12px; background: #fff; }

/* ---------- help tooltip ---------- */
.help { position: relative; display: inline-flex; align-items: center; justify-content: center;
        width: 16px; height: 16px; margin-left: 6px; border-radius: 50%;
        background: var(--bg-soft); color: var(--muted); font-size: 11px; font-weight: 700;
        border: 1px solid var(--line); cursor: help; vertical-align: middle; }
.help .tip { position: absolute; bottom: 135%; left: 50%; transform: translateX(-50%);
  width: 264px; background: var(--ink); color: #fff; font-weight: 400; text-transform: none;
  letter-spacing: normal; font-size: 12.5px; line-height: 1.55; text-align: left;
  padding: 13px 15px; border-radius: 12px; box-shadow: 0 18px 40px -16px rgba(0,0,0,.5);
  opacity: 0; visibility: hidden; transition: opacity .12s; z-index: 50; pointer-events: none; }
.help .tip::after { content: ""; position: absolute; top: 100%; left: 50%; transform: translateX(-50%);
  border: 6px solid transparent; border-top-color: var(--ink); }
.help:hover .tip, .help:focus .tip, .help:focus-within .tip { opacity: 1; visibility: visible; }
.help .tip strong { color: #fff; }
.help .tip ol { margin: 6px 0 0; padding-left: 18px; }
.help .tip li { margin: 4px 0; }

/* ---------- hero ---------- */
.hero { margin: 4px 0 22px; border-radius: 16px; overflow: hidden; background: var(--bg-soft);
        border: 1px solid var(--line); }
.hero svg { display: block; width: 100%; height: auto; }
.hero-copy { padding: 0 2px 2px; }
.hero-copy h1 { font-size: 36px; line-height: 1.08; margin: 8px 0 8px; }
.hero-copy .muted { font-size: 16px; max-width: 46ch; }
.fairy-bob { animation: bob 4.5s ease-in-out infinite; transform-box: fill-box; transform-origin: center; }
@keyframes bob { 0%,100% { transform: translateY(0); } 50% { transform: translateY(-5px); } }

/* ---------- wizard ---------- */
.wizard-step { display: none; }
.wizard-step.active { display: block; animation: fade .2s ease both; }
@keyframes fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.step-kicker { font-size: 12px; font-weight: 700; color: var(--muted); letter-spacing: .06em;
               text-transform: uppercase; }
.optional-pill { font-size: 11px; font-weight: 600; color: var(--muted); background: var(--bg-soft);
                 border: 1px solid var(--line); border-radius: 999px; padding: 2px 9px; margin-left: 6px;
                 vertical-align: middle; }

.wizard-nav { display: flex; align-items: center; gap: 12px; margin-top: 26px; }
.wizard-nav .spacer { flex: 1; }
.field-error { color: var(--err-ink); font-size: 13px; font-weight: 600; margin-top: 8px; min-height: 1em; }

.progress-wrap { margin-top: 24px; }
.progress-meta { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600;
                 color: var(--muted); margin-bottom: 7px; }
.progress { position: relative; height: 8px; border-radius: 999px; background: #ededf0; overflow: hidden; }
.progress .bar { position: absolute; inset: 0 auto 0 0; width: 0%; border-radius: 999px;
                 background: var(--accent); transition: width .4s cubic-bezier(.2,.8,.2,1); }
.progress.full .bar { background: var(--ok-ink); }

@media (max-width: 560px) {
  .people-grid, .extra-grid { grid-template-columns: 1fr; }
  .row-headers.people-grid, .row-headers.extra-grid { display: none; }
  .hero-copy h1 { font-size: 30px; }
  .wrap { padding: 28px 18px 56px; }
}
