/* =========================================================
   Memo tile grid — financial_memos_tiles + personal_memos_tiles
   Extracted from per-template <style> blocks so a strict CSP
   (no 'unsafe-inline' on style-src) can be enforced.
   ========================================================= */

.memo-tiles {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.memo-tile {
  position: relative;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius-lg);
  padding: 1.5rem 1.35rem 1.3rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-color 0.15s ease;
  display: flex;
  flex-direction: column;
}

.memo-tile:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-md);
  border-color: #bfdbfe;
}

.memo-tile-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #2563eb, #0ea5e9);
  color: #ffffff;
  font-size: 1.05rem;
  margin-bottom: 0.85rem;
  box-shadow: 0 10px 20px rgba(37, 99, 235, 0.25);
}

/* Info tooltip pinned to the top-right corner of every tile. Reuses the
   existing `.help-tip` component (hover + :focus-within reveal) but
   overrides the default `float: right` which fights the tile's flex
   layout, and bumps z-index so the popup sits over sibling tiles. */
.memo-tile .help-tip {
  position: absolute;
  top: 0.65rem;
  right: 0.7rem;
  float: none;
  margin: 0;
  z-index: 3;
}
.memo-tile .help-tip p {
  /* Anchor the popup under the `i` icon and prevent it being clipped by
     the tile border-radius or a neighbouring tile below. */
  right: -6px;
  left: auto;
  top: calc(100% + 8px);
}

/* Personal memo tiles use a warmer gradient so the two pages read
   distinctly at a glance. Applied by adding the `memo-tiles--personal`
   modifier to the `.memo-tiles` grid container. */
