/* Canvas-inspired IFi Teacher Portal */
.tp-shell {
  display: flex;
  min-height: 100vh;
  background: #f5f5f5;
  margin: 0;
  font-family: Inter, Lato, system-ui, sans-serif;
}

.tp-global {
  width: 72px;
  flex-shrink: 0;
  background: #394B58;
  color: #fff;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 0.75rem 0;
  gap: 0.35rem;
  z-index: 30;
}

.tp-global-btn {
  width: 56px;
  border: none;
  background: transparent;
  color: #dce4ea;
  border-radius: 0.5rem;
  padding: 0.55rem 0.25rem;
  font-size: 0.62rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
  line-height: 1.15;
}

.tp-global-btn i { font-size: 1.15rem; }
.tp-global-btn:hover,
.tp-global-btn.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}

.tp-global-logo {
  width: 36px;
  height: 36px;
  object-fit: contain;
  margin: 0;
  filter: drop-shadow(0 2px 4px rgba(0,0,0,0.25));
}

.tp-course-nav {
  width: 220px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid #e0e0e0;
  padding: 1rem 0.75rem 1.5rem;
  overflow-y: auto;
}

.tp-course-nav h2 {
  font-size: 0.95rem;
  font-weight: 700;
  color: #2d3b45;
  margin: 0 0 0.25rem;
  line-height: 1.3;
  padding: 0 0.5rem;
}

.tp-course-nav .tp-term {
  font-size: 0.72rem;
  color: #6b7780;
  padding: 0 0.5rem 0.85rem;
  border-bottom: 1px solid #eee;
  margin-bottom: 0.5rem;
}

.tp-nav-label {
  margin: 0.85rem 0.5rem 0.35rem;
  font-size: 0.65rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #9aa3a9;
}

.tp-course-link {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.65rem;
  border-radius: 0.35rem;
  font-size: 0.88rem;
  color: #2d3b45;
  cursor: pointer;
  font-weight: 500;
}

