/* Max Kaiser Studio: student portal. Studio-wing palette (see css/styles.css). */
:root {
  --paper: #efe8e1;
  --paper-dark: #e2d8cd;
  --card: #fbf8f5;
  --terra: #c56651;
  --terra-deep: #a4503e;
  --terra-deeper: #8a4232;
  --terra-tint: rgba(197, 102, 81, 0.13);
  --ink: #1f232a;
  --muted: #5e5853;
  --line: rgba(31, 35, 42, 0.12);
  --line-strong: rgba(31, 35, 42, 0.22);
  --good: #3e6b3f;
  --good-tint: #e1eadb;
  --alert: #8f3a2a;
  --alert-tint: #f6ddd5;
  --serif: 'Playfair Display', Georgia, serif;
  --sans: 'Inter', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --radius: 10px;
  --tabbar-h: 62px;
  color-scheme: light;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; overflow-x: clip; }

body.portal {
  min-height: 100vh;
  min-height: 100dvh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
}

a { color: var(--terra-deep); }
img { display: block; max-width: 100%; }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }

.sr-only {
  position: absolute; width: 1px; height: 1px; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap;
}

:focus-visible { outline: 2px solid var(--terra-deep); outline-offset: 2px; }

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 44px;
  padding: 0.6rem 1.2rem;
  border: 1px solid transparent;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s, color 0.2s, transform 0.2s;
}
.btn:disabled { opacity: 0.6; cursor: default; }
.btn-primary { background: var(--terra-deep); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--terra-deeper); }
.btn-ghost { background: transparent; border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--terra-deep); color: var(--terra-deep); }
.btn-danger { background: var(--alert); color: #fff; }
.btn-danger:hover { background: #742d20; }
.btn-block { width: 100%; }
.btn-sm { min-height: 36px; padding: 0.35rem 0.9rem; font-size: 0.72rem; }

.link-btn {
  background: none;
  border: 0;
  color: var(--terra-deep);
  font-size: 0.92rem;
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 3px;
  padding: 0.6rem 0.25rem;
  align-self: center;
}

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 40px; height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--paper-dark); color: var(--ink); }

.info-btn {
  display: inline-grid;
  place-items: center;
  width: 28px; height: 28px;
  margin: -6px 0 -6px 2px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--muted);
  font-size: 0.85rem;
  vertical-align: middle;
  flex-shrink: 0;
}
.info-btn:hover, .info-btn[aria-expanded="true"] { color: var(--terra-deep); background: var(--terra-tint); }

.tip {
  position: fixed;
  z-index: 3000;
  max-width: min(280px, calc(100vw - 16px));
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--ink);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 400;
  line-height: 1.45;
  letter-spacing: 0;
  text-transform: none;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  pointer-events: none;
}

/* ── Pills ── */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.18rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 500;
  line-height: 1.5;
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pill i { font-size: 0.7rem; }
.pill-neutral { background: var(--paper-dark); color: var(--ink); }
.pill-plain { background: transparent; color: var(--muted); padding-left: 0; padding-right: 0.2rem; }
.pill-warm { background: var(--terra-tint); color: var(--terra-deeper); }
.pill-good { background: var(--good-tint); color: var(--good); }
.pill-alert { background: var(--alert-tint); color: var(--alert); }

.demo-badge {
  display: inline-block;
  padding: 0.12rem 0.55rem;
  border: 1px solid var(--terra-deep);
  border-radius: 999px;
  color: var(--terra-deep);
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: default;
}

/* ── Forms ── */
.stack { display: flex; flex-direction: column; gap: 1rem; }
.field { display: flex; flex-direction: column; gap: 0.35rem; min-width: 0; }
.field-label {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.optional { font-weight: 400; letter-spacing: 0; text-transform: none; color: var(--muted); font-size: 0.8rem; }

input[type="text"], input[type="password"], input[type="number"], input[type="date"], textarea {
  width: 100%;
  min-width: 0;
  min-height: 46px;
  padding: 0.65rem 0.85rem;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  font-size: 1rem; /* 16px: no zoom-on-focus on iPhone */
  transition: border-color 0.2s, box-shadow 0.2s;
}
input[type="date"] { -webkit-appearance: none; appearance: none; display: block; }
textarea { resize: vertical; min-height: 90px; line-height: 1.45; }
input:focus, textarea:focus { outline: none; border-color: var(--terra-deep); box-shadow: 0 0 0 3px var(--terra-tint); }
input::placeholder, textarea::placeholder { color: #9a918a; }

.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 3rem; }
.pw-toggle {
  position: absolute;
  right: 3px; top: 50%;
  transform: translateY(-50%);
  width: 40px; height: 40px;
  border: 0; background: none;
  color: var(--muted);
  border-radius: 50%;
}
.pw-toggle:hover { color: var(--ink); }

.form-error {
  padding: 0.6rem 0.8rem;
  border-radius: 8px;
  background: var(--alert-tint);
  color: var(--alert);
  font-size: 0.9rem;
}

.notice {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  padding: 0.8rem 1rem;
  border-radius: 8px;
  background: var(--good-tint);
  color: var(--good);
  font-size: 0.95rem;
}
.notice-warn { background: var(--alert-tint); color: var(--alert); }

/* ── Signed-out pages ── */
.auth {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  padding: 2rem 16px;
  position: relative;
}
.auth-demo { position: absolute; top: 16px; right: 16px; }
.auth-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 1.2rem;
  padding: 2rem 1.5rem 1.4rem;
  background: var(--card);
  border-radius: 16px;
  box-shadow: 0 1px 2px rgba(60, 40, 30, 0.06), 0 12px 40px rgba(60, 40, 30, 0.08);
}
.auth-logo { width: 56px; height: 56px; align-self: center; border-radius: 14px; }
.auth-title {
  font-family: var(--serif);
  font-size: 1.75rem;
  font-weight: 600;
  text-align: center;
  line-height: 1.2;
}
.auth-back {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.8rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-decoration: none;
  padding: 0.5rem;
}
.auth-back:hover { color: var(--terra-deep); }

