/*
 * styles.css
 * How the gift tracker looks: colors, spacing, layout and warnings.
 *
 * The look is a quiet Christmas palette: deep evergreen, cranberry and
 * antique gold on warm ivory, with serif headings. Colors are named once
 * here (as "variables") so they are easy to change.
 */
:root {
  --bg: #f7f3ec;
  --surface: #fffdf9;
  --surface-2: #f3ede2;
  --text: #1f2a24;
  --muted: #6c6f68;
  --border: #e5ddcf;

  --pine: #1e3d31;
  --pine-2: #2b5443;
  --pine-tint: #e6eee9;
  --gold: #b0905a;
  --gold-soft: #d9c39a;
  --cranberry: #9b2335;
  --cranberry-bg: #f8e9e9;

  --whatif: #6e5418;
  --whatif-bg: #faf2e1;

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(60, 40, 20, 0.05), 0 4px 14px rgba(60, 40, 20, 0.04);
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

body {
  margin: 0;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

main {
  padding-bottom: 32px;
}

h1, h2, h3, h4 {
  margin: 0;
  line-height: 1.25;
  font-family: var(--serif);
  font-weight: 600;
}

a {
  color: var(--pine-2);
}

/* ----- Header and navigation ----- */

.site-header {
  color: #fff;
  background-color: var(--pine);
  /* A faint pattern of snowflakes and stars. */
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'%3E%3Cg fill='none' stroke='%23ffffff' stroke-opacity='0.07' stroke-width='1' stroke-linecap='round'%3E%3Cpath d='M18 10v16M10 18h16M12.3 12.3l11.4 11.4M23.7 12.3L12.3 23.7'/%3E%3Cpath d='M52 44v10M47 49h10'/%3E%3C/g%3E%3Ccircle cx='58' cy='14' r='1.2' fill='%23ffffff' fill-opacity='0.12'/%3E%3Ccircle cx='30' cy='56' r='1' fill='%23ffffff' fill-opacity='0.1'/%3E%3C/svg%3E");
  border-bottom: 3px double var(--gold);
}

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-top: 14px;
  padding-bottom: 14px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.site-header h1 {
  font-size: 1.55rem;
  letter-spacing: 0.01em;
}

.star {
  color: var(--gold-soft);
  font-size: 0.9em;
}

.year-badge {
  font-family: var(--serif);
  font-size: 0.85rem;
  color: var(--gold-soft);
  border: 1px solid rgba(217, 195, 154, 0.6);
  border-radius: 999px;
  padding: 0 10px;
}

.year-badge:empty {
  display: none;
}

.save-status {
  font-size: 0.8rem;
  color: var(--gold-soft);
  opacity: 0;
  transition: opacity 0.3s;
}

.save-status.visible {
  opacity: 1;
}

.save-status.problem {
  color: #f3b4bc;
  font-weight: 600;
}

/* ----- Sign-in screens ----- */

/* While signed out, only the header and the sign-in card show. */
.signed-out .header-right,
.signed-out #whatif-bar,
.signed-out main,
.signed-out #footer,
.signed-out #account-bar {
  display: none;
}

.account-screen {
  padding-top: 48px;
  padding-bottom: 48px;
}

.account-card {
  max-width: 440px;
  margin: 0 auto;
  padding: 24px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 4px solid var(--pine);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.account-card h2 {
  font-size: 1.6rem;
  color: var(--pine);
  margin-bottom: 6px;
}

.account-card form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 16px;
}

.account-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

.account-card label input {
  font-weight: normal;
}

.account-card input[readonly] {
  background: var(--surface-2);
  color: var(--muted);
}

.account-option {
  padding: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fff;
}

.account-option h3 {
  font-size: 1.1rem;
}

.account-option p {
  margin: 0;
}

.account-message {
  margin: 0;
}

.account-message:not(.form-error) {
  color: var(--pine-2);
}

.account-bar {
  padding-bottom: 24px;
  color: var(--muted);
  font-size: 0.85rem;
}

.account-bar p {
  margin: 0;
}

.account-bar code {
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--pine);
}

.header-right {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 12px;
}

.site-header nav {
  display: flex;
  gap: 4px;
}

