:root {
  --app-font: "Noto Sans Hebrew", "Noto Sans", sans-serif;
  --bg: #020617;
  --panel: #0f172a;
  --panel-2: #111c31;
  --panel-3: #1e293b;
  --text: #f8fafc;
  --muted: #9fb0c8;
  --border: rgba(148, 163, 184, 0.22);
  --accent: #0ea5e9;
  --accent-2: #38bdf8;
  --danger: #fb7185;
  --good: #22c55e;
  --shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
  font-family: var(--app-font);
}

*, *::before, *::after {
  box-sizing: border-box;
  font-family: var(--app-font) !important;
  letter-spacing: 0 !important;
  font-synthesis: none;
}

html, body {
  min-height: 100%;
  margin: 0;
  background: radial-gradient(circle at top, rgba(14, 165, 233, 0.08), transparent 36%), var(--bg);
  color: var(--text);
  direction: rtl;
  text-align: right;
  overflow-x: hidden;
}

body {
  padding: 18px;
}

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

button {
  cursor: pointer;
}

[hidden] { display: none !important; }

.auth-screen {
  min-height: calc(100vh - 36px);
  display: grid;
  place-items: center;
}

.auth-card, .clean-card, .date-card, .metric-card, .month-card {
  border: 1px solid var(--border);
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.96), rgba(2, 6, 23, 0.78));
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.auth-card {
  width: min(100%, 520px);
  padding: 22px;
}

.brand-row {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand-row.compact h1 { font-size: 22px; }
.brand-row.compact p { margin-top: 0; }

.brand-mark {
  width: 46px;
  height: 46px;
  border-radius: 15px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent), #2563eb);
  color: white;
  font-size: 24px;
  font-weight: 700;
  box-shadow: 0 12px 28px rgba(14, 165, 233, 0.28);
}

h1, h2, h3, p { margin: 0; }
h1 { font-size: 28px; font-weight: 700; }
h2 { font-size: 20px; font-weight: 700; }
h3 { font-size: 17px; font-weight: 600; }

.auth-note, .muted-line, .eyebrow, .module-meta, .video-meta, .edit-hint {
  color: var(--muted);
}

.auth-note { margin: 18px 0; line-height: 1.65; }
.auth-grid, .form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
.full { grid-column: 1 / -1; }

label {
  display: grid;
  gap: 6px;
  font-weight: 500;
  color: #dbeafe;
}

input, textarea, select {
  width: 100%;
  border: 1px solid rgba(148, 163, 184, 0.24);
  background: rgba(2, 6, 23, 0.62);
  border-radius: 12px;
  min-height: 44px;
  padding: 10px 12px;
  outline: none;
  color: var(--text);
}

textarea { min-height: 110px; resize: vertical; line-height: 1.65; }

input:focus, textarea:focus, select:focus {
  border-color: rgba(14, 165, 233, 0.7);
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.14);
}

input[type="date"] { color-scheme: dark; }
input[type="date"]:placeholder-shown { color: transparent; }
input[type="date"]::-webkit-datetime-edit { color: inherit; }
input[type="date"]:not(:focus):invalid::-webkit-datetime-edit { color: transparent; }

.form-grid > label,
.editor-panel label,
.task-text,
.row-editor-main,
.admin-head h3 {
  min-width: 0;
}
input[type="date"] {
  min-width: 0;
  max-width: 100%;
  padding-inline: 10px;
}

.primary-btn, .ghost-btn, .small-btn, .danger-btn, .icon-text-btn, .file-btn, .card-summary-btn {
  border: 1px solid transparent;
  border-radius: 12px;
  min-height: 42px;
  padding: 9px 14px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
}

.primary-btn {
  background: var(--accent);
  color: white;
  box-shadow: 0 12px 26px rgba(14, 165, 233, 0.28);
}
.ghost-btn, .small-btn, .icon-text-btn, .file-btn {
  background: rgba(15, 23, 42, 0.72);
  color: #dbeafe;
  border-color: rgba(148, 163, 184, 0.25);
}
.small-btn.accent { color: var(--accent-2); border-color: rgba(14, 165, 233, 0.38); }
.danger-btn {
  color: #fecdd3;
  background: rgba(127, 29, 29, 0.22);
  border-color: rgba(244, 63, 94, 0.42);
}
.compact-btn { min-height: 38px; padding: 8px 12px; }
.auth-actions, .form-actions, .calendar-actions, .top-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-top: 14px;
}
.error-line { color: #fecaca; min-height: 22px; margin-top: 12px; }

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 14px;
}

.tabs {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px;
  border: 1px solid var(--border);
  border-radius: 16px;
  background: rgba(15, 23, 42, 0.76);
  margin-bottom: 16px;
}
.tabs button {
  border: 0;
  background: transparent;
  color: #bfdbfe;
  border-radius: 12px;
  padding: 10px 16px;
  white-space: nowrap;
  font-weight: 600;
}
.tabs button.active { background: var(--accent); color: white; }

.tab-panel { display: none; }
.tab-panel.active { display: grid; gap: 14px; }

.date-card {
  padding: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  overflow: visible;
}
.date-card strong { display: block; color: var(--accent-2); font-size: 25px; font-weight: 700; }
.date-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.metrics-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
}
.metric-card { padding: 14px; display: grid; gap: 6px; }
.metric-card span { color: var(--muted); font-weight: 700; }
.metric-card strong { font-size: 26px; font-weight: 700; color: var(--accent-2); }
.metric-card input { min-height: 36px; padding: 6px 8px; }
.metric-label {
  display: flex;
  align-items: center;
  gap: 7px;
}
.metric-icon {
  width: 22px;
  height: 22px;
  border-radius: 999px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  color: #7dd3fc;
  background: rgba(14, 165, 233, 0.12);
  border: 1px solid rgba(56, 189, 248, 0.28);
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.14);
  font-size: 14px;
  font-style: normal;
  line-height: 1;
}

.module-list, .video-categories, .admin-list { display: grid; gap: 12px; }
.module-card, .video-category, .admin-card {
  border: 1px solid var(--border);
  background: rgba(15, 23, 42, 0.82);
  border-radius: 18px;
  overflow: hidden;
}
.module-head, .video-category-head, .admin-head {
  min-height: 56px;
  padding: 13px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: rgba(30, 41, 59, 0.68);
}
.module-title, .video-category-title { display: flex; align-items: center; gap: 10px; min-width: 0; font-weight: 700; }
.collapse-symbol { color: var(--accent-2); font-size: 24px; font-weight: 700; line-height: 1; min-width: 22px; text-align: center; }
.module-actions { display: flex; gap: 6px; flex: 0 0 auto; }
.icon-btn {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  border: 1px solid rgba(148, 163, 184, 0.20);
  background: rgba(2, 6, 23, 0.25);
  color: var(--accent-2);
  display: grid;
  place-items: center;
  padding: 0;
}
.icon-btn svg { width: 24px; height: 24px; display: block; }
.drag-icon svg { width: 28px; height: 28px; }
.module-body { padding: 12px; display: grid; gap: 10px; }
.module-body[hidden] { display: none !important; }
.task-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: start;
  gap: 10px;
  padding: 12px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.30);
}
.task-row input[type="checkbox"] { width: 22px; min-height: 22px; margin-top: 2px; accent-color: var(--accent); }
.task-title { font-weight: 600; }
.task-desc { color: var(--muted); line-height: 1.55; margin-top: 3px; }
.row-textarea { grid-column: 1 / -1; }

.clean-card { padding: 16px; }
.clean-card > summary, .card-summary-btn {
  list-style: none;
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  justify-content: flex-start;
  text-align: right;
  font-size: 18px;
}
.clean-card > summary::-webkit-details-marker { display: none; }
.daily-note-card textarea { margin-top: 12px; }

.search-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 10px;
  align-items: center;
  padding: 3px;
}
.search-row input { outline-offset: -2px; }
.section-title { display: flex; align-items: center; gap: 10px; }
.section-title span { width: 6px; height: 36px; border-radius: 999px; background: var(--accent); }
.video-category-body { padding: 12px; display: grid; gap: 12px; }
.video-category-body[hidden] { display: none !important; }
.video-toolbar {
  margin-top: 8px;
  padding: 10px;
  border: 1px solid rgba(14, 165, 233, 0.22);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.34);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.video-view-buttons { display: flex; gap: 8px; }
.video-toolbar button { min-width: 46px; }
.video-list { display: grid; gap: 10px; }
.video-list.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.video-card {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  padding: 10px;
  background: rgba(15, 23, 42, 0.72);
  display: grid;
  gap: 8px;
  min-width: 0;
}
.video-preview {
  aspect-ratio: 9 / 12;
  border-radius: 12px;
  overflow: hidden;
  background: rgba(2, 6, 23, 0.6);
  border: 1px solid rgba(14, 165, 233, 0.22);
  display: grid;
  place-items: center;
  color: var(--accent-2);
  font-weight: 700;
}
.video-preview img { width: 100%; height: 100%; object-fit: cover; display: block; }
.video-actions { display: flex; gap: 8px; }
.video-actions button { flex: 1; }

