/* Taro - Stage 1 styles */
:root {
  --ink: #1f2328;
  --muted: #667085;
  --line: #e4e7ec;
  --bg: #f6f7f4;
  --card: #ffffff;
  --brand: #2f7d32;        /* leaf green */
  --brand-dark: #23602a;
  --earth: #6b4423;        /* taro brown */
  --accent: #c2185b;       /* taro pink */
  --blue: #1d4ed8;
  --red: #c62828;
  --amber: #b45309;
  --radius: 10px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 1rem/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--brand-dark); }
h1 { font-size: 1.6rem; margin: 0 0 .25rem; line-height: 1.25; }
h2 { font-size: 1.15rem; margin: 0 0 .75rem; }
h3 { font-size: 1rem; margin: 1rem 0 .5rem; }
img { max-width: 100%; height: auto; }
.wrap { max-width: none; margin: 0; padding: 0 24px; }   /* full screen width */

/* top bar */
.topbar { background: #fff; border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar-inner { display: flex; align-items: center; gap: 18px; min-height: 58px; flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: 8px; text-decoration: none; color: var(--earth); font-weight: 700; font-size: 1.2rem; }
.nav { display: flex; gap: 4px; align-items: center; flex-wrap: wrap; }
.nav a, .nav .linkish { padding: 6px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); font-size: .95rem; }
.nav a:hover, .nav .linkish:hover { background: var(--bg); }
.nav a.active { background: #e8f3e8; color: var(--brand-dark); font-weight: 600; }
.who { margin-left: auto; color: var(--muted); font-size: .9rem; }
.textsize { display: flex; gap: 4px; }
.textsize button { font: inherit; font-size: .85rem; padding: 3px 8px; border: 1px solid #cfd4dc; background: #fff; border-radius: 6px; cursor: pointer; }
.linkish { background: none; border: 0; cursor: pointer; font: inherit; }

main.wrap { padding-top: 20px; padding-bottom: 32px; }
.footer { display: flex; justify-content: space-between; color: var(--muted); font-size: .85rem; padding-bottom: 24px; }

/* cards & layout */
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; margin-bottom: 16px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.head-actions { display: flex; gap: 8px; }
.section-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 8px; }
.section-head h2 { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.narrow { max-width: 520px; }
.grid2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 12px; }
.inline { display: inline; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* forms */
label { display: flex; flex-direction: column; gap: 4px; font-weight: 600; font-size: .95rem; }
label.check { flex-direction: row; align-items: center; gap: 8px; font-weight: 400; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search],
input[type=datetime-local], select, textarea {
  font: inherit; font-weight: 400; padding: 9px 11px; border: 1px solid #cfd4dc; border-radius: 8px; background: #fff; width: 100%;
}
textarea { resize: vertical; }
textarea.mono { font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .85rem; }
input:focus, select:focus, textarea:focus { outline: 2px solid #a7d3a9; border-color: var(--brand); }
fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 10px 14px; }
legend { font-weight: 600; padding: 0 4px; }
.checks { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 4px 12px; }
.mark-input input { max-width: 120px; }
.search { display: flex; gap: 6px; align-items: center; }
.search input { width: 220px; }

/* buttons */
.btn { display: inline-block; padding: 8px 14px; border-radius: 8px; border: 1px solid #cfd4dc; background: #fff; color: var(--ink);
  font: inherit; font-size: .95rem; cursor: pointer; text-decoration: none; line-height: 1.3; }
.btn:hover { background: #f2f4f7; }
.btn-primary { background: var(--brand); border-color: var(--brand); color: #fff; font-weight: 600; }
.btn-primary:hover { background: var(--brand-dark); }
.btn-small { padding: 4px 10px; font-size: .85rem; }
.btn-danger { color: var(--red); border-color: #f3b8b8; }
.btn-danger:hover { background: #fdecec; }

/* flash & badges */
.flash { padding: 10px 14px; border-radius: 8px; margin-bottom: 12px; background: #e8f3e8; border: 1px solid #b7dcb9; }
.flash-error { background: #fdecec; border-color: #f3b8b8; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.badge-grey { background: #eef0f3; color: #475467; }
.badge-green { background: #e3f4e4; color: #1e6b22; }
.badge-blue { background: #e6edfd; color: #1d4ed8; }
.badge-red { background: #fdecec; color: var(--red); }
.badge-amber { background: #fdf3e2; color: var(--amber); }

/* tables */
.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: .8rem; text-transform: uppercase; letter-spacing: .03em; color: var(--muted); font-weight: 600; }
.table th, .table td { padding: 9px 8px; border-bottom: 1px solid var(--line); vertical-align: top; }
.table tr:last-child td { border-bottom: 0; }
.row-archived td { opacity: .6; }
.tabs { display: flex; gap: 4px; margin-bottom: 10px; flex-wrap: wrap; }
.tabs a { padding: 5px 10px; border-radius: 8px; text-decoration: none; color: var(--ink); }
.tabs a.active { background: #e8f3e8; color: var(--brand-dark); font-weight: 600; }
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; margin-top: 12px; }

/* homework content */
.content { overflow-wrap: anywhere; }
.content img { max-width: 100%; height: auto; border: 1px solid var(--line); border-radius: 6px; cursor: zoom-in; transition: transform .2s; }
.content table { border-collapse: collapse; }
.content a[href$=".pdf" i]::before { content: "PDF"; background: var(--earth); color: #fff; border-radius: 4px; padding: 1px 5px; font-size: .7rem; font-weight: 700; margin-right: 6px; vertical-align: 1px; }
.content td, .content th { border: 1px solid var(--line); padding: 4px 8px; }
.resp { border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin: 12px 0; background: #fff; }
.resp-hidden { background: #fbf8ef; }
.resp-deleted { background: #f4f4f4; opacity: .75; }
.resp-head { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.resp-actions { display: flex; gap: 8px; align-items: flex-start; flex-wrap: wrap; margin-top: 10px; }
.author-head { border-top: 1px solid var(--line); padding-top: 12px; }
.feedback { margin-top: 12px; border-left: 4px solid var(--brand); background: #f3f9f3; padding: 10px 14px; border-radius: 0 8px 8px 0; }
.feedback-head { font-weight: 700; margin-bottom: 4px; }
.mark { color: #fff; background: var(--brand); border-radius: 6px; padding: 1px 8px; margin-left: 4px; }
.mark-box { width: 100%; border: 1px dashed #cfd4dc; border-radius: 8px; padding: 8px 12px; }
.mark-box summary { cursor: pointer; font-weight: 600; color: var(--brand-dark); }
.mark-box form { margin-top: 10px; }
.mark-on-image { margin: 4px 0 10px; }

/* files */
.files { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
/* Pictures of work are shown at full width so they can be read without opening them. */
.file-img { margin: 0; width: 100%; }
.file-img img { display: block; width: 100%; max-width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fafafa; }
.file-img.is-marked img { border: 2px solid var(--brand); }
.file-img figcaption { font-size: .9rem; color: var(--muted); overflow-wrap: anywhere; margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.file-doc { align-self: flex-start; }
.marked-caption { font-size: .9rem; color: var(--muted); margin: 4px 0 10px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.content img[data-remove-marked] { border: 2px solid var(--brand); }
.file-doc { display: flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; }
.doc-icon { background: var(--earth); color: #fff; border-radius: 4px; padding: 2px 6px; font-size: .7rem; font-weight: 700; }
.file-missing { color: var(--muted); padding: 8px 12px; border: 1px dashed var(--line); border-radius: 8px; }

/* login */
.page-login .login-card { max-width: 420px; margin: 24px auto; text-align: left; }
.login-logo { display: block; width: 180px; margin: 0 auto 8px; }

/* annotate */
.annotate-bar { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; position: sticky; top: 64px; z-index: 5; }
.tools { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.tool { padding: 6px 10px; border: 1px solid #cfd4dc; background: #fff; border-radius: 8px; cursor: pointer; font: inherit; min-width: 40px; }
.tool.active { background: #e8f3e8; border-color: var(--brand); font-weight: 700; }
.swatch { width: 28px; height: 28px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 0 0 1px #cfd4dc; cursor: pointer; }
.swatch.active { box-shadow: 0 0 0 3px var(--ink); }
.sep { width: 1px; height: 24px; background: var(--line); margin: 0 4px; }
.tools label { flex-direction: row; align-items: center; font-weight: 400; }
/* PDFs shown as pages (assets/pdfpages.js) */
[hidden] { display: none !important; }
.file-pdf { width: 100%; }
.pdf-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; }
.pdf-pages { display: flex; flex-direction: column; gap: 18px; margin-top: 10px; }
.pdf-page { margin: 0; width: 100%; }
.pdf-page img, .pdf-sheet { display: block; width: 100%; height: auto; border-radius: 8px; border: 1px solid var(--line); background: #fff; }
.pdf-sheet { display: flex; align-items: center; justify-content: center; color: var(--muted); }
.pdf-page.is-marked img { border: 2px solid var(--brand); }
.pdf-page figcaption { font-size: .9rem; color: var(--muted); margin-top: 6px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pdf-nav { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 10px; overflow-wrap: anywhere; }
.canvas-wrap { overflow: auto; }
.canvas-wrap canvas { width: 100%; height: auto; touch-action: none; border: 1px solid var(--line); border-radius: 6px; cursor: crosshair; display: block; }
.canvas-wrap.fit canvas { width: auto; max-width: 100%; max-height: calc(100vh - 170px); margin: 0 auto; }
.canvas-wrap.moving canvas { touch-action: auto; cursor: grab; }

@media (max-width: 640px) {
  .who { display: none; }
  .table th:nth-child(n+4), .table td:nth-child(n+4) { display: none; }
  .search input { width: 150px; }
}

/* Accounts and My people (patch 3) */
.login-card.wide-card { max-width: 560px; }
label.radio { flex-direction: row; align-items: flex-start; gap: 8px; font-weight: 400; }
label.radio input { margin-top: .3em; }
fieldset.roles { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px 10px; display: flex; flex-direction: column; gap: 6px; }
fieldset.roles legend { font-weight: 600; padding: 0 4px; }
.hint { font-weight: 400; font-size: .85rem; color: var(--muted); }
.label-text { display: block; font-weight: 600; font-size: .95rem; margin-bottom: 4px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row select, .row input { width: auto; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; overflow: hidden; }
.card.notice { border-color: #f3d39b; background: #fffaf0; }
.request { padding: 10px 0; border-top: 1px solid var(--line); }
.request:first-of-type { border-top: 0; }
.request p { margin: 0 0 6px; }
.inline-form { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.inline-form input[type=password] { width: auto; }
.person { padding: 10px 0; border-top: 1px solid var(--line); }
.person:first-of-type { border-top: 0; }
ul.plain { list-style: none; padding: 0; margin: 6px 0; display: flex; flex-direction: column; gap: 4px; }
.copy-row { display: flex; gap: 8px; max-width: 640px; }
.copy-row input { flex: 1; font-family: ui-monospace, Menlo, Consolas, monospace; font-size: .9rem; }
.people-grid { align-items: start; margin-bottom: 0; }
.people-grid > .card { margin-bottom: 16px; }
.prose { max-width: 860px; line-height: 1.6; }
.prose h2 { margin-top: 1.4em; font-size: 1.15rem; }
.prose li { margin-bottom: 4px; }
details.card > summary { cursor: pointer; }

/* Classes, marks grid and progress (patch 4) */
.grid2.tight { gap: 10px 16px; }
.input-inline { width: auto; min-width: 10em; }
.search select { width: auto; }
.danger-row { margin-top: 14px; padding-top: 12px; border-top: 1px solid var(--line); }
.class-chips { display: flex; flex-wrap: wrap; gap: 10px; }
.class-chip { display: flex; flex-direction: column; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: var(--radius);
  text-decoration: none; color: var(--ink); min-width: 200px; background: #fbfcfa; }
.class-chip:hover { border-color: var(--brand); }
.grid-scroll { overflow-x: auto; }
.marks-grid { width: auto; min-width: 100%; }
.marks-grid th.hw-col { text-transform: none; letter-spacing: 0; font-size: .82rem; min-width: 7.5em; max-width: 11em; white-space: normal; }
.marks-grid th.who-col { text-transform: none; letter-spacing: 0; font-size: .95rem; color: var(--ink); white-space: nowrap; }
.marks-grid td { text-align: center; white-space: nowrap; font-variant-numeric: tabular-nums; }
.marks-grid td a { color: inherit; text-decoration: none; display: block; }
.marks-grid tfoot th, .marks-grid tfoot td { border-top: 2px solid var(--line); font-weight: 600; }
.marks-grid td.avg { font-weight: 700; }
.mk-high { background: #e3f4e4; color: #1e6b22; }
.mk-mid { background: #fdf3e2; color: #8a4b08; }
.mk-low { background: #fdecec; color: var(--red); }
.st-waiting { background: #e6edfd; color: var(--blue); }
.st-missing { color: var(--red); }
.st-todo { color: var(--muted); }
.legend span { display: inline-block; padding: 1px 7px; border-radius: 6px; margin-right: 2px; }
.stats { display: flex; flex-wrap: wrap; gap: 12px; margin-bottom: 16px; }
.stat { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 18px; min-width: 130px; display: flex; flex-direction: column; }
.stat-n { font-size: 1.6rem; font-weight: 700; border-radius: 6px; align-self: flex-start; padding: 0 4px; }
.stat-l { color: var(--muted); font-size: .85rem; }
.txt-red { color: var(--red); }

/* Tutor profiles and Find a tutor */
.profile-strip { display: flex; justify-content: space-between; align-items: center; gap: 12px; flex-wrap: wrap; }
.lead { font-size: 1.05rem; max-width: 760px; }
.profile-head { display: flex; gap: 22px; align-items: flex-start; flex-wrap: wrap; }
.profile-head h1 { margin: 0 0 4px; }
.headline { font-size: 1.08rem; margin: 0 0 8px; }
.profile-photo { width: 160px; height: 160px; border-radius: 50%; object-fit: cover; border: 3px solid #fff; box-shadow: 0 1px 4px rgba(0,0,0,.15); flex: none; }
.profile-photo.small { width: 84px; height: 84px; }
.profile-photo.placeholder { display: flex; align-items: center; justify-content: center; background: #e8f3e8; color: var(--brand-dark); font-size: 1.8rem; font-weight: 700; }
.profile-edit-top { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.photo-box { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; max-width: 220px; }
.photo-box .profile-photo.placeholder { font-size: .95rem; font-weight: 400; color: var(--muted); }
.grow { flex: 1; min-width: 260px; }
.find-filters { display: flex; flex-wrap: wrap; gap: 12px; align-items: flex-end; }
.find-filters label { min-width: 200px; }
.tutor-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 14px; margin-bottom: 16px; }
.tutor-card { display: flex; gap: 16px; text-decoration: none; color: var(--ink); margin: 0; }
.tutor-card:hover { border-color: var(--brand); }
.tutor-card h2 { margin: 0 0 2px; font-size: 1.15rem; }
.checks-form { margin-top: 10px; padding-top: 10px; border-top: 1px dashed var(--line); }
.checks-form input[type=date] { width: auto; }

/* ---------- patch 5: Showcase, practice sets, reviews ---------- */
.sc-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 14px; margin-bottom: 16px; }
.sc-grid-small { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.sc-card { display: flex; flex-direction: column; gap: 6px; text-decoration: none; color: var(--ink); margin: 0; overflow: hidden; }
a.card.sc-card:hover { border-color: var(--brand); }
.sc-card img, .sc-noimg { width: 100%; aspect-ratio: 4 / 3; object-fit: cover; object-position: top; border-radius: 8px; border: 1px solid var(--line); background: #fafafa; }
.sc-noimg { display: flex; align-items: center; justify-content: center; font-size: 2rem; color: var(--muted); }
.sc-grid-small .sc-card { color: var(--brand-dark); }
.sc-byline { color: var(--muted); margin: 0 0 12px; }
.sc-title { margin-bottom: 2px; }
.sc-part { border-top: 1px solid var(--line); padding-top: 12px; margin-top: 14px; }
.sc-part h2 { font-size: 1.05rem; color: var(--earth); }
.sc-pictures { display: flex; flex-direction: column; gap: 14px; }
.sc-pictures figure { margin: 0; }
.sc-pictures img { display: block; width: 100%; border-radius: 8px; border: 1px solid var(--line); }
.sc-mark { font-size: 1.1rem; margin: 0 0 8px; }
.sc-comment { background: #f3f8f3; border-left: 3px solid var(--brand); padding: 8px 12px; border-radius: 6px; }
.sc-preview { border: 2px dashed #cfd4dc; }
.sc-decide { background: #fffaf0; border: 1px solid #f5deb3; border-radius: 8px; padding: 12px; margin-top: 10px; }
.sc-choose { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.sc-pick { display: flex; flex-direction: column; gap: 4px; border: 1px solid var(--line); border-radius: 8px; padding: 6px; cursor: pointer; overflow-wrap: anywhere; }
.sc-pick img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 6px; }
.sc-pick:has(input:checked) { border-color: var(--brand); background: #f3f8f3; }
.btn-showcase { border-color: #e9c46a; background: #fff8e1; }
.practice-list { list-style: none; padding: 0; margin: 0; }
.practice-list li { padding: 10px 0; border-top: 1px solid var(--line); }
.practice-list li:first-child { border-top: 0; }
.practice-solutions summary { cursor: pointer; }
.practice-solutions .solution { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 12px; }
.practice-box summary { cursor: pointer; }
.stars { color: #e0a800; letter-spacing: 1px; white-space: nowrap; }
.stars-off { color: #d6d9de; }
.rating { margin: 2px 0 6px; }
.rating a { text-decoration: none; color: var(--ink); font-weight: 600; }
.review { padding: 10px 0; border-top: 1px solid var(--line); }
.review:first-of-type { border-top: 0; }
.review p { margin: 0 0 4px; }
.review-removed { opacity: .55; }
.review-reply { margin: 6px 0 0 14px; padding: 6px 10px; border-left: 3px solid var(--line); color: #344054; font-size: .95rem; }
.review-reply p { display: inline; }
.review-form { margin-top: 10px; }
.review-form summary { cursor: pointer; }
.star-pick { display: inline-flex; flex-direction: row-reverse; justify-content: flex-end; gap: 2px; position: relative; }
.star-pick input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.star-pick label { font-size: 1.9rem; line-height: 1; color: #d6d9de; cursor: pointer; }
.star-pick input:checked ~ label, .star-pick label:hover, .star-pick label:hover ~ label { color: #e0a800; }
.star-pick input:focus-visible + label { outline: 2px solid var(--brand); border-radius: 4px; }
