/* Dates to Remember: styles, grouped by part of the page. */

/* ---- Colours ---- */
:root {
  --sky: #EEF5FB;
  --ink: #1B2B4B;
  --muted: #5B6B85;
  --sun: #F2B02E;
  --leaf: #2F7D6D;
  --white: #FFFFFF;
  --line: #D5E2EE;
  --error: #B3261E;
  /* One colour per type, used for list badges and the year view: strong for dots, soft for badges. */
  --birthday: #2F6FD0;    --birthday-soft: #CFE0F8;
  --anniversary: #D63B3B; --anniversary-soft: #F8D0D0;
  --graduation: #3E8E2F;  --graduation-soft: #D3EBC8;
}

/* ---- Page and text ---- */
* { box-sizing: border-box; }
body {
  margin: 0;
  background: var(--sky);
  color: var(--ink);
  font-family: "Figtree", system-ui, sans-serif;
  font-size: 17px;
  line-height: 1.5;
}
main { max-width: 620px; margin: 0 auto; padding: 48px 20px 80px; }
h1 {
  font-family: "Young Serif", Georgia, serif;
  font-weight: 400;
  font-size: 2.6rem;
  line-height: 1.1;
  margin: 0 0 8px;
}
h2 { font-family: "Young Serif", Georgia, serif; font-weight: 400; font-size: 1.4rem; margin: 40px 0 12px; }
.intro { color: var(--muted); margin: 0 0 32px; max-width: 60ch; }
.hint { font-weight: 400; color: var(--muted); }
.empty { color: var(--muted); margin: 0; }
[hidden] { display: none !important; }

/* ---- Panels, fields and messages ---- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: 14px; padding: 24px; }
label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
input {
  width: 100%; font: inherit; color: inherit;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
}
textarea {
  width: 100%; font: inherit; font-size: 0.95rem; color: inherit; resize: vertical;
  padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--white);
}
.field { margin-top: 16px; }
.names { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.names .field { margin-top: 0; }
.label-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 6px; }
.label-row label { margin: 0; }
.message { margin-top: 14px; min-height: 1.5em; color: var(--leaf); }
.message.error { color: var(--error); }

/* ---- Buttons ---- */
button {
  font: inherit; font-weight: 600; cursor: pointer;
  border: none; border-radius: 8px; padding: 11px 20px;
  background: var(--leaf); color: var(--white); margin-top: 20px;
}
button.secondary { background: var(--white); color: var(--leaf); box-shadow: inset 0 0 0 1px var(--leaf); }
button.quiet { background: none; color: var(--muted); padding: 6px 8px; margin: 0; font-weight: 500; }
button.quiet:hover { color: var(--error); }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
/* Keyboard focus ring for everything you can Tab to. */
button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, a:focus-visible {
  outline: 3px solid var(--sun); outline-offset: 2px;
}

/* ---- Sign in and create account ---- */
.panel-heading { margin: 0 0 16px; }
.captcha { margin-top: 16px; min-height: 65px; }
.switch-mode { margin: 12px 0 0; }
#mode-btn { padding: 4px 0; color: var(--leaf); font-weight: 600; }

/* ---- Account bar and the set/change password panel ---- */
.account { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; color: var(--muted); font-size: 0.95rem; margin-bottom: 24px; }
.account-actions { display: flex; gap: 4px; }
/* Quiet buttons that aren't destructive darken on hover instead of turning red. */
#password-toggle:hover, #show-password-btn:hover, #show-login-password-btn:hover, #mode-btn:hover { color: var(--ink); }
#password-panel { margin-bottom: 24px; }
#password-panel .field:first-child { margin-top: 0; }