.floating-calendar {
  position: fixed;
  z-index: 9999;
  width: min(420px, calc(100vw - 28px));
  border: 1px solid rgba(14, 165, 233, 0.30);
  border-radius: 18px;
  background: rgba(15, 23, 42, 0.98);
  box-shadow: var(--shadow);
  padding: 14px;
}
.calendar-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}
.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 6px;
}
.calendar-day-name, .calendar-day, .calendar-spacer {
  min-height: 42px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 600;
}
.calendar-day-name { color: var(--muted); min-height: 28px; }
.calendar-day { border: 1px solid rgba(148, 163, 184, 0.16); background: rgba(2, 6, 23, 0.42); }
.calendar-day.today { border-color: var(--accent); color: var(--accent-2); }
.calendar-day.active { background: var(--accent); color: white; }
.calendar-day.has-data::after { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--good); margin-top: -8px; }

.month-card { padding: 14px; }
.month-title { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.history-box { line-height: 1.7; }
.history-box ul { margin: 8px 0 0; padding-right: 20px; }

.card-head, .admin-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.info-list { margin: 0; padding-right: 22px; line-height: 1.75; }
.table-scroll { overflow-x: auto; }
table { border-collapse: collapse; width: 100%; min-width: 720px; }
th, td { border-bottom: 1px solid rgba(148, 163, 184, 0.16); padding: 10px; vertical-align: top; }
th { color: #dbeafe; font-weight: 700; }
td { color: #e2e8f0; }

.admin-card { padding: 0; }
.admin-body { padding: 12px; display: grid; gap: 10px; }
.admin-row { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px; border-radius: 12px; background: rgba(2,6,23,.28); }

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 10000;
  background: rgba(2, 6, 23, 0.76);
  display: grid;
  place-items: center;
  padding: 16px;
}
.modal-card {
  width: min(100%, 760px);
  max-height: calc(100vh - 40px);
  overflow: auto;
  border: 1px solid var(--border);
  background: #0f172a;
  border-radius: 18px;
  box-shadow: var(--shadow);
  padding: 16px;
}
.modal-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 14px; }
.close-btn { width: 38px; height: 38px; border-radius: 12px; border: 1px solid var(--border); background: rgba(2,6,23,.4); color: var(--text); }

.toast {
  position: fixed;
  z-index: 11000;
  bottom: 22px;
  right: 50%;
  transform: translateX(50%);
  min-width: 220px;
  max-width: calc(100vw - 32px);
  padding: 12px 16px;
  border-radius: 14px;
  background: rgba(14, 165, 233, 0.95);
  color: white;
  box-shadow: var(--shadow);
  font-weight: 600;
  text-align: center;
}

@media (max-width: 760px) {
  body { padding: 12px; }
  .topbar, .date-card, .card-head { align-items: stretch; flex-direction: column; }
  .auth-grid, .form-grid, .metrics-grid { grid-template-columns: 1fr; }
  .search-row { grid-template-columns: 1fr; padding: 4px; }
  .date-actions { display: grid; grid-template-columns: repeat(3, 1fr); }
  .video-list.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-toolbar { margin-top: 9px; }
  .tabs { margin-inline: -2px; }
  h1 { font-size: 24px; }
  .date-card strong { font-size: 22px; }
}

@media (min-width: 900px) {
  .video-list.grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

/* V12 rebuild pass: clean module/row settings, no white native button backgrounds */
button {
  background: transparent;
  border: 0;
  color: inherit;
}
button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}
.module-title,
.video-category-title {
  width: 100%;
  border: 0;
  background: transparent;
  color: var(--text);
  padding: 0;
  text-align: right;
  justify-content: flex-start;
}
.module-title span:last-child,
.video-category-title span:last-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: normal;
}
.collapse-symbol {
  font-size: 32px;
  min-width: 30px;
  text-shadow: 0 0 20px rgba(56, 189, 248, 0.35);
}
.daily-note-panel textarea {
  min-height: 132px;
}
.passive-icon {
  pointer-events: none;
}
.empty-state {
  border: 1px solid rgba(148, 163, 184, 0.14);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.26);
  color: var(--muted);
  padding: 14px;
  font-weight: 500;
}
.empty-state.small {
  padding: 10px;
  font-size: 14px;
}
.task-row {
  position: relative;
  grid-template-columns: auto minmax(0, 1fr) auto;
  overflow: visible;
}
.task-row.done {
  border-color: rgba(34, 197, 94, 0.34);
}
.task-row.skipped {
  opacity: 0.82;
  border-color: rgba(251, 191, 36, 0.28);
  background: rgba(113, 63, 18, 0.12);
}
.task-text {
  min-width: 0;
}
.task-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: flex-end;
}
.skip-btn {
  min-height: 34px;
  padding: 7px 10px;
  color: var(--accent-2);
}
.skip-reason {
  margin-top: 8px;
  color: #fde68a;
  font-size: 14px;
  line-height: 1.5;
}
.row-type-badge {
  min-width: 54px;
  border: 1px solid rgba(14, 165, 233, 0.28);
  border-radius: 999px;
  color: var(--accent-2);
  background: rgba(14, 165, 233, 0.08);
  padding: 6px 9px;
  text-align: center;
  font-size: 13px;
  font-weight: 600;
}
.spark-burst {
  position: absolute;
  z-index: 3;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  pointer-events: none;
  animation: spark-pop 0.95s ease-out forwards;
  font-size: 22px;
  filter: drop-shadow(0 0 10px rgba(251, 146, 60, 0.7));
}
@keyframes spark-pop {
  0% { opacity: 0; transform: translateY(-50%) scale(0.5) rotate(0deg); }
  25% { opacity: 1; transform: translateY(-75%) scale(1.2) rotate(-8deg); }
  100% { opacity: 0; transform: translateY(-155%) scale(1.55) rotate(14deg); }
}
.settings-editor {
  display: grid;
  gap: 14px;
}
.editor-panel {
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 16px;
  background: rgba(2, 6, 23, 0.22);
  padding: 14px;
}
.editor-panel h3 {
  margin-bottom: 12px;
}
.editor-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}
.field-title {
  color: #dbeafe;
  font-weight: 600;
  margin-bottom: 8px;
}
.check-line {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  gap: 9px;
  min-height: 44px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 12px;
  background: rgba(2, 6, 23, 0.28);
  padding: 10px 12px;
}
.check-line input,
.weekday-pill input {
  width: auto;
  min-height: 0;
}
.weekday-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  gap: 8px;
}
.weekday-pill {
  position: relative;
  display: block;
}
.weekday-pill input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.weekday-pill span {
  min-height: 42px;
  border: 1px solid rgba(148, 163, 184, 0.22);
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #dbeafe;
  background: rgba(15, 23, 42, 0.68);
  font-weight: 700;
}
.weekday-pill input:checked + span {
  border-color: rgba(14, 165, 233, 0.70);
  background: rgba(14, 165, 233, 0.24);
  color: var(--accent-2);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.18);
}
.row-editor-list {
  display: grid;
  gap: 10px;
}
.row-editor-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  border: 1px solid rgba(148, 163, 184, 0.17);
  border-radius: 14px;
  background: rgba(15, 23, 42, 0.56);
  padding: 10px;
}
.row-editor-card:active {
  opacity: 0.78;
}
.row-handle {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(14, 165, 233, 0.24);
  border-radius: 12px;
  background: rgba(14, 165, 233, 0.06);
  cursor: grab;
}
.row-handle svg {
  width: 28px;
  height: 28px;
}
.row-editor-main {
  min-width: 0;
}
.row-editor-main strong {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.row-controls {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
  flex-wrap: wrap;
}
.row-controls svg {
  width: 17px;
  height: 17px;
}
.icon-only {
  width: 38px;
  padding: 0;
}
.sticky-actions {
  position: sticky;
  bottom: -16px;
  margin: 0 -16px -16px;
  padding: 12px 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.86), #0f172a);
  border-top: 1px solid rgba(148, 163, 184, 0.18);
}
.info-edit-list .admin-row span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.history-done-list li {
  color: var(--good);
  font-weight: 600;
}
.history-skip-list li {
  color: #fde68a;
}
.history-box h3 {
  margin-top: 12px;
}

@media (max-width: 760px) {
  .task-row,
  .row-editor-card {
    grid-template-columns: 1fr;
  }
  .task-actions,
  .row-controls {
    justify-content: stretch;
  }
  .task-actions > *,
  .row-controls > * {
    flex: 1;
  }
  .weekday-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .editor-toolbar {
    align-items: stretch;
    flex-direction: column;
  }
  .modal-card {
    padding: 14px;
  }
  .sticky-actions {
    margin: 0 -14px -14px;
  }
}