/* ── Signed-in shell ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--paper);
  border-bottom: 1px solid var(--line);
  padding-top: env(safe-area-inset-top);
}
.topbar-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0.8rem 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-family: var(--serif);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  min-width: 0;
}
.brand img { width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; }
.brand span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
a.brand { color: var(--ink); text-decoration: none; }
.topbar-end { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.acct-btn {
  display: inline-grid;
  place-items: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  border: 1px solid var(--line-strong);
  background: var(--card);
  color: var(--terra-deep);
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 700;
  text-decoration: none;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
}
.acct-btn:hover { border-color: var(--terra-deep); }
.acct-btn.active { background: var(--terra-deep); border-color: var(--terra-deep); color: #fff; }

.tabs {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 16px;
  display: flex;
  gap: 0.25rem;
}
.tab {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.7rem 0.9rem 0.8rem;
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  transition: color 0.2s;
}
.tab i { font-size: 0.85rem; }
.tab::after {
  content: '';
  position: absolute;
  left: 0.9rem; right: 0.9rem; bottom: -1px;
  height: 2px;
  border-radius: 2px;
  background: var(--terra-deep);
  transform: scaleX(0);
  transition: transform 0.25s ease;
}
.tab:hover { color: var(--ink); }
.tab.active { color: var(--terra-deep); }
.tab.active::after { transform: scaleX(1); }

.view {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.6rem 16px 4rem;
  outline: none;
}

@media (max-width: 639.98px) {
  .tabs {
    position: fixed;
    left: 0; right: 0; bottom: 0;
    z-index: 200;
    max-width: none;
    padding: 0 max(4px, env(safe-area-inset-left)) env(safe-area-inset-bottom) max(4px, env(safe-area-inset-right));
    gap: 0;
    background: var(--card);
    border-top: 1px solid var(--line);
    box-shadow: 0 -6px 24px rgba(60, 40, 30, 0.08);
  }
  .tab {
    flex: 1 1 0;
    min-width: 0;
    height: var(--tabbar-h);
    flex-direction: column;
    justify-content: center;
    gap: 0.3rem;
    padding: 0.4rem 0.1rem;
    font-size: 0.66rem;
    letter-spacing: 0.02em;
    text-transform: none;
    font-weight: 500;
  }
  .tab span { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
  .tab i { font-size: 1.15rem; }
  .tab::after { top: 0; bottom: auto; left: 28%; right: 28%; height: 3px; border-radius: 0 0 3px 3px; }
  /* The Library's music view slides the tab bar away (its control bar takes the place). */
  .tabs { transition: transform 0.34s cubic-bezier(0.2, 0.8, 0.2, 1); }
  html.lib-tabs-away .tabs { transform: translateY(105%); }
  .view { padding: 1.2rem 16px calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 2rem); }
  .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 12px) !important; }
}

/* ── Page structure ── */
.page-head {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.6rem 0.9rem;
  margin-bottom: 1.4rem;
}
.page-title {
  font-family: var(--serif);
  font-size: clamp(1.7rem, 5vw, 2.3rem);
  font-weight: 600;
  line-height: 1.15;
  margin-right: auto;
}
.page-head .pill { order: 0; }
.page-head .page-title + .pill { margin-right: auto; margin-left: -0.3rem; }
.page-head:has(.page-title + .pill) .page-title { margin-right: 0; }

.section { margin-top: 2rem; }
.section:first-of-type { margin-top: 0.4rem; }
.section-title {
  display: flex;
  align-items: center;
  gap: 0.2rem;
  font-family: var(--serif);
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
}

.card {
  background: var(--card);
  border-radius: var(--radius);
  border: 1px solid var(--line);
}
.card-title {
  font-family: var(--serif);
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.3;
  display: flex;
  align-items: center;
  gap: 0.2rem;
  min-width: 0;
  overflow-wrap: anywhere;
}

.loading { display: grid; place-items: center; padding: 3rem 0; }
.spin {
  width: 28px; height: 28px;
  border: 3px solid var(--paper-dark);
  border-top-color: var(--terra-deep);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.error-box {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.7rem;
  padding: 1rem;
  border-radius: var(--radius);
  background: var(--alert-tint);
  color: var(--alert);
}
.error-box span { flex: 1 1 200px; }

.empty {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  padding: 1.1rem 1rem;
  border: 1px dashed var(--line-strong);
  border-radius: var(--radius);
  color: var(--muted);
}

.chips { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem 0.5rem; min-width: 0; }

/* ── Rep: assignments ── */
.list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.row {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 0.85rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}
.row-icon {
  width: 2.4rem; height: 2.4rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--terra-tint);
  color: var(--terra-deep);
  font-size: 0.9rem;
}
.row-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem 1rem;
}
.row-title {
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
  min-width: 0;
}
.assignment.is-done { opacity: 0.72; }
.assignment.is-done .row-title { text-decoration: line-through; text-decoration-color: var(--line-strong); }
.assignment.is-done .row-icon { background: var(--good-tint); color: var(--good); }

