/* Iconic Days
 *
 * The look comes straight from the logo: four soft crayon colors, everything
 * outlined in the same warm charcoal, rounded letters, and a sticker-like
 * offset shadow on anything you can press.
 */

@font-face {
  font-family: 'Fredoka';
  src: url('/fonts/fredoka.woff2') format('woff2');
  font-weight: 300 700;
  font-display: swap;
}
@font-face {
  font-family: 'Graduate';
  src: url('/fonts/graduate.woff2') format('woff2');
  font-weight: 400;
  font-display: swap;
}
@font-face {
  font-family: 'Nunito';
  src: url('/fonts/nunito.woff2') format('woff2');
  font-weight: 200 1000;
  font-display: swap;
}

:root {
  /* Sampled from the logo art. */
  --green: #81C884;
  --blue: #70B2E2;
  --yellow: #FFEC88;
  --coral: #E57173;
  --ink: #3A3A3C;

  /* Deeper versions for text and focus rings, which need more contrast than
     the pastel fills can give on white. */
  --blue-deep: #2F7DB8;
  --green-deep: #3E8E44;
  --coral-deep: #C24648;

  --paper: #FFFDF6;
  --card: #FFFFFF;
  --muted: #6B6B70;
  --line: #E6E1D6;
  --tint-blue: #EAF4FB;
  --tint-green: #EDF7EE;
  --tint-yellow: #FFF9DB;
  --tint-coral: #FCECEC;

  --outline: 2.5px solid var(--ink);
  --sticker: 3px 3px 0 var(--ink);
  --radius: 18px;
  --radius-sm: 12px;

  --font-display: 'Fredoka', 'Nunito', system-ui, sans-serif;
  --font-body: 'Nunito', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; height: auto; }
h1, h2, h3 { font-family: var(--font-display); font-weight: 600; line-height: 1.15; margin: 0 0 .4em; }
h1 { font-size: 2rem; }
h2 { font-size: 1.35rem; }
p { margin: 0 0 1em; }
[hidden] { display: none !important; }

:focus-visible { outline: 3px solid var(--blue-deep); outline-offset: 2px; border-radius: 6px; }

.link { color: var(--blue-deep); font-weight: 700; text-decoration-thickness: 2px; text-underline-offset: 3px; }
.link:hover { color: var(--ink); }
.lede { font-size: 1.05rem; color: var(--muted); }
.hint { display: block; font-size: .88rem; color: var(--muted); margin-top: 4px; }
.optional { font-weight: 400; color: var(--muted); }

/* ------------------------------- buttons -------------------------------- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: 600 1.05rem/1 var(--font-display);
  padding: 13px 22px;
  border: var(--outline);
  border-radius: 999px;
  box-shadow: var(--sticker);
  cursor: pointer;
  text-decoration: none;
  color: var(--ink);
  background: var(--card);
  transition: transform .08s ease, box-shadow .08s ease, background .15s;
}
.btn:hover { transform: translate(-1px, -1px); box-shadow: 4px 4px 0 var(--ink); }
.btn:active { transform: translate(2px, 2px); box-shadow: 1px 1px 0 var(--ink); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; box-shadow: var(--sticker); }
.btn-primary { background: var(--blue); }
.btn-primary:hover { background: #82BEE8; }
.btn-secondary { background: var(--yellow); }
.btn-green { background: var(--green); }
.btn-green:hover { background: #93D196; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px;
  border: 0; border-radius: 50%;
  background: transparent; color: var(--ink); cursor: pointer;
}
.icon-btn:hover { background: var(--tint-blue); }

/* -------------------------------- forms --------------------------------- */