/* V12.0.3: drag, mobile safe actions, compact skip and lighter typography */
body {
  font-weight: 400;
}
.brand-mark { font-weight: 700; }
.module-title,
.video-category-title,
.task-title,
.field-title,
.row-editor-main strong,
.metric-card strong,
.date-card strong {
  font-weight: 600;
}
label,
.metric-card span,
.tabs button,
.primary-btn,
.ghost-btn,
.small-btn,
.danger-btn,
.icon-text-btn,
.file-btn,
.card-summary-btn,
.weekday-pill span,
.empty-state,
.toast {
  font-weight: 500;
}
.module-meta,
.video-meta,
.edit-hint,
.task-desc,
td {
  font-weight: 400;
}
.collapse-symbol {
  font-weight: 700;
}
.danger-btn,
.video-toolbar .danger-btn,
.row-controls .danger-btn {
  justify-content: center;
  align-items: center;
  text-align: center;
}
.video-toolbar .danger-btn svg,
.row-controls .danger-btn svg,
.small-btn svg,
.danger-btn svg {
  width: 18px;
  height: 18px;
  flex: 0 0 auto;
}
.editor-panel,
.modal-card,
.clean-card,
.module-card,
.admin-card,
.video-category {
  min-width: 0;
}
.form-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.sticky-actions {
  bottom: calc(10px + env(safe-area-inset-bottom, 0px));
  z-index: 4;
  border-radius: 16px 16px 0 0;
}
.modal-card {
  padding-bottom: calc(76px + env(safe-area-inset-bottom, 0px));
}
.skip-btn {
  min-height: 30px;
  padding: 5px 9px;
  border-radius: 999px;
  font-size: 13px;
  white-space: nowrap;
}
.sortable-card,
.row-editor-card {
  touch-action: none;
}
.row-handle {
  color: var(--accent-2);
  touch-action: none;
  user-select: none;
}
.row-handle:active,
.is-sorting .row-handle {
  cursor: grabbing;
}
.dragging {
  opacity: 0.62;
  border-color: rgba(14, 165, 233, 0.60) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.12);
}
.admin-head {
  grid-template-columns: auto minmax(0, 1fr) auto;
}
.admin-head h3 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.module-handle {
  flex: 0 0 auto;
}
.row-editor-card {
  cursor: default;
}
.row-editor-card .row-handle,
.admin-card .row-handle {
  cursor: grab;
}
@media (max-width: 760px) {
  .form-grid {
    grid-template-columns: 1fr;
  }
  .task-row {
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 8px;
    padding: 10px;
  }
  .task-row.input-row,
  .row-editor-card {
    grid-template-columns: 1fr;
  }
  .task-actions {
    justify-content: flex-end;
    align-items: center;
  }
  .task-actions > * {
    flex: 0 0 auto;
  }
  .skip-btn {
    min-height: 28px;
    padding: 4px 7px;
    font-size: 12px;
  }
  .task-title {
    font-size: 14px;
  }
  .task-desc {
    font-size: 13px;
    line-height: 1.45;
  }
  .modal-overlay {
    align-items: start;
    padding: 10px;
    padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
  }
  .modal-card {
    max-height: calc(100dvh - 20px);
    padding-bottom: calc(92px + env(safe-area-inset-bottom, 0px));
  }
  .sticky-actions {
    bottom: calc(14px + env(safe-area-inset-bottom, 0px));
    gap: 8px;
  }
  .sticky-actions > * {
    flex: 1 1 auto;
  }
  .admin-head {
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
  }
  .admin-head .row-controls {
    justify-content: end;
  }
  .admin-head .row-controls > * {
    flex: 0 0 auto;
  }
}

/* V12.0.4: direct page editing, fresh pointer DnD, lighter type, mobile info fix */
body { font-weight: 400; }
h1 { font-weight: 600; }
h2 { font-weight: 600; }
h3 { font-weight: 500; }
label, .tabs button, .primary-btn, .ghost-btn, .small-btn, .danger-btn, .icon-text-btn, .file-btn, .card-summary-btn { font-weight: 500; }
.module-title, .video-category-title, .task-title, .field-title, .row-editor-main strong { font-weight: 500; }
.metric-card span, .module-meta, .video-meta, .edit-hint, .task-desc, td, .info-list { font-weight: 400; }
.collapse-symbol, .brand-mark { font-weight: 600; }

.sync-line {
  display: flex;
  align-items: center;
  min-height: 18px;
  margin-top: 2px;
}
.sync-dot {
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--good);
  box-shadow: 0 0 0 3px rgba(34, 197, 94, 0.13), 0 0 16px rgba(34, 197, 94, 0.45);
  display: inline-block;
}
.sync-dot.syncing {
  animation: sync-pulse 0.8s ease-in-out infinite;
}
.sync-dot.error {
  background: var(--danger);
  box-shadow: 0 0 0 3px rgba(251, 113, 133, 0.14), 0 0 16px rgba(251, 113, 133, 0.4);
}
@keyframes sync-pulse {
  0%, 100% { opacity: 0.38; transform: scale(0.82); }
  50% { opacity: 1; transform: scale(1.16); }
}

.module-card.module-disabled {
  opacity: 0.72;
  border-color: rgba(71, 85, 105, 0.5);
}
.module-card.module-disabled .module-head {
  background: rgba(15, 23, 42, 0.55);
}
.status-pill {
  margin-inline-start: 8px;
  padding: 3px 8px;
  border-radius: 999px;
  font-size: 12px;
  line-height: 1.4;
  border: 1px solid rgba(148, 163, 184, 0.2);
  color: var(--muted);
  background: rgba(2, 6, 23, 0.36);
}
.status-pill.off { color: #cbd5e1; }
.add-module-card {
  border-style: dashed;
  background: rgba(2, 6, 23, 0.28);
}
.add-module-bottom {
  width: 100%;
  min-height: 58px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  color: var(--accent-2);
  font-size: 18px;
  padding: 12px;
}

.module-drag-handle, .row-handle {
  touch-action: none;
  user-select: none;
  cursor: grab;
}
.module-drag-handle:active, .row-handle:active, .is-sorting .module-drag-handle, .is-sorting .row-handle { cursor: grabbing; }
.sorting-active { user-select: none; }
.sortable-item.dragging {
  opacity: 0.58;
  border-color: rgba(14, 165, 233, 0.76) !important;
  box-shadow: 0 0 0 2px rgba(14, 165, 233, 0.14), var(--shadow);
}
.sorting-active .sortable-item:not(.dragging) {
  transition: transform 0.12s ease, border-color 0.12s ease;
}

.module-editor-top {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 12px;
  align-items: end;
  margin-bottom: 12px;
}
.module-title-field { grid-column: auto; }
.switch-line {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  justify-content: flex-start;
  min-height: 44px;
  color: #cbd5e1;
  cursor: pointer;
  white-space: nowrap;
}
.switch-line input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
  width: 1px;
  min-height: 1px;
}
.switch-track {
  width: 52px;
  height: 28px;
  border-radius: 999px;
  background: #1f2937;
  border: 1px solid rgba(148, 163, 184, 0.18);
  padding: 3px;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  transition: background 0.18s ease, border-color 0.18s ease;
}
.switch-thumb {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #94a3b8;
  transition: transform 0.18s ease, background 0.18s ease;
}
.switch-line.active .switch-track {
  background: rgba(34, 197, 94, 0.28);
  border-color: rgba(34, 197, 94, 0.55);
}
.switch-line.active .switch-thumb {
  transform: translateX(-24px);
  background: var(--good);
}
.switch-line.active .switch-text { color: #bbf7d0; }

.form-grid > label, .editor-panel label { overflow: hidden; }
input[type="date"] {
  min-width: 0;
  max-width: 100%;
  width: 100%;
  -webkit-appearance: none;
  appearance: none;
}
.task-row.input-row input:not([type="checkbox"]) { grid-column: 1 / -1; }
.row-inline-edit svg { width: 15px; height: 15px; }

.info-list {
  overflow-wrap: anywhere;
  word-break: normal;
}
.info-list li { margin-bottom: 8px; }
.card-head { min-width: 0; }
.card-head h2 { min-width: 0; overflow-wrap: anywhere; }
.table-scroll {
  width: 100%;
  max-width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-inline: contain;
}
.table-scroll table { table-layout: fixed; }
th, td { overflow-wrap: anywhere; }
.video-fallback {
  padding: 10px;
  background: radial-gradient(circle at top, rgba(14, 165, 233, 0.16), rgba(2, 6, 23, 0.72));
}
.video-fallback-badge {
  width: 54px;
  height: 54px;
  border-radius: 18px;
  display: grid;
  place-items: center;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.26);
  color: var(--accent-2);
  font-size: 12px;
}
.video-fallback-creator {
  margin-top: 8px;
  color: #dbeafe;
  font-size: 13px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}

@media (max-width: 760px) {
  .module-editor-top { grid-template-columns: 1fr; align-items: stretch; }
  .switch-line { justify-content: space-between; }
  .task-row { grid-template-columns: auto minmax(0, 1fr) auto; }
  .task-actions { gap: 6px; }
  .row-inline-edit span { display: none; }
  .row-inline-edit { min-height: 28px; padding: 4px 7px; border-radius: 999px; }
  .skip-btn { min-height: 28px; padding: 4px 7px; font-size: 12px; }
  .video-list.grid { grid-template-columns: 1fr 1fr; }
  .video-card { padding: 8px; }
  .video-preview { aspect-ratio: 4 / 5; }
  table { min-width: 620px; font-size: 13px; }
  th, td { padding: 8px; }
  .clean-card { overflow: hidden; }
}
.module-title > span:nth-child(2),
.video-category-title > span:nth-child(2) {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
}
.module-title .status-pill {
  flex: 0 0 auto;
  overflow: visible;
}

