/* Circle of Success: admin panel (dashboard layout after the supplied Homeschool reference) */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.admin { margin: 0; background: #f1eef6; color: var(--ink); font: 400 .97rem/1.5 var(--font-body); -webkit-font-smoothing: antialiased; }
img, svg { max-width: 100%; }
a { color: var(--v-700); }
h1, h2, h3 { font-family: var(--font-display); letter-spacing: -.02em; margin: 0; line-height: 1.15; }
::selection { background: var(--sun); color: var(--v-950); }
:focus-visible { outline: 3px solid var(--v-500); outline-offset: 2px; border-radius: 6px; }
.icon { width: 1.2em; height: 1.2em; flex: none; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
* { scrollbar-color: var(--v-300) transparent; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.shell { display: grid; grid-template-columns: 264px minmax(0, 1fr); min-height: 100vh; }
.side { background: #0e0617; color: #d9cbe9; display: flex; flex-direction: column; padding: 18px 14px; position: sticky; top: 0; height: 100vh; overflow-y: auto; }
.side__brand { display: flex; align-items: center; gap: 12px; padding: 6px 8px 18px; border-bottom: 1px solid rgba(255,255,255,.1); margin-bottom: 18px; text-decoration: none; color: #fff; }
.side__brand img { width: 40px; height: auto; background: #fff; border-radius: 12px; padding: 5px; }
.side__brand b { font: 700 1.1rem var(--font-display); display: block; line-height: 1.1; }
.side__brand small { color: #a592bd; font-size: .74rem; }
.side nav { display: grid; gap: 4px; }
.side a.link { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: 12px; color: #d9cbe9; text-decoration: none; font-weight: 600; transition: background-color .2s, color .2s; }
.side a.link:hover { background: rgba(255,255,255,.08); color: #fff; }
.side a.link[aria-current="page"] { background: var(--v-600); color: #fff; box-shadow: 0 8px 20px -8px rgba(122, 63, 176, .8); }
.side a.link .count { margin-left: auto; min-width: 24px; padding: 1px 8px; border-radius: 99px; background: var(--sun); color: var(--v-950); font-size: .78rem; font-weight: 800; text-align: center; }
.side__foot { margin-top: auto; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.1); display: grid; gap: 4px; }
.side__toggle { display: none; }

.main { padding: 26px clamp(18px, 3vw, 40px) 60px; min-width: 0; overflow-x: clip; }
.topbar { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.topbar h1 { font-size: 1.7rem; }
.topbar__user { text-align: right; line-height: 1.25; }
.topbar__user b { display: block; }
.topbar__user small { color: var(--ink-3); }
.topbar__actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.btn.menu-btn { display: none; }

.card { background: #fff; border-radius: 16px; padding: 22px 24px; box-shadow: 0 1px 2px rgba(45,15,77,.05); }
.card + .card { margin-top: 18px; }
.card h2 { font-size: 1.15rem; margin-bottom: 4px; }
.card__head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.muted { color: var(--ink-3); }
.small { font-size: .88rem; }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px; padding: 0 18px; border-radius: 12px; border: 1.5px solid transparent; font: 700 .93rem var(--font-body); text-decoration: none; cursor: pointer; transition: background-color .2s, color .2s, border-color .2s, transform .2s; background: none; white-space: nowrap; }
.btn:active { transform: scale(.97); }
.btn--primary { background: var(--v-700); color: #fff; } .btn--primary:hover { background: var(--v-800); }
.btn--soft { background: var(--v-50); color: var(--v-700); border-color: var(--v-100); } .btn--soft:hover { background: var(--v-100); }
.btn--ghost { border-color: var(--line); color: var(--ink-2); background: #fff; } .btn--ghost:hover { border-color: var(--v-500); color: var(--v-700); }
.btn--danger { color: var(--bad); border-color: #f2cfd2; background: #fff; } .btn--danger:hover { background: var(--bad); color: #fff; border-color: var(--bad); }
.btn--sm { min-height: 34px; padding: 0 12px; font-size: .85rem; border-radius: 10px; }
.btn--icon { width: 34px; padding: 0; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.inline { display: inline; margin: 0; }

/* alerts */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 18px; border-radius: 14px; margin-bottom: 18px; font-weight: 600; }
.alert--ok { background: #e3f6ea; color: #14573a; }
.alert--bad { background: #fde8ea; color: #8e1c24; }
.alert--warn { background: #fff4d6; color: #6b4a00; }
.alert a { color: inherit; }
.alert ul { margin: 4px 0 0; padding-left: 18px; font-weight: 500; }

/* dashboard */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.stat { position: relative; overflow: hidden; display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 120px; }
.stat b { display: block; font: 700 2.1rem/1 var(--font-display); letter-spacing: -.03em; }
.stat span { color: var(--ink-2); font-weight: 600; }
.stat svg.art { width: 92px; height: 92px; flex: none; }
.duo { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; margin-bottom: 18px; }
.duo .card + .card { margin-top: 0; }
.pill-tag { display: inline-block; padding: 2px 10px; border-radius: 99px; background: var(--v-100); color: var(--v-700); font-size: .75rem; font-weight: 800; vertical-align: middle; margin-left: 6px; }
.ticklist { list-style: none; margin: 14px 0 18px; padding: 0; display: grid; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.ticklist li { display: flex; gap: 8px; align-items: center; }
.ticklist .icon { color: var(--v-500); }
.progress { height: 18px; border-radius: 99px; background: #eee9f4; position: relative; overflow: hidden; }
.progress i { display: block; height: 100%; border-radius: 99px; background: var(--v-500); min-width: 2%; }
.progress i.sun { background: var(--sun); }
.progress i.pink { background: var(--sun-d); }
.progress span { position: absolute; inset: 0; display: grid; place-items: center; font-size: .72rem; font-weight: 800; color: #fff; mix-blend-mode: normal; }
.row-activity { display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 14px; }
.mini { background: #f6f3fa; border-radius: 14px; padding: 14px 16px; display: grid; gap: 8px; }
.mini h3 { font-size: 1rem; }
.mini .meta { display: flex; justify-content: space-between; gap: 8px; align-items: center; color: var(--ink-3); font-size: .82rem; }
.cols { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 14px; }
.col { background: #f6f3fa; border-radius: 14px; padding: 16px; display: grid; gap: 10px; align-content: start; }
.col h3 { font-size: 1rem; display: flex; gap: 8px; align-items: center; }
.col .icon { color: var(--v-600); }
.col .big { font: 700 1.6rem/1 var(--font-display); }

/* chips */
.chip { display: inline-flex; align-items: center; gap: 5px; padding: 3px 10px; border-radius: 99px; font-size: .76rem; font-weight: 800; background: var(--v-100); color: var(--v-700); white-space: nowrap; }
.chip--ok { background: #e3f6ea; color: #14573a; }
.chip--off { background: #eee9f4; color: var(--ink-3); }
.chip--new { background: var(--sun); color: var(--v-950); }
.chip--contacted { background: #dff0ff; color: #0b4a85; }
.chip--closed { background: #eee9f4; color: var(--ink-3); }
.chip--sample { background: #fff; border: 1.5px dashed var(--v-500); color: var(--v-700); }

/* tables */
.table-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; min-width: 640px; }
.tbl th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); padding: 10px 14px; border-bottom: 1px solid var(--line); white-space: nowrap; }
.tbl td { padding: 12px 14px; border-bottom: 1px solid #f0ebf6; vertical-align: middle; }
.tbl tr:last-child td { border-bottom: 0; }
.tbl tbody tr:hover { background: #faf8fd; }
.tbl .num { font-variant-numeric: tabular-nums; }
.tbl .t-title { font-weight: 700; display: block; }
.tbl .t-sub { color: var(--ink-3); font-size: .85rem; }
.tbl .acts { display: flex; gap: 6px; justify-content: flex-end; }
.thumb { width: 64px; height: 44px; border-radius: 10px; object-fit: cover; background: var(--v-100); display: block; }
.thumb--sq { width: 44px; height: 44px; }
.empty-state { text-align: center; padding: 48px 16px; color: var(--ink-3); }
.empty-state .icon { width: 40px; height: 40px; color: var(--v-300); margin-bottom: 10px; }

/* photo grid */
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 16px; }
.photo-card { background: #fff; border-radius: 16px; overflow: hidden; box-shadow: 0 1px 2px rgba(45,15,77,.05); display: flex; flex-direction: column; }
.photo-card img { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--v-100); }
.photo-card__body { padding: 12px 14px 14px; display: grid; gap: 8px; }
.photo-card__body b { line-height: 1.2; }
.photo-card .acts { display: flex; gap: 6px; flex-wrap: wrap; }

/* forms */
.form-grid { display: grid; grid-template-columns: minmax(0, 1fr) 330px; gap: 18px; align-items: start; }
.fields { display: grid; grid-template-columns: minmax(0, 1fr); gap: 18px; min-width: 0; }
.f2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.f3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.field { display: grid; gap: 6px; align-content: start; }
.field label { font-weight: 700; font-size: .88rem; }
.field .hint { color: var(--ink-3); font-size: .82rem; }
.field .err { color: var(--bad); font-size: .85rem; font-weight: 700; }
.req { color: var(--bad); }
.input, .select, .textarea { width: 100%; font: 500 .97rem/1.3 var(--font-body); padding: 11px 14px; min-height: 44px; border-radius: 12px; border: 1.5px solid #ddd2ec; background: #fff; color: var(--ink); transition: border-color .2s, box-shadow .2s; appearance: none; }
.select { background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b1f8a' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E"); background-repeat: no-repeat; background-position: right 12px center; background-size: 18px; padding-right: 38px; }
.textarea { min-height: 110px; resize: vertical; line-height: 1.5; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--v-300); }
.input:focus, .select:focus, .textarea:focus { outline: none; border-color: var(--v-700); box-shadow: 0 0 0 4px rgba(153,102,204,.25); }
.field.has-err .input, .field.has-err .select, .field.has-err .textarea { border-color: var(--bad); }
.check { display: flex; align-items: center; gap: 10px; font-weight: 600; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--v-700); }
.dropzone { min-width: 0; border: 2px dashed var(--v-300); border-radius: 14px; background: var(--v-50); padding: 14px; display: grid; gap: 10px; place-items: center; text-align: center; }
.dropzone img { max-height: 180px; width: 100%; object-fit: cover; border-radius: 10px; background: var(--v-100); }
.dropzone input[type=file] { font: inherit; width: 100%; max-width: 100%; min-width: 0; }
.dropzone input[type=file]::file-selector-button { font: 700 .88rem var(--font-body); padding: 8px 14px; margin-right: 10px; border-radius: 10px; border: 0; background: var(--v-700); color: #fff; cursor: pointer; }
.sticky-actions { position: sticky; bottom: 0; background: linear-gradient(to top, #f1eef6 70%, transparent); padding: 18px 0 4px; display: flex; gap: 10px; justify-content: flex-end; margin-top: 18px; }
.filter-tabs { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.filter-tabs a { padding: 7px 14px; border-radius: 99px; background: #fff; text-decoration: none; color: var(--ink-2); font-weight: 700; font-size: .88rem; border: 1.5px solid transparent; }
.filter-tabs a[aria-current="true"] { background: var(--v-700); color: #fff; }
.filter-tabs a:hover:not([aria-current]) { border-color: var(--v-300); }

.hl-preview { font-family: var(--font-display); font-size: 1.15rem; }
.hl-preview mark { background: var(--sun); color: var(--v-950); padding: 0 4px; border-radius: 4px; }
code { background: var(--v-50); padding: 1px 6px; border-radius: 6px; font-size: .88em; }

/* login */
body.login { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: var(--v-950); position: relative; overflow: hidden; }
body.login::before, body.login::after { content: ""; position: absolute; border-radius: 50%; }
body.login::before { width: 620px; height: 620px; border: 70px solid var(--v-800); left: -220px; bottom: -260px; }
body.login::after { width: 260px; height: 260px; background: var(--v-700); right: -80px; top: -90px; }
.login-card { position: relative; z-index: 1; width: min(440px, 100%); background: #fff; border-radius: 28px; padding: 38px 34px; display: grid; gap: 18px; box-shadow: 0 40px 80px -30px rgba(0,0,0,.6); }
.login-card img { width: 130px; margin: 0 auto; }
.login-card h1 { text-align: center; font-size: 1.6rem; }
.login-card p { text-align: center; margin: 0; color: var(--ink-3); }
.login-card .btn { min-height: 50px; }

@media (max-width: 1100px) {
	.cols { grid-template-columns: repeat(2, minmax(0, 1fr)); }
	.form-grid { grid-template-columns: 1fr; }
	.stats { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
	.shell { grid-template-columns: 1fr; }
	.side { position: fixed; inset: 0 auto 0 0; width: 280px; z-index: 60; transform: translateX(-102%); transition: transform .4s var(--ease); box-shadow: 20px 0 60px rgba(0,0,0,.4); }
	.side.open { transform: none; }
	.btn.menu-btn { display: inline-flex; }
	.duo, .f2, .f3 { grid-template-columns: 1fr; }
	.topbar__user small { display: none; }
}
@media (max-width: 560px) { .cols { grid-template-columns: 1fr; } .main { padding-inline: 14px; } }
@media (prefers-reduced-motion: reduce) { *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; } }

/* ---------- loading state for buttons ---------- */
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading { position: relative; color: transparent !important; pointer-events: none; cursor: progress; --spin: #fff; }
.btn.is-loading > * { opacity: 0; }
.btn.is-loading::after { content: ""; position: absolute; inset: 0; margin: auto; width: 22px; height: 22px; border-radius: 50%; border: 3px solid var(--spin); border-right-color: transparent; animation: spin .7s linear infinite; }
.btn--soft.is-loading, .btn--ghost.is-loading { --spin: var(--v-700); }
.btn--danger.is-loading { --spin: var(--bad); }
.btn--sm.is-loading::after { width: 16px; height: 16px; border-width: 2.5px; }
@media (prefers-reduced-motion: reduce) { .btn.is-loading::after { animation-duration: 1.4s !important; animation-iteration-count: infinite !important; } }
