@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:wght@500;600;700&family=Manrope:wght@400;500;600;700&display=swap');

:root {
  --bg: #f7f5f0;
  --panel: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e8e4dc;
  --accent: #2563eb;
  --accent-hover: #1d4ed8;
  --accent-soft: #dbeafe;
  --danger: #dc2626;
  --success: #059669;
  --success-bg: #d1fae5;
  --sidebar-w: 340px;
  --outline-w: 290px;
  --shadow: 0 4px 24px rgba(28, 25, 23, 0.06);
  --radius: 14px;
  --font-ui: "Manrope", system-ui, sans-serif;
  --font-display: "Cormorant Garamond", Georgia, serif;
  --lesson-scale: 1;
}

* { box-sizing: border-box; }
html, body {
  margin: 0;
  min-height: 100%;
  color: var(--text);
  background: var(--bg);
  font-family: var(--font-ui);
}

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

.topbar {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.7rem 1.1rem;
  background: rgba(255,255,255,0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 50;
}

.topbar h1 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: 0.01em;
}

.btn {
  border: none;
  border-radius: 10px;
  padding: 0.58rem 1.05rem;
  cursor: pointer;
  background: var(--accent);
  color: #fff;
  font-weight: 600;
  font-size: 0.92rem;
  transition: background 0.15s, transform 0.1s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  box-sizing: border-box;
}
.btn:hover { background: var(--accent-hover); }
.btn:active { transform: scale(0.98); }
.btn.secondary { background: #eef2f7; color: var(--text); }
.btn.secondary:hover { background: #e2e8f0; }
.btn.success { background: var(--success); }
.btn.danger { background: var(--danger); }
.btn.icon { padding: 0.42rem 0.6rem; min-width: 2.1rem; }
.btn.upload-btn {
  background: linear-gradient(135deg, #2563eb, #1d4ed8);
  width: 100%;
  margin-top: 0.65rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.45rem;
}

.layout, .viewer-layout {
  display: flex;
  min-height: calc(100vh - 58px);
  height: calc(100vh - 58px);
  overflow: hidden;
}

.sidebar {
  width: var(--sidebar-w);
  background: var(--panel);
  border-right: 1px solid var(--line);
  overflow: auto;
  flex-shrink: 0;
  transition: width 0.25s ease, min-width 0.25s ease, opacity 0.2s ease;
  min-height: 0;
}

@media (min-width: 961px) {
  .viewer-layout.sidebar-collapsed .sidebar {
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
    pointer-events: none;
  }

  .viewer-layout.outline-collapsed .outline {
    width: 0;
    min-width: 0;
    opacity: 0;
    overflow: hidden;
    border-right: none;
    pointer-events: none;
    padding: 0;
  }

  .viewer-layout.outline-hidden .outline {
    display: none;
  }

  .menu-toggle#menu-outline { display: inline-flex; }
}

.lang-select {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.55rem;
  font-size: 0.85rem;
  font-weight: 600;
  background: #fff;
  color: var(--text);
  cursor: pointer;
  margin-right: 0.25rem;
}

.topbar .lang-select { flex-shrink: 0; }

.font-size-controls {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  flex-shrink: 0;
  background: #f9fafb;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 0.15rem 0.35rem;
}

.font-size-controls .font-btn {
  min-width: 2rem;
  padding: 0.35rem 0.45rem;
  font-weight: 700;
  font-size: 0.82rem;
  line-height: 1;
}

.font-size-label {
  min-width: 2.6rem;
  text-align: center;
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--muted);
}

.font-size-controls .font-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

@media (min-width: 961px) {
  .menu-toggle#menu-modules { display: inline-flex; }
}

.sidebar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1rem 0.75rem;
  border-bottom: 1px solid var(--line);
  font-weight: 700;
  font-size: 0.95rem;
  position: sticky;
  top: 0;
  background: var(--panel);
  z-index: 2;
}

.sidebar-head .hint {
  font-size: 0.78rem;
  color: var(--muted);
  font-weight: 500;
  margin-top: 0.25rem;
}

.edit-banner {
  background: #fff7ed;
  border-bottom: 1px solid #fed7aa;
  color: #9a3412;
  padding: 0.55rem 1rem;
  font-size: 0.82rem;
  line-height: 1.4;
}

.main, .lesson-frame { flex: 1; overflow: auto; min-width: 0; min-height: 0; }

.main { padding: 1.5rem; }

.course-block { margin-bottom: 0.35rem; }

.course-header {
  color: #fff;
  padding: 0.72rem 0.9rem;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  line-height: 1.35;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  text-transform: uppercase;
}

.course-header input[type="color"] {
  width: 26px;
  height: 22px;
  border: none;
  padding: 0;
  background: transparent;
  cursor: pointer;
  flex-shrink: 0;
}

.course-header input[type="text"] {
  font-size: 0.74rem;
}

.module-item, .lesson-item {
  padding: 0.72rem 1rem;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  transition: background 0.12s;
}

.module-item:hover, .lesson-item:hover { background: #faf9f7; }
.module-item.active, .lesson-item.active {
  background: var(--accent-soft);
  color: #1e40af;
  font-weight: 600;
  border-left: 3px solid var(--accent);
}

.lesson-item { padding-left: 1.5rem; font-size: 0.86rem; }

.drag-handle {
  cursor: grab;
  color: var(--accent);
  font-size: 0.95rem;
  user-select: none;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  letter-spacing: -0.12em;
  opacity: 0.85;
}

.course-header .drag-handle {
  color: rgba(255, 255, 255, 0.92);
}

.sidebar-label {
  flex: 1;
  min-width: 0;
  line-height: 1.35;
}

.sidebar-rename-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: 0.35rem 0.5rem;
  background: #fff;
}

.course-header .sidebar-rename-input {
  background: rgba(255, 255, 255, 0.95);
}

.module-item.dragging,
.course-block.dragging,
.lesson-card.dragging {
  opacity: 0.55;
}

.module-item.drop-target,
.course-block.drop-target,
.course-header.drop-target,
.lesson-card.drop-target {
  outline: 2px dashed var(--accent);
  outline-offset: -2px;
}

.ctx-menu {
  position: fixed;
  z-index: 200;
  min-width: 190px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 12px 36px rgba(28, 25, 23, 0.14);
  padding: 0.35rem;
}

.ctx-menu button {
  display: block;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.75rem;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
}

.ctx-menu button:hover {
  background: #f3f4f6;
}

.ctx-menu button.danger {
  color: var(--danger);
}

.edit-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  width: 100%;
}