/* V12.0.5: motion DnD, mobile safe modals, no pinch/horizontal zoom, compact info controls */
html,
body {
  width: 100%;
  max-width: 100%;
  overflow-x: hidden;
  overscroll-behavior-x: none;
  touch-action: pan-y;
}
body.is-sorting {
  cursor: grabbing;
  overflow-x: hidden;
}
.app-shell,
main,
.tab-panel,
.clean-card,
.module-card,
.video-category,
.modal-card,
.editor-panel,
.settings-editor {
  max-width: 100%;
}
img,
svg,
video {
  max-width: 100%;
}
.daily-note-panel .icon-btn {
  cursor: pointer;
}
.weekday-grid + .edit-hint {
  margin-top: 9px;
}
.drag-ghost {
  position: fixed;
  z-index: 12000;
  pointer-events: none;
  opacity: 0.96;
  transform-origin: top left;
  border-color: rgba(14, 165, 233, 0.86) !important;
  box-shadow: 0 24px 60px rgba(0,0,0,0.44), 0 0 0 2px rgba(14, 165, 233, 0.18) !important;
  filter: saturate(1.08);
}
.dragging-placeholder {
  opacity: 0.24;
  border-color: rgba(14, 165, 233, 0.48) !important;
}
.sorting-active .sortable-item:not(.dragging-placeholder) {
  transition: transform 0.16s ease, margin 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}
.confirm-overlay {
  z-index: 13000;
  background: rgba(2, 6, 23, 0.52);
  backdrop-filter: blur(3px);
}
.confirm-card {
  width: min(100%, 420px);
  max-height: calc(100dvh - 40px);
}
.confirm-actions {
  justify-content: flex-start;
}
.info-gear-btn {
  flex: 0 0 auto;
}
.card-head .info-gear-btn svg {
  width: 22px;
  height: 22px;
}
.table-scroll table {
  min-width: 0;
}

@media (max-width: 760px) {
  body {
    padding: 10px;
  }
  .calendar-actions {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 8px;
  }
  .calendar-actions button {
    width: 100%;
    min-width: 0;
    padding-inline: 8px;
  }
  .modal-overlay {
    align-items: start;
    overflow-y: auto;
    padding: 10px;
  }
  .modal-card {
    max-height: none;
    overflow: visible;
    padding-bottom: 14px;
  }
  .sticky-actions {
    position: static;
    margin: 14px 0 0;
    padding: 12px;
    border: 1px solid rgba(148, 163, 184, 0.18);
    border-radius: 14px;
    background: rgba(2, 6, 23, 0.36);
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .sticky-actions > * {
    min-width: 0;
    width: 100%;
  }
  .sticky-actions > .danger-btn {
    grid-column: span 1;
  }
  .table-scroll {
    overflow-x: hidden;
  }
  .table-scroll table,
  .table-scroll thead,
  .table-scroll tbody,
  .table-scroll tr,
  .table-scroll td {
    display: block;
    width: 100%;
    min-width: 0;
  }
  .table-scroll thead {
    display: none;
  }
  .table-scroll tr {
    border: 1px solid rgba(148, 163, 184, 0.16);
    border-radius: 14px;
    padding: 8px;
    margin-bottom: 10px;
    background: rgba(2, 6, 23, 0.24);
  }
  .table-scroll td {
    border-bottom: 1px solid rgba(148, 163, 184, 0.10);
    padding: 7px 0;
    display: grid;
    grid-template-columns: 74px minmax(0, 1fr);
    gap: 8px;
    align-items: start;
  }
  .table-scroll td:last-child {
    border-bottom: 0;
  }
  .table-scroll td::before {
    content: attr(data-label);
    color: var(--muted);
    font-weight: 500;
  }
  .card-head {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }
  .card-head .info-gear-btn {
    justify-self: end;
  }
  .drag-ghost {
    max-width: calc(100vw - 20px);
  }
}


/* V12.0.6: daily journal as a real sortable module, mobile date format, mobile topbar fix */
.daily-note-panel textarea {
  min-height: 132px;
}
.date-picker-field {
  position: relative;
  display: grid;
  gap: 6px;
}
.date-picker-field input[type="date"] {
  color: transparent;
  caret-color: transparent;
  direction: ltr;
  text-align: left;
  padding-inline-end: 44px;
}
.date-picker-field input[type="date"]::-webkit-datetime-edit,
.date-picker-field input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.date-picker-field input[type="date"]::-webkit-datetime-edit-text,
.date-picker-field input[type="date"]::-webkit-datetime-edit-day-field,
.date-picker-field input[type="date"]::-webkit-datetime-edit-month-field,
.date-picker-field input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent;
}
.date-picker-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0.9;
  cursor: pointer;
}
.date-display {
  position: absolute;
  right: 12px;
  left: 44px;
  bottom: 11px;
  min-height: 22px;
  display: flex;
  align-items: center;
  color: var(--text);
  pointer-events: none;
  direction: ltr;
  text-align: right;
  justify-content: flex-end;
}
.date-picker-field input[type="date"]:focus + .date-display {
  color: var(--accent-2);
}
#openDatePickerBtn {
  white-space: nowrap;
}
@media (max-width: 760px) {
  .topbar {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .top-actions {
    margin-top: 0;
    flex: 0 0 auto;
    justify-content: flex-start;
  }
  .brand-row.compact {
    min-width: 0;
  }
  .brand-row.compact > div:last-child {
    min-width: 0;
  }
  .brand-row.compact h1 {
    font-size: 20px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  #logoutBtn {
    min-height: 36px;
    padding: 7px 11px;
    white-space: nowrap;
  }
  #openDatePickerBtn {
    white-space: normal;
  }
}


/* V12.0.7: locked module active switch, disabled-field dimming, current-day label, date icon alignment */
.module-settings-panel .module-dim-field {
  transition: opacity 0.18s ease, filter 0.18s ease, background-color 0.18s ease;
}
.module-settings-panel.module-settings-disabled .module-dim-field {
  opacity: 0.46;
  filter: saturate(0.45) brightness(0.72);
}
.module-settings-panel.module-settings-disabled .module-dim-field input,
.module-settings-panel.module-settings-disabled .module-dim-field textarea,
.module-settings-panel.module-settings-disabled .module-dim-field select,
.module-settings-panel.module-settings-disabled .weekday-pill span {
  background-color: rgba(2, 6, 23, 0.78);
  border-color: rgba(71, 85, 105, 0.38);
}
.switch-line {
  width: 132px;
  min-width: 132px;
  max-width: 132px;
  justify-content: flex-start !important;
  align-self: end;
}
.switch-track {
  flex: 0 0 52px;
}
.switch-text {
  display: inline-block;
  width: 38px;
  min-width: 38px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.date-picker-field input[type="date"] {
  position: relative;
  z-index: 2;
  padding-inline-start: 44px;
  padding-inline-end: 12px;
}
.date-picker-field input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 0;
  width: 36px;
  height: 36px;
  margin: 0;
  cursor: pointer;
}
.date-display {
  right: 12px;
  left: 48px;
  z-index: 3;
  pointer-events: none;
  direction: ltr;
  unicode-bidi: plaintext;
  text-align: right;
  justify-content: flex-end;
}
.date-calendar-icon {
  position: absolute;
  left: 13px;
  bottom: 12px;
  z-index: 3;
  width: 19px;
  height: 19px;
  border: 1.8px solid var(--accent-2);
  border-radius: 5px;
  pointer-events: none;
  opacity: 0.95;
}
.date-calendar-icon::before {
  content: "";
  position: absolute;
  top: 4px;
  left: 2px;
  right: 2px;
  height: 1.8px;
  background: var(--accent-2);
  opacity: 0.8;
}
.date-calendar-icon::after {
  content: "";
  position: absolute;
  top: -4px;
  left: 4px;
  width: 9px;
  height: 5px;
  border-left: 1.8px solid var(--accent-2);
  border-right: 1.8px solid var(--accent-2);
}
#openDatePickerBtn .date-picker-btn-text {
  direction: ltr;
  unicode-bidi: plaintext;
}
@media (max-width: 760px) {
  .switch-line {
    width: 132px;
    min-width: 132px;
    max-width: 132px;
  }
  .module-editor-top {
    align-items: start;
  }
}

