/* The Hat Box — Haunted Mansion styling.
   Palette: deep purple #2B0041, nav #1E0036, gold #C9A227, light gold #E8C766, aqua #2FC8EA.
   Fonts: Cinzel (headings), Inter (body). No emojis anywhere in the UI. */
@import url("https://fonts.googleapis.com/css2?family=Cinzel:wght@500;700;900&family=Inter:wght@400;500;600;700&display=swap");

:root {
  --purple: #2b0041;
  --nav: #1e0036;
  --gold: #c9a227;
  --gold-light: #e8c766;
  --aqua: #2fc8ea;
  --ink: #241a2e;
  --paper: #f7f2e7;
  --panel: rgba(24, 2, 40, 0.93);
  --panel-edge: rgba(201, 162, 39, 0.45);
  --nav-w: 264px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: #0f0119 url("/assets/bg-graveyard.webp") no-repeat left top / cover fixed;
  min-height: 100vh;
}
h1, h2, h3, .cinzel { font-family: "Cinzel", serif; }

/* ---------- layout ---------- */
.layout { display: flex; }
.app {
  flex: 1;
  margin-left: var(--nav-w);
  padding: 0 clamp(16px, 4vw, 52px) 120px;
  min-height: 100vh;
  position: relative;
  z-index: 2;
}
.loading { color: #fff; font-family: "Cinzel", serif; font-size: 20px; padding: 60px 10px; text-shadow: 0 2px 10px #000; }

/* ---------- left navigation ---------- */
.side-nav {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w);
  background: var(--nav);
  color: #efe8f7;
  display: flex; flex-direction: column;
  padding: 22px 18px 18px;
  overflow-y: auto;
  z-index: 40;
  box-shadow: 4px 0 24px rgba(0,0,0,0.45);
}
.side-nav .wordmark { width: 100%; height: auto; display: block; margin-bottom: 8px; }
.nav-title { font-family: "Cinzel", serif; text-align: center; color: var(--gold-light); letter-spacing: 3px; font-size: 15px; margin: 2px 0 18px; }
.nav-group { margin-bottom: 20px; }
.nav-group h4 {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 2.5px;
  color: var(--aqua); margin: 0 0 8px; text-transform: uppercase;
}
.nav-link {
  display: block; width: 100%; text-align: left;
  background: transparent; border: 0; color: #efe8f7;
  font: 500 14.5px "Inter", sans-serif; padding: 8px 10px; border-radius: 8px; cursor: pointer;
}
.nav-link:hover { background: rgba(232, 199, 102, 0.12); }
.nav-link.active { background: rgba(201, 162, 39, 0.22); color: var(--gold-light); }
.nav-user { font-size: 13px; color: #cbb8e6; padding: 4px 10px 8px; word-break: break-all; }
.nav-panel {
  margin-top: auto; border: 1px solid var(--panel-edge); border-radius: 12px;
  padding: 12px; background: rgba(255,255,255,0.04);
}
.nav-panel h4 { margin-top: 0; }
.nav-toggle {
  display: none; position: fixed; top: 10px; left: 10px; z-index: 60;
  font-family: "Cinzel", serif; letter-spacing: 2px; font-size: 13px;
  background: var(--nav); color: var(--gold-light); border: 1px solid var(--gold);
  border-radius: 8px; padding: 9px 14px; cursor: pointer;
}

/* ---------- hero (title + search, top right; mansion shows upper left) ---------- */
.hero {
  min-height: 300px;
  display: flex; flex-direction: column; align-items: flex-end; justify-content: flex-start;
  text-align: right; padding-top: 34px; margin-bottom: 6px;
}
.hero h1 {
  margin: 0; font-size: clamp(38px, 5.4vw, 64px); font-weight: 900; color: #fff;
  text-shadow: 0 3px 0 rgba(43,0,65,0.85), 0 8px 30px rgba(0,0,0,0.75); letter-spacing: 1px;
}
.hero .tagline {
  color: var(--gold-light); font-size: clamp(14px, 1.6vw, 18px); margin: 8px 0 22px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.9); font-weight: 500;
}
.search-wrap { width: min(520px, 92vw); }
.search-wrap input {
  width: 100%; padding: 15px 20px; font-size: 16.5px; border-radius: 999px;
  border: 2px solid var(--gold); background: rgba(255,255,255,0.96); color: var(--ink);
  box-shadow: 0 10px 30px rgba(0,0,0,0.5); outline: none;
}
.search-wrap input:focus { border-color: var(--aqua); }

