:root {
  --bg: #eef6fb;
  --panel: rgba(255, 255, 255, 0.92);
  --panel-soft: rgba(16, 86, 110, 0.08);
  --line: rgba(18, 72, 96, 0.12);
  --text: #163042;
  --muted: #5f7b8b;
  --accent: #0f8a9d;
  --accent-dark: #0b6f7f;
}

html {
  font-size: 16px;
  min-height: 100%;
}

body.portal-body {
  margin: 0;
  min-height: 100vh;
  color: var(--text);
  background:
    radial-gradient(circle at top right, rgba(15, 138, 157, 0.14), transparent 28%),
    radial-gradient(circle at top left, rgba(255, 153, 102, 0.14), transparent 24%),
    linear-gradient(180deg, #f7fbfe 0%, #edf5fa 48%, #e6f1f8 100%);
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

a {
  text-decoration: none;
}

.portal-container {
  width: min(1180px, calc(100% - 2rem));
  margin: 0 auto;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.user-pill {
  padding: 0.45rem 0.8rem;
  border-radius: 999px;
  background: var(--panel-soft);
  color: var(--muted);
  font-size: 0.9rem;
}

.hero-panel,
.dashboard-header,
.watch-layout,
.stats-grid,
.admin-grid,
.card-grid {
  margin-bottom: 2rem;
}

.app-shell {
  display: grid;
  grid-template-columns: 230px 1fr;
  min-height: 100vh;
}

.side-nav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
  height: 100vh;
  padding: 2rem 1.25rem;
  background:
    linear-gradient(180deg, rgba(8, 63, 83, 0.96) 0%, rgba(8, 53, 71, 0.97) 100%);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow-y: auto;
  box-shadow: 10px 0 35px rgba(15, 70, 90, 0.08);
}

.side-brand h2 {
  margin: 0.75rem 0 0.35rem;
  font-size: 1.35rem;
  line-height: 1.15;
  overflow-wrap: anywhere;
  word-break: break-word;
  color: #f5fbff;
}

.side-brand p {
  margin: 0;
  color: rgba(219, 233, 240, 0.88);
  overflow-wrap: anywhere;
}

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

.side-links {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  min-height: 0;
}

.side-link {
  display: block;
  padding: 0.85rem 1rem;
  border-radius: 14px;
  color: rgba(243, 249, 252, 0.94);
  background: transparent;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.side-link:hover,
.side-link.active {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.side-footer {
  margin-top: auto;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.side-credit {
  color: rgba(228, 240, 247, 0.78);
  font-size: 0.9rem;
  text-align: center;
}

.app-content {
  padding: 2rem;
}

.simple-header {
  padding: 1rem 0;
  background: rgba(255, 255, 255, 0.72);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(18, 72, 96, 0.08);
}

.simple-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.brand-link {
  color: var(--text);
  font-size: 1.15rem;
  font-weight: 600;
}

.brand-link-rich {
  display: inline-flex;
  align-items: center;
  gap: 0.75rem;
}

.portal-logo {
  display: block;
  object-fit: contain;
}

.side-logo-shell {
  width: 100%;
  margin-bottom: 0.9rem;
  padding: 0.7rem 0.85rem;
  border-radius: 22px;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
}

.portal-logo-side {
  width: 100%;
  height: 76px;
  margin-bottom: 0;
  border-radius: 0;
  background: transparent;
  padding: 0;
}

.portal-logo-header {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  background: rgba(15, 138, 157, 0.1);
  padding: 0.35rem;
}

.portal-logo-login {
  width: 240px;
  height: 90px;
  margin: 0 auto 1rem;
  border-radius: 20px;
  background: linear-gradient(180deg, rgba(15, 138, 157, 0.08), rgba(255, 255, 255, 0.85));
  padding: 0.7rem 0.9rem;
}

.hero-panel,
.form-shell,
.table-shell,
.portal-card,
.video-stage,
.hero-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 24px;
  box-shadow: 0 22px 55px rgba(29, 82, 107, 0.08);
}

.hero-panel {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.5rem;
  padding: 2.5rem;
}

.hero-card {
  padding: 1.5rem;
}

.eyebrow,
.tag,
.metric-label {
  display: inline-flex;
  padding: 0.35rem 0.75rem;
  border-radius: 999px;
  background: rgba(15, 138, 157, 0.1);
  color: var(--accent);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.hero-panel h1,
.dashboard-header h1,
.watch-layout h1,
.form-shell h1 {
  margin: 0.75rem 0 1rem;
  font-size: clamp(2rem, 4vw, 3.4rem);
  line-height: 1.08;
}

.lead-copy,
.section-heading p,
.portal-card p,
.metric-copy,
.small-note,
.empty-text {
  color: var(--muted);
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.5rem;
}

.btn-primary {
  background: var(--accent);
  border-color: var(--accent);
  color: #ffffff;
}

.btn-primary:hover,
.btn-primary:focus {
  background: var(--accent-dark);
  border-color: var(--accent-dark);
  color: #ffffff;
}

.btn-outline-light {
  border-color: rgba(16, 86, 110, 0.28);
  color: var(--text);
}

.btn-outline-light:hover,
.btn-outline-light:focus {
  background: rgba(15, 138, 157, 0.08);
  color: var(--text);
}

.sidebar-logout {
  border: 1px solid #ffffff;
  color: #123244;
  background: #ffffff;
  font-weight: 700;
}

.sidebar-logout:hover,
.sidebar-logout:focus {
  background: #e8f6fa;
  border-color: #e8f6fa;
  color: #123244;
}

.section-heading {
  margin-bottom: 1.25rem;
}

.card-grid,
.stats-grid {
  display: grid;
  gap: 1rem;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.compact-grid {
  grid-template-columns: 1fr;
}

.portal-card,
.table-shell,
.form-shell {
  padding: 1.5rem;
}

.content-option-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.content-option-card {
  padding: 1.5rem;
}

.content-option-card-wide {
  grid-column: 1 / -1;
}

.form-shell {
  max-width: 980px;
  margin: 0 auto 2rem;
  background: rgba(255, 255, 255, 0.96);
}

.form-shell-wide {
  max-width: none;
}

.settings-tabs {
  margin-bottom: 1.25rem;
  border-bottom-color: var(--line);
}

.settings-tabs .nav-link {
  color: var(--muted);
  border: 1px solid transparent;
  border-radius: 14px 14px 0 0;
}

.settings-tabs .nav-link.active {
  color: var(--accent);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--line);
  border-bottom-color: transparent;
}

.settings-tab-content {
  margin-top: -1px;
}

.settings-panel {
  padding: 1.5rem;
}

.settings-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.logo-preview-shell {
  margin-bottom: 1.25rem;
}

.logo-preview-card {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 150px;
  min-height: 150px;
  padding: 1rem;
  border-radius: 22px;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.04);
}

.settings-logo-preview {
  max-width: 180px;
  max-height: 110px;
  object-fit: contain;
}

.small-shell {
  max-width: 520px;
}

.login-page-shell {
  display: grid;
  place-items: center;
  min-height: calc(100vh - 120px);
}

.login-panel {
  width: min(100%, 480px);
  padding: 2rem;
  background: rgba(255, 255, 255, 0.98);
  border: 1px solid rgba(18, 72, 96, 0.1);
  border-radius: 24px;
  box-shadow: 0 22px 50px rgba(30, 77, 103, 0.12);
}

.login-panel .section-heading {
  text-align: center;
}

.login-panel h1,
.form-shell h1,
.table-shell h1,
.table-shell h2,
.portal-card h2,
.hero-card h1 {
  color: #163042;
}

.login-helper {
  margin-top: 1rem;
  color: var(--muted);
  text-align: center;
}

.login-helper a {
  color: var(--accent);
}

.portal-form label {
  margin-bottom: 0.4rem;
  color: #456577;
  font-weight: 600;
}

.form-control,
.form-select {
  background: #ffffff;
  border: 1px solid rgba(18, 72, 96, 0.14);
  color: #163042;
}

.form-control::placeholder,
textarea.form-control::placeholder {
  color: #7a95a4;
}

.form-select option {
  color: #08111f;
  background: #ffffff;
}

.form-control:focus,
.form-select:focus,
.form-check-input:focus,
.btn:focus {
  box-shadow: 0 0 0 0.2rem rgba(240, 180, 41, 0.2);
  border-color: var(--accent);
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.phone-group {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1rem;
  align-items: end;
}

.full-span {
  grid-column: 1 / -1;
}

.dashboard-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: center;
}

.admin-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.25rem;
}

.published-scroll {
  max-height: 560px;
  overflow-y: auto;
  padding-right: 0.25rem;
}

.table {
  --bs-table-bg: transparent;
  --bs-table-color: var(--text);
  --bs-table-border-color: var(--line);
}

.table thead th,
.table tbody td,
.table tbody th,
.table-responsive,
.table-shell h1,
.table-shell h2,
.table-shell h3 {
  color: var(--text) !important;
}

.table tbody tr {
  background: transparent;
}

.watch-layout {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 1.25rem;
}

.library-banner {
  display: grid;
  grid-template-columns: 1.6fr 1fr;
  gap: 1.25rem;
  margin-bottom: 2rem;
}

.library-summary,
.lesson-card,
.content-list-shell {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 22px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.22);
}

.library-summary {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  overflow: hidden;
}

.library-summary > div {
  padding: 1.25rem;
  background: rgba(255, 255, 255, 0.02);
}

.library-summary strong {
  display: block;
  font-size: 1.9rem;
  line-height: 1;
}

.library-summary span {
  display: block;
  margin-top: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.library-toolbar-shell {
  margin-bottom: 1.5rem;
  padding: 1rem;
  background: rgba(255, 255, 255, 0.62);
  border: 1px solid var(--line);
  border-radius: 20px;
}

.library-toolbar {
  display: grid;
  grid-template-columns: minmax(240px, 1.6fr) repeat(2, minmax(160px, 1fr)) auto;
  gap: 1rem;
  align-items: end;
}

.toolbar-label {
  display: block;
  margin-bottom: 0.45rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.toolbar-actions {
  display: flex;
  gap: 0.75rem;
}

.lesson-list-header {
  display: flex;
  justify-content: space-between;
  align-items: end;
  margin-bottom: 1rem;
}

.lesson-source,
.lesson-date {
  color: var(--muted);
  font-size: 0.88rem;
}

.lesson-icon {
  display: grid;
  place-items: center;
  width: 72px;
  height: 72px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.08);
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 700;
  letter-spacing: 0.08em;
}

.library-empty {
  max-width: 760px;
}

.compact-icon {
  width: 64px;
  height: 64px;
  border-radius: 18px;
}

.learning-table .table-title-cell {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.learning-table .table-title-cell strong {
  font-size: 1rem;
}

.learning-table .table-title-cell span {
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.status-pill {
  display: inline-flex;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-active {
  background: rgba(39, 171, 117, 0.15);
  color: #177553;
}

.status-inactive {
  background: rgba(227, 93, 93, 0.14);
  color: #ad3434;
}

.comment-list {
  display: grid;
  gap: 1rem;
}

.attachment-stack {
  display: grid;
  gap: 1rem;
}

.attachment-card {
  position: relative;
  padding: 1rem;
  border-radius: 20px;
  background: rgba(248, 252, 255, 0.92);
  border: 1px solid var(--line);
  overflow: hidden;
}

.chapter-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
}

.comment-card {
  padding: 1rem 1.2rem;
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--line);
}

.admin-response-card {
  margin-top: 1rem;
  padding: 0.9rem 1rem;
  border-radius: 16px;
  background: rgba(15, 138, 157, 0.08);
  border: 1px solid rgba(15, 138, 157, 0.18);
}

.content-admin-actions {
  display: flex;
  justify-content: flex-end;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.comment-head {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.5rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.video-stage {
  padding: 1rem;
  position: relative;
  user-select: none;
  overflow: hidden;
}

.secure-player,
.secure-frame,
.secure-image,
.text-content-panel {
  width: 100%;
  border-radius: 18px;
  background: #dfeaf0;
}

.secure-player,
.secure-frame,
.secure-image {
  aspect-ratio: 16 / 9;
  border: 0;
}

.secure-image {
  object-fit: contain;
  background: rgba(240, 247, 251, 0.95);
}

.text-content-panel {
  min-height: 420px;
  padding: 1.5rem;
  background:
    linear-gradient(180deg, rgba(243, 250, 253, 0.98), rgba(255, 255, 255, 0.98));
  border: 1px solid var(--line);
  overflow: auto;
}

.text-content-panel p {
  margin-bottom: 1rem;
  line-height: 1.7;
  color: var(--text);
}

.text-danger {
  color: #c93a3a !important;
}

.alert-success {
  color: #1d5f46;
  background: #e7f6ee;
  border-color: #ccead9;
}

.upload-help {
  margin-bottom: 1.25rem;
}

.upload-guide {
  margin: 0;
  padding-left: 1.2rem;
  color: var(--muted);
}

.inspection-overlay {
  position: absolute;
  inset: 1rem;
  display: none;
  align-items: center;
  justify-content: center;
  border-radius: 18px;
  background: rgba(20, 48, 66, 0.92);
  color: #f2f8fb;
  z-index: 3;
  font-weight: 600;
  letter-spacing: 0.04em;
}

body.inspection-blocked .inspection-overlay {
  display: flex;
}

body.inspection-blocked .secure-player,
body.inspection-blocked .secure-frame {
  visibility: hidden;
}

.video-watermark {
  position: absolute;
  z-index: 2;
  padding: 0.35rem 0.7rem;
  border-radius: 999px;
  background: rgba(15, 73, 93, 0.16);
  color: rgba(16, 48, 66, 0.78);
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  backdrop-filter: blur(6px);
  pointer-events: none;
}

.video-watermark-top {
  top: 1.8rem;
  left: 1.8rem;
}

.video-watermark-bottom {
  right: 1.8rem;
  bottom: 1.8rem;
}

@media (max-width: 991px) {
  .hero-panel,
  .library-banner,
  .watch-layout,
  .admin-grid {
    grid-template-columns: 1fr;
  }

  .app-shell {
    grid-template-columns: 1fr;
  }

  .side-nav {
    position: static;
    min-height: auto;
    height: auto;
  }

  .library-toolbar {
    grid-template-columns: 1fr 1fr;
  }

  .toolbar-actions {
    grid-column: 1 / -1;
  }

}

@media (max-width: 767px) {
  .form-grid {
    grid-template-columns: 1fr;
  }

  .phone-group {
    grid-template-columns: 1fr;
  }

  .portal-container {
    width: min(100% - 1rem, 1180px);
  }

  .library-summary,
  .library-toolbar {
    grid-template-columns: 1fr;
  }

  .content-option-grid {
    grid-template-columns: 1fr;
  }

  .toolbar-actions {
    flex-direction: column;
  }

  .login-panel,
  .form-shell {
    padding: 1.2rem;
  }
}
