/* PalmGuru web app (/app). Brand: deep purple + gold + ivory; Playfair Display for display type, Inter for UI.
   Structure: tokens → base → shell (sidebar, topbar) → auth → components → feature screens. */

/* ============================================================ tokens */
:root {
  --pg-bg: #0d0620;
  --pg-bg-2: #12082e;
  --pg-surface: #170c37;
  --pg-card: #1b0f40;
  --pg-card-2: #251656;
  --pg-text: #f5f0e1;
  --pg-muted: #b7acd3;
  --pg-dim: #8c81ac;
  --pg-gold: #d4af37;
  --pg-gold-soft: #f2dc91;
  --pg-line: rgba(255, 255, 255, 0.09);
  --pg-border: rgba(212, 175, 55, 0.28);
  --pg-danger: #ff8f8f;
  --pg-ok: #8ee0a8;
  --pg-radius: 16px;
  --pg-radius-sm: 11px;
  --pg-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --pg-side: 264px;
  --pg-heading: "Playfair Display", Georgia, serif;
  --pg-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
}

/* ============================================================ base */
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
body {
  margin: 0; min-height: 100vh; color: var(--pg-text); font-family: var(--pg-body); font-size: 15px; line-height: 1.6;
  background: radial-gradient(1100px 600px at 12% -10%, rgba(107, 63, 175, 0.22), transparent 60%), radial-gradient(900px 500px at 100% 0%, rgba(212, 175, 55, 0.07), transparent 55%), var(--pg-bg);
  background-attachment: fixed;
  -webkit-font-smoothing: antialiased;
}
a { color: var(--pg-gold-soft); text-underline-offset: 3px; }
a:hover { color: var(--pg-gold); }
:focus-visible { outline: 2px solid var(--pg-gold); outline-offset: 2px; border-radius: 8px; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { margin: 0; line-height: 1.25; }
h1 { font-family: var(--pg-heading); font-size: clamp(1.7rem, 3.2vw, 2.25rem); font-weight: 700; letter-spacing: -0.01em; }
h2 { font-family: var(--pg-heading); font-size: 1.25rem; font-weight: 600; margin-bottom: 10px; }
p { margin: 0 0 12px; }
.muted { color: var(--pg-muted); }
.small { font-size: 0.85rem; }
.center { text-align: center; }
.block { margin-bottom: 18px; }
.skip { position: absolute; left: -999px; top: 0; }
.skip:focus { left: 12px; top: 12px; z-index: 100; background: var(--pg-gold); color: #1a0b3d; padding: 8px 14px; border-radius: 10px; }
.ic { width: 20px; height: 20px; flex: none; }
.page-loading { text-align: center; color: var(--pg-muted); padding: 30vh 16px 0; }

/* ============================================================ app shell */
.shell { min-height: 100vh; }
.side {
  position: fixed; inset: 0 auto 0 0; width: var(--pg-side); z-index: 40; overflow-y: auto; padding: 18px 14px 28px;
  background: linear-gradient(180deg, rgba(23, 12, 55, 0.96), rgba(13, 6, 32, 0.98)); border-right: 1px solid var(--pg-line);
  display: flex; flex-direction: column; gap: 2px; scrollbar-width: thin;
}
.side-brand { display: flex; align-items: center; gap: 10px; padding: 6px 10px 18px; font-family: var(--pg-heading); font-weight: 700; font-size: 1.35rem; color: var(--pg-gold); text-decoration: none; }
.mark { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; color: #1a0b3d; background: linear-gradient(135deg, var(--pg-gold), var(--pg-gold-soft)); box-shadow: 0 6px 16px rgba(212, 175, 55, 0.3); }
.mark .ic { width: 20px; height: 20px; }
.side-head { margin: 18px 10px 6px; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pg-dim); }
.side-link { display: flex; align-items: center; gap: 12px; padding: 9px 12px; border-radius: 10px; color: var(--pg-muted); text-decoration: none; font-weight: 500; font-size: 0.93rem; transition: background 0.15s, color 0.15s; }
.side-link .ic { color: var(--pg-dim); transition: color 0.15s; }
.side-link:hover { background: rgba(255, 255, 255, 0.05); color: var(--pg-text); }
.side-link:hover .ic { color: var(--pg-gold-soft); }
.side-link[aria-current="page"] { background: linear-gradient(90deg, rgba(212, 175, 55, 0.2), rgba(212, 175, 55, 0.06)); color: var(--pg-text); box-shadow: inset 3px 0 0 var(--pg-gold); }
.side-link[aria-current="page"] .ic { color: var(--pg-gold); }

.content { margin-left: var(--pg-side); min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 14px; height: 64px; padding: 0 32px;
  background: rgba(13, 6, 32, 0.78); backdrop-filter: blur(14px); -webkit-backdrop-filter: blur(14px); border-bottom: 1px solid var(--pg-line);
}
.spacer { flex: 1; }
.icon-btn { display: none; place-items: center; width: 40px; height: 40px; border-radius: 10px; border: 1px solid var(--pg-line); background: rgba(255, 255, 255, 0.04); color: var(--pg-text); cursor: pointer; }
.icon-btn:hover { border-color: var(--pg-border); }
.credits-pill { display: inline-flex; align-items: center; gap: 8px; padding: 7px 14px 7px 11px; border-radius: 999px; border: 1px solid var(--pg-border); background: rgba(212, 175, 55, 0.1); color: var(--pg-gold-soft); text-decoration: none; font-weight: 600; font-size: 0.88rem; white-space: nowrap; }
.credits-pill:hover { background: rgba(212, 175, 55, 0.18); color: var(--pg-gold-soft); }
.credits-pill .ic { width: 18px; height: 18px; color: var(--pg-gold); }
.credits-pill.low { border-color: rgba(255, 143, 143, 0.55); background: rgba(255, 143, 143, 0.1); color: var(--pg-danger); }
.credits-pill.low .ic { color: var(--pg-danger); }
.usermenu { display: flex; align-items: center; gap: 10px; }
.avatar { display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 0.78rem; font-weight: 700; color: #1a0b3d; background: linear-gradient(135deg, var(--pg-gold), var(--pg-gold-soft)); }
.who { color: var(--pg-muted); font-size: 0.88rem; max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
main { max-width: 1080px; margin: 0 auto; padding: 34px 32px 72px; }
.pagehead { margin-bottom: 26px; }
.pagehead .lead, .lead { color: var(--pg-muted); margin: 8px 0 0; max-width: 64ch; font-size: 1rem; }
.backdrop { position: fixed; inset: 0; z-index: 35; background: rgba(5, 2, 14, 0.62); backdrop-filter: blur(2px); }
#view:focus { outline: none; }
#view > .pg-page { animation: pg-in 0.22s ease both; }
@keyframes pg-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

@media (max-width: 980px) {
  .side { transform: translateX(-102%); transition: transform 0.22s ease; box-shadow: var(--pg-shadow); width: min(84vw, 300px); z-index: 50; }
  .side.open { transform: none; }
  .content { margin-left: 0; }
  .icon-btn { display: inline-grid; }
  .topbar { padding: 0 16px; }
  main { padding: 24px 16px 56px; }
  .who { display: none; }
}
@media (max-width: 520px) {
  .usermenu .btn { padding: 6px 12px; }
}

/* ============================================================ sign-in */
.auth { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.12fr) minmax(0, 0.88fr); }
.auth-hero { padding: 56px clamp(24px, 6vw, 84px); background: linear-gradient(160deg, rgba(60, 30, 120, 0.55), rgba(13, 6, 32, 0) 70%); display: flex; flex-direction: column; justify-content: center; gap: 22px; }
.auth-brand { display: inline-flex; align-items: center; gap: 12px; font-family: var(--pg-heading); font-size: 1.6rem; font-weight: 700; color: var(--pg-gold); text-decoration: none; }
.auth-hero h1 { font-size: clamp(2rem, 4vw, 3rem); max-width: 18ch; }
.auth-hero .lead { font-size: 1.05rem; }
.auth-points { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 28px; margin-top: 8px; }
.auth-points h2 { font-family: var(--pg-body); font-size: 0.78rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pg-gold); margin-bottom: 12px; }
.ticks { list-style: none; margin: 0; padding: 0; display: grid; gap: 11px; }
.ticks li { position: relative; padding-left: 26px; color: var(--pg-muted); font-size: 0.93rem; }
.ticks li::before { content: ""; position: absolute; left: 0; top: 4px; width: 16px; height: 16px; border-radius: 50%; background: rgba(212, 175, 55, 0.18) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M4 8.4l2.6 2.6L12 5.6' fill='none' stroke='%23d4af37' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") center / 14px no-repeat; }
.ticks strong { color: var(--pg-text); font-weight: 600; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; align-items: center; padding: 40px 24px; gap: 14px; background: rgba(8, 3, 22, 0.5); border-left: 1px solid var(--pg-line); }
.auth-card { width: 100%; max-width: 410px; padding: 30px; box-shadow: var(--pg-shadow); }
.auth-card h2 { font-size: 1.6rem; }
@media (max-width: 900px) {
  .auth { grid-template-columns: 1fr; }
  .auth-hero { padding: 36px 20px 20px; }
  .auth-panel { border-left: 0; padding: 12px 16px 40px; background: none; }
}

/* ============================================================ cards, buttons, forms */
.card {
  background: linear-gradient(180deg, rgba(37, 22, 86, 0.55), rgba(27, 15, 64, 0.7)); border: 1px solid var(--pg-line); border-radius: var(--pg-radius); padding: 24px;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.04) inset, 0 8px 24px rgba(0, 0, 0, 0.18);
}
.card > h2:first-child { margin-top: 0; }
.row { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.row.between { justify-content: space-between; }
.grid { display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); align-items: start; }
.gapped { margin-top: 18px; }
.cards3 { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); }
.stack { display: flex; flex-direction: column; gap: 12px; }
.badge { display: inline-flex; align-items: center; padding: 2px 11px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; background: rgba(212, 175, 55, 0.16); color: var(--pg-gold-soft); border: 1px solid rgba(212, 175, 55, 0.25); }
.badge.ok { background: rgba(142, 224, 168, 0.14); color: var(--pg-ok); border-color: rgba(142, 224, 168, 0.28); }
.badge.warn { background: rgba(255, 143, 143, 0.14); color: var(--pg-danger); border-color: rgba(255, 143, 143, 0.28); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; border: 1px solid transparent; border-radius: 999px;
  padding: 11px 22px; font: inherit; font-weight: 600; text-decoration: none; text-align: center; min-height: 44px; color: #1a0b3d;
  background: linear-gradient(135deg, var(--pg-gold), var(--pg-gold-soft)); box-shadow: 0 6px 18px rgba(212, 175, 55, 0.22);
  transition: transform 0.12s, box-shadow 0.12s, filter 0.12s;
}
.btn:hover { color: #1a0b3d; transform: translateY(-1px); box-shadow: 0 10px 22px rgba(212, 175, 55, 0.3); filter: brightness(1.04); }
.btn:active { transform: none; }
.btn.secondary { background: rgba(255, 255, 255, 0.04); color: var(--pg-gold-soft); border-color: var(--pg-border); box-shadow: none; }
.btn.secondary:hover { background: rgba(212, 175, 55, 0.12); color: var(--pg-text); box-shadow: none; }
.btn.ghost { background: transparent; color: var(--pg-muted); box-shadow: none; border-color: var(--pg-line); }
.btn.ghost:hover { color: var(--pg-text); background: rgba(255, 255, 255, 0.05); box-shadow: none; }
.btn.small { padding: 6px 15px; min-height: 36px; font-size: 0.85rem; }
.btn.block { display: flex; width: 100%; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; transform: none; }

label { display: block; font-weight: 600; font-size: 0.86rem; margin: 16px 0 6px; color: var(--pg-text); }
input[type="email"], input[type="text"], input[type="date"], input[type="time"], input[type="number"], input[inputmode="numeric"], select, textarea {
  width: 100%; padding: 12px 14px; font: inherit; color: var(--pg-text); background: rgba(8, 3, 22, 0.55); border: 1px solid var(--pg-line); border-radius: var(--pg-radius-sm);
  transition: border-color 0.15s, box-shadow 0.15s; color-scheme: dark;
}
input:hover, select:hover, textarea:hover { border-color: rgba(212, 175, 55, 0.35); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--pg-gold); box-shadow: 0 0 0 3px rgba(212, 175, 55, 0.18); }
input::placeholder, textarea::placeholder { color: var(--pg-dim); }
textarea { resize: vertical; }
select { appearance: none; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='M5 8l5 5 5-5' fill='none' stroke='%23b7acd3' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.otp { letter-spacing: 0.4em; font-size: 1.4rem; text-align: center; font-weight: 600; }
.field { margin-bottom: 2px; }
.field > .muted.small { margin: 6px 0 0; }
.error { color: var(--pg-danger); min-height: 1.3em; margin: 8px 0 4px; font-size: 0.9rem; }
.form-status { margin: 14px 0; }
.form .btn[type="submit"] { margin-top: 10px; }
.placefield { position: relative; }
.suggest { position: absolute; z-index: 6; left: 0; right: 0; margin: 4px 0 0; padding: 5px; list-style: none; background: var(--pg-card-2); border: 1px solid var(--pg-border); border-radius: 12px; box-shadow: var(--pg-shadow); }
.suggest li { padding: 9px 11px; border-radius: 8px; cursor: pointer; font-size: 0.92rem; }
.suggest li:hover, .suggest li:focus { background: rgba(212, 175, 55, 0.16); outline: none; }

/* notices */
.notice { border: 1px solid var(--pg-line); border-left: 4px solid var(--pg-gold); background: rgba(37, 22, 86, 0.6); border-radius: 12px; padding: 14px 18px; margin: 0 0 18px; }
.notice > :last-child { margin-bottom: 0; }
.notice.ok { border-left-color: var(--pg-ok); }
.notice.warn, .notice.err { border-left-color: var(--pg-danger); }
.notice.credits { text-align: center; border: 1px solid var(--pg-border); border-left: 1px solid var(--pg-border); background: radial-gradient(500px 200px at 50% 0, rgba(212, 175, 55, 0.14), transparent 70%), var(--pg-card); padding: 28px 20px; }
.notice.credits h2 { margin-bottom: 6px; }

/* tabs */
.tabs { display: flex; gap: 4px; margin: 4px 0 20px; border-bottom: 1px solid var(--pg-line); overflow-x: auto; scrollbar-width: none; }
.tabs::-webkit-scrollbar { display: none; }
.tab { flex: none; background: none; border: 0; border-bottom: 2px solid transparent; margin-bottom: -1px; color: var(--pg-muted); padding: 10px 14px; cursor: pointer; font: inherit; font-size: 0.92rem; font-weight: 500; white-space: nowrap; }
.tab:hover { color: var(--pg-text); }
.tab[aria-selected="true"] { color: var(--pg-gold-soft); border-bottom-color: var(--pg-gold); font-weight: 600; }

/* data display */
.prose { white-space: pre-line; margin: 6px 0; }
.points { margin: 8px 0; padding-left: 1.2em; }
.points li { margin: 6px 0; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 6px 18px; margin: 6px 0; }
.kv dt { color: var(--pg-muted); font-size: 0.86rem; }
.kv dd { margin: 0; font-weight: 500; }
.sub { background: rgba(8, 3, 22, 0.4); border: 1px solid var(--pg-line); border-radius: 12px; padding: 14px 16px; }
.sub h3, .part h3, .part h4 { font-family: var(--pg-heading); font-size: 1.02rem; color: var(--pg-gold-soft); margin: 0 0 6px; font-weight: 600; }
.part { margin-top: 16px; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; min-width: 460px; }
th, td { text-align: left; padding: 12px 10px; border-bottom: 1px solid var(--pg-line); font-size: 0.92rem; }
th { color: var(--pg-dim); font-weight: 600; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.06em; }
tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
.pos { color: var(--pg-ok); }
.neg { color: var(--pg-danger); }
.listitem { display: flex; justify-content: space-between; gap: 14px; align-items: center; padding: 15px 4px; border-bottom: 1px solid var(--pg-line); flex-wrap: wrap; }
.listitem:last-child { border-bottom: 0; }
.listitem a.title { font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--pg-text); }
.listitem a.title:hover { color: var(--pg-gold-soft); }
.meter { height: 8px; background: rgba(255, 255, 255, 0.07); border-radius: 999px; overflow: hidden; margin-top: 7px; }
.meter > i { display: block; height: 100%; border-radius: 999px; background: linear-gradient(90deg, var(--pg-gold), var(--pg-gold-soft)); }
.big, .bignum { font-family: var(--pg-heading); font-size: 2.4rem; font-weight: 700; color: var(--pg-gold-soft); line-height: 1.1; margin: 4px 0; }
.chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; }
.chip { background: rgba(255, 255, 255, 0.04); color: var(--pg-text); border: 1px solid var(--pg-line); border-radius: 999px; padding: 8px 15px; font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left; transition: border-color 0.15s, background 0.15s; }
.chip:hover { border-color: var(--pg-gold); background: rgba(212, 175, 55, 0.1); }
.cost { display: inline-flex; align-items: center; gap: 7px; color: var(--pg-muted); font-size: 0.84rem; margin: 0 0 18px; padding: 5px 12px; border-radius: 999px; background: rgba(212, 175, 55, 0.08); border: 1px solid rgba(212, 175, 55, 0.16); }
.cost::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--pg-gold); }