.edit-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.45rem 0.6rem;
}

.module-hero {
  margin-bottom: 1.25rem;
}

.module-hero-toolbar {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
}

.module-hero-text {
  flex: 1;
  min-width: 220px;
}

.view-toggle {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
}

.view-toggle .view-btn.active {
  background: var(--accent-soft);
  border-color: var(--accent);
  color: #1d4ed8;
}

.module-hero h2 {
  font-family: var(--font-display);
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  line-height: 1.2;
}

.module-hero .sub {
  color: var(--muted);
  font-size: 0.95rem;
}

.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.35rem;
}

.main .card,
.main .upload-hero,
.main .admin-empty {
  width: 100%;
  max-width: none;
}

.module-list-main {
  padding-top: 1.5rem;
}

.lesson-frame .module-list-main {
  width: 100%;
  max-width: none;
  padding: 1.5rem 2rem 2.5rem;
  box-sizing: border-box;
}

.lesson-frame .module-hero h2 {
  font-family: var(--font-display);
  font-size: clamp(1.6rem, 2.5vw, 2.2rem);
  margin: 0;
}

.lesson-frame .lessons-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 900px) {
  .lesson-frame .lessons-grid {
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
  }
}

.lesson-frame .lessons-grid .lesson-card {
  width: 100%;
  margin-bottom: 0;
}

.lesson-frame .lessons-grid .lesson-card h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  line-height: 1.35;
}

