:root {
  color-scheme: light;
  --ink: #21170d;
  --muted: #76685a;
  --line: #ead7bd;
  --panel: #fffaf1;
  --paper: #f4ead9;
  --mint: #e7f0dd;
  --sage: #386858;
  --rust: #b34f24;
  --gold: #f0a11c;
  --amber: #ffb02e;
  --blue: #2f5d72;
  --stage: #120f0c;
  --shadow: 0 18px 45px rgba(53, 30, 10, 0.14);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  min-height: 100vh;
  margin: 0;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(240, 161, 28, 0.18), transparent 34rem),
    linear-gradient(90deg, rgba(78, 46, 17, 0.055) 1px, transparent 1px) 0 0 / 48px 48px,
    linear-gradient(0deg, rgba(78, 46, 17, 0.045) 1px, transparent 1px) 0 0 / 48px 48px,
    var(--paper);
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  cursor: pointer;
}

[hidden] {
  display: none !important;
}

.login-screen {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(circle at 50% 15%, rgba(255, 176, 46, 0.22), transparent 28rem),
    linear-gradient(160deg, #070604 0%, #19120c 48%, #3c1a0c 100%);
}

.login-panel {
  width: min(100%, 680px);
  padding: 30px;
  border: 1px solid rgba(255, 176, 46, 0.3);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.96);
  box-shadow: 0 26px 70px rgba(0, 0, 0, 0.38);
}

.login-brand {
  margin-bottom: 24px;
  color: var(--ink);
  align-items: center;
  flex-direction: column;
  text-align: center;
}

.login-brand .brand-logo {
  width: min(100%, 560px);
  height: auto;
  margin: -20px auto 8px;
}

.login-form {
  display: grid;
  gap: 13px;
}

.login-error {
  min-height: 20px;
  margin: 0;
  color: var(--rust);
  font-weight: 800;
}

.demo-accounts {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.demo-accounts .eyebrow {
  flex: 0 0 100%;
  margin: 0;
}

.demo-login {
  min-height: 34px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: #fffdf9;
  font-weight: 800;
}

.app-shell {
  display: grid;
  grid-template-columns: 280px minmax(0, 1fr);
  min-height: 100vh;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  padding: 24px;
  color: #f8faf6;
  background:
    linear-gradient(180deg, rgba(255, 176, 46, 0.12), transparent 22rem),
    var(--stage);
  display: flex;
  flex-direction: column;
  gap: 24px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.sidebar .brand {
  flex-direction: column;
  align-items: flex-start;
}

.brand h1,
.brand p,
.topbar h2,
.topbar p,
.panel-heading h3,
.metric-panel span,
.metric-panel strong {
  margin: 0;
}

.brand h1 {
  font-size: 1.08rem;
  color: #fff7e6;
}

.brand p {
  color: #d8c2a3;
  font-size: 0.9rem;
}

.brand-logo {
  width: 210px;
  max-height: 138px;
  object-fit: contain;
  flex: 0 0 auto;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.45));
}

.nav-list {
  display: grid;
  gap: 8px;
}

.nav-item,
.primary-action,
.icon-button,
.text-button,
.small-action {
  border: 0;
  border-radius: 8px;
  transition:
    transform 160ms ease,
    background 160ms ease,
    border-color 160ms ease;
}

.nav-item {
  min-height: 44px;
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 0 12px;
  color: #ecdcc6;
  background: transparent;
  text-align: left;
}

.nav-item:hover,
.nav-item.active {
  color: #fff8e9;
  background: rgba(255, 176, 46, 0.18);
}

svg {
  width: 20px;
  height: 20px;
  flex: 0 0 auto;
  fill: currentColor;
}

.weekly-card {
  margin-top: auto;
  padding: 18px;
  border: 1px solid rgba(255, 176, 46, 0.24);
  border-radius: 8px;
  background: rgba(255, 176, 46, 0.1);
}

.weekly-card strong {
  display: block;
  font-size: 2rem;
  line-height: 1.1;
}

.weekly-card span {
  color: #d8c2a3;
}

.account-card {
  display: grid;
  gap: 7px;
  padding: 14px;
  border: 1px solid rgba(255, 176, 46, 0.24);
  border-radius: 8px;
  background: rgba(255, 176, 46, 0.1);
}

.account-card strong {
  line-height: 1.1;
}

.account-card span:last-of-type {
  color: #d8c2a3;
}

.account-card .small-action {
  justify-content: center;
  margin-top: 4px;
}

.main-area {
  min-width: 0;
  padding: 28px;
}

.topbar {
  min-height: 72px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  margin-bottom: 22px;
}