/* loading */
.skeleton { color: var(--pg-muted); position: relative; padding: 24px; border-radius: var(--pg-radius); background: linear-gradient(90deg, rgba(255, 255, 255, 0.03), rgba(255, 255, 255, 0.08), rgba(255, 255, 255, 0.03)); background-size: 200% 100%; animation: pg-shimmer 1.3s linear infinite; }
@keyframes pg-shimmer { to { background-position: -200% 0; } }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); max-width: min(92vw, 520px); padding: 12px 20px; border-radius: 12px; background: var(--pg-card-2); border: 1px solid var(--pg-border); color: var(--pg-text); display: none; z-index: 80; box-shadow: var(--pg-shadow); }
.toast.show { display: block; }
.toast.err, .toast.error { border-color: var(--pg-danger); }
.fineprint { color: var(--pg-dim); font-size: 0.78rem; max-width: 70ch; margin: 36px 0 0; }
.auth-panel .fineprint { margin-top: 4px; }

/* ============================================================ home */
.hero { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(260px, 1fr); gap: 20px; margin-bottom: 26px; }
.hero-main { padding: 30px; border-radius: 20px; border: 1px solid var(--pg-border); background: radial-gradient(520px 260px at 0 0, rgba(107, 63, 175, 0.55), transparent 70%), radial-gradient(420px 220px at 100% 100%, rgba(212, 175, 55, 0.16), transparent 70%), var(--pg-card); }
.hero-main .eyebrow { font-size: 0.74rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--pg-gold); margin-bottom: 8px; }
.hero-main h1 { margin-bottom: 8px; }
.hero-main p { color: var(--pg-muted); max-width: 46ch; margin: 0; }
.hero-credits { display: flex; flex-direction: column; justify-content: space-between; gap: 14px; }
.hero-credits .bignum { font-size: 2.8rem; }
.section-title { font-family: var(--pg-body); font-size: 0.78rem; font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pg-dim); margin: 30px 0 12px; }
.tile-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); }
a.tile { display: flex; gap: 14px; align-items: flex-start; text-decoration: none; color: var(--pg-text); padding: 18px; border-radius: var(--pg-radius); border: 1px solid var(--pg-line); background: linear-gradient(180deg, rgba(37, 22, 86, 0.5), rgba(27, 15, 64, 0.65)); transition: transform 0.15s, border-color 0.15s, box-shadow 0.15s; }
a.tile:hover { transform: translateY(-2px); border-color: var(--pg-border); box-shadow: 0 12px 28px rgba(0, 0, 0, 0.3); color: var(--pg-text); }
.tile-ic { display: grid; place-items: center; flex: none; width: 42px; height: 42px; border-radius: 12px; color: var(--pg-gold); background: rgba(212, 175, 55, 0.12); border: 1px solid rgba(212, 175, 55, 0.22); }
a.tile strong { display: block; font-weight: 600; font-size: 0.98rem; }
a.tile span.desc { display: block; color: var(--pg-muted); font-size: 0.84rem; line-height: 1.45; margin-top: 2px; }
.quick { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
a.tile.big-tile { padding: 22px; flex-direction: column; gap: 12px; background: radial-gradient(300px 140px at 0 0, rgba(107, 63, 175, 0.35), transparent 70%), var(--pg-card); border-color: var(--pg-border); }
a.tile.big-tile strong { font-family: var(--pg-heading); font-size: 1.15rem; }
@media (max-width: 760px) { .hero { grid-template-columns: 1fr; } .hero-main { padding: 24px; } }

/* ============================================================ chat */
.chatbox { display: flex; flex-direction: column; gap: 14px; min-height: 300px; max-height: 60vh; overflow-y: auto; padding: 6px 4px; scroll-behavior: smooth; }
.bubble { max-width: 86%; padding: 12px 16px; border-radius: 18px; white-space: pre-line; line-height: 1.55; }
.bubble.user { align-self: flex-end; border-bottom-right-radius: 6px; color: #1a0b3d; background: linear-gradient(135deg, var(--pg-gold), var(--pg-gold-soft)); font-weight: 500; }
.bubble.ai { align-self: flex-start; border-bottom-left-radius: 6px; width: 100%; max-width: 100%; white-space: normal; background: rgba(8, 3, 22, 0.45); border: 1px solid var(--pg-line); }
.bubble .take { font-weight: 600; font-size: 1.02rem; margin: 0 0 8px; }
.chatform { display: flex; gap: 10px; margin-top: 14px; align-items: flex-end; }
.chatform textarea { flex: 1; min-height: 48px; }
.chatform .btn { min-height: 48px; padding-inline: 26px; }

/* ============================================================ palm */
.dropzone { display: block; border: 1.5px dashed var(--pg-border); border-radius: var(--pg-radius); padding: 22px; text-align: center; cursor: pointer; background: rgba(8, 3, 22, 0.3); transition: border-color 0.15s, background 0.15s; }
.dropzone:hover { border-color: var(--pg-gold); background: rgba(212, 175, 55, 0.06); }
.dropzone strong { font-size: 1rem; }
.dropzone img { max-width: 100%; max-height: 240px; border-radius: 12px; display: block; margin: 12px auto 0; }
.dropzone input { display: none; }

/* ============================================================ responsive tweaks */
@media (max-width: 560px) {
  .card { padding: 18px; }
  .kv { grid-template-columns: 1fr; gap: 0; }
  .kv dt { margin-top: 8px; }
  .bubble { max-width: 94%; }
  .bignum, .big { font-size: 2rem; }
}
@media (prefers-reduced-motion: reduce) { * { scroll-behavior: auto !important; transition: none !important; animation: none !important; } }

/* ============================================================ wallet */
.pack { display: flex; align-items: center; justify-content: space-between; gap: 12px; width: 100%; padding: 15px 18px; font: inherit; color: var(--pg-text); text-align: left; cursor: pointer; border-radius: 14px; border: 1px solid var(--pg-line); background: rgba(8, 3, 22, 0.4); transition: border-color 0.15s, background 0.15s, transform 0.12s; }
.pack:hover { border-color: var(--pg-gold); background: rgba(212, 175, 55, 0.08); transform: translateY(-1px); }
.pack[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.pack-credits { font-weight: 600; font-size: 1.05rem; }
.pack-credits small { color: var(--pg-muted); font-weight: 400; font-size: 0.85rem; }
.pack-price { font-family: var(--pg-heading); font-size: 1.35rem; font-weight: 700; color: var(--pg-gold-soft); }
.reference { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--pg-line); }
.reference h3 { font-family: var(--pg-body); font-size: 0.74rem; letter-spacing: 0.1em; text-transform: uppercase; color: var(--pg-dim); margin-bottom: 8px; }
.ref { margin: 0 0 10px; display: grid; grid-template-columns: 1fr auto; gap: 7px 14px; }
.ref dt { color: var(--pg-muted); font-size: 0.9rem; }
.ref dd { margin: 0; font-weight: 600; font-variant-numeric: tabular-nums; text-align: right; }

/* ============================================================ facts (compact key/value tiles) */
.facts { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px 22px; margin: 6px 0; }
.fact .k { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pg-dim); }
.fact .v { display: block; font-weight: 600; margin-top: 2px; }
.chiprow { display: flex; flex-wrap: wrap; gap: 8px; }
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.78rem; font-weight: 600; background: rgba(255, 255, 255, 0.06); color: var(--pg-muted); }
.pill.gold { background: rgba(212, 175, 55, 0.16); color: var(--pg-gold-soft); }
.house-grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.house { padding: 12px 14px; border-radius: 12px; border: 1px solid var(--pg-line); background: rgba(8, 3, 22, 0.4); }
.house b { display: block; font-family: var(--pg-heading); color: var(--pg-gold-soft); font-size: 0.95rem; }
.house span { color: var(--pg-muted); font-size: 0.88rem; }
tr.current td { background: rgba(212, 175, 55, 0.07); }
.row-actions { margin: 4px 0 20px; }
.hero-main { display: flex; flex-direction: column; justify-content: center; }
.card > form.form, .card > .form { max-width: 620px; }

