/* =====================================================================
   Parent-Teacher Education Library — STYLES
   Palette sampled from the approved Reading Log screenshot.
   ===================================================================== */
:root {
  --purple: #7751C9;        /* primary brand / accent */
  --purple-deep: #6441B2;   /* large serif headings */
  --text: #655C7A;          /* body text */
  --strong: #4C4264;        /* values, dense data */
  --muted: #6F6783;         /* labels, captions */
  --gold: #DFC4A3;          /* decorative only — never text */
  --border: #E4DBF2;
  --track: #F1E9FA;
  --page: #F6EFFA;
  --card: #FCFBFE;
  --tint: #EEE6FA;          /* soft purple fill for pills/active rows */
  --sage-bg: #EDF1EA;       /* small secondary accent */
  --sage-line: #C9D4C3;
  --sage-text: #4F6349;
  --amber-bg: #FBF3E8;
  --amber-line: #E8D3B4;
  --amber-text: #7A5A2E;
  --rose-bg: #FBEDEF;
  --rose-line: #EBC9CF;
  --rose-text: #8A3B4A;

  --serif: "Fraunces", Georgia, "Times New Roman", serif;
  --sans: "Karla", "Helvetica Neue", Arial, sans-serif;
  --script: "Great Vibes", "Snell Roundhand", cursive;

  --r: 18px;
  --r-sm: 12px;
  --shadow: 0 1px 2px rgba(76, 66, 100, .04), 0 6px 18px rgba(119, 81, 201, .05);
  --side: 276px;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--page); color: var(--text);
  font: 400 16px/1.6 var(--sans); -webkit-font-smoothing: antialiased;
}
a { color: var(--purple); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--purple-deep); }
h1, h2, h3, h4 { font-family: var(--serif); color: var(--purple-deep); font-weight: 480; line-height: 1.2; margin: 0; font-optical-sizing: auto; }
p { margin: 0 0 .8em; }
button, input, select, textarea { font: inherit; color: var(--strong); }
:focus-visible { outline: 2px solid var(--purple); outline-offset: 2px; border-radius: 6px; }
[tabindex="-1"]:focus { outline: none; }
.sr-only { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.skip { position: absolute; left: 12px; top: -60px; background: var(--purple); color: #fff; padding: 10px 16px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 12px; color: #fff; }

.ico { width: 20px; height: 20px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; vertical-align: middle; }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--side) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; overflow-y: auto; background: var(--card);
  border-right: 1px solid var(--border); padding: 22px 14px 28px; scrollbar-width: thin;
}
.content { min-width: 0; }
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; gap: 14px;
  padding: 14px clamp(16px, 3vw, 40px); background: rgba(246, 239, 250, .92);
  backdrop-filter: saturate(1.2) blur(8px); -webkit-backdrop-filter: saturate(1.2) blur(8px);
  border-bottom: 1px solid var(--border);
}
.menu-btn { display: none; }
.scrim { display: none; }
.search { position: relative; flex: 1; max-width: 560px; }
.search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 11px 16px 11px 44px; border: 1px solid var(--border); border-radius: 999px;
  background: var(--card); color: var(--strong);
}
.search input::placeholder { color: var(--muted); }
.search input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(119, 81, 201, .15); }
.sync-badge { margin-left: auto; display: inline-flex; align-items: center; gap: 8px; font-size: 13.5px; color: var(--muted); white-space: nowrap; }
.sync-badge .dot { width: 9px; height: 9px; border-radius: 50%; background: var(--gold); }
.sync-ok .dot { background: #6E9B6A; }
.sync-pending .dot { background: var(--gold); animation: pulse 1.4s ease-in-out infinite; }
.sync-warn .dot { background: #C79A57; }
.sync-bad .dot { background: #B5566A; }
.sync-badge .build { font-size: 11px; letter-spacing: .08em; padding: 1px 7px; border: 1px solid var(--border); border-radius: 999px; }
@keyframes pulse { 50% { opacity: .35; } }

main { padding: 28px clamp(16px, 3vw, 40px) 80px; max-width: 1240px; }

/* ---------- Sidebar ---------- */
.brand-link { display: grid; justify-items: center; text-decoration: none; padding: 6px 0 18px; border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.brand-crown { color: var(--purple); }
.brand-crown .ico { width: 24px; height: 24px; }
.brand-eyebrow { font-size: 10.5px; letter-spacing: .32em; text-transform: uppercase; color: var(--purple); font-weight: 700; margin-top: 4px; }
.brand-name { font-family: var(--serif); font-size: 19px; color: var(--purple-deep); margin-top: 6px; letter-spacing: .02em; }
.brand-script { font-family: var(--script); font-size: 36px; color: var(--purple); line-height: .9; margin-top: -2px; }
.nav-group-label { font-size: 11px; letter-spacing: .22em; text-transform: uppercase; color: var(--muted); margin: 18px 12px 6px; font-weight: 700; }
.nav-list { list-style: none; margin: 0; padding: 0; }
.nav-link {
  display: flex; align-items: center; gap: 10px; padding: 7px 12px; border-radius: 10px; color: var(--text);
  text-decoration: none; font-size: 14.5px; line-height: 1.3;
}
.nav-link .ico { width: 18px; height: 18px; color: var(--purple); opacity: .8; }
.nav-link:hover { background: var(--page); color: var(--strong); }
.nav-link.is-active { background: var(--tint); color: var(--purple-deep); font-weight: 600; }
.nav-link.is-active .ico { opacity: 1; }
.nav-text { flex: 1; }
.nav-count { font-size: 12px; color: var(--muted); min-width: 22px; text-align: right; }
.side-foot { text-align: center; margin-top: 22px; color: var(--muted); font-family: var(--serif); font-style: italic; font-size: 13px; }
.side-foot p { margin: 4px 0 0; }

/* ---------- Ornaments ---------- */
.laurel { width: 120px; height: 20px; fill: none; stroke: var(--gold); stroke-width: 1.2; stroke-linecap: round; display: block; margin: 0 auto; }
.laurel .laurel-star { fill: var(--gold); stroke: none; }
.head-rule { margin: 14px auto 0; }

/* ---------- Page head ---------- */
.page-head { text-align: center; margin: 8px auto 28px; max-width: 820px; }
.page-head h1 { font-size: clamp(28px, 3.4vw, 40px); }
.page-sub { margin: 10px auto 0; color: var(--muted); max-width: 680px; }
.eyebrow { font-size: 12px; letter-spacing: .28em; text-transform: uppercase; color: var(--purple); font-weight: 700; margin-bottom: 8px; }
.eyebrow.wide { letter-spacing: .5em; }
.head-actions { margin-top: 14px; display: flex; justify-content: center; gap: 8px; flex-wrap: wrap; align-items: center; }

/* ---------- Hero (dashboard) ---------- */
.hero { text-align: center; padding: 8px 0 6px; }
.hero-crown { color: var(--purple); }
.hero-crown .ico { width: 30px; height: 30px; }
.hero h1 { display: grid; justify-items: center; }
.hero-the { font-family: var(--serif); font-size: clamp(24px, 3.2vw, 38px); letter-spacing: .06em; text-transform: uppercase; color: var(--purple-deep); font-weight: 450; }
.hero-script { font-family: var(--script); font-size: clamp(54px, 7.5vw, 96px); color: var(--purple); line-height: 1.05; font-weight: 400; margin-top: 10px; }
.hero-tag { font-family: var(--serif); font-style: italic; color: var(--muted); font-size: clamp(16px, 1.8vw, 20px); margin-top: 2px; }

.purpose { margin: 18px auto 30px; max-width: 760px; text-align: center; }
.purpose blockquote { margin: 14px 0 12px; font-family: var(--serif); font-style: italic; font-size: clamp(17px, 1.9vw, 21px); line-height: 1.55; color: var(--strong); }
.purpose figcaption { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--purple); font-weight: 600; }
.purpose figcaption span { color: var(--gold); margin: 0 3px; }

/* ---------- Stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 26px; }
.stat { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 14px 16px; text-align: center; box-shadow: var(--shadow); }
.stat-n { font-family: var(--serif); font-size: 38px; line-height: 1; color: var(--purple); font-weight: 500; }
.stat-l { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); margin-top: 10px; font-weight: 600; }
.stat-s { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
@media (min-width: 1180px) { .stats { grid-template-columns: repeat(5, 1fr); } }
.stat-ring { display: flex; align-items: center; gap: 12px; text-align: left; grid-column: span 2; justify-content: center; }
.ring {
  --p: 0; width: 76px; height: 76px; border-radius: 50%; flex: none; display: grid; place-items: center;
  background: conic-gradient(var(--purple) calc(var(--p) * 1%), var(--track) 0);
}
.ring span { width: 60px; height: 60px; border-radius: 50%; background: var(--card); display: grid; place-items: center; font-family: var(--serif); font-size: 19px; color: var(--purple-deep); }

/* ---------- Panels ---------- */
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 22px 22px 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.panel > h2 { font-size: 22px; margin-bottom: 14px; padding-bottom: 10px; border-bottom: 1px solid var(--track); position: relative; }
.panel > h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 44px; height: 1px; background: var(--gold); }
.dash-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 20px; }
.minis { list-style: none; margin: 0; padding: 0; }
.mini { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 10px 0; border-bottom: 1px solid var(--track); }
.mini:last-child { border-bottom: 0; }
.mini-title { font-weight: 600; color: var(--strong); text-decoration: none; }
.mini-title:hover { color: var(--purple); text-decoration: underline; }
.mini-sub { grid-column: 1; font-size: 13.5px; color: var(--muted); }
.mini-pills { grid-column: 2; grid-row: 1 / span 2; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; justify-content: center; }

.sp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 10px 22px; }
.sp { display: grid; grid-template-columns: 1fr auto; gap: 4px 8px; padding: 8px 4px; text-decoration: none; color: var(--text); border-radius: 10px; }
.sp:hover { background: var(--page); }
.sp-name { display: flex; align-items: center; gap: 8px; font-size: 14.5px; color: var(--strong); }
.sp-name .ico { width: 16px; height: 16px; color: var(--purple); }
.sp-n { font-size: 12.5px; color: var(--muted); align-self: center; }
.sp .bar { grid-column: 1 / -1; }
.bar { height: 6px; background: var(--track); border-radius: 999px; overflow: hidden; }
.bar span { display: block; height: 100%; background: linear-gradient(90deg, var(--purple), #9A7ED7); border-radius: inherit; transition: width .4s ease; }

.empty { text-align: center; padding: 18px 10px; color: var(--muted); }
.empty p { margin: 10px auto 0; max-width: 420px; font-size: 14.5px; }

/* ---------- Toolbar / filters ---------- */
.toolbar { display: flex; gap: 14px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.filters { flex: 1 1 520px; background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); }
.filters > summary { cursor: pointer; padding: 11px 16px; display: flex; gap: 8px; align-items: center; color: var(--strong); font-weight: 600; list-style: none; }
.filters > summary::-webkit-details-marker { display: none; }
.filters > summary .ico { color: var(--purple); width: 18px; height: 18px; }
.fcount { margin-left: auto; font-size: 12.5px; color: var(--purple); font-weight: 600; }
.filter-body { padding: 4px 16px 16px; border-top: 1px solid var(--track); }
.fld-row { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 10px 14px; margin-top: 12px; }
.fld { display: grid; gap: 5px; font-size: 13px; }
.fld > span { color: var(--muted); font-weight: 600; letter-spacing: .02em; }
.fld input, .fld select, .fld textarea, .mini-select {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; background: #fff; font-size: 15px;
}
.fld textarea { resize: vertical; line-height: 1.5; }
.fld input:focus, .fld select:focus, .fld textarea:focus, .mini-select:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(119, 81, 201, .14); }
.fld-wide { grid-column: 1 / -1; }
.fld-sort { min-width: 210px; }
.hint { color: var(--muted); font-size: 12.5px; }
.err { color: var(--rose-text); font-size: 12.5px; }
.chip-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 14px; }
.fchip { border: 1px solid var(--border); background: #fff; color: var(--text); border-radius: 999px; padding: 6px 13px; font-size: 13.5px; cursor: pointer; }
.fchip[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.fchk { font-size: 13.5px; display: inline-flex; gap: 6px; align-items: center; margin-left: 4px; }
.result-count { color: var(--muted); font-size: 14px; margin: 4px 0 12px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 7px; padding: 10px 17px; border-radius: 999px; border: 1px solid var(--purple);
  font-weight: 600; font-size: 14.5px; text-decoration: none; cursor: pointer; line-height: 1.2; background: transparent; color: var(--purple);
}
.btn .ico { width: 17px; height: 17px; }
.btn-primary { background: var(--purple); color: #fff; }
.btn-primary:hover { background: var(--purple-deep); color: #fff; }
.btn-ghost { background: #fff; color: var(--purple); border-color: var(--border); }
.btn-ghost:hover { border-color: var(--purple); color: var(--purple-deep); }
.btn-on { background: var(--tint); border-color: var(--tint); color: var(--purple-deep); }
.btn-gold { background: #fff; border-color: var(--gold); color: var(--purple-deep); box-shadow: inset 0 0 0 1px var(--gold); }
.btn-gold:hover { background: #FBF6EF; }
.btn-danger { background: var(--rose-text); border-color: var(--rose-text); color: #fff; }
.btn-sm { padding: 7px 13px; font-size: 13.5px; }
.is-static { cursor: default; }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-top: 12px; }
.icon-btn { width: 34px; height: 34px; display: inline-grid; place-items: center; border-radius: 10px; border: 1px solid var(--border); background: #fff; color: var(--purple); cursor: pointer; }
.icon-btn:disabled { opacity: .35; cursor: default; }
.icon-btn .ico { width: 17px; height: 17px; }
.nolink { font-size: 13.5px; color: var(--muted); font-style: italic; }
.confirm-q { font-weight: 600; color: var(--strong); }
.file-btn { position: relative; }
.tlink { font-size: 13.5px; margin-right: 12px; }

/* ---------- Pills, chips, tags ---------- */
.pill { display: inline-flex; align-items: center; gap: 5px; border-radius: 999px; padding: 2px 10px; font-size: 12.5px; font-weight: 600; line-height: 1.6; white-space: nowrap; }
/* Provider status = outlined; my status = filled. Never confused. */
.pill-provider { border: 1px solid var(--border); background: #fff; color: var(--strong); }
.pill-provider.pill-sage { border-color: var(--sage-line); color: var(--sage-text); background: var(--sage-bg); }
.pill-provider.pill-caution { border-color: var(--amber-line); color: var(--amber-text); background: var(--amber-bg); }
.pill-provider.pill-warn { border-color: var(--rose-line); color: var(--rose-text); background: var(--rose-bg); }
.pill-mine { background: var(--track); color: var(--strong); border: 1px solid transparent; }
.pill-mine.pill-active { background: var(--purple); color: #fff; }
.pill-mine.pill-done { background: var(--purple-deep); color: #fff; }
.pill-mine.pill-ready, .pill-mine.pill-planned { background: var(--tint); color: var(--purple-deep); }
.pill-mine.pill-paused { background: #F3EFF6; color: var(--muted); }
.pill-mine.pill-reference { background: var(--sage-bg); color: var(--sage-text); }
.pill-link { border: 1px solid var(--border); background: #fff; color: var(--strong); }
.pill-link.pill-ok { border-color: var(--sage-line); color: var(--sage-text); background: var(--sage-bg); }
.pill-link.pill-caution { border-color: var(--amber-line); color: var(--amber-text); background: var(--amber-bg); }
.pill-link.pill-warn { border-color: var(--rose-line); color: var(--rose-text); background: var(--rose-bg); }
.prio { font-size: 11.5px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--muted); padding: 2px 0; }
.prio-essential { color: var(--purple-deep); }
.prio-essential::before { content: "◆ "; color: var(--gold); }
.prio-high { color: var(--purple); }
.chip { display: inline-block; font-size: 12.5px; padding: 2px 10px; border-radius: 999px; background: var(--page); color: var(--text); border: 1px solid var(--track); margin: 0 6px 6px 0; }
.chip-soft { background: var(--tint); border-color: var(--tint); color: var(--purple-deep); }
.chips { display: flex; flex-wrap: wrap; }
.subj { display: inline-block; font-size: 12.5px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--border); color: var(--purple); text-decoration: none; margin: 0 6px 6px 0; background: #fff; }
.subj-primary { background: var(--purple); border-color: var(--purple); color: #fff; }
.subj:hover { border-color: var(--purple); }
.ttype { display: inline-block; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--sage-text); background: var(--sage-bg); border: 1px solid var(--sage-line); border-radius: 999px; padding: 2px 10px; margin: 0 6px 6px 0; font-weight: 700; }
.minor { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.flag { display: inline-block; font-size: 11.5px; letter-spacing: .08em; text-transform: uppercase; font-weight: 700; color: var(--purple); margin-right: 10px; }
.flag-ok { color: var(--sage-text); }
.flag-warn { color: var(--rose-text); }
.flag-archived { color: var(--amber-text); }

/* Stars */
.stars { position: relative; display: inline-block; font-size: 16px; letter-spacing: 2px; line-height: 1; vertical-align: -1px; }
.stars-base { color: var(--track); }
.stars-fill { position: absolute; left: 0; top: 0; overflow: hidden; white-space: nowrap; color: var(--purple); }
.stars-none { font-size: 12.5px; color: var(--muted); font-style: italic; }
.take-note { font-family: var(--serif); font-style: italic; color: var(--strong); font-size: 14.5px; }

/* ---------- Resource cards ---------- */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(330px, 1fr)); gap: 18px; }
.rcard {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 20px 20px 16px; box-shadow: var(--shadow);
  display: flex; flex-direction: column; gap: 10px; position: relative;
}
.rcard.is-archived { opacity: .82; border-style: dashed; }
.rcard-top { display: flex; justify-content: space-between; align-items: flex-start; gap: 8px; }
.rcard-eyebrow { font-size: 11.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--purple); font-weight: 700; }
.donecheck { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--purple-deep); color: #fff; flex: none; }
.donecheck .ico { width: 16px; height: 16px; stroke-width: 2.2; }
.rcard-title { font-size: 21px; line-height: 1.25; }
.rcard-title a { color: var(--purple-deep); text-decoration: none; }
.rcard-title a:hover { text-decoration: underline; }
.rcard-flags { margin-top: -4px; }
.rcard-take { display: flex; align-items: baseline; flex-wrap: wrap; gap: 6px 8px; }
.lbl { display: block; font-size: 11px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; margin-bottom: 2px; }
.rcard-focus { margin: 0; color: var(--text); font-size: 15px; }
.rcard-meta { margin: 0; display: grid; gap: 6px; font-size: 14px; }
.rcard-meta > div { display: grid; gap: 2px; }
.rcard-meta dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.rcard-meta dd { margin: 0; color: var(--strong); }
.rcard-meta .subjs { display: flex; flex-wrap: wrap; }
.rcard-tags { margin-top: -2px; }
.rcard-status { display: grid; gap: 6px; padding: 10px 12px; background: var(--page); border-radius: var(--r-sm); }
.srow { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 8px; }
.slbl { font-size: 10.5px; letter-spacing: .16em; text-transform: uppercase; color: var(--muted); font-weight: 700; min-width: 64px; }
.rcard-details { border-top: 1px solid var(--track); padding-top: 8px; }
.rcard-details > summary { cursor: pointer; color: var(--purple); font-weight: 600; font-size: 14px; padding: 4px 0; }
.rcard-details .dsec { margin-top: 10px; }
.rcard-details h4, .dgrid h4 { font-size: 15px; margin-bottom: 4px; }
.rcard-details p { font-size: 14.5px; }
.role-note { background: var(--tint); border-left: 3px solid var(--purple); padding: 8px 12px; border-radius: 0 10px 10px 0; color: var(--strong); }
.dgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 16px; margin-top: 12px; }
.dgrid p { margin: 0; }
.dlink { margin-top: 12px; }
.rcard-foot { margin-top: auto; display: flex; gap: 8px; flex-wrap: wrap; padding-top: 6px; }

/* ---------- Detail page ---------- */
.crumbs { font-size: 13.5px; color: var(--muted); margin-bottom: 12px; }
.crumbs a { color: var(--muted); }
.detail-head { position: relative; background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 28px clamp(18px, 3vw, 34px); box-shadow: var(--shadow); margin-bottom: 22px; }
.detail-head h1 { font-size: clamp(28px, 3.4vw, 40px); margin: 2px 0 8px; padding-right: 64px; }
.detail-subjects { margin: 10px 0 6px; display: flex; flex-wrap: wrap; }
.detail-status { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 14px 0 6px; }
.status-box { border-radius: var(--r-sm); padding: 12px 14px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center; align-content: flex-start; }
.status-box .slbl { width: 100%; }
.status-provider { border: 1px dashed var(--border); background: #fff; }
.status-mine { background: var(--tint); }
.inline-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; width: 100%; }
.detail-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--track); }
.detail-body { display: grid; gap: 18px; }
.dsec-block { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 22px clamp(18px, 3vw, 30px); box-shadow: var(--shadow); }
.dsec-block > h2 { font-size: 22px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--track); position: relative; }
.dsec-block > h2::after { content: ""; position: absolute; left: 0; bottom: -1px; width: 44px; height: 1px; background: var(--gold); }
.lead { font-size: 17px; color: var(--strong); }
.take { margin-top: 6px; }
.mini-h { font-size: 16px; margin: 16px 0 8px; }
.callout { background: var(--tint); border-left: 3px solid var(--purple); padding: 12px 16px; border-radius: 0 12px 12px 0; color: var(--strong); margin: 12px 0; }
.callout-strong { background: #fff; border: 1px solid var(--purple); border-left-width: 4px; border-radius: 12px; font-weight: 600; }
.callout-split { display: grid; grid-template-columns: 1fr 1fr; gap: 0; padding: 0; border: 1px solid var(--border); border-left: 0; background: var(--card); border-radius: var(--r-sm); overflow: hidden; margin: 0 0 18px; }
.callout-split > div { padding: 14px 18px; }
.callout-split > div + div { border-left: 1px solid var(--border); }
.callout-split h3 { font-size: 16px; }
.callout-split p { margin: 2px 0 0; }
.conn { list-style: none; margin: 0; padding: 0; }
.conn li { display: grid; grid-template-columns: minmax(160px, 260px) 1fr; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--track); }
.conn li:last-child { border-bottom: 0; }
.conn a { font-weight: 600; }
.facts { margin: 0; display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 12px 24px; }
.facts dt { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); font-weight: 700; }
.facts dd { margin: 3px 0 0; color: var(--strong); }
.break { word-break: break-all; }
.links { margin: 0; padding-left: 18px; }
.fs { border: 1px solid var(--track); border-radius: var(--r-sm); padding: 14px 16px 16px; margin: 0 0 14px; }
.fs legend { font-family: var(--serif); color: var(--purple-deep); font-size: 17px; padding: 0 6px; }
.fgrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px 16px; margin-top: 8px; }
.check { display: inline-flex; gap: 8px; align-items: center; font-weight: 600; color: var(--strong); cursor: pointer; }
.check input, .fchk input { width: 18px; height: 18px; accent-color: var(--purple); }
.rate { display: flex; gap: 4px; align-items: center; margin-bottom: 12px; }
.rate-star { font-size: 28px; line-height: 1; border: 0; background: none; color: var(--track); cursor: pointer; padding: 2px 3px; }
.rate-star.on { color: var(--purple); }
.seg { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.seg-btn { border: 1px solid var(--border); background: #fff; color: var(--text); padding: 7px 16px; border-radius: 999px; cursor: pointer; font-weight: 600; }
.seg-btn[aria-pressed="true"] { background: var(--purple); border-color: var(--purple); color: #fff; }
.qlist { margin: 6px 0 12px; padding-left: 22px; display: grid; gap: 8px; }
.qlist li { padding-left: 4px; }
.qlist li > input { width: calc(100% - 44px); padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; margin-right: 6px; }
.qlist li > input:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(119, 81, 201, .14); }

/* Rich text */
.rt-label { font-size: 13px; color: var(--muted); font-weight: 600; margin-bottom: 6px; }
.rt-bar { display: flex; gap: 4px; padding: 6px; border: 1px solid var(--border); border-bottom: 0; border-radius: 12px 12px 0 0; background: var(--page); }
.rt-bar button { border: 1px solid transparent; background: none; padding: 4px 10px; border-radius: 8px; cursor: pointer; color: var(--strong); font-size: 14px; }
.rt-bar button:hover { background: #fff; border-color: var(--border); }
.rt-box { min-height: 140px; padding: 12px 14px; border: 1px solid var(--border); border-radius: 0 0 12px 12px; background: #fff; color: var(--strong); line-height: 1.6; }
.rt-box:focus { outline: none; border-color: var(--purple); box-shadow: 0 0 0 3px rgba(119, 81, 201, .14); }
.rt-box ul, .rt-box ol { padding-left: 22px; margin: 6px 0; }

/* Completion check — restrained */
.complete-mark { position: absolute; right: 22px; top: 22px; width: 52px; height: 52px; }
.complete-mark svg { width: 100%; height: 100%; fill: none; stroke-linecap: round; stroke-linejoin: round; }
.complete-mark circle { stroke: var(--gold); stroke-width: 2; }
.complete-mark path { stroke: var(--purple-deep); stroke-width: 3; }
.complete-mark.animate circle { stroke-dasharray: 151; stroke-dashoffset: 151; animation: draw .7s ease forwards; }
.complete-mark.animate path { stroke-dasharray: 40; stroke-dashoffset: 40; animation: draw .45s .55s ease forwards; }
@keyframes draw { to { stroke-dashoffset: 0; } }

/* ---------- Companions ---------- */
.comp { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 24px clamp(18px, 3vw, 30px); box-shadow: var(--shadow); margin-bottom: 22px; }
.comp-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.comp-head h2 { font-size: 26px; }
.progression { margin: 14px 0 16px; }
.progression h3 { font-size: 16px; margin-bottom: 8px; }
.progression ol { list-style: none; counter-reset: s; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.progression li { counter-increment: s; background: var(--page); border: 1px solid var(--track); border-radius: 999px; padding: 4px 14px 4px 6px; font-size: 14px; color: var(--strong); }
.progression li::before { content: counter(s); display: inline-grid; place-items: center; width: 22px; height: 22px; border-radius: 50%; background: var(--purple); color: #fff; font-size: 12px; margin-right: 8px; font-weight: 700; }
.comp-list { list-style: none; margin: 0; padding: 0; counter-reset: c; }
.comp-item { display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; padding: 14px 0; border-bottom: 1px solid var(--track); align-items: start; }
.comp-item:last-child { border-bottom: 0; }
.comp-title { font-family: var(--serif); font-size: 18px; color: var(--purple-deep); text-decoration: none; display: block; }
.comp-title:hover { text-decoration: underline; }
.comp-purpose { margin: 6px 0 0; color: var(--strong); }
.comp-pills { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; }
.warnline { margin: 6px 0 0; font-size: 13.5px; color: var(--rose-text); font-weight: 600; }
.note { text-align: center; color: var(--muted); max-width: 720px; margin: -10px auto 18px; font-size: 14.5px; }

/* ---------- Path ---------- */
.stage { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 20px clamp(16px, 3vw, 28px); box-shadow: var(--shadow); margin-bottom: 18px; }
.stage h2 { font-size: 21px; margin-bottom: 10px; }
.path-list { list-style: none; margin: 0; padding: 0; }
.path-item { display: grid; grid-template-columns: 36px 1fr auto auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--track); }
.path-item:last-child { border-bottom: 0; }
.path-item.is-done .path-n { background: var(--purple-deep); color: #fff; border-color: var(--purple-deep); }
.path-n { width: 32px; height: 32px; border-radius: 50%; border: 1px solid var(--gold); display: grid; place-items: center; font-family: var(--serif); color: var(--purple-deep); }
.path-main a { font-weight: 600; color: var(--strong); text-decoration: none; display: block; }
.path-main a:hover { color: var(--purple); text-decoration: underline; }
.path-pills { display: flex; gap: 8px; align-items: center; }
.path-ctl { display: flex; gap: 6px; align-items: center; }
.mini-select { width: auto; padding: 6px 8px; font-size: 13.5px; }
.empty-line { margin: 0; }

/* ---------- Providers ---------- */
.prov-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.prov { background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 18px 20px; text-decoration: none; display: grid; gap: 6px; box-shadow: var(--shadow); }
.prov:hover { border-color: var(--purple); }
.prov-name { font-family: var(--serif); font-size: 19px; color: var(--purple-deep); }
.prov-n { color: var(--muted); font-size: 14px; }
.prov-price { font-size: 13px; color: var(--muted); }
.pricing { background: var(--card); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 16px 18px; margin: 0 auto 20px; max-width: 820px; }
.pricing h3 { font-size: 17px; margin-bottom: 6px; }

/* ---------- Admin ---------- */
.flash { background: var(--sage-bg); border: 1px solid var(--sage-line); color: var(--sage-text); padding: 12px 16px; border-radius: 12px; margin-bottom: 18px; font-weight: 600; }
.flash-err { background: var(--rose-bg); border-color: var(--rose-line); color: var(--rose-text); }
.lh { margin: 0 12px 8px 0; color: var(--strong); font-weight: 600; }
.table-wrap { overflow-x: auto; margin: 8px -6px 0; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 720px; }
.admin-table th, .admin-table td { text-align: left; padding: 10px 6px; border-bottom: 1px solid var(--track); vertical-align: middle; }
.admin-table thead th { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.admin-table tbody th { font-weight: 600; }
.admin-table tbody th a { color: var(--strong); text-decoration: none; display: block; }
.admin-table tbody th a:hover { color: var(--purple); text-decoration: underline; }
.admin-table tr.is-archived { opacity: .7; }
.row-actions { white-space: nowrap; text-align: right; }
.row-actions .btn { margin-left: 4px; }
.inline-form { display: grid; grid-template-columns: 1fr 2fr auto; gap: 12px; align-items: end; margin-top: 12px; }
.prov-edit { border-top: 1px solid var(--track); padding: 10px 0; }
.prov-edit > summary { cursor: pointer; font-weight: 600; color: var(--strong); }
.editor .checks { display: flex; flex-wrap: wrap; gap: 8px 18px; margin-top: 6px; }
.editor .checks .check { font-weight: 400; }
.checks-cols { display: grid !important; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.comp-edit { align-items: end; }
.sticky-actions { position: sticky; bottom: 0; background: var(--page); padding: 14px 0; border-top: 1px solid var(--border); }

/* ---------- Sign-in ---------- */
.signin { position: fixed; inset: 0; z-index: 200; background: var(--page); display: grid; place-items: center; padding: 20px; }
.signin[hidden] { display: none; }
.signin-card { width: min(420px, 100%); background: var(--card); border: 1px solid var(--border); border-radius: var(--r); padding: 30px 28px; box-shadow: var(--shadow); text-align: center; }
.signin-card form { display: grid; gap: 12px; text-align: left; margin-top: 18px; }

/* ---------- Responsive ---------- */
@media (max-width: 1080px) {
  .app { grid-template-columns: 1fr; }
  .sidebar {
    position: fixed; left: 0; top: 0; bottom: 0; width: min(300px, 86vw); z-index: 60; transform: translateX(-102%);
    transition: transform .25s ease; box-shadow: 0 10px 40px rgba(76, 66, 100, .18);
  }
  body.nav-open .sidebar { transform: none; }
  .scrim { position: fixed; inset: 0; background: rgba(76, 66, 100, .28); z-index: 50; display: none; border: 0; }
  body.nav-open .scrim { display: block; }
  .menu-btn { display: inline-grid; place-items: center; width: 42px; height: 42px; border-radius: 12px; border: 1px solid var(--border); background: var(--card); color: var(--purple); cursor: pointer; }
}
@media (max-width: 720px) {
  main { padding-top: 20px; }
  .topbar { flex-wrap: wrap; gap: 10px; }
  .search { order: 3; flex-basis: 100%; max-width: none; }
  .stat-ring { grid-column: span 1; flex-direction: column; text-align: center; }
  .stats { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-n { font-size: 32px; }
  .cards { grid-template-columns: 1fr; }
  .dash-grid { grid-template-columns: 1fr; }
  .dgrid, .inline-fields, .callout-split { grid-template-columns: 1fr; }
  .callout-split > div + div { border-left: 0; border-top: 1px solid var(--border); }
  .conn li { grid-template-columns: 1fr; gap: 2px; }
  .path-item { grid-template-columns: 32px 1fr; }
  .path-pills, .path-ctl { grid-column: 2; }
  .comp-item { grid-template-columns: 1fr; }
  .comp-pills { flex-direction: row; flex-wrap: wrap; align-items: flex-start; }
  .inline-form { grid-template-columns: 1fr; }
  .detail-head h1 { padding-right: 0; }
  .complete-mark { width: 40px; height: 40px; right: 14px; top: 14px; }
  .sync-badge span:nth-child(2) { max-width: 46vw; overflow: hidden; text-overflow: ellipsis; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}
@media print {
  .sidebar, .topbar, .rcard-foot, .detail-actions, .rt-bar { display: none !important; }
  .app { display: block; }
  body { background: #fff; }
}

/* Labels on soft-purple fills use body text color for 4.5:1+ contrast */
.nav-link.is-active .nav-count,
.status-mine .slbl,
.status-mine .fld > span { color: var(--text); }

.table-wrap { position: relative; }
@media (max-width: 720px) {
  .admin-table { min-width: 0; }
  .admin-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .admin-table tr { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 10px; padding: 12px 6px; border-bottom: 1px solid var(--track); }
  .admin-table th, .admin-table td { border: 0; padding: 0; }
  .admin-table tbody th { grid-column: 1 / -1; }
  .admin-table .row-actions { grid-column: 1 / -1; text-align: left; white-space: normal; }
  .admin-table .row-actions .btn { margin: 4px 6px 0 0; }
}

/* ---------- Import / restore review + safety backups (b2) ---------- */
.review { margin-top: 16px; background: #fff; border: 1px solid var(--purple); border-left-width: 4px; border-radius: 14px; padding: 18px 20px; }
.review:focus { outline: none; }
.review h3 { font-size: 20px; margin-bottom: 8px; }
.review-warn { font-weight: 700; color: var(--strong); background: var(--amber-bg); border: 1px solid var(--amber-line); border-radius: 10px; padding: 10px 14px; }
.review-table { width: 100%; border-collapse: collapse; font-size: 14px; margin: 12px 0; }
.review-table caption { text-align: left; font-family: var(--serif); color: var(--purple-deep); font-size: 16px; padding-bottom: 6px; }
.review-table th, .review-table td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--track); vertical-align: top; }
.review-table thead th { font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--muted); }
.review-table tbody th { font-weight: 600; color: var(--strong); }
.review-table .num { text-align: right; white-space: nowrap; width: 80px; }
.review-table tr.is-warn th, .review-table tr.is-warn .num { color: var(--amber-text); }
.busy { font-weight: 700; color: var(--purple-deep); }
.bk-list { list-style: none; margin: 0; padding: 0; }
.bk { border-top: 1px solid var(--track); padding: 12px 0; display: grid; grid-template-columns: 1fr auto; gap: 8px 16px; }
.bk .review, .bk .bk-preview { grid-column: 1 / -1; }
.bk-main { display: grid; gap: 3px; }
.bk-time { font-weight: 700; color: var(--strong); }
.bk-why { color: var(--text); }
.bk-where { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.bk-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: flex-start; }
.bk-actions .btn:disabled { opacity: .45; cursor: not-allowed; }
code { font-size: .92em; background: var(--page); padding: 1px 5px; border-radius: 5px; color: var(--strong); }
@media (max-width: 720px) {
  .bk { grid-template-columns: 1fr; }
  .review { padding: 14px; }
  .review-table .num { width: 56px; }
}

/* ---------- Sign-in gate (b3) ---------- */
.app[hidden] { display: none !important; }
.signin-title { font-size: 26px; margin: 4px 0 6px; }
.signin-note { background: var(--amber-bg); border: 1px solid var(--amber-line); color: var(--amber-text); border-radius: 10px; padding: 10px 12px; font-size: 14px; text-align: left; margin-top: 12px; }
.signin-card button:disabled, .signin-card input:disabled { opacity: .55; cursor: not-allowed; }
.signin-card .btn { justify-content: center; }
