/* Applai — shares the palette and Montserrat/Merriweather pairing of ghimirepranjal.com.np */
:root {
  --ink: #2E3A3B;
  --slate: #576F72;
  --sage: #7D9D9C;
  --stone: #DCD7C9;
  --sand: #E4DCCF;
  --paper: #F2F4F3;
  --white: #FFFFFF;
  --strong: #2F6B5A;   /* 80+ fit */
  --good: #A77B3E;     /* 60–79 fit */
  --weak: #A9B2B1;     /* below 60 */
  --danger: #A4442F;
  --line: #D5DCDA;
  --radius-s: 4px;
  --radius-m: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 400 15px/1.55 "Montserrat", system-ui, sans-serif;
}
a { color: var(--slate); }
:focus-visible { outline: 2px solid var(--slate); outline-offset: 2px; }
h1, h2, h3 { line-height: 1.25; margin: 0; }
h1 { font-size: 1.6rem; font-weight: 600; }
h2 { font-size: 1.2rem; font-weight: 600; }
h3 { font-size: 1rem; font-weight: 600; }
p { margin: 0; }
.muted { color: #66706F; }
.small { font-size: 0.85rem; }

/* ---------- controls ---------- */
button, .button {
  font: 600 0.9rem "Montserrat", sans-serif; cursor: pointer;
  border: 1px solid var(--slate); background: var(--slate); color: var(--white);
  padding: 0.6rem 1.1rem; border-radius: var(--radius-s); text-decoration: none; display: inline-block;
}
button:hover, .button:hover { background: var(--ink); border-color: var(--ink); }
button.quiet, .button.quiet { background: transparent; color: var(--slate); }
button.quiet:hover, .button.quiet:hover { background: var(--white); color: var(--ink); }
button.link { background: none; border: none; color: var(--slate); padding: 0; text-decoration: underline; font-weight: 500; }
button:disabled { opacity: 0.5; cursor: wait; }
label { display: block; font-weight: 500; font-size: 0.9rem; margin-bottom: 1rem; }
input, textarea, select {
  display: block; width: 100%; margin-top: 0.35rem; padding: 0.6rem 0.7rem;
  font: 400 0.95rem "Montserrat", sans-serif; color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-s); background: var(--white);
}
textarea { min-height: 9rem; resize: vertical; }
input[type="checkbox"] { display: inline; width: auto; margin: 0 0.5rem 0 0; }
.notice { padding: 0.7rem 0.9rem; border-radius: var(--radius-s); background: var(--white); border-left: 3px solid var(--slate); margin: 1rem 0; }
.notice.error { border-left-color: var(--danger); color: var(--danger); }
.notice.ok { border-left-color: var(--strong); }
[hidden] { display: none !important; }

/* ---------- sign-in page ---------- */
.gate { min-height: 100vh; display: grid; grid-template-columns: 1fr 1fr; }
.gate-story { background: var(--slate); color: var(--white); padding: 4rem clamp(1.5rem, 5vw, 5rem); display: flex; flex-direction: column; justify-content: center; }
.gate-story .wordmark { font-family: "Sacramento", cursive; font-size: 4rem; color: var(--sand); line-height: 1; margin-bottom: 1.5rem; }
.gate-story h1 { font-size: 1.9rem; max-width: 22ch; }
.gate-story ol { margin: 2rem 0 0; padding-left: 1.2rem; max-width: 42ch; }
.gate-story li { margin-bottom: 0.9rem; color: var(--stone); }
.gate-story li strong { color: var(--white); font-weight: 600; }
.gate-form { padding: 4rem clamp(1.5rem, 5vw, 5rem); display: flex; flex-direction: column; justify-content: center; max-width: 34rem; }
.gate-form h2 { margin-bottom: 1.5rem; }
.gate-switch { margin-top: 1.2rem; font-size: 0.9rem; }
@media (max-width: 800px) { .gate { grid-template-columns: 1fr; } .gate-story { padding: 2.5rem 1.5rem; } }