/* V12.0.8: clean main rows, date picker inline desktop/mobile, disabled rows dim */
.task-row .row-inline-edit { display: none !important; }
.rows-settings-panel.module-settings-disabled {
  opacity: 0.54;
  filter: saturate(0.45) brightness(0.72);
  transition: opacity 0.18s ease, filter 0.18s ease;
}
.rows-settings-panel.module-settings-disabled .row-editor-card {
  background: rgba(2, 6, 23, 0.74);
  border-color: rgba(71, 85, 105, 0.38);
}
.date-picker-field {
  display: grid !important;
  grid-template-columns: minmax(92px, auto) minmax(160px, 1fr) 28px;
  align-items: center;
  column-gap: 10px;
  min-height: 48px;
  cursor: pointer;
}
.date-picker-field .date-label-text {
  grid-column: 1;
  line-height: 1.1;
  white-space: nowrap;
}
.date-picker-field input[type="date"] {
  grid-column: 2 / 4;
  grid-row: 1;
  position: relative;
  width: 100%;
  min-height: 44px;
  padding-inline-start: 44px !important;
  padding-inline-end: 12px !important;
}
.date-picker-field .date-display {
  grid-column: 2;
  grid-row: 1;
  position: relative !important;
  inset: auto !important;
  z-index: 4;
  min-height: 44px;
  justify-content: flex-end;
  pointer-events: none;
  padding-inline-end: 2px;
}
.date-picker-field .date-calendar-icon {
  grid-column: 3;
  grid-row: 1;
  position: relative !important;
  inset: auto !important;
  justify-self: start;
  z-index: 4;
  pointer-events: none;
}
@media (max-width: 760px) {
  .date-picker-field {
    grid-template-columns: minmax(86px, auto) minmax(0, 1fr) 28px;
    column-gap: 8px;
  }
  .date-picker-field .date-label-text { font-size: 13px; }
}


/* V12.0.9: final clean clickable date field */
.date-picker-field {
  position: relative !important;
  display: flex !important;
  flex-direction: row !important;
  direction: rtl !important;
  align-items: center !important;
  gap: 10px !important;
  min-height: 58px !important;
  width: 100% !important;
  padding: 0 14px 0 50px !important;
  border: 1px solid rgba(14, 165, 233, 0.55) !important;
  border-radius: 14px !important;
  background: rgba(2, 6, 23, 0.62) !important;
  color: var(--text) !important;
  overflow: hidden !important;
  cursor: pointer !important;
  user-select: none !important;
  box-shadow: inset 0 0 0 1px rgba(2, 132, 199, 0.08) !important;
}
.date-picker-field:hover {
  border-color: rgba(56, 189, 248, 0.9) !important;
  background: rgba(2, 6, 23, 0.78) !important;
}
.date-picker-field:focus-within,
.date-picker-field:focus {
  border-color: rgba(56, 189, 248, 0.95) !important;
  box-shadow: 0 0 0 3px rgba(14, 165, 233, 0.16), inset 0 0 0 1px rgba(56, 189, 248, 0.12) !important;
}
.date-picker-field .date-label-text {
  flex: 0 0 auto !important;
  min-width: auto !important;
  white-space: nowrap !important;
  font-size: 14px !important;
  line-height: 1 !important;
  color: #dbeafe !important;
  font-weight: 500 !important;
  margin: 0 !important;
  align-self: center !important;
}
.date-picker-field .date-display {
  position: static !important;
  inset: auto !important;
  flex: 1 1 auto !important;
  min-width: 0 !important;
  min-height: auto !important;
  height: auto !important;
  display: block !important;
  padding: 0 !important;
  margin: 0 !important;
  line-height: 1 !important;
  color: var(--text) !important;
  text-align: right !important;
  direction: ltr !important;
  unicode-bidi: plaintext !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  pointer-events: none !important;
  z-index: 2 !important;
}
.date-picker-field .date-calendar-icon {
  position: absolute !important;
  left: 16px !important;
  top: 50% !important;
  right: auto !important;
  bottom: auto !important;
  transform: translateY(-50%) !important;
  z-index: 2 !important;
  width: 19px !important;
  height: 19px !important;
  margin: 0 !important;
  pointer-events: none !important;
}
.date-picker-field input[type="date"] {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  min-height: 100% !important;
  max-width: none !important;
  padding: 0 !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: inherit !important;
  background: transparent !important;
  color: transparent !important;
  caret-color: transparent !important;
  opacity: 0 !important;
  z-index: 3 !important;
  cursor: pointer !important;
}
.date-picker-field input[type="date"]::-webkit-datetime-edit,
.date-picker-field input[type="date"]::-webkit-datetime-edit-fields-wrapper,
.date-picker-field input[type="date"]::-webkit-datetime-edit-text,
.date-picker-field input[type="date"]::-webkit-datetime-edit-day-field,
.date-picker-field input[type="date"]::-webkit-datetime-edit-month-field,
.date-picker-field input[type="date"]::-webkit-datetime-edit-year-field {
  color: transparent !important;
}
.date-picker-field input[type="date"]::-webkit-calendar-picker-indicator {
  position: absolute !important;
  inset: 0 !important;
  width: 100% !important;
  height: 100% !important;
  padding: 0 !important;
  margin: 0 !important;
  opacity: 0 !important;
  cursor: pointer !important;
}
.module-settings-panel .form-grid {
  align-items: start !important;
}
@media (min-width: 761px) {
  .date-picker-field {
    min-height: 60px !important;
  }
}
@media (max-width: 760px) {
  .date-picker-field {
    min-height: 58px !important;
    padding-right: 12px !important;
    padding-left: 48px !important;
    gap: 8px !important;
  }
  .date-picker-field .date-label-text,
  .date-picker-field .date-display {
    font-size: 14px !important;
  }
}

/* V12.0.10: custom mobile-style date picker, same UI on desktop and mobile */
.mobile-date-overlay {
  position: fixed;
  inset: 0;
  z-index: 13000;
  display: grid;
  place-items: center;
  padding: 16px;
  background: rgba(2, 6, 23, 0.64);
  backdrop-filter: blur(10px);
  direction: ltr;
  text-align: left;
}
.mobile-date-card {
  width: min(100%, 520px);
  min-height: min(760px, calc(100vh - 32px));
  display: grid;
  grid-template-rows: auto auto 1fr auto;
  gap: 22px;
  padding: 34px 30px 28px;
  border: 1px solid rgba(125, 211, 252, 0.20);
  border-radius: 38px;
  background:
    radial-gradient(circle at 78% 8%, rgba(34, 197, 94, 0.18), transparent 16%),
    radial-gradient(circle at 20% 50%, rgba(14, 165, 233, 0.10), transparent 42%),
    linear-gradient(180deg, rgba(15, 23, 42, 0.97), rgba(2, 12, 27, 0.96));
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.56), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
  color: var(--text);
  overflow: hidden;
}
.mobile-date-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}
.mobile-date-title {
  border: 0;
  background: transparent;
  color: #f8fafc;
  padding: 0;
  min-height: 0;
  font-size: clamp(27px, 5vw, 38px);
  line-height: 1;
  font-weight: 700;
  letter-spacing: -0.02em !important;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  box-shadow: none;
}
.mobile-date-title-chevron {
  color: #7db7ff;
  font-size: 1.18em;
  line-height: 0.8;
}
.mobile-date-nav {
  display: flex;
  align-items: center;
  gap: 26px;
}
.mobile-date-arrow {
  width: 48px;
  height: 48px;
  min-height: 48px;
  border: 0;
  border-radius: 18px;
  background: transparent;
  position: relative;
  padding: 0;
  box-shadow: none;
}
.mobile-date-arrow::before {
  content: "";
  position: absolute;
  inset: 11px 14px;
  border-top: 6px solid #f8fafc;
  border-left: 6px solid #f8fafc;
  border-radius: 3px 0 0 0;
}
.mobile-date-arrow.prev::before { transform: rotate(-45deg); }
.mobile-date-arrow.next::before { transform: rotate(135deg); }
.mobile-date-weekdays,
.mobile-date-grid {
  display: grid;
  grid-template-columns: repeat(7, minmax(0, 1fr));
  align-items: center;
  justify-items: center;
}
.mobile-date-weekdays {
  gap: 10px;
  color: rgba(226, 232, 240, 0.66);
  font-size: clamp(16px, 3vw, 22px);
  font-weight: 700;
  letter-spacing: 0.04em !important;
  text-transform: uppercase;
}
.mobile-date-grid {
  gap: clamp(8px, 1.8vw, 16px) clamp(10px, 2vw, 18px);
  align-content: start;
}
.mobile-date-empty,
.mobile-date-day {
  width: clamp(42px, 8.5vw, 62px);
  height: clamp(42px, 8.5vw, 62px);
}
.mobile-date-day {
  min-height: 0;
  border: 0;
  border-radius: 999px;
  display: grid;
  place-items: center;
  padding: 0;
  background: transparent;
  color: #f8fafc;
  font-size: clamp(24px, 5.2vw, 36px);
  font-weight: 400;
  line-height: 1;
  box-shadow: none;
}
.mobile-date-day:hover {
  background: rgba(125, 211, 252, 0.12);
}
.mobile-date-day.today:not(.selected) {
  outline: 1px solid rgba(125, 211, 252, 0.36);
  color: #bfdbfe;
}
.mobile-date-day.selected {
  background: #7cb7ff;
  color: #f8fbff;
  box-shadow: 0 14px 32px rgba(96, 165, 250, 0.32);
}
.mobile-date-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-top: 8px;
}
.mobile-date-reset {
  min-width: 116px;
  min-height: 70px;
  border: 0;
  border-radius: 999px;
  background: rgba(31, 41, 55, 0.62);
  color: #f8fafc;
  padding: 0 26px;
  font-size: clamp(24px, 4vw, 32px);
  font-weight: 600;
  box-shadow: none;
}
.mobile-date-apply {
  width: 78px;
  height: 78px;
  min-height: 78px;
  border: 0;
  border-radius: 999px;
  background: #7cb7ff;
  color: rgba(236, 253, 245, 0.96);
  padding: 0;
  font-size: 50px;
  line-height: 1;
  font-weight: 300;
  box-shadow: 0 14px 36px rgba(96, 165, 250, 0.34);
}
@media (max-width: 760px) {
  .mobile-date-overlay { padding: 10px; }
  .mobile-date-card {
    width: min(100%, 460px);
    min-height: min(680px, calc(100vh - 20px));
    border-radius: 34px;
    padding: 28px 20px 22px;
    gap: 18px;
  }
  .mobile-date-nav { gap: 18px; }
  .mobile-date-arrow { width: 44px; height: 44px; min-height: 44px; }
  .mobile-date-empty,
  .mobile-date-day {
    width: clamp(38px, 11vw, 56px);
    height: clamp(38px, 11vw, 56px);
  }
  .mobile-date-reset { min-height: 62px; min-width: 106px; }
  .mobile-date-apply { width: 68px; height: 68px; min-height: 68px; font-size: 44px; }
}
@media (max-width: 390px) {
  .mobile-date-card { padding-inline: 14px; }
  .mobile-date-weekdays { font-size: 14px; }
  .mobile-date-grid { gap: 8px 6px; }
  .mobile-date-empty,
  .mobile-date-day {
    width: 36px;
    height: 36px;
  }
  .mobile-date-day { font-size: 22px; }
}