/* ---- Entry form: type buttons ---- */
.type-field { margin-bottom: 16px; }
.group-label { display: block; font-weight: 600; font-size: 0.95rem; margin-bottom: 6px; }
.types { display: inline-flex; flex-wrap: wrap; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.types button {
  margin: 0; padding: 8px 14px; border-radius: 0; font-weight: 500;
  background: var(--white); color: var(--muted);
}
.types button[aria-checked="true"] { background: var(--ink); color: var(--white); }
.types button:focus-visible { outline-offset: -3px; }
.types .key {
  display: inline-block; margin-left: 6px; padding: 0 5px; border: 1px solid currentColor;
  border-radius: 4px; font-size: 0.75rem; line-height: 1.4; opacity: 0.75;
}

/* ---- Entry form: date box, preview and Month/Day switch ---- */
.date-input-row { display: flex; gap: 8px; }
.date-input-row input { flex: 1; min-width: 0; }
.preview { margin-top: 8px; min-height: 1.5em; font-size: 0.95rem; color: var(--muted); }
.preview.ok { color: var(--leaf); font-weight: 600; }
.preview.bad { color: var(--error); }
.date-under { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.date-under .preview { margin-top: 0; }
.order { display: inline-flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.order button {
  margin: 0; padding: 4px 10px; border-radius: 0; font-size: 0.85rem; font-weight: 500;
  background: var(--white); color: var(--muted);
}
.order button[aria-pressed="true"] { background: var(--ink); color: var(--white); }

/* ---- Calendar picker ---- */
.cal-btn { margin: 0; padding: 0 12px; background: var(--white); color: var(--ink); box-shadow: inset 0 0 0 1px var(--line); font-size: 1.2rem; }
.cal-btn:hover, .cal-btn[aria-expanded="true"] { background: var(--sky); }
.cal-panel:focus { outline: none; }
.cal-panel {
  margin-top: 8px; max-width: 400px; padding: 12px; background: var(--white);
  border: 1px solid var(--line); border-radius: 12px; box-shadow: 0 4px 16px rgba(27, 43, 75, 0.08);
}
.cal-head { display: flex; gap: 6px; align-items: center; }
.cal-head select {
  font: inherit; font-size: 0.95rem; color: inherit; background: var(--white);
  padding: 6px 8px; border: 1px solid var(--line); border-radius: 8px;
}
#cal-month { flex: 1; min-width: 7.5em; }
#cal-year { flex: 1; min-width: 0; }
.cal-nav { margin: 0; padding: 4px 10px; background: none; color: var(--ink); font-size: 1.4rem; line-height: 1; }
.cal-nav:hover { background: var(--sky); }
.cal-hint { margin: 8px 0 0; font-size: 0.85rem; color: var(--muted); }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 8px; }
.cal-wd { text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.cal-day { margin: 0; padding: 8px 0; border-radius: 8px; background: var(--sky); color: var(--ink); font-weight: 500; }
.cal-day:hover { background: var(--line); }
.cal-day.today { box-shadow: inset 0 0 0 2px var(--sun); }
.cal-day.selected { background: var(--ink); color: var(--white); }
.cal-foot { display: flex; justify-content: flex-end; margin-top: 8px; }

/* ---- Paste a list ---- */
#bulk-panel { margin-top: 16px; }
.template-link { color: var(--leaf); font-size: 0.9rem; font-weight: 500; }
.bulk-help { margin: 0 0 10px; font-size: 0.92rem; color: var(--muted); }
.bulk-help code, .bulk-preview code { font-size: 0.88rem; background: var(--sky); padding: 1px 4px; border-radius: 4px; }
.bulk-keys { margin: 10px 0 0; font-size: 0.85rem; }
.bulk-preview { margin-top: 12px; overflow-x: auto; }
.bulk-preview table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
.bulk-preview th { text-align: left; font-weight: 600; color: var(--muted); padding: 6px 8px; border-bottom: 1px solid var(--line); }
.bulk-preview td { padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: top; overflow-wrap: anywhere; }
.bulk-preview td:nth-child(-n+2), .bulk-preview td:nth-child(4) { white-space: nowrap; overflow-wrap: normal; }
.bulk-preview tr.ok td:last-child { color: var(--leaf); font-weight: 600; }
.bulk-preview tr.bad td { color: var(--error); }
.bulk-preview tr.skip td { color: var(--muted); }

/* ---- The list ("Coming up") ---- */
ul { list-style: none; margin: 0; padding: 0; }
li { display: flex; align-items: center; gap: 16px; padding: 12px 0; border-bottom: 1px solid var(--line); }
li:last-child { border-bottom: none; }
li.editing { background: var(--sky); border-radius: 10px; padding-left: 8px; padding-right: 8px; }
.stamp {
  flex: none; width: 58px; text-align: center;
  background: var(--birthday-soft); border-radius: 10px; padding: 6px 0 4px;
}
.stamp.anniversary { background: var(--anniversary-soft); }
.stamp.graduation { background: var(--graduation-soft); }
.stamp .month { display: block; font-size: 0.8rem; font-weight: 600; }
.stamp .day { display: block; font-family: "Young Serif", Georgia, serif; font-size: 1.6rem; line-height: 1; }
.who { flex: 1; min-width: 0; }
.who .name { font-weight: 600; overflow-wrap: anywhere; }
.who .when { color: var(--muted); font-size: 0.92rem; }
.row-actions { flex: none; display: flex; gap: 4px; }
.row-actions .edit:hover { color: var(--ink); }

/* ---- Your year ---- */
.tdot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin: 1px; vertical-align: middle; background: var(--birthday); }
.tdot.anniversary { background: var(--anniversary); }
.tdot.graduation { background: var(--graduation); }
.year-legend { display: flex; gap: 14px; flex-wrap: wrap; margin: 0 0 10px; font-size: 0.85rem; color: var(--muted); }
.year-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.month-tile {
  margin: 0; padding: 8px; min-height: 64px; text-align: left; font-weight: 600; font-size: 0.9rem;
  display: flex; flex-direction: column; gap: 4px;
  background: var(--white); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
}
.month-tile:hover { background: var(--sky); }
.month-tile.now { border: 2px solid var(--ink); }
.month-tile[aria-pressed="true"] { background: var(--ink); color: var(--white); }
.month-tile .dots { line-height: 0; }
.month-tile .more { font-size: 0.75rem; font-weight: 500; }
#month-detail { margin-top: 12px; }
.month-detail-head { display: flex; justify-content: space-between; align-items: center; }
.month-detail-head h3 { margin: 0; font-family: "Young Serif", Georgia, serif; font-weight: 400; font-size: 1.25rem; }
.month-cal { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin: 12px 0 4px; }
.mc-wd { text-align: center; font-size: 0.78rem; font-weight: 600; color: var(--muted); }
.mc-day { text-align: center; padding: 6px 0 4px; min-height: 42px; border-radius: 8px; font-size: 0.9rem; color: var(--muted); }
.mc-day.has { background: var(--sky); color: var(--ink); font-weight: 600; }
.mc-day .tdot { width: 6px; height: 6px; }
.month-list li { gap: 12px; padding: 10px 0; }

/* ---- Phones ---- */
@media (max-width: 520px) {
  h1 { font-size: 2.1rem; }
  .names { grid-template-columns: 1fr; }
  .names .field + .field { margin-top: 16px; }
  .year-grid { grid-template-columns: repeat(3, 1fr); }
}