.eyebrow {
  color: var(--rust);
  font-size: 0.74rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.topbar h2 {
  font-size: clamp(1.8rem, 4vw, 3.2rem);
  line-height: 1;
  color: #23160b;
}

.top-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.primary-action {
  min-height: 44px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 0 14px;
  color: #1a0f06;
  background: linear-gradient(180deg, #ffbd42, var(--gold));
  font-weight: 800;
  box-shadow: 0 8px 18px rgba(179, 79, 36, 0.2);
}

.primary-action:hover,
.icon-button:hover,
.small-action:hover {
  transform: translateY(-1px);
}

.icon-button {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  color: var(--ink);
  background: #fff7e6;
  border: 1px solid var(--line);
}

.text-button {
  color: var(--rust);
  background: transparent;
  font-weight: 800;
}

.full-width {
  width: 100%;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}

.metric-panel,
.work-panel {
  background: rgba(255, 250, 241, 0.92);
  border: 1px solid rgba(179, 79, 36, 0.16);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.metric-panel {
  min-height: 112px;
  display: grid;
  align-content: center;
  gap: 6px;
  padding: 18px;
}

.metric-panel span {
  color: var(--muted);
}

.metric-panel strong {
  font-size: 2.2rem;
  line-height: 1;
  color: var(--rust);
}

.content-grid,
.split-layout,
.assignment-detail-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(340px, 0.65fr);
  gap: 18px;
  align-items: start;
}

.assignment-detail-layout {
  grid-template-columns: minmax(0, 1fr) minmax(300px, 420px);
}

.work-panel {
  padding: 18px;
}

.panel-heading {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.panel-heading h3 {
  font-size: 1.05rem;
}

select,
input,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  color: var(--ink);
}

select,
input {
  min-height: 42px;
  padding: 0 11px;
}

textarea {
  resize: vertical;
  padding: 11px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.assignment-list,
.log-list,
.student-grid {
  display: grid;
  gap: 12px;
}

.assignment-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  overflow: hidden;
}

.assignment-detail-panel {
  overflow: hidden;
}

.assignment-detail-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.assignment-detail-header h3 {
  margin: 0;
  font-size: clamp(1.6rem, 3vw, 2.45rem);
  line-height: 1;
}

.detail-copy {
  max-width: 76ch;
  font-size: 1.02rem;
}

.assignment-notes {
  margin: 0 0 14px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7e6;
}

.assignment-notes h4,
.assignment-notes p,
.resource-section-title {
  margin: 0;
}

.assignment-notes p {
  margin-top: 6px;
  color: #4b3f35;
  line-height: 1.5;
}

.detail-progress {
  margin-top: 14px;
}

.detail-actions {
  margin: 14px -18px -18px;
}

.compact-empty {
  min-height: 80px;
}

.assignment-card.completed {
  opacity: 0.72;
}

.assignment-main {
  padding: 15px;
}

.assignment-top {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}

.assignment-top h4,
.student-card h4,
.log-item strong {
  margin: 0;
}

.assignment-top h4 {
  font-size: 1rem;
}

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin: 11px 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  min-height: 26px;
  padding: 0 8px;
  border-radius: 999px;
  color: #4b3114;
  background: #f6dfb4;
  font-size: 0.78rem;
  font-weight: 850;
}

.tag.warn {
  color: #6c331f;
  background: #f4dfd6;
}

.tag.gold {
  color: #4b250d;
  background: #ffd889;
}

.assignment-details {
  color: #48515c;
  line-height: 1.5;
  margin: 0 0 14px;
}

.assignment-resources {
  display: grid;
  gap: 10px;
  margin: 0 0 14px;
}

.assignment-detail-panel .assignment-resources {
  gap: 12px;
}

.resource-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: var(--ink);
}

.resource-heading span {
  color: var(--muted);
  font-size: 0.88rem;
  font-weight: 800;
}

.video-frame {
  position: relative;
  overflow: hidden;
  aspect-ratio: 16 / 9;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--stage);
}

.video-frame iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
}

.video-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  max-height: 520px;
  overflow: auto;
  padding-right: 4px;
}

.resource-section-title {
  font-size: 1rem;
}

.video-card {
  display: grid;
  gap: 8px;
  padding: 8px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7e6;
}

.video-card .video-frame {
  border-radius: 6px;
}

.video-card strong {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-size: 0.92rem;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.video-link {
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 7px;
  width: 100%;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: #6b2e13;
  background: #fff7e6;
  font-size: 0.94rem;
  font-weight: 850;
  text-decoration: none;
}

.video-link svg {
  width: 16px;
  height: 16px;
}

.resource-links {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 7px;
  max-height: 170px;
  overflow: auto;
  padding-right: 4px;
}

.progress-wrap {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
  align-items: center;
}

.progress-track {
  height: 9px;
  overflow: hidden;
  border-radius: 999px;
  background: #ead7bd;
}

.progress-fill {
  height: 100%;
  width: var(--progress);
  background: linear-gradient(90deg, var(--rust), var(--gold));
}

.assignment-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  padding: 10px 15px;
  border-top: 1px solid var(--line);
  background: #fff2d8;
}