/* V12.0.11: compact custom date picker, about 35-45% smaller */
.mobile-date-overlay {
  padding: 12px;
}
.mobile-date-card {
  width: min(100%, 360px);
  min-height: auto;
  gap: 13px;
  padding: 22px 20px 18px;
  border-radius: 26px;
  box-shadow: 0 20px 54px rgba(0, 0, 0, 0.52), inset 0 0 0 1px rgba(255, 255, 255, 0.025);
}
.mobile-date-head {
  gap: 12px;
}
.mobile-date-title {
  font-size: clamp(21px, 3.6vw, 28px);
  gap: 6px;
}
.mobile-date-nav {
  gap: 14px;
}
.mobile-date-arrow {
  width: 36px;
  height: 36px;
  min-height: 36px;
  border-radius: 14px;
}
.mobile-date-arrow::before {
  inset: 9px 11px;
  border-top-width: 4px;
  border-left-width: 4px;
  border-radius: 2px 0 0 0;
}
.mobile-date-weekdays {
  gap: 6px;
  font-size: clamp(12px, 2vw, 15px);
  letter-spacing: 0.035em !important;
}
.mobile-date-grid {
  gap: 7px 6px;
}
.mobile-date-empty,
.mobile-date-day {
  width: clamp(32px, 5vw, 42px);
  height: clamp(32px, 5vw, 42px);
}
.mobile-date-day {
  font-size: clamp(18px, 3.2vw, 25px);
}
.mobile-date-day.selected {
  box-shadow: 0 10px 22px rgba(96, 165, 250, 0.30);
}
.mobile-date-actions {
  gap: 10px;
  padding-top: 4px;
}
.mobile-date-reset {
  min-width: 82px;
  min-height: 48px;
  padding: 0 18px;
  font-size: clamp(17px, 2.6vw, 21px);
}
.mobile-date-apply {
  width: 54px;
  height: 54px;
  min-height: 54px;
  font-size: 35px;
  box-shadow: 0 10px 25px rgba(96, 165, 250, 0.32);
}
@media (max-width: 760px) {
  .mobile-date-overlay { padding: 8px; }
  .mobile-date-card {
    width: min(100%, 360px);
    min-height: auto;
    border-radius: 24px;
    padding: 20px 16px 16px;
    gap: 12px;
  }
  .mobile-date-nav { gap: 12px; }
  .mobile-date-arrow { width: 34px; height: 34px; min-height: 34px; }
  .mobile-date-empty,
  .mobile-date-day {
    width: clamp(31px, 9vw, 40px);
    height: clamp(31px, 9vw, 40px);
  }
  .mobile-date-reset { min-height: 46px; min-width: 78px; }
  .mobile-date-apply { width: 52px; height: 52px; min-height: 52px; font-size: 33px; }
}
@media (max-width: 390px) {
  .mobile-date-card {
    width: min(100%, 330px);
    padding: 18px 12px 14px;
    gap: 10px;
  }
  .mobile-date-title { font-size: 20px; }
  .mobile-date-weekdays { font-size: 11px; }
  .mobile-date-grid { gap: 6px 4px; }
  .mobile-date-empty,
  .mobile-date-day {
    width: 30px;
    height: 30px;
  }
  .mobile-date-day { font-size: 18px; }
  .mobile-date-reset { min-height: 42px; min-width: 72px; font-size: 16px; }
  .mobile-date-apply { width: 48px; height: 48px; min-height: 48px; font-size: 31px; }
}

/* V12.0.13 wellness score and icon layer */
.wellness-panel {
  overflow: hidden;
}
.wellness-head .module-title {
  pointer-events: none;
}
.wellness-body {
  padding-top: 14px;
}
.wellness-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
.wellness-field {
  min-width: 0;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.26);
  padding: 10px;
  color: #dbeafe;
  font-weight: 500;
}
.wellness-field > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.wellness-field input[type="number"] {
  min-height: 38px;
  padding: 7px 9px;
  background: rgba(15, 23, 42, 0.72);
}
.sleep-duration-inputs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.sleep-duration-inputs input {
  min-width: 0;
}
.range-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 34px;
  align-items: center;
  gap: 8px;
}
.range-line input[type="range"] {
  min-height: 34px;
  padding: 0;
  accent-color: var(--accent);
}
.range-line strong {
  color: var(--accent-2);
  text-align: center;
  font-weight: 700;
}
.history-wellness-list li::marker {
  color: var(--accent-2);
}
@media (max-width: 900px) {
  .wellness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .wellness-grid { grid-template-columns: 1fr; }
  .wellness-head { align-items: flex-start; }
}

/* V12.0.14 wellness metric icon/editor refinement */
.metric-card {
  position: relative;
  min-height: 92px;
  padding: 16px 18px 16px 72px;
  display: grid;
  align-content: center;
  gap: 5px;
}
.metric-card .metric-label {
  display: block;
  color: var(--muted);
  font-weight: 500;
  padding: 0;
}
.metric-card .metric-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 44px;
  height: 44px;
  border-radius: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #7dd3fc;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.2), rgba(37, 99, 235, 0.08));
  border: 1px solid rgba(56, 189, 248, 0.34);
  box-shadow: 0 0 26px rgba(14, 165, 233, 0.18);
  font-style: normal;
  line-height: 1;
  font-weight: 800;
  letter-spacing: -0.03em;
}
.metric-card .metric-icon svg {
  width: 30px;
  height: 30px;
  display: block;
}
.metric-card .metric-check {
  font-size: 34px;
}
.metric-card .metric-zzz {
  font-size: 15px;
  letter-spacing: -0.08em;
}
.metric-card .metric-wellness {
  font-size: 30px;
}
.wellness-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.wellness-gear-btn svg {
  width: 22px;
  height: 22px;
}
.wellness-panel.wellness-editing {
  border-color: rgba(56, 189, 248, 0.48);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12), 0 18px 42px rgba(14, 165, 233, 0.08);
}
.wellness-panel.wellness-editing .wellness-field {
  border-color: rgba(56, 189, 248, 0.34);
}
@media (max-width: 760px) {
  .metric-card {
    min-height: 84px;
    padding: 14px 14px 14px 64px;
  }
  .metric-card .metric-icon {
    left: 14px;
    width: 40px;
    height: 40px;
    border-radius: 14px;
  }
  .metric-card .metric-icon svg {
    width: 27px;
    height: 27px;
  }
  .metric-card .metric-check { font-size: 31px; }
  .metric-card .metric-zzz { font-size: 14px; }
  .metric-card .metric-wellness { font-size: 28px; }
}