.memo-tiles--personal .memo-tile-icon {
  background: linear-gradient(135deg, #7c3aed, #ec4899);
  box-shadow: 0 10px 20px rgba(124, 58, 237, 0.25);
}

.memo-tile-title {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: var(--color-ink);
}

.memo-tile-count {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 0 1rem;
  color: var(--color-ink-muted);
  font-size: 0.88rem;
  font-weight: 500;
}

.memo-tile-actions {
  margin-top: auto;
  display: flex;
  gap: 0.45rem;
  flex-wrap: wrap;
}

.memo-tile-actions .btn {
  flex: 1 1 auto;
  justify-content: center;
}

/* --- Dashboard intro / how-it-works copy -------------------------------
   Sits above and below the tile grid to orient first-time users. */

.dashboard-intro {
  background: var(--color-surface-muted, #f8fafc);
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 1.1rem 1.35rem;
  margin-bottom: 1.25rem;
  color: var(--color-ink-soft, #334155);
  font-size: 0.95rem;
  line-height: 1.5;
}
.dashboard-intro strong { color: var(--color-ink, #0f172a); }

.how-it-works {
  margin-top: 2rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--color-border, #e2e8f0);
}
.how-it-works-title {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-ink, #0f172a);
  margin: 0 0 0.9rem;
  letter-spacing: 0.01em;
}
.how-it-works-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.9rem;
}
.how-step {
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-md, 10px);
  padding: 0.95rem 1rem;
  display: flex;
  gap: 0.8rem;
  align-items: flex-start;
}
.how-step-num {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 999px;
  background: var(--color-primary, #2563eb);
  color: #ffffff;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.memo-tiles--personal ~ .how-it-works .how-step-num,
.how-it-works--personal .how-step-num {
  background: #7c3aed;
}
.how-step-body h4 {
  margin: 0 0 0.25rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--color-ink, #0f172a);
}
.how-step-body p {
  margin: 0;
  font-size: 0.85rem;
  line-height: 1.45;
  color: var(--color-ink-muted, #64748b);
}

/* Empty-state tweak: new-user encouragement vs. permission-denied
   remain visually distinct via the `.empty-state--new` modifier. */
.empty-state--new {
  text-align: center;
  padding: 2rem 1.25rem;
  border: 1px dashed var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  background: #ffffff;
  color: var(--color-ink-muted, #64748b);
}
.empty-state--new h3 {
  color: var(--color-ink, #0f172a);
  margin: 0.5rem 0 0.4rem;
  font-size: 1.05rem;
}
.empty-state--new p { margin: 0 0 0.9rem; }

/* --- Legal pages (Terms, Privacy) -------------------------------------- */

.legal-body {
  max-width: 760px;
  margin: 1.5rem auto 0;
  color: var(--color-ink-soft, #334155);
  line-height: 1.55;
}
.legal-body h2 {
  margin: 1.6rem 0 0.4rem;
  font-size: 1.1rem;
  color: var(--color-ink, #0f172a);
}
.legal-body p,
.legal-body ul,
.legal-body ol {
  margin: 0 0 0.8rem;
}
.legal-body ul,
.legal-body ol {
  padding-left: 1.4rem;
}
.legal-body li {
  margin: 0.25rem 0;
}
.legal-footnote {
  text-align: center;
  margin: 2rem 0 0;
  font-weight: 600;
}

/* --- Pricing page ------------------------------------------------------- */

.pricing-status {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: var(--radius-lg, 12px);
  padding: 0.85rem 1.1rem;
  margin-bottom: 1.25rem;
  color: #1e3a8a;
}
.pricing-status p { margin: 0; }
.pricing-status i { margin-right: 0.4rem; }

.pricing-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.1rem;
  margin-bottom: 2.25rem;
}
.pricing-card {
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 1.3rem 1.4rem 1.5rem;
  box-shadow: var(--shadow-sm, 0 2px 5px rgba(15, 23, 42, 0.04));
  display: flex;
  flex-direction: column;
}
.pricing-card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
  color: var(--color-ink, #0f172a);
}
.pricing-card--paid {
  border-color: #2563eb;
  box-shadow: 0 12px 24px rgba(37, 99, 235, 0.12);
}
.pricing-price {
  margin: 0.4rem 0 0.9rem;
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary, #2563eb);
}
.pricing-price-unit {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--color-ink-muted, #64748b);
  margin-left: 0.2rem;
}
.pricing-card ul {
  list-style: none;
  padding: 0;
  margin: 0 0 1rem;
  flex: 1;
}
.pricing-card li {
  padding: 0.28rem 0;
  color: var(--color-ink-soft, #334155);
  font-size: 0.92rem;
}
.pricing-card li::before {
  content: "\2713";
  color: #16a34a;
  font-weight: 700;
  margin-right: 0.45rem;
}
.pricing-note {
  margin: 0;
  color: var(--color-ink-muted, #64748b);
  font-size: 0.88rem;
}
.pricing-faq { margin-top: 1.5rem; }
.pricing-faq h2 {
  font-size: 1.1rem;
  margin: 0 0 0.75rem;
  color: var(--color-ink, #0f172a);
}
.pricing-faq h3 {
  margin: 1rem 0 0.3rem;
  font-size: 0.98rem;
  color: var(--color-ink, #0f172a);
}
.pricing-faq p {
  margin: 0;
  color: var(--color-ink-soft, #334155);
  line-height: 1.5;
}

/* --- Bulk trustee assignment -------------------------------------------- */

.bulk-trustee-form {
  display: flex;
  flex-direction: column;
  gap: 1.1rem;
}

.bulk-trustee-controls {
  position: sticky;
  top: 0.75rem;
  z-index: 5;
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  box-shadow: var(--shadow-md, 0 6px 18px rgba(15, 23, 42, 0.08));
  padding: 0.95rem 1.1rem;
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 0.85rem;
  align-items: center;
}
.bulk-trustee-controls > label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--color-ink, #0f172a);
  margin-bottom: 0.3rem;
}
.bulk-trustee-controls select {
  width: 100%;
  padding: 0.5rem 0.7rem;
  border-radius: 10px;
  border: 1px solid var(--color-border-strong, #cbd5f5);
  font-size: 0.95rem;
}
.bulk-trustee-action {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
}
.bulk-trustee-action label {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  margin: 0;
  font-weight: 500;
}

@media (max-width: 640px) {
  .bulk-trustee-controls {
    grid-template-columns: 1fr;
    position: static;
  }
}

.bulk-trustee-block {
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 0.9rem 1.1rem 1rem;
  box-shadow: var(--shadow-sm, 0 2px 5px rgba(15, 23, 42, 0.04));
}
.bulk-trustee-block header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 0.5rem;
  margin-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
}
.bulk-trustee-block h3 {
  margin: 0;
  font-size: 1rem;
  color: var(--color-ink, #0f172a);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.bulk-trustee-all {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.85rem;
  color: var(--color-ink-muted, #64748b);
  font-weight: 500;
  cursor: pointer;
}

.bulk-trustee-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.bulk-trustee-list li {
  padding: 0.45rem 0;
  border-bottom: 1px dashed var(--color-border, #e2e8f0);
}
.bulk-trustee-list li:last-child { border-bottom: 0; }
.bulk-trustee-list label {
  display: grid;
  grid-template-columns: 22px 1fr auto;
  gap: 0.7rem;
  align-items: center;
  cursor: pointer;
  margin: 0;
}
.bulk-trustee-list input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--color-primary, #2563eb);
}
.bulk-trustee-title {
  color: var(--color-ink, #0f172a);
  font-weight: 500;
}
.bulk-trustee-trustees {
  display: inline-flex;
  gap: 0.3rem;
  flex-wrap: wrap;
  justify-content: flex-end;
}

/* --- Trustee preview page ----------------------------------------------- */

.trustee-preview-list {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
}

.trustee-preview-card {
  background: #ffffff;
  border: 1px solid var(--color-border, #e2e8f0);
  border-radius: var(--radius-lg, 12px);
  padding: 1.1rem 1.25rem 1.3rem;
  box-shadow: var(--shadow-sm, 0 2px 5px rgba(15, 23, 42, 0.04));
}

.trustee-preview-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding-bottom: 0.7rem;
  margin-bottom: 0.9rem;
  border-bottom: 1px solid var(--color-border, #e2e8f0);
  flex-wrap: wrap;
}
.trustee-preview-head h2 {
  margin: 0;
  font-size: 1.1rem;
  color: var(--color-ink, #0f172a);
}
.trustee-preview-email {
  margin: 0.1rem 0 0;
  color: var(--color-ink-muted, #64748b);
  font-size: 0.88rem;
}
.trustee-preview-count {
  background: var(--color-primary-soft, #dbeafe);
  color: var(--color-primary-hover, #1d4ed8);
  font-size: 0.82rem;
  font-weight: 600;
  padding: 0.3rem 0.75rem;
  border-radius: 999px;
}

.trustee-preview-buckets {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 0.85rem;
}
.trustee-preview-bucket h4 {
  margin: 0 0 0.35rem;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-ink-muted, #64748b);
}
.trustee-preview-bucket ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.trustee-preview-bucket li {
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--color-border, #e2e8f0);
}
.trustee-preview-bucket li:last-child { border-bottom: 0; }
.trustee-preview-bucket a {
  color: var(--color-ink, #0f172a);
  font-weight: 500;
  text-decoration: none;
}
.trustee-preview-bucket a:hover { color: var(--color-primary, #2563eb); }

.trustee-preview-none {
  margin: 0;
  color: var(--color-ink-muted, #64748b);
  font-style: italic;
  font-size: 0.9rem;
}

.trustee-preview-orphans {
  margin-top: 2rem;
  background: #fef3c7;
  border: 1px solid #fcd34d;
  border-radius: var(--radius-lg, 12px);
  padding: 1rem 1.2rem 1.1rem;
}
.trustee-preview-orphans h2 {
  margin: 0 0 0.35rem;
  font-size: 1.05rem;
  color: #78350f;
}
.trustee-preview-orphans p {
  margin: 0 0 0.7rem;
  color: #92400e;
  font-size: 0.92rem;
}
.trustee-preview-orphans ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.trustee-preview-orphans li {
  padding: 0.3rem 0;
}
.trustee-preview-orphans a {
  color: #78350f;
  font-weight: 600;
}

/* Per-type icon mapping (Font Awesome 4.7 unicode codepoints). */
.memo-tile[data-modelname="bankaccountmemo"] .memo-tile-icon .fa::before    { content: "\f19c"; } /* university */
.memo-tile[data-modelname="cryptoaccountmemo"] .memo-tile-icon .fa::before  { content: "\f15a"; } /* btc */
.memo-tile[data-modelname="cryptowalletmemo"] .memo-tile-icon .fa::before   { content: "\f084"; } /* key */
.memo-tile[data-modelname="loancreditcardmemo"] .memo-tile-icon .fa::before { content: "\f09d"; } /* credit-card */
.memo-tile[data-modelname="mortgagememo"] .memo-tile-icon .fa::before       { content: "\f015"; } /* home */
.memo-tile[data-modelname="pensionmemo"] .memo-tile-icon .fa::before        { content: "\f0d6"; } /* money */
.memo-tile[data-modelname="realestateassetmemo"] .memo-tile-icon .fa::before{ content: "\f1ad"; } /* building */
.memo-tile[data-modelname="otherfinancialassetmemo"] .memo-tile-icon .fa::before { content: "\f201"; } /* line-chart */
.memo-tile[data-modelname="videoimagememo"] .memo-tile-icon .fa::before     { content: "\f03d"; } /* video-camera */
.memo-tile[data-modelname="willmemo"] .memo-tile-icon .fa::before           { content: "\f15c"; } /* file-text */
.memo-tile[data-modelname="writtenmemo"] .memo-tile-icon .fa::before        { content: "\f040"; } /* pencil */
.memo-tile[data-modelname="investmentmemo"] .memo-tile-icon .fa::before     { content: "\f200"; } /* pie-chart */
.memo-tile[data-modelname="funeralwishesmemo"] .memo-tile-icon .fa::before  { content: "\f06c"; } /* leaf */