.tp-course-link:hover { background: #f2f4f5; }
.tp-course-link.active {
  background: #e5f2f8;
  color: #0374B5;
  font-weight: 700;
  box-shadow: inset 3px 0 0 #0374B5;
}

.tp-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.tp-topbar {
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  padding: 0.65rem 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.tp-topbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
  flex-wrap: wrap;
}

.tp-topbar-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.tp-user {
  font-size: 0.85rem;
  color: #6b7780;
  margin-right: 0.25rem;
}

.tp-back-btn {
  border: 1px solid #c7cdd1;
  background: #fff;
  color: #2d3b45;
  border-radius: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}

.tp-back-btn:hover:not(:disabled) { background: #eef7fc; border-color: #0374B5; color: #0374B5; }
.tp-back-btn:disabled { opacity: 0.4; cursor: not-allowed; }

.tp-breadcrumbs {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.25rem;
  min-width: 0;
}

.tp-crumb-link {
  border: none;
  background: none;
  color: #0374B5;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  padding: 0.15rem 0.25rem;
  border-radius: 0.25rem;
}

.tp-crumb-link:hover { text-decoration: underline; background: #eef7fc; }
.tp-crumb-link.current {
  color: #2d3b45;
  font-weight: 700;
  cursor: default;
  text-decoration: none;
}

.tp-crumb-sep { color: #9aa3a9; font-size: 0.85rem; }

.tp-mobile-nav {
  display: none;
  gap: 0.4rem;
  padding: 0.65rem 1rem;
  background: #fff;
  border-bottom: 1px solid #e0e0e0;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.tp-mobile-chip {
  flex: 0 0 auto;
  border: 1px solid #c7cdd1;
  background: #fff;
  color: #2d3b45;
  border-radius: 999px;
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
}

.tp-mobile-chip.active {
  background: #0374B5;
  border-color: #0374B5;
  color: #fff;
}

.tp-body {
  padding: 1.25rem 1.5rem 2rem;
  flex: 1;
  overflow: auto;
}

.tp-title-row {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 1rem;
}

.tp-title-row h1 {
  margin: 0;
  font-size: 1.65rem;
  font-weight: 700;
  color: #2d3b45;
}

.tp-btn {
  border: 1px solid #c7cdd1;
  background: #fff;
  color: #2d3b45;
  border-radius: 0.35rem;
  padding: 0.45rem 0.85rem;
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
}

.tp-btn:hover { background: #f5f5f5; }
.tp-btn.primary {
  background: #0374B5;
  border-color: #0374B5;
  color: #fff;
}
.tp-btn.primary:hover { background: #02629a; }

.tp-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
}

.tp-course-card {
  background: #fff;
  border-radius: 0.5rem;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(45, 59, 69, 0.12);
  border: 1px solid #e6e6e6;
  text-align: left;
  cursor: pointer;
  padding: 0;
  font: inherit;
}

.tp-course-card-banner {
  height: 90px;
  display: flex;
  align-items: flex-end;
  padding: 0.75rem;
  color: #fff;
  font-weight: 700;
  font-size: 1.05rem;
}

.tp-course-card-body {
  padding: 0.85rem 1rem 1rem;
}

.tp-course-card-meta {
  font-size: 0.78rem;
  color: #6b7780;
  margin-bottom: 0.65rem;
}

.tp-course-card-actions {
  display: flex;
  gap: 0.75rem;
  color: #0374B5;
  font-size: 0.95rem;
}

.tp-panel {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0.4rem;
  padding: 1rem 1.1rem;
  margin-bottom: 1rem;
}

.tp-panel h3 {
  margin: 0 0 0.65rem;
  font-size: 1rem;
  color: #2d3b45;
}

.tp-todo {
  list-style: none;
  margin: 0;
  padding: 0;
}

.tp-todo li {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.65rem 0;
  border-bottom: 1px solid #eee;
  font-size: 0.9rem;
}

.tp-todo li:last-child { border-bottom: 0; }
.tp-todo button {
  border: none;
  background: none;
  color: #0374B5;
  font-weight: 600;
  cursor: pointer;
  text-align: left;
  padding: 0;
  font-size: inherit;
}

.tp-module {
  border: 1px solid #e0e0e0;
  border-radius: 0.4rem;
  margin-bottom: 0.75rem;
  background: #fff;
  overflow: hidden;
}

.tp-module-head {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.75rem 1rem;
  background: #f8f9fa;
  border-bottom: 1px solid #eee;
  font-weight: 700;
  color: #2d3b45;
}

.tp-module-head .handle {
  color: #9aa3a9;
  cursor: grab;
}

.tp-badge {
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  padding: 0.15rem 0.45rem;
  border-radius: 999px;
  margin-left: auto;
}

.tp-badge.pub { background: #e5f8ee; color: #0b7b3e; }
.tp-badge.unpub { background: #f2f2f2; color: #6b7780; }
.tp-badge.graded { background: #e5f8ee; color: #0b7b3e; }
.tp-badge.submitted { background: #e5f2f8; color: #0374B5; }
.tp-badge.missing { background: #fdecea; color: #c62828; }
.tp-badge.locked { background: #f2f2f2; color: #6b7780; }

.tp-game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.85rem;
}

.tp-game-card {
  border: none;
  border-radius: 0.6rem;
  padding: 1.1rem;
  text-align: left;
  color: #fff;
  cursor: pointer;
  font: inherit;
  box-shadow: 0 8px 20px rgba(0,0,0,0.12);
  min-height: 150px;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}

.tp-game-card strong { font-size: 1.05rem; }
.tp-game-card span { font-size: 0.84rem; opacity: 0.95; line-height: 1.4; }
.tp-game-card:hover { filter: brightness(1.05); transform: translateY(-2px); }

.tp-announce {
  border-bottom: 1px solid #eee;
  padding: 0.85rem 0;
}
.tp-announce:last-child { border-bottom: 0; }
.tp-announce h4 { margin: 0 0 0.25rem; color: #2d3b45; font-size: 0.98rem; }
.tp-announce .when { font-size: 0.75rem; color: #6b7780; margin-bottom: 0.35rem; }
.tp-announce p { margin: 0; font-size: 0.88rem; color: #455a64; line-height: 1.45; }

.tp-lock-note {
  font-size: 0.78rem;
  color: #c62828;
  font-weight: 600;
  margin-left: auto;
}

.tp-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.65rem 1rem 0.65rem 2.25rem;
  border-top: 1px solid #f0f0f0;
  font-size: 0.9rem;
}

.tp-item i { color: #0374B5; width: 1.1rem; }
.tp-item .pts { margin-left: auto; color: #6b7780; font-size: 0.8rem; }

.tp-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.88rem;
  background: #fff;
}

.tp-table th, .tp-table td {
  border: 1px solid #e6e6e6;
  padding: 0.55rem 0.65rem;
  text-align: left;
  white-space: nowrap;
}

.tp-table th {
  background: #f5f7f8;
  color: #2d3b45;
  font-weight: 700;
  position: sticky;
  top: 0;
  z-index: 1;
}

.tp-table tr:hover td { background: #fafbfc; }

.tp-grade-input {
  width: 3.4rem;
  border: 1px solid #c7cdd1;
  border-radius: 0.25rem;
  padding: 0.25rem 0.35rem;
  text-align: center;
  font-size: 0.85rem;
}

.tp-gradebook-wrap {
  overflow: auto;
  max-height: min(60vh, 520px);
  border: 1px solid #e0e0e0;
  border-radius: 0.4rem;
  background: #fff;
}

.tp-sg {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 0;
  min-height: 480px;
  border: 1px solid #e0e0e0;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #fff;
}

.tp-sg-doc {
  padding: 1.25rem 1.5rem;
  border-right: 1px solid #e0e0e0;
  background: #fafafa;
}

.tp-sg-doc h3 { margin: 0 0 0.5rem; color: #2d3b45; }
.tp-sg-meta { font-size: 0.8rem; color: #6b7780; margin-bottom: 1rem; }
.tp-sg-body {
  background: #fff;
  border: 1px solid #e6e6e6;
  border-radius: 0.35rem;
  padding: 1rem;
  min-height: 220px;
  line-height: 1.55;
  font-size: 0.95rem;
}

.tp-sg-side {
  padding: 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.tp-sg-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.tp-guide-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.tp-guide-card {
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 0.5rem;
  padding: 1.1rem;
}

.tp-guide-card h3 {
  margin: 0 0 0.35rem;
  color: #0374B5;
  font-size: 1.05rem;
}

.tp-guide-card p {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: #54636d;
}

.tp-guide-card ol {
  margin: 0;
  padding-left: 1.15rem;
  font-size: 0.86rem;
  color: #2d3b45;
  line-height: 1.45;
}

.tp-guide-card li { margin-bottom: 0.4rem; }

.tp-resource-strip {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.tp-resource-strip button {
  border: 1px solid #d7e7f2;
  background: #eef7fc;
  border-radius: 0.45rem;
  padding: 0.85rem;
  text-align: left;
  cursor: pointer;
  font: inherit;
}

.tp-resource-strip strong {
  display: block;
  color: #0374B5;
  margin-bottom: 0.25rem;
  font-size: 0.92rem;
}

.tp-resource-strip span {
  font-size: 0.78rem;
  color: #54636d;
}

@media (max-width: 960px) {
  .tp-course-nav { display: none; }
  .tp-mobile-nav { display: flex; }
  .tp-sg { grid-template-columns: 1fr; }
  .tp-sg-doc { border-right: 0; border-bottom: 1px solid #e0e0e0; }
  .tp-resource-strip { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .tp-global { width: 56px; }
  .tp-global-btn { width: 48px; font-size: 0.55rem; }
  .tp-body { padding: 1rem; }
}