.prices-toggle {
  background: transparent;
  color: var(--gold-soft);
  border-color: rgba(217, 195, 154, 0.6);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
}

.prices-toggle:hover {
  border-color: var(--gold-soft);
}

.prices-toggle[aria-pressed="true"] {
  background: var(--gold-soft);
  color: var(--pine);
  font-weight: 600;
}

.site-header nav a {
  color: #fff;
  text-decoration: none;
  padding: 6px 14px;
  border-radius: 999px;
}

.site-header nav a:hover {
  background: rgba(255, 255, 255, 0.12);
}

.site-header nav a.active {
  background: var(--surface);
  color: var(--pine);
  font-weight: 600;
}

/* ----- What-if bar ----- */

.whatif-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  background: var(--whatif-bg);
  border-bottom: 1px solid var(--gold-soft);
  color: var(--whatif);
}

.whatif-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding-top: 8px;
  padding-bottom: 8px;
}

.whatif-inner p {
  margin: 0;
}

.whatif-hint {
  font-size: 0.875rem;
}

.whatif-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.whatif-line, .ideas-line {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  font-size: 0.875rem;
}

.whatif-line {
  background: var(--whatif-bg);
  color: var(--whatif);
}

.ideas-line {
  background: var(--surface-2);
  color: var(--muted);
}

.whatif-line.over, .ideas-line.caution {
  background: var(--cranberry-bg);
  color: var(--cranberry);
}

.whatif-cell {
  font-size: 0.8rem;
  color: var(--whatif);
}

.whatif-cell.over {
  color: var(--cranberry);
  font-weight: 600;
}

/* ----- Buttons and form controls ----- */

button, .button {
  font: inherit;
  font-size: 0.95rem;
  padding: 6px 14px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  line-height: 1.4;
}

button:hover, .button:hover {
  border-color: var(--pine-2);
}

button.primary {
  background: var(--pine);
  border-color: var(--pine);
  color: #fff;
}

button.primary:hover {
  background: var(--pine-2);
}

button.danger {
  color: var(--cranberry);
}

button.danger:hover {
  border-color: var(--cranberry);
}

button.small, .button.small {
  padding: 3px 10px;
  font-size: 0.85rem;
}

.link-button {
  border: none;
  background: none;
  padding: 0;
  color: var(--pine-2);
  text-decoration: underline;
  font-family: var(--serif);
  font-size: 1rem;
}

input, select, textarea {
  font: inherit;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: #fff;
  color: var(--text);
}

input:focus, select:focus, textarea:focus, button:focus-visible, summary:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 1px;
}

input[type="checkbox"], input[type="radio"] {
  width: 18px;
  height: 18px;
  accent-color: var(--pine);
  cursor: pointer;
}

.money-input {
  width: 92px;
  text-align: right;
}

/* While prices are hidden, amounts in pop-up forms stay blurred until clicked into. */
.prices-hidden dialog input[inputmode="decimal"]:not(:focus) {
  color: transparent;
  text-shadow: 0 0 8px rgba(0, 0, 0, 0.5);
}

/* The All / Christmas / Birthdays switch */
.segmented {
  display: inline-flex;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  padding: 2px;
}

.segmented button {
  border: none;
  border-radius: 999px;
  background: none;
  padding: 4px 12px;
  font-size: 0.875rem;
  color: var(--muted);
}

.segmented button[aria-pressed="true"] {
  background: var(--pine);
  color: #fff;
}

/* ----- Coming up ----- */

.coming-up {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-top: 20px;
}

.event {
  background: var(--surface);
  border: 1px solid var(--border);
  border-top: 3px solid var(--cranberry);
  border-radius: var(--radius);
  padding: 10px 14px;
  box-shadow: var(--shadow);
}

.event-when {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 600;
}

.event-title {
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 600;
}

.event-progress {
  font-size: 0.875rem;
  color: var(--muted);
}

/* ----- Screens, groups and cards ----- */

.view-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px;
  margin: 24px 0 14px;
}

.view-header h2 {
  font-size: 1.7rem;
}

.view-controls {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

/* Group headings like "KIDS" with gold lines on both sides */
.group-heading {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 26px 0 12px;
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
}

.group-heading::before, .group-heading::after {
  content: "";
  flex: 1;
  height: 1px;
  background: linear-gradient(to right, transparent, var(--gold-soft), transparent);
}

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

.card-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 8px;
}

