/* The teacher workspace shares its ink, illustrated cards and turquoise masthead
   with the explorer portal. Scope the layout to the enhanced teacher shell. */
#teacher-app.td-shell {
  --desk-ink: #0b2955;
  --desk-deep: #075e68;
  --desk-turquoise: #00868a;
  --desk-sky: #e0f6ff;
  --desk-border: #cee5e9;
  --desk-heading: Nunito, 'Trebuchet MS', system-ui, sans-serif;
  color: var(--desk-ink);
  background: #f6fcfe;
  min-height: 100svh;
}
#teacher-app.td-shell .teacher-main {
  display: grid;
  grid-template-columns: clamp(10.5rem, 15vw, 13.75rem) minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  min-height: 100svh;
}
#teacher-app.td-shell :is(.teacher-topbar, .teacher-area, .td-sidebar, .td-home, .td-week, .td-tools) { min-width: 0; }
#teacher-app.td-shell .teacher-topbar {
  grid-column: 1 / -1;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: nowrap;
  gap: clamp(.45rem, 1vw, 1rem);
  min-height: 4.6rem;
  height: auto;
  padding: .68rem clamp(.85rem, 2vw, 2.1rem);
  border: 0;
  border-bottom: 1px solid #007981;
  background: linear-gradient(105deg, #007c83, #008c93 55%, #008188);
  color: #fff;
}
#teacher-app.td-shell .teacher-topbar .menu-toggle {
  color: #fff;
  background: transparent;
  border: 1px solid #ffffff70;
  border-radius: .75rem;
}
#teacher-app.td-shell .header-brand {
  display: flex;
  align-items: center;
  flex: 0 1 auto;
  gap: .5rem;
  color: #fff;
  line-height: 1.12;
  min-width: 0;
}

#teacher-app.td-shell .header-brand img { width: 2.9rem; height: 2.9rem; object-fit: contain; flex: none; }
#teacher-app.td-shell .header-brand strong {
  color: #fff;
  font: 900 clamp(1.15rem, 2.1vw, 1.75rem)/1.1 var(--desk-heading);
  letter-spacing: -.04em;
}
#teacher-app.td-shell .td-search {
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: .6rem;
  min-width: 0;
  min-height: 2.75rem;
  width: clamp(8.5rem, 24vw, 24rem);
  margin-inline: auto;
  border: 1px solid #c3f2f5;
  border-radius: 2rem;
  padding: .4rem 1rem;
  background: #fff;
  color: #164a63;
  font: 750 1rem/1.15 var(--desk-heading);
  text-align: start;
}
#teacher-app.td-shell .td-icon,
#teacher-app.td-shell :is(.td-search, .td-nav-item, .td-tool, .td-tools-open) svg {
  width: 1.4rem;
  height: 1.4rem;
  flex: none;
}
#teacher-app.td-shell .td-language {
  display: inline-flex;
  align-items: center;
  flex: none;
  border: 1px solid #ffffff8a;
  border-radius: 2rem;
  padding: .1rem;
}
#teacher-app.td-shell .td-language button {
  display: grid;
  place-items: center;
  min-width: 2.38rem;
  min-height: 2.5rem;
  padding: .22rem .45rem;
  border: 0;
  border-radius: 2rem;
  background: transparent;
  color: #fff;
  font: 850 .88rem/1 var(--desk-heading);
}
#teacher-app.td-shell .td-language button[aria-pressed=true] {
  background: #fff;
  color: #075d69;
}
#teacher-app.td-shell .teacher-topbar .profile-toggle {
  min-width: 0;
  max-width: 12rem;
  padding: .35rem .65rem;
  background: #006f74;
  color: white;
  border-color: #8edbdc;
  gap: .45rem;
}
#teacher-app.td-shell .teacher-topbar .profile-toggle span:last-child {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}
#teacher-app.td-shell .teacher-topbar .avatar-bubble {
  background: #f8e8ce;
  color: #4a3428;
  flex: none;
}
#teacher-app.td-shell .td-sidebar {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: .45rem;
  grid-column: 1;
  grid-row: 2;
  padding: 1.4rem .7rem;
  background: linear-gradient(150deg, #d6f4ff, #e4f6ff 75%, #d5f4fb);
  border-inline-end: 1px solid #c4e5ef;
}
#teacher-app.td-shell .td-nav-item {
  display: flex;
  align-items: center;
  gap: .65rem;
  min-height: 3rem;
  width: 100%;
  min-width: 0;
  padding: .6rem .75rem;
  border: 0;
  border-radius: .85rem;
  text-align: start;
  color: var(--desk-ink);
  background: transparent;
  font: 850 1rem/1.25 var(--desk-heading);
  overflow-wrap: anywhere;
}
#teacher-app.td-shell .td-nav-item[aria-current=page] { background: #91e7ec; color: #073b57; }
#teacher-app.td-shell .td-side-tools { margin-block-start: auto; }
#teacher-app.td-shell .teacher-area {
  grid-column: 2;
  grid-row: 2;
  width: 100%;
  max-width: 80rem;
  align-self: start;
  margin: 0 auto;
  padding: clamp(1rem, 1.7vw, 1.85rem) clamp(1rem, 2vw, 2.4rem) 3.5rem;
}
#teacher-app.td-shell #teacher-nav { display: none; }
#teacher-app.td-shell[data-td-view=overview] .teacher-heading {
  position: absolute;
  width: 1px;
  height: 1px;
  min-height: 0;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  border: 0;
}
#teacher-app.td-shell:is([data-td-view=overview], [data-td-view=create], [data-td-view=bank]) .teacher-scope,
#teacher-app.td-shell[data-td-view=create] #teacher-crumb,
#teacher-app.td-shell #teacher-subtitle:empty { display: none; }
#teacher-app.td-shell:is([data-td-view=create], [data-td-view=bank], [data-td-view=factory]) .teacher-heading {
  min-height: 0;
  margin-bottom: .85rem;
}
#teacher-app.td-shell #teacher-crumb button {
  padding: .25rem 0;
  background: transparent;
  border: 0;
  color: #075e68;
  font: inherit;
  text-decoration: underline;
  text-underline-offset: .2em;
}
#teacher-app.td-shell .td-create-options {
  display: grid;
  grid-template-columns: repeat(auto-fit,minmax(min(100%,16rem),1fr));
  gap: .8rem;
}
#teacher-app.td-shell .td-create-options button {
  display: grid;
  align-content: start;
  gap: .4rem;
  padding: 1.25rem;
  border: 1px solid var(--desk-border);
  border-radius: 1rem;
  background: white;
  color: var(--desk-ink);
  text-align: start;
}
#teacher-app.td-shell .td-create-options button:hover { border-color: var(--desk-turquoise); }
#teacher-app.td-shell .td-create-options strong { font: 850 1.2rem/1.25 var(--desk-heading); color: var(--desk-deep); }
#teacher-app.td-shell .td-create-options span { font-size: 1rem; }