.lessons-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 380px), 1fr));
  gap: 1rem;
  width: 100%;
}

#lessons-list.lessons-view-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  width: 100%;
}

@media (min-width: 768px) {
  #lessons-list.lessons-view-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1100px) {
  #lessons-list.lessons-view-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

#lessons-list.lessons-view-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  width: 100%;
}

#lessons-list.lessons-view-list .lesson-card {
  width: 100%;
  padding: 1.35rem 1.6rem;
}

#lessons-list.lessons-view-list .lesson-card h3 {
  font-family: var(--font-display);
  font-size: clamp(1.45rem, 2.2vw, 2rem);
  line-height: 1.25;
  margin: 0 0 0.65rem;
}

#lessons-list.lessons-view-list .upload-zone {
  margin-top: 0.55rem;
  padding: 0.85rem;
}

.lessons-grid .lesson-card,
#lessons-list .lesson-card {
  margin-bottom: 0;
}

.card h2 {
  font-family: var(--font-display);
  margin: 0 0 0.75rem;
  font-size: 1.6rem;
}

.section-label {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 1rem;
}

.badge {
  display: inline-block;
  background: var(--success-bg);
  color: #065f46;
  font-size: 0.72rem;
  font-weight: 700;
  padding: 0.22rem 0.6rem;
  border-radius: 999px;
}

.badge.pending {
  background: #fef3c7;
  color: #92400e;
}

.lesson-card {
  margin-bottom: 1rem;
  transition: box-shadow 0.15s;
}
.lesson-card:hover { box-shadow: 0 8px 28px rgba(28,25,23,0.08); }

.lesson-card h3 {
  font-family: var(--font-display);
  font-size: 1.15rem;
  margin: 0 0 0.5rem;
}

.upload-zone {
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 1.1rem;
  text-align: center;
  color: var(--muted);
  margin-top: 0.75rem;
  background: #f8fbff;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.upload-zone:hover {
  border-color: var(--accent);
  background: #eff6ff;
}

.upload-zone.dragover {
  border-color: var(--accent);
  background: #dbeafe;
}

.upload-zone .upload-icon {
  font-size: 1.6rem;
  margin-bottom: 0.35rem;
}

.upload-zone strong {
  display: block;
  color: var(--accent);
  font-size: 0.95rem;
  margin-bottom: 0.25rem;
}

.share-row {
  display: flex;
  gap: 0.45rem;
  align-items: center;
  margin-top: 0.75rem;
  flex-wrap: wrap;
}

