/* Personal Dashboard - scoped frontend styles */
.pd-root, .pd-root *, .pd-root *::before, .pd-root *::after { box-sizing: border-box; }
.pd-root {
  --pd-bg: #f3f6fb;
  --pd-fg: #1a2236;
  --pd-card: #fff;
  --pd-muted: #6b7280;
  --pd-border: #e5e7eb;
  --pd-primary: var(--pd-accent, #3b82f6);
  --pd-secondary: #f5c542;
  --pd-dark: #232b45;
  --pd-dark-fg: #f5f7fb;
  --pd-shadow: 0 8px 30px -10px rgba(60,80,140,.18);
  --pd-grad-blue: linear-gradient(135deg, var(--pd-primary), #6366f1);
  --pd-grad-yellow: linear-gradient(135deg, #fbcf4a, #f5a623);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
  color: var(--pd-fg);
  background: var(--pd-bg);
  border-radius: 20px;
  overflow: hidden;
  position: relative;
  width: 100%;
  min-height: 600px;
}
.pd-root[data-mode="dark"] {
  --pd-bg: #141a2c;
  --pd-fg: #f5f7fb;
  --pd-card: #1f2740;
  --pd-muted: #94a3b8;
  --pd-border: rgba(255,255,255,.08);
}
.pd-loading { display: grid; place-items: center; min-height: 400px; }
.pd-spinner { width: 32px; height: 32px; border: 3px solid var(--pd-border); border-top-color: var(--pd-primary); border-radius: 50%; animation: pd-spin 0.8s linear infinite; }
@keyframes pd-spin { to { transform: rotate(360deg); } }

.pd-app { display: flex; min-height: 700px; }
.pd-sidebar { display: none; }
.pd-main { flex: 1; display: flex; flex-direction: column; padding: 0 0 100px; }
.pd-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 20px 8px; position: sticky; top: 0; backdrop-filter: blur(10px); background: color-mix(in oklab, var(--pd-bg) 80%, transparent); z-index: 5; }
.pd-header-user { display: flex; align-items: center; gap: 12px; }
.pd-avatar { width: 44px; height: 44px; border-radius: 50%; background: var(--pd-grad-blue); color: #fff; display: grid; place-items: center; font-weight: 600; overflow: hidden; box-shadow: 0 0 0 2px color-mix(in oklab, var(--pd-primary) 30%, transparent); }
.pd-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-welcome { line-height: 1.2; }
.pd-welcome small { color: var(--pd-muted); font-size: 12px; display: block; }
.pd-welcome strong { font-size: 14px; }
.pd-bell { width: 40px; height: 40px; border-radius: 50%; background: var(--pd-card); border: 0; display: grid; place-items: center; box-shadow: var(--pd-shadow); cursor: pointer; color: var(--pd-fg); }
.pd-content { padding: 12px 20px 20px; flex: 1; }
.pd-h1 { font-size: 22px; font-weight: 700; margin: 0 0 4px; }
.pd-sub { color: var(--pd-muted); font-size: 13px; margin: 0 0 16px; }

/* Bottom nav (mobile) */
.pd-bottom-nav { position: absolute; bottom: 18px; left: 50%; transform: translateX(-50%); display: flex; gap: 8px; background: var(--pd-dark); color: var(--pd-dark-fg); padding: 8px; border-radius: 999px; box-shadow: 0 20px 50px -15px rgba(0,0,0,.4); width: min(92%, 360px); justify-content: space-between; z-index: 10; }
.pd-bottom-nav button { width: 44px; height: 44px; border-radius: 50%; border: 0; display: grid; place-items: center; cursor: pointer; background: transparent; color: rgba(245,247,251,.7); transition: all .2s; }
.pd-bottom-nav button.active { background: var(--pd-secondary); color: #1f2740; transform: scale(1.1); }
.pd-bottom-nav svg { width: 20px; height: 20px; }

/* Cards */
.pd-card-base { background: var(--pd-card); border-radius: 18px; box-shadow: var(--pd-shadow); padding: 18px; }
.pd-cover-card { background: var(--pd-card); border-radius: 18px; overflow: hidden; box-shadow: var(--pd-shadow); margin-bottom: 18px; }
.pd-cover { position: relative; height: 140px; background: var(--pd-grad-blue); background-size: cover; background-position: center; }
.pd-cover-btn { position: absolute; right: 12px; top: 12px; width: 36px; height: 36px; border-radius: 50%; border: 0; background: rgba(0,0,0,.4); color: #fff; cursor: pointer; backdrop-filter: blur(6px); }
.pd-profile-row { padding: 0 18px 18px; }
.pd-profile-avatar { position: relative; width: 96px; height: 96px; border-radius: 50%; background: var(--pd-grad-blue); color: #fff; display: grid; place-items: center; font-size: 32px; font-weight: 700; margin-top: -48px; box-shadow: 0 0 0 4px var(--pd-card); overflow: hidden; }
.pd-profile-avatar img { width: 100%; height: 100%; object-fit: cover; }
.pd-profile-edit { position: absolute; bottom: 4px; right: 4px; width: 28px; height: 28px; border-radius: 50%; background: var(--pd-primary); color: #fff; border: 0; cursor: pointer; display: grid; place-items: center; }
.pd-profile-name { font-size: 20px; font-weight: 700; margin: 12px 0 2px; }
.pd-profile-bio { color: var(--pd-muted); font-size: 13px; margin: 0; }

.pd-grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
.pd-stat { display: flex; align-items: center; gap: 12px; padding: 16px; border-radius: 16px; background: var(--pd-card); box-shadow: var(--pd-shadow); }
.pd-stat-icon { width: 42px; height: 42px; border-radius: 50%; display: grid; place-items: center; color: #fff; flex-shrink: 0; }
.pd-stat-icon.blue { background: var(--pd-grad-blue); }
.pd-stat-icon.yellow { background: var(--pd-grad-yellow); color: #1f2740; }
.pd-stat-value { font-size: 18px; font-weight: 700; line-height: 1.1; }
.pd-stat-label { font-size: 12px; color: var(--pd-muted); }

.pd-chart-card { background: var(--pd-dark); color: var(--pd-dark-fg); padding: 20px; border-radius: 18px; box-shadow: var(--pd-shadow); margin-bottom: 16px; }
.pd-chart-head { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 12px; }
.pd-chart-head small { font-size: 11px; opacity: .6; display: block; }
.pd-chart-head strong { font-size: 16px; }
.pd-pill { background: rgba(245,197,66,.2); color: var(--pd-secondary); padding: 4px 10px; border-radius: 999px; font-size: 11px; }
.pd-bars { display: flex; align-items: flex-end; justify-content: space-between; height: 140px; padding: 8px 0; gap: 6px; }
.pd-bars .bar { flex: 1; background: var(--pd-grad-yellow); border-radius: 6px 6px 0 0; min-height: 8px; transition: height .4s; }
.pd-bars .label { text-align: center; font-size: 10px; margin-top: 6px; opacity: .6; }
.pd-bars-wrap { display: flex; gap: 6px; }
.pd-bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; }

.pd-mini-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-mini { padding: 16px; border-radius: 16px; box-shadow: var(--pd-shadow); color: #fff; }
.pd-mini.blue { background: var(--pd-grad-blue); }
.pd-mini.yellow { background: var(--pd-grad-yellow); color: #1f2740; }
.pd-mini small { display: block; opacity: .8; font-size: 11px; margin-bottom: 4px; }
.pd-mini b { font-size: 22px; }
.pd-progress { height: 6px; background: rgba(0,0,0,.15); border-radius: 999px; overflow: hidden; margin-top: 10px; }
.pd-progress span { display: block; height: 100%; background: rgba(0,0,0,.5); border-radius: 999px; }

/* Planner */
.pd-planner-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.pd-btn { background: var(--pd-primary); color: #fff; border: 0; padding: 8px 14px; border-radius: 10px; cursor: pointer; font-weight: 500; font-size: 13px; display: inline-flex; align-items: center; gap: 6px; }
.pd-btn.secondary { background: var(--pd-card); color: var(--pd-fg); border: 1px solid var(--pd-border); }
.pd-btn.danger { background: #ef4444; }
.pd-btn.primary { background: var(--pd-primary); }
.pd-btn.ghost { background: transparent; color: var(--pd-fg); border: 1px solid var(--pd-border); }
.pd-btn:hover { filter: brightness(1.04); }
.pd-btn:focus-visible { outline: 2px solid var(--pd-primary); outline-offset: 2px; }
.pd-btn[disabled] { opacity: .6; cursor: not-allowed; }
.pd-date-nav { display: flex; align-items: center; gap: 6px; }
.pd-date-nav button { background: var(--pd-card); border: 1px solid var(--pd-border); width: 32px; height: 32px; border-radius: 8px; cursor: pointer; color: var(--pd-fg); }
.pd-date-nav .date { font-weight: 600; padding: 0 8px; }
.pd-task-list { display: flex; flex-direction: column; gap: 10px; }
.pd-task { display: flex; align-items: center; gap: 12px; padding: 14px; background: var(--pd-card); border-radius: 14px; box-shadow: var(--pd-shadow); }
.pd-task.done .pd-task-title { text-decoration: line-through; color: var(--pd-muted); }
.pd-check-btn { width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--pd-border); background: transparent; cursor: pointer; display: grid; place-items: center; color: transparent; flex-shrink: 0; }
.pd-task.done .pd-check-btn { background: var(--pd-primary); border-color: var(--pd-primary); color: #fff; }
.pd-task-body { flex: 1; min-width: 0; }
.pd-task-title { font-weight: 600; font-size: 14px; }
.pd-task-meta { font-size: 11px; color: var(--pd-muted); margin-top: 2px; display: flex; gap: 10px; flex-wrap: wrap; }
.pd-task-actions { display: flex; gap: 4px; }
.pd-icon-btn { background: transparent; border: 0; width: 30px; height: 30px; border-radius: 8px; cursor: pointer; color: var(--pd-muted); }
.pd-icon-btn:hover { background: var(--pd-bg); color: var(--pd-fg); }
.pd-empty { text-align: center; padding: 40px 20px; color: var(--pd-muted); font-size: 13px; }

/* Tools */
.pd-search { width: 100%; padding: 12px 16px; border-radius: 999px; background: var(--pd-card); border: 1px solid var(--pd-border); color: var(--pd-fg); font-size: 14px; margin-bottom: 16px; }
.pd-tools-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.pd-tool-card { padding: 16px; border-radius: 16px; cursor: pointer; border: 0; text-align: left; box-shadow: var(--pd-shadow); transition: transform .2s; }
.pd-tool-card:hover { transform: translateY(-2px); }
.pd-tool-card.blue { background: var(--pd-grad-blue); color: #fff; }
.pd-tool-card.yellow { background: var(--pd-grad-yellow); color: #1f2740; }
.pd-tool-card.dark { background: var(--pd-dark); color: #fff; }
.pd-tool-icon { width: 36px; height: 36px; border-radius: 50%; background: rgba(255,255,255,.2); display: grid; place-items: center; margin-bottom: 10px; }
.pd-tool-icon svg { width: 18px; height: 18px; }
.pd-tool-name { font-weight: 600; font-size: 13px; }
.pd-tool-desc { font-size: 11px; opacity: .75; margin-top: 2px; }

/* Settings */
.pd-section { background: var(--pd-card); border-radius: 16px; padding: 18px; box-shadow: var(--pd-shadow); margin-bottom: 14px; }
.pd-section h3 { margin: 0 0 12px; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.pd-field { margin-bottom: 12px; }
.pd-field label { font-size: 12px; color: var(--pd-muted); display: block; margin-bottom: 4px; font-weight: 500; }
.pd-input, .pd-textarea, .pd-select { width: 100%; padding: 10px 12px; border-radius: 10px; border: 1px solid var(--pd-border); background: var(--pd-bg); color: var(--pd-fg); font-size: 13px; font-family: inherit; }
.pd-textarea { min-height: 70px; resize: vertical; }
.pd-toggle-row { display: flex; align-items: center; justify-content: space-between; padding: 10px 0; }
.pd-toggle-row + .pd-toggle-row { border-top: 1px solid var(--pd-border); }
.pd-toggle { position: relative; width: 42px; height: 24px; background: var(--pd-border); border-radius: 999px; cursor: pointer; border: 0; }
.pd-toggle::after { content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: .2s; }
.pd-toggle.on { background: var(--pd-primary); }
.pd-toggle.on::after { left: 20px; }

/* Modal */
.pd-modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.6); display: grid; place-items: center; z-index: 999999; padding: 16px; animation: pd-fade .2s; }
@keyframes pd-fade { from { opacity: 0; } }
.pd-modal { background: var(--pd-card); color: var(--pd-fg); border-radius: 18px; max-width: 520px; width: 100%; max-height: 85vh; overflow: auto; padding: 24px; position: relative; }
.pd-modal-wide { max-width: 880px; }
.pd-modal h3 { margin: 0 0 16px; font-size: 17px; }
.pd-modal-close { position: absolute; top: 14px; right: 14px; background: transparent; border: 0; width: 32px; height: 32px; cursor: pointer; color: var(--pd-muted); border-radius: 8px; font-size: 20px; }
.pd-modal-close:hover { background: var(--pd-bg); }

/* Toast */
.pd-toast { position: fixed; bottom: 90px; left: 50%; transform: translateX(-50%); background: var(--pd-dark); color: #fff; padding: 10px 18px; border-radius: 10px; font-size: 13px; z-index: 9999999; animation: pd-toast-in .3s; box-shadow: 0 10px 30px -10px rgba(0,0,0,.4); }
@keyframes pd-toast-in { from { opacity: 0; transform: translate(-50%, 20px); } }

/* Desktop layout */
@media (min-width: 1024px) {
  .pd-root { min-height: 720px; border-radius: 24px; }
  .pd-app { display: flex; }
  .pd-sidebar { display: flex; flex-direction: column; width: 240px; background: color-mix(in oklab, var(--pd-card) 60%, transparent); border-right: 1px solid var(--pd-border); padding: 24px 16px; flex-shrink: 0; }
  .pd-sidebar-brand { display: flex; align-items: center; gap: 12px; padding: 0 8px 24px; }
  .pd-sidebar-logo { width: 40px; height: 40px; border-radius: 12px; background: var(--pd-grad-blue); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 13px; }
  .pd-sidebar-brand small { color: var(--pd-muted); font-size: 11px; display: block; }
  .pd-sidebar-brand strong { font-size: 14px; }
  .pd-sidebar nav { flex: 1; display: flex; flex-direction: column; gap: 4px; }
  .pd-sidebar nav button { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: 12px; background: transparent; border: 0; color: var(--pd-muted); cursor: pointer; font-size: 13px; font-weight: 500; text-align: left; }
  .pd-sidebar nav button:hover { background: color-mix(in oklab, var(--pd-card) 80%, transparent); color: var(--pd-fg); }
  .pd-sidebar nav button.active { background: var(--pd-dark); color: var(--pd-dark-fg); box-shadow: var(--pd-shadow); }
.pd-sidebar nav svg { width: 16px; height: 16px; }

  /* Two-level navigation. The group head keeps the standard row metrics so
     depth is the only thing that changes; children are indented and quieter. */
  .pd-nav-group { display: flex; flex-direction: column; }
  .pd-nav-group-head { width: 100%; justify-content: space-between; }
  .pd-nav-group-head > span { flex: 1; }
  .pd-nav-group.is-active > .pd-nav-group-head { color: var(--pd-fg); }
  .pd-nav-caret { width: 14px; height: 14px; flex: 0 0 auto; opacity: .5; transition: transform .18s ease; }
  .pd-nav-group-head[aria-expanded="true"] .pd-nav-caret { transform: rotate(90deg); }
  .pd-nav-children { display: flex; flex-direction: column; gap: 2px; margin: 2px 0 4px; padding-left: 14px; border-left: 1px solid color-mix(in oklab, var(--pd-muted) 25%, transparent); }
  .pd-nav-children[hidden] { display: none; }
  .pd-nav-children button { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }
  .pd-nav-children button.active { background: color-mix(in oklab, var(--pd-dark) 88%, transparent); box-shadow: none; }
  .pd-sidebar-foot { display: flex; gap: 10px; padding: 10px; background: color-mix(in oklab, var(--pd-bg) 70%, transparent); border-radius: 12px; align-items: center; }
  .pd-sidebar-foot .pd-avatar { width: 36px; height: 36px; }
  .pd-sidebar-foot small { color: var(--pd-muted); font-size: 11px; display: block; }
  .pd-main { padding: 0 0 40px; }
  .pd-header { padding: 28px 36px 16px; }
  .pd-header-user { display: none; }
  .pd-header-title { display: block !important; }
  .pd-content { padding: 16px 36px 36px; }
  .pd-grid-2 { grid-template-columns: repeat(4, 1fr); }
  .pd-cover { height: 220px; }
  .pd-bars { height: 220px; }
  .pd-bottom-nav { display: none; }
  .pd-tools-grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 1280px) {
  .pd-tools-grid { grid-template-columns: repeat(5, 1fr); }
}
.pd-header-title { display: none; }
.pd-header-title small { color: var(--pd-muted); font-size: 12px; display: block; }
.pd-header-title h2 { margin: 0; font-size: 20px; }

/* ===== v1.1 fixes & improvements ===== */

/* Bottom nav: fixed to viewport on mobile, hidden on desktop */
@media (max-width: 1023px) {
  .pd-bottom-nav {
    position: fixed !important;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 999990;
  }
  .pd-main { padding-bottom: 120px !important; }
}
@media (min-width: 1024px) {
  .pd-bottom-nav { display: none; }
}

/* Modal: explicit bg so it works even when appended outside .pd-root */

/*
 * Dialogs are appended to <body>, not inside .pd-root, so they do not inherit
 * the design tokens declared above. Without these the block editor inside a
 * dialog renders with no borders and transparent surfaces. Kept in sync with
 * the .pd-root values above by hand.
 */
.pd-modal-overlay {
  --pd-bg: #f3f6fb;
  --pd-fg: #1a2236;
  --pd-card: #fff;
  --pd-muted: #6b7280;
  --pd-border: #e5e7eb;
  --pd-primary: var(--pd-accent, #3b82f6);
  --pd-secondary: #f5c542;
  --pd-dark: #232b45;
  --pd-dark-fg: #f5f7fb;
  --pd-shadow: 0 8px 30px -10px rgba(60,80,140,.18);
  --pd-grad-blue: linear-gradient(135deg, var(--pd-primary), #6366f1);
  --pd-grad-yellow: linear-gradient(135deg, #fbcf4a, #f5a623);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, sans-serif;
}
.pd-modal-overlay[data-mode="dark"] {
  --pd-bg: #141a2c;
  --pd-fg: #f5f7fb;
  --pd-card: #1f2740;
  --pd-muted: #94a3b8;
  --pd-border: rgba(255,255,255,.08);
}
.pd-modal-overlay { background: rgba(15, 23, 42, .55) !important; }
.pd-modal {
  background: #ffffff !important;
  color: #1a2236 !important;
  border: 1px solid rgba(15,23,42,.08);
  box-shadow: 0 30px 80px -20px rgba(15,23,42,.35);
}
.pd-modal-overlay[data-mode="dark"] .pd-modal {
  background: #1f2740 !important;
  color: #f5f7fb !important;
  border-color: rgba(255,255,255,.08);
}
.pd-modal-overlay[data-mode="dark"] .pd-modal-close { color: #cbd5e1; }
.pd-modal-overlay[data-mode="dark"] .pd-modal-close:hover { background: rgba(255,255,255,.08); }
.pd-modal-overlay[data-mode="dark"] .pd-input,
.pd-modal-overlay[data-mode="dark"] .pd-textarea,
.pd-modal-overlay[data-mode="dark"] .pd-select {
  background: #141a2c !important;
  color: #f5f7fb !important;
  border-color: rgba(255,255,255,.1) !important;
}

/* Modal inputs: visible borders in light mode */
.pd-modal .pd-input,
.pd-modal .pd-textarea,
.pd-modal .pd-select {
  background: #f7f8fb;
  color: #1a2236;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  padding: 10px 12px;
  width: 100%;
  font: inherit;
}

/* Productivity analytics enhancements */
.pd-prod-card {
  background: linear-gradient(135deg, #232b45 0%, #2d375a 100%);
  color: #f5f7fb;
  border-radius: 20px;
  padding: 22px;
  box-shadow: var(--pd-shadow);
  margin-bottom: 16px;
}
.pd-prod-top { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.pd-prod-meta small { display: block; font-size: 11px; opacity: .65; text-transform: uppercase; letter-spacing: .05em; }
.pd-prod-meta strong { font-size: 18px; display: block; margin-top: 4px; }
.pd-prod-gauge { position: relative; width: 90px; height: 90px; flex-shrink: 0; }
.pd-prod-gauge svg { transform: rotate(-90deg); width: 100%; height: 100%; }
.pd-prod-gauge .track { stroke: rgba(255,255,255,.1); }
.pd-prod-gauge .bar { stroke: url(#pdGrad); transition: stroke-dashoffset .8s ease; }
.pd-prod-gauge .num { position: absolute; inset: 0; display: grid; place-items: center; font-size: 22px; font-weight: 700; }
.pd-prod-legend { display: flex; gap: 14px; font-size: 11px; margin-top: 14px; opacity: .8; }
.pd-prod-legend span { display: inline-flex; align-items: center; gap: 6px; }
.pd-prod-legend i { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.pd-bars-grid { position: relative; }
.pd-bars-grid::before, .pd-bars-grid::after {
  content: ''; position: absolute; left: 0; right: 0; height: 1px; background: rgba(255,255,255,.06);
}
.pd-bars-grid::before { top: 33%; } .pd-bars-grid::after { top: 66%; }
.pd-bars { position: relative; }
.pd-bars .bar {
  background: linear-gradient(180deg, #f5c542 0%, #f59e0b 100%) !important;
  position: relative; overflow: visible;
}
.pd-bars .bar::after {
  content: attr(data-v); position: absolute; top: -18px; left: 50%; transform: translateX(-50%);
  font-size: 10px; color: #f5c542; font-weight: 600; opacity: 0;
  transition: opacity .2s;
}
.pd-bar-col:hover .bar::after { opacity: 1; }
.pd-bar-col:hover .bar { filter: brightness(1.15); }

/* Auth form (login/signup) */
.pd-auth-root { max-width: 440px; margin: 40px auto; padding: 0 16px; font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
.pd-auth-card { background: #fff; border-radius: 22px; padding: 32px; box-shadow: 0 30px 80px -20px rgba(15,23,42,.18); border: 1px solid rgba(15,23,42,.06); }
.pd-auth-logo { width: 56px; height: 56px; border-radius: 18px; background: linear-gradient(135deg, #3b82f6, #6366f1); margin: 0 auto 18px; display: grid; place-items: center; color: #fff; font-weight: 700; font-size: 20px; box-shadow: 0 12px 30px -8px rgba(59,130,246,.5); }
.pd-auth-title { text-align: center; font-size: 22px; font-weight: 700; margin: 0 0 4px; color: #0f172a; }
.pd-auth-sub { text-align: center; font-size: 13px; color: #64748b; margin: 0 0 22px; }
.pd-auth-tabs { display: flex; background: #f1f5f9; padding: 4px; border-radius: 12px; margin-bottom: 22px; }
.pd-auth-tabs button { flex: 1; background: transparent; border: 0; padding: 10px; border-radius: 9px; font-weight: 600; font-size: 13px; cursor: pointer; color: #64748b; transition: all .2s; }
.pd-auth-tabs button.active { background: #fff; color: #0f172a; box-shadow: 0 2px 6px rgba(15,23,42,.06); }
.pd-auth-field { margin-bottom: 14px; }
.pd-auth-field label { display: block; font-size: 12px; font-weight: 600; color: #475569; margin-bottom: 6px; }
.pd-auth-field input { width: 100%; padding: 12px 14px; border-radius: 11px; border: 1px solid #e2e8f0; background: #f8fafc; font-size: 14px; color: #0f172a; transition: all .15s; box-sizing: border-box; }
.pd-auth-field input:focus { outline: none; border-color: #3b82f6; background: #fff; box-shadow: 0 0 0 4px rgba(59,130,246,.12); }
.pd-auth-submit { width: 100%; padding: 13px; border-radius: 12px; border: 0; background: linear-gradient(135deg, #3b82f6, #6366f1); color: #fff; font-weight: 600; font-size: 14px; cursor: pointer; margin-top: 6px; box-shadow: 0 10px 25px -8px rgba(59,130,246,.5); transition: transform .15s; }
.pd-auth-submit:hover { transform: translateY(-1px); }
.pd-auth-submit:disabled { opacity: .6; cursor: not-allowed; }
.pd-auth-msg { padding: 10px 12px; border-radius: 10px; font-size: 13px; margin-bottom: 14px; }
.pd-auth-msg.err { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.pd-auth-msg.ok { background: #f0fdf4; color: #166534; border: 1px solid #bbf7d0; }
.pd-auth-foot { text-align: center; font-size: 12px; color: #94a3b8; margin-top: 18px; }
.pd-auth-foot a { color: #3b82f6; text-decoration: none; }

@media (prefers-color-scheme: dark) {
  .pd-auth-root.pd-auth-auto .pd-auth-card { background: #1f2740; border-color: rgba(255,255,255,.06); }
  .pd-auth-root.pd-auth-auto .pd-auth-title { color: #f5f7fb; }
  .pd-auth-root.pd-auth-auto .pd-auth-sub,
  .pd-auth-root.pd-auth-auto .pd-auth-foot { color: #94a3b8; }
  .pd-auth-root.pd-auth-auto .pd-auth-tabs { background: #141a2c; }
  .pd-auth-root.pd-auth-auto .pd-auth-tabs button { color: #94a3b8; }
  .pd-auth-root.pd-auth-auto .pd-auth-tabs button.active { background: #2d375a; color: #f5f7fb; }
  .pd-auth-root.pd-auth-auto .pd-auth-field label { color: #cbd5e1; }
  .pd-auth-root.pd-auth-auto .pd-auth-field input { background: #141a2c; border-color: rgba(255,255,255,.08); color: #f5f7fb; }
}

/* ===== v1.2 additions ===== */

/* Fix oversized settings icons */
.pd-section h3 svg { width: 18px; height: 18px; flex-shrink: 0; }
.pd-section h3 { font-size: 15px; font-weight: 600; }
.pd-stat-icon svg { width: 18px; height: 18px; }

/* Access gate */
.pd-gate { padding: 48px 24px; text-align: center; background: var(--pd-card); border-radius: 16px; box-shadow: var(--pd-shadow); }
.pd-gate h3 { margin: 0 0 8px; }
.pd-gate p { margin: 0 0 16px; color: var(--pd-muted); }
.pd-loading-sm { padding: 14px; color: var(--pd-muted); font-size: 13px; text-align: center; }

/* Blog analytics on Home */
.pd-blog-analytics { background: var(--pd-card); border-radius: 16px; padding: 18px; box-shadow: var(--pd-shadow); margin-top: 14px; }
.pd-blog-analytics .pd-prod-meta { margin-bottom: 12px; }
.pd-blog-stats { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin-bottom: 14px; }
@media (min-width: 640px) { .pd-blog-stats { grid-template-columns: repeat(5, 1fr); } }
.pd-blog-stat { background: var(--pd-bg); border-radius: 12px; padding: 10px; text-align: center; }
.pd-blog-stat .v { font-size: 20px; font-weight: 700; color: var(--pd-text); }
.pd-blog-stat .l { font-size: 11px; color: var(--pd-muted); }
.pd-blog-stat.blue   .v { color: var(--pd-accent); }
.pd-blog-stat.yellow .v { color: #f59e0b; }
.pd-blog-stat.green  .v { color: #16a34a; }
.pd-blog-chart small { color: var(--pd-muted); font-size: 11px; display: block; margin-bottom: 6px; }

/* Lecture editor */
.pd-le-grid { display: grid; gap: 16px; grid-template-columns: 1fr; }
@media (min-width: 1024px) { .pd-le-grid { grid-template-columns: 1fr 320px; } }
.pd-le-main { background: var(--pd-card); border-radius: 16px; padding: 16px; box-shadow: var(--pd-shadow); }
.pd-le-side { display: flex; flex-direction: column; gap: 12px; }
.pd-le-section { background: var(--pd-card); border-radius: 16px; padding: 14px; box-shadow: var(--pd-shadow); }
.pd-le-section h4 { margin: 0 0 8px; font-size: 13px; color: var(--pd-muted); text-transform: uppercase; letter-spacing: .04em; }
.pd-le-title { font-size: 20px; font-weight: 700; padding: 14px 12px; margin-bottom: 10px; }
/* "Start from a course lesson" picker in the lecture editor. */
.pd-le-source { background: var(--pd-bg); border: 1px solid var(--pd-border); border-radius: 14px; padding: 12px; margin-bottom: 12px; }
.pd-le-source-head strong { display: block; font-size: 14px; }
.pd-le-source-head p { margin: 4px 0 0; }
.pd-le-source-list { margin-top: 10px; max-height: 320px; overflow-y: auto; }
.pd-le-source-course { border-top: 1px solid var(--pd-border); padding: 6px 0; }
.pd-le-source-course summary { cursor: pointer; font-size: 13px; padding: 4px 2px; }
.pd-le-source-item { display: flex; align-items: center; gap: 10px; width: 100%; text-align: left; border: 0; background: transparent; padding: 8px 4px; border-radius: 10px; cursor: pointer; }
.pd-le-source-item:hover:not(:disabled) { background: var(--pd-card); }
.pd-le-source-item:disabled { opacity: .55; cursor: not-allowed; }
.pd-le-source-thumb { width: 44px; height: 44px; flex: 0 0 44px; border-radius: 8px; overflow: hidden; background: var(--pd-card); display: block; }
.pd-le-source-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pd-le-source-meta { display: flex; flex-direction: column; gap: 2px; min-width: 0; align-items: flex-start; }
.pd-le-source-title { font-weight: 600; font-size: 14px; }
.pd-le-toolbar { margin: 8px 0 6px; font-size: 13px; color: var(--pd-muted); }
.pd-le-palette { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; padding: 10px; background: var(--pd-bg); border-radius: 12px; }
.pd-le-add { background: var(--pd-card); border: 1px solid var(--pd-border); border-radius: 999px; padding: 6px 10px; font-size: 12px; display: inline-flex; align-items: center; gap: 6px; cursor: grab; color: var(--pd-text); }
.pd-le-add:hover { border-color: var(--pd-accent); color: var(--pd-accent); }
.pd-le-add svg { width: 14px; height: 14px; }
.pd-le-blocks { display: flex; flex-direction: column; gap: 10px; min-height: 120px; }
.pd-block { background: var(--pd-bg); border: 1px solid var(--pd-border); border-radius: 12px; padding: 10px; }
.pd-block.drag-over { border-color: var(--pd-accent); box-shadow: 0 0 0 2px rgba(59,130,246,.2); }
.pd-block.dragging { opacity: .5; }
.pd-block-head { display: flex; align-items: center; gap: 6px; margin-bottom: 8px; }
.pd-block-handle { cursor: grab; color: var(--pd-muted); display: inline-flex; }
.pd-block-handle svg { width: 16px; height: 16px; }
.pd-block-type { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--pd-muted); font-weight: 600; }
.pd-block-body { display: flex; flex-direction: column; gap: 8px; }
.pd-icon-btn { background: transparent; border: 1px solid var(--pd-border); border-radius: 8px; padding: 4px 8px; cursor: pointer; color: var(--pd-text); font-size: 12px; }
.pd-icon-btn.danger { color: #dc2626; border-color: rgba(220,38,38,.3); }
.pd-icon-btn.danger svg { width: 14px; height: 14px; }
.pd-le-feat img { display: block; }
.pd-le-actions { display: flex; gap: 8px; }
.pd-le-actions .pd-btn { flex: 1; }
.pd-le-tax { display: flex; flex-direction: column; gap: 4px; max-height: 200px; overflow-y: auto; }
.pd-le-tax label { display: flex; align-items: center; gap: 6px; font-size: 13px; padding: 4px 0; }
.pd-slide-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 6px; margin-top: 8px; }
.pd-slide-item { background: var(--pd-card); padding: 4px; border-radius: 8px; }
.pd-slide-item .pd-btn { width: 100%; padding: 4px; font-size: 11px; }
.pd-quiz-row { display: flex; align-items: center; gap: 8px; }
.pd-quiz-row input[type="text"] { flex: 1; }

/* My lectures list */
.pd-lectures { display: grid; gap: 12px; margin-top: 14px; grid-template-columns: 1fr; }
@media (min-width: 700px) { .pd-lectures { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1100px) { .pd-lectures { grid-template-columns: repeat(3, 1fr); } }
.pd-lec-card { background: var(--pd-card); border-radius: 16px; box-shadow: var(--pd-shadow); overflow: hidden; display: flex; flex-direction: column; }
.pd-lec-thumb { width: 100%; height: 140px; background-size: cover; background-position: center; background-color: var(--pd-bg); }
.pd-lec-thumb-empty { display: grid; place-items: center; color: var(--pd-muted); }
.pd-lec-thumb-empty svg { width: 36px; height: 36px; }
.pd-lec-body { padding: 12px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.pd-lec-body h3 { margin: 4px 0; font-size: 16px; line-height: 1.3; }
.pd-lec-row { display: flex; justify-content: space-between; align-items: center; font-size: 12px; }
.pd-badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 10px; text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.pd-badge.is-ok   { background: rgba(22,163,74,.15); color: #16a34a; }
.pd-badge.is-warn { background: rgba(245,158,11,.15); color: #d97706; }
.pd-badge-publish { background: rgba(22,163,74,.15); color: #16a34a; }
.pd-badge-draft   { background: rgba(245,158,11,.15); color: #d97706; }
.pd-badge-pending { background: rgba(59,130,246,.15); color: var(--pd-accent); }
.pd-badge-private { background: rgba(100,116,139,.15); color: #64748b; }
.pd-lec-meta { display: flex; gap: 12px; font-size: 12px; color: var(--pd-muted); flex-wrap: wrap; align-items: center; margin-top: auto; }
.pd-lec-meta svg { width: 14px; height: 14px; vertical-align: -2px; margin-right: 3px; }
.pd-lec-actions { display: flex; gap: 6px; margin-top: 8px; }
.pd-lec-actions .pd-btn { flex: 1; padding: 6px; font-size: 12px; text-align: center; text-decoration: none; }
.pd-empty { text-align: center; padding: 40px 20px; background: var(--pd-card); border-radius: 16px; box-shadow: var(--pd-shadow); margin-top: 16px; }

/* Mobile main column needs more bottom padding to clear fixed bottom nav */
@media (max-width: 1023px) { .pd-main { padding-bottom: 90px; } }

/* Mobile sub-section chips: the sidebar is hidden on phones, so the active
   group's child panels get a horizontally scrollable row under the header to
   keep every sub-tab (incl. Certificate Builder) reachable. Desktop uses the
   sidebar and hides the row. */
.pd-mobile-subnav { display: none; }
@media (max-width: 1023px) {
  .pd-mobile-subnav {
    display: flex;
    gap: 5px;
    overflow-x: auto;
    padding: 5px 10px;
    margin: 6px 10px 0;
    border-radius: 14px;
    background: var(--pd-bg);
    box-shadow: 0 1px 4px rgba(15, 23, 42, .06), inset 0 0 0 1px var(--pd-border);
    scrollbar-width: none;
    -ms-overflow-style: none;
  }
  .pd-mobile-subnav::-webkit-scrollbar { display: none; }
  .pd-mobile-subnav button {
    flex: 0 0 auto;
    position: relative;
    border: 0;
    border-radius: 10px;
    padding: 9px 14px;
    font-size: 12.5px;
    font-weight: 600;
    letter-spacing: .01em;
    color: var(--pd-muted);
    background: transparent;
    cursor: pointer;
    white-space: nowrap;
    transition: color .15s ease, background .15s ease, box-shadow .15s ease;
  }
  .pd-mobile-subnav button:active { transform: scale(.97); }
  .pd-mobile-subnav button.active {
    color: #fff;
    background: var(--pd-grad-blue);
    box-shadow: 0 4px 14px -2px rgba(59, 130, 246, .45);
  }
}
@media (min-width: 1024px) {
  .pd-mobile-subnav { display: none; }
}

/* ===== v1.3 enhancements ===== */
.pd-quiz-opts .pd-quiz-row { display:flex; align-items:center; gap:8px; margin:6px 0; }
.pd-quiz-opts .pd-quiz-row .pd-input { flex:1; }
.pd-quiz-opts .pd-sub { font-size:11px; color:var(--pd-muted); text-transform:uppercase; letter-spacing:.04em; }
@media (max-width: 1023px) {
  .pd-bottom-nav button span { display:none; }
}
@media (min-width: 1024px) {
  /* desktop sidebar nav: ensure labels show next to icons (no "undefined" prefix) */
  .pd-sidebar nav button { display:flex; align-items:center; gap:10px; }
  .pd-sidebar nav button svg { width:16px; height:16px; flex:0 0 auto; }
}

/* ===== Frontend quiz (rendered in posts) ===== */
.pd-quiz { background:#f8fafc; border:1px solid #e2e8f0; border-radius:14px; padding:16px 18px; margin:18px 0; }
.pd-dark .pd-quiz { background:rgba(31,39,64,.6); border-color:rgba(255,255,255,.08); color:#f5f7fb; }
.pd-quiz-q { margin:0 0 10px; font-size:17px; font-weight:600; }
.pd-quiz-list { list-style:none; padding:0; margin:0 0 10px; }
.pd-quiz-list li { padding:6px 0; }
.pd-quiz-list label { display:flex; gap:10px; align-items:center; cursor:pointer; }
.pd-quiz-input { width:100%; padding:10px 12px; border:1px solid #cbd5e1; border-radius:10px; font:inherit; }
.pd-quiz-check { margin-top:6px; padding:8px 16px; border:0; border-radius:999px; background:#3b82f6; color:#fff; font-weight:600; cursor:pointer; }
.pd-quiz-check:hover { background:#2563eb; }
.pd-quiz-feedback { margin-top:10px; padding:10px 12px; border-radius:10px; font-weight:600; }
.pd-quiz-feedback.is-correct { background:#dcfce7; color:#166534; }
.pd-quiz-feedback.is-wrong { background:#fee2e2; color:#991b1b; }
.pd-quiz-feedback .pd-quiz-exp { margin-top:6px; font-weight:400; opacity:.85; }
.pd-quiz-note { margin:6px 0 0; font-size:13px; opacity:.7; font-style:italic; }
.pd-quiz-list li label { cursor:default; }
.pd-quiz input:disabled, .pd-quiz-list input:disabled { opacity:.65; cursor:default; }

/* ===== v1.4 - Lighter bottom nav blue ===== */
.pd-bottom-nav {
  background: linear-gradient(135deg, #4f8cff, #6ea8ff) !important;
  color: #fff !important;
  box-shadow: 0 20px 50px -15px rgba(79,140,255,.55) !important;
}
.pd-bottom-nav button { color: rgba(255,255,255,.78) !important; }
.pd-bottom-nav button.active { background: #fff !important; color: #2563eb !important; }

/* ===== Planner v1.6 enhancements ===== */
.pd-planner-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; margin: 12px 0; }
.pd-stat-card { background: var(--pd-card); border-radius: 12px; padding: 10px 12px; box-shadow: var(--pd-shadow); text-align: center; }
.pd-stat-card small { display: block; color: var(--pd-muted); font-size: 10px; text-transform: uppercase; letter-spacing: .5px; }
.pd-stat-card b { font-size: 18px; color: var(--pd-fg); }
.pd-planner-filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr; gap: 8px; margin-bottom: 12px; }
.pd-day-progress { background: var(--pd-card); padding: 10px 14px; border-radius: 12px; box-shadow: var(--pd-shadow); margin-bottom: 12px; }
.pd-day-progress-bar { height: 6px; background: var(--pd-bg); border-radius: 999px; overflow: hidden; margin-bottom: 6px; }
.pd-day-progress-bar span { display: block; height: 100%; background: var(--pd-primary); transition: width .3s; }
.pd-day-progress small { color: var(--pd-muted); font-size: 11px; }
.pd-chip { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 11px; font-weight: 600; background: var(--pd-bg); color: var(--pd-fg); margin-right: 6px; }
.pd-chip-sm { display: inline-flex; padding: 1px 8px; border-radius: 999px; font-size: 10px; background: var(--pd-bg); color: var(--pd-muted); font-weight: 600; }
.pd-section-head { margin: 20px 0 8px; }
.pd-h2 { font-size: 16px; font-weight: 700; color: var(--pd-fg); }

/* Task form */
.pd-task-form .pd-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin-bottom: 10px; }
.pd-color { width: 100%; height: 38px; border-radius: 8px; border: 1px solid var(--pd-border); background: var(--pd-bg); cursor: pointer; padding: 2px; }
.pd-sub-edit { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.pd-sub-row-edit { display: flex; gap: 6px; }

/* Task detail modal */
.pd-task-detail-bar { height: 4px; border-radius: 4px; margin-bottom: 12px; }
.pd-task-detail-row { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.pd-detail-line { font-size: 13px; margin: 6px 0; color: var(--pd-fg); }
.pd-detail-notes { font-size: 13px; color: var(--pd-muted); white-space: pre-wrap; padding: 10px; background: var(--pd-bg); border-radius: 10px; margin-top: 10px; }
.pd-detail-h { font-weight: 600; font-size: 12px; text-transform: uppercase; color: var(--pd-muted); letter-spacing: .5px; margin: 12px 0 6px; }
.pd-subtasks { margin-top: 8px; }
.pd-sub-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; font-size: 13px; cursor: pointer; }
.pd-detail-actions { display: flex; gap: 8px; margin-top: 16px; flex-wrap: wrap; }

/* Calendar */
.pd-cal-wrap { background: var(--pd-card); border-radius: 16px; padding: 14px; box-shadow: var(--pd-shadow); }
.pd-cal-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; margin-bottom: 12px; }
.pd-cal-right { display: flex; align-items: center; gap: 8px; }
.pd-cal-switch { display: inline-flex; background: var(--pd-bg); border-radius: 999px; padding: 3px; gap: 2px; }
.pd-cal-tab { border: 0; background: transparent; padding: 6px 14px; border-radius: 999px; cursor: pointer; font-size: 12px; font-weight: 600; color: var(--pd-muted); }
.pd-cal-tab.active { background: var(--pd-primary); color: #fff; }

/* Month grid */
.pd-cal-month { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; background: var(--pd-border); border-radius: 10px; overflow: hidden; }
.pd-cal-dow { background: var(--pd-bg); text-align: center; padding: 8px 0; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--pd-muted); }
.pd-cal-cell { background: var(--pd-card); min-height: 90px; padding: 6px; cursor: pointer; display: flex; flex-direction: column; gap: 4px; transition: background .15s; }
.pd-cal-cell:hover { background: var(--pd-bg); }
.pd-cal-cell.out { opacity: .4; }
.pd-cal-cell.today .pd-cal-num { background: var(--pd-primary); color: #fff; }
.pd-cal-cell.sel { outline: 2px solid var(--pd-primary); outline-offset: -2px; }
.pd-cal-num { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; font-size: 12px; font-weight: 600; color: var(--pd-fg); }
.pd-cal-events { display: flex; flex-direction: column; gap: 2px; overflow: hidden; }
.pd-cal-ev { border: 0; text-align: left; padding: 2px 6px; border-radius: 4px; font-size: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; cursor: pointer; }
.pd-cal-ev.done { text-decoration: line-through; opacity: .6; }
.pd-cal-more { font-size: 10px; color: var(--pd-muted); padding-left: 4px; }

/* Week / Day */
.pd-cal-week, .pd-cal-day { display: flex; flex-direction: column; max-height: 600px; overflow: auto; border: 1px solid var(--pd-border); border-radius: 10px; }
.pd-cal-week-head { display: grid; grid-template-columns: 50px repeat(7, 1fr); position: sticky; top: 0; background: var(--pd-card); z-index: 2; border-bottom: 1px solid var(--pd-border); }
.pd-cal-week-day { border: 0; background: transparent; padding: 8px 4px; cursor: pointer; border-left: 1px solid var(--pd-border); }
.pd-cal-week-day:hover { background: var(--pd-bg); }
.pd-cal-week-day.today .pd-cal-num { background: var(--pd-primary); color: #fff; margin: 4px auto 0; }
.pd-cal-week-day.sel { background: var(--pd-bg); }
.pd-cal-week-body { display: grid; grid-template-columns: 50px repeat(7, 1fr); position: relative; }
.pd-cal-day { display: grid; grid-template-columns: 60px 1fr; max-height: 700px; }
.pd-cal-time-col { display: flex; flex-direction: column; background: var(--pd-bg); }
.pd-cal-hour { height: 40px; font-size: 10px; color: var(--pd-muted); padding: 2px 6px; border-bottom: 1px dashed var(--pd-border); text-align: right; }
.pd-cal-day-col { position: relative; border-left: 1px solid var(--pd-border); }
.pd-cal-day-col.big .pd-cal-slot, .pd-cal-day.big .pd-cal-hour { height: 48px; }
.pd-cal-day .pd-cal-hour { height: 48px; }
.pd-cal-slot { height: 40px; border-bottom: 1px dashed var(--pd-border); cursor: pointer; }
.pd-cal-slot:hover { background: var(--pd-bg); }
.pd-cal-ev-block { position: absolute; left: 4px; right: 4px; border: 0; border-radius: 6px; padding: 4px 6px; text-align: left; cursor: pointer; font-size: 11px; overflow: hidden; box-shadow: 0 1px 3px rgba(0,0,0,.1); display: flex; flex-direction: column; gap: 2px; }
.pd-cal-ev-block strong { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pd-cal-ev-block small { font-size: 10px; opacity: .8; }
.pd-cal-ev-block.done { text-decoration: line-through; opacity: .55; }

@media (max-width: 640px) {
  .pd-planner-stats { grid-template-columns: repeat(2, 1fr); }
  .pd-planner-filters { grid-template-columns: 1fr 1fr; }
  .pd-cal-cell { min-height: 60px; }
  .pd-cal-ev { font-size: 9px; }
  .pd-cal-week-body, .pd-cal-week-head { grid-template-columns: 40px repeat(7, minmax(80px, 1fr)); }
  .pd-cal-week { overflow-x: auto; }
}

/* ======= v1.7 - Forum + cover cog + subtabs ======= */
.pd-cover-cog{position:absolute;top:12px;right:60px;width:36px;height:36px;border-radius:50%;border:0;background:rgba(255,255,255,.92);color:#1a2236;display:grid;place-items:center;cursor:pointer;box-shadow:0 6px 18px rgba(15,23,42,.18)}
.pd-cover-cog svg{width:18px;height:18px}
.pd-cover-cog:hover{background:#fff;transform:rotate(20deg);transition:transform .2s}

.pd-forum{display:flex;flex-direction:column;gap:14px}
.pd-forum-header{display:flex;justify-content:space-between;align-items:center}
.pd-subtabs{display:flex;gap:6px;background:var(--pd-card);padding:6px;border-radius:14px;overflow-x:auto;box-shadow:0 2px 10px rgba(15,23,42,.04)}
.pd-subtabs button{flex:1;min-width:fit-content;border:0;background:transparent;color:var(--pd-muted);padding:8px 14px;border-radius:10px;cursor:pointer;display:flex;align-items:center;gap:6px;font-weight:600;font-size:13px;white-space:nowrap}
.pd-subtabs button svg{width:16px;height:16px}
.pd-subtabs button.active{background:var(--pd-grad-blue);color:#fff;box-shadow:0 6px 16px rgba(59,130,246,.25)}
.pd-subtabs button:hover:not(.active){background:rgba(0,0,0,.04);color:var(--pd-fg)}

.pd-forum-panel{min-height:200px}
.pd-row-between{display:flex;justify-content:space-between;align-items:center;gap:10px;margin-bottom:12px;flex-wrap:wrap}
.pd-row-actions{display:flex;gap:6px;margin-top:8px;flex-wrap:wrap}
.pd-card-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.pd-pad{padding:18px}
.pd-form-stack{display:flex;flex-direction:column;gap:8px}
.pd-form-stack label{font-size:13px;font-weight:600;color:var(--pd-fg)}

.pd-group-card,.pd-forum-card{background:var(--pd-card);border-radius:16px;overflow:hidden;box-shadow:0 4px 18px rgba(15,23,42,.05);display:flex;flex-direction:column}
.pd-group-cover{height:120px;background:linear-gradient(135deg,var(--pd-accent),var(--pd-secondary));background-size:cover;background-position:center;display:grid;place-items:center;color:#fff}
.pd-group-cover.empty svg{width:48px;height:48px;opacity:.7}
.pd-group-body{padding:14px}
.pd-group-body h3{margin:0 0 4px;font-size:16px}
.pd-group-meta{display:flex;gap:14px;color:var(--pd-muted);font-size:12px;margin-top:8px;align-items:center}
.pd-group-meta svg{width:14px;height:14px;vertical-align:-2px;margin-right:4px}

.pd-forum-card{flex-direction:row;padding:14px;gap:12px;align-items:flex-start}
.pd-forum-icon{width:44px;height:44px;border-radius:12px;background:var(--pd-grad-blue);color:#fff;display:grid;place-items:center;flex-shrink:0}
.pd-forum-icon svg{width:22px;height:22px}
.pd-forum-card h3{margin:0 0 4px;font-size:15px}

.pd-thread-list{display:flex;flex-direction:column;gap:10px}
.pd-thread{display:flex;gap:12px;background:var(--pd-card);padding:14px;border-radius:14px;box-shadow:0 2px 10px rgba(15,23,42,.04)}
.pd-thread-avatar{width:44px;height:44px;border-radius:50%;background:var(--pd-grad-blue) center/cover;flex-shrink:0}
.pd-thread-body{flex:1;min-width:0}
.pd-thread-row{display:flex;justify-content:space-between;align-items:baseline;gap:10px;flex-wrap:wrap}

.pd-member-list{display:flex;flex-direction:column;gap:8px;margin-top:12px}
.pd-member{display:flex;gap:10px;align-items:center;background:var(--pd-card);padding:10px 14px;border-radius:12px;box-shadow:0 2px 8px rgba(15,23,42,.04)}
.pd-member-avatar{width:36px;height:36px;border-radius:50%;background:#e5e7eb center/cover}
.pd-member-body{flex:1;min-width:0}

@media (max-width: 720px){
  .pd-cover-cog{top:10px;right:54px;width:32px;height:32px}
  .pd-subtabs{gap:4px;padding:4px;border-radius:12px}
  .pd-subtabs button{flex:0 0 auto;padding:8px 12px;border-radius:9px;font-size:12px}
}

/* v1.8 - Course detail view */
.pd-course-head{display:flex;justify-content:space-between;align-items:flex-start;gap:12px;flex-wrap:wrap;padding:14px 16px;background:var(--pd-card,#fff);border:1px solid var(--pd-border,#e5e7eb);border-radius:14px;margin-bottom:8px}
.pd-lecture-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(260px,1fr));gap:14px}
.pd-lecture-card{background:var(--pd-card,#fff);border:1px solid var(--pd-border,#e5e7eb);border-radius:14px;overflow:hidden;display:flex;flex-direction:column;transition:transform .15s ease,box-shadow .15s ease}
.pd-lecture-card:hover{transform:translateY(-2px);box-shadow:0 8px 24px rgba(15,23,42,.08)}
.pd-lecture-thumb{display:block;height:140px;background:#eef2f7 center/cover no-repeat;color:#94a3b8;display:flex;align-items:center;justify-content:center;text-decoration:none}
.pd-lecture-body{padding:12px 14px;display:flex;flex-direction:column;gap:6px;flex:1}
.pd-lecture-body h3{font-size:15px;line-height:1.3;margin:0}
.pd-lecture-body h3 a{color:inherit;text-decoration:none}
.pd-lecture-body h3 a:hover{color:var(--pd-accent,#3b82f6)}
.pd-lecture-body .pd-row-actions{margin-top:auto;display:flex;flex-wrap:wrap;gap:6px}
.pd-like.active{background:#fee2e2;color:#dc2626;border-color:#fecaca}

/* v1.9 - Course detail view */
.pd-course-head { display:flex; flex-direction:column; gap:6px; margin-bottom:16px; }
.pd-course-head > button { align-self:flex-start; }
.pd-lecture-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(260px,1fr)); gap:16px; }
.pd-lecture-card { background:var(--pd-card,#fff); border:1px solid var(--pd-border,#e5e7eb); border-radius:14px; overflow:hidden; display:flex; flex-direction:column; box-shadow:0 4px 12px rgba(0,0,0,.04); transition:transform .15s ease, box-shadow .15s ease; }
.pd-lecture-card:hover { transform:translateY(-2px); box-shadow:0 10px 24px rgba(0,0,0,.08); }
.pd-lecture-thumb { aspect-ratio:16/9; background:#f1f5f9 center/cover no-repeat; }
.pd-lecture-thumb.empty { background:linear-gradient(135deg,#dbeafe,#eff6ff); }
.pd-lecture-body { padding:12px 14px; display:flex; flex-direction:column; gap:6px; }
.pd-lecture-body h3 { margin:0; font-size:16px; line-height:1.3; }
.pd-lecture-body h3 a { color:inherit; text-decoration:none; }
.pd-lecture-body h3 a:hover { color:var(--pd-accent,#3b82f6); }
.pd-lecture-actions { display:flex; gap:6px; margin-top:8px; flex-wrap:wrap; }
.pd-lecture-actions .pd-btn { padding:6px 10px; font-size:13px; }
.pd-btn.pd-like { color:#dc2626; }
.pd-btn.pd-like.liked { background:#fee2e2; border-color:#fecaca; color:#b91c1c; }

/* ---- Student dashboard v2.3 additions ---- */
.pd-student-root .pd-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 100vh; background: var(--pd-bg, #f3f6fb); color: var(--pd-fg, #1a2236); }
.pd-student-root .pd-sidebar { padding: 24px 16px; border-right: 1px solid var(--pd-border, #e5e7eb); background: var(--pd-card, #fff); position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; gap: 16px; }
.pd-student-root .pd-brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px; }
.pd-student-root .pd-brand-badge { width: 38px; height: 38px; border-radius: 12px; display: grid; place-items: center; font-weight: 700; }
.pd-student-root .pd-brand-title { font-weight: 700; }
.pd-student-root .pd-brand-sub { font-size: 12px; color: var(--pd-muted); }
.pd-student-root .pd-nav { display: flex; flex-direction: column; gap: 4px; }
.pd-student-root .pd-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border-radius: 12px; background: transparent; border: 0; color: var(--pd-fg); cursor: pointer; text-align: left; }
.pd-student-root .pd-nav button:hover { background: rgba(0,0,0,.04); }
.pd-student-root .pd-nav button.active { background: var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1)); color: #fff; box-shadow: 0 10px 25px -12px rgba(59,130,246,.5); }
.pd-student-root .pd-nav button.active svg { stroke: #fff; }
.pd-student-root .pd-user-card { margin-top: auto; display: flex; gap: 10px; align-items: center; padding: 10px; background: rgba(0,0,0,.03); border-radius: 12px; }
.pd-student-root .pd-avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; }
.pd-student-root .pd-avatar-lg { width: 90px; height: 90px; border-radius: 50%; border: 4px solid var(--pd-card,#fff); margin-top: -50px; object-fit: cover; }
.pd-student-root .pd-user-name { font-weight: 600; font-size: 13px; }
.pd-student-root .pd-user-mail { font-size: 11px; color: var(--pd-muted); }
.pd-student-root .pd-main { padding: 24px 32px 80px; min-width: 0; }
.pd-student-root .pd-header { position: sticky; top: 0; z-index: 5; background: var(--pd-bg); display: flex; justify-content: space-between; align-items: center; padding: 8px 0 16px; }
.pd-student-root .pd-header-title h2 { margin: 0; font-size: 20px; }
.pd-student-root .pd-header-title small { color: var(--pd-muted); font-size: 12px; }
.pd-student-root .pd-header-actions { display: flex; gap: 10px; }
.pd-student-root .pd-icon-btn { position: relative; width: 42px; height: 42px; border-radius: 50%; background: var(--pd-card); border: 1px solid var(--pd-border); display: grid; place-items: center; cursor: pointer; }
.pd-student-root .pd-icon-btn .pd-badge { position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; font-size: 10px; border-radius: 999px; padding: 2px 6px; min-width: 18px; text-align: center; }
.pd-student-root .pd-content { display: flex; flex-direction: column; gap: 16px; }
.pd-student-root .pd-card { background: var(--pd-card,#fff); border-radius: 18px; padding: 18px; box-shadow: 0 10px 30px -18px rgba(15,23,42,.15); border: 1px solid var(--pd-border,#eef1f5); }
.pd-student-root .pd-cover-card { position: relative; }
.pd-student-root .pd-profile-row { display: flex; gap: 16px; align-items: flex-end; padding: 0 8px; }
.pd-student-root .pd-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.pd-student-root .pd-stat { background: var(--pd-card); border-radius: 16px; padding: 16px; border: 1px solid var(--pd-border); }
.pd-student-root .pd-stat[data-variant="blue"] { background: var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1)); color: #fff; border: 0; }
.pd-student-root .pd-stat[data-variant="yellow"] { background: linear-gradient(135deg,#f5c542,#f97316); color: #1a2236; border: 0; }
.pd-student-root .pd-stat-value { font-size: 22px; font-weight: 700; }
.pd-student-root .pd-stat-label { font-size: 12px; opacity: .85; }
.pd-student-root .pd-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; }
.pd-student-root .pd-course-card { display: flex; flex-direction: column; text-align: left; background: var(--pd-card); border-radius: 16px; overflow: hidden; border: 1px solid var(--pd-border); cursor: pointer; }
.pd-student-root .pd-course-thumb { height: 100px; }
.pd-student-root .pd-course-body { padding: 12px; }
.pd-student-root .pd-course-body strong { display: block; margin-bottom: 4px; }
.pd-student-root .pd-subtabs { display: flex; gap: 8px; flex-wrap: wrap; background: var(--pd-card); padding: 8px; border-radius: 14px; border: 1px solid var(--pd-border); }
.pd-student-root .pd-subtabs button { padding: 8px 14px; border-radius: 10px; background: transparent; border: 0; cursor: pointer; color: var(--pd-fg); font-weight: 500; }
.pd-student-root .pd-subtabs button.active { background: var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1)); color: #fff; }
.pd-student-root .pd-input { display: block; width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--pd-border); background: var(--pd-card); color: var(--pd-fg); margin: 8px 0; }
.pd-student-root .pd-btn { display: inline-block; padding: 10px 16px; border-radius: 12px; background: var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1)); color: #fff; border: 0; cursor: pointer; font-weight: 600; text-decoration: none; }
.pd-student-root .pd-btn-ghost { background: transparent; color: var(--pd-fg); border: 1px solid var(--pd-border); }
.pd-student-root .pd-table { width: 100%; border-collapse: collapse; }
.pd-student-root .pd-table th, .pd-student-root .pd-table td { padding: 10px; border-bottom: 1px solid var(--pd-border); text-align: left; font-size: 14px; }
.pd-student-root .pd-event-row { display: flex; justify-content: space-between; padding: 10px 0; border-bottom: 1px solid var(--pd-border); }
.pd-student-root .pd-bottom-nav { display: none; }
.pd-student-root .pd-sub { color: var(--pd-muted); font-size: 13px; }

/* Messaging */
.pd-msg-wrap { display: grid; grid-template-columns: 300px 1fr; gap: 12px; min-height: 60vh; }
.pd-msg-list, .pd-msg-thread { background: var(--pd-card,#fff); border: 1px solid var(--pd-border,#eef1f5); border-radius: 16px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.pd-user-row { display: flex; align-items: center; gap: 10px; padding: 8px; border-radius: 10px; border: 0; background: transparent; text-align: left; cursor: pointer; width: 100%; }
.pd-user-row:hover { background: rgba(0,0,0,.04); }
.pd-user-row.unread { background: rgba(59,130,246,.08); }
.pd-msg-head { display: flex; gap: 10px; align-items: center; padding-bottom: 10px; border-bottom: 1px solid var(--pd-border); }
.pd-msg-scroll { flex: 1; overflow-y: auto; max-height: 55vh; padding: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.pd-msg-bubble { max-width: 75%; padding: 10px 14px; border-radius: 16px; background: rgba(0,0,0,.05); }
.pd-msg-bubble.mine { align-self: flex-end; background: var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1)); color: #fff; }
.pd-msg-bubble.mine small { color: rgba(255,255,255,.7) !important; }
.pd-msg-att { display: flex; flex-direction: column; gap: 4px; margin-top: 6px; font-size: 12px; }
.pd-msg-compose { display: grid; grid-template-columns: 1fr auto auto; gap: 8px; align-items: center; }

/* Notifications panel */
.pd-notif-panel { position: fixed; top: 70px; right: 24px; width: 340px; max-height: 70vh; overflow: auto; z-index: 9999; background: var(--pd-card,#fff); border: 1px solid var(--pd-border,#eef1f5); border-radius: 16px; padding: 14px; box-shadow: 0 20px 60px -20px rgba(15,23,42,.35); }
.pd-notif-panel h4 { margin: 0 0 10px; }
.pd-notif { padding: 10px; border-radius: 12px; border: 1px solid var(--pd-border); margin-bottom: 8px; }
.pd-notif.unread { background: rgba(59,130,246,.06); }
.pd-toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%) translateY(20px); background: #1a2236; color: #fff; padding: 10px 18px; border-radius: 999px; opacity: 0; transition: all .25s; z-index: 99999; }
.pd-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

@media (max-width: 900px) {
  .pd-student-root .pd-shell { grid-template-columns: 1fr; }
  .pd-student-root .pd-sidebar { display: none; }
  .pd-student-root .pd-bottom-nav { display: flex; position: fixed; bottom: 12px; left: 50%; transform: translateX(-50%); width: min(94%, 400px); background: #1a2236; color: #fff; border-radius: 999px; padding: 8px; gap: 4px; justify-content: space-between; z-index: 100; }
  .pd-student-root .pd-bottom-nav button { flex: 1; padding: 10px; border: 0; background: transparent; color: rgba(255,255,255,.7); border-radius: 999px; }
  .pd-student-root .pd-bottom-nav button.active { background: #f5c542; color: #1a2236; }
  .pd-student-root .pd-bottom-nav button span { display: none; }
  .pd-student-root .pd-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-msg-wrap { grid-template-columns: 1fr; }
}

/* =========================================================
   Student Dashboard - v2 layout refresh (matches lecturer look)
   ========================================================= */
.pd-root[data-theme="dark"] {
  --pd-bg: #141a2c;
  --pd-fg: #f5f7fb;
  --pd-card: #1f2740;
  --pd-muted: #94a3b8;
  --pd-border: rgba(255,255,255,.08);
}
.pd-student-root { min-height: 720px; overflow: visible; border-radius: 24px; background: var(--pd-bg); }
.pd-student-root .pd-shell { display: grid; grid-template-columns: 260px 1fr; min-height: 720px; align-items: stretch; }
.pd-student-root .pd-sidebar {
  display: flex; flex-direction: column; gap: 18px;
  padding: 22px 16px; border-right: 1px solid var(--pd-border);
  background: color-mix(in oklab, var(--pd-card) 50%, transparent);
}
.pd-student-root .pd-brand { display: flex; gap: 12px; align-items: center; padding: 0 6px 4px; }
.pd-student-root .pd-brand-badge {
  width: 42px; height: 42px; border-radius: 14px;
  display: grid; place-items: center; font-weight: 700;
  background: var(--pd-grad-blue); color: #fff;
  box-shadow: 0 8px 20px -6px rgba(59,130,246,.5);
}
.pd-student-root .pd-brand-title { font-weight: 700; font-size: 14px; color: var(--pd-fg); }
.pd-student-root .pd-brand-sub { font-size: 12px; color: var(--pd-muted); }

.pd-student-root .pd-nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.pd-student-root .pd-nav button {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border: 0; background: transparent; border-radius: 14px;
  color: var(--pd-muted); font-weight: 500; font-size: 14px; cursor: pointer;
  text-align: left; transition: all .18s;
}
.pd-student-root .pd-nav button:hover { background: color-mix(in oklab, var(--pd-fg) 6%, transparent); color: var(--pd-fg); }
.pd-student-root .pd-nav button.active { background: var(--pd-dark); color: var(--pd-dark-fg); box-shadow: var(--pd-shadow); }
.pd-student-root .pd-nav button svg { width: 18px; height: 18px; flex-shrink: 0; }

.pd-student-root .pd-user-card {
  display: flex; gap: 10px; align-items: center;
  background: color-mix(in oklab, var(--pd-fg) 5%, transparent);
  padding: 10px 12px; border-radius: 16px;
}
.pd-student-root .pd-user-name { font-size: 13px; font-weight: 600; color: var(--pd-fg); }
.pd-student-root .pd-user-mail { font-size: 11px; color: var(--pd-muted); }
.pd-student-root .pd-avatar-sm { width: 36px; height: 36px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px color-mix(in oklab, var(--pd-primary) 30%, transparent); }
.pd-student-root .pd-avatar-lg { width: 96px; height: 96px; border-radius: 50%; object-fit: cover; margin-top: -48px; box-shadow: 0 0 0 4px var(--pd-card); }

.pd-student-root .pd-main { display: flex; flex-direction: column; padding: 0; }
.pd-student-root .pd-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 24px 28px 12px;
  background: color-mix(in oklab, var(--pd-bg) 80%, transparent);
  backdrop-filter: blur(8px);
  position: sticky; top: 0; z-index: 5;
}
.pd-student-root .pd-header-title { display: block; }
.pd-student-root .pd-header-title small { display: block; color: var(--pd-muted); font-size: 12px; }
.pd-student-root .pd-header-title h2 { margin: 2px 0 0; font-size: 22px; font-weight: 700; color: var(--pd-fg); }
.pd-student-root .pd-header-actions { display: flex; gap: 10px; align-items: center; }
.pd-student-root .pd-icon-btn {
  position: relative; width: 42px; height: 42px; border-radius: 14px;
  background: var(--pd-card); border: 1px solid var(--pd-border); color: var(--pd-fg);
  cursor: pointer; display: grid; place-items: center; box-shadow: var(--pd-shadow);
}
.pd-student-root .pd-icon-btn:hover { color: var(--pd-primary); }

.pd-student-root .pd-content { padding: 8px 28px 40px; display: flex; flex-direction: column; gap: 18px; }
.pd-student-root .pd-card { background: var(--pd-card); border: 1px solid var(--pd-border); border-radius: 20px; padding: 20px; box-shadow: var(--pd-shadow); color: var(--pd-fg); }
.pd-student-root .pd-card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 700; color: var(--pd-fg); }
.pd-student-root .pd-card h1 { margin: 12px 0 4px; font-size: 22px; font-weight: 700; color: var(--pd-fg); }

.pd-student-root .pd-cover-card { padding: 0; overflow: hidden; }
.pd-student-root .pd-cover-card .pd-cover { height: 160px; border-radius: 0 !important; }
.pd-student-root .pd-profile-row { padding: 0 22px 22px; align-items: flex-end; }

.pd-student-root .pd-stats-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; }
.pd-student-root .pd-stat { display: flex; flex-direction: column; gap: 4px; padding: 18px; border-radius: 18px; background: var(--pd-card); border: 1px solid var(--pd-border); box-shadow: var(--pd-shadow); }
.pd-student-root .pd-stat[data-variant="blue"] { background: var(--pd-grad-blue); color: #fff; border: 0; }
.pd-student-root .pd-stat[data-variant="yellow"] { background: var(--pd-grad-yellow); color: #1f2740; border: 0; }

.pd-student-root .pd-grid-3 { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.pd-student-root .pd-course-card { background: var(--pd-card); border: 1px solid var(--pd-border); border-radius: 18px; overflow: hidden; box-shadow: var(--pd-shadow); text-align: left; padding: 0; cursor: pointer; transition: transform .15s, box-shadow .15s; color: var(--pd-fg); }
.pd-student-root .pd-course-card:hover { transform: translateY(-2px); box-shadow: 0 20px 40px -20px rgba(15,23,42,.3); }
.pd-student-root .pd-course-thumb { height: 96px; }
.pd-student-root .pd-course-body { padding: 14px; }
.pd-student-root .pd-course-body strong { display: block; margin-bottom: 6px; color: var(--pd-fg); }
.pd-student-root .pd-course-body .pd-sub { margin-bottom: 10px; }

.pd-student-root .pd-subtabs { display: flex; gap: 6px; background: var(--pd-card); padding: 6px; border-radius: 14px; overflow-x: auto; border: 1px solid var(--pd-border); }
.pd-student-root .pd-subtabs button { flex: 1; padding: 10px 16px; border-radius: 10px; background: transparent; border: 0; cursor: pointer; color: var(--pd-muted); font-weight: 600; font-size: 13px; white-space: nowrap; }
.pd-student-root .pd-subtabs button.active { background: var(--pd-grad-blue); color: #fff; }

.pd-student-root .pd-input { display: block; width: 100%; padding: 10px 14px; border-radius: 12px; border: 1px solid var(--pd-border); background: var(--pd-bg); color: var(--pd-fg); margin: 6px 0; font-size: 14px; }
.pd-student-root .pd-input:focus { outline: none; border-color: var(--pd-primary); }
.pd-student-root .pd-btn { display: inline-flex; align-items: center; gap: 6px; padding: 10px 18px; border-radius: 12px; background: var(--pd-grad-blue); color: #fff; border: 0; cursor: pointer; font-weight: 600; font-size: 13px; text-decoration: none; }
.pd-student-root .pd-btn:disabled { opacity: .6; cursor: not-allowed; }
.pd-student-root .pd-btn-ghost { background: transparent; color: var(--pd-fg); border: 1px solid var(--pd-border); }
.pd-student-root .pd-badge { position: absolute; top: -4px; right: -4px; background: #ef4444; color: #fff; font-size: 10px; border-radius: 999px; padding: 2px 6px; min-width: 18px; text-align: center; line-height: 1.2; }

.pd-student-root .pd-bottom-nav { display: none; }

@media (max-width: 960px) {
  .pd-student-root .pd-shell { grid-template-columns: 1fr; }
  .pd-student-root .pd-sidebar { display: none; }
  .pd-student-root .pd-content { padding: 8px 16px 100px; }
  .pd-student-root .pd-header { padding: 20px 16px 10px; }
  .pd-student-root .pd-stats-grid { grid-template-columns: repeat(2, 1fr); }
  .pd-student-root .pd-bottom-nav {
    display: flex; position: fixed; bottom: 14px; left: 50%; transform: translateX(-50%);
    width: min(94%, 400px); background: var(--pd-dark); color: var(--pd-dark-fg);
    border-radius: 999px; padding: 8px; gap: 4px; justify-content: space-between;
    z-index: 100; box-shadow: 0 20px 50px -15px rgba(0,0,0,.4);
  }
  .pd-student-root .pd-bottom-nav button {
    flex: 1; width: 44px; height: 44px; border: 0; background: transparent;
    color: rgba(255,255,255,.7); border-radius: 50%; display: grid; place-items: center; cursor: pointer;
  }
  .pd-student-root .pd-bottom-nav button.active { background: var(--pd-secondary); color: #1f2740; }
  .pd-student-root .pd-bottom-nav button span { display: none; }
}

/* =========================================================
   Student Dashboard - dark mode polish + settings controls
   ========================================================= */

/* Match dark variables for both attribute names */
.pd-root[data-mode="dark"],
.pd-root[data-theme="dark"] {
  --pd-bg: #141a2c;
  --pd-fg: #f5f7fb;
  --pd-card: #1f2740;
  --pd-muted: #94a3b8;
  --pd-border: rgba(255,255,255,.08);
  --pd-shadow: 0 10px 30px -18px rgba(0,0,0,.6);
  color-scheme: dark;
}

/* Ensure the student shell repaints on mode change */
.pd-student-root { background: var(--pd-bg); color: var(--pd-fg); transition: background .2s, color .2s; }
.pd-student-root .pd-sidebar { background: color-mix(in oklab, var(--pd-card) 60%, transparent); }
.pd-student-root .pd-header  { background: color-mix(in oklab, var(--pd-bg) 85%, transparent); }
.pd-student-root .pd-card,
.pd-student-root .pd-stat,
.pd-student-root .pd-subtabs,
.pd-student-root .pd-course-card,
.pd-student-root .pd-icon-btn { color: var(--pd-fg); }

/* Fix hardcoded hover / bubble backgrounds so dark stays readable */
.pd-root[data-mode="dark"] .pd-user-row:hover,
.pd-root[data-theme="dark"] .pd-user-row:hover { background: rgba(255,255,255,.06); }
.pd-root[data-mode="dark"] .pd-user-row.unread,
.pd-root[data-theme="dark"] .pd-user-row.unread { background: rgba(99,102,241,.18); }
.pd-root[data-mode="dark"] .pd-msg-bubble,
.pd-root[data-theme="dark"] .pd-msg-bubble { background: rgba(255,255,255,.08); color: var(--pd-fg); }
.pd-root[data-mode="dark"] .pd-notif.unread,
.pd-root[data-theme="dark"] .pd-notif.unread { background: rgba(99,102,241,.18); }
.pd-root[data-mode="dark"] .pd-notif-panel,
.pd-root[data-theme="dark"] .pd-notif-panel { background: var(--pd-card); color: var(--pd-fg); }
.pd-root[data-mode="dark"] .pd-input,
.pd-root[data-theme="dark"] .pd-input,
.pd-root[data-mode="dark"] .pd-textarea,
.pd-root[data-theme="dark"] .pd-textarea,
.pd-root[data-mode="dark"] select.pd-input,
.pd-root[data-theme="dark"] select.pd-input {
  background: rgba(255,255,255,.04);
  color: var(--pd-fg);
  border-color: var(--pd-border);
}
.pd-root[data-mode="dark"] .pd-input::placeholder,
.pd-root[data-theme="dark"] .pd-input::placeholder { color: rgba(255,255,255,.4); }
.pd-root[data-mode="dark"] .pd-table th,
.pd-root[data-theme="dark"] .pd-table th,
.pd-root[data-mode="dark"] .pd-table td,
.pd-root[data-theme="dark"] .pd-table td { color: var(--pd-fg); border-color: var(--pd-border); }

/* Settings - appearance selector */
.pd-student-root .pd-mode-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.pd-student-root .pd-mode-btn {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px; border-radius: 14px; cursor: pointer;
  border: 1px solid var(--pd-border); background: var(--pd-card); color: var(--pd-fg);
  font-weight: 600; font-size: 13px;
}
.pd-student-root .pd-mode-btn.active {
  border-color: transparent; background: var(--pd-grad-blue); color: #fff;
  box-shadow: 0 10px 24px -12px rgba(59,130,246,.6);
}

/* Settings - field labels + toggle rows */
.pd-student-root .pd-field { margin-bottom: 12px; }
.pd-student-root .pd-field label { display: block; font-size: 12px; font-weight: 600; color: var(--pd-muted); margin-bottom: 4px; }
.pd-student-root .pd-toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 4px; border-bottom: 1px solid var(--pd-border);
  font-size: 14px; color: var(--pd-fg);
}
.pd-student-root .pd-toggle-row:last-of-type { border-bottom: 0; }
.pd-student-root .pd-switch { position: relative; display: inline-block; width: 42px; height: 24px; }
.pd-student-root .pd-switch input { opacity: 0; width: 0; height: 0; }
.pd-student-root .pd-switch-slider {
  position: absolute; inset: 0; background: var(--pd-border);
  border-radius: 999px; transition: .2s; cursor: pointer;
}
.pd-student-root .pd-switch-slider::before {
  content: ''; position: absolute; top: 2px; left: 2px; width: 20px; height: 20px;
  background: #fff; border-radius: 50%; transition: .2s;
  box-shadow: 0 2px 6px rgba(0,0,0,.2);
}
.pd-student-root .pd-switch input:checked + .pd-switch-slider { background: var(--pd-primary, #3b82f6); }
.pd-student-root .pd-switch input:checked + .pd-switch-slider::before { transform: translateX(18px); }

/* ---- Student home animated charts ---- */
.pd-student-root .pd-charts-grid { display:grid; grid-template-columns:repeat(2,minmax(0,1fr)); gap:14px; margin-bottom:14px; }
.pd-student-root .pd-charts-grid > .pd-chart-card:first-child { grid-column:1 / -1; }
@media (max-width:820px){ .pd-student-root .pd-charts-grid { grid-template-columns:1fr; } }
.pd-student-root .pd-chart-card h3 { margin:0 0 10px; }
.pd-student-root .pd-chart-wrap { width:100%; height:200px; }
.pd-student-root .pd-chart-svg { width:100%; height:200px; display:block; }
.pd-student-root .pd-chart-grid { stroke:currentColor; opacity:.12; stroke-width:1; }
.pd-student-root .pd-chart-dot { opacity:0; animation: pdstuPop .4s ease-out forwards; }
@keyframes pdstuPop { from { opacity:0; transform:scale(.2); transform-box:fill-box; transform-origin:center; } to { opacity:1; transform:scale(1);} }
.pd-student-root .pd-chart-xaxis { display:flex; justify-content:space-between; font-size:12px; opacity:.65; padding:6px 8px 0; }
.pd-student-root .pd-legend { display:flex; gap:12px; font-size:12px; opacity:.8; }
.pd-student-root .pd-legend-i { display:inline-flex; align-items:center; gap:6px; }
.pd-student-root .pd-legend-i i { width:10px; height:10px; border-radius:3px; display:inline-block; }
.pd-student-root .pd-bar-row { display:flex; align-items:center; gap:10px; margin:8px 0; font-size:13px; }
.pd-student-root .pd-bar-label { width:96px; flex:none; opacity:.8; text-transform:capitalize; }
.pd-student-root .pd-bar-track { flex:1; height:10px; border-radius:999px; background:currentColor; opacity:1; position:relative; }
.pd-student-root .pd-bar-track { background:rgba(127,127,127,.18); }
.pd-student-root .pd-bar-fill { height:100%; border-radius:999px; background:var(--pd-grad-blue,linear-gradient(135deg,#3b82f6,#6366f1)); transition:width 1s cubic-bezier(.22,.9,.28,1); }
.pd-student-root .pd-bar-val { width:26px; text-align:right; opacity:.7; }
.pd-student-root .pd-donut { position:relative; display:grid; place-items:center; }
.pd-student-root .pd-donut-svg { width:150px; height:150px; }
.pd-student-root .pd-donut-track { opacity:.15; }
.pd-student-root .pd-donut-val { position:absolute; font-size:26px; font-weight:700; }
.pd-student-root .pd-streak { display:flex; align-items:center; gap:16px; }
.pd-student-root .pd-streak-num .pd-stat-value { font-size:34px; font-weight:800; line-height:1; }
.pd-student-root .pd-streak-bar { flex:1; }
.pd-student-root .pd-streak-bar .pd-task-meta { margin-bottom:8px; }
.pd-student-root .pd-quick-row { margin-bottom:14px; }
.pd-student-root .pd-quick-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(140px,1fr)); gap:10px; }
.pd-student-root .pd-quick { padding:12px; border-radius:14px; border:1px solid var(--pd-border,rgba(127,127,127,.25)); background:transparent; color:inherit; font-weight:600; cursor:pointer; transition:transform .18s, box-shadow .18s, background .18s; }
.pd-student-root .pd-quick:hover { transform:translateY(-2px); background:rgba(59,130,246,.10); box-shadow:0 8px 20px -12px rgba(0,0,0,.5); }

/* ---- Coursework (assignments, quizzes, grades) ---- */
.pd-student-root .pd-card-head { display:flex; align-items:center; justify-content:space-between; gap:10px; margin-bottom:6px; }
.pd-student-root .pd-chip-done { background:rgba(34,197,94,.15); color:#15803d; font-weight:700; font-size:11px; padding:3px 10px; border-radius:999px; }
.pd-student-root .pd-chip-todo { background:rgba(245,183,1,.18); color:#a16207; font-weight:700; font-size:11px; padding:3px 10px; border-radius:999px; }
.pd-student-root .pd-quiz-result { margin-top:12px; display:flex; flex-direction:column; gap:4px; }
.pd-student-root .pd-quiz-timer { font-variant-numeric:tabular-nums; font-weight:600; color:var(--pd-fg); margin-top:12px; }
.pd-student-root .pd-quiz-timer.is-urgent { color:#dc2626; }
.pd-student-root .pd-radio { display:flex; align-items:flex-start; gap:8px; padding:6px 0; font-size:14px; cursor:pointer; }
.pd-student-root .pd-radio input { margin-top:3px; }
.pd-student-root .pd-field .pd-label { font-weight:600; color:var(--pd-fg); margin-bottom:6px; }
.pd-student-root .pd-course-thumb img { width:100%; height:100%; object-fit:cover; display:block; }
.pd-student-root .pd-grade-summary { display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; }
.pd-student-root .pd-btn[disabled] { opacity:.6; cursor:not-allowed; }

/* ---- Instructor LMS (courses, assignments, quizzes, grading) ---- */
.pd-lms { display:flex; flex-direction:column; gap:16px; }
.pd-course-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(240px,1fr)); gap:12px; }
.pd-course-card { text-align:left; padding:0; overflow:hidden; border-radius:16px; border:1px solid var(--pd-border); background:var(--pd-card); box-shadow:var(--pd-shadow); cursor:pointer; color:inherit; font:inherit; display:flex; flex-direction:column; transition:transform .18s, box-shadow .18s; }
.pd-course-card:hover { transform:translateY(-2px); box-shadow:0 12px 26px -18px rgba(0,0,0,.55); }
.pd-course-card:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-course-cover { width:100%; height:120px; object-fit:cover; display:block; background:var(--pd-bg); }
.pd-course-cover.is-blank { display:grid; place-items:center; color:var(--pd-muted); }
.pd-course-cover.is-blank svg { width:32px; height:32px; }
.pd-course-body { padding:12px 14px 14px; display:flex; flex-direction:column; gap:4px; }
.pd-course-body strong { font-size:15px; color:var(--pd-fg); }
.pd-subnav { display:flex; gap:6px; flex-wrap:wrap; }
.pd-subnav button { background:var(--pd-card); color:var(--pd-fg); border:1px solid var(--pd-border); border-radius:999px; padding:6px 14px; font-size:12px; font-weight:600; cursor:pointer; text-transform:capitalize; }
.pd-subnav button.active { background:var(--pd-primary); border-color:var(--pd-primary); color:#fff; }
.pd-lms-body { display:flex; flex-direction:column; gap:16px; }
.pd-lms .pd-field { display:flex; flex-direction:column; gap:6px; margin-bottom:12px; }
.pd-lms .pd-field > .pd-sub { font-weight:600; color:var(--pd-fg); }
.pd-sub-list { display:flex; flex-direction:column; gap:8px; margin-top:12px; }
.pd-sub-row { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:10px 12px; border:1px solid var(--pd-border); border-radius:12px; background:var(--pd-card); }
.pd-sub-row .pd-member-body { flex:1; min-width:180px; }
.pd-stat-grid { display:grid; grid-template-columns:repeat(auto-fit,minmax(150px,1fr)); gap:12px; }
.pd-stat-grid .pd-stat { box-shadow:var(--pd-shadow); }

/* ---- Curriculum builder ---- */
.pd-list { display:flex; flex-direction:column; gap:8px; }
.pd-list-row { display:flex; align-items:center; justify-content:space-between; gap:12px; width:100%; text-align:left; padding:10px 14px; border:1px solid var(--pd-border); border-radius:12px; background:var(--pd-card); color:var(--pd-fg); font:inherit; cursor:pointer; transition:border-color .18s, background .18s; }
button.pd-list-row:hover { border-color:var(--pd-primary); }
.pd-list-row:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-list-row strong { display:block; font-size:13.5px; }
.pd-btn-row { display:flex; flex-wrap:wrap; gap:8px; }
.pd-notice { border-left:3px solid var(--pd-primary); }
.pd-builder { display:flex; flex-direction:column; gap:12px; }
.pd-builder-section { border:1px solid var(--pd-border); border-radius:14px; background:var(--pd-card); padding:12px; display:flex; flex-direction:column; gap:8px; }
.pd-builder-section-head { display:flex; gap:8px; align-items:center; flex-wrap:wrap; }
.pd-builder-section-head .pd-input { flex:1; min-width:180px; font-weight:600; }
.pd-builder-item { display:flex; align-items:center; gap:10px; flex-wrap:wrap; padding:8px 10px; border:1px solid var(--pd-border); border-radius:12px; background:var(--pd-bg); cursor:grab; }
.pd-builder-item.is-dragging { opacity:.45; }
.pd-builder-item.is-drop-target { border-color:var(--pd-primary); box-shadow:0 0 0 2px color-mix(in oklab, var(--pd-primary) 30%, transparent); }
.pd-builder-grip { display:grid; place-items:center; color:var(--pd-muted); }
.pd-builder-grip svg { width:16px; height:16px; }
.pd-builder-item-main { flex:1; min-width:150px; }
.pd-builder-item-nav { display:flex; gap:4px; align-items:center; flex-wrap:wrap; }
.pd-builder-section-nav { display:flex; gap:4px; align-items:center; }

/* Section drag lives on the grip, so the title stays a normal text input and
   dragging never fights with selecting text inside it. */
.pd-builder-section-head .pd-builder-grip { cursor:grab; }
.pd-builder-section-head .pd-builder-section-title { flex:1; min-width:180px; font-weight:600; }
.pd-builder-section-head .pd-builder-grip:active { cursor:grabbing; }
.pd-builder-section-head.is-drop-target { border-radius:10px; box-shadow:0 0 0 2px color-mix(in oklab, var(--pd-primary) 30%, transparent); }

/* Section thumbnail in the builder. Sits after the section title; the title
   flexes to fill, so the thumbnail is pinned to the right of it. */
.pd-sec-thumb-wrap { display:flex; align-items:center; gap:4px; flex:0 0 auto; }
.pd-sec-thumb-clear { flex:0 0 auto; color:var(--pd-muted); }
.pd-sec-thumb-clear:hover { color:#dc2626; }
.pd-sec-thumb {
  width:54px; height:40px; flex:0 0 54px; border-radius:10px;
  border:1.5px dashed var(--pd-border); background-color:var(--pd-bg);
  background-size:cover; background-position:center; cursor:pointer; padding:0;
  display:grid; place-items:center; overflow:hidden; position:relative;
}
.pd-sec-thumb:hover { border-color:var(--pd-primary); }
.pd-sec-thumb:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-sec-thumb.has-image { border-style:solid; }
.pd-sec-thumb-label {
  font-size:10px; font-weight:700; color:var(--pd-muted); padding:2px 4px;
  background:color-mix(in oklab, var(--pd-card) 78%, transparent); border-radius:6px;
}
.pd-sec-thumb.has-image .pd-sec-thumb-label { opacity:0; transition:opacity .15s ease; }
.pd-sec-thumb:hover .pd-sec-thumb-label,
.pd-sec-thumb:focus-visible .pd-sec-thumb-label { opacity:1; }

/* Format shortcuts. A wrapping row of chips reads faster than a select when
   there are only five of them, and shows the label without a click. */
.pd-builder-formats { display:flex; gap:6px; align-items:center; flex-wrap:wrap; padding-top:8px; margin-top:2px; border-top:1px dashed var(--pd-border); }
.pd-btn-sm { padding:5px 11px; font-size:12px; border-radius:9px; }
.pd-builder-orphans { border-style:dashed; }

/* Reorder buttons next to the drag handle. The disabled state matters: the
   first and last lesson in the flat order have nowhere to go. */
.pd-builder-item-nav .pd-icon-btn { display:grid; place-items:center; }
.pd-builder-item-nav .pd-icon-btn svg { width:16px; height:16px; display:block; }
.pd-builder-item-nav .pd-icon-btn[disabled] { opacity:.3; cursor:default; }
.pd-builder-item-nav .pd-icon-btn[disabled]:hover { background:transparent; color:var(--pd-muted); }

/* Lesson editor */
.pd-lesson-editor { display:flex; flex-direction:column; gap:12px; }
.pd-lesson-editor .pd-block-list { display:flex; flex-direction:column; gap:10px; min-height:60px; }

/* Course featured image picker. The preview is the <button> that opens the file
   dialog, so it carries the reset that keeps the UA button styling out. */
.pd-cover-row { position:relative; }
.pd-cover-pick {
  display:grid; place-items:center; width:100%; min-height:132px; border-radius:14px;
  border:1.5px dashed var(--pd-border); background-color:var(--pd-bg);
  background-size:cover; background-position:center; color:var(--pd-muted); font-size:13px;
  font-family:inherit; cursor:pointer; padding:0;
}
.pd-cover-pick:hover { border-color:var(--pd-primary); color:var(--pd-fg); }
.pd-cover-pick:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-cover-pick.has-image { border-style:solid; }
.pd-cover-pick-label { background:color-mix(in oklab, var(--pd-card) 82%, transparent); padding:6px 12px; border-radius:999px; font-weight:600; }
.pd-cover-pick.has-image .pd-cover-pick-label { opacity:0; transition:opacity .15s ease; }
.pd-cover-pick:hover .pd-cover-pick-label,
.pd-cover-pick:focus-visible .pd-cover-pick-label { opacity:1; }

/* Google Drive embed rendered from a lesson block */
.pd-gdrive iframe { border-radius:12px; }

.pd-select-sm { padding:5px 8px; font-size:12px; border-radius:9px; min-width:110px; }
.pd-table-wrap { overflow-x:auto; margin-top:12px; }
.pd-table { width:100%; border-collapse:collapse; font-size:13px; }
.pd-table th, .pd-table td { padding:9px 10px; border-bottom:1px solid var(--pd-border); text-align:left; white-space:nowrap; }
.pd-table th { font-size:11px; text-transform:uppercase; letter-spacing:.04em; color:var(--pd-muted); }
.pd-table td.is-pending { color:#b45309; font-style:italic; }
.pd-check-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:6px; }
.pd-check { display:flex; align-items:center; gap:6px; font-size:13px; }
.pd-quiz-edit { display:flex; flex-direction:column; gap:12px; }
.pd-quiz-q-edit { margin:0; }
.pd-quiz-opts-edit { display:flex; flex-direction:column; gap:6px; }
.pd-quiz-opt-row { display:flex; align-items:center; gap:6px; }
.pd-quiz-opt-row .pd-input { flex:1; }
.pd-grade-head { margin-bottom:10px; }
.pd-answer { white-space:pre-wrap; font-size:14px; line-height:1.55; margin-bottom:12px; }
.pd-root[data-mode="dark"] .pd-btn.ghost, .pd-root[data-theme="dark"] .pd-btn.ghost { color:var(--pd-fg); }

/* ==========================================================================
   COURSE PLAYER
   Overview (section thumbnails) -> section (items) -> lesson (content).
   Unscoped because the player renders inside the student shell, which reuses
   the same tokens.
   ========================================================================== */

/* ---- top bar: back button + breadcrumb, present at every level ---- */
.pd-player-bar {
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:10px 12px; margin-bottom:4px;
  background:var(--pd-card); border:1px solid var(--pd-border);
  border-radius:16px; box-shadow:var(--pd-shadow);
  position:sticky; top:0; z-index:20;
  animation:pd-slide-down .22s ease both;
}
@keyframes pd-slide-down { from { opacity:0; transform:translateY(-8px); } to { opacity:1; transform:none; } }

.pd-back-btn {
  display:inline-flex; align-items:center; gap:7px;
  background:var(--pd-bg); border:1px solid var(--pd-border); color:var(--pd-fg);
  padding:7px 13px 7px 9px; border-radius:999px; cursor:pointer;
  font-size:13px; font-weight:600; font-family:inherit;
  transition:transform .15s ease, border-color .15s ease, box-shadow .15s ease;
}
.pd-back-btn:hover { border-color:var(--pd-primary); transform:translateX(-2px); box-shadow:0 4px 14px -6px rgba(60,80,140,.5); }
.pd-back-btn:active { transform:translateX(0); }
.pd-back-btn:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-back-btn-icon { display:grid; place-items:center; width:16px; height:16px; }
.pd-back-btn-icon svg { width:16px; height:16px; }

.pd-crumb { display:flex; flex-direction:column; min-width:0; flex:1; line-height:1.3; }
.pd-crumb strong { font-size:14px; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pd-crumb-sub { font-size:12px; color:var(--pd-muted); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.pd-crumb-course { font-size:11px; font-weight:700; text-transform:uppercase; letter-spacing:.05em; color:var(--pd-muted); }

/* ---- overview ---- */
.pd-player-intro { margin-bottom:4px; animation:pd-fade-up .25s ease both; }
.pd-player-intro h3 { margin:0 0 4px; font-size:20px; }
.pd-player-progress { display:flex; align-items:center; gap:10px; margin-top:10px; max-width:320px; }
.pd-player-progress .pd-progress-bar { flex:1; }

.pd-sec-grid { display:grid; gap:16px; grid-template-columns:repeat(auto-fill, minmax(230px, 1fr)); }

.pd-sec-card {
  text-align:left; padding:0; overflow:hidden; cursor:pointer; font-family:inherit;
  background:var(--pd-card); color:var(--pd-fg);
  border:1px solid var(--pd-border); border-radius:18px;
  box-shadow:var(--pd-shadow);
  transition:transform .2s cubic-bezier(.2,.7,.3,1), box-shadow .2s ease, border-color .2s ease;
  animation:pd-fade-up .28s ease both;
}
.pd-sec-card:hover { transform:translateY(-3px); border-color:var(--pd-primary); box-shadow:0 16px 36px -16px rgba(60,80,140,.55); }
.pd-sec-card:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-sec-card:nth-child(2) { animation-delay:.04s; }
.pd-sec-card:nth-child(3) { animation-delay:.08s; }
.pd-sec-card:nth-child(4) { animation-delay:.12s; }
.pd-sec-card:nth-child(5) { animation-delay:.16s; }
.pd-sec-card:nth-child(6) { animation-delay:.2s; }

.pd-sec-card-cover {
  aspect-ratio:16/9; display:grid; place-items:center; overflow:hidden;
  background:var(--pd-grad-blue, linear-gradient(135deg,#3b82f6,#6366f1));
}
.pd-sec-card-cover img { width:100%; height:100%; object-fit:cover; display:block; transition:transform .35s ease; }
.pd-sec-card:hover .pd-sec-card-cover img { transform:scale(1.045); }
.pd-sec-card-fallback { color:rgba(255,255,255,.9); display:grid; place-items:center; }
.pd-sec-card-fallback svg { width:30px; height:30px; }

.pd-sec-card-body { display:flex; flex-direction:column; gap:3px; padding:13px 15px 15px; }
.pd-sec-card-index { font-size:10.5px; font-weight:800; text-transform:uppercase; letter-spacing:.07em; color:var(--pd-primary); }
.pd-sec-card-body strong { font-size:15px; line-height:1.3; }

/* ---- section hero ---- */
.pd-sec-hero { border-radius:18px; overflow:hidden; margin-bottom:4px; box-shadow:var(--pd-shadow); animation:pd-fade-up .25s ease both; }
.pd-sec-hero img { display:block; width:100%; max-height:230px; object-fit:cover; }

/* ---- two-column body: rail + content ---- */
.pd-player-layout { display:grid; gap:18px; grid-template-columns:216px minmax(0, 1fr); align-items:start; }
.pd-player-main { min-width:0; display:flex; flex-direction:column; gap:14px; animation:pd-fade-up .25s ease both; }

/* ---- section rail ---- */
.pd-sec-rail {
  display:flex; flex-direction:column; gap:7px;
  position:sticky; top:78px;
  max-height:calc(100vh - 100px); overflow-y:auto;
  padding-right:4px; scrollbar-width:thin;
}
.pd-sec-rail-item {
  display:flex; align-items:center; gap:9px; text-align:left; cursor:pointer;
  padding:7px 9px; border-radius:12px; font-family:inherit;
  background:transparent; border:1px solid transparent; color:var(--pd-fg);
  transition:background .15s ease, border-color .15s ease, transform .15s ease;
}
.pd-sec-rail-item:hover { background:var(--pd-card); border-color:var(--pd-border); transform:translateX(2px); }
.pd-sec-rail-item.is-active {
  background:var(--pd-card); border-color:var(--pd-primary);
  box-shadow:inset 3px 0 0 var(--pd-primary);
}
.pd-sec-rail-item:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-sec-rail-thumb {
  width:40px; height:32px; flex:0 0 40px; border-radius:9px; overflow:hidden;
  display:grid; place-items:center; background:var(--pd-bg); border:1px solid var(--pd-border);
}
.pd-sec-rail-thumb img { width:100%; height:100%; object-fit:cover; }
.pd-sec-rail-label { display:flex; flex-direction:column; min-width:0; line-height:1.25; }
.pd-sec-rail-label small { font-size:10px; font-weight:800; text-transform:uppercase; letter-spacing:.06em; color:var(--pd-muted); }
.pd-sec-rail-label span { font-size:12.5px; font-weight:600; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---- item rows inside a section ---- */
.pd-item-list { display:flex; flex-direction:column; gap:8px; }
.pd-item-row {
  display:flex; align-items:center; gap:13px; text-align:left; cursor:pointer;
  padding:11px 13px; border-radius:14px; font-family:inherit;
  background:var(--pd-card); color:var(--pd-fg);
  border:1px solid var(--pd-border); box-shadow:var(--pd-shadow);
  transition:transform .16s ease, border-color .16s ease, box-shadow .16s ease;
}
.pd-item-row:hover { transform:translateX(3px); border-color:var(--pd-primary); box-shadow:0 10px 26px -14px rgba(60,80,140,.55); }
.pd-item-row:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-item-row:hover .pd-item-go { opacity:1; transform:translateX(0); }

.pd-item-thumb {
  width:52px; height:40px; flex:0 0 52px; border-radius:11px; overflow:hidden; position:relative;
  display:grid; place-items:center; background:var(--pd-bg); border:1px solid var(--pd-border); color:var(--pd-muted);
}
.pd-item-thumb img { position:absolute; inset:0; width:100%; height:100%; object-fit:cover; }
.pd-item-thumb svg { width:18px; height:18px; }
.pd-item-thumb.is-lg { width:62px; height:62px; flex:0 0 62px; border-radius:14px; }
.pd-item-thumb.is-lg svg { width:24px; height:24px; }

.pd-item-main { flex:1; min-width:0; display:flex; flex-direction:column; gap:1px; }
.pd-item-index { font-size:10px; font-weight:800; letter-spacing:.06em; color:var(--pd-muted); }
.pd-item-main strong { font-size:14px; line-height:1.35; }

.pd-item-go { display:grid; place-items:center; width:16px; height:16px; color:var(--pd-muted); opacity:.5; transform:translateX(-3px); transition:opacity .16s ease, transform .16s ease; }
.pd-item-go svg { width:16px; height:16px; }
.pd-item-go.is-forward { transform:rotate(180deg); }
.pd-item-row:hover .pd-item-go.is-forward { transform:rotate(180deg); }

/* ---- lesson ---- */
.pd-lesson { background:var(--pd-card); border:1px solid var(--pd-border); border-radius:18px; box-shadow:var(--pd-shadow); overflow:hidden; }
.pd-lesson-head { display:flex; align-items:center; gap:14px; padding:16px 18px; border-bottom:1px solid var(--pd-border); }
.pd-lesson-head h3 { margin:0; font-size:18px; line-height:1.3; }
.pd-lesson-head p { margin:2px 0 0; }
.pd-lesson-hero { max-height:280px; overflow:hidden; }
.pd-lesson-hero img { display:block; width:100%; object-fit:cover; }
.pd-lesson-body { padding:18px; }

/* Lectures tab: filters, pager and the single-lecture reader. */
.pd-le-toolbar { display:flex; flex-wrap:wrap; gap:10px; margin-bottom:14px; align-items:center; }
.pd-le-toolbar .pd-input { flex:1 1 220px; min-width:0; }
.pd-le-pager { display:flex; align-items:center; justify-content:center; gap:14px; margin-top:18px; flex-wrap:wrap; }
.pd-le-reader-bar { margin-bottom:12px; }
.pd-le-reader-title { margin:12px 0; line-height:1.25; }

@media (max-width:640px) {
 .pd-le-toolbar .pd-input { flex:1 1 100%; }
 .pd-le-toolbar select { flex:1 1 100%; }
}

/* Rendered lecture HTML arrives unstyled from the block renderer. */
.pd-rich { line-height:1.7; font-size:15px; }
.pd-rich > *:first-child { margin-top:0; }
.pd-rich > *:last-child { margin-bottom:0; }
.pd-rich h1, .pd-rich h2, .pd-rich h3, .pd-rich h4 { margin:1.5em 0 .5em; line-height:1.3; }
.pd-rich h1 { font-size:23px; } .pd-rich h2 { font-size:20px; }
.pd-rich h3 { font-size:17px; } .pd-rich h4 { font-size:15px; }
.pd-rich p, .pd-rich ul, .pd-rich ol, .pd-rich blockquote { margin:0 0 1em; }
.pd-rich ul, .pd-rich ol { padding-left:1.4em; }
.pd-rich li { margin-bottom:.35em; }
.pd-rich img, .pd-rich video, .pd-rich iframe { max-width:100%; height:auto; border-radius:12px; }
.pd-rich iframe { width:100%; aspect-ratio:16/9; border:0; }
.pd-rich audio { width:100%; }
.pd-rich blockquote { border-left:3px solid var(--pd-primary); padding-left:14px; color:var(--pd-muted); }
.pd-rich pre { overflow-x:auto; background:var(--pd-bg); padding:13px; border-radius:12px; border:1px solid var(--pd-border); }
.pd-rich code { background:var(--pd-bg); padding:.15em .4em; border-radius:6px; font-size:.9em; }
.pd-rich pre code { background:none; padding:0; }
.pd-rich table { width:100%; border-collapse:collapse; font-size:14px; }
.pd-rich th, .pd-rich td { padding:9px 10px; border:1px solid var(--pd-border); text-align:left; }
.pd-rich hr { border:0; border-top:1px solid var(--pd-border); margin:2em 0; }
.pd-rich a { color:var(--pd-primary); }

/* ---- prev/next ---- */
.pd-lesson-pager { display:flex; align-items:center; justify-content:space-between; gap:10px; flex-wrap:wrap; }
.pd-pager-btn { display:inline-flex; align-items:center; gap:8px; max-width:48%; text-align:left; }
.pd-pager-btn svg { width:16px; height:16px; flex:0 0 16px; }
.pd-pager-btn.is-next { text-align:right; }
.pd-pager-btn.is-next svg { transform:rotate(180deg); }
.pd-pager-btn span { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

/* ---- course discussion ---- */
.pd-disc { display:flex; flex-direction:column; gap:14px; }

/* Entry point on the course overview */
.pd-disc-launch {
  display:flex; align-items:center; gap:13px; width:100%; text-align:left; cursor:pointer;
  padding:14px 16px; border-radius:16px; font-family:inherit; color:var(--pd-fg);
  background:var(--pd-card); border:1px solid var(--pd-border); box-shadow:var(--pd-shadow);
  transition:transform .16s ease, border-color .16s ease;
}
.pd-disc-launch:hover { transform:translateY(-2px); border-color:var(--pd-primary); }
.pd-disc-launch:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-disc-launch-icon {
  display:grid; place-items:center; width:38px; height:38px; flex:0 0 38px; border-radius:12px;
  background:var(--pd-grad-blue); color:#fff;
}
.pd-disc-launch-icon svg { width:19px; height:19px; }
.pd-disc-launch-text { display:flex; flex-direction:column; gap:2px; min-width:0; }
.pd-disc-launch-text strong { font-size:14.5px; }
.pd-disc-launch-text .pd-sub { margin:0; }

/* Composer */
.pd-disc-composer {
  display:flex; flex-direction:column; gap:9px; padding:14px;
  background:var(--pd-card); border:1px solid var(--pd-border); border-radius:16px; box-shadow:var(--pd-shadow);
}
.pd-disc-composer.is-reply { margin-top:10px; border-left:3px solid var(--pd-primary); background:var(--pd-bg); }
.pd-disc-input { min-height:78px; width:100%; }
.pd-disc-tools { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }
.pd-disc-tools .pd-sub { margin:0; }
.pd-disc-clip { display:grid; place-items:center; }
.pd-disc-clip svg { width:15px; height:15px; }
.pd-disc-send { display:flex; justify-content:flex-end; }

/* Selected-file chips */
.pd-disc-chips { display:flex; flex-wrap:wrap; gap:6px; }
.pd-disc-chips:empty { display:none; }
.pd-disc-chip {
  display:inline-flex; align-items:center; gap:6px; max-width:100%; cursor:pointer;
  padding:4px 8px 4px 10px; border-radius:999px; font-family:inherit; font-size:12px;
  background:var(--pd-bg); border:1px solid var(--pd-border); color:var(--pd-fg);
}
.pd-disc-chip:hover { border-color:#ef4444; color:#ef4444; }
.pd-disc-chip svg { width:12px; height:12px; flex:0 0 12px; }
.pd-disc-chip-name { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; max-width:210px; }

/* Thread */
.pd-disc-list { display:flex; flex-direction:column; gap:12px; }
.pd-disc-post {
  padding:14px; border-radius:16px;
  background:var(--pd-card); border:1px solid var(--pd-border); box-shadow:var(--pd-shadow);
}
.pd-disc-post.is-pinned { border-color:var(--pd-primary); box-shadow:inset 3px 0 0 var(--pd-primary), var(--pd-shadow); }

.pd-disc-head { display:flex; align-items:center; gap:10px; margin-bottom:9px; }
.pd-disc-avatar { width:36px; height:36px; flex:0 0 36px; border-radius:999px; background:var(--pd-bg); }
.pd-disc-who { display:flex; flex-direction:column; gap:1px; min-width:0; }
.pd-disc-name { display:flex; align-items:center; gap:6px; flex-wrap:wrap; font-size:13.5px; font-weight:600; }
.pd-disc-when { font-size:11.5px; color:var(--pd-muted); }
.pd-disc-tutor { background:rgba(59,130,246,.15); color:var(--pd-accent); }
.pd-disc-mine { background:rgba(100,116,139,.15); color:#64748b; }

.pd-disc-body { font-size:14px; overflow-wrap:anywhere; }
.pd-disc-body p { margin:0 0 .6em; }
.pd-disc-body p:last-child { margin-bottom:0; }
.pd-disc-removed { margin:0; font-size:13px; font-style:italic; color:var(--pd-muted); }

/* Attachments */
.pd-disc-atts { display:flex; flex-wrap:wrap; gap:8px; margin-top:11px; }
.pd-disc-atts:empty { display:none; }
.pd-disc-att { border-radius:12px; border:1px solid var(--pd-border); overflow:hidden; }
.pd-disc-att.is-image { display:block; line-height:0; }
.pd-disc-att.is-image img { display:block; max-width:190px; max-height:150px; width:auto; height:auto; object-fit:cover; }
.pd-disc-att.is-media { width:100%; }
.pd-disc-att.is-media video { display:block; width:100%; max-height:340px; background:#000; }
.pd-disc-att.is-media audio { display:block; width:100%; }
.pd-disc-att.is-file {
  display:inline-flex; align-items:center; gap:9px; max-width:100%;
  padding:9px 12px; font-size:12.5px; color:var(--pd-fg); text-decoration:none; background:var(--pd-bg);
}
.pd-disc-att.is-file:hover { border-color:var(--pd-primary); }
.pd-disc-att-label { overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.pd-disc-att-icon { display:grid; place-items:center; flex:0 0 auto; color:var(--pd-muted); }
.pd-disc-att-icon svg { width:17px; height:17px; }

/* Per-post actions */
.pd-disc-actions { display:flex; align-items:center; gap:4px; flex-wrap:wrap; margin-top:11px; }
.pd-disc-act {
  display:inline-flex; align-items:center; gap:5px; cursor:pointer; font-family:inherit;
  padding:5px 9px; border-radius:9px; font-size:12px; font-weight:600;
  background:transparent; border:1px solid transparent; color:var(--pd-muted);
}
.pd-disc-act:hover { background:var(--pd-bg); border-color:var(--pd-border); color:var(--pd-fg); }
.pd-disc-act:focus-visible { outline:2px solid var(--pd-primary); outline-offset:2px; }
.pd-disc-act svg { width:14px; height:14px; }
.pd-disc-act.is-danger:hover { border-color:#ef4444; color:#ef4444; }

/* Replies nest once, visually indented */
.pd-disc-replies { display:flex; flex-direction:column; gap:9px; margin-top:11px; padding-left:13px; border-left:2px solid var(--pd-border); }
.pd-disc-replies .pd-disc-post { background:var(--pd-bg); box-shadow:none; padding:12px; }

.pd-disc-count { margin:0; text-align:center; }
.pd-disc-pager { display:flex; align-items:center; justify-content:center; gap:9px; }
.pd-disc-pager svg { width:14px; height:14px; }
.pd-disc-pager .pd-btn:first-child svg { transform:rotate(90deg); }

/* ---- persistent course picker (Lectures tab) ---- */
/* Sticks to the top so a student deep inside a lesson can still switch course. */
.pd-course-picker {
  position:sticky; top:0; z-index:5;
  display:flex; align-items:center; gap:12px; flex-wrap:wrap;
  padding:12px 16px; margin-bottom:14px;
}
.pd-course-picker label { font-size:12px; font-weight:700; text-transform:uppercase; letter-spacing:.06em; color:var(--pd-muted); flex:0 0 auto; }
.pd-course-picker select { flex:1 1 240px; min-width:0; max-width:520px; }

@media (max-width: 560px) {
  .pd-course-picker { flex-direction:column; align-items:stretch; gap:6px; }
  .pd-course-picker select { max-width:none; }
}

@keyframes pd-fade-up { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:none; } }

/* ---- narrow screens: rail becomes a horizontal scroller ---- */
@media (max-width: 900px) {
  .pd-player-layout { grid-template-columns:1fr; }
  .pd-sec-rail {
    flex-direction:row; position:static; max-height:none; overflow-x:auto;
    padding-bottom:6px; gap:8px; scroll-snap-type:x proximity;
  }
  .pd-sec-rail-item { flex:0 0 auto; scroll-snap-align:start; }
  .pd-sec-rail-label span { max-width:120px; }
  .pd-sec-rail-item.is-active { box-shadow:inset 0 -3px 0 var(--pd-primary); }
}
@media (max-width: 560px) {
  .pd-crumb-course { display:none; }
  .pd-sec-grid { grid-template-columns:1fr; }
  .pd-lesson-head { flex-direction:column; align-items:flex-start; gap:11px; }
  .pd-pager-btn { max-width:100%; }
  .pd-disc-replies { padding-left:9px; }
  .pd-disc-chip-name { max-width:130px; }
  .pd-disc-send .pd-btn { width:100%; justify-content:center; }
}

@media (prefers-reduced-motion: reduce) {
  .pd-player-bar, .pd-player-intro, .pd-sec-card, .pd-sec-hero, .pd-player-main { animation:none; }
  .pd-sec-card:hover, .pd-item-row:hover, .pd-back-btn:hover { transform:none; }
}

/* ==========================================================================
   Certificates
   Front-end styles for the [pd_verification_form] and [pd_my_certificates]
   shortcodes, so they sit correctly in a theme that never loads the dashboard
   bundle.
   ========================================================================== */
.pd-cert-verify { max-width:640px; }
.pd-cert-verify-form { display:flex; flex-wrap:wrap; gap:9px; align-items:flex-end; margin-bottom:16px; }
.pd-cert-verify-form label { display:block; width:100%; font-weight:600; margin-bottom:4px; }
.pd-cert-verify-form input {
  flex:1 1 200px; min-width:0; padding:9px 11px;
  border:1px solid var(--pd-border,#d8dde5); border-radius:8px;
  font-family:inherit; font-size:14px; letter-spacing:.06em; text-transform:uppercase;
}
.pd-cert-card { border:1px solid var(--pd-border,#d8dde5); border-radius:12px; padding:18px; background:var(--pd-card,#fff); }
.pd-cert-card.is-revoked { border-color:#c0392b; }
.pd-cert-verdict { margin:0 0 12px; font-weight:700; color:#1e7d46; }
.pd-cert-card.is-revoked .pd-cert-verdict { color:#c0392b; }
.pd-cert-invalid { color:#c0392b; font-weight:600; }
.pd-cert-card dl { display:grid; grid-template-columns:auto 1fr; gap:6px 14px; margin:0; }
.pd-cert-card dt { font-weight:600; color:var(--pd-muted,#667085); }
.pd-cert-card dd { margin:0; }
.pd-cert-list { display:grid; gap:10px; }
.pd-cert-item { border:1px solid var(--pd-border,#d8dde5); border-radius:10px; padding:13px 15px; }
.pd-cert-item.is-revoked { border-color:#c0392b; }

@media (max-width:560px) {
  .pd-cert-verify-form { flex-direction:column; align-items:stretch; }
  .pd-cert-card dl { grid-template-columns:1fr; gap:2px; }
  .pd-cert-card dd { margin-bottom:8px; }
}

/* In-app certificate block on the student course overview. Reuses .pd-cert-item
   from the shortcode styles so the student view and the public verification
   page cannot look like two different products. */
.pd-cert-panel { margin-bottom:14px; }
.pd-cert-panel .pd-cert-item { display:flex; flex-wrap:wrap; gap:10px; align-items:center; }
.pd-cert-panel .pd-cert-item strong { flex:1 0 100%; }
.pd-cert-panel .pd-cert-item.is-revoked { border-color:#c0392b; }

/* ==========================================================================
   Certificate builder (lecturer) and certificate view/print (student)
   ========================================================================== */
.pd-cert-grid { display:grid; gap:16px; grid-template-columns:1fr; align-items:start; }
@media (min-width:1100px) { .pd-cert-grid { grid-template-columns:minmax(0,380px) minmax(0,1fr); } }

.pd-cert-headbtn {
  background: transparent;
  border: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
}
.pd-cert-headbtn:hover { background: color-mix(in oklab, var(--pd-border) 40%, transparent); }

.pd-cert-fullscreen { max-width: 1000px; width: min(1000px, 94vw); }
.pd-cert-fullscreen .pd-modal { max-width: 1000px; width: min(1000px, 94vw); }
.pd-cert-fullscreen .pd-cert-fullwrap { display:flex; flex-direction:column; gap:10px; align-items:center; }
.pd-cert-fullscreen .pd-cert-frame {
  width: 100%;
  position: relative;
  overflow: hidden;
  background: #555;
  border-radius: 12px;
}
.pd-cert-fullscreen .pd-cert-iframe {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 1123px;
  height: 794px;
  transform-origin: center center;
  border: 0;
}
.pd-cert-full-actions { display: flex; gap: 10px; justify-content: flex-end; margin-top: 4px; }

.pd-cert-side { display:flex; flex-direction:column; gap:12px; min-width:0; }
.pd-cert-form { background:var(--pd-card,#fff); border-radius:16px; padding:14px;
 box-shadow:var(--pd-shadow,0 2px 10px rgba(15,23,42,.05)); display:flex; flex-direction:column; gap:10px; }
.pd-cert-form h3 { margin:2px 0 0; font-size:13px; color:var(--pd-muted,#6b7280);
 text-transform:uppercase; letter-spacing:.04em; }
.pd-cert-form .pd-field { display:flex; flex-direction:column; gap:4px; }

/* Collapsible groups: the panel stays short because nothing is open by
   default except the properties of the selected element. */
.pd-cert-group { border:1px solid var(--pd-border,#d8dde5); border-radius:12px;
 background:var(--pd-card,#fff); overflow:hidden; }
.pd-cert-group > summary { cursor:pointer; padding:10px 12px; font-size:13px; font-weight:600;
 color:var(--pd-fg,#1f2937); list-style:none; display:flex; align-items:center; gap:7px;
 user-select:none; }
.pd-cert-group > summary::-webkit-details-marker { display:none; }
.pd-cert-group > summary::before { content:"+"; display:inline-flex; align-items:center;
 justify-content:center; width:17px; height:17px; flex:0 0 17px; border-radius:5px;
 background:var(--pd-bg,#f6f7f9); color:var(--pd-muted,#6b7280); font-weight:700; font-size:13px; }
.pd-cert-group[open] > summary::before { content:"\2212"; }
.pd-cert-group > summary:hover { background:var(--pd-bg,#f6f7f9); }
.pd-cert-group-body { padding:4px 12px 12px; display:flex; flex-direction:column; gap:10px; }

.pd-cert-insp-wrap { display:flex; flex-direction:column; gap:8px; }
.pd-cert-inspector { display:flex; flex-direction:column; gap:10px; }
.pd-cert-insp-head { display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:8px;
 padding:9px 11px; border-radius:11px; background:var(--pd-bg,#f6f7f9); border:1px solid var(--pd-border,#d8dde5); }
.pd-cert-inline { display:flex; flex-wrap:wrap; gap:8px; align-items:center; }

/* The element dropdown is the one control that stays put, so moving between
   elements never means scrolling back up to find the selector. */
.pd-cert-picker { position:sticky; top:0; z-index:5; font-weight:600;
 border-color:var(--pd-accent,#2563eb); }
@media (max-width:760px) { .pd-cert-picker { position:sticky; top:0; } }

/* Slider plus number box, so a value can be typed or dragged. */
.pd-cert-range { display:flex; align-items:center; gap:8px; }
.pd-cert-range .pd-input { width:74px; flex:0 0 74px; padding:6px 7px; }
.pd-cert-slider { flex:1 1 auto; min-width:0; accent-color:var(--pd-accent,#2563eb); }
.pd-cert-color { display:flex; align-items:center; gap:8px; flex-wrap:wrap; }
.pd-cb-color { width:56px; height:34px; padding:2px; border:1px solid var(--pd-border,#d8dde5);
 border-radius:8px; background:var(--pd-card,#fff); cursor:pointer; }

/* Template picker thumbnails: paper colour plus two accent blocks positioned
   the way the real layout uses them, so the fifteen read apart at a glance. */
.pd-cert-mini { display:block; width:100%; aspect-ratio:4/3; border-radius:7px;
 position:relative; overflow:hidden; box-shadow:inset 0 0 0 1px rgba(15,23,42,.10); }
.pd-mini-accent-a,.pd-mini-accent-b { position:absolute; display:block; }
.pd-mini-accent-a { left:12%; top:16%; width:52%; height:5%; border-radius:2px; }
.pd-mini-accent-b { left:22%; top:40%; width:44%; height:9%; border-radius:2px; }

.pd-mini-classic   .pd-mini-accent-b { left:50%; transform:translateX(-50%); width:40%; height:12%; }
.pd-mini-diploma   .pd-mini-accent-a { left:0; top:0; width:100%; height:20%; border-radius:0; }
.pd-mini-diploma   .pd-mini-accent-b { top:52%; }
.pd-mini-academic  .pd-mini-accent-a { left:6%; top:6%; width:88%; height:88%; border:2px solid currentColor; border-radius:4px; background:none !important; }
.pd-mini-academic  .pd-mini-accent-b { left:44%; top:10%; width:12%; height:12%; border-radius:50%; }
.pd-mini-luxe      { box-shadow:inset 0 0 0 2px #c9a227; }
.pd-mini-luxe      .pd-mini-accent-a { left:8%; top:8%; width:84%; height:84%; background:none !important; border:1px solid rgba(201,162,39,.7); border-radius:2px; }
.pd-mini-frame     .pd-mini-accent-a { left:5%; top:5%; width:90%; height:90%; background:none !important; border:3px double currentColor; border-radius:2px; }
.pd-mini-modern    .pd-mini-accent-a { left:0; top:0; bottom:0; width:16%; height:100%; border-radius:0; }
.pd-mini-modern    .pd-mini-accent-b { left:24%; }
.pd-mini-minimal   .pd-mini-accent-a { left:40%; top:52%; width:20%; height:2%; border-radius:0; }
.pd-mini-minimal   .pd-mini-accent-b { top:20%; height:7%; }
.pd-mini-elegant   .pd-mini-accent-a { left:8%; top:8%; width:84%; height:84%; background:none !important; border:1px solid currentColor; border-radius:6px; }
.pd-mini-gradient  { background:linear-gradient(135deg,#eef2ff,#fdf2f8) !important; }
.pd-mini-gradient  .pd-mini-accent-a { left:18%; top:18%; width:64%; height:64%; border-radius:5px; opacity:.55; }
.pd-mini-bold      { background:linear-gradient(135deg,#e11d48,#f97316) !important; }
.pd-mini-bold      .pd-mini-accent-a { left:22%; top:16%; width:66%; height:68%; border-radius:4px; }
.pd-mini-bold      .pd-mini-accent-b { left:28%; top:44%; width:40%; }
.pd-mini-geometric { box-shadow:inset 0 0 0 1px rgba(255,255,255,.18); }
.pd-mini-geometric .pd-mini-accent-a { left:0; top:0; width:42%; height:34%; border-radius:0; clip-path:polygon(0 0,100% 0,0 100%); }
.pd-mini-geometric .pd-mini-accent-b { right:0; bottom:0; left:auto; width:38%; height:30%; border-radius:0; clip-path:polygon(100% 0,100% 100%,0 100%); }
.pd-mini-banner    .pd-mini-accent-a { left:-6%; top:0; width:112%; height:30%; border-radius:0; clip-path:polygon(0 0,100% 0,100% 55%,0 100%); }
.pd-mini-banner    .pd-mini-accent-b { top:52%; }
.pd-mini-stripe    .pd-mini-accent-a { left:0; top:0; bottom:0; width:24%; height:100%; border-radius:0;
 background:repeating-linear-gradient(-45deg,#0284c7 0 5px,#38bdf8 5px 10px) !important; }
.pd-mini-stripe    .pd-mini-accent-b { left:32%; }
.pd-mini-medal     .pd-mini-accent-a { left:38%; top:8%; width:24%; height:24%; border-radius:50%; }
.pd-mini-medal     .pd-mini-accent-b { top:52%; }
.pd-mini-seal      .pd-mini-accent-a { left:6%; top:6%; width:88%; height:88%; background:none !important; border:1px solid currentColor; border-radius:3px; }
.pd-mini-seal      .pd-mini-accent-b { right:8%; left:auto; bottom:10%; top:auto; width:26%; height:26%; border-radius:50%; }

.pd-cert-logo { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.pd-cert-logo img { max-height:44px; max-width:120px; object-fit:contain;
 border:1px solid var(--pd-border,#d8dde5); border-radius:6px; background:#fff; padding:3px; }
.pd-cert-actions { display:flex; flex-wrap:wrap; gap:8px; }

/* Preview: the real A4 page, isolated in its own iframe and scaled to fit, so
   the whole certificate is visible at once with no scrolling. */
.pd-cert-stage { background:var(--pd-card,#fff); border-radius:18px; padding:16px;
 box-shadow:var(--pd-shadow,0 2px 10px rgba(15,23,42,.05)); min-width:0; overflow:hidden; }
.pd-cert-stage-head { display:flex; flex-wrap:wrap; align-items:baseline; justify-content:space-between;
 gap:4px 12px; margin-bottom:12px; }
.pd-cert-stage-head h3 { margin:0; font-size:15px; }
.pd-cert-hint { font-size:12px; color:var(--pd-muted,#6b7280); }
.pd-cert-frame { position:relative; width:100%; overflow:hidden; border-radius:12px;
 background:#eef1f6; box-shadow:inset 0 0 0 1px var(--pd-border,#d8dde5), 0 10px 30px rgba(15,23,42,.10); }
.pd-cert-iframe { position:absolute; top:0; left:0; width:1123px; height:794px; border:0;
 transform-origin:top left; display:block; background:#eef1f6; }
.pd-cert-sheet { overflow:auto; max-height:72vh; border:1px solid var(--pd-border,#d8dde5);
 border-radius:10px; background:#eef1f6; }
.pd-cert-sheet .pdc-page { margin:0; }

.pd-cert-view-bar { display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; }
.pd-cert-view-link { display:inline-block; margin-top:8px; text-decoration:none; }

/* Printing must produce the certificate and nothing else, so the whole
   dashboard is hidden and only the print-marked sheet survives. */
@media print {
 body * { visibility:hidden !important; }
 .pd-cert-print, .pd-cert-print * { visibility:visible !important; }
 .pd-cert-print { position:absolute; left:0; top:0; width:100%; border:0; border-radius:0;
 max-height:none; overflow:visible; background:#fff; }
 .pd-cert-print .pdc-page { margin:0; }
 .pd-modal-overlay { position:static !important; background:none !important; padding:0 !important; }
 .pd-modal { box-shadow:none !important; border:0 !important; padding:0 !important; max-width:none !important; }
 .pd-modal-close, .pd-cert-view-bar, .pd-modal > h3 { display:none !important; }
}

/* The template grid is the one group that stays open, so cap its height and
   let it scroll rather than pushing the inspector down the page. */
.pd-cert-group--scrollable .pd-cert-group-body { max-height:260px; overflow-y:auto; }
@media (max-width:760px) { .pd-cert-group--scrollable .pd-cert-group-body { max-height:200px; } }
.pd-cert-note { margin:0; font-size:12px; line-height:1.5; font-style:italic; }
/* Certificate builder layout: course, then the compact template picker, then
   the property panel and preview side by side. */
.pd-cert-coursebar { margin-bottom:14px; }

/* Template picker: a single thumbnail opens the layout gallery, so the builder
   never gives over a whole row of tiles to fifteen templates. */
.pd-cert-bar { display:flex; flex-wrap:wrap; align-items:center; gap:14px; margin-bottom:14px; }
.pd-cert-bar-thumb { position:relative; flex:0 0 122px; padding:0; border:0; background:transparent;
  cursor:pointer; border-radius:10px; transition:transform .12s ease; }
.pd-cert-bar-thumb:hover { transform:translateY(-2px); }
.pd-cert-bar-thumb .pd-cert-mini { border-radius:10px;
  box-shadow:inset 0 0 0 1px rgba(15,23,42,.12), 0 6px 14px rgba(15,23,42,.14); }
.pd-cert-bar-change { position:absolute; right:6px; bottom:6px; font-size:10px; font-weight:800;
  letter-spacing:.05em; color:#fff; background:rgba(15,23,42,.6); padding:3px 8px; border-radius:999px;
  box-shadow:0 1px 4px rgba(15,23,42,.4); backdrop-filter:blur(3px); }
.pd-cert-bar-meta { flex:1 1 220px; min-width:0; display:flex; flex-direction:column; gap:3px; cursor:pointer; }
.pd-cert-bar-title { display:flex; flex-wrap:wrap; align-items:center; gap:8px; }
.pd-cert-bar-title strong { font-size:16px; }
.pd-cert-bar-group { font-size:11px; font-weight:700; color:var(--pd-accent,#2563eb);
  background:rgba(37,99,235,.10); padding:2px 9px; border-radius:999px; }
.pd-cert-bar-act { flex:0 0 auto; }
@media (max-width:760px) {
  .pd-cert-bar-act { flex:1 1 100%; }
  .pd-cert-bar-act .pd-btn { width:100%; }
}

/* Layout gallery: every template as a true rendered preview in a wide modal. */
.pd-cert-tpl-modal { max-width:1020px; padding:22px; }
.pd-cert-tpl-note { margin:0 0 16px; font-size:12.5px; line-height:1.5; }
.pd-cert-tpl-group-title { margin:0 0 10px; font-size:12px; font-weight:800; text-transform:uppercase;
  letter-spacing:.06em; color:var(--pd-muted,#6b7280); }
.pd-cert-tpl-group-title:not(:first-child) { margin-top:20px; }
.pd-cert-tpl-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(210px,1fr)); gap:14px; }
.pd-cert-tpl-tile { position:relative; display:flex; flex-direction:column; gap:6px; padding:10px; margin:0;
  background:var(--pd-card,#fff); border:2px solid var(--pd-border,#d8dde5); border-radius:14px;
  cursor:pointer; text-align:left; font:inherit; color:inherit;
  transition:transform .12s ease, box-shadow .12s ease, border-color .12s ease; }
.pd-cert-tpl-tile:hover { transform:translateY(-2px); box-shadow:0 10px 22px rgba(15,23,42,.12);
  border-color:#c7ccd6; }
.pd-cert-tpl-tile.is-active { border-color:var(--pd-accent,#2563eb);
  box-shadow:0 0 0 3px rgba(37,99,235,.16), 0 10px 22px rgba(15,23,42,.12); }
.pd-cert-tpl-preview { position:relative; display:block; width:100%; aspect-ratio:1123/794; overflow:hidden;
  border-radius:9px; border:1px solid var(--pd-border,#d8dde5); background:#eef1f6; }
@supports not (aspect-ratio:1/1) { .pd-cert-tpl-preview { height:170px; } }
.pd-cert-tpl-iframe { position:absolute; top:0; left:0; width:1123px; height:794px; border:0;
  transform-origin:top left; display:block; background:#fff; }
.pd-cert-tpl-loading, .pd-cert-tpl-err { position:absolute; inset:0; display:flex; align-items:center;
  justify-content:center; font-size:11px; letter-spacing:.03em; color:var(--pd-muted,#6b7280); }
.pd-cert-tpl-err { color:#c0392b; }
.pd-cert-tpl-name { font-size:13px; font-weight:800; color:var(--pd-fg,#1f2937); }
.pd-cert-tpl-desc { font-size:11px; line-height:1.45; color:var(--pd-muted,#6b7280); min-height:16px; }
.pd-cert-tpl-badge { position:absolute; top:14px; right:14px; z-index:2; font-size:10px; font-weight:800;
  letter-spacing:.06em; color:#fff; background:var(--pd-accent,#2563eb); padding:3px 9px;
  border-radius:999px; box-shadow:0 2px 6px rgba(15,23,42,.28); }
@media (max-width:760px) {
  .pd-cert-tpl-overlay { padding:10px; }
  .pd-cert-tpl-modal { padding:16px; }
  .pd-cert-tpl-grid { grid-template-columns:repeat(auto-fill,minmax(150px,1fr)); gap:10px; }
  .pd-cert-tpl-tile { padding:8px; }
}
.pd-cert-grid { grid-template-columns:minmax(0,1fr); }
@media (min-width:1100px) { .pd-cert-grid { grid-template-columns:minmax(340px,420px) minmax(0,1fr); } }

/* ---- Certificate builder: premium polish ---- */
.pd-cert-form { background:linear-gradient(180deg,var(--pd-card,#fff),var(--pd-bg,#f6f7f9));
 border:1px solid var(--pd-border,#d8dde5); }
.pd-cert-group { border-radius:14px; }
.pd-cert-group > summary { padding:11px 13px; }
.pd-cert-mini { box-shadow:inset 0 0 0 1px rgba(15,23,42,.12), 0 2px 6px rgba(15,23,42,.10); }
.pd-cert-mini::after { content:""; position:absolute; inset:0; pointer-events:none;
 background:linear-gradient(135deg,rgba(255,255,255,.35),transparent 46%); }
/* On narrow screens the preview leads, so a tap on the certificate is the
   first thing a tutor sees. */
@media (max-width:1099px) { .pd-cert-stage { order:-1; } }