#teacher-app.td-shell .td-home {
  display: grid;
  gap: clamp(1rem, 1.6vw, 1.6rem);
  color: var(--desk-ink);
  font-family: var(--desk-heading);
}
#teacher-app.td-shell .td-attendance {
  display: grid;
  grid-template-columns: minmax(6rem, 1fr) minmax(8rem, 1.1fr) minmax(0, 1.75fr) auto;
  align-items: center;
  min-width: 0;
  height: clamp(6.5rem, 11vw, 10rem);
  overflow: hidden;
  position: relative;
  isolation: isolate;
  background: #eaf8ee;
  border: 1px solid #d2e9d7;
  border-radius: 1.1rem;
  color: var(--desk-ink);
  text-decoration: none;
}
#teacher-app.td-shell .td-portal,
#teacher-app.td-shell .td-explorers {
  width: 100%;
  max-width: 100%;
  height: 100%;
  min-width: 0;
  position: relative;
  z-index: -1;
  object-fit: contain;
  object-position: left bottom;
  align-self: end;
}
#teacher-app.td-shell .td-explorers { object-position: center bottom; }
#teacher-app.td-shell .td-attendance-title {
  padding-inline: .35rem;
  margin: 0;
  font: 900 clamp(1.35rem, 2.45vw, 2.55rem)/1.07 var(--desk-heading);
  letter-spacing: -.04em;
  text-wrap: balance;
}
#teacher-app.td-shell .td-attendance-next { display: none; }
#teacher-app.td-shell .td-start {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.75rem;
  margin-inline: .25rem clamp(.65rem, 1.1vw, 1.25rem);
  padding: .55rem clamp(.6rem, 1.1vw, 1.15rem);
  border-radius: .88rem;
  background: #007b7b;
  color: white;
  font: 850 clamp(.9rem, 1.25vw, 1.1rem)/1.2 var(--desk-heading);
  text-align: center;
}
#teacher-app.td-shell .td-resources {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(.6rem, 1.05vw, 1.15rem);
  align-items: stretch;
}
#teacher-app.td-shell .td-card {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  min-width: 0;
  overflow: hidden;
  margin: 0;
  border: 1px solid color-mix(in srgb, var(--card-bg) 80%, #638387);
  border-radius: 1rem;
  background: var(--card-bg);
  color: var(--desk-ink);
  padding: 0;
  text-decoration: none;
  text-align: center;
  box-shadow: 0 2px 4px #1047610a;
}
#teacher-app.td-shell .td-library { --card-bg: #d6f5dd; }
#teacher-app.td-shell .td-textbook { --card-bg: #cfedf3; }
#teacher-app.td-shell .td-studio { --card-bg: #f1dff9; }
#teacher-app.td-shell .td-craftbook { --card-bg: #fedccd; }
#teacher-app.td-shell .td-card-art {
  display: block;
  width: 100%;
  aspect-ratio: 1.13;
  object-fit: cover;
  object-position: center;
}
#teacher-app.td-shell .td-book-spread {
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg,#eafaf6,#b2dbe7);
}
#teacher-app.td-shell .td-book-spread > span {
  display: flex;
  width: 88%;
  max-width: 26rem;
  transform: rotate(-4deg);
  border: 2px solid white;
  box-shadow: 0 3px 0 #99afbb, 0 7px 12px #25495832;
}
#teacher-app.td-shell .td-book-page { display: block; width: 50%; height: auto; }
#teacher-app.td-shell .td-card-label {
  display: grid;
  flex: 1;
  place-items: center;
  min-height: 2.95em;
  padding: .42em .35em .54em;
  color: var(--desk-ink);
  font: 900 clamp(1.05rem, 1.9vw, 1.65rem)/1.12 var(--desk-heading);
  letter-spacing: -.035em;
  overflow-wrap: break-word;
  text-wrap: balance;
}
#teacher-app.td-shell .td-week,
#teacher-app.td-shell .td-homework,
#teacher-app.td-shell .td-tools {
  min-width: 0;
  border: 1px solid var(--desk-border);
  border-radius: 1rem;
  padding: clamp(.8rem, 1.25vw, 1.3rem);
  background: #fff;
}
#teacher-app.td-shell .td-week h2,
#teacher-app.td-shell .td-homework h2 {
  margin: 0 0 .65rem;
  font: 900 clamp(1.18rem, 1.7vw, 1.55rem)/1.2 var(--desk-heading);
  letter-spacing: -.035em;
}
#teacher-app.td-shell .td-work-actions { display: flex; flex-wrap: wrap; gap: .5rem; }
#teacher-app.td-shell .td-work-actions button {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: .5rem;
  min-height: 44px;
  padding: .55rem .75rem;
  border: 1px solid #b8d8d9;
  border-radius: .65rem;
  background: #edf8f6;
  color: var(--desk-deep);
  font: 800 1rem/1.2 var(--desk-heading);
  text-align: start;
}
#teacher-app.td-shell .td-work-actions svg { width: 1rem; height: 1rem; }
#teacher-app.td-shell .td-week-link {
  display: flex;
  width: 100%;
  min-width: 0;
  min-height: 2.75rem;
  align-items: center;
  gap: .5rem;
  margin: .35rem 0 0;
  padding: .5rem .75rem;
  border: 0;
  border-radius: .65rem;
  background: #e7f6fc;
  color: var(--desk-ink);
  font: 750 1rem/1.3 var(--desk-heading);
  text-align: start;
  overflow-wrap: anywhere;
}
#teacher-app.td-shell .td-tools {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: .35rem .7rem;
  padding: .35rem .6rem;
  background: #edf8f7;
}
#teacher-app.td-shell .td-tools h2 { margin: 0; font: inherit; }
#teacher-app.td-shell .td-tools-open,
#teacher-app.td-shell .td-tool {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: .42rem;
  min-height: 44px;
  border-radius: .65rem;
  cursor: pointer;
}
#teacher-app.td-shell .td-tools-open {
  padding: .25rem .45rem;
  border: 0;
  background: transparent;
  color: var(--desk-deep);
  font: 850 1.1rem/1.18 var(--desk-heading);
}
#teacher-app.td-shell .td-tools-open .td-icon { width: .85rem; height: .85rem; }
#teacher-app.td-shell .td-tool {
  min-width: 44px;
  padding: .35rem .65rem;
  border: 1px solid #b8d8d9;
  background: #fff;
  color: var(--desk-deep);
  font: 800 .94rem/1.15 var(--desk-heading);
}
#teacher-app.td-shell .td-tool .td-icon { width: 1.4rem; height: 1.4rem; }
#teacher-app.td-shell .td-bottom { display: none; }
#teacher-app.td-shell :is(.td-home, .td-sidebar, .td-bottom, .teacher-topbar) :is(button, a):focus-visible {
  outline: 3px solid #104e75;
  outline-offset: 2px;
  box-shadow: 0 0 0 5px #fff;
}
@media (hover: hover) {
  #teacher-app.td-shell .td-card:hover,
  #teacher-app.td-shell .td-attendance:hover { outline: 2px solid #409b9e; outline-offset: 1px; }
  #teacher-app.td-shell .td-nav-item:hover,
  #teacher-app.td-shell .td-tool:hover { background: #cff0f5; }
}
@media (max-width: 1000px) and (min-width: 761px) {
  #teacher-app.td-shell .teacher-main { grid-template-columns: 9.4rem minmax(0, 1fr); }
  #teacher-app.td-shell .td-sidebar { padding-inline: .4rem; }
  #teacher-app.td-shell .td-nav-item { padding-inline: .45rem; }
  #teacher-app.td-shell .teacher-area { padding-inline: .8rem; }
  #teacher-app.td-shell .td-resources { grid-template-columns: repeat(2,minmax(0,1fr)); }
  #teacher-app.td-shell .td-card-art { aspect-ratio: 1.8; }
}
@media (max-width: 760px) {
  #teacher-app.td-shell .teacher-main { display: block; }
  #teacher-app.td-shell .teacher-topbar {
    min-height: 3.75rem;
    padding: .43rem clamp(.55rem, 2.4vw, 1rem);
    gap: clamp(.3rem, 1.5vw, .65rem);
  }
  #teacher-app.td-shell .teacher-topbar .menu-toggle {
    width: 2.6rem;
    min-height: 2.65rem;
    border: 0;
    border-radius: .5rem;
  }
  #teacher-app.td-shell .header-brand { flex: 1 1 auto; gap: .35rem; }

  #teacher-app.td-shell .header-brand img { width: 2rem; height: 2rem; }
  #teacher-app.td-shell .header-brand strong { font-size: clamp(1.02rem, 4.8vw, 1.42rem); }
  #teacher-app.td-shell .td-search {
    width: 2.6rem;
    min-height: 2.65rem;
    flex: none;
    padding: .35rem;
    margin: 0;
    justify-content: center;
    border-radius: .55rem;
    background: transparent;
    border: 0;
    color: #fff;
  }
  #teacher-app.td-shell .td-search span:not(.td-icon) { display: none; }
  #teacher-app.td-shell .td-language button { min-width: 2.05rem; min-height: 2.5rem; }
  #teacher-app.td-shell .teacher-topbar .profile-toggle,
  #teacher-app.td-shell .td-sidebar { display: none; }
  #teacher-app.td-shell .teacher-area {
    max-width: 38rem;
    margin: 0 auto;
    padding: .85rem clamp(.7rem, 2.8vw, 1.25rem) calc(6.4rem + env(safe-area-inset-bottom));
  }
  #teacher-app.td-shell .td-home { gap: .78rem; }
  #teacher-app.td-shell .td-attendance {
    height: clamp(4.3rem,16vw,6rem);
    grid-template-columns: clamp(4.8rem, 23%, 8.8rem) minmax(0, 1fr) 2.35rem;
    border-radius: .8rem;
  }
  #teacher-app.td-shell .td-attendance-title {
    font-size: clamp(1.13rem, 5vw, 1.5rem);
    padding-inline: .4rem;
    text-wrap: pretty;
  }
  #teacher-app.td-shell .td-explorers, #teacher-app.td-shell .td-start { display: none; }
  #teacher-app.td-shell .td-attendance-next {
    display: grid;
    place-items: center;
  }
  #teacher-app.td-shell .td-resources { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .6rem; }
  #teacher-app.td-shell .td-card { border-radius: .8rem; }
  #teacher-app.td-shell .td-card-art { aspect-ratio: 1.45; }
  #teacher-app.td-shell .td-card-label {
    font-size: clamp(1.05rem, 4.55vw, 1.4rem);
    min-height: 2.7em;
    padding: .33em .24em .42em;
  }
  #teacher-app.td-shell .td-tools { padding: .25rem .35rem; gap: .25rem; }
  #teacher-app.td-shell .td-tools-open { font-size: 1rem; padding: .25rem; }
  #teacher-app.td-shell .td-tool {
    padding: .3rem .55rem;
    font-size: .94rem;
  }
  #teacher-app.td-shell .td-bottom {
    position: fixed;
    z-index: 8;
    inset: auto 0 0;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    padding: .3rem max(.5rem, env(safe-area-inset-right)) max(.3rem, env(safe-area-inset-bottom)) max(.5rem, env(safe-area-inset-left));
    gap: .35rem;
    border-top: 1px solid #badfe6;
    background: #fcfeff;
    color: var(--desk-ink);
    box-shadow: 0 -2px 10px #1649600a;
  }
  #teacher-app.td-shell .td-bottom .td-nav-item {
    min-height: 3rem;
    justify-content: center;
    flex-direction: column;
    gap: .13rem;
    padding: .26rem;
    font-size: .86rem;
    border-radius: .65rem;
  }
}
@media (max-width: 390px) {
  #teacher-app.td-shell .header-brand img { width:1.45rem;height:1.45rem; }
  #teacher-app.td-shell .td-card-art { aspect-ratio: 1.5; }
}
@media print {
  #teacher-app.td-shell .td-bottom,
  #teacher-app.td-shell .td-sidebar { display: none; }
}