/* ---------- app shell ---------- */
.topbar { display: flex; align-items: center; gap: 1rem; padding: 0.8rem clamp(1rem, 4vw, 2.5rem); background: var(--slate); color: var(--white); }
.topbar .wordmark { font-family: "Sacramento", cursive; font-size: 2.2rem; color: var(--sand); text-decoration: none; line-height: 1; }
.topbar .spacer { flex: 1; }
.credits-pill { background: rgba(255,255,255,0.14); padding: 0.35rem 0.8rem; border-radius: 999px; font-size: 0.85rem; }
.topbar button.quiet { color: var(--white); border-color: rgba(255,255,255,0.5); padding: 0.4rem 0.8rem; }
.topbar button.quiet:hover { background: rgba(255,255,255,0.12); color: var(--white); }
.tabs { display: flex; gap: 0.25rem; padding: 0 clamp(1rem, 4vw, 2.5rem); background: var(--white); border-bottom: 1px solid var(--line); overflow-x: auto; }
.tabs a { padding: 0.9rem 1rem; text-decoration: none; color: #66706F; font-weight: 500; border-bottom: 3px solid transparent; white-space: nowrap; }
.tabs a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--slate); }
main { max-width: 64rem; padding: 2rem clamp(1rem, 4vw, 2.5rem) 4rem; }
.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.25rem; }
.section-head p { max-width: 60ch; margin-top: 0.3rem; }

/* ---------- the fit bar (signature element) ---------- */
.fit { display: grid; grid-template-columns: 1fr 2.6rem; align-items: center; gap: 0.6rem; width: 11rem; }
.fit-track { position: relative; height: 8px; background: var(--stone); border-radius: 4px; }
.fit-fill { position: absolute; inset: 0 auto 0 0; border-radius: 4px; background: var(--weak); }
.fit-tick { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--paper); }
.fit-tick.t60 { left: 60%; } .fit-tick.t80 { left: 80%; }
.fit-num { font-weight: 700; font-variant-numeric: tabular-nums; text-align: right; }
.fit.strong .fit-fill { background: var(--strong); } .fit.strong .fit-num { color: var(--strong); }
.fit.good .fit-fill { background: var(--good); } .fit.good .fit-num { color: var(--good); }
@media (prefers-reduced-motion: no-preference) { .fit-fill { transition: width 600ms ease-out; } }

/* ---------- match list ---------- */
.match-list { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.match { display: grid; grid-template-columns: 1fr auto; gap: 0.5rem 1.5rem; padding: 1.1rem 0; border-bottom: 1px solid var(--line); }
.match-title { font-weight: 600; font-size: 1.02rem; }
.match-meta { color: #66706F; font-size: 0.88rem; }
.match-why { font-size: 0.88rem; margin-top: 0.4rem; }
.match-why .gap { color: var(--danger); }
.match-side { display: flex; flex-direction: column; align-items: flex-end; gap: 0.6rem; }
.match-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: flex-end; }
.match-actions button, .match-actions .button { padding: 0.45rem 0.8rem; font-size: 0.82rem; }
.tier-label { font-size: 0.8rem; font-weight: 600; }
.tier-label.strong { color: var(--strong); } .tier-label.good { color: var(--good); }
@media (max-width: 640px) { .match { grid-template-columns: 1fr; } .match-side { align-items: flex-start; } .match-actions { justify-content: flex-start; } }

/* ---------- panels ---------- */
.panel { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.5rem; margin-bottom: 1.25rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; }
@media (max-width: 800px) { .two-col { grid-template-columns: 1fr; } }
.chips { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.6rem; }
.chip { background: var(--paper); border: 1px solid var(--line); border-radius: 999px; padding: 0.2rem 0.65rem; font-size: 0.82rem; }
.dropzone { border: 2px dashed var(--sage); border-radius: var(--radius-m); padding: 2rem; text-align: center; background: var(--white); }
.packs { display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr)); gap: 1rem; }
.pack { background: var(--white); border: 1px solid var(--line); border-radius: var(--radius-m); padding: 1.25rem; }
.pack .price { font-size: 1.8rem; font-weight: 700; margin: 0.5rem 0; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th { text-align: left; font-weight: 600; color: #66706F; border-bottom: 1px solid var(--line); padding: 0.6rem 0.5rem; }
td { border-bottom: 1px solid var(--line); padding: 0.75rem 0.5rem; vertical-align: middle; }
.table-wrap { overflow-x: auto; }

/* ---------- dialog ---------- */
dialog { border: none; border-radius: var(--radius-m); padding: 1.75rem; width: min(38rem, 94vw); color: var(--ink); }
dialog::backdrop { background: rgba(46, 58, 59, 0.55); }
.dialog-actions { display: flex; gap: 0.6rem; justify-content: flex-end; margin-top: 1rem; }
