/* Study Guide: the accent (Media and reading: red) and the app's own pieces.
   Everything else comes from syad_kit.ui_kit; the app's own names start with sg-. */
:root { --ui-accent: #e8303a; --ui-accent-text: #fff; }

/* Tabs under the header */
.sg-tabs { display: flex; gap: 4px; margin: 6px 0 0; }
.sg-tabs a {
  flex: 1 1 0; display: flex; align-items: center; justify-content: center; min-height: var(--ui-tap);
  border-radius: 10px; color: var(--ui-dim); text-decoration: none; font-weight: 600;
}
.sg-tabs a:hover { background: var(--ui-hover); }
.sg-tabs a[aria-current="page"] { background: var(--ui-accent-dim); color: var(--ui-accent-link); }

.sg-actions { justify-content: flex-start; }
.sg-indent { padding-left: 14px; }

/* Progress bars */
.sg-progress { display: flex; align-items: center; gap: 10px; color: var(--ui-dim); font-size: 0.9rem; }
.sg-progress--big { margin: 14px 0 0; font-size: 0.95rem; }
.sg-bar { flex: 0 0 90px; height: 6px; border-radius: 3px; background: var(--ui-surface2); overflow: hidden; }
.sg-progress--big .sg-bar { flex: 1 1 auto; max-width: 320px; }
.sg-bar > span { display: block; height: 100%; background: var(--ui-accent); border-radius: 3px; }

/* Guide list */
.sg-list { list-style: none; margin: 0; padding: 0 0 0 14px; }
.sg-guide { display: flex; align-items: center; gap: 6px; }
.sg-guide + .sg-guide { margin-top: 2px; }
.sg-guide__link {
  flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 4px;
  min-height: 64px; justify-content: center; padding: 10px 2px; color: inherit; text-decoration: none;
}
.sg-guide__title { font-weight: 600; overflow-wrap: anywhere; }
.sg-star, .sg-fav[aria-pressed] span {
  font-size: 1.3rem; line-height: 1;
}
.sg-star {
  flex: 0 0 var(--ui-tap); height: var(--ui-tap); border: 0; border-radius: 10px; background: none;
  color: var(--ui-faint); cursor: pointer;
}
.sg-star:hover { background: var(--ui-hover); }
.sg-star[aria-pressed="true"], .sg-fav[aria-pressed="true"] span { color: var(--ui-accent); }

/* A guide's page */
.sg-description { color: var(--ui-dim); }
.sg-guide-head { margin: 0 0 18px; }
.sg-section { margin: 0 -18px; padding: 0 18px; border-radius: 0; }
.sg-section + .sg-section { margin-top: 2px; }
.sg-section > summary {
  display: flex; align-items: baseline; gap: 12px; min-height: 60px; padding: 16px 2px;
  cursor: pointer; list-style: none;
}
.sg-section > summary::-webkit-details-marker { display: none; }
.sg-section > summary::before {
  content: ""; flex: 0 0 auto; align-self: center; width: 8px; height: 8px; margin-right: 2px;
  border-right: 2px solid var(--ui-dim); border-bottom: 2px solid var(--ui-dim); transform: rotate(-45deg);
  transition: transform 0.15s ease;
}
.sg-section[open] > summary::before { transform: rotate(45deg); }
.sg-section[open] { background: var(--ui-surface); }
.sg-section__title { flex: 1 1 auto; font-weight: 600; overflow-wrap: anywhere; }
.sg-reading .sg-section__title { color: var(--ui-dim); font-weight: 500; }
.sg-section__body { padding: 0 0 18px 22px; }
.sg-count { flex: 0 0 auto; color: var(--ui-dim); font-size: 0.9rem; white-space: nowrap; }
.sg-count--done { color: var(--ui-ok); }

.sg-label {
  display: inline-block; margin-right: 8px; padding: 1px 8px; border-radius: var(--ui-radius-sm, 6px);
  background: var(--ui-surface2); color: var(--ui-dim); font-size: 0.8rem; font-weight: 600; vertical-align: 1px;
}
.sg-goal { display: flex; align-items: baseline; gap: 2px; }
.sg-goal .sg-md > :first-child { margin-top: 0; }
.sg-notes { margin: 10px 0 4px; }
.sg-notes > summary { min-height: var(--ui-tap); display: flex; align-items: center; color: var(--ui-accent-link); font-weight: 600; cursor: pointer; }
.sg-notes > .sg-md { padding: 0 0 8px; }
.sg-group-title { font-size: 0.95rem; font-weight: 600; color: var(--ui-dim); margin: 18px 0 4px; }

/* Exercises and checkpoints */
.sg-items { list-style: none; margin: 8px 0 0; padding: 0; }
.sg-items--grouped { padding-left: 14px; }
.sg-item + .sg-item { margin-top: 2px; }
.sg-check { display: flex; align-items: flex-start; gap: 12px; min-height: var(--ui-tap); padding: 10px 4px; border-radius: 8px; cursor: pointer; }
.sg-check:hover { background: var(--ui-hover); }
.sg-check input { flex: 0 0 auto; width: 22px; height: 22px; margin: 1px 0 0; accent-color: var(--ui-accent); cursor: pointer; }
.sg-item__text { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.sg-item__text p { display: inline; margin: 0; }
.sg-check:has(input:checked) .sg-item__text { color: var(--ui-dim); }
.sg-item--checkpoint { margin-top: 10px; }
.sg-item--checkpoint .sg-label { background: var(--ui-accent-dim); color: var(--ui-accent-link); }
.sg-item__detail { padding: 0 0 6px 38px; color: var(--ui-dim); font-size: 0.95rem; }

/* Rendered Markdown */
.sg-md { overflow-wrap: anywhere; }
.sg-md > :first-child { margin-top: 0; }
.sg-md > :last-child { margin-bottom: 0; }
.sg-md p, .sg-md ul, .sg-md ol, .sg-md pre, .sg-md blockquote, .sg-md table { margin: 10px 0; }
.sg-md ul, .sg-md ol { padding-left: 22px; }
.sg-md li + li { margin-top: 4px; }
.sg-md code { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92em; background: var(--ui-surface2); padding: 1px 5px; border-radius: 5px; }
.sg-md pre { background: var(--ui-surface2); padding: 12px 14px; border-radius: 8px; overflow-x: auto; }
.sg-md pre code { background: none; padding: 0; }
.sg-md blockquote { margin-left: 0; padding: 4px 0 4px 14px; border-left: 3px solid var(--ui-accent-dim); color: var(--ui-dim); }
.sg-md table { display: block; overflow-x: auto; border-collapse: collapse; }
.sg-md th, .sg-md td { text-align: left; padding: 6px 12px 6px 0; vertical-align: top; }
.sg-md th { color: var(--ui-dim); font-weight: 600; }
.sg-md img { max-width: 100%; height: auto; }

/* Owner tools and confirmations */
.sg-tools-wrap { margin-top: 28px; }
.sg-confirm { padding: 12px 0; }
.sg-confirm p { margin: 0; }
.sg-gone { padding: 14px 2px; margin: 0; }
.sg-problems ul { margin: 8px 0 0; padding-left: 20px; }
.sg-problems p { margin: 0; }
.sg-problems li + li { margin-top: 4px; }

/* Journal */
.sg-filters { margin: 14px 0 0; }
.sg-filter-row { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.sg-filter-row select { flex: 1 1 200px; min-width: 0; }
.sg-textarea { min-height: 120px; resize: vertical; font: inherit; line-height: 1.5; }
.sg-hint { font-size: 0.85rem; margin: 6px 0 0; }
.sg-entry-body { margin: 6px 0 0; }
.sg-shots { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 0; }
.sg-shots img { display: block; width: 120px; height: 90px; object-fit: cover; border-radius: 8px; background: var(--ui-surface2); }
.sg-shot { display: flex; flex-direction: column; gap: 4px; font-size: 0.9rem; }
.sg-shot span { display: flex; align-items: center; gap: 6px; min-height: 36px; }
.sg-prompt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.85rem; }
.sg-copied { min-height: 1.5em; text-align: right; }

/* Problems */
.sg-switch { margin: 14px 0 0; }
.sg-switch a { display: inline-flex; align-items: center; text-decoration: none; color: var(--ui-text); }
.sg-problem__row { display: flex; align-items: center; gap: 8px; }
.sg-problem__row > .ui-line { flex: 1 1 auto; min-width: 0; }
.sg-problem__row > .ui-line--open { flex-basis: 100%; }
.sg-problem__row:has(> .ui-line--open) { flex-wrap: wrap; }
.sg-problem__solve { flex: 0 0 auto; min-height: var(--ui-tap); }
.sg-solve-form { margin: 0 0 12px; }

/* Admin */
.sg-admin-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; min-height: 64px; padding: 8px 2px; }
.sg-admin-row__title { font-weight: 600; }