/* ---------- carved wooden plot signs (section titles, single-section views, centered) ---------- */
.plot-row { display: flex; align-items: flex-end; justify-content: center; margin: 34px 0 4px; }
.plot-sign { position: relative; transform: rotate(-0.6deg); }
.plot-sign .board {
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 1.5px;
  font-size: clamp(17px, 2.2vw, 23px); color: #2e1c08;
  padding: 12px 30px 13px; border-radius: 6px;
  background:
    repeating-linear-gradient(180deg, rgba(0,0,0,0.10) 0 2px, transparent 2px 26px),
    linear-gradient(180deg, #8a5a2b 0%, #71471f 45%, #5d3a18 100%);
  border: 2px solid #3d2508;
  box-shadow: inset 0 2px 0 rgba(255,225,160,0.35), inset 0 -3px 0 rgba(0,0,0,0.35), 0 10px 22px rgba(0,0,0,0.55);
  text-shadow: 0 1px 0 rgba(255, 220, 150, 0.4), 0 -1px 1px rgba(0,0,0,0.55);
  white-space: nowrap;
}
.plot-sign .board::before, .plot-sign .board::after {
  content: ""; position: absolute; top: 9px; width: 9px; height: 9px; border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #e8c766, #7a5c10);
  box-shadow: inset 0 -1px 2px rgba(0,0,0,0.6);
}
.plot-sign .board::before { left: 10px; }
.plot-sign .board::after { right: 10px; }
.plot-sign .posts { display: flex; justify-content: space-between; padding: 0 34px; }
.plot-sign .posts span {
  display: block; width: 12px; height: 26px;
  background: linear-gradient(90deg, #4a2e10, #6b4419 55%, #3d2508);
  border-radius: 0 0 3px 3px; box-shadow: 0 6px 10px rgba(0,0,0,0.4);
}

/* ---------- the headline pair (All Plots opening row) ---------- */
.top-pair {
  display: grid; grid-template-columns: 1fr 1fr; gap: 30px 26px;
  max-width: 620px; margin: 26px auto 4px; padding: 0 2px; align-items: start;
}
/* TravelBreeze, the most-used stone: a darker stone with gold lettering */
.stone.featured {
  box-shadow: 0 18px 34px rgba(0,0,0,0.65), inset 0 0 46px rgba(20,0,36,0.5);
}
.stone.featured::before {
  background: linear-gradient(180deg, rgba(56,28,88,0.55), rgba(38,15,62,0.52) 60%, rgba(22,5,38,0.58));
  box-shadow: inset 0 2px 10px rgba(232,199,102,0.28), inset 0 -8px 18px rgba(0,0,0,0.5);
}
.stone.featured .rip { color: var(--gold-light); text-shadow: 0 1px 2px rgba(0,0,0,0.65); }
.stone.featured h3 { color: var(--gold-light); text-shadow: 0 2px 3px rgba(0,0,0,0.65), 0 0 14px rgba(201,162,39,0.35); }
.stone.featured p { color: #f3e3ac; text-shadow: 0 1px 2px rgba(0,0,0,0.6); }
.stone .most-used {
  position: absolute; top: 12px; left: -6px; z-index: 2;
  background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--purple);
  border: 1px solid #8a6d14;
  font-family: "Cinzel", serif; font-size: 10.5px; font-weight: 700; letter-spacing: 1.6px;
  padding: 5px 10px; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); transform: rotate(-3deg);
}

/* ---------- tombstones ---------- */
.stone-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 30px 26px; padding: 20px 2px 10px; align-items: start;
}
.stone {
  position: relative; text-align: center; padding: 15% 9% 20px;
  aspect-ratio: 0.82;
  background: url("/assets/stone-texture.webp") center / cover no-repeat;
  border-radius: 48% 48% 10px 10px / 30% 30% 10px 10px;
  box-shadow: 0 18px 30px rgba(0,0,0,0.55), inset 0 0 40px rgba(0,0,0,0.28);
  display: flex; flex-direction: column; align-items: center;
}
.stone::before { /* the smoothed carved face */
  content: ""; position: absolute; inset: 7% 6.5% 6%;
  border-radius: 48% 48% 8px 8px / 30% 30% 8px 8px;
  background: linear-gradient(180deg, rgba(226,222,212,0.42), rgba(196,191,180,0.30) 60%, rgba(170,165,155,0.34));
  box-shadow: inset 0 2px 10px rgba(255,255,255,0.35), inset 0 -8px 18px rgba(60,55,48,0.30);
}
.stone > * { position: relative; z-index: 1; }
.stone .rip {
  font-family: "Cinzel", serif; font-size: 11px; letter-spacing: 4px; color: #4a443c;
  text-shadow: 0 1px 0 rgba(255,255,255,0.4); margin-bottom: 2px;
}
.stone h3 {
  font-size: clamp(19px, 1.8vw, 23px); margin: 2px 0 6px; color: #2e2a24; font-weight: 900; line-height: 1.15;
  text-shadow: 0 1px 0 rgba(255,255,255,0.45), 0 -1px 1px rgba(0,0,0,0.35);
}
.stone p {
  margin: 0 0 auto; font-size: 13.5px; line-height: 1.45; color: #3d382f; font-weight: 500;
  text-shadow: 0 1px 0 rgba(255,255,255,0.35);
}
.stone .badge {
  position: absolute; top: 12px; right: -6px; z-index: 2;
  background: var(--purple); color: var(--gold-light); border: 1px solid var(--gold);
  font-family: "Cinzel", serif; font-size: 10.5px; font-weight: 700; letter-spacing: 1.6px;
  padding: 5px 10px; border-radius: 4px; box-shadow: 0 4px 10px rgba(0,0,0,0.5); transform: rotate(3deg);
}
.btn-gold {
  margin-top: 14px; border: 0; cursor: pointer;
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 1.2px; font-size: 14.5px;
  color: var(--purple); padding: 12px 20px; border-radius: 999px;
  background: linear-gradient(180deg, var(--gold-light), var(--gold));
  box-shadow: 0 6px 16px rgba(0,0,0,0.45), inset 0 1px 0 rgba(255,255,255,0.65);
  text-decoration: none; display: inline-block;
}
.btn-gold:hover { filter: brightness(1.07); }
.btn-gold:disabled { opacity: 0.55; cursor: default; }
.btn-ghost {
  border: 1px solid var(--gold); background: transparent; color: var(--gold-light);
  font: 600 13.5px "Inter", sans-serif; padding: 9px 15px; border-radius: 999px; cursor: pointer;
}
.btn-ghost:hover { background: rgba(201,162,39,0.15); }
.btn-danger {
  border: 1px solid #b0413e; background: transparent; color: #ff9d99;
  font: 600 13px "Inter", sans-serif; padding: 8px 13px; border-radius: 999px; cursor: pointer;
}
.empty-note { color: #fff; text-shadow: 0 2px 8px #000; font-size: 16px; padding: 22px 4px; }

/* ---------- the Hatbox Ghost (foot of the left nav, decorative only) ---------- */
.nav-ghost { margin-top: 16px; text-align: center; }
.nav-ghost img {
  width: min(152px, 72%); height: auto; opacity: 0.97;
  filter: drop-shadow(0 6px 16px rgba(0,0,0,0.5));
}

/* ---------- panels (Crypt / Leadership) ---------- */
.panel {
  background: var(--panel); color: #f2ecfa; border: 1px solid var(--panel-edge);
  border-radius: 18px; padding: clamp(18px, 3vw, 30px); margin: 26px 0 40px;
  box-shadow: 0 24px 50px rgba(0,0,0,0.55);
}
.panel h2 { color: var(--gold-light); margin: 0 0 4px; font-size: clamp(24px, 3vw, 32px); }
.panel h3 { color: var(--gold-light); margin: 26px 0 10px; font-size: 19px; }
.panel .sub { color: #cbb8e6; margin: 0 0 8px; font-size: 14.5px; }
.panel label { display: block; font-size: 13px; font-weight: 600; color: #d9cbf2; margin: 12px 0 5px; }
.panel input[type="text"], .panel input[type="email"], .panel input[type="password"],
.panel input[type="tel"], .panel input[type="url"], .panel input[type="date"],
.panel input[type="number"], .panel select, .panel textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid #5a3d85;
  background: #fff; color: var(--ink); font: 400 14.5px "Inter", sans-serif;
}
.panel textarea { min-height: 110px; resize: vertical; }
.panel .row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.panel .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.card {
  background: rgba(255,255,255,0.05); border: 1px solid rgba(201,162,39,0.3);
  border-radius: 14px; padding: 16px 18px; margin: 12px 0;
}
.card h4 { margin: 0 0 5px; font-family: "Cinzel", serif; color: #fff; font-size: 17px; }
.card p { margin: 4px 0; font-size: 14px; color: #ddd2f2; line-height: 1.5; }
.card .meta { font-size: 12.5px; color: #b7a6d9; }
.contract-body {
  white-space: pre-wrap; background: rgba(0,0,0,0.35); border-radius: 10px;
  padding: 14px; font-size: 13.5px; line-height: 1.55; color: #e9e2f7; max-height: 300px; overflow-y: auto;
}
.sample-tag {
  display: inline-block; background: #7a1f1c; color: #ffd9d6; border: 1px solid #ff9d99;
  font: 700 10.5px "Inter", sans-serif; letter-spacing: 1.4px; padding: 3px 8px; border-radius: 4px; vertical-align: 2px;
}
table.roster { width: 100%; border-collapse: collapse; font-size: 14px; }
table.roster th, table.roster td { padding: 10px 9px; border-bottom: 1px solid rgba(201,162,39,0.22); text-align: left; vertical-align: top; }
table.roster th { font-family: "Cinzel", serif; color: var(--gold-light); font-size: 12.5px; letter-spacing: 1px; }
table.roster input[type="date"] { width: auto; padding: 7px 9px; }
.tabs { display: flex; gap: 8px; flex-wrap: wrap; margin: 14px 0 6px; }
.tabs button {
  font-family: "Cinzel", serif; font-weight: 700; letter-spacing: 0.6px; font-size: 14px;
  padding: 10px 16px; border-radius: 999px; cursor: pointer;
  border: 1px solid var(--gold); background: transparent; color: var(--gold-light);
}
.tabs button.active { background: linear-gradient(180deg, var(--gold-light), var(--gold)); color: var(--purple); }
.viewas-bar {
  display: flex; gap: 12px; align-items: center; flex-wrap: wrap;
  background: rgba(47,200,234,0.10); border: 1px solid rgba(47,200,234,0.45);
  border-radius: 12px; padding: 12px 14px; margin: 14px 0;
}
.viewas-bar label { margin: 0; color: #bfeaf7; }
.viewas-bar select { width: auto; min-width: 230px; }

/* ---------- renewal flags (hatbox marker) ---------- */
.flag-list { display: grid; gap: 9px; margin: 10px 0; }
.flag-item {
  display: flex; align-items: center; gap: 11px;
  background: rgba(201,162,39,0.13); border: 1px solid rgba(201,162,39,0.55);
  border-radius: 12px; padding: 10px 13px; font-size: 14px; color: #f6ecd2;
}
.flag-item.overdue { background: rgba(176,65,62,0.18); border-color: rgba(255,157,153,0.6); color: #ffe3e1; }
.flag-item .hatbox-ico { width: 27px; height: 27px; flex: 0 0 auto; }
.flag-item .due { margin-left: auto; font-weight: 700; white-space: nowrap; }
.flag-inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: #f6ecd2; }
.flag-inline .hatbox-ico { width: 19px; height: 19px; }
.flags-banner h3 { margin-top: 4px; }

/* ---------- modal / toast ---------- */
.modal-back {
  position: fixed; inset: 0; background: rgba(8,0,16,0.72); z-index: 100;
  display: flex; align-items: center; justify-content: center; padding: 18px;
}
.modal {
  background: #22103c; color: #f2ecfa; border: 1px solid var(--gold); border-radius: 18px;
  width: min(560px, 94vw); max-height: 88vh; overflow-y: auto; padding: 26px;
  box-shadow: 0 30px 70px rgba(0,0,0,0.7);
}
.modal h3 { font-family: "Cinzel", serif; color: var(--gold-light); margin: 0 0 8px; font-size: 21px; }
.modal p { font-size: 14.5px; line-height: 1.55; color: #ddd2f2; }
.modal label { display: block; font-size: 13px; font-weight: 600; margin: 13px 0 5px; color: #d9cbf2; }
.modal input, .modal textarea {
  width: 100%; padding: 11px 13px; border-radius: 10px; border: 1px solid #5a3d85;
  font: 400 15px "Inter", sans-serif; color: var(--ink); background: #fff;
}
.modal .actions { margin-top: 18px; display: flex; gap: 10px; flex-wrap: wrap; }
.modal .error { color: #ff9d99; font-size: 14px; min-height: 18px; margin-top: 10px; }
.toast {
  position: fixed; left: 50%; bottom: 22px; transform: translateX(-50%) translateY(20px);
  background: var(--nav); color: var(--gold-light); border: 1px solid var(--gold);
  padding: 12px 20px; border-radius: 999px; font-size: 14.5px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all 0.25s; z-index: 200; max-width: 92vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .app { margin-left: 0; padding: 0 14px 110px; }
  .side-nav { transform: translateX(-105%); transition: transform 0.25s; width: min(300px, 86vw); }
  .side-nav.open { transform: translateX(0); }
  .nav-toggle { display: block; }
  .hero { min-height: 210px; padding-top: 58px; align-items: stretch; text-align: left; }
  .hero .search-wrap { width: 100%; }
  .stone-grid { grid-template-columns: 1fr; gap: 24px; max-width: 340px; }
  .top-pair { grid-template-columns: 1fr; max-width: 340px; gap: 24px; }
  .nav-ghost img { width: min(132px, 60%); }
  .panel .row { grid-template-columns: 1fr; }
  table.roster { font-size: 13px; }
  .plot-sign .board { white-space: normal; }
}
