/* =========================================
   PORTAL — header strip (teacher / student entry)
========================================= */
.portal-strip {
  background: rgba(7, 15, 29, 0.6);
  border-bottom: 1px solid rgba(255,255,255,0.06);
}
.portal-strip-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 0 24px;
  height: 28px;
  display: flex;
  align-items: center;
  gap: 4px;
}
.portal-link {
  background: none;
  border: none;
  color: rgba(255,255,255,0.55);
  font-family: inherit;
  font-size: 0.76rem;
  font-weight: 500;
  padding: 3px 8px;
  border-radius: 6px;
  cursor: pointer;
  transition: color 0.2s, background 0.2s;
}
.portal-link:hover,
.portal-link:focus-visible {
  color: #fff;
  background: rgba(255,255,255,0.08);
  outline: none;
}
.portal-sep { color: rgba(255,255,255,0.25); font-size: 0.7rem; }

/* =========================================
   PORTAL — modal
========================================= */
body.pm-open { overflow: hidden; }
.pm-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  background: rgba(7, 15, 29, 0.62);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  animation: pm-fade 0.2s ease;
}
.pm-overlay[hidden] { display: none; }
@keyframes pm-fade { from { opacity: 0; } }
.pm-dialog {
  background: #fff;
  color: var(--navy);
  width: 100%;
  max-width: 440px;
  max-height: calc(100vh - 32px);
  max-height: calc(100dvh - 32px);
  display: flex;
  flex-direction: column;
  border-radius: 18px;
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: pm-pop 0.22s var(--ease);
}
.pm-dialog.pm-wide { max-width: 760px; }
@keyframes pm-pop { from { transform: translateY(12px) scale(0.98); opacity: 0; } }
.pm-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 22px;
  background: linear-gradient(135deg, var(--navy), var(--navy-mid));
  color: #fff;
  flex-shrink: 0;
}
.pm-title { font-size: 1.1rem; font-weight: 700; }
.pm-close {
  background: rgba(255,255,255,0.1);
  border: none;
  color: #fff;
  width: 32px; height: 32px;
  border-radius: 50%;
  font-size: 1.3rem;
  line-height: 1;
  cursor: pointer;
  transition: background 0.2s;
}
.pm-close:hover { background: rgba(255,255,255,0.2); }
.pm-body {
  padding: 22px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* Forms */
.pm-form { display: flex; flex-direction: column; gap: 10px; }
.pm-lead { font-size: 0.98rem; color: #3a3a4a; margin-bottom: 4px; }
.pm-label { font-weight: 700; font-size: 0.92rem; margin-top: 10px; }
.pm-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid #d6dde6;
  border-radius: 10px;
  font-family: inherit;
  font-size: 0.95rem;
  color: var(--navy);
  background: #fff;
  transition: border-color 0.2s, box-shadow 0.2s;
}
.pm-input:focus { outline: none; border-color: var(--teal); box-shadow: 0 0 0 3px rgba(0,163,224,0.15); }
.pm-input-lg { font-size: 1.15rem; padding: 14px 16px; text-align: center; letter-spacing: 0.04em; }
.pm-textarea { resize: vertical; min-height: 120px; line-height: 1.6; }
.pm-hint { font-size: 0.8rem; color: #6b7280; }
.pm-hint-bad { color: #b42318; font-weight: 600; }
.pm-error { color: #b42318; font-size: 0.88rem; font-weight: 500; min-height: 0; }
.pm-error:empty { display: none; }
.pm-status { font-size: 0.86rem; color: var(--teal-dark); }
.pm-status:empty { display: none; }
.pm-warn {
  background: #fff7e6;
  border: 1px solid #f5d38a;
  color: #7a4b00;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: 0.9rem;
}
.pm-warn ul { margin: 6px 18px 0 0; }
.pm-check { display: flex; align-items: center; gap: 8px; margin-top: 12px; font-weight: 600; font-size: 0.92rem; cursor: pointer; }
.pm-check input { width: 18px; height: 18px; accent-color: var(--teal-dark); }
.pm-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.pm-row .pm-input { flex: 1 1 160px; width: auto; }
.pm-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* Buttons */
.pm-btn {
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 22px;
  font-family: inherit;
  font-size: 0.98rem;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
}
.pm-btn:hover:not(:disabled) { opacity: 0.92; transform: translateY(-1px); }
.pm-btn:disabled { opacity: 0.6; cursor: wait; }
.pm-btn-ghost { background: #eef3f8; color: var(--navy); }
.pm-btn-small {
  display: inline-block;
  background: #eef3f8;
  color: var(--navy);
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-family: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
  align-self: flex-start;
  white-space: nowrap;
}
.pm-btn-small:hover:not(:disabled) { background: #dfe8f1; }
.pm-btn-small.pm-danger { background: #fdecec; color: #b42318; }
.pm-btn-small.pm-danger:hover:not(:disabled) { background: #fadada; }
.pm-btn-small.pm-primary { background: var(--teal-dark); color: #fff; }
.pm-icon-btn {
  background: none;
  border: none;
  color: #8a94a3;
  font-size: 1.3rem;
  line-height: 1;
  width: 30px; height: 30px;
  border-radius: 50%;
  cursor: pointer;
  flex-shrink: 0;
}
.pm-icon-btn:hover { background: #f1f4f8; color: #b42318; }
.pm-link { background: none; border: none; color: var(--teal-dark); font-family: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; }
.pm-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 20px; }

/* Task view (student + teacher preview) */
.pm-meta { font-size: 0.82rem; color: #6b7280; }
.pm-permanent { color: var(--teal-dark); font-weight: 700; }
.pm-task .pm-meta { margin-bottom: 12px; }
.pm-desc {
  white-space: pre-wrap;
  line-height: 1.8;
  font-size: 0.98rem;
  color: #2a2f3a;
  background: var(--sand-light);
  border-right: 4px solid var(--teal);
  border-radius: 10px;
  padding: 16px 18px;
  overflow-wrap: anywhere;
}
.pm-subtitle { font-size: 0.98rem; font-weight: 700; margin: 20px 0 10px; }
.pm-links { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pm-links a {
  color: var(--teal-dark);
  font-weight: 600;
  overflow-wrap: anywhere;
}
.pm-links a::before { content: '🔗 '; }
.pm-files { list-style: none; display: flex; flex-direction: column; gap: 8px; }
.pm-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  text-decoration: none;
  color: var(--navy);
  transition: border-color 0.2s, background 0.2s;
}
a.pm-file:hover { border-color: var(--teal); background: #f2fafd; }
.pm-file-icon {
  width: 30px; height: 30px;
  border-radius: 8px;
  background: rgba(0,163,224,0.12);
  color: var(--teal-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
  flex-shrink: 0;
}
.pm-file-name { flex: 1; font-weight: 600; font-size: 0.9rem; overflow-wrap: anywhere; }
.pm-file-size { font-size: 0.78rem; color: #8a94a3; white-space: nowrap; }

/* Dashboard */
.pm-userbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; font-size: 0.95rem; }
.pm-badge {
  display: inline-block;
  background: var(--gold);
  color: var(--navy);
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 9px;
  border-radius: 20px;
  margin-right: 8px;
  vertical-align: middle;
}
.pm-tabs { display: flex; gap: 4px; border-bottom: 2px solid #e7edf3; margin-bottom: 18px; flex-wrap: wrap; }
.pm-tab {
  background: none;
  border: none;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  padding: 9px 14px;
  font-family: inherit;
  font-size: 0.93rem;
  font-weight: 600;
  color: #6b7280;
  cursor: pointer;
}
.pm-tab:hover { color: var(--navy); }
.pm-tab.active { color: var(--navy); border-bottom-color: var(--teal); }
.pm-loading { color: #6b7280; text-align: center; padding: 20px 0; }
.pm-count { font-size: 0.9rem; color: #4b5563; margin-bottom: 12px; }
.pm-empty { text-align: center; padding: 18px 0; display: flex; flex-direction: column; align-items: center; gap: 14px; }
.pm-empty .pm-btn-small, .pm-empty .pm-btn { align-self: center; }

.pm-task-list, .pm-teacher-list { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.pm-task-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 12px;
  padding: 14px 16px;
}
.pm-task-top { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.pm-pw { font-size: 0.92rem; }
.pm-pw strong {
  background: rgba(0,163,224,0.12);
  color: var(--navy);
  padding: 2px 10px;
  border-radius: 6px;
  font-size: 1rem;
}
.pm-task-btns { display: flex; gap: 6px; flex-wrap: wrap; }
.pm-excerpt { font-size: 0.9rem; color: #3a3a4a; margin-bottom: 6px; white-space: pre-line; overflow-wrap: anywhere; }
.pm-task-details summary { cursor: pointer; font-size: 0.84rem; color: var(--teal-dark); font-weight: 600; margin-top: 6px; }
.pm-task-details .pm-task { margin-top: 10px; }

.pm-form-wide .pm-input { max-width: 100%; }
.pm-link-rows { display: flex; flex-direction: column; gap: 8px; }
.pm-link-rows:empty { display: none; }
.pm-link-row { display: flex; gap: 8px; align-items: center; }
.pm-link-row .pm-input { flex: 1; min-width: 0; }
.pm-file-pick { cursor: pointer; }
.pm-file-picks { list-style: none; display: flex; flex-direction: column; gap: 6px; }
.pm-file-picks:empty { display: none; }
.pm-file-picks li { display: flex; align-items: center; gap: 10px; padding: 6px 10px; background: var(--sand-light); border-radius: 8px; }

.pm-created { text-align: center; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.pm-created .pm-btn-small { align-self: center; }
.pm-created .pm-actions { justify-content: center; }
.pm-created-icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--teal), var(--teal-dark));
  color: #fff;
  font-size: 1.8rem;
  display: flex; align-items: center; justify-content: center;
}
.pm-big-pw {
  font-size: 2rem;
  font-weight: 800;
  color: var(--navy);
  background: var(--sand-light);
  border: 2px dashed var(--teal);
  border-radius: 12px;
  padding: 8px 28px;
  letter-spacing: 0.05em;
}

.pm-add-teacher { background: var(--sand-light); border-radius: 12px; padding: 4px 16px 16px; margin-bottom: 8px; }
.pm-add-teacher .pm-subtitle { margin-top: 14px; }
.pm-add-teacher .pm-error { margin-top: 8px; }
.pm-teacher { border: 1.5px solid #e2e8f0; border-radius: 12px; padding: 12px 16px; }
.pm-teacher-main { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.pm-teacher-name { flex: 1; min-width: 140px; }
.pm-edit:not(:empty) { margin-top: 10px; }
.pm-edit .pm-error { margin-top: 6px; }

@media (max-width: 540px) {
  .portal-strip-inner { padding: 0 14px; }
  .pm-overlay { padding: 8px; align-items: flex-end; }
  .pm-dialog { max-height: calc(100vh - 16px); max-height: calc(100dvh - 16px); border-radius: 16px; }
  .pm-body { padding: 18px 16px; }
  .pm-link-row { flex-wrap: wrap; }
  .pm-link-row .pm-input { flex: 1 1 100%; }
  .pm-big-pw { font-size: 1.6rem; }
}