.field { display: block; margin-bottom: 16px; }
.label { display: block; font-weight: 800; margin-bottom: 6px; }
input[type=text], input[type=email], input[type=password] {
  width: 100%;
  font: inherit;
  padding: 12px 14px;
  border: 2px solid #C9C4BA;
  border-radius: var(--radius-sm);
  background: #fff;
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
input:focus { outline: none; border-color: var(--blue-deep); box-shadow: 0 0 0 4px var(--tint-blue); }
input::placeholder { color: #A9A59D; }

.password-wrap { position: relative; display: block; }
.password-wrap input { padding-right: 70px; }
.reveal {
  position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
  font: 700 .85rem var(--font-body); color: var(--blue-deep);
  background: none; border: 0; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.reveal:hover { background: var(--tint-blue); }

.check { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; cursor: pointer; }
.check input { width: 18px; height: 18px; accent-color: var(--blue-deep); }

.form-error {
  background: var(--tint-coral);
  border: 2px solid var(--coral);
  color: #8E2A2C;
  border-radius: var(--radius-sm);
  padding: 10px 14px;
  font-weight: 700;
}
.row-between { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 18px; }

/* --------------------------------- cards -------------------------------- */

.card {
  background: var(--card);
  border: var(--outline);
  border-radius: var(--radius);
  box-shadow: 5px 5px 0 var(--ink);
  padding: 28px;
}

/* ------------------------------ sign-in pages ---------------------------- */

.auth { display: grid; grid-template-columns: 1.05fr 1fr; min-height: 100vh; }
.auth-art {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 48px 32px;
  background:
    radial-gradient(circle at 20% 20%, var(--tint-yellow) 0 18%, transparent 19%),
    radial-gradient(circle at 85% 80%, var(--tint-green) 0 22%, transparent 23%),
    var(--tint-blue);
  border-right: var(--outline);
}
.auth-logo { width: min(340px, 70%); position: relative; z-index: 1; }
.auth-pitch {
  position: relative; z-index: 1;
  max-width: 340px; margin-top: 24px; text-align: center;
  font: 500 1.2rem/1.4 var(--font-display);
}
.auth-panel { display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 40px 24px; }
.auth-logo-small { display: none; width: 240px; margin-bottom: 24px; }
.auth-card { width: 100%; max-width: 420px; }
.auth-card h1 { font-size: 1.9rem; }
.auth-switch { text-align: center; margin: 18px 0 0; }
/* "New to Iconic Days?" between the Sign in and Sign up buttons. */
.or-line { display: flex; align-items: center; gap: 12px; margin: 18px 0 14px; color: var(--muted); font-size: .9rem; font-weight: 700; }
.or-line::before, .or-line::after { content: ''; flex: 1; border-top: 2px dashed var(--line); }
.done { text-align: center; }
.done .btn { margin-top: 8px; }
.done-badge {
  width: 72px; height: 72px; margin: 0 auto 14px;
  display: grid; place-items: center; font-size: 34px;
  background: var(--yellow); border: var(--outline); border-radius: 50%;
}
.dev-note { background: var(--tint-yellow); border: 2px dashed #D9C45A; border-radius: var(--radius-sm); padding: 8px 12px; font-size: .9rem; }

/* The floating doodles, drawn in the logo's style. */
.doodle {
  position: absolute; width: 64px; height: 64px;
  background: center / contain no-repeat;
  animation: bob 6s ease-in-out infinite;
  animation-delay: calc(var(--i) * -1s);
  opacity: .95;
}
.doodle-heart  { top: 9%;  left: 10%; transform: rotate(-12deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M32 54C18 44 8 35 8 23c0-8 6-13 13-13 5 0 9 3 11 7 2-4 6-7 11-7 7 0 13 5 13 13 0 12-10 21-24 31z' fill='%23E57173' stroke='%233A3A3C' stroke-width='3.5' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.doodle-star   { top: 14%; right: 12%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M32 6l7.6 16.2 17.4 2.2-12.8 12.1 3.3 17.4L32 45.4 16.5 53.9l3.3-17.4L7 24.4l17.4-2.2z' fill='%23FFEC88' stroke='%233A3A3C' stroke-width='3.5' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.doodle-flower { bottom: 12%; left: 8%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cg fill='%2381C884' stroke='%233A3A3C' stroke-width='3.5'%3E%3Ccircle cx='32' cy='16' r='10'/%3E%3Ccircle cx='47' cy='27' r='10'/%3E%3Ccircle cx='41' cy='45' r='10'/%3E%3Ccircle cx='23' cy='45' r='10'/%3E%3Ccircle cx='17' cy='27' r='10'/%3E%3C/g%3E%3Ccircle cx='32' cy='32' r='8' fill='%23FFEC88' stroke='%233A3A3C' stroke-width='3.5'/%3E%3C/svg%3E"); }
.doodle-note   { bottom: 18%; right: 9%; transform: rotate(10deg);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Cpath d='M22 12l30-5v36' fill='none' stroke='%233A3A3C' stroke-width='5' stroke-linecap='round' stroke-linejoin='round'/%3E%3Cpath d='M22 12v34' fill='none' stroke='%233A3A3C' stroke-width='5' stroke-linecap='round'/%3E%3Cellipse cx='16' cy='47' rx='8' ry='6.5' fill='%2381C884' stroke='%233A3A3C' stroke-width='3.5'/%3E%3Cellipse cx='46' cy='44' rx='8' ry='6.5' fill='%2381C884' stroke='%233A3A3C' stroke-width='3.5'/%3E%3C/svg%3E"); }
.doodle-gift   { top: 48%; left: 4%; width: 52px; height: 52px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Crect x='10' y='26' width='44' height='30' rx='4' fill='%23FFEC88' stroke='%233A3A3C' stroke-width='3.5'/%3E%3Crect x='6' y='17' width='52' height='11' rx='3' fill='%23FFEC88' stroke='%233A3A3C' stroke-width='3.5'/%3E%3Crect x='27' y='17' width='10' height='39' fill='%23E57173' stroke='%233A3A3C' stroke-width='3.5'/%3E%3Cpath d='M32 17c-4-9-15-10-14-3 1 4 8 3 14 3zm0 0c4-9 15-10 14-3-1 4-8 3-14 3z' fill='%23E57173' stroke='%233A3A3C' stroke-width='3.5' stroke-linejoin='round'/%3E%3C/svg%3E"); }
.doodle-smile  { top: 44%; right: 5%; width: 56px; height: 56px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='25' fill='%23FFEC88' stroke='%233A3A3C' stroke-width='3.5'/%3E%3Ccircle cx='24' cy='27' r='3.5' fill='%233A3A3C'/%3E%3Ccircle cx='40' cy='27' r='3.5' fill='%233A3A3C'/%3E%3Cpath d='M21 38c6 7 16 7 22 0' fill='none' stroke='%233A3A3C' stroke-width='3.5' stroke-linecap='round'/%3E%3C/svg%3E"); }

@keyframes bob {
  0%, 100% { translate: 0 0; }
  50% { translate: 0 -10px; }
}
@media (prefers-reduced-motion: reduce) {
  .doodle { animation: none; }
  .btn { transition: none; }
}

/* ------------------------------ the app shell ---------------------------- */

.page { min-height: 100vh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 28px;
  padding: 12px 28px;
  background: #fff;
  border-bottom: var(--outline);
}
.brand { display: flex; flex-shrink: 0; }
.brand img { width: 232px; }
.tabs { display: flex; gap: 8px; flex: 1; }
.tab {
  font: 600 1.05rem var(--font-display);
  color: var(--ink); text-decoration: none;
  padding: 9px 18px; border-radius: 999px;
  border: 2.5px solid transparent;
  white-space: nowrap;
}
.tab:hover { background: var(--tint-blue); }
.tab.is-active { background: var(--yellow); border-color: var(--ink); box-shadow: 2px 2px 0 var(--ink); }
.topbar-end { margin-left: auto; }

.main { flex: 1; width: 100%; max-width: 1180px; margin: 0 auto; padding: 36px 28px 64px; }

/* ----------------------------- settings menu ----------------------------- */

.menu { position: relative; }
.menu-button {
  display: flex; align-items: center; gap: 10px;
  font: 700 1rem var(--font-body); color: var(--ink);
  background: #fff; border: 2.5px solid var(--line); border-radius: 999px;
  padding: 5px 12px 5px 5px; cursor: pointer;
}
.menu-button:hover, .menu-button[aria-expanded=true] { border-color: var(--ink); }
.menu-name { max-width: 180px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar {
  width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  font: 600 1.05rem var(--font-display);
  background: var(--green); border: 2.5px solid var(--ink);
}
.chev { transition: transform .15s; }
.menu-button[aria-expanded=true] .chev { transform: rotate(180deg); }
.menu-list {
  position: absolute; right: 0; top: calc(100% + 10px);
  width: 270px; padding: 8px;
  background: #fff; border: var(--outline); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}
.menu-head { display: flex; flex-direction: column; padding: 10px 12px 12px; border-bottom: 2px dashed var(--line); margin-bottom: 6px; }
.menu-head span { font-size: .88rem; color: var(--muted); overflow-wrap: anywhere; }
.menu-list [role=menuitem] {
  display: flex; align-items: center; gap: 10px; width: 100%;
  font: 600 1rem var(--font-body); color: var(--ink); text-decoration: none; text-align: left;
  background: none; border: 0; border-radius: 10px; padding: 10px 12px; cursor: pointer;
}
.menu-list [role=menuitem]:hover, .menu-list [role=menuitem]:focus-visible { background: var(--tint-blue); outline: none; }
.menu-list hr { border: 0; border-top: 2px dashed var(--line); margin: 6px 0; }

/* -------------------------------- dialogs -------------------------------- */

.dialog {
  width: min(460px, calc(100vw - 32px));
  padding: 0; color: var(--ink);
  border: var(--outline); border-radius: var(--radius);
  box-shadow: 6px 6px 0 var(--ink);
}
.dialog::backdrop { background: rgb(58 58 60 / .45); }
.dialog-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 6px 24px; }
.dialog-head h2 { margin: 0; }
.dialog-body { padding: 8px 24px 24px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 8px; }

/* --------------------------------- toast --------------------------------- */

#toast {
  position: fixed; left: 50%; bottom: 28px; z-index: 100;
  transform: translate(-50%, 30px); opacity: 0; pointer-events: none;
  padding: 12px 22px; border-radius: 999px;
  font-weight: 800; background: var(--green); border: var(--outline); box-shadow: var(--sticker);
  transition: opacity .2s, transform .2s;
}
#toast.show { opacity: 1; transform: translate(-50%, 0); }
#toast.error { background: var(--coral); }

/* ------------------------------ placeholders ----------------------------- */

.welcome { display: grid; grid-template-columns: 1fr auto; gap: 48px; align-items: center; }
.welcome h1 { font-size: 2.4rem; }
.welcome-art { width: 300px; transform: rotate(3deg); }
.steps { list-style: none; padding: 0; margin: 24px 0; display: grid; gap: 14px; }
.steps li {
  display: flex; align-items: center; gap: 16px;
  background: #fff; border: 2.5px solid var(--line); border-radius: var(--radius);
  padding: 14px 18px;
}
.steps li div { display: flex; flex-direction: column; }
.steps li span:not(.step-icon) { color: var(--muted); font-size: .95rem; }
.step-icon {
  flex-shrink: 0; width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; font-size: 24px;
  background: var(--c); border: 2.5px solid var(--ink);
}
.coming {
  display: inline-block; margin: 12px 0 0;
  font: 600 .95rem var(--font-display);
  background: var(--tint-yellow); border: 2px dashed #D9C45A; border-radius: 999px; padding: 6px 14px;
}

.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 28px; margin-top: 20px; }
.swatches { list-style: none; padding: 0; margin: 18px 0; display: grid; gap: 12px; }
.swatches li { display: flex; align-items: center; gap: 12px; }
.swatch { width: 30px; height: 30px; border-radius: 50%; border: 2.5px solid var(--ink); }
.ghost-line { height: 12px; width: 55%; background: var(--line); border-radius: 999px; }

/* ------------------------------- small screens ---------------------------- */

@media (max-width: 900px) {
  .menu-name { display: none; }
  .topbar { gap: 16px; }
  .auth { grid-template-columns: 1fr; }
  .auth-art { display: none; }
  .auth-logo-small { display: block; }
  .welcome { grid-template-columns: 1fr; }
  .welcome-art { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .topbar { flex-wrap: wrap; gap: 10px 12px; padding: 10px 16px; }
  .brand img { width: 170px; }
  .tabs { order: 3; flex-basis: 100%; }
  .tab { flex: 1; text-align: center; padding: 8px 10px; font-size: .98rem; }
  .menu-name { display: none; }
  .menu-button { padding: 4px 8px 4px 4px; }
  .main { padding: 24px 16px 48px; }
  .card { padding: 22px 18px; }
  h1, .welcome h1 { font-size: 1.7rem; }
}

/* ------------------------------ Phase 2 bits ------------------------------ */

.btn-small { padding: 8px 14px; font-size: .95rem; box-shadow: 2px 2px 0 var(--ink); }
.btn-danger { background: var(--coral); }
.btn-danger:hover { background: #EA8587; }
.link-btn {
  font: 700 .92rem var(--font-body); color: var(--coral-deep);
  background: none; border: 0; padding: 6px 8px; border-radius: 8px; cursor: pointer;
}
.link-btn:hover { background: var(--tint-coral); }
.g-mark { flex-shrink: 0; vertical-align: -4px; }
.btn .g-mark { background: #fff; border-radius: 50%; padding: 2px; width: 24px; height: 24px; }
.privacy { margin: 14px 0 0; font-size: .9rem; color: var(--muted); }
.card-wide { margin-top: 28px; }

/* Connected accounts and their calendars */
.account + .account { margin-top: 18px; padding-top: 16px; border-top: 2px dashed var(--line); }
.account-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.account-email { display: inline-flex; align-items: center; gap: 8px; font-weight: 800; overflow-wrap: anywhere; }
.account-actions { display: inline-flex; align-items: center; gap: 2px; }
.is-spinning svg { animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.reconnect {
  display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap;
  margin: 10px 0; padding: 10px 14px;
  background: var(--tint-coral); border: 2px solid var(--coral); border-radius: var(--radius-sm);
}
.reconnect p { margin: 0; font-weight: 700; }
.cal-group {
  font: 700 .8rem var(--font-body); letter-spacing: .06em; text-transform: uppercase;
  color: var(--muted); margin: 16px 0 6px;
}
.cal-list { list-style: none; margin: 0; padding: 0; }
.switch-row { display: flex; align-items: center; gap: 12px; padding: 7px 4px; border-radius: 10px; cursor: pointer; }
.switch-row:hover { background: var(--tint-blue); }
.cal-name { min-width: 0; overflow-wrap: anywhere; }
.hint-inline { color: var(--muted); font-size: .88rem; }
.swatch-sm { flex-shrink: 0; width: 16px; height: 16px; border-radius: 50%; border: 2px solid var(--ink); }
.add-account { display: inline-block; margin-top: 16px; }

/* A chunky on/off switch in the logo's style. */
.switch { position: relative; flex-shrink: 0; width: 44px; height: 26px; }
/* The real checkbox sits on top (invisible) so a click anywhere on the switch
   reaches it; the drawn track underneath ignores the mouse. */
.switch input { position: absolute; inset: 0; opacity: 0; margin: 0; cursor: pointer; z-index: 1; }
.switch .track { pointer-events: none; }
.switch .track {
  position: absolute; inset: 0; border-radius: 999px;
  background: #E3DFD6; border: 2px solid var(--ink); transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 50%; background: #fff; border: 2px solid var(--ink);
  box-sizing: border-box; transition: transform .15s;
}
.switch input:checked + .track { background: var(--green); }
.switch input:checked + .track::after { transform: translateX(18px); }
.switch input:focus-visible + .track { outline: 3px solid var(--blue-deep); outline-offset: 2px; }
.switch input:disabled + .track { opacity: .6; }

/* The month view */
.monthview { margin-top: 12px; }
.mv-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.mv-nav { display: flex; align-items: center; gap: 6px; }
.mv-title { margin: 0 0 0 8px; font-size: 1.4rem; }
.mv-status { color: var(--muted); font-size: .9rem; }
.mv-problems { margin-bottom: 12px; padding: 10px 14px; background: var(--tint-coral); border: 2px solid var(--coral); border-radius: var(--radius-sm); }
.mv-problems p { margin: 0; }
.mv-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  grid-template-rows: auto repeat(var(--weeks, 5), minmax(112px, auto));
  border: var(--outline); border-radius: var(--radius-sm); overflow: hidden;
  background: var(--line); gap: 1px;
}
.mv-dow {
  background: var(--tint-blue); text-align: center; padding: 6px 0;
  font: 700 .8rem var(--font-body); letter-spacing: .06em; text-transform: uppercase;
}
.mv-cell { background: #fff; padding: 4px 4px 6px; min-width: 0; }
.mv-cell.is-outside { background: #FAF8F3; }
.mv-cell.is-outside .mv-date { color: #A9A59D; }
.mv-date {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 4px;
  font: 600 .9rem var(--font-display); border-radius: 999px; margin-bottom: 2px;
}
.mv-cell.is-today .mv-date { background: var(--coral); border: 2px solid var(--ink); }
.mv-events { display: flex; flex-direction: column; gap: 2px; }
.mv-chip {
  display: flex; align-items: center; gap: 4px;
  font-size: .78rem; line-height: 1.35; padding: 1px 4px; border-radius: 5px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.mv-chip .dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 50%; background: var(--c); }
.mv-chip.is-allday { display: block; background: var(--c); color: #fff; font-weight: 700; text-shadow: 0 0 2px rgb(0 0 0 / .35); }
.mv-more {
  font: 700 .78rem var(--font-body); color: var(--blue-deep); text-align: left;
  background: none; border: 0; padding: 1px 4px; border-radius: 5px; cursor: pointer;
}
.mv-more:hover { background: var(--tint-blue); }

.day-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.day-list li { display: flex; gap: 10px; align-items: flex-start; }
.day-list .swatch-sm { margin-top: 4px; }

@media (max-width: 720px) {
  .mv-grid { grid-template-rows: auto repeat(var(--weeks, 5), minmax(64px, auto)); }
  .mv-chip { font-size: 0; padding: 0; height: 6px; border-radius: 3px; background: var(--c); }
  .mv-chip .dot { display: none; }
  .mv-more { font-size: .7rem; }
}

/* ------------------------------ Phase 3 bits ------------------------------ */

.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.color-btn {
  flex-shrink: 0; width: 22px; height: 22px; padding: 0;
  border: 2.5px solid var(--ink); border-radius: 50%; cursor: pointer;
  transition: transform .1s;
}
.color-btn:hover { transform: scale(1.15); }
.color-btn-lg { width: 34px; height: 34px; box-shadow: 2px 2px 0 var(--ink); }

/* The calendar rows now hold a switch, a color button and a name. */
.cal-list .switch-row { cursor: default; }
.cal-list .cal-name { flex: 1; min-width: 0; display: flex; flex-direction: column; }
/* Looks like plain text until you hover or click into it to rename. */
.cal-list input.cal-rename {
  width: 100%; font: 600 1rem var(--font-body); color: var(--ink);
  padding: 4px 8px; border: 2px solid transparent; border-radius: 8px; background: transparent;
}
.cal-list input.cal-rename:hover { background: var(--tint-blue); }
.cal-list input.cal-rename:focus { background: #fff; border-color: var(--blue-deep); box-shadow: none; }
.cal-name .hint-inline { padding-left: 10px; }

.family-list { list-style: none; margin: 16px 0; padding: 0; display: grid; gap: 8px; }
.family-row { display: flex; align-items: center; gap: 10px; }
/* Looks like plain text until you hover or click into it. */
.family-row input.family-name {
  flex: 1; min-width: 0;
  font: 700 1.05rem var(--font-body);
  padding: 8px 10px; border-color: transparent; background: transparent;
}
.family-row input.family-name:hover { background: var(--tint-blue); }
.family-row input.family-name:focus { background: #fff; border-color: var(--blue-deep); }
.family-tools { display: inline-flex; }
.family-tools .icon-btn { width: 32px; height: 32px; }
.family-tools .icon-btn:disabled { opacity: .25; cursor: default; background: none; }
.icon-btn-danger:hover { background: var(--tint-coral); color: var(--coral-deep); }
.family-empty { padding: 14px; text-align: center; color: var(--muted); border: 2px dashed var(--line); border-radius: var(--radius-sm); }
.family-add { display: flex; gap: 10px; align-items: center; }
.family-add input { flex: 1; }

/* The color picker popover */
.picker {
  position: absolute; z-index: 50; width: 232px; padding: 12px;
  background: #fff; border: var(--outline); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink);
}
.picker-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.picker-swatch {
  width: 42px; height: 42px; border-radius: 50%; padding: 0;
  background: var(--c); border: 2.5px solid var(--ink); cursor: pointer;
  transition: transform .1s;
}
.picker-swatch:hover, .picker-swatch:focus-visible { transform: scale(1.12); }
.picker-swatch.is-current { box-shadow: 0 0 0 3px #fff, 0 0 0 6px var(--ink); }
.picker-custom, .picker-reset {
  display: flex; align-items: center; gap: 10px; width: 100%;
  margin-top: 12px; padding: 8px; border-radius: 10px;
  font: 700 .92rem var(--font-body); color: var(--ink);
  background: none; border: 0; cursor: pointer;
}
.picker-custom { border-top: 2px dashed var(--line); border-radius: 0; padding-top: 12px; }
.picker-custom:hover, .picker-reset:hover { background: var(--tint-blue); }
.picker-custom input { width: 30px; height: 30px; padding: 0; border: 2px solid var(--ink); border-radius: 8px; background: none; cursor: pointer; }

/* ------------------------------ Phase 4 bits ------------------------------ */

.main:has(.editor) { max-width: none; padding: 0; }

/* Saved calendars list */
.list-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 24px; }
.list-head .lede { margin: 0; }
.saved-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 20px; }
.saved-card {
  position: relative; background: #fff; border: var(--outline); border-radius: var(--radius);
  box-shadow: 4px 4px 0 var(--ink); transition: transform .1s, box-shadow .1s;
}
.saved-card:hover { transform: translate(-2px, -2px); box-shadow: 6px 6px 0 var(--ink); }
.saved-open { display: flex; flex-direction: column; gap: 4px; padding: 18px; color: var(--ink); text-decoration: none; }
.saved-name { font: 600 1.2rem var(--font-display); padding-right: 30px; }
.saved-card [data-delete] { position: absolute; top: 10px; right: 10px; }
.saved-thumb { display: flex; gap: 6px; height: 70px; align-items: center; margin-bottom: 10px; }
.saved-thumb i { display: block; border: 2px solid var(--ink); border-radius: 4px; background:
  linear-gradient(var(--tint-blue) 0 22%, transparent 22%),
  repeating-linear-gradient(90deg, transparent 0 13%, var(--line) 13% 14.3%), #fff; }
.saved-thumb.is-landscape i { width: 88px; height: 68px; }
.saved-thumb.is-portrait i { width: 53px; height: 68px; }
.empty-state { text-align: center; padding: 40px 20px; background: #fff; border: 2.5px dashed var(--line); border-radius: var(--radius); }
.empty-state img { width: 160px; margin-bottom: 8px; }

/* The editor: settings on the left, the paper on the right. */
.editor { display: grid; grid-template-columns: 330px minmax(0, 1fr); min-height: calc(100vh - 78px); }
.panel { background: #fff; border-right: var(--outline); overflow-y: auto; max-height: calc(100vh - 78px); position: sticky; top: 78px; }
.panel-inner { padding: 18px 20px 40px; }
.panel-section { padding: 14px 0 18px; border-bottom: 2px dashed var(--line); }
.panel-section:last-child { border-bottom: 0; }
.panel-section h2 { font-size: 1.1rem; margin-bottom: 10px; }
.mini-label { display: block; font-weight: 800; font-size: .88rem; margin: 14px 0 6px; }
.panel .hint { font-size: .82rem; margin-top: 8px; }

.segmented { display: flex; background: var(--tint-blue); border: 2px solid var(--ink); border-radius: 999px; padding: 3px; gap: 2px; }
.segmented button {
  flex: 1; font: 700 .86rem var(--font-body); color: var(--ink);
  background: none; border: 0; border-radius: 999px; padding: 7px 6px; cursor: pointer; white-space: nowrap;
}
.segmented button:hover { background: rgb(255 255 255 / .6); }
.segmented button.is-on { background: var(--yellow); box-shadow: inset 0 0 0 2px var(--ink); }

.range-step { display: flex; align-items: center; justify-content: space-between; margin: 12px 0 6px; }
.range-step .icon-btn { font-size: 1.6rem; line-height: 1; }
.range-label { font: 600 1.05rem var(--font-display); text-align: center; }
.date-pair { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.field-sm span { display: block; font-size: .8rem; font-weight: 800; color: var(--muted); }
.field-sm input { width: 100%; font: inherit; font-size: .9rem; padding: 7px 8px; border: 2px solid #C9C4BA; border-radius: 10px; }

.layout-grid, .theme-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.layout-card, .theme-card {
  display: flex; align-items: center; gap: 10px; text-align: left;
  font: 700 .88rem var(--font-body); color: var(--ink); line-height: 1.2;
  background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px; cursor: pointer;
}
.layout-card small, .theme-card small { font-weight: 600; color: var(--muted); }
.layout-card:hover, .theme-card:hover { border-color: var(--ink); }
.layout-card.is-on, .theme-card.is-on { border-color: var(--ink); background: var(--tint-yellow); box-shadow: 2px 2px 0 var(--ink); }
.mini { display: flex; gap: 3px; flex-shrink: 0; }
.mini i { display: block; border: 1.5px solid var(--ink); border-radius: 2px; background: #fff; }
.mini.is-landscape i { width: 22px; height: 17px; }
.mini.is-portrait i { width: 14px; height: 18px; }
.theme-sample { width: 34px; height: 34px; flex-shrink: 0; display: grid; place-items: center; border-radius: 8px; border: 1.5px solid var(--ink); font-size: 1.05rem; }
.theme-card-cute .theme-sample { font: 600 1.15rem var(--font-display); background: var(--yellow); color: var(--coral-deep); }
.theme-card-modern .theme-sample { font: 300 1.05rem 'Outfit', sans-serif; background: #fff; letter-spacing: .06em; }
.theme-card-sports .theme-sample { font: 400 1rem 'Graduate', serif; background: #1F3A68; color: #fff; }
.theme-card-classic .theme-sample { font: italic 400 1.15rem 'Playfair Display', Georgia, serif; background: #FBF6EC; color: #6B2737; }

.toggle-row { display: flex; align-items: center; gap: 12px; padding: 6px 0; cursor: pointer; font-weight: 700; }

/* The stage with the paper previews */
.stage {
  min-width: 0; padding: 14px 20px 0; background: #EFEBE3;
  display: flex; flex-direction: column;
  position: sticky; top: 77px; height: calc(100vh - 77px);
}
.stage-bar { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; flex-wrap: wrap; flex-shrink: 0; }
.stage-note { flex-shrink: 0; }
.back { white-space: nowrap; }
.stage-bar input.name-input {
  flex: 1; min-width: 180px; font: 600 1.35rem var(--font-display);
  padding: 6px 10px; border-color: transparent; background: transparent;
}
.stage-bar input.name-input:hover { background: rgb(255 255 255 / .6); }
.stage-bar input.name-input:focus { background: #fff; border-color: var(--blue-deep); }
.save-state { color: var(--muted); font-size: .9rem; white-space: nowrap; }
.stage-note { margin-bottom: 16px; padding: 12px 16px; background: var(--tint-yellow); border: 2px solid #D9C45A; border-radius: var(--radius-sm); }
/* The pages scroll in their own window, like a PDF viewer, so the toolbar
   and zoom buttons stay put. Auto side margins (rather than centering) keep a
   zoomed-in page's left edge reachable. */
.sheets {
  flex: 1; min-height: 0; overflow: auto;
  display: flex; flex-direction: column; align-items: flex-start; gap: 28px;
  padding: 4px 4px 40px;
}
.sheet-frame { position: relative; flex-shrink: 0; margin: 0 auto; }

.zoom { display: inline-flex; align-items: center; gap: 2px; background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 2px; }
.zoom .icon-btn { width: 34px; height: 34px; }
.zoom-level {
  min-width: 86px; font: 700 .88rem var(--font-body); color: var(--ink);
  background: none; border: 0; border-radius: 999px; padding: 7px 8px; cursor: pointer; white-space: nowrap;
}
.zoom-level:hover { background: var(--tint-blue); }
.zoom-level.is-fit { color: var(--muted); }
.sheet-frame .sheet { transform-origin: top left; box-shadow: 0 2px 10px rgb(0 0 0 / .18); margin-top: 24px; }
.page-label { position: absolute; top: 0; left: 0; font-size: .82rem; font-weight: 700; color: var(--muted); }

@media (max-width: 900px) {
  .editor { grid-template-columns: 1fr; }
  .panel { position: static; max-height: none; border-right: 0; border-bottom: var(--outline); }
  .stage { padding: 16px; position: static; height: auto; }
  .sheets { overflow: auto hidden; }
}


/* ------------------------------ footer, legal ------------------------------ */

.site-footer {
  display: flex; justify-content: center; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 22px 16px 28px; font-size: .88rem; color: var(--muted);
}
.site-footer a { color: var(--muted); font-weight: 700; text-decoration: none; }
.site-footer a:hover { color: var(--blue-deep); text-decoration: underline; }
.auth-panel .site-footer { padding-bottom: 0; }
.menu-list .menu-danger { color: var(--coral-deep); }
.menu-list .menu-danger:hover { background: var(--tint-coral); }

.legal { max-width: 760px; }
.legal h2 { margin-top: 1.6em; }
.legal ul { padding-left: 1.3em; }
.legal li { margin-bottom: .45em; }
.legal p, .legal li { line-height: 1.65; }

/* ------------------------------ Phase 5 bits ------------------------------ */

.dialog-wide { width: min(560px, calc(100vw - 24px)); max-height: calc(100vh - 24px); }
.ev-form .field { margin-bottom: 18px; }
.pic-row { display: flex; align-items: center; gap: 14px; }
.pic-current {
  width: 76px; height: 76px; flex-shrink: 0; object-fit: contain; padding: 8px;
  background: var(--tint-yellow); border: 2.5px solid var(--ink); border-radius: 18px;
}
.pic-choices, .pic-results { display: flex; flex-wrap: wrap; gap: 8px; }
.pic-results { margin-top: 10px; max-height: 150px; overflow-y: auto; padding: 4px; }
.pic-choice {
  width: 50px; height: 50px; padding: 6px; cursor: pointer;
  background: #fff; border: 2px solid var(--line); border-radius: 12px;
}
.pic-choice img { width: 100%; height: 100%; object-fit: contain; }
.pic-choice:hover { border-color: var(--ink); }
.pic-choice.is-on { border-color: var(--ink); background: var(--tint-blue); box-shadow: 2px 2px 0 var(--ink); }
.pic-tools { display: flex; gap: 10px; align-items: center; margin-top: 10px; flex-wrap: wrap; }
.pic-tools .btn { box-shadow: 2px 2px 0 var(--ink); }
.pic-search {
  flex: 1; min-width: 160px; font: inherit; font-size: .95rem;
  padding: 8px 12px; border: 2px solid #C9C4BA; border-radius: 999px;
}
.pic-own { margin-top: 10px; }
.pic-own summary { cursor: pointer; font-weight: 700; color: var(--blue-deep); }
.pic-own-body { display: flex; flex-direction: column; gap: 10px; padding-top: 10px; }
.pic-own-body label.btn { align-self: flex-start; box-shadow: 2px 2px 0 var(--ink); }
.pic-link { display: flex; gap: 8px; }
.pic-link input { flex: 1; font: inherit; font-size: .92rem; padding: 8px 12px; border: 2px solid #C9C4BA; border-radius: 12px; }

.who { display: flex; flex-wrap: wrap; gap: 8px; }
.who-chip {
  display: inline-flex; align-items: center; gap: 6px;
  font: 700 .92rem var(--font-body); color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.who-chip i { width: 14px; height: 14px; border-radius: 50%; background: var(--c); border: 2px solid var(--ink); }
.who-chip:hover { border-color: var(--ink); }
.who-chip.is-on { border-color: var(--ink); background: var(--tint-yellow); box-shadow: 2px 2px 0 var(--ink); }

.ev-form .segmented { max-width: 420px; }
.scope { border: 0; padding: 0; margin: 0 0 14px; }
.scope label { display: block; padding: 6px 0; font-weight: 700; cursor: pointer; }
.scope input { accent-color: var(--blue-deep); margin-right: 6px; }
.scope .hint { display: block; margin-left: 24px; font-weight: 400; }
.repeat-row { display: flex; gap: 14px; flex-wrap: wrap; }
.repeat-row select, .repeat-row input[type=date] {
  font: inherit; padding: 8px 10px; border: 2px solid #C9C4BA; border-radius: 12px; background: #fff;
}
.ev-actions { align-items: center; flex-wrap: wrap; }
.ev-actions .spacer { flex: 1; }
.link-btn-quiet { color: var(--muted); }
.link-btn-quiet:hover { background: var(--tint-blue); color: var(--ink); }

.hidden-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }

/* The header picture picker */
.hp .label { margin-top: 14px; }
.hp-slots { display: flex; gap: 12px; }
.hp-slot {
  width: 78px; height: 78px; padding: 10px; cursor: pointer;
  background: #fff; border: 2.5px dashed var(--line); border-radius: 18px;
}
.hp-slot img { width: 100%; height: 100%; object-fit: contain; }
.hp-slot:hover { border-color: var(--ink); }
.hp-slot.is-on { border: 2.5px solid var(--ink); background: var(--tint-yellow); box-shadow: 3px 3px 0 var(--ink); }
.hp-sets-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 10px; }
.hp-sets-head .btn { box-shadow: 2px 2px 0 var(--ink); }
.hp-sets { display: grid; grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); gap: 8px; margin-top: 8px; }
.hp-set {
  display: flex; flex-direction: column; align-items: center; gap: 4px; cursor: pointer;
  font: 700 .85rem var(--font-body); color: var(--ink);
  background: #fff; border: 2px solid var(--line); border-radius: 12px; padding: 8px 6px;
}
.hp-set:hover { border-color: var(--ink); }
.hp-set.is-on { border-color: var(--ink); background: var(--tint-blue); box-shadow: 2px 2px 0 var(--ink); }
.hp-set-pics { display: flex; gap: 2px; }
.hp-set-pics img { width: 28px; height: 28px; }
.hp-ideas { margin: 8px 0 10px; max-height: 170px; }
.hp .pic-search { width: 100%; }
.hidden-count {
  font: 700 .88rem var(--font-body); color: var(--ink); white-space: nowrap;
  background: var(--tint-yellow); border: 2px solid #D9C45A; border-radius: 999px; padding: 6px 12px; cursor: pointer;
}
.hidden-count:hover { border-color: var(--ink); }
.panel-section.flash { animation: flash 1.4s ease; border-radius: 12px; }
@keyframes flash { 0%, 60% { background: var(--tint-yellow); box-shadow: 0 0 0 6px var(--tint-yellow); } 100% { background: transparent; box-shadow: none; } }
.hidden-list li { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: .88rem; }
.hidden-list li span { min-width: 0; overflow-wrap: anywhere; }
.hidden-list .link-btn { white-space: nowrap; font-size: .82rem; }