/* V12.0.15 wellness settings and metric reorder */
.wellness-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
  margin-bottom: 12px;
}
.wellness-strip-chip {
  min-width: 0;
  border: 1px solid rgba(56, 189, 248, 0.18);
  border-radius: 13px;
  background: linear-gradient(135deg, rgba(14, 165, 233, 0.12), rgba(15, 23, 42, 0.42));
  padding: 8px 10px;
}
.wellness-strip-chip span {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}
.wellness-strip-chip strong {
  display: block;
  color: #dbeafe;
  font-size: 16px;
  font-weight: 700;
  margin-top: 2px;
}
.wellness-field-card {
  position: relative;
  display: block;
  transition: transform 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.wellness-input-label {
  display: grid;
  gap: 8px;
  min-width: 0;
}
.wellness-field .wellness-input-label > span {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.wellness-drag-handle {
  display: none;
  position: absolute;
  top: 8px;
  left: 8px;
  width: 30px;
  height: 30px;
  min-height: 30px;
  padding: 0;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 10px;
  background: rgba(15, 23, 42, 0.86);
  color: var(--accent-2);
  cursor: grab;
  touch-action: none;
  z-index: 2;
}
.wellness-drag-handle svg {
  width: 22px;
  height: 22px;
  display: block;
  margin: auto;
}
.wellness-reorder-mode .wellness-drag-handle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.wellness-reorder-mode .wellness-field-card {
  padding-left: 44px;
  border-color: rgba(56, 189, 248, 0.32);
  background: rgba(14, 165, 233, 0.08);
}
.wellness-move-btn.active {
  border-color: rgba(56, 189, 248, 0.52);
  background: rgba(14, 165, 233, 0.18);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12), 0 0 22px rgba(14, 165, 233, 0.16);
}
.wellness-settings-list {
  display: grid;
  gap: 10px;
}
.wellness-settings-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  align-items: center;
  gap: 10px;
  padding: 11px;
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 14px;
  background: rgba(2, 6, 23, 0.28);
}
.wellness-settings-row strong {
  color: #e0f2fe;
  font-weight: 700;
}
.wellness-settings-row p {
  margin: 3px 0 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.settings-toggle {
  min-width: 68px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  padding: 8px 9px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  border-radius: 999px;
  background: rgba(15, 23, 42, 0.62);
  color: #dbeafe;
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}
.settings-toggle input {
  width: 16px;
  height: 16px;
  min-height: 16px;
  accent-color: var(--accent);
}
@media (max-width: 900px) {
  .wellness-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .wellness-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 7px; }
  .wellness-settings-row { grid-template-columns: minmax(0, 1fr); align-items: stretch; }
  .settings-toggle { justify-content: flex-start; width: 100%; }
}


/* V12.0.16 wiki video header controls, mobile metrics 2-up, collapsible wellness */
.wellness-head .module-title {
  pointer-events: auto;
}
.wellness-closed .wellness-move-btn {
  opacity: 0.72;
}
.video-category-head {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 10px;
}
.video-category-title {
  min-width: 0;
  text-align: right;
}
.video-category-title small {
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
  white-space: nowrap;
}
.video-head-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}
.video-head-actions .icon-btn {
  width: 42px;
  height: 42px;
  border-radius: 14px;
}
.video-view-btn.active {
  border-color: rgba(56, 189, 248, 0.62);
  background: rgba(14, 165, 233, 0.18);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.12), 0 0 22px rgba(14, 165, 233, 0.14);
}
.video-delete-category {
  color: #fecdd3;
  border-color: rgba(244, 63, 94, 0.36);
  background: rgba(127, 29, 29, 0.18);
}
.video-toolbar {
  display: none !important;
}
.video-list.list {
  grid-template-columns: 1fr;
}
.video-list.list .video-card {
  grid-template-columns: 96px minmax(0, 1fr) auto;
  align-items: center;
}
.video-list.list .video-preview {
  aspect-ratio: 1 / 1;
  min-height: 88px;
}
.video-list.list .video-actions {
  min-width: 130px;
  flex-direction: column;
}
@media (max-width: 760px) {
  .metrics-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  .metric-card {
    min-height: 118px;
    padding: 14px 12px 14px 54px;
    align-content: center;
  }
  .metric-card .metric-icon {
    left: 10px;
    width: 36px;
    height: 36px;
    border-radius: 13px;
  }
  .metric-card .metric-icon svg {
    width: 24px;
    height: 24px;
  }
  .metric-card strong {
    font-size: clamp(24px, 7.2vw, 33px);
  }
  .metric-card .metric-label {
    font-size: 15px;
  }
  .metric-card .metric-check { font-size: 28px; }
  .metric-card .metric-zzz { font-size: 12px; }
  .metric-card .metric-wellness { font-size: 25px; }
  .video-category-head {
    padding: 11px 12px;
    gap: 8px;
  }
  .video-head-actions {
    gap: 6px;
  }
  .video-head-actions .icon-btn {
    width: 38px;
    height: 38px;
    border-radius: 13px;
  }
  .video-category-title {
    gap: 7px;
  }
  .video-category-title small {
    font-size: 12px;
  }
  .video-list.list .video-card {
    grid-template-columns: 76px minmax(0, 1fr);
  }
  .video-list.list .video-preview {
    min-height: 72px;
  }
  .video-list.list .video-actions {
    grid-column: 1 / -1;
    min-width: 0;
    flex-direction: row;
  }
}
@media (max-width: 380px) {
  .video-category-title small {
    display: none;
  }
  .video-head-actions .icon-btn {
    width: 34px;
    height: 34px;
  }
}

/* V12.0.17 wellness/video cleanup */
.wellness-strip { display: none !important; }
.wellness-grid { overflow: visible; }
.wellness-reorder-mode #wellnessGrid { cursor: grabbing; }
.wellness-reorder-mode .wellness-field-card {
  will-change: transform;
  transition: transform 0.18s ease, opacity 0.18s ease, border-color 0.18s ease, background 0.18s ease;
}
.wellness-reorder-mode .wellness-drag-handle {
  display: inline-flex !important;
  align-items: center;
  justify-content: center;
}
.wellness-field-card.dragging-placeholder {
  opacity: 0.28;
  background: rgba(14, 165, 233, 0.16);
}
.sleep-duration-field input[data-wellness-sleep-duration] {
  direction: ltr;
  text-align: center;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.03em;
}
.wellness-settings-row {
  grid-template-columns: minmax(0, 1fr) auto;
}
.video-category,
.video-category-body,
.video-list,
.video-card,
.video-preview {
  min-width: 0;
  box-sizing: border-box;
}
.video-category {
  overflow: hidden;
}
.video-category-body {
  overflow: hidden;
}
.video-list.grid {
  width: 100%;
  overflow: hidden;
}
.video-card {
  overflow: hidden;
  max-width: 100%;
}
.video-card > div:not(.video-preview):not(.video-actions) {
  min-width: 0;
  overflow: hidden;
}
.video-card strong,
.video-meta,
.video-fallback-creator,
.video-fallback-badge {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.video-actions {
  min-width: 0;
}
.video-actions .primary-btn,
.video-actions .danger-btn {
  min-width: 0;
}
.drag-ghost {
  animation: dragLift 0.12s ease-out both;
}
@keyframes dragLift {
  from { opacity: 0.76; transform: scale(0.98); }
  to { opacity: 0.98; transform: scale(1.02); }
}
@media (max-width: 760px) {
  .wellness-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .wellness-settings-row { grid-template-columns: minmax(0, 1fr); }
  .video-list.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .video-list.grid .video-card { padding: 10px; }
  .video-list.grid .video-preview { aspect-ratio: 4 / 5; min-height: 0; }
  .video-list.grid .video-actions { gap: 8px; }
}


/* V12.0.18: modal header lock, stable footer actions, smoother DnD, video thumbnail containment */
.modal-card {
  padding: 0 !important;
  overflow: auto;
  max-height: min(92dvh, calc(100vh - 32px));
  overscroll-behavior: contain;
}
.modal-card > :not(.modal-head):not(.sticky-actions) {
  margin-left: 16px;
  margin-right: 16px;
}
.modal-head {
  position: sticky;
  top: 0;
  z-index: 5;
  margin: 0 !important;
  padding: 14px 16px;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.98), rgba(15, 23, 42, 0.94));
  border-bottom: 1px solid rgba(148, 163, 184, 0.18);
  backdrop-filter: blur(10px);
}
.sticky-actions {
  position: sticky;
  bottom: 0 !important;
  z-index: 4;
  margin: 16px 0 0 !important;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom)) !important;
  background: linear-gradient(180deg, rgba(15, 23, 42, 0.94), #0f172a 42%);
  border-top: 1px solid rgba(148, 163, 184, 0.22);
  box-shadow: 0 -12px 30px rgba(2, 6, 23, 0.36);
}
.confirm-card > p { margin: 16px; }
.drag-ghost {
  opacity: 0.98;
  transform-origin: top left;
  transition: opacity 90ms ease, box-shadow 90ms ease !important;
  animation: none !important;
}
.drag-ghost-drop { opacity: 0; }
.dragging-placeholder {
  opacity: 0.18 !important;
  transform: scale(0.985);
  transition: opacity 120ms ease, transform 120ms ease;
}
.sorting-active .sortable-item:not(.dragging-placeholder),
.sorting-active .wellness-field-card:not(.dragging-placeholder) {
  transition: transform 180ms ease, border-color 160ms ease, box-shadow 160ms ease, background 160ms ease !important;
}
.video-list.grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
  align-items: stretch;
}
.video-list.grid .video-card {
  width: 100%;
  min-width: 0;
  contain: layout paint;
}
.video-info { min-width: 0; overflow: hidden; }
.instagram-embed-preview {
  background: radial-gradient(circle at 50% 25%, rgba(14, 165, 233, 0.18), rgba(8, 47, 73, 0.34) 45%, rgba(2, 6, 23, 0.92));
  overflow: hidden;
}
.instagram-embed-preview iframe {
  width: 100%;
  height: 150%;
  border: 0;
  transform: scale(1.18) translateY(-8%);
  transform-origin: top center;
  pointer-events: none;
  background: transparent;
}
@media (max-width: 760px) {
  .modal-overlay { align-items: center; padding: 10px; }
  .modal-card { width: min(100%, 720px); max-height: calc(100dvh - 28px); }
  .modal-card > :not(.modal-head):not(.sticky-actions) { margin-left: 12px; margin-right: 12px; }
  .modal-head { padding: 12px; }
  .sticky-actions { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .video-list.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .video-card strong { font-size: 15px; }
  .video-actions .primary-btn, .video-actions .danger-btn { padding-inline: 8px; }
}

/* V12.0.19 polish: uniform video buttons, 3-up desktop, safer mobile grid, wellness dnd */
.video-list.grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  padding: 0;
  width: 100%;
  max-width: 100%;
  overflow: hidden;
}
.video-list.grid .video-card {
  width: 100%;
  min-width: 0;
  max-width: 100%;
}
.video-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.video-actions .primary-btn,
.video-actions .danger-btn,
.video-actions .compact-btn {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  padding: 9px 10px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  white-space: nowrap;
}
.video-actions .danger-btn {
  background: rgba(127, 29, 29, 0.18);
  border-color: rgba(244, 63, 94, 0.38);
  color: #fecdd3;
}
.video-player-modal {
  display: grid;
  gap: 12px;
}
.video-player-modal iframe {
  width: min(860px, 100%);
  aspect-ratio: 16 / 9;
  min-height: 260px;
  border: 1px solid rgba(56, 189, 248, 0.22);
  border-radius: 18px;
  background: #020617;
}
.video-player-modal.instagram-player iframe {
  aspect-ratio: 9 / 14;
  min-height: min(72vh, 680px);
}
.wellness-reorder-mode .wellness-field-card {
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.wellness-reorder-mode .wellness-field-card:active {
  cursor: grabbing;
}
.wellness-reorder-mode .wellness-field-card input {
  pointer-events: none;
}
.wellness-reorder-mode .wellness-field-card.dragging-placeholder {
  opacity: 0.22;
  outline: 1px dashed rgba(56, 189, 248, 0.55);
}
.wellness-body .wellness-grid {
  margin-top: 8px;
}
.sleep-duration-field input[data-wellness-sleep-duration] {
  direction: ltr !important;
  text-align: center !important;
}
@media (max-width: 980px) {
  .video-list.grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .video-category-body {
    padding: 10px;
    overflow: hidden;
  }
  .video-list.grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    overflow: hidden;
  }
  .video-list.grid .video-card {
    padding: 8px;
    border-radius: 16px;
  }
  .video-preview {
    aspect-ratio: 9 / 11;
  }
  .video-info strong {
    font-size: clamp(14px, 4vw, 18px);
  }
  .video-actions {
    gap: 7px;
  }
  .video-actions .primary-btn,
  .video-actions .danger-btn,
  .video-actions .compact-btn {
    min-height: 38px;
    padding: 8px 6px;
    font-size: 14px;
  }
  .wellness-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
    gap: 10px;
  }
  .wellness-field-card[data-sort-id="weight"],
  .wellness-field-card[data-sort-id="restingHr"] {
    grid-column: auto;
  }
}
@media (max-width: 390px) {
  .video-category-body { padding: 8px; }
  .video-list.grid { gap: 8px; }
  .video-actions { grid-template-columns: 1fr; }
}

