:root {
  --bg: #f4f5f9;
  --card: #ffffff;
  --text: #1f2430;
  --muted: #7b8194;
  --border: #e5e7ef;
  --accent: #4f6bed;
  --accent-soft: #e8ecff;
  --danger: #e5484d;
  --radius: 16px;
  --surface-2: #fafbfe;
  --teal-hover: #cdeeed;
  --teal-faint: #f0fbfa;
  --teal-line: #b9e3e1;
  --accent-hover: #d9e0ff;
  --faint: #c2c6d4;
  --danger-soft: #fdecec;
  --paper-bg: #e7e9ee;
  --today: #0f9d9a;
  --today-faint: #f0fbfa;
  color-scheme: light;
}

/* ---------- Night mode: same names, darker values ---------- */
:root[data-theme="dark"] {
  --bg: #0b0b0b;
  --card: #161616;
  --text: #ececec;
  --muted: #9a9a9a;
  --border: #2a2a2a;
  --accent: #c4c4c4;
  --accent-soft: #2a2a2a;
  --danger: #ff6b70;
  --surface-2: #1c1c1c;
  --teal-hover: #303030;
  --teal-faint: #1a1a1a;
  --teal-line: #343434;
  --today: #4a4a4a;
  --today-faint: #323232;
  --accent-hover: #363636;
  --faint: #4a4a4a;
  --danger-soft: #301c1e;
  --paper-bg: #080808;
  --teal: #d0d0d0;
  --teal-fill: #3a3a3a;
  --teal-soft: #262626;
  color-scheme: dark;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
}

.dashboard {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 24px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
  align-items: start;
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: 0 2px 10px rgba(30, 36, 60, 0.04);
}

.muted { color: var(--muted); font-size: 0.9rem; }

/* ---------- Tasks ---------- */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.panel-header h1 { font-size: 1.6rem; }

.task-form {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 16px;
}
.task-form input[type="text"] { flex: 1 1 180px; min-width: 0; }
.task-note {
  margin: -6px 0 12px;
  font-size: 0.85rem;
  color: var(--teal);
}
.task-note[hidden] { display: none; }
.task-form input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface-2);
}
.task-form input:focus {
  outline: 2px solid var(--accent-soft);
  border-color: var(--accent);
}

.primary-btn, .ghost-btn, .icon-btn {
  font: inherit;
  cursor: pointer;
  border-radius: 10px;
  border: 1px solid transparent;
  transition: background 0.15s, transform 0.05s;
}
.primary-btn { background: var(--teal-fill, var(--teal)); color: #fff; padding: 10px 18px; }
.primary-btn:hover { background: #0b7f7c; }
.ghost-btn { background: var(--accent-soft); color: var(--accent); padding: 8px 14px; font-size: 0.85rem; }
.ghost-btn:hover { background: var(--accent-hover); }
.ghost-btn[hidden] { display: none; }

#task-progress { margin-bottom: 12px; }

.task-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.task-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: var(--card);
}
.task-item input[type="checkbox"] {
  width: 18px; height: 18px;
  accent-color: var(--accent);
  cursor: pointer;
  flex-shrink: 0;
}
.task-text { flex: 1; word-break: break-word; }
.task-time {
  font-size: 0.8rem;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 8px;
  border-radius: 20px;
  flex-shrink: 0;
}
.task-item.done .task-text { text-decoration: line-through; color: var(--muted); }
.task-item.done .task-time { color: var(--muted); background: var(--bg); }

.delete-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1.2rem;
  cursor: pointer;
  line-height: 1;
}
.delete-btn:hover { color: var(--danger); }

.empty-state { text-align: center; color: var(--muted); padding: 32px 0; }
.empty-state[hidden] { display: none; }

/* ---------- Calendar ---------- */
.side-panel { display: flex; flex-direction: column; gap: 24px; }

.calendar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}
.calendar-header h2 { font-size: 1.1rem; }

.icon-btn {
  background: var(--bg);
  width: 32px; height: 32px;
  font-size: 1.3rem;
  line-height: 1;
}
.icon-btn:hover { background: var(--accent-soft); }

.weekdays, .calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  text-align: center;
}
.weekdays { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.calendar-grid { gap: 4px; }

.day {
  position: relative;
  aspect-ratio: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 10px;
  font-size: 0.9rem;
  cursor: pointer;
  border: none;
  background: none;
  font-family: inherit;
  color: var(--text);
}
.day:hover { background: var(--accent-soft); }
.day.other-month { color: var(--faint); }
.day.today { background: var(--teal-fill, var(--teal)); color: #fff; font-weight: 600; }
.day.selected:not(.today) { outline: 2px solid var(--accent); }
.day.has-tasks::after {
  content: "";
  position: absolute;
  bottom: 5px;
  width: 5px; height: 5px;
  border-radius: 50%;
  background: var(--accent);
}
.day.today.has-tasks::after { background: #fff; }

/* ---------- Top bar ---------- */
:root {
  --teal: #0f9d9a;
  --teal-soft: #e0f5f4;
  --topbar-h: 60px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-h);
  background: var(--teal-fill, var(--teal));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  box-shadow: 0 2px 8px rgba(15, 157, 154, 0.25);
}

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-title { font-size: 1.25rem; font-weight: 600; letter-spacing: 0.2px; }

/* Three-dash menu button */
.menu-btn {
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  transition: background 0.15s;
}
.menu-btn:hover { background: rgba(255, 255, 255, 0.18); }
.menu-btn span {
  display: block;
  width: 22px;
  height: 2.5px;
  background: #fff;
  border-radius: 2px;
}

/* Profile */
.profile-name { font-weight: 500; }

.avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, 0.7);
  background: rgba(255, 255, 255, 0.25);
  color: #fff;
  font: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  overflow: hidden;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}
.avatar:hover { border-color: #fff; }
.avatar img { width: 100%; height: 100%; object-fit: cover; }

/* ---------- Sidebar ---------- */
.layout { display: flex; min-height: calc(100vh - var(--topbar-h)); }
.layout .dashboard { flex: 1; min-width: 0; margin: 0 auto; }

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--card);
  border-right: 1px solid var(--teal-line);
  overflow-x: hidden;
  overflow-y: auto;
  /* stays in place while the page scrolls */
  position: sticky;
  top: var(--topbar-h);
  align-self: flex-start;
  height: calc(100vh - var(--topbar-h));
}
/* Only animate after the person clicks the menu button, never while the page loads */
.sidebar.animate { transition: width 0.25s ease; }
.sidebar.collapsed { width: 64px; } /* a slim bar of icons stays visible */

.sidebar-inner {
  width: 100%;
  min-width: 64px;
  padding: 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--teal);
  text-decoration: none;
  font-weight: 500;
}
.nav-item:hover { background: var(--teal-soft); }
.nav-item.active { background: var(--teal-fill, var(--teal)); color: #fff; }

/* ---------- Pages / Resources ---------- */
.layout .page {
  flex: 1;
  min-width: 0;
  max-width: 1200px;
  margin: 0 auto;
  padding: 32px 24px;
}
.view[hidden] { display: none; }

.page-header { margin-bottom: 24px; }
.page-header h1 { font-size: 1.6rem; margin-bottom: 4px; }

.back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 16px;
  padding: 5px 14px 5px 11px;
  border-radius: 20px;
  color: var(--teal);
  background: var(--teal-soft);
  box-shadow: 0 0 14px rgba(15, 157, 154, 0.22);
  text-decoration: none;
  font-weight: 500;
  transition: box-shadow 0.15s, background 0.15s;
}
.back-link::before { content: "<"; font-weight: 700; }
.back-link:hover, .back-link:focus-visible { background: var(--teal-hover); box-shadow: 0 0 18px rgba(15, 157, 154, 0.38); text-decoration: none; outline: none; }

.resource-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 24px;
}

.resource-card {
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-height: 200px;
  color: inherit;
  text-decoration: none;
  transition: transform 0.15s, box-shadow 0.15s, border-color 0.15s;
}
.resource-card:hover {
  transform: translateY(-3px);
  border-color: var(--teal);
  box-shadow: 0 8px 20px rgba(15, 157, 154, 0.15);
}
.resource-card h2 { font-size: 1.2rem; }

.resource-icon {
  width: 52px;
  height: 52px;
  border-radius: 14px;
  background: var(--teal-soft);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.6rem;
}

.soon-tag {
  margin-top: auto;
  align-self: flex-start;
  font-size: 0.75rem;
  color: var(--muted);
  background: var(--bg);
  padding: 3px 10px;
  border-radius: 20px;
}