.card-title h3 {
  font-size: 1.4rem;
}

.card-sub {
  display: block;
  font-size: 0.85rem;
  color: var(--muted);
}

.card-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.welcome p {
  max-width: 60ch;
  color: var(--muted);
}

.occasion {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.occasion h4 {
  font-size: 1.05rem;
  color: var(--pine);
  margin-bottom: 4px;
}

.stats {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 24px;
  margin: 0;
}

.stats div {
  display: flex;
  gap: 6px;
  align-items: baseline;
}

.stats dt {
  color: var(--muted);
  font-size: 0.85rem;
}

.stats dd {
  margin: 0;
  font-weight: 600;
}

.over, .stats .over dd {
  color: var(--cranberry);
}

/* Spending bar: solid for spent, striped gold for the what-if plan */
.meter {
  display: flex;
  height: 6px;
  margin-top: 8px;
  border-radius: 999px;
  background: var(--surface-2);
  overflow: hidden;
}

.meter-spent {
  background: var(--pine-2);
}

.meter-plan {
  background: repeating-linear-gradient(45deg, var(--gold), var(--gold) 3px, var(--gold-soft) 3px, var(--gold-soft) 6px);
}

.meter.over .meter-spent {
  background: var(--cranberry);
}

.meter.would-be-over .meter-plan {
  background: repeating-linear-gradient(45deg, var(--cranberry), var(--cranberry) 3px, #d89aa3 3px, #d89aa3 6px);
}

td .meter {
  margin-top: 4px;
  height: 4px;
  min-width: 70px;
}

.warning {
  margin: 8px 0 0;
  padding: 6px 10px;
  border-radius: 8px;
  background: var(--cranberry-bg);
  color: var(--cranberry);
  font-weight: 600;
}

.warning::before {
  content: "⚠ ";
}

.badge {
  display: inline-block;
  padding: 0 6px;
  border-radius: 4px;
  background: var(--cranberry);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 600;
}

.empty {
  color: var(--muted);
}

.empty.small {
  font-size: 0.9rem;
  margin: 8px 0 0;
}

.muted {
  color: var(--muted);
}

.note {
  color: var(--muted);
  font-size: 0.85rem;
}

/* ----- Gift list ----- */

.gift-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.gift {
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 96px 112px 116px 200px;
  align-items: center;
  gap: 8px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.gift:last-child {
  border-bottom: none;
}

.gift-head {
  padding: 0 0 4px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.cell-check {
  text-align: center;
}

.cell-planned, .cell-spent {
  text-align: right;
  white-space: nowrap;
}

.cell-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 6px;
}

/* Labels like "Planned" only show on phones, where there are no column headings. */
.cell-label {
  display: none;
}

.whatif-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  cursor: pointer;
}

.whatif-toggle input {
  accent-color: var(--gold);
}

.gift-name {
  font-weight: 500;
}

.gift-link {
  font-size: 0.85rem;
  margin-left: 4px;
}

.gift-meta, .gift-notes {
  font-size: 0.85rem;
  color: var(--muted);
}

.gift-notes {
  font-style: italic;
}

.done-mark {
  color: var(--pine-2);
  font-size: 0.85rem;
  font-weight: 600;
}

.gift.status-given .gift-name,
.gift.status-returned .gift-name {
  color: var(--muted);
}

.gift.status-returned .gift-name {
  text-decoration: line-through;
}

/* The "More" menu */
.menu {
  position: relative;
}

.menu summary {
  list-style: none;
}

.menu summary::-webkit-details-marker {
  display: none;
}

.menu-items {
  position: absolute;
  right: 0;
  top: calc(100% + 4px);
  z-index: 10;
  min-width: 170px;
  display: flex;
  flex-direction: column;
  padding: 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(30, 30, 20, 0.15);
}

.menu-items button {
  border: none;
  text-align: left;
  border-radius: 6px;
}

.menu-items button:hover {
  background: var(--surface-2);
}

/* ----- Wishes ----- */

.nav-count {
  display: inline-block;
  min-width: 20px;
  margin-left: 6px;
  padding: 0 6px;
  border-radius: 999px;
  background: var(--cranberry);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  text-align: center;
  line-height: 1.6;
}

.intro {
  max-width: 70ch;
  margin: -4px 0 16px;
  color: var(--muted);
}

.wish-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.wish {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
}

.wish:last-child {
  border-bottom: none;
}

.wish.status-dismissed .gift-name {
  color: var(--muted);
}

.wish-note {
  display: inline-block;
  margin-top: 2px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--gold);
  text-decoration: none;
}

.wish-note:hover {
  text-decoration: underline;
}

.wished {
  color: var(--gold);
  font-weight: 600;
}

/* Wish list links */

.wish-links h3 {
  font-size: 1.2rem;
}

.small-text {
  font-size: 0.875rem;
  max-width: 70ch;
}

.link-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
}