/* ============================================================ detail-screen layouts (views.js) */
.k { display: block; font-size: 0.72rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em; color: var(--pg-dim); }
.pill.good { background: rgba(142, 224, 168, 0.14); color: var(--pg-ok); }
.pill.bad { background: rgba(255, 143, 143, 0.14); color: var(--pg-danger); }
.pill.warn { background: rgba(255, 196, 120, 0.14); color: #ffc678; }
.narrative p { margin: 0 0 14px; line-height: 1.7; }
.narrative p:last-child { margin-bottom: 0; }
.itemtitle { font-family: var(--pg-heading); font-size: 1.12rem; font-weight: 600; margin: 0; }
.stat-grid { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); margin-bottom: 18px; }
.stat { display: flex; flex-direction: column; gap: 3px; padding: 16px 18px; border-radius: var(--pg-radius); border: 1px solid var(--pg-line); background: linear-gradient(180deg, rgba(37, 22, 86, 0.5), rgba(27, 15, 64, 0.65)); }
.stat .big-v { font-family: var(--pg-heading); font-size: 1.9rem; font-weight: 700; color: var(--pg-gold-soft); line-height: 1.15; }
.stat .big-v.small-v { font-size: 1.25rem; }
.stat .sub-v { color: var(--pg-muted); font-size: 0.82rem; }
.stat.good { border-color: rgba(142, 224, 168, 0.3); }
.stat.warn { border-color: rgba(255, 196, 120, 0.35); }
.score-card { display: flex; gap: 32px; align-items: center; flex-wrap: wrap; }
.score-side { flex: 1; min-width: 240px; }
.ring { position: relative; width: 150px; flex: none; text-align: center; }
.ring-svg { display: block; width: 150px; height: 150px; }
.ring-label { position: absolute; top: 0; left: 0; width: 150px; height: 150px; display: flex; flex-direction: column; align-items: center; justify-content: center; }
.ring-label b { font-family: var(--pg-heading); font-size: 2.3rem; color: var(--pg-gold-soft); line-height: 1; }
.ring-label span { color: var(--pg-dim); font-size: 0.8rem; }
.ring-cap { margin: 8px 0 0; color: var(--pg-muted); font-size: 0.82rem; }
.barrow { margin-bottom: 12px; }
.barrow .row { font-size: 0.9rem; }
.finding { display: flex; gap: 10px; align-items: baseline; margin-top: 10px; }
.finding .pill { flex: none; }
.rec { margin-top: 12px; padding: 12px 14px; border-radius: 12px; background: rgba(212, 175, 55, 0.08); border: 1px solid rgba(212, 175, 55, 0.18); }
.verdict { margin-top: 18px; }
.compare { display: grid; grid-template-columns: 1fr auto 1fr; gap: 20px; align-items: center; text-align: center; }
.delta { font-family: var(--pg-heading); font-size: 1.6rem; font-weight: 700; color: var(--pg-muted); }
.delta.up { color: var(--pg-ok); }
.delta.down { color: var(--pg-danger); }
.numcard, .tarotcard { padding: 20px; border-radius: var(--pg-radius); border: 1px solid var(--pg-line); background: linear-gradient(180deg, rgba(37, 22, 86, 0.5), rgba(27, 15, 64, 0.65)); text-align: center; }
.numcard .bignum { font-size: 3rem; margin: 6px 0; }
.tarotcard { text-align: left; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; min-height: 190px; border-top: 3px solid var(--pg-gold); }
.tarotcard h3 { font-family: var(--pg-heading); font-size: 1.15rem; margin: 0; }
.tarotcard.reversed { border-top-color: #ffc678; }
.takeaway { border-color: var(--pg-border); background: radial-gradient(420px 160px at 0 0, rgba(212, 175, 55, 0.12), transparent 70%), var(--pg-card); }
.big-q { font-family: var(--pg-heading); font-size: 1.2rem; }
.seg { border-left: 4px solid var(--pg-line); }
.seg.now { border-left-color: var(--pg-gold); box-shadow: 0 0 0 1px rgba(212, 175, 55, 0.35) inset; }
.seg-time { font-weight: 600; color: var(--pg-gold-soft); font-variant-numeric: tabular-nums; }
.trend { margin-top: 4px; }
@media (max-width: 560px) { .compare { grid-template-columns: 1fr; } .score-card { justify-content: center; } }
.tabbody .field { margin-bottom: 18px; }