@media (max-width: 1000px) {
  .resource-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ---------- File pages ---------- */
.drop-zone {
  border: 2px dashed var(--border);
  background: var(--surface-2);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  padding: 32px 24px;
  margin-bottom: 24px;
  color: var(--muted);
  transition: border-color 0.15s, background 0.15s;
}
.drop-zone.dragover { border-color: var(--teal); background: var(--teal-soft); }
.drop-zone .primary-btn { background: var(--teal-fill, var(--teal)); }
.drop-zone .primary-btn:hover { background: #0b7f7c; }

.file-list { list-style: none; display: flex; flex-direction: column; gap: 8px; }

.file-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
}

.file-icon {
  width: 42px;
  height: 42px;
  flex-shrink: 0;
  border-radius: 10px;
  background: var(--teal-soft);
  color: var(--teal);
  font-size: 0.7rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

.file-info { flex: 1; min-width: 0; }

.file-name {
  display: block;
  max-width: 100%;
  padding: 0;
  border: none;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--text);
  text-align: left;
  cursor: pointer;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.file-name:hover { color: var(--teal); text-decoration: underline; }

.file-meta { font-size: 0.8rem; color: var(--muted); }

.file-actions { display: flex; align-items: center; gap: 6px; }
.file-actions .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.file-actions .ghost-btn:hover { background: var(--teal-hover); }

/* ---------- Folders ---------- */
.files-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 16px;
}
.files-toolbar .ghost-btn,
.folder-form .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.files-toolbar .ghost-btn:hover,
.folder-form .ghost-btn:hover { background: var(--teal-hover); }

.breadcrumb {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  margin-top: 6px;
  font-size: 0.95rem;
}
.breadcrumb[hidden] { display: none; }
.crumb {
  padding: 2px 8px;
  border: none;
  border-radius: 6px;
  background: none;
  font: inherit;
  color: var(--teal);
  cursor: pointer;
}
.crumb:hover { background: var(--teal-soft); }
.crumb.current { color: var(--text); font-weight: 600; cursor: default; }
.crumb.dragover { background: var(--teal-soft); outline: 2px dashed var(--teal); }
.crumb-sep { color: var(--muted); }

.folder-form {
  display: flex;
  gap: 8px;
  padding: 14px 16px;
  margin-bottom: 16px;
}
.folder-form[hidden] { display: none; }
.folder-form input {
  flex: 1;
  min-width: 0;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface-2);
}
.folder-form input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.folder-form .primary-btn { background: var(--teal-fill, var(--teal)); }
.folder-form .primary-btn:hover { background: #0b7f7c; }

.folder-grid {
  list-style: none;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}
.folder-grid:empty { display: none; }

.folder-card {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s, background 0.15s;
}
.folder-card:hover { border-color: var(--teal); }
.folder-card.dragover {
  background: var(--teal-soft);
  border-color: var(--teal);
  border-style: dashed;
}
.folder-card .delete-btn { padding: 0 14px; align-self: stretch; }

.folder-main {
  flex: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border: none;
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
  cursor: pointer;
}
.folder-icon { font-size: 1.6rem; flex-shrink: 0; }
.folder-text { min-width: 0; display: flex; flex-direction: column; }
.folder-name {
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.folder-meta { font-size: 0.8rem; color: var(--muted); }

.file-item[draggable="true"] { cursor: grab; }
.file-item.dragging { opacity: 0.5; }

/* ---------- Sign-in, roles ---------- */
.booting .layout, .booting .topbar-right { visibility: hidden; }
.boot-error { padding: 32px; text-align: center; color: var(--danger); }
.boot-error[hidden] { display: none; }

/* Edit controls are hidden for view-only accounts (the server refuses their edits anyway) */
body:not(.is-admin) .admin-only { display: none !important; }

.role-pill {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 10px;
  border-radius: 20px;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
}
.role-pill[hidden] { display: none; }

.logout-btn-unused {
  font: inherit;
  font-size: 0.85rem;
  color: #fff;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 10px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s;
}
.logout-btn-unused:hover { background: rgba(255, 255, 255, 0.18); }

@media (max-width: 480px) {
  .topbar { padding: 0 12px; }
  .topbar-right { gap: 10px; }
  .role-pill { display: none; } /* no room on a narrow phone; view-only accounts simply have no edit controls */
}

.rename-btn {
  background: none;
  border: none;
  color: var(--muted);
  font-size: 1rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 4px;
  align-self: stretch;
}
.rename-btn:hover { color: var(--teal); }

.login-wrap {
  min-height: calc(100vh - var(--topbar-h));
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 400px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.login-card[hidden] { display: none; }
.login-card h1 { font-size: 1.5rem; }
.login-card code { background: var(--bg); padding: 1px 6px; border-radius: 6px; }
.login-card .primary-btn { width: 100%; }
.field { display: flex; flex-direction: column; gap: 6px; font-size: 0.9rem; color: var(--muted); }
.field input {
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
}
.field input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.form-error { color: var(--danger); font-size: 0.9rem; min-height: 1.2em; text-align: center; }
.login-card .form-error { text-align: left; }

/* ---------- Compact calendar ---------- */
.dashboard { grid-template-columns: 1fr 260px; }
.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.calendar.card { padding: 14px; }
.calendar-header { margin-bottom: 10px; }
.calendar-header h2 { font-size: 0.95rem; }
.calendar .icon-btn { width: 28px; height: 28px; font-size: 1.1rem; }
.weekdays { font-size: 0.68rem; margin-bottom: 4px; }
.calendar-grid { gap: 2px; }
.day { font-size: 0.78rem; border-radius: 8px; }
.day.has-tasks::after { bottom: 3px; width: 4px; height: 4px; }

/* ---------- Timer module (a square, as wide as the calendar) ---------- */
.timer-card {
  aspect-ratio: 1;
  container-type: inline-size;
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 12px;
  overflow: hidden;
}

.timer-tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--bg);
  flex-shrink: 0;
}
.timer-tab {
  flex: 1;
  min-width: 0;
  padding: 6px 2px;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.74rem;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.timer-tab:hover { color: var(--teal); }
.timer-tab.active {
  background: var(--card);
  color: var(--teal);
  box-shadow: 0 1px 3px rgba(30, 36, 60, 0.12);
}
.timer-tab:focus-visible, .tool-btn:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.timer-panel {
  position: relative;
  flex: 1;
  min-height: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}
.timer-panel[hidden] { display: none; }

/* Pop-out (and, for admins, settings) icons in the top right of the panel */
.timer-tools { position: absolute; top: 0; right: 0; display: flex; gap: 2px; z-index: 1; }
.tool-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 8px;
  background: none;
  color: var(--muted);
  cursor: pointer;
}
.tool-btn svg { width: 16px; height: 16px; }
.tool-btn:hover { background: var(--teal-soft); color: var(--teal); }

.timer-label {
  height: 28px;
  display: flex;
  align-items: center;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}

.timer-display {
  flex: 1;
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.timer-time {
  font-size: 2.4rem;
  font-size: 17cqw;
  font-weight: 600;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.timer-time.long { font-size: 2rem; font-size: 12.5cqw; }
.timer-time[hidden] { display: none; }
.timer-sub { font-size: 0.8rem; color: var(--muted); min-height: 1.2em; text-align: center; }

.timer-panel[data-phase="rest"] .timer-label,
.timer-panel[data-phase="rest"] .timer-time { color: #c2410c; }

.timer-buttons { display: flex; gap: 8px; width: 100%; }
.timer-buttons .primary-btn { flex: 1; padding: 9px 0; }
.timer-buttons .ghost-btn { background: var(--teal-soft); color: var(--teal); padding: 9px 14px; font-size: 0.9rem; }
.timer-buttons .ghost-btn:hover { background: var(--teal-hover); }

/* Timer time fields */
.tm-inputs { display: flex; align-items: center; gap: 3px; font-size: 1.7rem; font-weight: 600; }
.tm-inputs[hidden] { display: none; }
.tm-inputs input {
  width: 3.1ch;
  padding: 6px 0;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface-2);
  font: inherit;
  text-align: center;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}
.tm-inputs input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }

/* Pomodoro settings (covers the pomodoro panel) */
.timer-settings {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 6px;
  padding-top: 4px;
  background: var(--card);
}
.timer-settings[hidden] { display: none; }
.timer-settings h3 { font-size: 0.9rem; }
.settings-row { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.timer-settings .field { font-size: 0.78rem; }
.timer-settings .field input { padding: 7px 8px; width: 100%; }
.timer-settings .form-error { text-align: left; min-height: 1.1em; font-size: 0.78rem; }

/* ---------- Pop-out window ---------- */
.popout-body {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 100vh;
  padding: 10px 18px;
  background: var(--card);
  overflow: hidden;
}
.popout-time-wrap { min-width: 0; }
.popout-title {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--teal);
}
.popout-time {
  font-size: 2.6rem;
  font-weight: 600;
  line-height: 1.1;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.popout-btn { flex-shrink: 0; width: 64px; height: 56px; padding: 0; display: flex; align-items: center; justify-content: center; border-radius: 14px; }
.popout-btn:disabled { opacity: 0.5; cursor: default; }
.popout-body[data-phase="rest"] .popout-title,
.popout-body[data-phase="rest"] .popout-time { color: #c2410c; }
.popout-status {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 4px;
  font-size: 0.7rem;
  color: var(--danger);
}
.popout-status[hidden] { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 800px) {
  .dashboard { grid-template-columns: 1fr; }
  .side-panel { order: -1; width: 100%; max-width: 340px; margin: 0 auto; }

  /* Sidebar slides over the page on small screens */
  .sidebar {
    position: fixed;
    top: var(--topbar-h);
    bottom: 0;
    left: 0;
    z-index: 15;
    height: auto;
    box-shadow: 4px 0 16px rgba(30, 36, 60, 0.12);
  }
  .sidebar.collapsed { box-shadow: none; }
  .profile-name { display: none; }
  .resource-grid { grid-template-columns: 1fr; }
}

/* ---------- Top bar: title link and account drop-down ---------- */
a.app-title { color: #fff; text-decoration: none; border-radius: 8px; padding: 2px 6px; margin-left: -6px; }
a.app-title:hover { background: rgba(255, 255, 255, 0.18); }
a.app-title:focus-visible, .avatar:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.profile-menu { position: relative; }
.dropdown {
  position: absolute;
  right: 0;
  top: calc(100% + 10px);
  min-width: 170px;
  padding: 6px;
  background: var(--card);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(30, 36, 60, 0.18);
  z-index: 30;
}
.dropdown[hidden] { display: none; }
.dropdown-item {
  display: block;
  width: 100%;
  padding: 9px 12px;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  color: var(--text);
  text-align: left;
  text-decoration: none;
  cursor: pointer;
}
.dropdown-item:hover, .dropdown-item:focus-visible { background: var(--teal-soft); color: var(--teal); outline: none; }

/* ---------- Dashboard: tasks + notes column ---------- */
.main-col { min-width: 0; display: flex; flex-direction: column; gap: 24px; }

.date-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 8px 2px 0;
  border: none;
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.9rem;
  color: var(--muted);
  cursor: pointer;
}
.date-btn:hover, .date-btn:focus-visible { color: var(--teal); outline: none; }
.date-btn:focus-visible { box-shadow: 0 0 0 2px var(--teal-soft); }
.date-input-hidden { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.panel-header > div { position: relative; }

.task-tabs { display: flex; gap: 4px; margin: 4px 0 14px; border-bottom: 1px solid var(--border); }
.task-tab {
  padding: 8px 14px;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  background: none;
  font: inherit;
  font-weight: 500;
  color: var(--muted);
  cursor: pointer;
}
.task-tab:hover { color: var(--teal); }
.task-tab.active { color: var(--teal); border-bottom-color: var(--teal); }
.task-tab:focus-visible { outline: 2px solid var(--teal-soft); border-radius: 8px 8px 0 0; }
.task-tab .count {
  display: inline-block;
  min-width: 1.5em;
  margin-left: 4px;
  padding: 0 6px;
  border-radius: 20px;
  background: var(--bg);
  font-size: 0.75rem;
  text-align: center;
}
.task-tab.active .count { background: var(--teal-soft); }

.task-item { transition: opacity 0.18s, transform 0.18s; }
.task-item.leaving { opacity: 0; transform: translateX(14px); }
.task-item input[type="checkbox"] { accent-color: var(--teal); }
.task-body { flex: 1; min-width: 0; }
.task-body .task-text { display: block; color: var(--text); text-decoration: none; word-break: break-word; }
.task-body .task-text:hover { color: var(--teal); text-decoration: underline; }
.task-item.done .task-body .task-text { text-decoration: line-through; color: var(--muted); }
.task-item { cursor: pointer; }
.task-desc {
  margin-top: 2px;
  font-size: 0.82rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.task-time { color: var(--teal); background: var(--teal-soft); }
.task-item.done .task-time { color: var(--muted); background: var(--bg); }
.day.has-tasks::after { background: var(--teal-fill, var(--teal)); }
.day.today.has-tasks::after { background: #fff; }
.day.has-done:not(.has-tasks)::after {
  content: "";
  position: absolute;
  bottom: 3px;
  width: 4px; height: 4px;
  border-radius: 50%;
  background: var(--border);
}
.day.selected:not(.today) { outline-color: var(--teal); }
.day:hover { background: var(--teal-soft); }

/* ---------- Notes ---------- */
.notes-panel.card { padding: 24px; }
.notes-panel .panel-header { align-items: baseline; margin-bottom: 14px; }
.notes-panel h2 { font-size: 1.2rem; }
.note-form { display: flex; flex-direction: column; align-items: flex-end; gap: 8px; margin-bottom: 8px; }
.note-form textarea, .note-edit textarea, .task-detail textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  color: var(--text);
  background: var(--surface-2);
  resize: vertical;
}
.note-form textarea:focus, .note-edit textarea:focus, .task-detail textarea:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.notes-panel .form-error { text-align: left; min-height: 0; }
.note-list { list-style: none; display: flex; flex-direction: column; gap: 10px; margin-top: 8px; }
.note-item { padding: 12px 14px; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.note-text { white-space: pre-wrap; word-break: break-word; }
.note-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  font-size: 0.78rem;
  color: var(--muted);
}
.note-actions { display: flex; gap: 12px; }
.link-btn { border: none; background: none; font: inherit; font-size: 0.8rem; color: var(--teal); cursor: pointer; padding: 0; }
.link-btn:hover { text-decoration: underline; }
.link-btn.danger { color: var(--danger); }
.note-edit { display: flex; flex-direction: column; gap: 8px; }
.note-edit .form-error { text-align: left; min-height: 0; }
.note-edit-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.note-edit .ghost-btn, .task-detail .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.note-edit .ghost-btn:hover, .task-detail .ghost-btn:hover { background: var(--teal-hover); }

/* ---------- Task page ---------- */
.task-detail { max-width: 720px; display: flex; flex-direction: column; gap: 16px; padding: 24px; }
.task-detail[hidden] { display: none; }
.detail-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.detail-top h1 { font-size: 1.4rem; }
.detail-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.task-detail .field input { width: 100%; }
.status-pill { font-size: 0.78rem; font-weight: 600; padding: 3px 12px; border-radius: 20px; background: var(--bg); color: var(--muted); white-space: nowrap; }
.status-pill.done { background: var(--teal-soft); color: var(--teal); }
.form-message { min-height: 1.2em; font-size: 0.9rem; color: var(--muted); }
.form-message.ok { color: var(--teal); }
.form-message.error { color: var(--danger); }
.detail-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.task-detail .ghost-btn.danger { background: var(--danger-soft); color: var(--danger); }
.task-detail .ghost-btn.danger:hover { background: var(--danger-soft); }
.empty-card { max-width: 720px; display: flex; flex-direction: column; align-items: flex-start; gap: 14px; }
.link-as-btn { display: inline-block; text-decoration: none; border-radius: 10px; font-size: 0.95rem; }

/* ---------- Profile page ---------- */
.profile-card { max-width: 720px; display: flex; align-items: center; gap: 20px; padding: 24px; }
.avatar-large { width: 88px; height: 88px; font-size: 1.8rem; flex-shrink: 0; cursor: default; background: var(--teal-fill, var(--teal)); border-color: var(--teal-soft); }
.profile-card h2 { font-size: 1.3rem; }
.profile-card .ghost-btn { margin-top: 12px; background: var(--teal-soft); color: var(--teal); }
.profile-soon { margin-top: 16px; }

@media (max-width: 800px) {
  .main-col { order: 0; }
}
@media (max-width: 480px) {
  .detail-row { grid-template-columns: 1fr; }
  .profile-card { flex-direction: column; text-align: center; }
  .notes-panel.card { padding: 18px; }
}

/* ---------- Public (not signed in) view ---------- */
.is-public .auth-only { display: none !important; }
.signin-link {
  color: #fff;
  text-decoration: none;
  font-size: 0.9rem;
  padding: 6px 14px;
  border: 1px solid rgba(255, 255, 255, 0.7);
  border-radius: 10px;
}
.signin-link:hover { background: rgba(255, 255, 255, 0.18); }
.signin-link[hidden] { display: none; }

/* ---------- Arranging tasks ---------- */
.drag-handle {
  flex-shrink: 0;
  width: 18px;
  padding: 6px 0;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--border);
  font-size: 0.9rem;
  line-height: 0.7;
  letter-spacing: -3px;
  cursor: grab;
  touch-action: none;       /* lets a finger drag the row instead of scrolling the page */
  user-select: none;
}
.task-item:hover .drag-handle, .drag-handle:focus-visible { color: var(--muted); }
.drag-handle:hover { color: var(--teal); }
.drag-handle:focus-visible { outline: 2px solid var(--teal); }
.task-item.dragging {
  cursor: grabbing;
  background: var(--teal-soft);
  border-color: var(--teal);
  box-shadow: 0 6px 18px rgba(15, 157, 154, 0.25);
  transition: none;
}
.task-item.dragging .drag-handle { cursor: grabbing; color: var(--teal); }
@media (hover: none) { .drag-handle { color: var(--muted); } }

/* ---------- Round time chooser ---------- */
.time-field { position: relative; display: inline-flex; align-items: center; }
.time-field input { padding-right: 38px; width: 100%; }
.time-field input::-webkit-calendar-picker-indicator { display: none; }
.task-form .time-field { flex: 0 1 150px; }
.task-detail .time-field { display: flex; }
.time-btn {
  position: absolute;
  right: 4px;
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--teal);
  cursor: pointer;
}
.time-btn:hover, .time-btn:focus-visible { background: var(--teal-soft); outline: none; }

.clock-overlay {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(30, 36, 60, 0.35);
}
.clock-overlay[hidden] { display: none; }
.clock-dialog {
  width: 288px;
  max-width: 100%;
  padding: 18px;
  background: var(--card);
  border-radius: 18px;
  box-shadow: 0 16px 48px rgba(30, 36, 60, 0.3);
}
.clock-head { display: flex; align-items: center; justify-content: center; gap: 4px; margin-bottom: 14px; }
.clock-colon { font-size: 2.4rem; font-weight: 600; line-height: 1; color: var(--muted); }
.clock-part {
  width: 76px;
  padding: 6px 0;
  border: none;
  border-radius: 12px;
  background: var(--bg);
  font: inherit;
  font-size: 2.4rem;
  font-weight: 600;
  line-height: 1.1;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  cursor: pointer;
}
.clock-part.active { background: var(--teal-soft); color: var(--teal); }
.clock-ampm { display: flex; flex-direction: column; gap: 4px; margin-left: 8px; }
.clock-ap {
  padding: 5px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  background: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}
.clock-ap.active { background: var(--teal-fill, var(--teal)); border-color: var(--teal); color: #fff; }

.clock-face {
  position: relative;
  width: 224px;
  height: 224px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: var(--bg);
  touch-action: none;
  user-select: none;
  cursor: pointer;
}
.clock-face:focus-visible { outline: 2px solid var(--teal); outline-offset: 3px; }
.clock-center { position: absolute; left: 50%; top: 50%; width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--teal-fill, var(--teal)); }
.clock-hand {
  position: absolute;
  left: 50%;
  top: 24px;           /* centre (112) minus hand length (88) */
  width: 2px;
  height: 88px;
  margin-left: -1px;
  background: var(--teal-fill, var(--teal));
  transform-origin: 50% 100%;
  pointer-events: none;
}
.clock-knob {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  border-radius: 50%;
  background: var(--teal-fill, var(--teal));
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
}
.clock-labels { position: absolute; inset: 0; pointer-events: none; }
.clock-num {
  position: absolute;
  width: 36px;
  height: 36px;
  margin: -18px 0 0 -18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  color: var(--text);
  z-index: 1;
}
.clock-num.on { color: #fff; }
.clock-knob.odd { z-index: 2; }
.clock-foot { display: flex; align-items: center; gap: 8px; }
.clock-spacer { flex: 1; }
.clock-foot .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.clock-foot .primary-btn { padding: 8px 18px; }
.clock-foot .link-btn { font-size: 0.85rem; }

/* ---------- Resource boxes: icon-only tools and the add tile ---------- */
.resource-card { position: relative; }
.resource-link {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  color: inherit;
  text-decoration: none;
  border-radius: var(--radius);
}
.resource-link:focus-visible { outline: 2px solid var(--teal); outline-offset: 6px; }
.resource-card.editing:hover { transform: none; }

.card-tools { position: absolute; top: 12px; right: 12px; display: flex; gap: 2px; }
.card-tools[hidden] { display: none; }
.icon-action {
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, opacity 0.15s;
}
.icon-action:hover, .icon-action:focus-visible { background: var(--teal-soft); color: var(--teal); outline: none; }
.icon-action.danger:hover, .icon-action.danger:focus-visible { background: var(--danger-soft); color: var(--danger); }
.icon-action.ok { color: var(--teal); }
.icon-action:disabled { opacity: 0.5; cursor: default; }
/* On a mouse the icons stay quiet until you hover the box; on a touch screen they are always visible */
@media (hover: hover) {
  .card-tools { opacity: 0; transition: opacity 0.15s; }
  .resource-card:hover .card-tools, .card-tools:focus-within { opacity: 1; }
}

.add-tile {
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 2px dashed var(--border);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: none;
}
.add-tile:not(.editing):hover { border-color: var(--teal); box-shadow: none; transform: none; background: var(--teal-soft); }
.add-tile-btn {
  width: 100%;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: none;
  color: var(--teal);
  cursor: pointer;
  border-radius: var(--radius);
}
.add-tile-btn:focus-visible { outline: 2px solid var(--teal); }

.name-editor { width: 100%; display: flex; flex-direction: column; gap: 4px; }
.name-editor-row { display: flex; align-items: center; gap: 2px; }
.name-editor input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 10px;
  font: inherit;
  background: var(--surface-2);
}
.name-editor input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.name-editor .form-error { text-align: left; min-height: 0; }
.resource-link h2 { padding-right: 56px; word-break: break-word; }
.resource-card.editing .resource-link { width: 100%; }
.file-icon { cursor: pointer; }

/* ---------- Sort and Filter ---------- */
.task-tools { margin-left: auto; display: flex; align-items: center; gap: 6px; padding-bottom: 4px; }
.menu-wrap { position: relative; }
.tool-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--card);
  font: inherit;
  font-size: 0.85rem;
  color: var(--muted);
  cursor: pointer;
}
.tool-chip:hover, .tool-chip:focus-visible, .tool-chip[aria-expanded="true"] { color: var(--teal); border-color: var(--teal); outline: none; }
.tool-chip.on { color: var(--teal); background: var(--teal-soft); border-color: var(--teal-soft); }
.tool-chip.on::after {  /* a dot shows that something is switched on */
  content: "";
  position: absolute;
  top: -3px; right: -3px;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: var(--teal-fill, var(--teal));
  border: 2px solid var(--card);
}
.menu-wrap .dropdown { top: calc(100% + 6px); min-width: 200px; }
.dropdown-item.choice { position: relative; padding-left: 30px; }
.dropdown-item.choice[aria-checked="true"] { color: var(--teal); font-weight: 600; }
.dropdown-item.choice[aria-checked="true"]::before {
  content: "";
  position: absolute;
  left: 11px; top: 50%;
  width: 6px; height: 11px;
  margin-top: -7px;
  border: solid var(--teal);
  border-width: 0 2px 2px 0;
  transform: rotate(45deg);
}
.task-tabs { align-items: flex-end; flex-wrap: wrap; }
@media (max-width: 480px) {
  .chip-label { display: none; }          /* icons only on a phone */
  .tool-chip { padding: 7px 9px; }
  .task-tab { padding: 8px 8px; font-size: 0.9rem; }
}
@media (max-width: 480px) {
  .task-tabs { flex-wrap: nowrap; gap: 0; }
  .task-tab { padding: 8px 6px; font-size: 0.84rem; white-space: nowrap; }
  .task-tab .count { margin-left: 2px; padding: 0 5px; }
  .task-tools { gap: 4px; }
}

/* ======== Round 2: smaller tabs + views, icon-only tools, reminders, timer arrows, 4 tiles ======== */
.task-tabs { align-items: center; flex-wrap: nowrap; gap: 4px; margin: 2px 0 12px; padding-bottom: 0; }
.tab-strip { display: flex; align-items: flex-end; gap: 0; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab-strip::-webkit-scrollbar { display: none; }
.tab-item { position: relative; display: flex; align-items: center; flex-shrink: 0; }
.task-tab { padding: 6px 10px; font-size: 0.82rem; white-space: nowrap; }
.task-tab .count { margin-left: 3px; padding: 0 5px; min-width: 1.3em; font-size: 0.68rem; }
.tab-x {
  margin: 0 4px 0 -6px;
  width: 18px; height: 18px;
  display: flex; align-items: center; justify-content: center;
  border: none; border-radius: 50%;
  background: none;
  color: var(--muted);
  font-size: 0.95rem; line-height: 1;
  cursor: pointer;
  opacity: 0;
}
.tab-item:hover .tab-x, .tab-x:focus-visible, .tab-item:focus-within .tab-x { opacity: 1; }
.tab-x:hover { background: var(--danger-soft); color: var(--danger); }
@media (hover: none) { .tab-x { opacity: 1; } }
.tab-add {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border: 1px dashed var(--border);
  border-radius: 50%;
  background: none;
  color: var(--teal);
  cursor: pointer;
}
.tab-add:hover, .tab-add:focus-visible, .tab-add[aria-expanded="true"] { background: var(--teal-soft); border-color: var(--teal); outline: none; }
.task-tabs { border-bottom: 1px solid var(--border); }
.task-tab { margin-bottom: -1px; }
.task-tools { margin-left: auto; padding-bottom: 0; }
.tool-chip { padding: 6px; width: 32px; height: 32px; justify-content: center; }
.chip-label { display: none; }

.view-form { left: 0; right: auto; min-width: 250px; display: flex; flex-direction: column; gap: 10px; padding: 14px; }
.view-form[hidden] { display: none; }
.view-form h3 { font-size: 0.95rem; }
.view-form .field { font-size: 0.8rem; }
.view-form select, .view-form input {
  padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; color: var(--text); background: var(--surface-2);
}
.view-form select:focus, .view-form input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.view-form-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.view-form .ghost-btn { background: var(--teal-soft); color: var(--teal); }

.task-date-chip { font-size: 0.75rem; color: var(--muted); background: var(--bg); padding: 2px 8px; border-radius: 20px; flex-shrink: 0; }

@media (max-width: 480px) {
  .task-tab { padding: 6px 7px; font-size: 0.78rem; }
  .view-form { position: fixed; left: 16px; right: 16px; top: auto; min-width: 0; }
}

/* Reminders */
.reminders { position: fixed; right: 16px; bottom: 16px; z-index: 120; display: flex; flex-direction: column; gap: 8px; width: min(360px, calc(100vw - 32px)); }
.reminder {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
  background: var(--card);
  border: 1px solid var(--teal);
  border-left-width: 5px;
  border-radius: 12px;
  box-shadow: 0 10px 28px rgba(30, 36, 60, 0.25);
}
.reminder-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.reminder-text strong { font-size: 0.8rem; color: var(--teal); }
.reminder-text span { word-break: break-word; }
.reminder-buttons { display: flex; gap: 6px; flex-shrink: 0; }
.reminder .ghost-btn { background: var(--teal-soft); color: var(--teal); padding: 6px 10px; }

/* Timer arrows */
.tm-inputs { gap: 2px; align-items: center; }
.tm-col { display: flex; flex-direction: column; align-items: center; gap: 1px; }
.tm-col input { width: 3ch; font-size: 1.5rem; padding: 3px 0; }


/* Clock picker with seconds */
.clock-dialog { width: 330px; }
.clock-part { width: 62px; font-size: 1.9rem; }
.clock-colon { font-size: 1.9rem; }
.clock-ampm { margin-left: 6px; }

/* Resources: four tiles per row */
.resource-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.resource-card { min-height: 150px; gap: 10px; }
.resource-link { gap: 10px; }
.resource-card h2 { font-size: 1.02rem; }
.resource-icon { width: 44px; height: 44px; font-size: 1.35rem; border-radius: 12px; }
.add-tile { min-height: 150px; }
@media (max-width: 1100px) { .resource-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 860px) { .resource-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .resource-grid { gap: 12px; } .resource-card { min-height: 130px; } .add-tile { min-height: 130px; } }

.page-header-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.page-header-row .ghost-btn { background: var(--teal-soft); color: var(--teal); white-space: nowrap; }
.group-new { max-width: 420px; margin-bottom: 20px; }
.group-new[hidden] { display: none; }
.res-group { margin-bottom: 28px; }
.res-group-head { display: flex; align-items: center; gap: 6px; margin-bottom: 12px; padding-bottom: 8px; border-bottom: 1px solid var(--border); min-height: 42px; }
.res-group-head h2 { font-size: 1.05rem; font-weight: 600; }
.group-tools { display: flex; gap: 2px; }
.group-tools[hidden] { display: none; }
@media (hover: hover) {
  .group-tools { opacity: 0; transition: opacity 0.15s; }
  .res-group-head:hover .group-tools, .group-tools:focus-within { opacity: 1; }
}
.group-editor { max-width: 420px; }
.editor-extra { width: 100%; margin-top: 6px; padding: 8px 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--surface-2); }


/* ---------- Dragging tiles ---------- */
body.is-admin .resource-card[data-id] { cursor: grab; }
body.is-admin .resource-card[data-id] .resource-link { cursor: inherit; }
.resource-card.tile-dragging { opacity: 0.35; outline: 2px dashed var(--teal); outline-offset: -2px; transform: none !important; }
.tile-ghost {
  position: fixed;
  z-index: 200;
  margin: 0;
  pointer-events: none;
  opacity: 0.93;
  transform: rotate(2deg) scale(1.02) !important;
  box-shadow: 0 16px 36px rgba(30, 36, 60, 0.3);
}
.tile-ghost .card-tools { display: none; }
body.dragging-tile { user-select: none; -webkit-user-select: none; cursor: grabbing; }
body.dragging-tile .resource-card { cursor: grabbing; }
.res-group.drop-target .res-group-head { border-bottom-color: var(--teal); }
.res-group.drop-target > .resource-grid { background: rgba(15, 157, 154, 0.05); border-radius: var(--radius); }
.temp-loose .resource-grid { display: block; }
.drop-hint { padding: 22px; text-align: center; color: var(--muted); border: 2px dashed var(--border); border-radius: var(--radius); }
.temp-loose.drop-target .drop-hint { border-color: var(--teal); color: var(--teal); }

/* Time field: only the clock icon (and the chosen time, without seconds) */
.time-field input[type="time"] { position: absolute; opacity: 0; pointer-events: none; width: 1px; height: 1px; padding: 0; border: 0; }
.time-field { width: auto !important; flex: 0 0 auto !important; }
.time-field .time-btn { position: static; width: auto; min-width: 38px; height: 38px; padding: 0 10px; display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--border, #d5dde0); border-radius: 8px; background: var(--card); color: var(--teal); }
.time-field .time-label { font-size: 0.9rem; font-variant-numeric: tabular-nums; }
.time-field .time-btn:not(.has-time) .time-label { display: none; }

/* Smaller right-hand column on the dashboard */
.dashboard { grid-template-columns: 1fr 210px; }
.side-panel { gap: 14px; }
.calendar.card { padding: 10px; }
.calendar-header h2 { font-size: 0.85rem; }
.calendar .icon-btn { width: 24px; height: 24px; font-size: 1rem; }
.day { font-size: 0.7rem; border-radius: 6px; }
.weekdays { font-size: 0.62rem; }
.timer-card { padding: 9px; gap: 6px; }
.timer-tab { font-size: 0.68rem; padding: 5px 2px; }
.timer-buttons .primary-btn { padding: 7px 0; font-size: 0.85rem; }
.timer-buttons .ghost-btn { padding: 7px 10px; font-size: 0.82rem; }
.spotify-card.card { padding: 9px; gap: 6px; }
@media (max-width: 900px) { .side-panel { max-width: 260px; } }

/* Sort / filter: icons only, no boxes */
.tool-chip { border: none; background: none; padding: 6px; border-radius: 8px; }
.tool-chip:hover, .tool-chip:focus-visible, .tool-chip[aria-expanded="true"] { border: none; background: var(--teal-soft); }
.tool-chip.on { background: none; border: none; }
.tool-chip.on::after { top: 1px; right: 1px; }

/* ---------- Calendar page (full-page month: time across the top, dates on the right) ---------- */
.layout .page.cal-page { max-width: none; width: 100%; padding: 20px 20px 28px; }
.cal-top { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; }
.cal-top h1 { font-size: 1.5rem; }
.cal-nav { display: flex; align-items: center; gap: 8px; }
.cal-nav h2 { font-size: 1.05rem; min-width: 150px; text-align: center; }
.cal-help { margin: 6px 0 12px; font-size: 0.82rem; color: var(--muted); }
.cal-scroll {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  overflow: auto;
  max-height: calc(100vh - var(--topbar-h) - 150px);
}
.cal-grid {
  display: grid;
  grid-template-columns: 150px repeat(24, 84px) 76px;
  width: max-content;
  min-width: 100%;
}
.cal-h {
  position: sticky; top: 0; z-index: 3;
  padding: 9px 4px; text-align: center;
  font-size: 0.72rem; font-weight: 600; color: var(--muted);
  background: var(--card); border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
}
.cal-h.now { color: var(--teal); }
.cal-h-any { color: var(--teal); }
.cal-h-date { position: sticky; right: 0; z-index: 4; border-right: none; border-left: 1px solid var(--border); }
.cal-cell {
  min-height: 46px; padding: 3px;
  border-bottom: 1px solid var(--border); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; gap: 3px;
  cursor: cell;
}
.cal-cell.cal-any:hover { background: var(--teal-soft); }
.cal-cell.weekend { background: var(--surface-2); }
.cal-cell.today { background: var(--teal-faint); }
.cal-cell.over { background: var(--teal-soft); outline: 2px dashed var(--teal); outline-offset: -2px; }
.cal-any { background: var(--surface-2); }
.cal-date {
  position: sticky; right: 0; z-index: 2;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  background: var(--card); border-bottom: 1px solid var(--border); border-left: 1px solid var(--border);
  line-height: 1.15;
}
.cal-date strong { font-size: 1rem; }
.cal-date span { font-size: 0.68rem; color: var(--muted); text-transform: uppercase; }
.cal-date.weekend { background: var(--surface-2); }
.cal-date.today { background: var(--teal-fill, var(--teal)); color: #fff; }
.cal-date.today span { color: #fff; }
.cal-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 5px; border-radius: 6px;
  background: var(--teal-soft); color: var(--teal);
  font-size: 0.72rem; cursor: grab; min-width: 0;
}
.cal-chip.dragging { opacity: 0.4; }
.cal-chip.busy { opacity: 0.6; }
.cal-chip.done { background: var(--bg); color: var(--muted); }
.cal-chip.done .cal-chip-text { text-decoration: line-through; }
.cal-chip-text { color: inherit; text-decoration: none; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; flex: 1; }
.cal-chip-text:hover { text-decoration: underline; }
.cal-tick { flex: none; width: 12px; height: 12px; padding: 0; border: 1.5px solid currentColor; border-radius: 50%; background: none; cursor: pointer; }
.cal-chip.done .cal-tick { background: currentColor; }
.cal-add { position: fixed; inset: 0; z-index: 60; background: rgba(20, 30, 40, 0.35); display: flex; align-items: center; justify-content: center; padding: 16px; }
.cal-add[hidden] { display: none; }
.cal-add-box { background: var(--card); border-radius: 14px; padding: 20px; width: min(380px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0,0,0,0.25); }
.cal-add-box input { padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; }
.cal-add-box input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.cal-add-when { font-size: 0.85rem; color: var(--muted); }
.cal-add-buttons { display: flex; justify-content: flex-end; gap: 8px; }
/* ---- Calendar refinements: date on the left, no vertical lines, fills the page ---- */
.layout .page.cal-page { padding: 14px 0 0; display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h)); }
.layout .page.cal-page[hidden] { display: none; }
.cal-top, .cal-help, .cal-page .task-note { padding-left: 20px; padding-right: 20px; }
.cal-scroll { flex: 1; min-height: 0; max-height: none; border-radius: 0; border-width: 1px 0 0 0; }
.cal-grid { position: relative; grid-template-columns: 76px 150px repeat(24, 84px); }
.cal-h, .cal-cell, .cal-date { border-right: none; border-left: none; }
.cal-h-date { position: sticky; left: 0; right: auto; z-index: 6; border-left: none; }
.cal-h-any { position: sticky; left: 76px; z-index: 5; }
.cal-date { position: sticky; left: 0; right: auto; z-index: 3; }
.cal-cell.cal-any { position: sticky; left: 76px; z-index: 2; background: var(--card); }
.cal-cell.cal-any.today { background: var(--teal-faint); }
.cal-cell.weekend.cal-any { background: var(--surface-2); }
.cal-now { position: absolute; pointer-events: none; z-index: 1; }
.cal-now-line { top: 0; bottom: 0; width: 2px; background: #e5484d; }
.cal-now-dot { width: 10px; height: 10px; border-radius: 50%; background: #e5484d; z-index: 1; }
/* Current-time line: see-through so tasks stay readable */
.cal-now-line { background: rgba(229, 72, 77, 0.4); }
.cal-now-dot { background: rgba(229, 72, 77, 0.55); }

/* Arranging files */
.file-item { align-items: center; }
.file-item .file-grip { opacity: 0.55; cursor: grab; touch-action: none; align-self: center; margin-right: 2px; }
.file-item:hover .file-grip, .file-item .file-grip:focus-visible { opacity: 1; color: var(--teal); }
.file-item.dragging { box-shadow: 0 6px 18px rgba(15, 157, 154, 0.25); }

/* Calendar page: scrolling still works, but no scroll bars */
.cal-scroll { scrollbar-width: none; -ms-overflow-style: none; }
.cal-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }

/* Paste a PDF link */
.drop-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.drop-zone .drop-actions .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.link-form { display: flex; flex-wrap: wrap; gap: 8px; width: min(640px, 100%); margin: 0 0 14px; justify-content: center; }

.link-form input { flex: 1 1 240px; min-width: 0; padding: 10px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--card); }
.link-form input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.link-form .form-error { flex-basis: 100%; text-align: center; min-height: 1.1em; }

/* Admin / User preview switch */
.view-switch { display: inline-flex; padding: 2px; border-radius: 20px; background: rgba(255, 255, 255, 0.2); }
.view-switch[hidden] { display: none; }
.vs-btn { border: none; background: none; color: #fff; font: inherit; font-size: 0.75rem; font-weight: 600; padding: 3px 12px; border-radius: 18px; cursor: pointer; }
.vs-btn:hover { background: rgba(255, 255, 255, 0.15); }
.vs-btn.active { background: #fff; color: var(--teal); }
.vs-btn:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
body.previewing-user .role-pill { background: #fff; color: var(--teal); }
@media (max-width: 800px) { .view-switch { margin-right: -4px; } .vs-btn { padding: 3px 9px; } }

/* Full-page file viewer */
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #20262b; }
.viewer[hidden] { display: none; }
body.viewer-open { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--teal-fill, var(--teal)); color: #fff; flex: none; }
.viewer-title { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.viewer-btn { border: none; background: rgba(255, 255, 255, 0.18); color: #fff; font: inherit; font-size: 0.82rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.viewer-btn:hover, .viewer-btn:focus-visible { background: rgba(255, 255, 255, 0.32); outline: none; }
.viewer-close { font-size: 1.3rem; line-height: 1; padding: 3px 12px; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }


/* Full-page file viewer */
.viewer { position: fixed; inset: 0; z-index: 100; display: flex; flex-direction: column; background: #20262b; }
.viewer[hidden] { display: none; }
body.viewer-open { overflow: hidden; }
.viewer-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 14px; background: var(--teal-fill, var(--teal)); color: #fff; flex: none; }
.viewer-title { font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.viewer-actions { display: flex; align-items: center; gap: 6px; flex: none; }
.viewer-btn { border: none; background: rgba(255, 255, 255, 0.18); color: #fff; font: inherit; font-size: 0.82rem; padding: 6px 12px; border-radius: 8px; cursor: pointer; text-decoration: none; }
.viewer-btn:hover, .viewer-btn:focus-visible { background: rgba(255, 255, 255, 0.32); outline: none; }
.viewer-close { font-size: 1.3rem; line-height: 1; padding: 3px 12px; }
.viewer-body { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.viewer-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.viewer-image { max-width: 100%; max-height: 100%; object-fit: contain; }


/* Tile titles use the whole width of the box (the edit/delete icons sit beside the picture, above the title) */
.resource-link h2 { padding-right: 0; overflow-wrap: anywhere; word-break: normal; text-wrap: pretty; line-height: 1.25; }

/* Viewer: back arrow on the left instead of a close button on the right */
.viewer-bar { justify-content: flex-start; }
.viewer-title { flex: 1; }
.viewer-back { flex: none; display: flex; align-items: center; justify-content: center; width: 36px; height: 36px; border: none; border-radius: 50%; background: rgba(255, 255, 255, 0.18); color: #fff; cursor: pointer; }
.viewer-back:hover, .viewer-back:focus-visible { background: rgba(255, 255, 255, 0.32); outline: none; }
.viewer-actions { margin-left: auto; }

/* Dragging a file by its grip: folders and path levels light up as drop spots */
body.dragging-file { cursor: grabbing; user-select: none; }
body.dragging-file .folder-card, body.dragging-file .crumb[data-drop-folder] { transition: box-shadow 0.12s, background 0.12s; }
.folder-card.dragover, .crumb.dragover { background: var(--teal-soft); box-shadow: 0 0 0 2px var(--teal); }

.files-toolbar-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; justify-content: flex-end; }
.ext-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 0.82rem; color: var(--muted); cursor: pointer; user-select: none; }
.ext-toggle input { accent-color: var(--teal); width: 15px; height: 15px; margin: 0; cursor: pointer; }
.link-form .link-name { flex: 0 1 200px; }

/* Unfinished tasks from earlier days */
.overdue { margin-top: 18px; padding-top: 14px; border-top: 1px dashed var(--border); }
.overdue[hidden] { display: none; }
.overdue-title { font-size: 0.78rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: #c0392b; margin-bottom: 8px; }
.overdue-item .task-body .overdue-text { color: #c0392b; }
.overdue-item .task-body .overdue-text:hover { color: #a93226; }
.overdue-item { background: var(--danger-soft); }
.overdue-date { flex: none; font-size: 0.74rem; color: #b5483c; background: var(--danger-soft); padding: 3px 9px; border-radius: 20px; white-space: nowrap; }
.split-btn { position: relative; display: inline-flex; flex: none; }
.split-main, .split-arrow { border: none; background: var(--teal-fill, var(--teal)); color: #fff; font: inherit; font-size: 0.82rem; cursor: pointer; }
.split-main { padding: 6px 12px; border-radius: 8px 0 0 8px; }
.split-arrow { display: flex; align-items: center; padding: 0 7px; border-radius: 0 8px 8px 0; border-left: 1px solid rgba(255, 255, 255, 0.4); }
.split-main:hover, .split-arrow:hover, .split-arrow[aria-expanded="true"] { background: #0b7f7c; }
.split-main:focus-visible, .split-arrow:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.split-menu { right: 0; left: auto; top: calc(100% + 6px); min-width: 190px; }
@media (max-width: 600px) { .overdue-item { flex-wrap: wrap; } }

/* ---------- Spotify now playing ---------- */
.spotify-card.card { padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.spotify-head { display: flex; align-items: center; justify-content: space-between; min-height: 24px; }
.spotify-head h2 { font-size: 0.72rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; color: var(--teal); padding-left: 4px; }
.sp-link { border: none; background: none; font: inherit; font-size: 0.72rem; color: var(--muted); cursor: pointer; padding: 2px 6px; border-radius: 6px; }
.sp-link:hover, .sp-link:focus-visible { color: var(--teal); background: var(--teal-soft); outline: none; }
.sp-link[hidden], .sp-connect[hidden], .sp-now[hidden], .sp-hint[hidden], .sp-note[hidden] { display: none; }
.sp-connect { display: flex; flex-direction: column; gap: 10px; align-items: stretch; }
.sp-hint { font-size: 0.78rem; color: var(--muted); text-align: center; line-height: 1.35; }
.sp-connect .primary-btn { padding: 9px 12px; font-size: 0.85rem; }
.sp-now { display: flex; flex-direction: column; align-items: center; gap: 4px; }
.sp-title { width: 100%; margin-top: 2px; text-align: center; font-weight: 600; font-size: 0.95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sp-artist { width: 100%; text-align: center; font-size: 0.8rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-height: 1.1em; }
.sp-controls { display: flex; align-items: center; justify-content: center; gap: 12px; margin-top: 6px; }
.sp-ctl { display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border: none; border-radius: 50%; background: none; color: var(--text); cursor: pointer; }
.sp-ctl:hover, .sp-ctl:focus-visible { background: var(--teal-soft); color: var(--teal); outline: none; }
.sp-ctl-main { width: 48px; height: 48px; background: var(--teal-fill, var(--teal)); color: #fff; }
.sp-ctl-main:hover, .sp-ctl-main:focus-visible { background: #0b7f7c; color: #fff; }
.sp-note { font-size: 0.75rem; color: #b5483c; text-align: center; line-height: 1.3; }

/* Connect dialog */
.sp-dialog { position: fixed; inset: 0; z-index: 60; background: rgba(20, 30, 40, 0.4); display: flex; align-items: center; justify-content: center; padding: 16px; overflow: auto; }
.sp-dialog[hidden] { display: none; }
.sp-box { background: var(--card); border-radius: 14px; padding: 22px; width: min(480px, 100%); display: flex; flex-direction: column; gap: 10px; box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25); }
.sp-steps-lead { font-size: 0.85rem; color: var(--muted); }
.sp-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 12px; font-size: 0.85rem; line-height: 1.4; }
.sp-steps a { color: var(--teal); }
.sp-steps input { display: block; width: 100%; margin-top: 6px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 0.85rem; background: var(--card); }
.sp-steps input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.sp-copy { display: flex; gap: 6px; margin-top: 6px; }
.sp-copy input { margin-top: 0; flex: 1; min-width: 0; background: var(--bg); }
.sp-copy .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.sp-warning { font-size: 0.8rem; color: #b5483c; background: var(--danger-soft); border-radius: 8px; padding: 8px 10px; }
.sp-warning[hidden] { display: none; }
.sp-box-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.sp-box .form-error { text-align: left; min-height: 1.1em; }

.callback-page { display: grid; place-items: center; min-height: 100vh; background: var(--bg); }
.callback-msg { color: var(--muted); }

/* ---------- Notes: one per day ---------- */
.notes-panel .panel-header { align-items: flex-start; }
.notes-panel .panel-header .muted { display: block; font-size: 0.82rem; margin-top: 2px; }
.notes-status { font-size: 0.78rem; color: var(--muted); min-height: 1em; white-space: nowrap; }
.day-note {
  display: block; width: 100%; min-height: 140px; padding: 12px 14px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2);
  font: inherit; line-height: 1.5; color: var(--text); resize: vertical;
}
.day-note:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); background: var(--card); }
.notes-all { display: inline-block; margin-top: 10px; font-size: 0.82rem; color: var(--teal); text-decoration: none; }
.notes-all:hover { text-decoration: underline; }
.notes-page-list { list-style: none; display: flex; flex-direction: column; gap: 14px; margin-top: 18px; }
.note-day { background: var(--card); border: 1px solid var(--border); border-radius: 14px; padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.note-day-head { display: flex; align-items: center; gap: 10px; }
.note-day-date { border: none; background: none; padding: 0; font: inherit; font-weight: 600; color: var(--teal); cursor: pointer; text-align: left; }
.note-day-date:hover, .note-day-date:focus-visible { text-decoration: underline; outline: none; }
.note-day-head .notes-status { margin-left: auto; }
.note-day .day-note { min-height: 0; }

/* Sidebar icons (teal) and the collapsed icon bar */
.nav-icon { flex: none; color: var(--teal); }
.nav-item.active .nav-icon { color: #fff; }
.nav-label { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; transition: opacity 0.15s ease; }
.sidebar.collapsed .nav-item { justify-content: center; gap: 0; padding: 10px 0; }
.sidebar.collapsed .nav-label { opacity: 0; width: 0; }
@media (max-width: 800px) {
  /* on a phone the sidebar slides over the page, so collapsed means fully hidden */
  .sidebar.collapsed { width: 0; border-right-width: 0; }
}

/* Calendar popup: time you can scroll */
.cal-time { display: inline-flex; align-items: center; gap: 2px; align-self: flex-start; padding: 4px 6px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.cal-time[hidden], .cal-t-set[hidden], .cal-t-hint[hidden] { display: none; }
.cal-t-seg { min-width: 44px; padding: 6px 4px; border: none; border-radius: 8px; background: none; font: inherit; font-size: 1.5rem; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--text); cursor: ns-resize; text-align: center; }
.cal-t-seg:hover, .cal-t-seg:focus-visible { background: var(--teal-soft); color: var(--teal); outline: none; }
.cal-t-ap { min-width: 52px; font-size: 1rem; cursor: pointer; color: var(--teal); }
.cal-t-colon { font-size: 1.5rem; font-weight: 600; color: var(--muted); }
.cal-t-clear { margin-left: 6px; border: none; background: none; font: inherit; font-size: 0.78rem; color: var(--muted); cursor: pointer; padding: 4px 8px; border-radius: 8px; }
.cal-t-clear:hover { color: var(--teal); background: var(--teal-soft); }
.cal-t-set { align-self: flex-start; background: var(--teal-soft); color: var(--teal); }
.cal-t-hint { font-size: 0.76rem; color: var(--muted); }

/* Calendar: task details side bar on the right */
.cal-body { flex: 1; min-height: 0; display: flex; }
.cal-body .cal-scroll { flex: 1; min-width: 0; }
.cal-side { flex: none; width: 340px; display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--border); border-top: 1px solid var(--border); min-height: 0; }
.cal-side[hidden] { display: none; }
.cal-side-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.cal-side-head h2 { font-size: 1rem; }
.cal-side-head .notes-status { margin-left: auto; }
.cal-side-close { border: none; background: none; font-size: 1.5rem; line-height: 1; color: var(--muted); cursor: pointer; padding: 0 6px; border-radius: 8px; }
.cal-side-close:hover, .cal-side-close:focus-visible { color: var(--teal); background: var(--teal-soft); outline: none; }
.cal-side-body { flex: 1; min-height: 0; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 14px; scrollbar-width: thin; }
.cal-d-field { display: flex; flex-direction: column; gap: 5px; font-size: 0.78rem; color: var(--muted); min-width: 0; }
.cal-d-row .cal-d-field { flex: 1; }
.cal-d-field input[type="text"], .cal-d-field input[type="date"], .cal-d-field textarea {
  width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font: inherit; font-size: 0.92rem; color: var(--text); background: var(--surface-2);
}
.cal-d-field textarea { resize: vertical; min-height: 110px; line-height: 1.45; }
.cal-d-field input:focus, .cal-d-field textarea:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); background: var(--card); }
.cal-d-row { display: flex; gap: 10px; }
.cal-d-row .time-field { width: auto; }
.cal-d-check { display: flex; align-items: center; gap: 8px; font-size: 0.92rem; cursor: pointer; }
.cal-d-check input { width: 17px; height: 17px; accent-color: var(--teal); }
.cal-side .form-error { text-align: left; min-height: 1.1em; }
.cal-side-foot { display: flex; justify-content: space-between; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
.cal-side-foot .ghost-btn { background: var(--teal-soft); color: var(--teal); text-decoration: none; font-size: 0.85rem; padding: 8px 14px; border-radius: 10px; }
.cal-side-foot .cal-d-delete { background: var(--danger-soft); color: #c0392b; border: none; cursor: pointer; font: inherit; font-size: 0.85rem; padding: 8px 14px; border-radius: 10px; }
.cal-chip.selected { outline: 2px solid var(--teal); outline-offset: 1px; background: var(--card); }
@media (max-width: 800px) { .cal-side { position: fixed; top: var(--topbar-h); right: 0; bottom: 0; width: min(360px, 100%); z-index: 40; box-shadow: -6px 0 24px rgba(0,0,0,0.18); } }

/* The status label on the task page is a button: click it to change the status */
button.status-pill { border: 1px solid transparent; font: inherit; font-size: 0.78rem; font-weight: 600; cursor: pointer; transition: box-shadow 0.12s, border-color 0.12s; }
button.status-pill:hover, button.status-pill:focus-visible { border-color: var(--teal); outline: none; box-shadow: 0 0 0 3px var(--teal-soft); }
button.status-pill:disabled { opacity: 0.6; cursor: default; }

/* ---------- Admin / User preview: a plain toggle, no text ---------- */
.vs-toggle { position: relative; width: 40px; height: 22px; padding: 0; border: none; border-radius: 12px; background: rgba(255, 255, 255, 0.35); cursor: pointer; flex-shrink: 0; transition: background 0.15s; }
.vs-toggle[hidden] { display: none; }
.vs-toggle.on { background: rgba(255, 255, 255, 0.9); }
.vs-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3); transition: transform 0.15s, background 0.15s; }
.vs-toggle.on .vs-knob { transform: translateX(18px); background: var(--teal-fill, var(--teal)); }
.vs-toggle:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

/* ---------- Resources view types ---------- */
.view-types { display: inline-flex; padding: 2px; border-radius: 10px; background: var(--teal-soft); }
.view-types button { display: grid; place-items: center; width: 32px; height: 28px; border: none; border-radius: 8px; background: none; color: var(--teal); cursor: pointer; }
.view-types button:hover { background: var(--teal-hover); }
.view-types button.active { background: var(--teal-fill, var(--teal)); color: #fff; }
.view-types button:focus-visible { outline: 2px solid var(--teal); outline-offset: 1px; }

.file-list[hidden], .split-wrap[hidden], #drop-slot[hidden] { display: none; }
.file-icon { position: relative; overflow: hidden; }
.file-thumb { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; display: none; }

/* Gallery: big tiles, pictures show as thumbnails */
#view-files[data-view="gallery"] .file-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 12px; }
#view-files[data-view="gallery"] .file-item { position: relative; flex-direction: column; align-items: stretch; text-align: center; padding: 10px; gap: 8px; }
#view-files[data-view="gallery"] .file-icon { width: 100%; height: 120px; border-radius: 8px; font-size: 1.1rem; }
#view-files[data-view="gallery"] .file-thumb { display: block; }
#view-files[data-view="gallery"] .file-name { white-space: normal; text-align: center; overflow-wrap: anywhere; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
#view-files[data-view="gallery"] .file-actions { display: flex; flex-wrap: nowrap; gap: 6px; }
#view-files[data-view="gallery"] .file-actions .ghost-btn { flex: 1 1 0; min-width: 0; padding-left: 4px; padding-right: 4px; text-align: center; }
#view-files[data-view="gallery"] .file-item .file-grip { position: absolute; top: 14px; left: 14px; margin: 0; background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--muted); border-radius: 6px; z-index: 1; }

/* Details: slim rows with the size and date in a column */
#view-files[data-view="details"] .file-list { gap: 0; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; background: var(--card); }
#view-files[data-view="details"] .file-item { border: none; border-bottom: 1px solid var(--border); border-radius: 0; padding: 6px 12px; gap: 10px; }
#view-files[data-view="details"] .file-item:last-child { border-bottom: none; }
#view-files[data-view="details"] .file-icon { width: 30px; height: 30px; border-radius: 6px; font-size: 0.55rem; }
#view-files[data-view="details"] .file-info { display: flex; align-items: center; gap: 14px; }
#view-files[data-view="details"] .file-name { flex: 1; min-width: 0; }
#view-files[data-view="details"] .file-meta { flex: 0 0 190px; }
#view-files[data-view="details"] .folder-grid { grid-template-columns: 1fr; gap: 6px; }
@media (max-width: 700px) { #view-files[data-view="details"] .file-meta { display: none; } }

/* ---------- Vertical splits inside a folder ---------- */
.split-wrap { display: grid; grid-template-columns: repeat(var(--cols, 2), minmax(0, 1fr)); gap: 18px; align-items: start; }
.split-col { min-width: 0; padding: 12px; border: 1px solid var(--border); border-radius: 14px; background: rgba(15, 157, 154, 0.03); transition: background 0.15s, border-color 0.15s; }
.split-col.dragover { background: var(--teal-soft); border-color: var(--teal); border-style: dashed; }
.split-head { display: flex; align-items: center; gap: 6px; margin-bottom: 10px; padding-bottom: 8px; border-bottom: 2px solid var(--teal); }
.split-title, .split-title-text { flex: 1; min-width: 0; margin: 0; font: inherit; font-size: 1.1rem; font-weight: 700; color: var(--text); }
.split-title { padding: 4px 6px; border: 1px solid transparent; border-radius: 8px; background: none; }
.split-title:hover { border-color: var(--border); }
.split-title:focus { outline: none; border-color: var(--teal); background: var(--card); }
.split-col .drop-zone { padding: 16px 12px; margin-bottom: 14px; gap: 8px; }
.split-col .link-form { margin-bottom: 8px; }
.split-col .link-form input { flex-basis: 100%; }
.split-col .link-name { flex: 1 1 100%; }
.split-empty { text-align: center; padding: 8px 0; font-size: 0.9rem; }
@media (max-width: 900px) { .split-wrap { grid-template-columns: 1fr; } }
#view-files[data-view="gallery"] .file-name { width: 100%; text-align: center; }

/* names beside the Admin / User switch: switch on the left = Admin, on the right = User */
.vs-wrap { display: inline-flex; align-items: center; gap: 8px; }
.vs-wrap[hidden] { display: none; }
.vs-lab { border: none; background: none; padding: 0; font: inherit; font-size: 0.78rem; font-weight: 600; color: rgba(255, 255, 255, 0.65); cursor: pointer; }
.vs-lab.active { color: #fff; }
.vs-wrap .vs-toggle { background: rgba(255, 255, 255, 0.9); }
.vs-wrap .vs-knob { background: var(--teal-fill, var(--teal)); transform: translateX(18px); }
.vs-wrap .vs-toggle.on .vs-knob { transform: none; }
@media (max-width: 520px) { .vs-lab { font-size: 0.7rem; } .vs-wrap { gap: 5px; } }

/* Viewer: icon buttons and the resources bar on the right */
.viewer-main { flex: 1; min-height: 0; display: flex; position: relative; }
.viewer-main .viewer-body { flex: 1; min-width: 0; }
.viewer-ico { display: grid; place-items: center; width: 36px; height: 36px; padding: 0; }
.viewer-side { flex: none; width: 280px; display: flex; flex-direction: column; background: var(--card); border-left: 1px solid var(--border); }
.viewer.side-hidden .viewer-side { display: none; }
.viewer-side-head { padding: 10px 14px; font-weight: 700; color: var(--teal); border-bottom: 1px solid var(--border); flex: none; }
.viewer-tree { flex: 1; overflow: auto; padding: 8px; display: flex; flex-direction: column; gap: 2px; }
.vt-file { display: block; width: 100%; text-align: left; padding: 7px 10px; border: none; border-radius: 8px; background: none; font: inherit; font-size: 0.88rem; color: var(--text); cursor: pointer; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.vt-file:hover { background: var(--teal-soft); }
.vt-file.current { background: var(--teal-fill, var(--teal)); color: #fff; font-weight: 600; }
.vt-folder { margin: 2px 0; }
.vt-folder > .vt-folder-name { cursor: pointer; padding: 6px 8px; font-weight: 600; font-size: 0.88rem; border-radius: 8px; }
.vt-folder > .vt-folder-name:hover { background: var(--teal-soft); }
.vt-folder > :not(summary) { margin-left: 12px; }
.vt-head { margin: 8px 4px 2px; padding-bottom: 3px; font-size: 0.75rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); }
@media (max-width: 800px) { .viewer-side { position: absolute; top: 0; right: 0; bottom: 0; width: min(280px, 80vw); box-shadow: -4px 0 16px rgba(0, 0, 0, 0.3); } }
.vt-folder > .vt-file { width: calc(100% - 12px); }

/* Viewer top bar: hidden until the mouse reaches the top edge */
.viewer-bar { position: absolute; top: 0; left: 0; right: 0; z-index: 6; transform: translateY(-100%); transition: transform 0.18s ease; }
.viewer.bar-on .viewer-bar { transform: none; box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25); }
.viewer-hot { position: absolute; top: 0; left: 0; right: 0; height: 12px; z-index: 5; }
.viewer-main { flex: 1 1 100%; }

/* Resources bar: hide with the tab on its left edge; show again with the arrow at the top right */
.viewer-side { position: relative; }
.viewer-side-close { position: absolute; left: -22px; top: 50%; transform: translateY(-50%); width: 22px; height: 56px; display: grid; place-items: center; padding: 0; border: 1px solid var(--border); border-right: none; border-radius: 10px 0 0 10px; background: var(--card); color: var(--teal); cursor: pointer; z-index: 3; }
.viewer-side-close:hover { background: var(--teal-soft); }
.viewer-side-open { display: none; position: absolute; top: 14px; right: 0; z-index: 7; width: 30px; height: 40px; padding: 0; place-items: center; border: none; border-radius: 10px 0 0 10px; background: var(--teal-fill, var(--teal)); color: #fff; cursor: pointer; box-shadow: -2px 2px 8px rgba(0, 0, 0, 0.3); transition: top 0.18s ease; }
.viewer-side-open:hover { background: #0b7f7c; }
.viewer.side-hidden .viewer-side-open { display: grid; }
.viewer.bar-on .viewer-side-open { top: 62px; }
@media (max-width: 800px) { .viewer-side-close { left: -22px; } }

/* Collapse arrow now sits in the bar's heading, before the word "Resources" */
.viewer-side-head { display: flex; align-items: center; gap: 8px; }
.viewer-side-close { position: static; transform: none; width: 22px; height: 22px; border: none; border-radius: 6px; background: var(--teal-soft); }
.viewer-side-close:hover { background: var(--teal-hover); }
/* the top bar and its hot edge stop short of the Resources bar, so its heading stays reachable */
.viewer:not(.side-hidden) .viewer-bar, .viewer:not(.side-hidden) .viewer-hot { right: 280px; }
@media (max-width: 800px) { .viewer:not(.side-hidden) .viewer-bar, .viewer:not(.side-hidden) .viewer-hot { right: 0; } }
/* the show-again arrow sits a little lower, clear of the top bar */
.viewer-side-open { top: 64px; }
.viewer.bar-on .viewer-side-open { top: 64px; }

/* Split view in the viewer */
.viewer-body { align-items: stretch; justify-content: flex-start; overflow: hidden; }
.vpane { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; position: relative; }
.vpane-divider { flex: none; width: 8px; background: #0a0e11; cursor: col-resize; position: relative; touch-action: none; z-index: 2; }
.vpane-divider::after { content: ""; position: absolute; top: 50%; left: 2px; width: 4px; height: 44px; margin-top: -22px; border-radius: 2px; background: #51606a; transition: background 0.12s; }
.vpane-divider:hover::after, .vpane-divider.dragging::after, .vpane-divider:focus-visible::after { background: var(--teal-fill, var(--teal)); }
.vpane-divider:focus-visible { outline: none; }
.viewer-body.resizing-panes { cursor: col-resize; user-select: none; }
.viewer-body.resizing-panes .vpane-content { pointer-events: none; }
.vpane-head { display: flex; align-items: center; gap: 8px; padding: 14px 10px 4px; background: #2b333a; color: #cfd8dc; font-size: 0.82rem; cursor: pointer; flex: none; border-bottom: 2px solid transparent; }
.vpane-head[hidden], .vpane-close[hidden] { display: none; }
.vpane.active .vpane-head { color: #fff; border-bottom-color: var(--teal); }
.vpane-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.vpane-close { border: none; background: none; color: inherit; font-size: 1.2rem; line-height: 1; cursor: pointer; padding: 0 4px; border-radius: 6px; }
.vpane-close:hover { background: rgba(255, 255, 255, 0.18); }
.vpane-content { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; overflow: auto; }
.vpane-hint { color: #9aa7ae; padding: 24px; text-align: center; max-width: 280px; }
.vt-file.shown { background: var(--teal-soft); color: var(--teal); font-weight: 600; }

/* ---------- Task page: form on the left, Resource and Notes on the right ---------- */
.task-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 20px; align-items: start; max-width: 1400px; }
.task-layout .task-detail { max-width: none; }
.task-side { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.task-side[hidden] { display: none; }
.task-side .card { padding: 18px; display: flex; flex-direction: column; gap: 10px; }
.task-side h2 { font-size: 1.05rem; margin: 0; color: var(--teal); }
.task-notes-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.task-side textarea { width: 100%; resize: vertical; }
@media (max-width: 1000px) { .task-layout { grid-template-columns: 1fr; } }

/* ---------- Resource box (task page and calendar side bar) ---------- */
.res-panel { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.res-form { display: flex; gap: 8px; }
.res-input { flex: 1; min-width: 0; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--card); }
.res-input:focus, .res-pick:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.res-add { background: var(--teal-fill, var(--teal)); }
.res-error { min-height: 1.1em; margin: 0; }
.res-pick { width: 100%; padding: 9px 10px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--card); color: var(--text); }
.res-bar { display: flex; align-items: center; gap: 10px; }
.res-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.res-link, .res-remove { flex: none; font: inherit; font-size: 0.82rem; padding: 5px 10px; border: none; border-radius: 8px; background: var(--teal-soft); color: var(--teal); cursor: pointer; text-decoration: none; }
.res-link:hover, .res-remove:hover { background: var(--teal-hover); }
.res-remove { background: var(--danger-soft); color: var(--danger); }
.res-remove:hover { background: var(--danger-soft); }
.res-embed { width: 100%; height: 62vh; min-height: 360px; border-radius: 10px; overflow: hidden; background: #20262b; display: flex; align-items: center; justify-content: center; }
.res-embed.res-video { height: auto; min-height: 0; aspect-ratio: 16 / 9; }
.res-frame { width: 100%; height: 100%; border: 0; background: #fff; }
.res-image { max-width: 100%; max-height: 100%; object-fit: contain; }
.res-hint { margin: 0; font-size: 0.8rem; color: var(--muted); }
.res-compact .res-embed { height: 300px; min-height: 0; }
.res-compact .res-embed.res-video { height: auto; }
.res-compact .res-bar { flex-wrap: wrap; }
.res-compact .res-form { flex-wrap: wrap; }

/* ---------- Dashboard: the right-hand boxes stay put while tasks and notes scroll ---------- */
@media (min-width: 901px) {
  .dashboard > .side-panel { position: sticky; top: calc(var(--topbar-h) + 16px); max-height: calc(100vh - var(--topbar-h) - 32px); overflow-y: auto; scrollbar-width: none; align-self: start; }
  .dashboard > .side-panel::-webkit-scrollbar { display: none; }
}
.res-embed.res-video { position: relative; height: auto; min-height: 0; aspect-ratio: 16 / 9; }
.res-embed.res-video .res-frame { position: absolute; inset: 0; }
.res-embed, .res-panel, .cal-side-body > .cal-d-field { flex-shrink: 0; }

/* The time on a task row is a button that opens the clock */
button.task-time { border: none; font: inherit; font-size: 0.8rem; cursor: pointer; line-height: 1.4; }
button.task-time:hover, button.task-time:focus-visible { background: var(--teal-hover); outline: none; }
button.task-time.no-time { display: inline-grid; place-items: center; padding: 3px 6px; color: var(--muted); background: none; opacity: 0.7; }
button.task-time.no-time:hover, button.task-time.no-time:focus-visible { opacity: 1; color: var(--teal); background: var(--teal-soft); }

/* ---------- Small now-playing player: top bar (other pages) and the viewer's bar ---------- */
.mini-slot { display: flex; align-items: center; }
.mini-player { display: flex; align-items: center; gap: 4px; color: #fff; }
.mini-player[hidden] { display: none; }
.mini-title { max-width: 190px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.82rem; font-weight: 600; margin-right: 4px; }
.mini-btn { display: grid; place-items: center; border: none; border-radius: 50%; cursor: pointer; padding: 0; font: inherit; }
.mini-main { width: 30px; height: 30px; background: #fff; color: var(--teal); flex: none; }
.mini-main:hover, .mini-main:focus-visible { background: var(--teal-faint); outline: none; }
.mini-side { width: 0; height: 28px; opacity: 0; overflow: hidden; background: rgba(255, 255, 255, 0.2); color: #fff; flex: none; transition: width 0.15s ease, opacity 0.15s ease, margin 0.15s ease; }
.mini-player:hover .mini-side, .mini-player:has(.mini-btn:focus-visible) .mini-side { width: 28px; opacity: 1; }
.mini-side:hover, .mini-side:focus-visible { background: rgba(255, 255, 255, 0.38); outline: none; }
.topbar-right .mini-slot { margin-right: 6px; }
@media (max-width: 600px) { .mini-title { display: none; } }

/* ---------- Changelog ---------- */
.changelog-list { display: flex; flex-direction: column; gap: 16px; max-width: 760px; }
.changelog-entry { padding: 20px 24px; }
.changelog-date { margin: 0 0 2px; font-size: 0.8rem; font-weight: 600; color: var(--teal); text-transform: uppercase; letter-spacing: 0.04em; }
.changelog-entry h2 { margin: 0 0 10px; font-size: 1.15rem; }
.changelog-items { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; line-height: 1.45; }
.profile-soon .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.profile-links { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 16px; }
.profile-links .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.profile-links .ghost-btn:hover { background: var(--teal-hover); }

/* ---------- Users page and its sidebar link ---------- */
.sidebar-inner { min-height: 100%; }
.nav-bottom { margin-top: auto; }
.users-list { list-style: none; display: flex; flex-direction: column; gap: 10px; max-width: 760px; padding: 0; }
.user-row { display: flex; align-items: center; gap: 14px; padding: 14px 18px; }
.user-avatar { width: 40px; height: 40px; flex: none; border-radius: 50%; background: var(--teal-fill, var(--teal)); color: #fff; display: grid; place-items: center; font-weight: 700; font-size: 0.9rem; }
.user-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.user-info strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-you { font-weight: 400; color: var(--muted); }
.user-meta { font-size: 0.82rem; color: var(--muted); }
.role-seg { display: inline-flex; padding: 3px; border-radius: 20px; background: var(--teal-soft); flex: none; }
.role-opt { border: none; background: none; font: inherit; font-size: 0.82rem; font-weight: 600; color: var(--teal); padding: 5px 14px; border-radius: 18px; cursor: pointer; }
.role-opt:hover:not(:disabled):not(.active) { background: var(--teal-hover); }
.role-opt.active { background: var(--teal-fill, var(--teal)); color: #fff; }
.role-opt:disabled { cursor: not-allowed; opacity: 0.8; }
@media (max-width: 560px) { .user-row { flex-wrap: wrap; } .role-seg { margin-left: 54px; } }

/* ---------- Sidebar bottom: day/night button above Users ---------- */
.nav-bottom { margin-top: 0; }
.sidebar-bottom { margin-top: auto; display: flex; flex-direction: column; gap: 4px; }
.theme-toggle { display: grid; place-items: center; width: 40px; height: 40px; margin-left: 4px; padding: 0; border: none; border-radius: 10px; background: none; color: var(--teal); cursor: pointer; }
.theme-toggle:hover, .theme-toggle:focus-visible { background: var(--teal-soft); outline: none; }
.theme-toggle .theme-moon { display: none; }
.theme-toggle[aria-pressed="true"] .theme-sun { display: none; }
.theme-toggle[aria-pressed="true"] .theme-moon { display: block; }
.sidebar.collapsed .theme-toggle { margin-left: auto; margin-right: auto; }

/* Task page notes: no border, just writing space */
.empty-card[hidden] { display: none; }

/* Timer fields change by scrolling over them (no arrow buttons) */
.tm-col input { cursor: ns-resize; }
/* Dashboard calendar: month arrows without boxes */
.calendar .icon-btn { background: none; border: none; color: var(--muted); }
.calendar .icon-btn:hover, .calendar .icon-btn:focus-visible { background: none; color: var(--teal); outline: none; }

/* "Tag" drop-down at the right end of a Resources section heading */
.tag-menu { position: relative; margin-left: auto; }
.tag-btn { display: inline-flex; align-items: center; gap: 4px; padding: 5px 10px; border: none; border-radius: 8px; background: var(--teal-soft); color: var(--teal); font: inherit; font-size: 0.82rem; font-weight: 600; cursor: pointer; }
.tag-btn:hover, .tag-btn:focus-visible, .tag-btn[aria-expanded="true"] { background: var(--teal-hover); outline: none; }
.tag-list { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 170px; padding: 10px 14px; background: var(--card); border: 1px solid var(--border); border-radius: 10px; box-shadow: 0 8px 24px rgba(30, 36, 60, 0.15); }
.tag-list[hidden] { display: none; }
.tag-empty { margin: 0; font-size: 0.85rem; color: var(--muted); }

/* ---- viewer: video, audio, Word documents ---- */
.viewer-video { display: block; width: 100%; height: 100%; max-width: 100%; max-height: 100%; background: #000; object-fit: contain; }
.vpane-audio { flex: 1 1 auto; width: 100%; height: 100%; display: flex; align-items: center; justify-content: center; padding: 24px; }
.vpane-audio audio { width: 560px; max-width: 100%; }
.docx-scroll { flex: 1 1 auto; width: 100%; height: 100%; overflow: auto; background: var(--paper-bg); padding: 24px 16px; box-sizing: border-box; }
.docx-page { width: 100%; background: #fff; color: #1b1b1f; max-width: 860px; margin: 0 auto; padding: 56px 64px; box-sizing: border-box; box-shadow: 0 1px 6px rgba(0,0,0,.18); min-height: 100%; font-family: Calibri, "Segoe UI", Arial, sans-serif; font-size: 11pt; line-height: 1.45; overflow-wrap: anywhere; }
.docx-page .docx-p { margin: 0 0 8px; }
.docx-page h1, .docx-page h2, .docx-page h3, .docx-page h4, .docx-page h5, .docx-page h6 { margin: 14px 0 6px; line-height: 1.25; }
.docx-page h1 { font-size: 22pt; } .docx-page h2 { font-size: 16pt; } .docx-page h3 { font-size: 13pt; } .docx-page h4, .docx-page h5, .docx-page h6 { font-size: 11pt; }
.docx-page img { max-width: 100%; height: auto; }
.docx-page a { color: #0b57d0; }
.docx-li { position: relative; }
.docx-marker { display: inline-block; min-width: 22px; text-indent: 0; }
.docx-table { border-collapse: collapse; margin: 8px 0; max-width: 100%; }
.docx-table td { padding: 4px 8px; vertical-align: top; }
.docx-table.bordered td { border: 1px solid #888; }
.docx-pagebreak { border: 0; border-top: 1px dashed #bbb; margin: 24px 0; }
@media (max-width: 700px) { .docx-page { padding: 28px 20px; } }

/* ---------- In-page dialogs (replace the browser's confirm / prompt / alert) ---------- */
.dlg-overlay { position: fixed; inset: 0; z-index: 1000; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 30, 40, 0.45); }
.dlg-box { width: min(420px, 100%); max-height: 90vh; overflow: auto; padding: 24px; border-radius: var(--radius); background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); animation: dlg-in 0.12s ease-out; }
.dlg-title { font-size: 1.1rem; margin-bottom: 8px; }
.dlg-message { white-space: pre-line; line-height: 1.45; overflow-wrap: anywhere; }
.dlg-input { width: 100%; margin-top: 14px; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--surface-2); color: var(--text); }
.dlg-input:focus { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.dlg-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.dlg-ok.danger { background: var(--danger); }
.dlg-ok.danger:hover { background: #c93a3f; }
.dlg-desc-box { width: min(480px, 100%); padding: 18px; }
.dlg-desc-task { font-weight: 600; overflow-wrap: anywhere; color: var(--muted, var(--text)); }
.dlg-desc { margin-top: 10px; resize: vertical; min-height: 110px; max-height: 60vh; }
.dlg-desc-hint { margin-top: 8px; font-size: 0.8rem; opacity: 0.65; }
@keyframes dlg-in { from { opacity: 0; transform: scale(0.96); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .dlg-box { animation: none; } }

/* calendar: pointer guide and time label */
.cal-guide { position: absolute; top: 0; bottom: 0; width: 0; border-left: 1px dashed var(--teal); pointer-events: none; z-index: 1; }
.cal-guide-label { position: absolute; transform: translateX(-50%); padding: 3px 9px; border-radius: 12px; background: var(--teal-fill, var(--teal)); color: #fff; font-size: 0.75rem; font-weight: 600; white-space: nowrap; pointer-events: none; z-index: 4; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); }
.cal-guide[hidden], .cal-guide-label[hidden] { display: none; }

/* ---------- Date chooser ---------- */
.dp-overlay { position: fixed; inset: 0; z-index: 900; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 30, 40, 0.4); }
.dp-dialog { width: 320px; max-width: 100%; padding: 16px; border-radius: var(--radius); background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); animation: dlg-in 0.12s ease-out; }
.dp-head { display: flex; align-items: center; justify-content: space-between; gap: 6px; margin-bottom: 10px; }
.dp-title { flex: 1; padding: 7px 10px; border: none; border-radius: 10px; background: none; color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.dp-title:hover, .dp-title:focus-visible { background: var(--teal-soft); outline: none; }
.dp-title::after { content: " \25BE"; color: var(--teal); font-size: 0.8em; }
.dp-nav { width: 34px; height: 34px; border: none; border-radius: 10px; background: none; color: var(--text); font-size: 1.3rem; line-height: 1; cursor: pointer; }
.dp-nav:hover, .dp-nav:focus-visible { background: var(--teal-soft); outline: none; }
.dp-body { height: 262px; position: relative; }
.dp-body.dp-years { overflow-y: auto; }
.dp-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; text-align: center; }
.dp-weekdays { font-size: 0.75rem; color: var(--muted); margin-bottom: 8px; }
.dp-day { aspect-ratio: 1; display: flex; align-items: center; justify-content: center; border: none; border-radius: 10px; background: none; color: var(--text); font: inherit; font-size: 0.9rem; cursor: pointer; }
.dp-day:hover:not(:disabled), .dp-day:focus-visible { background: var(--teal-soft); outline: none; }
.dp-day.other { color: var(--faint); }
.dp-day.today { background: var(--teal-fill, var(--teal)); color: #fff; font-weight: 600; }
.dp-day.selected:not(.today) { outline: 2px solid var(--teal); }
.dp-day.selected.today { box-shadow: 0 0 0 2px var(--card), 0 0 0 4px var(--teal); }
.dp-day:disabled, .dp-cell:disabled { opacity: 0.35; cursor: not-allowed; }
.dp-pick { grid-template-columns: repeat(3, 1fr); gap: 8px; }
.dp-years .dp-pick { grid-template-columns: repeat(4, 1fr); gap: 6px; }
.dp-cell { padding: 14px 4px; border: none; border-radius: 12px; background: none; color: var(--text); font: inherit; cursor: pointer; }
.dp-years .dp-cell { padding: 10px 2px; }
.dp-cell:hover:not(:disabled), .dp-cell:focus-visible { background: var(--teal-soft); outline: none; }
.dp-cell.today { color: var(--teal); font-weight: 700; }
.dp-cell.selected { background: var(--teal-fill, var(--teal)); color: #fff; font-weight: 600; }
.dp-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.dp-spacer { flex: 1; }
.date-field { display: inline-flex; position: relative; }
.date-btn-field { display: inline-flex; align-items: center; gap: 8px; padding: 9px 12px; border: 1px solid var(--border); border-radius: 10px; background: var(--card); color: var(--text); font: inherit; cursor: pointer; text-align: left; }
.date-btn-field svg { color: var(--teal); flex: none; }
.date-btn-field:hover, .date-btn-field:focus-visible { border-color: var(--teal); outline: none; }
.field .date-field, .cal-d-field .date-field { display: flex; }
.field .date-btn-field, .cal-d-field .date-btn-field { width: 100%; }

/* ---------- Clock: start, end and duration ---------- */
.clock-times { display: flex; align-items: center; justify-content: center; gap: 6px; margin-bottom: 12px; }
.clock-to { color: var(--muted); }
.clock-pill { padding: 6px 12px; border: 1px solid var(--border); border-radius: 20px; background: var(--card); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; white-space: pre; }
.clock-pill:hover { border-color: var(--teal); }
.clock-pill.active { background: var(--teal-fill, var(--teal)); border-color: var(--teal); color: #fff; font-weight: 600; }
.clock-pill.bad { border-color: var(--danger); color: var(--danger); background: var(--danger-soft); }
.clock-pill.active.bad { background: var(--danger); color: #fff; }
.clock-dur { display: flex; align-items: center; justify-content: center; gap: 8px; margin: 12px 0 8px; }
.clock-dur-label { color: var(--muted); font-size: 0.85rem; margin-right: 2px; }
.clock-step { width: 28px; height: 28px; border: none; border-radius: 50%; background: var(--teal-soft); color: var(--teal); font-size: 1.1rem; line-height: 1; cursor: pointer; }
.clock-step:hover { background: var(--teal-hover); }
.clock-dur-val { min-width: 96px; padding: 5px 10px; border: 1px solid var(--border); border-radius: 10px; text-align: center; font-weight: 600; cursor: ns-resize; user-select: none; }
.clock-dur-val:focus-visible { outline: 2px solid var(--teal-soft); border-color: var(--teal); }
.clock-presets { display: flex; justify-content: center; gap: 6px; margin-bottom: 8px; }
.clock-preset { padding: 3px 10px; border: 1px solid var(--border); border-radius: 14px; background: none; color: var(--muted); font: inherit; font-size: 0.78rem; cursor: pointer; }
.clock-preset:hover { border-color: var(--teal); color: var(--teal); }
.clock-preset.on { background: var(--teal-soft); border-color: var(--teal); color: var(--teal); font-weight: 600; }
.clock-err { min-height: 1.1em; margin-bottom: 6px; text-align: center; font-size: 0.8rem; color: var(--danger); }
.clock-foot .primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }

.cal-t-for { color: var(--muted); font-size: 0.85rem; margin: 0 4px 0 8px; }
.cal-t-dur { min-width: 64px; }

/* calendar: tasks with a start time are boxes on the time line */
.cal-chip.timed { position: absolute; z-index: 1; height: 24px; box-sizing: border-box; padding: 0 6px; overflow: hidden; border: 1px solid var(--teal); background: var(--teal-soft); }
.cal-chip.timed.fit { width: max-content; max-width: 260px; }
.cal-chip.timed.done { border-color: var(--border); }
.cal-chip.timed.selected { z-index: 2; }
.moving-task .cal-chip.timed { pointer-events: none; }
.cal-handle { position: absolute; top: 0; bottom: 0; width: 7px; cursor: ew-resize; z-index: 2; touch-action: none; }
.cal-handle.l { left: 0; }
.cal-handle.r { right: 0; }
.cal-chip.timed:hover .cal-handle::after, .cal-chip.resizing .cal-handle::after { content: ""; position: absolute; top: 5px; bottom: 5px; left: 2px; width: 2px; border-radius: 1px; background: var(--teal-fill, var(--teal)); opacity: 0.6; }
.cal-chip.resizing { z-index: 3; box-shadow: 0 2px 8px rgba(0, 0, 0, 0.25); cursor: ew-resize; }

/* Gallery: the delete cross sits in the top right corner of each file and folder tile */
#view-files[data-view="gallery"] .file-item .delete-btn,
#view-files[data-view="gallery"] .folder-card .delete-btn { position: absolute; top: 14px; right: 14px; z-index: 2; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--card) 88%, transparent); color: var(--muted); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); align-self: auto; }
#view-files[data-view="gallery"] .file-item .delete-btn:hover,
#view-files[data-view="gallery"] .folder-card .delete-btn:hover { color: #fff; background: var(--danger); }

/* Gallery: folders are tiles too */
#view-files[data-view="gallery"] .folder-grid { grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
#view-files[data-view="gallery"] .folder-card { position: relative; flex-direction: column; align-items: stretch; padding: 10px; }
#view-files[data-view="gallery"] .folder-main { flex: 1; flex-direction: column; justify-content: center; gap: 6px; padding: 8px 4px 6px; text-align: center; border-radius: 8px; }
#view-files[data-view="gallery"] .folder-icon { display: grid; place-items: center; width: 100%; height: 120px; border-radius: 8px; background: var(--teal-faint); font-size: 3.6rem; }
#view-files[data-view="gallery"] .folder-text { align-items: center; width: 100%; }
#view-files[data-view="gallery"] .folder-name { max-width: 100%; }
#view-files[data-view="gallery"] .folder-card .rename-btn { position: absolute; top: 14px; right: 46px; z-index: 2; width: 26px; height: 26px; padding: 0; display: grid; place-items: center; border-radius: 50%; background: color-mix(in srgb, var(--card) 88%, transparent); box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); }

.viewer-media { position: relative; width: 100%; height: 100%; background: #000; }
.viewer-media .viewer-video { position: absolute; inset: 0; }
.viewer-media-status { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); max-width: 80%; padding: 8px 16px; border-radius: 20px; background: rgba(0, 0, 0, 0.65); color: #fff; font-size: 0.9rem; text-align: center; pointer-events: none; }
.viewer-media-status[hidden] { display: none; }
.viewer-media-status.error { background: rgba(160, 40, 40, 0.9); border-radius: 12px; }

/* ---------- Sections inside a folder / page / split column ---------- */
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.part-area { margin-top: 14px; display: flex; flex-direction: column; gap: 10px; }
.part-area:empty { display: none; }
.res-part { border: 1px solid var(--border); border-radius: 12px; background: var(--card); transition: border-color 0.12s, background 0.12s; }
.res-part.dragover, [data-drop-part].dragover { border-color: var(--teal); background: var(--teal-soft); }
[data-drop-part].file-list { min-height: 30px; }
[data-drop-part].file-list.dragover { outline: 2px dashed var(--teal); outline-offset: 2px; border-radius: 10px; }
.res-part-head { display: flex; align-items: center; gap: 8px; padding: 8px 10px; }
.res-part-toggle { flex: none; display: grid; place-items: center; width: 28px; height: 28px; border: none; border-radius: 8px; background: var(--teal-soft); color: var(--teal); cursor: pointer; }
.res-part-toggle:hover, .res-part-toggle:focus-visible { background: var(--teal-hover); outline: none; }
.res-part-toggle svg { transition: transform 0.15s; }
.res-part.collapsed .res-part-toggle svg { transform: rotate(-90deg); }
.res-part-title, .res-part-title-text { flex: 1; min-width: 0; margin: 0; font: inherit; font-size: 1rem; font-weight: 700; color: var(--text); }
.res-part-title { padding: 4px 6px; border: 1px solid transparent; border-radius: 8px; background: none; }
.res-part-title:hover { border-color: var(--border); }
.res-part-title:focus { outline: none; border-color: var(--teal); background: var(--surface-2); }
.res-part-count { flex: none; font-size: 0.8rem; white-space: nowrap; }
.res-part-add { flex: none; padding: 5px 12px; font-size: 0.82rem; background: var(--teal-soft); color: var(--teal); }
.res-part-add:hover { background: var(--teal-hover); }
.res-part-body { padding: 4px 10px 12px; }
.res-part-body[hidden] { display: none; }
.res-part-empty { padding: 8px 4px; font-size: 0.85rem; }
.res-part-new { align-self: flex-start; background: none; border: 1px dashed var(--border); color: var(--muted); }
.res-part-new:hover { border-color: var(--teal); color: var(--teal); background: var(--teal-soft); }

/* ---------- Repeat chooser ---------- */
.rp-overlay { position: fixed; inset: 0; z-index: 500; display: flex; align-items: center; justify-content: center; padding: 16px; background: rgba(20, 30, 40, 0.4); }
.rp-box { width: min(360px, 100%); max-height: 92vh; overflow: auto; padding: 20px; border-radius: var(--radius); background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: 0 12px 40px rgba(0, 0, 0, 0.3); animation: dlg-in 0.12s ease-out; }
.rp-title { margin: 0 0 12px; font-size: 1.1rem; }
.rp-label { margin: 12px 0 6px; font-size: 0.8rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.rp-days { display: flex; justify-content: space-between; gap: 4px; }
.rp-day { width: 40px; height: 40px; border-radius: 50%; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-weight: 700; cursor: pointer; }
.rp-day:hover { background: var(--teal-soft); }
.rp-day.on { background: var(--teal-fill, var(--teal)); border-color: var(--teal); color: #fff; }
.rp-quick { display: flex; gap: 14px; margin-top: 8px; }
.rp-quick .link-btn { font-size: 0.85rem; }
.rp-end { display: flex; align-items: center; gap: 8px; margin: 6px 0; cursor: pointer; }
.rp-end-text { color: var(--text); font-size: 0.92rem; }
.rp-date { padding: 7px 12px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer; }
.rp-date.idle, .rp-count.idle { opacity: 0.55; }
.rp-date:hover { background: var(--teal-soft); }
.rp-count { width: 70px; padding: 7px 8px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.rp-note { min-height: 1.2em; margin: 10px 0 0; color: var(--muted); font-size: 0.85rem; }
.rp-err { min-height: 1.2em; margin: 4px 0 0; color: var(--danger, #c0392b); font-size: 0.85rem; }
.rp-foot { display: flex; align-items: center; gap: 8px; margin-top: 10px; }
.rp-foot .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.rp-foot .primary-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.clock-repeat { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; margin: 6px 0 10px; padding: 9px 12px; border-radius: 12px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.88rem; cursor: pointer; text-align: left; }
.clock-repeat:hover, .clock-repeat:focus-visible { background: var(--teal-soft); outline: none; }
.clock-repeat.on { border-color: var(--teal); color: var(--teal); font-weight: 600; }
.clock-repeat-val { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dlg-choices { display: flex; flex-direction: column; gap: 8px; margin-top: 14px; }
.dlg-choice { width: 100%; }
.dlg-choice-cancel { align-self: center; }
.time-btn .rep-mark { margin-left: 3px; }
.rep-badge { margin-left: 4px; color: var(--teal); font-weight: 700; }
.cal-t-repeat { margin: 6px 0 0; font-size: 0.85rem; }
.cal-t-repeat.on { background: var(--teal-soft); color: var(--teal); font-weight: 600; }

/* ---------- Selecting, cut / copy / paste ---------- */
.sel-box { display: none; width: 18px; height: 18px; flex: none; accent-color: var(--teal); cursor: pointer; }
#view-files.selecting .sel-box { display: inline-block; }
#view-files.selecting .file-item, #view-files.selecting .folder-card { cursor: pointer; }
.file-item.selected, .folder-card.selected { border-color: var(--teal); background: var(--teal-faint); box-shadow: 0 0 0 1px var(--teal); }
.file-item.cut, .folder-card.cut { opacity: 0.5; }
.folder-card .sel-box { margin-left: 12px; }
#view-files[data-view="gallery"] .file-item .sel-box, #view-files[data-view="gallery"] .folder-card .sel-box { position: absolute; top: 17px; left: 14px; z-index: 2; margin: 0; }
#view-files[data-view="gallery"] .file-item .file-grip { left: 40px; }
.sel-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 0 0 14px; padding: 10px 14px; border-radius: var(--radius); background: var(--card); border: 1px solid var(--teal); position: sticky; top: 8px; z-index: 5; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12); }
.sel-bar[hidden], .res-msg[hidden] { display: none; }
.sel-count { font-weight: 700; margin-right: 6px; }
.sel-bar .ghost-btn { background: var(--teal-soft); color: var(--teal); }
.sel-bar .ghost-btn:disabled { opacity: 0.45; cursor: not-allowed; }
.sel-bar .sel-danger:not(:disabled) { color: var(--danger, #c0392b); }
.res-msg { margin: 0 0 12px; padding: 9px 14px; border-radius: 10px; background: var(--teal-soft); color: var(--teal); font-size: 0.9rem; }
.res-part-paste { padding: 5px 12px; font-size: 0.82rem; }
.split-head .res-part-paste { margin-left: 6px; }
.tp-box { width: min(460px, 100%); }
.tp-tree { max-height: 46vh; overflow: auto; margin: 10px 0; padding: 4px; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); }
.tp-row { display: flex; align-items: center; gap: 6px; width: 100%; padding: 7px 12px; border: none; border-radius: 8px; background: none; color: var(--text); font: inherit; text-align: left; cursor: pointer; }
.tp-row:hover:not(:disabled), .tp-row:focus-visible { background: var(--teal-soft); outline: none; }
.tp-row.on { background: var(--teal-fill, var(--teal)); color: #fff; }
.tp-row:disabled { opacity: 0.4; cursor: not-allowed; }
.tp-page { font-weight: 700; }
.tp-caret { width: 14px; color: var(--muted); }
.tp-row.on .tp-caret { color: #fff; }
.tp-where { margin: 0 0 10px; color: var(--muted); font-size: 0.85rem; overflow-wrap: anywhere; }
.tp-place { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.tp-place[hidden] { display: none; }
.tp-place-label { font-size: 0.85rem; font-weight: 700; color: var(--muted); }
.tp-select { flex: 1; padding: 8px 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; }
.tp-err { min-height: 1em; margin: 0 0 6px; color: var(--danger, #c0392b); font-size: 0.85rem; }

/* ---------- Viewer: split button on file rows, notes popup, open in player ---------- */
.vt-row { position: relative; }
.vt-row .vt-file { padding-right: 36px; }
.vt-folder > .vt-row { width: calc(100% - 12px); }
.vt-folder > .vt-row .vt-file { width: 100%; }
.vt-split { position: absolute; right: 4px; top: 50%; transform: translateY(-50%); display: grid; place-items: center; width: 28px; height: 28px; padding: 0; border: none; border-radius: 7px; background: var(--card); color: var(--teal); cursor: pointer; opacity: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2); transition: opacity 0.12s; }
.vt-row:hover .vt-split, .vt-row:focus-within .vt-split { opacity: 1; }
.vt-split:hover { background: var(--teal-fill, var(--teal)); color: #fff; }
.vt-row .vt-file.current ~ .vt-split { background: #fff; }
@media (hover: none) { .vt-split { opacity: 1; } }
.viewer-side-foot { flex: none; padding: 10px; border-top: 1px solid var(--border); }
.viewer-notes-btn { width: 100%; padding: 9px 12px; border: none; border-radius: 10px; background: var(--teal-soft); color: var(--teal); font: inherit; font-weight: 700; cursor: pointer; }
.viewer-notes-btn:hover, .viewer-notes-btn[aria-expanded="true"] { background: var(--teal-fill, var(--teal)); color: #fff; }
.viewer-note { position: absolute; right: calc(100% + 12px); bottom: 12px; z-index: 8; width: min(360px, 90vw); display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 14px; background: var(--card); color: var(--text); border: 1px solid var(--border); box-shadow: 0 10px 32px rgba(0, 0, 0, 0.4); }
.viewer-note[hidden] { display: none; }
.vn-head { display: flex; align-items: baseline; gap: 8px; }
.vn-day { color: var(--muted); font-size: 0.82rem; }
.vn-status { margin-left: auto; color: var(--muted); font-size: 0.78rem; }
.vn-close { border: none; background: none; color: var(--muted); font-size: 1.4rem; line-height: 1; cursor: pointer; padding: 0 4px; }
.vn-close:hover { color: var(--danger); }
.vn-text { width: 100%; height: 240px; resize: vertical; padding: 10px; border-radius: 10px; border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; font-size: 0.92rem; }
.vn-text:focus { outline: 2px solid var(--teal); outline-offset: -1px; }
.vn-hint { margin: 0; color: var(--muted); font-size: 0.75rem; }
@media (max-width: 800px) { .viewer-note { right: 8px; bottom: 64px; width: calc(100% - 16px); } }
.viewer-media { position: relative; }
.viewer-extplay { position: absolute; top: 10px; right: 10px; z-index: 3; padding: 7px 12px; border: none; border-radius: 9px; background: rgba(0, 0, 0, 0.6); color: #fff; font: inherit; font-size: 0.82rem; cursor: pointer; opacity: 0; transition: opacity 0.15s; }
.viewer-media:hover .viewer-extplay, .viewer-extplay:focus-visible, .viewer-status-on .viewer-extplay { opacity: 1; }
.viewer-extplay:hover { background: var(--teal-fill, var(--teal)); }
.viewer-extplay[hidden] { display: none; }
.vpane-audio { position: relative; }
.vpane-audio .viewer-extplay { position: static; opacity: 1; margin-top: 12px; }
.vpane-audio { flex-wrap: wrap; justify-content: center; }
.vpane-audio .viewer-extplay { white-space: nowrap; }
.viewer-stream-note { position: absolute; left: 12px; right: 12px; bottom: 64px; z-index: 3; display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: 10px; padding: 8px 14px; border-radius: 12px; background: rgba(0, 0, 0, 0.72); color: #fff; font-size: 0.85rem; text-align: center; }
.viewer-stream-note[hidden] { display: none; }
.viewer-note-btn { padding: 5px 12px; border: none; border-radius: 8px; background: var(--teal-fill, var(--teal)); color: #fff; font: inherit; font-size: 0.82rem; cursor: pointer; }
.viewer-note-btn:disabled { opacity: 0.6; cursor: wait; }
.res-file { margin-top: 8px; }
.res-file .file-actions { flex-wrap: wrap; }
.res-file a.ghost-btn { text-decoration: none; display: inline-block; }
.res-file-link { cursor: pointer; }
.res-file-link:hover { color: var(--teal); text-decoration: underline; }
.res-compact .res-file { flex-wrap: wrap; }
.icon-btn { display: inline-grid; place-items: center; width: 36px; height: 34px; padding: 0; }
.icon-btn svg { display: block; }
.rename-btn svg { display: block; }
#view-files[data-view="gallery"] .file-actions .icon-btn { flex: 1 1 0; width: auto; }
.folder-card .rename-btn svg { width: 15px; height: 15px; }
#view-files[data-view="gallery"] .file-item .file-grip { opacity: 0.9; }
#view-files[data-view="gallery"] .file-item.dragging { opacity: 0.55; }
.res-part-move { display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; }
.res-part-move:hover:not(:disabled) { background: var(--teal-soft); color: var(--teal); }
.res-part-move:disabled { opacity: 0.3; cursor: default; }
.icon-action:disabled { opacity: 0.3; cursor: default; }

/* Notes: one line high, growing with the text */
.day-note { min-height: 0; resize: none; overflow-y: hidden; line-height: 1.5; }
.vn-text { height: auto; min-height: 0; resize: none; overflow-y: hidden; line-height: 1.5; }

/* The viewer note floats over the page: it does not depend on the right pane, and can be dragged */
.viewer-note { position: fixed; right: auto; z-index: 9; }
.viewer:not(.side-hidden) .viewer-note:not(.moved) { right: 292px; bottom: 12px; }
.viewer.side-hidden .viewer-note:not(.moved) { right: 22px; bottom: 112px; }
.viewer-note.moved { right: auto; bottom: auto; }
.viewer-note .vn-head { cursor: grab; user-select: none; touch-action: none; }
.viewer-note.dragging { box-shadow: 0 14px 40px rgba(0, 0, 0, 0.55); }
.viewer-note.dragging .vn-head { cursor: grabbing; }
.viewer-note-fab { display: none; position: absolute; right: 22px; bottom: 64px; z-index: 9; width: 42px; height: 42px; padding: 0; place-items: center; border: none; border-radius: 50%; background: var(--teal-fill, var(--teal)); color: #fff; cursor: pointer; box-shadow: 0 3px 12px rgba(0, 0, 0, 0.45); }
.viewer-note-fab:hover, .viewer-note-fab[aria-expanded="true"] { background: #0b7f7c; }
.viewer.side-hidden .viewer-note-fab { display: grid; }
@media (max-width: 800px) { .viewer:not(.side-hidden) .viewer-note:not(.moved) { right: 8px; bottom: 64px; } .viewer-note { width: min(360px, calc(100vw - 16px)); } }

/* ---------- Today in the calendar has its own colour (orange), also in the "Any time" column ---------- */
.cal-date.today { background: var(--today); color: #fff; }
.cal-date.today span { color: #fff; }
.cal-cell.today, .cal-cell.cal-any.today, .cal-cell.weekend.cal-any.today { background: var(--today-faint); }

/* ---------- A completed task in the calendar shows a tick inside its circle ---------- */
.cal-tick { position: relative; width: 14px; height: 14px; }
.cal-chip.done .cal-tick::after { content: ""; position: absolute; left: 3.5px; top: 0.5px; width: 3.5px; height: 6.5px; border: solid var(--bg); border-width: 0 1.8px 1.8px 0; transform: rotate(45deg); }

/* ---------- Night mode: neutral greys and black (no leftover teal) ---------- */
:root[data-theme="dark"] .topbar { background: #1f1f1f; border-bottom: 1px solid var(--border); box-shadow: none; }
:root[data-theme="dark"] .vs-btn.active,
:root[data-theme="dark"] body.previewing-user .role-pill { color: #222; }
:root[data-theme="dark"] .back-link:hover, :root[data-theme="dark"] .back-link:focus-visible { box-shadow: none; }

/* ---------- Task page: notes look like the Dashboard notes; resources can hold several items ---------- */
.task-side .task-notes-card { padding: 24px; gap: 0; }
.task-side .task-notes-card h2 { font-size: 1.2rem; color: var(--text); }
.task-side .task-notes-card .panel-header { margin-bottom: 14px; }
.task-side .day-note { resize: none; }
.res-or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 0.85rem; }
.res-or::before, .res-or::after { content: ""; flex: 1; height: 1px; background: var(--border); }
.res-list { display: flex; flex-direction: column; gap: 14px; margin-top: 6px; }
.res-item { display: flex; flex-direction: column; gap: 8px; min-width: 0; }

/* ---------- Timeline page ---------- */
.timeline-mode .main-col > :not(.timeline-panel) { display: none; }
.timeline-mode .main-col { position: sticky; top: calc(var(--topbar-h) + 32px); }
.timeline-panel[hidden] { display: none; }
.timeline-panel { --tl-label: 92px; display: flex; flex-direction: column; height: calc(100vh - var(--topbar-h) - 64px); min-height: 420px; padding: 24px 24px 0; overflow: hidden; }
.tl-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex: none; }
.tl-progress { display: flex; align-items: center; gap: 12px; margin: 14px 0 12px; flex: none; }
.tl-bar { flex: 1; height: 8px; border-radius: 8px; background: var(--border); overflow: hidden; }
.tl-fill { display: block; height: 100%; width: 0; border-radius: 8px; background: var(--teal-fill, var(--teal)); transition: width 0.4s ease; }
.tl-count { font-size: 0.85rem; color: var(--muted); white-space: nowrap; }
.tl-scroll { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: none; -ms-overflow-style: none; margin: 0 -24px; padding: 0 24px; border-top: 1px solid var(--border); }
.tl-scroll::-webkit-scrollbar { display: none; width: 0; height: 0; }
.tl-body { position: relative; min-height: 100%; padding: 18px 0 40px; }
.tl-line { position: absolute; left: calc(var(--tl-label) - 1px); top: 0; bottom: 0; width: 2px; background: var(--border); }
.tl-item { position: relative; display: grid; grid-template-columns: var(--tl-label) minmax(0, 1fr); padding-bottom: 16px; }
.tl-time { text-align: right; padding: 9px 20px 0 0; font-size: 0.85rem; font-weight: 600; line-height: 20px; white-space: nowrap; }
.tl-item.anytime .tl-time { color: var(--muted); font-weight: 500; }
.tl-node { position: absolute; left: calc(var(--tl-label) - 6px); top: 13px; width: 12px; height: 12px; border-radius: 50%; background: var(--card); border: 2px solid var(--teal-fill, var(--teal)); box-sizing: border-box; }
.tl-item.done .tl-node { background: var(--teal-fill, var(--teal)); }
.tl-card { margin-left: 22px; min-width: 0; border: 1px solid var(--border); border-radius: 12px; background: var(--surface-2); overflow: hidden; }
.tl-row { display: flex; align-items: center; gap: 12px; padding: 10px 14px; min-height: 38px; }
.tl-row input[type="checkbox"] { width: 18px; height: 18px; flex: none; cursor: pointer; accent-color: var(--teal); }
.tl-title-text { flex: 1; min-width: 0; word-break: break-word; font-weight: 500; }
.tl-item.done .tl-title-text { text-decoration: line-through; color: var(--muted); }
.tl-item.done .tl-card { opacity: 0.75; }
.tl-dur { flex: none; font-size: 0.8rem; color: var(--muted); }
.tl-dur:empty { display: none; }
.tl-split { display: grid; grid-template-columns: 1fr 1fr; border-top: 1px solid var(--border); }
.tl-col { padding: 10px 14px; min-width: 0; }
.tl-col + .tl-col { border-left: 1px solid var(--border); }
.tl-col h3 { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 4px; }
.tl-desc { white-space: pre-wrap; word-break: break-word; font-size: 0.88rem; line-height: 1.45; }
.tl-none { font-size: 0.85rem; color: var(--muted); }
.tl-reslist { display: flex; flex-direction: column; gap: 4px; }
.tl-res { font-size: 0.88rem; color: var(--teal); text-decoration: none; overflow-wrap: anywhere; }
.tl-res:hover { text-decoration: underline; }
.tl-res.gone { color: var(--muted); text-decoration: line-through; }
.tl-empty { margin: 4px 0 0 calc(var(--tl-label) + 22px); color: var(--muted); }
.tl-now { position: absolute; left: var(--tl-label); top: 0; z-index: 2; width: 0; height: 0; transition: top 1s linear; pointer-events: none; }
.tl-now[hidden] { display: none; }
.tl-now-dot { position: absolute; left: -7px; top: -7px; width: 14px; height: 14px; border-radius: 50%; background: var(--now, #ff7a59); box-shadow: 0 0 0 3px var(--card), 0 0 10px 3px var(--now, #ff7a59); animation: tl-glow 2s ease-in-out infinite; }
.tl-now-label { position: absolute; right: 20px; top: -11px; padding: 2px 8px; border-radius: 10px; background: var(--now, #ff7a59); color: #fff; font-size: 0.75rem; font-weight: 700; line-height: 18px; white-space: nowrap; }
@keyframes tl-glow { 0%, 100% { box-shadow: 0 0 0 3px var(--card), 0 0 6px 2px var(--now, #ff7a59); } 50% { box-shadow: 0 0 0 3px var(--card), 0 0 16px 6px var(--now, #ff7a59); } }
@media (prefers-reduced-motion: reduce) { .tl-now-dot { animation: none; } .tl-now { transition: none; } }
@media (max-width: 800px) { .timeline-panel { --tl-label: 74px; padding: 18px 16px 0; height: 75vh; } .timeline-mode .main-col { position: static; } .tl-scroll { margin: 0 -16px; padding: 0 16px; } .tl-split { grid-template-columns: 1fr; } .tl-col + .tl-col { border-left: none; border-top: 1px solid var(--border); } }
:root[data-theme="dark"] .tl-now-dot { --now: #ff8a6b; }
.tl-actions { display: flex; gap: 8px; flex: none; }
.tl-card.collapsed .tl-split { display: none; }
.tl-fold { flex: none; display: grid; place-items: center; width: 26px; height: 26px; padding: 0; border: none; border-radius: 8px; background: none; color: var(--muted); cursor: pointer; }
.tl-fold:hover { background: var(--teal-soft); color: var(--teal); }
.tl-fold svg { transition: transform 0.15s; }
.tl-fold.open svg { transform: rotate(180deg); }

/* ---------- Users page: list on the left, details of the chosen user on the right (stays in place) ---------- */
.users-layout { display: grid; grid-template-columns: minmax(0, 1fr) 380px; gap: 20px; align-items: start; max-width: 1100px; }
.users-layout .users-list { max-width: none; }
.user-row { cursor: pointer; transition: border-color 0.15s, background 0.15s; }
.user-row:hover { border-color: var(--teal); }
.user-row.selected { border-color: var(--teal); background: var(--teal-faint); }
.user-row:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.user-role-tag { flex: none; font-size: 0.75rem; font-weight: 600; padding: 3px 10px; border-radius: 12px; background: var(--surface-2); color: var(--muted); border: 1px solid var(--border); }
.user-role-tag.admin { background: var(--teal-soft); color: var(--teal); border-color: transparent; }
.users-detail { position: sticky; top: calc(var(--topbar-h) + 24px); max-height: calc(100vh - var(--topbar-h) - 48px); overflow-y: auto; scrollbar-width: thin; padding: 22px; display: flex; flex-direction: column; gap: 6px; }
.users-detail-empty { color: var(--muted); }
.ud-top { display: flex; align-items: center; gap: 14px; margin-bottom: 8px; }
.ud-avatar { width: 56px; height: 56px; font-size: 1.1rem; }
.ud-facts { display: grid; grid-template-columns: auto 1fr; gap: 6px 14px; font-size: 0.88rem; margin-bottom: 8px; }
.ud-facts dt { color: var(--muted); }
.ud-h { font-size: 0.95rem; margin: 12px 0 4px; }
.ud-note { font-size: 0.82rem; color: var(--muted); margin-bottom: 4px; }
.users-detail .role-seg { align-self: flex-start; margin-left: 0; }
.ud-funcs { list-style: none; display: flex; flex-direction: column; gap: 2px; padding: 0; }
.ud-func { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.ud-func:last-child { border-bottom: none; }
.ud-func-label { font-size: 0.88rem; line-height: 1.35; }
.perm-switch { flex: none; position: relative; width: 38px; height: 22px; padding: 0; border: none; border-radius: 12px; background: var(--faint); cursor: pointer; transition: background 0.15s; }
.perm-switch.on { background: var(--teal-fill, var(--teal)); }
.perm-switch:disabled { cursor: not-allowed; opacity: 0.55; }
.perm-knob { position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform 0.15s; }
.perm-switch.on .perm-knob { transform: translateX(16px); }
@media (max-width: 900px) { .users-layout { grid-template-columns: 1fr; } .users-detail { position: static; max-height: none; } }

/* ---------- Things a regular user can be given one by one (see the Users page) ---------- */
body:not(.cap-sections) [data-cap="sections"],
body:not(.cap-upload) [data-cap="upload"],
body:not(.cap-folders) [data-cap="folders"],
body:not(.cap-files) [data-cap="files"],
body:not(.cap-media) [data-cap="media"],
body:not(.cap-pomodoro) [data-cap="pomodoro"],
body:not(.cap-spotify) [data-cap="spotify"] { display: none !important; }
body.cap-sections .resource-card[data-id] { cursor: grab; }
.ud-presets { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 6px; }
.ud-preset { font: inherit; font-size: 0.8rem; padding: 4px 12px; border: 1px solid var(--border); border-radius: 14px; background: var(--surface-2); color: var(--text); cursor: pointer; }
.ud-preset:hover { border-color: var(--teal); }
.ud-preset.active { background: var(--teal-soft); color: var(--teal); border-color: transparent; font-weight: 600; }
.ud-func-text { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.ud-until { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 0.78rem; color: var(--muted); align-items: baseline; }
.ud-until .link-btn { font-size: 0.78rem; }
.ud-expired { color: var(--danger); }
.perm-switch:not(:disabled):hover { filter: brightness(1.08); }

/* ---------- Invite links ---------- */
.users-main { min-width: 0; display: flex; flex-direction: column; gap: 12px; }
.users-actions { display: flex; justify-content: flex-end; }
.invite-form { display: flex; flex-direction: column; gap: 12px; padding: 18px; }
.invite-form[hidden], .invite-result[hidden], .invites-box[hidden] { display: none; }
.invite-form input, .invite-form select, .invite-link-input { width: 100%; padding: 9px 11px; border: 1px solid var(--border); border-radius: 10px; font: inherit; background: var(--surface-2); color: var(--text); }
.invite-buttons { display: flex; justify-content: flex-end; gap: 8px; }
.invite-result { padding: 18px; display: flex; flex-direction: column; gap: 8px; }
.invite-link-row { display: flex; gap: 8px; }
.invites-box h2 { font-size: 1rem; margin: 6px 0 8px; }
.invites-list { list-style: none; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.invite-row { display: flex; align-items: center; gap: 14px; padding: 10px 16px; }
.invite-info { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.invite-remove { flex: none; }

/* Upload queue (bottom left, on every page) */
.uq { position: fixed; right: 16px; bottom: 16px; z-index: 130; transition: transform 0.25s ease; width: min(360px, calc(100vw - 32px)); background: var(--card); color: var(--text); border: 1px solid var(--border); border-radius: 14px; box-shadow: 0 8px 28px rgba(0, 0, 0, 0.22); overflow: hidden; }
.uq[hidden], .uq [hidden] { display: none !important; }
.uq-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px; border-bottom: 1px solid var(--border); }
.uq-title { flex: 1; font-size: 0.9rem; }
.uq-btn { border: none; background: none; color: var(--muted); font: inherit; font-size: 0.8rem; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.uq-btn:hover { color: var(--text); background: var(--accent-soft); }
.uq-list { max-height: 260px; overflow-y: auto; padding: 4px 12px 8px; }
.uq-item { padding: 7px 0; }
.uq-item + .uq-item { border-top: 1px solid var(--border); }
.uq-top { display: flex; align-items: center; gap: 8px; }
.uq-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.85rem; }
.uq-status { flex: none; max-width: 45%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 0.78rem; color: var(--muted); }
.uq-item[data-state="failed"] .uq-status { color: #d6453d; }
.uq-item[data-state="done"] .uq-status { color: var(--teal); }
.uq-bar { height: 4px; margin-top: 6px; border-radius: 4px; background: var(--border); overflow: hidden; }
.uq-fill { height: 100%; width: 0; background: var(--teal-fill, var(--teal)); transition: width 0.2s linear; }

/* Dark blue theme: same dark rules, only the colour values change (data-tone="blue" is set next to data-theme="dark") */
:root[data-theme="dark"][data-tone="blue"] {
  --bg: #0a1020;
  --card: #121a2e;
  --text: #e6ebf7;
  --muted: #8e9bb8;
  --border: #223051;
  --accent: #8fb0ff;
  --accent-soft: #1d2a4a;
  --danger: #ff6b70;
  --surface-2: #16203a;
  --teal-hover: #26365e;
  --teal-faint: #131c33;
  --teal-line: #2b3c66;
  --today: #2c4a8f;
  --today-faint: #1d2e57;
  --accent-hover: #2a3a64;
  --faint: #3a4a70;
  --danger-soft: #301c24;
  --paper-bg: #070b16;
  --teal: #8fb0ff;
  --teal-fill: #2f4fa8;
  --teal-soft: #1b2848;
}
:root[data-theme="dark"][data-tone="blue"] .topbar { background: #0f1830; }
:root[data-theme="dark"][data-tone="blue"] .drop-zone .primary-btn:hover { background: #3a5cc4; }

/* Theme picker on the Profile page */
.theme-card { margin-top: 16px; }
.theme-card h2 { font-size: 1.05rem; margin-bottom: 4px; }
.theme-options { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.theme-opt { display: flex; flex-direction: column; align-items: center; gap: 8px; padding: 10px; border: 2px solid var(--border); border-radius: 14px; background: var(--card); color: var(--text); font: inherit; font-size: 0.85rem; cursor: pointer; }
.theme-opt:hover { border-color: var(--teal); }
.theme-opt[aria-checked="true"] { border-color: var(--teal); box-shadow: 0 0 0 1px var(--teal); font-weight: 600; }
.theme-opt:focus-visible { outline: 2px solid var(--teal); outline-offset: 2px; }
.theme-swatch { display: flex; flex-direction: column; justify-content: center; gap: 6px; width: 108px; height: 64px; padding: 10px; border-radius: 9px; }
.theme-swatch i { display: block; height: 10px; border-radius: 4px; }
.theme-swatch i:last-child { width: 60%; }
.sw-light { background: #f4f5f9; } .sw-light i { background: #ffffff; box-shadow: 0 0 0 1px #e5e7ef; } .sw-light i:last-child { background: #0f9d9a; }
.sw-dark { background: #0b0b0b; } .sw-dark i { background: #1c1c1c; } .sw-dark i:last-child { background: #5a5a5a; }
.sw-blue { background: #0a1020; } .sw-blue i { background: #16203a; } .sw-blue i:last-child { background: #4f74e8; }
.uq.folded { transform: translateY(calc(100% - 40px)); cursor: pointer; box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.2); }
.uq.folded:hover { transform: translateY(calc(100% - 46px)); }
.uq.folded .uq-head { border-bottom: none; }
.reminders { bottom: calc(16px + var(--uq-h, 0px)); transition: bottom 0.25s ease; }
@media (prefers-reduced-motion: reduce) { .uq, .reminders { transition: none; } }

/* PDF viewer drawn by the page itself (phones and tablets) */
.pdfv { position: relative; display: flex; flex-direction: column; width: 100%; height: 100%; min-height: 0; background: #2b3238; }
.pdfv-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 6px 8px; background: #11161a; color: #e6e9ec; font-size: 0.82rem; }
.pdfv-count { flex: 1; min-width: 0; }
.pdfv-btn { display: inline-grid; place-items: center; min-width: 34px; height: 30px; padding: 0 10px; border: none; border-radius: 8px; background: #2b3540; color: #e6e9ec; font: inherit; font-size: 0.85rem; text-decoration: none; cursor: pointer; }
.pdfv-btn:hover { background: #3a4756; }
.pdfv-scroll { flex: 1; min-height: 0; overflow: auto; touch-action: pan-x pan-y; -webkit-overflow-scrolling: touch; }
.pdfv-pages { width: max-content; min-width: 100%; padding: 8px 0; }
.pdfv-page { margin: 0 auto 10px; background: #fff; box-shadow: 0 1px 6px rgba(0, 0, 0, 0.4); }
.pdfv-canvas { display: block; width: 100%; height: 100%; }
.pdfv-msg { padding: 24px 16px; color: #e6e9ec; text-align: center; }

/* Parts of a page an admin has hidden from this user */
.hidden-for-user { display: none !important; }
.ud-sub { margin: 14px 0 4px; font-size: 0.8rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--muted); }

/* Users page: folders and files list of a Resources page */
.ud-items { list-style: none; padding: 0 0 6px; }
.ud-tree { margin: 6px 0 8px; padding: 6px 8px; border: 1px solid var(--border); border-radius: 10px; background: var(--surface-2, var(--bg)); max-height: 340px; overflow: auto; }
.ud-tree-list { list-style: none; margin: 0; padding: 0; }
.ud-tree .ud-func { padding-top: 5px; padding-bottom: 5px; }
.ud-tree-row .ud-func-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ud-chev { flex: none; width: 22px; height: 22px; padding: 0; border: none; border-radius: 6px; background: none; color: var(--muted); cursor: pointer; transition: transform 0.15s; }
.ud-chev.open { transform: rotate(90deg); }
.ud-chev:hover { background: var(--teal-soft); color: var(--teal); }
.ud-dim { opacity: 0.55; }
.ud-count { color: var(--muted); font-size: 0.78rem; font-weight: 400; }