.link-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px 16px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.link-row:last-child {
  border-bottom: none;
}

.link-name {
  font-weight: 600;
  min-width: 110px;
}

.link-controls {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 1;
  justify-content: flex-end;
  min-width: 0;
}

.link-box {
  flex: 1;
  min-width: 0;
  max-width: 420px;
  font-size: 0.8rem;
  color: var(--muted);
  background: var(--surface-2);
}

/* ----- The kids' wish list page ----- */

.kid-main {
  max-width: 640px;
  padding-top: 24px;
  padding-bottom: 48px;
}

.kid-page .site-header h1 {
  font-size: 1.7rem;
}

.kid-card h2 {
  font-size: 1.45rem;
  color: var(--pine);
  display: flex;
  align-items: center;
  gap: 8px;
}

.kid-card form {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 12px;
}

.kid-card label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
}

.kid-card label input, .kid-card label textarea {
  font-weight: normal;
  font-size: 1.1rem;
  padding: 10px 12px;
}

.kid-add {
  font-size: 1.15rem;
  padding: 12px;
}

.kid-message {
  margin: 0;
  font-weight: 600;
  color: var(--pine-2);
}

.kid-wish-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0;
}

.kid-wish {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}

.kid-wish:last-child {
  border-bottom: none;
}

.kid-wish-star {
  color: var(--gold);
  font-size: 1.3rem;
}

.kid-wish-main {
  flex: 1;
  min-width: 0;
}

.kid-wish-name {
  font-size: 1.1rem;
  font-weight: 500;
  overflow-wrap: anywhere;
}

.kid-wish-notes {
  color: var(--muted);
  font-size: 0.9rem;
  font-style: italic;
}

/* ----- To-do screen ----- */

.stage h3 {
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.count {
  font-family: var(--sans);
  font-size: 0.8rem;
  font-weight: 600;
  min-width: 24px;
  padding: 1px 8px;
  border-radius: 999px;
  background: var(--pine-tint);
  color: var(--pine);
  text-align: center;
}

/* ----- Budget table ----- */

.table-wrap {
  position: relative;
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  box-shadow: var(--shadow);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}

th, td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: middle;
}

thead th {
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  background: var(--surface-2);
}

.budget-table th.group {
  text-align: center;
  font-family: var(--serif);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
  color: var(--pine);
  border-left: 1px solid var(--border);
}

.num {
  text-align: right;
  white-space: nowrap;
}

/* Keep names visible while the table scrolls sideways on a phone. */
.budget-table tbody th, .budget-table tfoot th, .budget-table .corner {
  position: sticky;
  left: 0;
  background: var(--surface);
  font-weight: 600;
}

.budget-table .corner {
  background: var(--surface-2);
}

.budget-table .group-row th {
  position: static;
  padding-top: 14px;
  font-size: 0.75rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--gold);
  background: var(--surface);
}

.budget-table .subtotal th, .budget-table .subtotal td {
  font-size: 0.875rem;
  color: var(--muted);
  background: #fbf8f2;
}

.budget-table tfoot th, .budget-table tfoot td {
  font-weight: 700;
  border-top: 2px solid var(--pine);
  border-bottom: none;
}

.over-count {
  font-size: 0.75rem;
  color: var(--cranberry);
  font-weight: 600;
}

.grand-total {
  margin-top: 16px;
  padding: 16px 18px;
  background: var(--pine);
  color: #fff;
  border-radius: var(--radius);
  border-bottom: 3px double var(--gold);
}