/* V12.0.19 info editor button consistency */
.info-edit-list .admin-row {
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
}
.info-edit-list .row-controls {
  display: grid;
  grid-template-columns: repeat(2, minmax(72px, 1fr));
  gap: 8px;
  align-items: center;
}
.info-edit-list .row-controls .small-btn,
.info-edit-list .row-controls .danger-btn {
  width: 100%;
  min-width: 0;
  min-height: 42px;
  border-radius: 14px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
@media (max-width: 560px) {
  .info-edit-list .admin-row {
    grid-template-columns: minmax(0, 1fr);
  }
  .info-edit-list .row-controls {
    width: 100%;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* V12.0.20 focused wellness drag fix: keep baseline video-wellness-polish and repair wellness DnD only */
.wellness-reorder-mode .wellness-field-card {
  position: relative;
  cursor: grab;
  touch-action: none;
  user-select: none;
  transition: transform 180ms ease, opacity 180ms ease, border-color 180ms ease, background 180ms ease, box-shadow 180ms ease;
}
.wellness-reorder-mode .wellness-field-card:active { cursor: grabbing; }
.wellness-reorder-mode .wellness-field-card input,
.wellness-reorder-mode .wellness-field-card label,
.wellness-reorder-mode .wellness-field-card .range-line {
  pointer-events: none;
}
.wellness-reorder-mode .wellness-drag-handle {
  display: inline-flex !important;
  position: absolute;
  left: 10px;
  top: 10px;
  width: 34px;
  height: 34px;
  align-items: center;
  justify-content: center;
  border-radius: 12px;
  border: 1px solid rgba(56, 189, 248, 0.34);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: 0 0 18px rgba(14, 165, 233, 0.12);
  cursor: grab;
  touch-action: none;
  z-index: 4;
}
.wellness-reorder-mode .wellness-drag-handle:active { cursor: grabbing; }
.wellness-reorder-mode .wellness-field-card.dragging-placeholder {
  opacity: 0.22;
  outline: 1px dashed rgba(56, 189, 248, 0.7);
  background: rgba(14, 165, 233, 0.12);
  box-shadow: inset 0 0 0 1px rgba(56, 189, 248, 0.18);
}
.drag-ghost.wellness-field-card,
.drag-ghost .wellness-field-card {
  pointer-events: none;
}
.drag-ghost {
  position: fixed !important;
  z-index: 99999 !important;
  pointer-events: none !important;
  opacity: 0.92;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.42), 0 0 0 1px rgba(56, 189, 248, 0.35), 0 0 28px rgba(14, 165, 233, 0.20) !important;
  transition: opacity 90ms ease, transform 90ms ease;
}

/* V12.0.21: smoother stable DnD for wellness cards */
.sorting-active .wellness-field-card:not(.dragging-placeholder),
.sorting-active .sortable-item:not(.dragging-placeholder) {
  transition: transform 220ms cubic-bezier(.2,.8,.2,1), border-color 160ms ease, box-shadow 160ms ease, background 160ms ease !important;
}
.wellness-reorder-mode .wellness-field-card {
  touch-action: none !important;
  user-select: none !important;
  -webkit-user-select: none !important;
  will-change: transform;
}
.wellness-reorder-mode .wellness-drag-handle {
  touch-action: none !important;
  -webkit-tap-highlight-color: transparent;
}
.drag-ghost {
  transition: opacity 140ms ease, box-shadow 140ms ease !important;
  will-change: transform;
}
.drag-ghost-drop {
  opacity: 0 !important;
  transition: opacity 140ms ease, transform 140ms cubic-bezier(.2,.8,.2,1) !important;
}
.dragging-placeholder {
  opacity: 0.20 !important;
  transform: scale(0.985);
}
@media (max-width: 760px) {
  .sorting-active .wellness-field-card:not(.dragging-placeholder) {
    transition: transform 240ms cubic-bezier(.2,.8,.2,1), border-color 160ms ease, box-shadow 160ms ease, background 160ms ease !important;
  }
  .drag-ghost {
    opacity: 0.94 !important;
    box-shadow: 0 18px 44px rgba(0,0,0,0.42), 0 0 0 1px rgba(56,189,248,0.38), 0 0 22px rgba(14,165,233,0.22) !important;
  }
}

/* V12.0.22: mobile wellness DnD animation fix */
.wellness-field-card.dnd-animating,
.sortable-item.dnd-animating {
  will-change: transform;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}
.wellness-reorder-mode .wellness-field-card.dragging-placeholder {
  min-height: var(--dnd-placeholder-height, auto);
  transform: scale(0.985);
}
@media (max-width: 760px) {
  .wellness-reorder-mode #wellnessGrid {
    touch-action: none;
    overflow: visible;
  }
  .wellness-reorder-mode .wellness-field-card {
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
    transition: transform 260ms cubic-bezier(.18,.82,.22,1), opacity 160ms ease, border-color 160ms ease, background 160ms ease, box-shadow 160ms ease !important;
  }
  .wellness-reorder-mode .wellness-field-card.dnd-animating {
    transition: transform 260ms cubic-bezier(.18,.82,.22,1) !important;
  }
  .drag-ghost.wellness-field-card {
    transform-origin: top left;
    will-change: transform;
    -webkit-transform: translateZ(0);
  }
}