.share-links {
  margin-top: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.share-block {
  padding: 0.75rem 0.85rem;
  border-radius: 10px;
  border: 1px solid var(--line);
}

.share-block-open {
  background: #ecfdf5;
  border-color: #6ee7b7;
}

.share-block-open .share-label {
  color: #047857;
}

.share-block-open input {
  background: #fff;
  border-color: #34d399;
}

.share-block-open .share-hint {
  color: #059669;
}

.share-block-closed {
  background: #eff6ff;
  border-color: #93c5fd;
}

.share-block-closed .share-label {
  color: #1d4ed8;
}

.share-block-closed input {
  background: #fff;
  border-color: #60a5fa;
}

.share-block-closed .share-hint {
  color: #2563eb;
}

.share-block .share-row {
  margin-top: 0.35rem;
}

.share-label {
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
}

.share-hint {
  font-size: 0.76rem;
  color: var(--muted);
  margin-top: 0.25rem;
  line-height: 1.35;
}

.share-popover {
  position: fixed;
  z-index: 300;
  width: min(420px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: 0 16px 48px rgba(28, 25, 23, 0.16);
  padding: 1rem;
}

.share-popover-title {
  font-weight: 700;
  margin-bottom: 0.75rem;
  font-size: 0.92rem;
}

.viewer-layout.public-mode .sidebar {
  display: none;
}

.viewer-layout.public-mode.outline-hidden .outline {
  display: none;
}

.share-row input {
  flex: 1;
  min-width: 180px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0.42rem 0.55rem;
  font-size: 0.8rem;
  background: #fafafa;
  color: var(--muted);
}

.outline {
  width: var(--outline-w);
  background: #f5f0e6;
  border-right: 1px solid #e8dfd0;
  overflow: auto;
  flex-shrink: 0;
  padding: 0.75rem 0;
  min-height: 0;
  transition: width 0.25s ease, min-width 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
}

.outline-title {
  font-size: 0.82rem;
  font-weight: 700;
  padding: 0 1rem 0.55rem;
  color: #7c6f5c;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.outline a {
  display: block;
  padding: 0.38rem 1rem;
  color: var(--text);
  text-decoration: none;
  font-size: 0.87rem;
  line-height: 1.35;
  border-left: 3px solid transparent;
  cursor: pointer;
  pointer-events: auto;
}

.outline a.h1-link { font-weight: 600; }
.outline a.h2-link { padding-left: 1.65rem; color: #4b5563; font-size: 0.83rem; }
.outline a:hover { background: #ebe3d4; }
.outline a.active {
  background: #e3d9c8;
  border-left-color: #b8956a;
  color: #5c4a32;
}

.lesson-frame { background: #fff; }

.lesson-content {
  width: 100%;
  max-width: none;
  margin: 0;
  padding: clamp(1rem, 2.5vw, 2.5rem);
  font-family: Georgia, "Times New Roman", serif;
  font-size: calc(1.06rem * var(--lesson-scale, 1));
  line-height: 1.82;
  color: #1c1c1c;
  user-select: none;
  -webkit-user-select: none;
  overflow-wrap: anywhere;
  word-wrap: break-word;
}

.lesson-content h1 {
  font-size: calc(1.95rem * var(--lesson-scale, 1));
  font-weight: 700;
  margin: 2rem 0 1rem;
  padding-bottom: 0.55rem;
  border-bottom: 3px solid #1a1208;
  scroll-margin-top: 1.25rem;
}
.lesson-content h1:first-child { margin-top: 0; }
.lesson-content h2 {
  font-size: calc(1.35rem * var(--lesson-scale, 1));
  font-weight: 700;
  margin: 1.75rem 0 0.85rem;
  padding-bottom: 0.3rem;
  border-bottom: 2px solid #5c3d2e;
  scroll-margin-top: 1.25rem;
}
.lesson-content p {
  margin: 0 0 1rem;
  text-align: justify;
  text-indent: 1.4em;
  font-size: inherit;
}
.lesson-content li,
.lesson-content td,
.lesson-content th,
.lesson-content blockquote {
  font-size: inherit;
}
.lesson-content h3 {
  font-size: calc(1.15rem * var(--lesson-scale, 1));
}
.lesson-content h1 + p,
.lesson-content h2 + p,
.lesson-content p.lead { text-indent: 0; }

.lesson-content.lesson-editing-enabled {
  user-select: text;
  -webkit-user-select: text;
}

.lesson-edit-bar {
  position: sticky;
  top: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
  padding: 0.65rem 0.85rem;
  margin: -0.5rem 0 1rem;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 10px;
  box-shadow: 0 4px 16px rgba(234, 88, 12, 0.08);
}

.lesson-edit-bar-title {
  font-weight: 700;
  color: #9a3412;
  font-size: 0.88rem;
}

.lesson-edit-status {
  flex: 1;
  font-size: 0.82rem;
  color: #b45309;
  min-width: 120px;
}

.lesson-editable-block {
  position: relative;
  padding-right: 3.2rem;
  border-radius: 8px;
  transition: background 0.12s;
}

.lesson-editable-block:hover {
  background: rgba(255, 247, 237, 0.65);
}

.lesson-editable-block.editing {
  background: #fffbeb;
  outline: 2px dashed #f59e0b;
  outline-offset: 4px;
}

.lesson-editable-block .is-editing {
  outline: none;
  cursor: text;
}

.lesson-edit-tools {
  position: absolute;
  right: 0.15rem;
  top: 0.15rem;
  display: flex;
  gap: 0.2rem;
  opacity: 0;
  transition: opacity 0.15s;
}

.lesson-editable-block:hover .lesson-edit-tools,
.lesson-editable-block.editing .lesson-edit-tools {
  opacity: 1;
}

.lesson-edit-pencil,
.lesson-edit-delete {
  border: none;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 8px;
  width: 2rem;
  height: 2rem;
  cursor: pointer;
  font-size: 0.95rem;
  line-height: 1;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

.lesson-edit-pencil:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.lesson-edit-delete:hover {
  background: #fef2f2;
  border-color: #fca5a5;
}

.empty-state {
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--muted);
}

.menu-toggle { display: none; }

.overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.35);
  z-index: 90;
}

.load-error {
  background: #fef2f2;
  border-bottom: 1px solid #fecaca;
  color: #991b1b;
  padding: 0.65rem 1rem;
  font-size: 0.9rem;
}

.sidebar-loading {
  padding: 1rem;
  color: var(--muted);
  font-size: 0.9rem;
}

.upload-hero {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 2px solid #93c5fd;
  border-radius: var(--radius);
  padding: 1.35rem;
  margin-bottom: 1.25rem;
}

.upload-hero h2 {
  font-family: var(--font-display);
  margin: 0 0 0.35rem;
  font-size: 1.5rem;
  color: #1e40af;
}

.upload-hero p {
  margin: 0 0 1rem;
  color: var(--muted);
  font-size: 0.92rem;
}

.portal-body {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  background: linear-gradient(160deg, #f7f5f0 0%, #eef2ff 50%, #f0fdf4 100%);
}

.portal-lang-bar {
  position: fixed;
  top: 0.75rem;
  right: 0.75rem;
  z-index: 50;
}

.portal-wrap {
  text-align: center;
  max-width: 820px;
  width: 100%;
}

.portal-hero-card {
  display: grid;
  grid-template-columns: minmax(200px, 280px) 1fr;
  gap: 1.75rem;
  align-items: center;
  text-align: left;
  margin-bottom: 2rem;
  padding: 1.25rem;
  background: linear-gradient(135deg, #fff 0%, #fdfbf7 45%, #f5f0ff 100%);
  border: 1px solid rgba(201, 162, 39, 0.25);
  border-radius: calc(var(--radius) + 4px);
  box-shadow: 0 16px 48px rgba(28, 25, 23, 0.08);
}

.portal-hero-image {
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: 0 8px 32px rgba(88, 28, 135, 0.12);
  line-height: 0;
}

.portal-hero-image img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

.portal-hero-text {
  padding: 0.25rem 0;
}

.portal-hero-tag {
  margin: 0 0 0.5rem;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: #92400e;
}

.portal-title {
  font-family: var(--font-display);
  font-size: clamp(2rem, 5vw, 2.75rem);
  margin: 0 0 0.65rem;
  line-height: 1.1;
  color: #1c1917;
}

.portal-hero-quote {
  margin: 0 0 0.75rem;
  font-family: var(--font-display);
  font-size: 1.05rem;
  line-height: 1.45;
  color: #44403c;
  font-style: italic;
}

.portal-sub { color: var(--muted); margin: 0; font-size: 0.95rem; }

.portal-ganesha { width: 120px; margin-bottom: 0.5rem; }

.portal-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 0.85rem;
  text-align: left;
}

.portal-member {
  max-width: 640px;
  margin: 0 auto;
}

.portal-welcome {
  margin: 0.85rem 0 0;
  font-size: 1rem;
  font-weight: 600;
  color: #059669;
}

.portal-logout {
  cursor: pointer;
  font: inherit;
  width: 100%;
  text-align: left;
  border-left-color: #dc2626 !important;
  background: #fef2f2 !important;
  border-color: #fecaca !important;
}

.portal-logout:hover {
  background: #fee2e2 !important;
}

.portal-card {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 1.15rem 1.2rem;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--text);
  transition: transform 0.12s, box-shadow 0.12s;
  border-left: 3px solid #d4d4d8;
}
.portal-card.accent { border-left-color: #2563eb; border-color: #bfdbfe; background: #f8fbff; }
.portal-card.admin-only { border-left-color: #d97706; border-color: #fcd34d; background: #fffbeb; }
.portal-card strong {
  font-size: 1.05rem;
  font-family: var(--font-display);
  letter-spacing: 0.01em;
}
.portal-card span:last-child { font-size: 0.82rem; color: var(--muted); line-height: 1.35; }
.portal-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 28px rgba(28,25,23,0.1);
}
.portal-user { margin-top: 1.25rem; font-size: 0.9rem; color: var(--muted); display: none; }

.auth-card { width: min(440px, 100%); }
.auth-card label { display: block; font-weight: 600; margin: 0.75rem 0 0.35rem; }
.auth-card input {
  width: 100%; border: 1px solid var(--line); border-radius: 8px; padding: 0.65rem 0.75rem;
}

.password-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.password-wrap input {
  padding-right: 2.75rem;
}

.password-toggle {
  position: absolute;
  right: 0.35rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  cursor: pointer;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 8px;
  color: #4b5563;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  z-index: 2;
  font-size: 1rem;
  line-height: 1;
}

.password-toggle:hover {
  background: #f3f4f6;
  color: var(--text);
}

.password-toggle svg {
  width: 1.15rem;
  height: 1.15rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.consent { display: flex; gap: 0.55rem; align-items: flex-start; margin: 1rem 0; font-size: 0.92rem; }
.admin-note {
  background: #fffbeb;
  border: 1px solid #fcd34d;
  border-radius: 8px;
  padding: 0.65rem 0.75rem;
  font-size: 0.88rem;
  margin-bottom: 0.75rem;
  text-align: left;
}
.msg { margin-top: 0.75rem; font-size: 0.92rem; }
.msg.ok { color: #166534; }
.msg.err { color: #dc2626; }

.auth-nav {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.55rem;
  margin-top: 1.15rem;
}

.auth-nav-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.62rem 0.75rem;
  border-radius: 10px;
  font-size: 0.9rem;
  font-weight: 600;
  text-decoration: none;
  border: 1px solid var(--line);
  background: #f9fafb;
  color: var(--text);
  transition: background 0.12s, border-color 0.12s;
}

.auth-nav-btn:hover {
  background: #f3f4f6;
  border-color: #d1d5db;
}

.auth-nav-btn.accent {
  background: #eff6ff;
  border-color: #93c5fd;
  color: #1d4ed8;
}

.auth-nav-btn.accent:hover {
  background: #dbeafe;
}

.user-pill {
  font-size: 0.82rem;
  color: var(--muted);
  max-width: 160px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#status {
  font-size: 0.85rem;
  font-weight: 600;
  min-width: 6rem;
  text-align: center;
}

@media (max-width: 960px) {
  .portal-hero-card {
    grid-template-columns: 1fr;
    text-align: center;
    padding: 1rem;
  }
  .portal-hero-image {
    max-width: 260px;
    margin: 0 auto;
  }
  .portal-hero-text { text-align: center; }
  .menu-toggle { display: inline-flex; }
  .sidebar, .outline {
    position: fixed;
    top: 58px;
    bottom: 0;
    z-index: 100;
    transform: translateX(-110%);
    transition: transform 0.25s ease;
    box-shadow: var(--shadow);
  }
  .sidebar.open, .outline.open { transform: translateX(0); }
  .sidebar { left: 0; width: min(92vw, var(--sidebar-w)); }
  .outline { left: 0; }
  .overlay.show { display: block; }
  .module-hero { grid-template-columns: 1fr; }
  .ganesha-art { justify-self: center; width: 140px; }
  .font-size-controls { padding: 0.1rem 0.25rem; }
  .font-size-controls .font-btn { min-width: 1.75rem; padding: 0.3rem 0.35rem; font-size: 0.75rem; }
  .font-size-label { min-width: 2.2rem; font-size: 0.72rem; }
}