.grand-total-main {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 16px;
}

.grand-total-main strong {
  font-family: var(--serif);
  font-size: 1.8rem;
}

.grand-total .whatif-line, .grand-total .ideas-line {
  display: inline-block;
  margin: 8px 8px 0 0;
}

/* ----- Footer, toast ----- */

.site-footer {
  border-top: 1px solid var(--border);
  margin-top: 24px;
  color: var(--muted);
  font-size: 0.875rem;
}

.footer-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding-top: 16px;
  padding-bottom: 24px;
}

.footer-inner p {
  margin: 0;
  max-width: 60ch;
}

.footer-inner.needs-backup p strong {
  color: var(--cranberry);
}

.footer-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.toast {
  position: fixed;
  left: 50%;
  bottom: 20px;
  transform: translateX(-50%);
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 14px;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 10px 12px 10px 16px;
  background: var(--pine);
  color: #fff;
  border-radius: var(--radius);
  border-bottom: 2px solid var(--gold);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  font-size: 0.9rem;
}

.toast button {
  background: transparent;
  color: var(--gold-soft);
  border-color: var(--gold-soft);
  font-weight: 600;
}

/* ----- Pop-up dialogs ----- */

dialog {
  border: none;
  border-top: 4px solid var(--pine);
  border-radius: var(--radius);
  padding: 20px;
  width: min(460px, calc(100vw - 32px));
  background: var(--surface);
  color: var(--text);
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.25);
}

dialog::backdrop {
  background: rgba(20, 30, 25, 0.45);
}

dialog form {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

dialog label, dialog legend {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-weight: 600;
  font-size: 0.9rem;
}

dialog legend {
  display: block;
  margin-bottom: 4px;
}

dialog label input, dialog label select, dialog label textarea {
  font-weight: normal;
}

dialog fieldset {
  border: none;
  margin: 0;
  padding: 0;
}

.inline-fields {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.inline-fields legend {
  width: 100%;
}

.two-up {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.radio {
  flex-direction: row !important;
  align-items: center;
  gap: 8px !important;
  font-weight: normal !important;
  padding: 4px 0;
}

.hint {
  font-weight: normal;
  color: var(--muted);
  font-size: 0.8rem;
}

label > .hint {
  display: inline;
}

.dialog-title {
  font-size: 1.35rem;
  color: var(--pine);
}

.dialog-message {
  margin: 0;
  color: var(--muted);
}

.form-error {
  margin: 0;
  color: var(--cranberry);
  font-weight: 600;
}

.dialog-buttons {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
}

/* ----- Phones and narrow windows ----- */

@media (max-width: 720px) {
  .view-header h2 {
    font-size: 1.45rem;
  }

  .card {
    padding: 14px;
  }

  .gift-head {
    display: none;
  }

  /* Each gift becomes a small stacked card. */
  .gift {
    grid-template-columns: minmax(0, 1fr) auto;
    grid-template-areas:
      "main    main"
      "planned spent"
      "status  status"
      "check   actions";
    gap: 8px 12px;
    padding: 12px 0;
  }

  .cell-main { grid-area: main; }
  .cell-planned { grid-area: planned; text-align: left; }
  .cell-spent { grid-area: spent; }
  .cell-status { grid-area: status; }
  .cell-check { grid-area: check; text-align: left; }
  .cell-actions { grid-area: actions; }

  .cell-status select {
    width: 100%;
  }

  .cell-label {
    display: inline;
    margin-right: 6px;
    color: var(--muted);
    font-size: 0.8rem;
  }

  .cell-check:empty, .cell-spent:empty {
    display: none;
  }

  .gift-name {
    font-size: 1.05rem;
  }

  .wish {
    grid-template-columns: 1fr;
  }

  /* Wishes share cell names with gifts, but not the gift card's layout. */
  .wish > .cell-main, .wish > .cell-actions {
    grid-area: auto;
  }

  .wish .cell-actions {
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .site-header nav a {
    padding: 6px 10px;
  }

  button.small, .button.small {
    padding: 6px 12px;
    font-size: 0.9rem;
  }

  .two-up {
    grid-template-columns: 1fr;
  }

  .brand {
    gap: 8px;
  }
}