/* ── Rep: expandable cards ── */
.xcard {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.xcard.open { border-color: rgba(164, 80, 62, 0.35); box-shadow: 0 4px 18px rgba(164, 80, 62, 0.08); }
.xcard-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 0.85rem;
  padding: 0.75rem 0.9rem 0.75rem 0.85rem;
  border: 0;
  background: transparent;
  border-radius: var(--radius);
  text-align: left;
}
.xcard-bpm { flex-shrink: 0; font-size: 0.85rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--ink); white-space: nowrap; }
.xcard-bpm-goal, .work-table .goal { color: var(--muted); font-weight: 400; }
.xcard-chev { color: var(--terra-deep); }
.xcard-title {
  flex: 1;
  min-width: 0;
  font-family: var(--serif);
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.3;
  overflow-wrap: anywhere;
}
.xcard.is-done .xcard-title { color: var(--muted); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.xcard.is-done .row-icon { background: var(--good-tint); color: var(--good); }
.xcard-chev { color: var(--muted); font-size: 0.8rem; transition: transform 0.25s ease, color 0.2s; flex-shrink: 0; }
.xcard.open .xcard-chev { transform: rotate(180deg); }
.xcard-body { display: grid; grid-template-rows: 0fr; transition: grid-template-rows 0.28s ease; }
.xcard.open .xcard-body { grid-template-rows: 1fr; }
.xcard-inner { overflow: hidden; min-height: 0; display: flex; flex-direction: column; gap: 0.7rem; padding: 0 1rem; }
.xcard.open .xcard-inner { padding-bottom: 1rem; }
.xcard-inner > :first-child { padding-top: 0.75rem; border-top: 1px solid var(--line); }
.xnote { display: flex; flex-direction: column; gap: 0.3rem; }
.xnote-title { display: flex; align-items: center; flex-wrap: wrap; gap: 0.45rem; font-weight: 600; font-size: 0.95rem; }
.xnote-title i { color: var(--terra-deep); font-size: 0.85rem; }
.xnote-text { color: #33363c; font-size: 0.95rem; white-space: pre-line; overflow-wrap: anywhere; }

.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot-neutral { border: 2px solid #9a918a; }
.dot-warm { background: var(--terra); }
.dot-good { background: var(--good); }

/* ── Progress ── */
.stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tile-value small { font-family: var(--sans); font-size: 0.72rem; font-weight: 500; color: var(--muted); }
.chart-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(380px, 100%), 1fr)); gap: 0.8rem; }
.chart-card { padding: 1rem 1rem 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.chart-head { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: 0.2rem 0.8rem; }
.tchart-wrap { position: relative; min-height: 184px; touch-action: pan-y; }
.tchart { display: block; font-family: var(--sans); }
.tchart-grid { stroke: var(--line); stroke-width: 1; }
.tchart-axis { stroke: var(--line-strong); stroke-width: 1; }
.tchart-tick { font-size: 11px; fill: var(--muted); font-variant-numeric: tabular-nums; }
.tchart-unit { font-size: 11px; font-weight: 600; fill: var(--muted); }
.tchart-goal { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 4 3; }
.tchart-goal-label { font-size: 11px; font-weight: 600; fill: var(--muted); }
.tchart-area { fill: var(--terra); opacity: 0.1; }
.tchart-line { fill: none; stroke: var(--terra); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.tchart-dot { fill: var(--terra); stroke: var(--card); stroke-width: 2; }
.tchart-dot-last { fill: var(--terra-deep); }
.tchart-cross { stroke: var(--ink); stroke-width: 1; opacity: 0.35; }
.tchart-ring { fill: none; stroke: var(--terra-deep); stroke-width: 2; }
.tchart-tip {
  position: absolute;
  z-index: 2;
  padding: 0.25rem 0.55rem;
  border-radius: 6px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 500;
  white-space: nowrap;
  pointer-events: none;
}

.rec-groups { display: flex; flex-direction: column; gap: 1.2rem; }
.month-title {
  margin-bottom: 0.55rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

/* ── History ── */
.seg {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 0.3rem;
  margin-bottom: 0.7rem;
  padding: 0.25rem;
  border-radius: 999px;
  background: var(--paper-dark);
  max-width: 100%;
}
.seg-btn {
  min-height: 34px;
  padding: 0.3rem 0.85rem;
  border: 0;
  border-radius: 999px;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 600;
}
.seg-btn[aria-pressed="true"] { background: var(--card); color: var(--ink); box-shadow: 0 1px 3px rgba(60, 40, 30, 0.12); }
.table-card { overflow-x: auto; }
.work-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.work-table th, .work-table td { padding: 0.6rem 0.8rem; text-align: left; vertical-align: middle; border-bottom: 1px solid var(--line); }
.work-table tbody tr:last-child > * { border-bottom: 0; }
.work-table thead th {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.work-table .col-title { font-weight: 500; overflow-wrap: anywhere; }
.work-table .col-title > span:last-child { vertical-align: middle; }
.work-icon { display: inline-grid; place-items: center; width: 1.6rem; color: var(--terra-deep); font-size: 0.8rem; vertical-align: middle; }
.work-table .col-date, .work-table .col-group { white-space: nowrap; color: var(--muted); }
.work-table .num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.work-table tr.is-finished .col-title { color: var(--muted); }
.status-text { font-weight: 600; color: var(--terra-deeper); }
.status-assigned { color: var(--muted); }
.status-performance_ready { color: var(--good); }

@media (max-width: 639.98px) {
  .work-table .col-group { display: none; }
  .work-table th, .work-table td { padding: 0.55rem 0.5rem; }
  .work-table th:first-child, .work-table td:first-child { padding-left: 0.75rem; }
  .work-table th:last-child, .work-table td:last-child { padding-right: 0.75rem; }
  .work-icon { display: none; }
}

/* ── Recordings ── */
.rec-list { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.rec {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.rec.is-active { border-color: rgba(164, 80, 62, 0.45); box-shadow: 0 4px 18px rgba(164, 80, 62, 0.1); }
.rec-play {
  width: 3rem; height: 3rem;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: 50%;
  border: 1px solid var(--terra-deep);
  background: transparent;
  color: var(--terra-deep);
  font-size: 1rem;
  transition: background 0.2s, color 0.2s, transform 0.2s;
}
.rec-play .fa-play { margin-left: 3px; }
.rec-play:hover { transform: scale(1.05); }
.rec.is-active .rec-play { background: var(--terra-deep); color: #fff; }
.rec-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.rec-top { display: flex; align-items: baseline; justify-content: space-between; gap: 0.3rem 0.8rem; flex-wrap: wrap; }
.rec-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; min-width: 0; }
.rec-date { font-size: 0.8rem; color: var(--muted); white-space: nowrap; }
.rec-bar { display: flex; align-items: center; gap: 0.8rem; }
.rec-time { font-size: 0.78rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 2.6rem; text-align: right; }

.scrub {
  --pct: 0%;
  flex: 1;
  min-width: 0;
  height: 24px;
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  cursor: pointer;
}
.scrub:disabled { cursor: default; }
.scrub::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 4px;
  background: linear-gradient(to right, var(--terra-deep) var(--pct), var(--paper-dark) var(--pct));
}
.scrub::-moz-range-track { height: 4px; border-radius: 4px; background: var(--paper-dark); }
.scrub::-moz-range-progress { height: 4px; border-radius: 4px; background: var(--terra-deep); }
.scrub::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px; height: 14px;
  margin-top: -5px;
  border-radius: 50%;
  background: var(--terra-deep);
  border: 2px solid var(--card);
  box-shadow: 0 0 0 1px rgba(164, 80, 62, 0.4);
}
.scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: var(--terra-deep); border: 2px solid var(--card); }
.scrub:disabled::-webkit-slider-thumb { opacity: 0; }
.scrub:disabled::-moz-range-thumb { opacity: 0; }

/* ── Notes timeline ── */
.timeline { list-style: none; position: relative; padding-left: 1.6rem; }
.timeline::before {
  content: '';
  position: absolute;
  left: 0.45rem; top: 0.5rem; bottom: 0.5rem;
  width: 2px;
  background: var(--paper-dark);
}
.tl-item { position: relative; padding-bottom: 1.4rem; }
.tl-dot {
  position: absolute;
  left: -1.6rem; top: 0.35rem;
  width: 0.95rem; height: 0.95rem;
  margin-left: 0.02rem;
  border-radius: 50%;
  background: var(--paper);
  border: 2px solid var(--terra-deep);
}
.tl-item:first-child .tl-dot { background: var(--terra-deep); }
.tl-meta { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem 0.6rem; margin-bottom: 0.45rem; min-height: 1.4rem; }
.tl-dot-off { border-color: #9a918a; }
/* Earlier lessons (folded at the top of Lessons): no "latest" dot. */
.timeline-earlier .tl-item:first-child .tl-dot { background: var(--paper); }
.timeline-earlier .tl-item:first-child .tl-dot-off { background: var(--paper); }
.past-fold .timeline { margin-top: 1rem; }
.fold-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  min-height: 48px;
  padding: 0.7rem 1rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: inherit;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.fold-btn:hover { border-color: var(--terra-deep); }
.fold-label { flex: 1; font-size: 0.78rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.fold-count { font-size: 0.8rem; color: var(--muted); font-variant-numeric: tabular-nums; }
.fold-chev { font-size: 0.75rem; color: var(--muted); transition: transform 0.2s; }
.fold-btn[aria-expanded="true"] .fold-chev { transform: rotate(180deg); }
/* A lesson's recordings, inside its summary card. */
.tl-recs { align-self: stretch; padding-top: 0.55rem; border-top: 1px solid var(--line); }
.tl-recs .month-title { margin-bottom: 0.4rem; }
.tl-recs .rec { padding: 0.7rem 0.8rem; gap: 0.8rem; }
/* Lesson videos: header row, then the player once opened. */
.rec-video { flex-direction: column; align-items: stretch; gap: 0; }
.rec-video-head { display: flex; align-items: center; gap: inherit; column-gap: 1rem; min-width: 0; }
.rec-video-slot:empty { display: none; }
.rec-video-slot { margin-top: 0.7rem; }
.rec-video-el { display: block; width: 100%; max-height: 70vh; border-radius: 8px; background: #000; }
.rec-kind { color: var(--muted); font-size: 0.85em; }
.rec-time-left { text-align: left; }
.tl-item:first-child .tl-dot-off { background: #9a918a; }
.tl-date {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.tl-card { padding: 1rem 1.1rem; display: flex; flex-direction: column; align-items: flex-start; gap: 0.55rem; }
.tl-note { color: #33363c; white-space: pre-line; overflow-wrap: anywhere; }

/* ── Practice ── */
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; margin-bottom: 1.2rem; }
@media (min-width: 640px) { .tiles-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  padding: 0.9rem 1rem;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}
.tile-value { font-family: var(--serif); font-size: 1.6rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; }

.practice-form { padding: 1.1rem 1.1rem 1.2rem; display: flex; flex-direction: column; gap: 1rem; margin-bottom: 1.4rem; scroll-margin-top: 130px; border-color: rgba(164, 80, 62, 0.35); }
.form-head { display: flex; align-items: center; justify-content: space-between; margin: -0.3rem -0.4rem -0.2rem 0; }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.quick { display: flex; gap: 0.35rem; flex-wrap: wrap; margin-top: 0.15rem; }
.chip-btn {
  min-width: 40px;
  min-height: 32px;
  padding: 0.2rem 0.55rem;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  background: #fff;
  font-size: 0.8rem;
  font-weight: 500;
}
.chip-btn:hover { border-color: var(--terra-deep); color: var(--terra-deep); }

.tempos { border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.tempos summary {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 0.9rem;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  list-style: none;
}
.tempos summary::-webkit-details-marker { display: none; }
.tempos summary::after { content: '\f078'; font-family: 'Font Awesome 6 Free'; font-weight: 900; margin-left: auto; font-size: 0.7rem; transition: transform 0.2s; }
.tempos[open] summary::after { transform: rotate(180deg); }
.tempo-list { display: flex; flex-direction: column; padding: 0 0.9rem 0.6rem; }
.tempo-row { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; padding: 0.45rem 0; border-top: 1px solid var(--line); }
.tempo-name { font-size: 0.92rem; min-width: 0; overflow-wrap: anywhere; }
.tempo-input { display: flex; align-items: center; gap: 0.4rem; flex-shrink: 0; }
.tempo-input input { width: 5.2rem; min-height: 40px; padding: 0.4rem 0.6rem; text-align: right; }
.unit { font-size: 0.8rem; color: var(--muted); }
.form-actions { display: flex; justify-content: flex-end; gap: 0.6rem; flex-wrap: wrap; }

.log { padding: 0.85rem 1rem 0.95rem; display: flex; flex-direction: column; gap: 0.45rem; }
.log-head { display: flex; align-items: center; gap: 0.6rem; min-width: 0; }
.log-date { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; white-space: nowrap; }
.log-actions { margin-left: auto; display: flex; margin-right: -0.5rem; margin-top: -0.3rem; margin-bottom: -0.3rem; }
.log-focus { font-weight: 500; overflow-wrap: anywhere; }
.log-note { color: var(--muted); font-size: 0.93rem; overflow-wrap: anywhere; white-space: pre-line; }
.log .chips .pill { font-size: 0.78rem; }
.more-btn { margin-top: 1rem; }

/* ── Account ── */
.account-card { padding: 1.1rem 1.1rem 1.2rem; margin-bottom: 0.9rem; display: flex; flex-direction: column; gap: 0.9rem; }
.account-card.stack { gap: 1rem; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 0.5rem 1.2rem; }
.kv dt { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--muted); align-self: center; }
.kv dd { font-weight: 500; overflow-wrap: anywhere; }
.row-between { display: flex; align-items: center; justify-content: space-between; gap: 0.8rem; flex-wrap: wrap; }
.signout-row { display: flex; justify-content: center; margin-top: 1.4rem; }

/* ── Home ── */
.home-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.9rem; }
@media (min-width: 760px) {
  .home-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hcard-wide { grid-column: 1 / -1; }
}
.hcard { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: 0.8rem; min-width: 0; }
.hcard-head { display: flex; align-items: center; gap: 0.5rem; min-height: 1.9rem; }
.hcard-head .card-title { margin-right: auto; }
.hcard-link {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.2rem 0.35rem 0.5rem;
  margin: -0.35rem -0.2rem -0.35rem 0;
  color: var(--terra-deep);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-decoration: none;
  white-space: nowrap;
}
.hcard-link i { font-size: 0.65rem; }
.hcard-link:hover { color: var(--terra-deeper); }
.hcard-date { font-size: 0.75rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; color: var(--muted); }
.hcard-focus { font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.muted { color: var(--muted); font-size: 0.93rem; }
.chips-tip { display: inline-flex; align-items: center; }

.cal {
  width: 3.4rem;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  overflow: hidden;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  background: #fff;
  line-height: 1;
}
.cal-mon { width: 100%; padding: 0.22rem 0; background: var(--terra-deep); color: #fff; font-size: 0.66rem; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase; text-align: center; }
.cal-day { padding: 0.35rem 0 0.4rem; font-family: var(--serif); font-size: 1.35rem; font-weight: 600; font-variant-numeric: tabular-nums; }

.next { display: flex; align-items: center; gap: 0.9rem; }
.next-main { min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.next-day { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.15; }
.next-date { color: var(--muted); font-size: 0.95rem; font-variant-numeric: tabular-nums; }

.minis { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.6rem; }
.mini { display: flex; flex-direction: column; gap: 0.15rem; padding: 0.6rem 0.75rem; border-radius: 8px; background: var(--paper); min-width: 0; }
.mini-value { font-family: var(--serif); font-size: 1.3rem; font-weight: 600; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mini-value small { font-family: var(--sans); font-size: 0.72rem; font-weight: 500; color: var(--muted); }
.wchart-block .month-title { margin-bottom: 0.3rem; }
.wchart-wrap { min-height: 168px; }
.wchart-bar { fill: var(--terra); opacity: 0.55; }
.wchart-bar-now { fill: var(--terra-deep); opacity: 1; }
.wchart-tick-now { fill: var(--ink); font-weight: 600; }
.wchart-hover { fill: var(--ink); opacity: 0.05; }

.account-card .seg { align-self: flex-start; }
@media (min-width: 760px) { .hcard-att { align-self: start; } }

.att { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 0.5rem; }
.att-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 0.2rem; padding: 0.6rem 0.7rem; border-radius: 8px; background: var(--paper); border-top: 3px solid var(--line-strong); min-width: 0; }
.att-cell .stat-label { letter-spacing: 0.06em; }
.att-good { border-top-color: var(--good); }
.att-warm { border-top-color: var(--terra); }
.att-neutral { border-top-color: #9a918a; }
.att-alert { border-top-color: var(--alert); }
.att-value { font-family: var(--serif); font-size: 1.45rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
@media (max-width: 419.98px) { .att { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Lessons ── */
.seg-view { margin-bottom: 1.3rem; }
.up-card { padding: 0.75rem 0.9rem; display: flex; flex-direction: column; gap: 0.6rem; }
.up-row { display: flex; align-items: center; gap: 0.85rem; min-width: 0; }
.up-row .cal { width: 3rem; }
.up-row .cal-day { font-size: 1.15rem; padding: 0.3rem 0 0.35rem; }
.up-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.1rem; }
.up-day { display: flex; align-items: center; gap: 0.2rem; font-family: var(--serif); font-size: 1.1rem; font-weight: 600; line-height: 1.25; }
.up-time { color: var(--muted); font-size: 0.92rem; font-variant-numeric: tabular-nums; }
.up-loc { flex-shrink: 1; min-width: 0; max-width: 45%; display: flex; justify-content: flex-end; }
@media (max-width: 519.98px) {
  .up-row { flex-wrap: wrap; }
  .up-loc { max-width: none; flex-basis: 100%; justify-content: flex-start; padding-left: 3.85rem; margin-top: -0.4rem; }
}

/* ── Billing ── */
.billing { margin-top: 1.4rem; margin-bottom: 1.4rem; }
.balance-card { padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: 0.3rem; margin-bottom: 0.8rem; }
.balance-card .stat-label { display: flex; align-items: center; gap: 0.2rem; }
.balance-line { display: flex; align-items: center; flex-wrap: wrap; gap: 0.5rem 0.8rem; }
.balance-value { font-family: var(--serif); font-size: 2rem; font-weight: 600; line-height: 1.1; font-variant-numeric: tabular-nums; }
.money-grid { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0.8rem; }
@media (min-width: 760px) { .money-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.money-card { padding: 1rem 1.1rem 0.6rem; display: flex; flex-direction: column; gap: 0.5rem; min-width: 0; }
.money-list { list-style: none; }
.money-row { display: flex; align-items: center; gap: 0.75rem; padding: 0.55rem 0; border-top: 1px solid var(--line); font-size: 0.93rem; }
.money-date { flex-shrink: 0; width: 4.2rem; color: var(--muted); font-size: 0.82rem; white-space: nowrap; }
.money-title { flex: 1; min-width: 0; display: flex; align-items: center; overflow-wrap: anywhere; }
.money-amount { flex-shrink: 0; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Toast & dialog ── */
.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  z-index: 2500;
  max-width: calc(100vw - 32px);
  padding: 0.7rem 1.1rem;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  font-size: 0.9rem;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  transform: translate(-50%, 20px);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s, transform 0.25s;
}
.toast.show { opacity: 1; transform: translate(-50%, 0); }

dialog.confirm {
  margin: auto;
  width: min(360px, calc(100vw - 32px));
  padding: 1.4rem 1.3rem 1.1rem;
  border: 0;
  border-radius: 14px;
  background: var(--card);
  color: var(--ink);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.25);
}
dialog.confirm::backdrop { background: rgba(31, 35, 42, 0.45); }
.confirm-title { font-family: var(--serif); font-size: 1.2rem; font-weight: 600; margin-bottom: 1.2rem; }
.confirm-actions { display: flex; justify-content: flex-end; gap: 0.6rem; }

@media (max-width: 420px) {
  .grid-2 { grid-template-columns: 1fr; }
  .row { padding: 0.8rem 0.85rem; gap: 0.75rem; }
  .rec { padding: 0.8rem 0.85rem; gap: 0.8rem; }
  .page-head .btn { padding: 0.55rem 1rem; }
}

@media (max-width: 519.98px) {
  .rec-top { flex-direction: column; align-items: flex-start; gap: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 0.01ms !important; }
}

/* ── Goals (migration 0034, docs/STUDIO.md §1) ── */
.goal-list { list-style: none; display: grid; grid-template-columns: minmax(0, 1fr); }
@media (min-width: 760px) {
  .goal-list { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 1.6rem; }
}
.goal { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.7rem 0; border-top: 1px solid var(--line); min-width: 0; }
.goal-list > .goal:first-child { border-top: 0; padding-top: 0.15rem; }
@media (min-width: 760px) { .goal-list > .goal:nth-child(2) { border-top: 0; padding-top: 0.15rem; } }
.goal .row-icon { width: 2.1rem; height: 2.1rem; font-size: 0.82rem; }
.goal-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; padding-top: 0.1rem; }
.goal-text { line-height: 1.4; overflow-wrap: anywhere; }
.goal-title { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; }
.inline-note { color: var(--muted); font-size: 0.93rem; white-space: pre-line; }
.xnote-goal { font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.xnote-goal i { color: var(--muted); font-size: 0.85rem; }
.xnote.is-current .xnote-goal i { color: var(--terra-deep); }
.xnote-goal-title { font-weight: 600; }
.goal-tempo {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
  background: var(--terra-tint);
  color: var(--terra-deeper);
  font-size: 0.85rem;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.goal-tempo.is-reached { background: var(--good-tint); color: var(--good); }
.goal-tempo i { font-size: 0.75rem; }
.goal-earlier { padding-top: 0.6rem; border-top: 1px solid var(--line); }
.goal-earlier .month-title { margin-bottom: 0.2rem; }
.hcard-head { flex-wrap: wrap; row-gap: 0.35rem; }
.xcard-goal { flex-shrink: 0; color: var(--terra-deep); font-size: 0.8rem; }
.xnote.is-current .xnote-title i { color: var(--terra-deep); }

/* ── Rep: groups and past repertoire ── */
.rep-groups { display: flex; flex-direction: column; gap: 1.1rem; }
.rep-group .month-title { margin-bottom: 0.45rem; }
.past-list { list-style: none; padding: 0 1rem; }
.past-row { display: flex; align-items: center; gap: 0.8rem; padding: 0.7rem 0; border-top: 1px solid var(--line); min-width: 0; }
.past-row:first-child { border-top: 0; }
.past-row .row-icon { width: 2rem; height: 2rem; font-size: 0.78rem; background: var(--paper-dark); color: var(--muted); }
.past-text { flex: 1; min-width: 0; line-height: 1.4; overflow-wrap: anywhere; }
.past-title { font-weight: 500; }
.past-when, .past-bpm { font-size: 0.85rem; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; }
.chart-card-empty { padding-bottom: 1rem; }
.chart-head .chips { gap: 0.3rem 0.5rem; }

/* ── Lessons: goals set at a lesson ── */
.tl-goals { align-self: stretch; padding-top: 0.55rem; border-top: 1px solid var(--line); }
.tl-goals .month-title { margin-bottom: 0.3rem; }
.tl-goals ul { list-style: none; display: flex; flex-direction: column; gap: 0.35rem; }
.tl-goals li { display: flex; align-items: baseline; gap: 0.55rem; font-size: 0.93rem; min-width: 0; }
.tl-goal-icon { width: 1.1rem; color: var(--terra-deep); font-size: 0.78rem; text-align: center; flex-shrink: 0; }
.tl-goal-title { min-width: 0; flex: 1 1 auto; overflow-wrap: anywhere; }
.tl-goals li .pill { flex-shrink: 0; }

/* ── Auditions (migration 0034, docs/STUDIO.md §5) ── */
.cal-tba .cal-day { font-family: var(--sans); font-size: 0.85rem; font-weight: 700; letter-spacing: 0.06em; padding: 0.5rem 0 0.55rem; }
.aud-list { list-style: none; display: flex; flex-direction: column; }
.aud-list li + li { border-top: 1px solid var(--line); }
.aud-row { display: flex; align-items: center; gap: 0.85rem; padding: 0.55rem 0; color: var(--ink); text-decoration: none; min-width: 0; }
.aud-list li:first-child .aud-row { padding-top: 0; }
.aud-list li:last-child .aud-row { padding-bottom: 0; }
.aud-row .cal { width: 3rem; }
.aud-row .cal-day { font-size: 1.15rem; padding: 0.3rem 0 0.35rem; }
.aud-row .cal-tba .cal-day { font-size: 0.8rem; padding: 0.45rem 0 0.5rem; }
.aud-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.25rem 0.55rem; }
.aud-name { font-family: var(--serif); font-size: 1.05rem; font-weight: 600; line-height: 1.3; overflow-wrap: anywhere; }
.aud-row:hover .aud-name { color: var(--terra-deep); }

.aud-cards { display: flex; flex-direction: column; gap: 0.9rem; }
.aud-card { padding: 1rem 1.1rem 1.1rem; display: flex; flex-direction: column; gap: 0.9rem; min-width: 0; scroll-margin-top: 140px; }
.aud-card.is-past .cal-mon { background: #8a817a; }
.aud-head { display: flex; align-items: flex-start; gap: 0.9rem; min-width: 0; }
.aud-head-main { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem 0.6rem; padding-top: 0.1rem; }
.aud-head .card-title { font-size: 1.25rem; }
.aud-kv { grid-template-columns: auto minmax(0, 1fr); gap: 0.4rem 1rem; padding-top: 0.8rem; border-top: 1px solid var(--line); }
.aud-kv dt { font-size: 0.68rem; align-self: baseline; }
.aud-kv dd { font-weight: 400; font-size: 0.95rem; }
.aud-kv a { display: inline-flex; align-items: center; gap: 0.35rem; font-weight: 500; overflow-wrap: anywhere; }
.ext-icon { font-size: 0.7rem; }
.aud-notes { color: #33363c; font-size: 0.95rem; white-space: pre-line; overflow-wrap: anywhere; padding: 0.7rem 0.85rem; border-radius: 8px; background: var(--paper); }
.aud-reqs .month-title { margin-bottom: 0.25rem; }
.req-list { list-style: none; display: flex; flex-direction: column; }
.req { display: flex; align-items: flex-start; gap: 0.75rem; padding: 0.65rem 0; border-top: 1px solid var(--line); min-width: 0; }
.req:first-child { border-top: 0; padding-top: 0.35rem; }
.req .row-icon { width: 2rem; height: 2rem; font-size: 0.78rem; }
.req-line { flex: 1; min-width: 0; padding-top: 0.25rem; font-size: 0.95rem; line-height: 1.45; overflow-wrap: anywhere; }
.req-label { font-weight: 600; }
.req-piece { font-family: var(--serif); font-size: 1.02rem; font-weight: 600; }
.req-desc { color: var(--muted); }
.req-arrow { color: var(--terra-deep); font-size: 0.78rem; }
.req-line .pill { vertical-align: 0.05em; }

/* ── Practice recorder (docs/MEDIA.md §6) ── */
.head-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.rc-live { display: flex; flex-direction: column; align-items: center; gap: 0.9rem; padding: 0.4rem 0 0.6rem; }
.rc-clock {
  display: flex; align-items: center; gap: 0.5rem;
  font-family: var(--serif); font-size: 2.1rem; font-weight: 600; line-height: 1;
  font-variant-numeric: tabular-nums; color: var(--muted);
}
.rc-card.is-recording .rc-clock { color: var(--ink); }
.rc-dot { width: 0.6rem; height: 0.6rem; border-radius: 50%; background: var(--alert); visibility: hidden; }
.rc-card.is-recording .rc-dot { visibility: visible; animation: rc-blink 1.2s ease-in-out infinite; }
@keyframes rc-blink { 50% { opacity: 0.25; } }
.rc-big {
  width: 5.5rem; height: 5.5rem;
  display: grid; place-items: center;
  border: 0; border-radius: 50%;
  background: var(--terra-deep); color: #fff;
  font-size: 2rem;
  box-shadow: 0 8px 24px rgba(164, 80, 62, 0.3);
  transition: background 0.2s, transform 0.2s;
}
.rc-big:hover:not(:disabled) { background: var(--terra-deeper); transform: scale(1.04); }
.rc-big:disabled { opacity: 0.7; cursor: default; }
.rc-card.is-recording .rc-big { background: var(--alert); box-shadow: 0 0 0 6px var(--alert-tint), 0 8px 24px rgba(143, 58, 42, 0.3); }
.rc-card.is-recording .rc-big i { font-size: 1.6rem; }
.rc-meter { width: min(100%, 15rem); height: 6px; border-radius: 6px; background: var(--paper-dark); overflow: hidden; visibility: hidden; }
.rc-card.is-recording .rc-meter { visibility: visible; }
.rc-meter-fill { display: block; height: 100%; width: 0; border-radius: 6px; background: var(--terra-deep); transition: width 0.1s linear; }
.rc-form { display: flex; flex-direction: column; gap: 1rem; }
.rc-take { display: flex; align-items: center; gap: 0.9rem; min-width: 0; }
.rc-take .rec-bar { flex: 1; min-width: 0; }
.rc-take .rec-time { min-width: 5.6rem; }
.rc-card.is-playing .rc-take .rec-play { background: var(--terra-deep); color: #fff; }
.rec-del { flex-shrink: 0; margin: -0.4rem -0.5rem -0.4rem -0.4rem; }

/* ── Home goals: one expandable card per category ── */
.goal-groups { list-style: none; display: flex; flex-direction: column; gap: 0.6rem; }
.goal-group { background: var(--paper, transparent); }
.goal-group .xcard-head { align-items: center; }
.goal-group-text { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.15rem; }
.goal-group-text .xcard-title { flex: none; }
.goal-group-count { font-family: var(--sans, inherit); font-size: 0.85rem; font-weight: 500; color: var(--muted); }
.goal-group-brief {
  font-size: 0.85rem;
  color: var(--muted);
  line-height: 1.35;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  overflow-wrap: anywhere;
}
.goal-group.open .goal-group-brief { display: none; }
.goal-list-one { grid-template-columns: minmax(0, 1fr) !important; }
.goal-list-one > .goal:nth-child(2) { border-top: 1px solid var(--line); padding-top: 0.7rem; }
.goal-list-one > .goal:first-child { border-top: 0; padding-top: 0; }
.ob-link {
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--terra-deep);
  text-decoration: none;
}
.ob-link:hover { text-decoration: underline; }
.ob-link i { font-size: 0.75rem; }

/* ── Shell: Library tab, practice tools, module screens (docs/LIBRARY.md §7) ── */
.subnav {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  gap: 0.4rem;
  margin-bottom: 1.2rem;
}
.subnav-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.3rem;
  min-width: 0;
  min-height: 58px;
  padding: 0.5rem 0.25rem;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--card);
  color: var(--ink);
  font-size: 0.74rem;
  font-weight: 600;
  line-height: 1.15;
  text-align: center;
  text-decoration: none;
  overflow-wrap: normal;
  word-break: normal;
  hyphens: none;
  overflow: hidden;
  transition: border-color 0.2s, color 0.2s, background 0.2s;
}
.subnav-btn i { font-size: 1.05rem; color: var(--terra-deep); }
.subnav-btn:hover { border-color: var(--terra-deep); color: var(--terra-deep); }
.subnav-btn.active { background: var(--terra-tint); border-color: var(--terra-deep); color: var(--terra-deep); }
@media (max-width: 399.98px) {
  .subnav { gap: 0.25rem; }
  .subnav-btn { font-size: 0.64rem; padding: 0.45rem 0; letter-spacing: -0.01em; }
}
@media (min-width: 640px) {
  .subnav-btn { flex-direction: row; min-height: 44px; gap: 0.5rem; font-size: 0.8rem; }
}

.module-view { min-width: 0; }
.not-ready i { color: var(--terra-deep); }

/* Home → Progress */
.minis-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
a.progress-minis { color: inherit; text-decoration: none; }
a.progress-minis:hover .mini { background: var(--paper-dark); }

/* Rep and Auditions → the Library */
.rep-lib { align-self: flex-start; }
.req-main { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 0.3rem; }
.req-main .req-line { flex: none; }

/* Floating tool bar: the running metronome / drone, above the tab bar. */
.toolbar {
  position: fixed;
  left: 50%;
  bottom: calc(16px + env(safe-area-inset-bottom));
  z-index: 150;
  transform: translateX(-50%);
  display: flex;
  gap: 0.4rem;
  max-width: calc(100vw - 32px);
}
.toolbar-item {
  display: flex;
  align-items: center;
  min-width: 0;
  border-radius: 999px;
  background: var(--ink);
  color: #fff;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
}
.toolbar-open {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  min-height: 40px;
  min-width: 0;
  padding: 0 0.4rem 0 0.95rem;
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  text-decoration: none;
  white-space: nowrap;
}
.toolbar-open i { font-size: 0.85rem; }
.toolbar-pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--terra); animation: toolbar-pulse 1s ease-in-out infinite; }
@keyframes toolbar-pulse { 50% { opacity: 0.3; } }
.toolbar-stop {
  display: grid;
  place-items: center;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #fff;
}
.toolbar-stop:hover { background: rgba(255, 255, 255, 0.12); }
body.has-toolbar .view { padding-bottom: calc(4rem + 56px); }
body.has-toolbar .toast { bottom: 80px; }
@media (max-width: 639.98px) {
  .toolbar { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px); }
  body.has-toolbar .view { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 2rem + 56px); }
  body.has-toolbar .toast { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 66px) !important; }
}
@media (prefers-reduced-motion: reduce) { .toolbar-pulse { animation: none; } .tabs { transition: none; } }
/* The Library's music view has its own metronome button: no floating bar over
   its controls; toasts sit above its control bar. */
html.lib-music-open .toolbar { display: none !important; }
html.lib-music-open .toast { bottom: calc(68px + env(safe-area-inset-bottom) + 14px) !important; }