.teacher-card-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.small-action {
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0 10px;
  color: var(--ink);
  background: #fffaf1;
  border: 1px solid var(--line);
  font-weight: 800;
}

.checkin-form,
.assignment-form {
  display: grid;
  gap: 13px;
}

.form-actions {
  display: grid;
  gap: 9px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.resource-builder {
  display: grid;
  gap: 8px;
}

.resource-builder > label {
  display: block;
}

.resource-entry {
  display: grid;
  grid-template-columns: minmax(160px, 0.6fr) minmax(220px, 1fr) auto;
  gap: 8px;
}

.form-resource-list {
  display: grid;
  gap: 7px;
}

.form-resource-empty,
.form-resource-item {
  min-height: 38px;
  display: flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff7e6;
}

.form-resource-empty {
  justify-content: center;
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 750;
}

.form-resource-item {
  justify-content: space-between;
  gap: 8px;
  padding: 5px 6px 5px 10px;
}

.form-resource-item.dragging {
  opacity: 0.55;
}

.drag-handle {
  flex: 0 0 auto;
  color: var(--rust);
  cursor: grab;
  font-weight: 900;
}

.form-resource-item span {
  min-width: 0;
  overflow: hidden;
  color: var(--ink);
  font-weight: 850;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.remove-resource {
  width: 32px;
  height: 32px;
}

.metronome-panel {
  display: grid;
  gap: 12px;
  margin-top: 18px;
  padding-top: 18px;
  border-top: 1px solid var(--line);
}

.metronome-controls {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 10px;
  align-items: end;
}

.metronome-light {
  width: 18px;
  height: 18px;
  border-radius: 999px;
  background: #ead7bd;
  box-shadow: inset 0 0 0 1px var(--line);
}

.metronome-light.active {
  background: var(--gold);
  box-shadow: 0 0 0 6px rgba(240, 161, 28, 0.18);
}

.log-list {
  margin-top: 16px;
}

.log-item {
  padding: 12px;
  border-left: 4px solid var(--gold);
  background: #fff2d8;
  border-radius: 8px;
}

.log-item p {
  margin: 5px 0 0;
  color: #5b6068;
}

.student-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.student-card {
  min-height: 154px;
  padding: 15px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fffaf1;
  display: grid;
  gap: 11px;
}

.student-card-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}

.student-avatar {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border-radius: 8px;
  color: white;
  background: linear-gradient(180deg, var(--rust), #6f2b14);
  font-weight: 900;
}

.student-meta {
  color: var(--muted);
  margin: 4px 0 0;
}

.piano-strip {
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  height: 28px;
  border: 1px solid var(--line);
  background: white;
}

.piano-strip span {
  border-right: 1px solid var(--line);
}

.piano-strip span:nth-child(2),
.piano-strip span:nth-child(4),
.piano-strip span:nth-child(7),
.piano-strip span:nth-child(9),
.piano-strip span:nth-child(11) {
  background: var(--stage);
}

.empty-state {
  min-height: 180px;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: 8px;
  background: rgba(255, 250, 241, 0.58);
}

@media (max-width: 980px) {
  .app-shell {
    grid-template-columns: 1fr;
  }

  .sidebar {
    position: relative;
    height: auto;
  }

  .sidebar .brand-logo {
    width: 240px;
    max-height: 156px;
  }

  .nav-list {
    grid-template-columns: repeat(3, 1fr);
  }

  .weekly-card {
    display: none;
  }

  .metrics-grid,
  .content-grid,
  .split-layout,
  .assignment-detail-layout,
  .student-grid {
    grid-template-columns: 1fr;
  }

}

@media (max-width: 640px) {
  .main-area,
  .sidebar {
    padding: 16px;
  }

  .topbar,
  .assignment-top,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .top-actions,
  .form-row,
  .resource-entry {
    grid-template-columns: 1fr;
  }

  .metronome-controls {
    grid-template-columns: 1fr;
  }

  .top-actions {
    display: grid;
  }

  .icon-button,
  .primary-action {
    width: 100%;
  }

  .nav-list {
    grid-template-columns: 1fr;
  }

  .resource-links {
    grid-template-columns: 1fr;
  }

  .brand {
    align-items: flex-start;
  }

  .login-brand {
    align-items: center;
  }

  .login-brand .brand-logo {
    width: min(100%, 420px);
  }
}

@media print {
  body {
    background: white;
  }

  .sidebar,
  .top-actions,
  .assignment-actions,
  #practiceForm,
  #logList {
    display: none;
  }

  .app-shell {
    display: block;
  }

  .main-area {
    padding: 0;
  }

  .work-panel,
  .metric-panel,
  .assignment-card {
    box-shadow: none;
    break-inside: avoid;
  }
}
