/* ===== Reset & Base ===== */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

:root {
  --color-bg: #f4f4f4;
  --color-surface: #ffffff;
  --color-primary: #0faeae;
  --color-primary-hover: #0c9494;
  --color-primary-rgb: 15, 174, 174;
  --color-danger: #dc2626;
  --color-danger-hover: #b91c1c;
  --color-success: #4cb820;
  --color-text: #222222;
  --color-text-light: #666666;
  --color-border: #e0e0e0;
  --color-btn-primary-text: #ffffff;
  --radius: 6px;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}

/* ===== Dark Mode ===== */
[data-theme="dark"] {
  --color-bg: #1a1a1a;
  --color-surface: #222222;
  --color-primary: #14eeee;
  --color-primary-hover: #4df4f4;
  --color-primary-rgb: 20, 238, 238;
  --color-danger: #ef4444;
  --color-danger-hover: #f87171;
  --color-success: #6fff2c;
  --color-text: #e8e8e8;
  --color-text-light: #999999;
  --color-border: #333333;
  --color-btn-primary-text: #222222;
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
/* Plain badges only: status badges (.badge-*) keep their own colors. */
[data-theme="dark"] .badge:not([class*="badge-"]) {
  background: rgba(20, 238, 238, 0.15);
  color: #14eeee;
}
[data-theme="dark"] .tag {
  background: #333333;
  color: #cccccc;
}
[data-theme="dark"] .tag.active,
[data-theme="dark"] a.tag:hover {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}
[data-theme="dark"] .alert-success {
  background: rgba(111, 255, 44, 0.1);
  color: #6fff2c;
  border-color: rgba(111, 255, 44, 0.2);
}
[data-theme="dark"] .alert-error {
  background: rgba(239, 68, 68, 0.12);
  color: #fca5a5;
  border-color: rgba(239, 68, 68, 0.2);
}
[data-theme="dark"] .filter-bar input[type="text"] {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
[data-theme="dark"] .form-group input,
[data-theme="dark"] .form-group select,
[data-theme="dark"] .form-group textarea {
  background: var(--color-bg);
  color: var(--color-text);
}
[data-theme="dark"] .ql-toolbar.ql-snow {
  border-color: var(--color-border);
  background: var(--color-bg);
}
[data-theme="dark"] .ql-container.ql-snow {
  border-color: var(--color-border);
  background: var(--color-bg);
  color: var(--color-text);
}
[data-theme="dark"] .ql-snow .ql-stroke {
  stroke: var(--color-text-light);
}
[data-theme="dark"] .ql-snow .ql-fill {
  fill: var(--color-text-light);
}
[data-theme="dark"] .ql-snow .ql-picker-label {
  color: var(--color-text-light);
}

html {
  font-size: 17px;
}
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.6;
  min-height: 100vh;
  transition: background 0.3s ease, color 0.3s ease;
}

a {
  color: var(--color-primary);
  text-decoration: none;
}
a:hover {
  text-decoration: underline;
}

/* ===== Navigation ===== */
.main-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--color-surface);
  border-bottom: 1px solid var(--color-border);
  padding: 0 1.5rem;
  height: 56px;
  box-shadow: var(--shadow);
  transition: background 0.3s ease, border-color 0.3s ease;
}

.nav-brand a {
  display: flex;
  align-items: center;
}
.nav-brand img {
  height: 28px;
  width: auto;
}
.logo-dark { display: none; }
.logo-light { display: inline; }
[data-theme="dark"] .logo-dark { display: inline; }
[data-theme="dark"] .logo-light { display: none; }

.nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
}
.nav-links > a,
.nav-dropdown-toggle {
  color: var(--color-text-light);
  font-size: 0.9rem;
  font-weight: 500;
}
.nav-links > a:hover,
.nav-dropdown-toggle:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* Nav dropdown */
.nav-dropdown {
  position: relative;
}
.nav-dropdown-menu {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 160px;
  z-index: 100;
  padding: 0.25rem 0;
}
@media (min-width: 769px) {
  .nav-dropdown:hover .nav-dropdown-menu {
    display: block;
  }
}
.nav-dropdown-menu a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
  color: var(--color-text);
}
.nav-dropdown-menu a:hover {
  background: var(--color-bg);
  text-decoration: none;
}

/* Mega menu: each top-level menu opens a panel of titled links with a
   one-line description. Opens on hover and on keyboard focus (desktop). */
.nav-brand-name {
  margin-left: 0.75rem;
  padding-left: 0.75rem;
  border-left: 1px solid var(--color-border);
  color: var(--color-text);
  font-size: 0.95rem;
  font-weight: 600;
  white-space: nowrap;
}
.nav-brand a:hover { text-decoration: none; }
.nav-dropdown.active > .nav-dropdown-toggle {
  color: var(--color-text);
  box-shadow: inset 0 -2px 0 var(--color-primary);
}
.nav-mega .nav-dropdown-toggle { display: inline-block; padding: 0.35rem 0; }
.nav-single .nav-dropdown-toggle { display: inline-block; padding: 0.35rem 0; }
.nav-single .nav-dropdown-toggle::after { content: none !important; }
.nav-mega .nav-dropdown-menu {
  min-width: 290px;
  padding: 0.4rem;
}
.nav-mega.nav-admin .nav-dropdown-menu { left: auto; right: 0; }
.nav-dropdown-menu a.nav-mega-link {
  display: grid;
  gap: 0.1rem;
  padding: 0.55rem 0.7rem;
  border-radius: calc(var(--radius) - 2px);
}
.nav-mega-title { font-weight: 600; color: var(--color-text); font-size: 0.88rem; }
.nav-mega-desc { color: var(--color-text-light); font-size: 0.78rem; line-height: 1.35; }
.nav-dropdown-menu a.nav-mega-link.active { background: var(--color-bg); }
.nav-dropdown-menu a.nav-mega-link.active .nav-mega-title { color: var(--color-primary); }
@media (min-width: 769px) {
  .nav-dropdown:focus-within .nav-dropdown-menu { display: block; }
}

.nav-user {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-left: 0.5rem;
  padding-left: 1rem;
  border-left: 1px solid var(--color-border);
}

.nav-username {
  font-size: 0.85rem;
  color: var(--color-text-light);
}

.btn-link {
  background: none;
  border: none;
  color: var(--color-text-light);
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 500;
  padding: 0;
}
.btn-link:hover {
  text-decoration: underline;
  color: var(--color-primary);
}

.inline-form {
  display: inline;
}

/* Hamburger toggle (hidden on desktop) */
.nav-toggle {
  display: none;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  flex-direction: column;
  gap: 4px;
}
.nav-toggle-bar {
  display: block;
  width: 22px;
  height: 2px;
  background: var(--color-text);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.2s;
}
.nav-toggle.open .nav-toggle-bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.nav-toggle.open .nav-toggle-bar:nth-child(2) {
  opacity: 0;
}
.nav-toggle.open .nav-toggle-bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

/* ===== Theme Toggle ===== */
.theme-toggle {
  position: relative;
  width: 44px;
  height: 24px;
  border-radius: 12px;
  border: 1px solid var(--color-border);
  background: var(--color-bg);
  cursor: pointer;
  padding: 0;
  transition: background 0.3s ease, border-color 0.3s ease;
  flex-shrink: 0;
}
.theme-toggle:hover {
  border-color: var(--color-primary);
}
.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  position: absolute;
  top: 2px;
  transition: opacity 0.3s ease, transform 0.3s ease;
  color: var(--color-text-light);
}
.theme-toggle .icon-sun {
  left: 3px;
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}
.theme-toggle .icon-moon {
  right: 3px;
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
[data-theme="light"] .theme-toggle .icon-sun {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
[data-theme="light"] .theme-toggle .icon-moon {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

/* ===== Container ===== */
.container {
  max-width: 960px;
  margin: 0 auto;
  padding: 1.5rem;
}
.container-wide {
  max-width: 1280px;
  margin: 0 auto;
  padding: 1.5rem;
}
.container-full {
  max-width: 100%;
  margin: 0 auto;
  padding: 1.5rem 2rem;
  overflow-x: hidden;
}

/* ===== Alerts ===== */
.alert {
  padding: 0.75rem 1rem;
  border-radius: var(--radius);
  margin-bottom: 1rem;
  font-size: 0.9rem;
  animation: alertFade 3s ease-in forwards;
}
@keyframes alertFade {
  0%, 70% { opacity: 1; }
  100% { opacity: 0; }
}
.alert-success {
  background: rgba(111, 255, 44, 0.1);
  color: #2d8a0e;
  border: 1px solid rgba(111, 255, 44, 0.25);
}
.alert-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* ===== Auth Page ===== */
.auth-page {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 80vh;
}
.auth-card {
  background: var(--color-surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  width: 100%;
  max-width: 400px;
}
.auth-card h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.auth-logo {
  margin-bottom: 0.5rem;
}
.auth-logo img {
  height: 32px;
  width: auto;
}
.auth-card .subtitle {
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
}
.auth-link {
  margin-top: 1rem;
  font-size: 0.85rem;
  text-align: center;
}

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem 1rem;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s;
  line-height: 1.4;
  text-decoration: none;
}
.btn:hover {
  text-decoration: none;
}
.btn-primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
}
.btn-primary:hover {
  background: var(--color-primary-hover);
}
.btn-primary.btn-suggest {
  background: var(--color-success);
  color: #222;
}
.btn-primary.btn-suggest:hover {
  filter: brightness(0.9);
}
.btn-secondary {
  background: var(--color-surface);
  color: var(--color-text);
  border-color: var(--color-border);
}
.btn-secondary:hover {
  background: var(--color-bg);
}
.btn-danger {
  background: var(--color-danger);
  color: #fff;
}
.btn-danger:hover {
  background: var(--color-danger-hover);
}
.btn-sm {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  font-size: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  cursor: pointer;
}
.btn-sm:hover {
  background: var(--color-bg);
  text-decoration: none;
}
.btn-sm.btn-danger {
  background: var(--color-danger);
  color: #fff;
  border-color: var(--color-danger);
}
.input-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  width: 120px;
}
.add-category-form {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.add-category-form .input-sm {
  width: 200px;
}
.btn-group {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

/* ===== Forms ===== */
.form {
  max-width: 600px;
}
.form-group {
  margin-bottom: 1rem;
}
.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}
.form-row > .form-group {
  flex: 1;
  min-width: 0;
}
.form-group-grow {
  flex: 1;
  min-width: 0;
}
.form-group-sm {
  width: 90px;
  flex-shrink: 0;
}
.form-group label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}
.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-family: inherit;
  background: var(--color-surface);
  color: var(--color-text);
}
.form-group input[type="file"] {
  padding: 0;
  border: none;
  background: none;
}
.form-group input[type="file"]::file-selector-button {
  padding: 0.4rem 0.85rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-family: inherit;
  font-weight: 500;
  cursor: pointer;
  margin-right: 0.75rem;
  transition: background 0.15s, border-color 0.15s;
}
.form-group input[type="file"]::file-selector-button:hover {
  background: var(--color-bg);
  border-color: var(--color-primary);
}
.form-group input[type="checkbox"] {
  width: auto;
  margin-right: 0.4rem;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.15);
}
.form-help {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 0.3rem;
}
.checkbox-label {
  display: flex !important;
  align-items: center;
  font-weight: 400 !important;
}

/* ===== Sectioned wide form (client projects) ===== */
.form-wide {
  max-width: 920px;
}
.form-section {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
}
.form-section-title {
  margin: 0 0 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
}
.form-section > .form-group:last-child,
.form-section > .form-row:last-child {
  margin-bottom: 0;
}
.checkbox-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.checkbox-row input[type="checkbox"] {
  width: auto;
  margin: 0;
}
.checkbox-row label {
  font-weight: 400;
  margin: 0;
  cursor: pointer;
}
/* Phase date rows */
.phase-list {
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
  margin-top: 1.25rem;
}
.phase-item {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.5rem 1rem;
}
.phase-item .phase-name {
  flex: 0 0 110px;
  font-weight: 600;
  font-size: 0.875rem;
  padding-bottom: 0.55rem;
}
.phase-item .form-group {
  flex: 1;
  min-width: 150px;
  margin-bottom: 0;
}
.phase-days-box {
  flex: 0 0 64px;
  text-align: center;
}
.phase-days-box label {
  display: block;
  font-weight: 500;
  font-size: 0.875rem;
  margin-bottom: 0.3rem;
}
.phase-days {
  display: block;
  padding: 0.5rem 0;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}
.phase-total {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 1rem;
  margin-top: 0.85rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--color-border);
}
.phase-total-label {
  font-weight: 600;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
}
.phase-total-days {
  flex: 0 0 64px;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--color-primary);
}
.phase-item input[readonly],
.form-group input[readonly] {
  background: var(--color-bg);
  color: var(--color-text-light);
  cursor: not-allowed;
}
/* A phase End the user typed in (won't be auto-filled from the next Start). */
.phase-item input.phase-end.is-manual {
  border-color: var(--color-primary);
  box-shadow: inset 2px 0 0 var(--color-primary);
}
.form-cost-preview {
  margin-top: 1.25rem;
  padding-top: 1.1rem;
  border-top: 1px dashed var(--color-border);
}
.form-actions {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}
/* Fieldset used purely to lock all fields at once (archived projects) */
.form-fieldset {
  border: none;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.form-fieldset:disabled {
  opacity: 0.65;
}
.archive-banner {
  margin-bottom: 1.25rem;
  padding: 0.75rem 1rem;
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--color-text-light);
  border-radius: var(--radius);
  background: var(--color-surface);
  font-size: 0.9rem;
  color: var(--color-text-light);
}
.archive-banner strong {
  color: var(--color-text);
}
/* Section heading with an inline field on the right (e.g. Projected) */
.form-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.1rem;
  padding-bottom: 0.6rem;
  border-bottom: 1px solid var(--color-border);
}
.form-section-head .form-section-title {
  margin: 0;
  padding: 0;
  border: none;
}
.form-section-head-field {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.form-section-head-field label {
  margin: 0;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--color-text-light);
  white-space: nowrap;
}
.form-section-head-field select {
  width: auto;
  padding: 0.35rem 0.6rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  font-size: 0.85rem;
  font-family: inherit;
}

/* ===== Edit modal ===== */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 2.5rem 1rem;
  overflow-y: auto;
  background: rgba(0, 0, 0, 0.6);
}
.modal-overlay[hidden] {
  display: none;
}
.modal-dialog {
  width: 100%;
  max-width: 980px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 12px 44px rgba(0, 0, 0, 0.45);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.9rem 1.35rem;
  border-bottom: 1px solid var(--color-border);
  background: var(--color-surface);
  border-radius: var(--radius) var(--radius) 0 0;
}
.modal-title {
  margin: 0;
  font-size: 1.1rem;
}
.modal-close {
  padding: 0 0.35rem;
  border: none;
  background: none;
  color: var(--color-text-light);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
}
.modal-close:hover {
  color: var(--color-text);
}
.modal-body {
  padding: 1.35rem;
}
.modal-body .form-wide {
  max-width: none;
}
.modal-loading {
  color: var(--color-text-light);
}
body.modal-open {
  overflow: hidden;
}

/* ===== Expandable project rows ===== */
.data-table.projects-table th:first-child,
.data-table.projects-table td:first-child {
  width: 34px;
  text-align: center;
  padding-left: 0.5rem;
  padding-right: 0;
  color: var(--color-text-light);
}
.badge-excluded {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.05rem 0.4rem;
  border: 1px solid var(--color-border);
  border-radius: 999px;
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
  vertical-align: middle;
}
.project-row.js-open-edit {
  cursor: pointer;
}
.project-row.js-open-edit:hover {
  background: var(--color-bg);
}
.project-caret {
  display: inline-block;
  font-size: 0.7rem;
  transition: transform 0.15s ease;
}
.project-row.expanded .project-caret {
  transform: rotate(90deg);
}
.project-detail > td {
  background: var(--color-bg);
  padding: 1.25rem 1.35rem;
}
.project-detail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 1rem;
  align-items: start;
}
.detail-block {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 0.9rem 1.05rem;
}
.detail-block-wide {
  grid-column: 1 / -1;
}
.detail-block h4 {
  margin: 0 0 0.65rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--color-text-light);
  font-weight: 700;
}
.detail-line {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-size: 0.85rem;
  padding: 0.3rem 0;
}
.detail-line + .detail-line {
  border-top: 1px solid var(--color-border);
}
.detail-line .k {
  color: var(--color-text-light);
}
.detail-line .v {
  font-weight: 500;
  text-align: right;
  white-space: nowrap;
}
.detail-line-total {
  font-weight: 700;
  margin-top: 0.35rem;
  padding-top: 0.5rem;
  border-top: 2px solid var(--color-border) !important;
}
.detail-notes {
  font-size: 0.85rem;
  line-height: 1.55;
  margin: 0;
  color: var(--color-text);
}

/* ===== Page Header ===== */
.page-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.page-header h1 {
  flex: 1;
  font-size: 1.5rem;
}
.page-header-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.admin-utility-bar {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  justify-content: flex-end;
  margin-bottom: 0.5rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}
.admin-utility-bar .btn {
  background: #222;
  color: #e8e8e8;
  border-color: #444;
}
.admin-utility-bar .btn:hover {
  background: #333;
}

/* ===== Feature Request Cards ===== */
.feature-request-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.feature-request-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
}
.feature-request-header {
  display: flex;
  gap: 0.5rem;
  align-items: center;
  margin-bottom: 0.5rem;
}
.feature-request-card h3 {
  margin: 0 0 0.25rem;
  font-size: 1rem;
}
.feature-request-card .description {
  margin: 0 0 0.5rem;
}
.feature-request-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
}

/* ===== Admin Sub-nav ===== */
.admin-nav {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--color-border);
}
.admin-nav a {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--color-text-light);
}
.admin-nav a:hover {
  color: var(--color-primary);
  text-decoration: none;
}

/* ===== Dashboard ===== */
.dashboard h1 {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}
.lead {
  color: var(--color-text-light);
  margin-bottom: 1.5rem;
}
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 1rem;
}
/* One card look across the hub: surface, 1px border, shared radius and
   padding, no drop shadow. Only clickable cards (links) get the hover
   border. .link-card, .portal-card and .portal-strip-item use the same
   tokens. */
:root { --card-pad: 1.1rem 1.25rem; }
.card {
  display: block;
  background: var(--color-surface);
  padding: var(--card-pad);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  transition: border-color 0.15s;
}
a.card:hover {
  text-decoration: none;
  border-color: var(--color-primary);
}
.card h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
  color: var(--color-text);
}
.card p {
  color: var(--color-text-light);
  font-size: 0.9rem;
}

/* ===== Filter / Search Bar ===== */
.filter-bar {
  margin-bottom: 1rem;
}
.filter-bar input[type="text"] {
  width: 100%;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-size: 0.82rem;
  background: var(--color-surface);
  color: var(--color-text);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.filter-bar input[type="text"]::placeholder {
  color: var(--color-text-light);
  opacity: 0.7;
}
.filter-bar input[type="text"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.15);
}

/* ===== Tags ===== */
.tag-filters {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.tag-filters .label {
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--color-text-light);
}
.tag {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  background: #e0e0e0;
  color: var(--color-text);
  border-radius: 12px;
  font-size: 0.78rem;
}
.tag.active,
a.tag:hover {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  text-decoration: none;
}
.tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.5rem;
}
.tag.tag-primary {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  font-weight: 600;
  font-size: 0.8rem;
}
a.tag.tag-primary:hover {
  background: var(--color-primary-hover);
  color: var(--color-btn-primary-text);
  text-decoration: none;
}

/* ===== Tutorial List ===== */
.tutorial-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.tutorial-card {
  display: flex;
  flex-wrap: wrap;
  align-content: flex-start;
  gap: 1rem;
  background: var(--color-surface);
  padding: 1rem 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.tutorial-thumb {
  width: 80px;
  align-self: stretch;
  object-fit: cover;
  border-radius: var(--radius);
  flex-shrink: 0;
}
.tutorial-body {
  flex: 1;
  min-width: 0;
}
.tutorial-card h3 {
  font-size: 1rem;
  margin-bottom: 0.35rem;
}
.tutorial-card h3 a {
  color: var(--color-text);
  text-decoration: none;
}
.tutorial-card h3 a:hover {
  color: var(--color-primary);
}
.tutorial-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-bottom: 0.35rem;
}
.badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  background: rgba(var(--color-primary-rgb), 0.12);
  color: var(--color-primary);
}
.badge-pending { background: rgba(212, 147, 14, 0.15); color: #d4930e; }
.badge-reviewed { background: rgba(20, 238, 238, 0.15); color: var(--color-primary); }
.badge-accepted, .badge-in_progress { background: rgba(20, 238, 238, 0.2); color: var(--color-primary); }
.badge-completed { background: rgba(111, 255, 44, 0.15); color: var(--color-success); }
.badge-ongoing { background: rgba(139, 92, 246, 0.18); color: #a78bfa; }
.badge-rejected { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.badge-deferred { background: rgba(148, 148, 148, 0.15); color: #949494; }
.badge-abandoned { background: rgba(124, 111, 100, 0.18); color: #a39484; }
.badge-p0 { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }
.badge-p1 { background: rgba(212, 147, 14, 0.15); color: #d4930e; }
.badge-p2 { background: rgba(20, 238, 238, 0.15); color: var(--color-primary); }
.badge-p3 { background: rgba(148, 148, 148, 0.15); color: #949494; }
.text-muted { color: var(--color-text-light); font-size: 0.85rem; }
.text-danger { color: var(--color-danger); font-weight: 600; }
.description {
  font-size: 0.9rem;
  color: var(--color-text-light);
}

/* ===== Tutorial Pipeline Sidebar ===== */
.tutorials-index-wrapper {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.tutorials-index-main {
  flex: 1;
  min-width: 0;
}
.pipeline-sidebar {
  width: 280px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 1.5rem;
}
.pipeline-title {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  display: flex;
  align-items: center;
}
.pipeline-add-form {
  display: flex;
  gap: 0.35rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
}
.pipeline-input {
  flex: 1;
  min-width: 0;
  padding: 0.35rem 0.5rem;
  font-size: 0.8rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.pipeline-select {
  padding: 0.35rem 0.4rem;
  font-size: 0.75rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  color: var(--color-text);
}
.pipeline-admin-actions {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.pipeline-admin-actions .btn {
  width: 100%;
}
.pipeline-phase {
  margin-bottom: 0.75rem;
}
.pipeline-phase:last-child {
  margin-bottom: 0;
}
.pipeline-phase-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.3rem 0;
  margin-bottom: 0.35rem;
  border-bottom: 1px solid var(--color-border);
}
.pipeline-phase-label {
  font-size: 0.8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.pipeline-phase-count {
  font-size: 0.7rem;
  color: var(--color-primary);
  padding: 0.1rem 0.4rem;
  border-radius: 10px;
  font-weight: 600;
  background: rgba(20, 238, 238, 0.1);
}
.pipeline-phase[data-phase="review"] .pipeline-phase-label {
  color: #d4930e;
}
.pipeline-phase[data-phase="planning"] .pipeline-phase-label {
  color: var(--color-primary);
}
.pipeline-phase[data-phase="creating"] .pipeline-phase-label {
  color: var(--color-success);
}
.pipeline-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.pipeline-item {
  padding: 0.4rem 0;
  border-bottom: 1px solid var(--color-border);
  font-size: 0.82rem;
}
.pipeline-item:last-child {
  border-bottom: none;
}
.pipeline-item-title {
  font-weight: 500;
  color: var(--color-text);
  margin-bottom: 0.15rem;
}
.pipeline-item-meta {
  font-size: 0.72rem;
  color: var(--color-text-light);
}
.pipeline-item-actions {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  margin-top: 0.25rem;
}
.pipeline-item-actions select {
  font-size: 0.7rem;
  padding: 0.15rem 0.25rem;
  border: 1px solid var(--color-border);
  border-radius: 3px;
  background: var(--color-bg);
  color: var(--color-text);
}
.pipeline-delete {
  color: var(--color-danger);
  font-size: 1.1rem;
  cursor: pointer;
  border: none;
  background: none;
  padding: 0 0.25rem;
  line-height: 1;
}
.pipeline-delete:hover {
  opacity: 0.7;
}
.pipeline-empty {
  font-size: 0.75rem;
  color: var(--color-text-light);
  padding: 0.25rem 0;
  font-style: italic;
  margin: 0;
}
.promote-list {
  max-height: 400px;
  overflow-y: auto;
}
.promote-item {
  padding: 0.75rem;
  border-bottom: 1px solid var(--color-border);
  display: flex;
  gap: 0.75rem;
  align-items: center;
}
.promote-item:last-child {
  border-bottom: none;
}
.promote-item-info {
  flex: 1;
  min-width: 0;
}
.promote-item-title {
  font-weight: 500;
  font-size: 0.9rem;
}
.promote-item-desc {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 0.15rem;
}
.promote-item-meta {
  font-size: 0.75rem;
  color: var(--color-text-light);
  display: flex;
  gap: 0.5rem;
  margin-top: 0.15rem;
}

/* ===== Tutorial Detail ===== */
.tutorial-detail-wrapper.has-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}
.tutorial-detail-wrapper.has-sidebar .tutorial-detail {
  flex: 1;
  min-width: 0;
}
.tutorial-detail h1 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

/* ===== Series Sidebar ===== */
.series-sidebar {
  width: 260px;
  flex-shrink: 0;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem;
  position: sticky;
  top: 1.5rem;
}
.series-title {
  font-size: 0.95rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
}
.series-title span {
  text-transform: capitalize;
}
.series-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.series-item {
  padding: 0.4rem 0;
  font-size: 0.85rem;
  border-bottom: 1px solid var(--color-border);
}
.series-item:last-child {
  border-bottom: none;
}
.series-item a {
  color: var(--color-text);
}
.series-item a:hover {
  text-decoration: underline;
  color: var(--color-primary);
}
.series-item-current {
  font-weight: 600;
  color: var(--color-primary);
  padding-left: 0.75rem;
}
.tutorial-image {
  margin: 1rem 0;
}
.tutorial-image img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius);
}

/* Video player */
.video-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
  margin: 1rem 0;
  cursor: pointer;
}
.video-player .video-poster {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}
.video-play-btn {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 72px;
  height: 72px;
  background: rgba(0, 0, 0, 0.6);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
  pointer-events: none;
}
.video-play-btn svg {
  margin-left: 4px;
}
.video-player:hover .video-play-btn {
  background: rgba(var(--color-primary-rgb), 0.85);
  transform: translate(-50%, -50%) scale(1.1);
}
.video-player.playing {
  cursor: default;
}
.video-player.playing iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
/* Video modal */
.video-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.video-modal.open {
  display: flex;
}
.video-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
}
.video-modal-content {
  position: relative;
  width: 90vw;
  max-width: 960px;
  z-index: 1;
}
.video-modal-close {
  position: absolute;
  top: -40px;
  right: 0;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.video-modal-close:hover {
  color: var(--color-primary);
}
.video-modal-player {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border-radius: var(--radius);
  overflow: hidden;
}
.video-modal-player iframe {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border: none;
}
/* Suggestion modal */
.suggestion-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}
.suggestion-modal.open {
  display: flex;
}
.suggestion-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
}
.suggestion-modal-content {
  position: relative;
  width: 90vw;
  max-width: 500px;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 2rem;
  z-index: 1;
}
.suggestion-modal-content h3 {
  margin: 0 0 0.25rem;
  font-size: 1.25rem;
}
.suggestion-subtitle {
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: 0 0 1.25rem;
}
.suggestion-modal-close {
  position: absolute;
  top: 0.75rem;
  right: 0.75rem;
  background: none;
  border: none;
  color: var(--color-muted);
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.suggestion-modal-close:hover {
  color: var(--color-primary);
}
.suggestion-error {
  color: var(--color-danger, #e74c3c);
  font-size: 0.85rem;
  min-height: 1.2em;
  margin-bottom: 0.5rem;
}
#suggestion-form .form-group {
  margin-bottom: 1rem;
}
#suggestion-form button[type="submit"] {
  width: 100%;
}

.tutorial-description {
  margin: 1rem 0;
  line-height: 1.7;
}
.tutorial-description h2,
.tutorial-description h3 {
  margin-top: 1rem;
  margin-bottom: 0.5rem;
}
.tutorial-description ul,
.tutorial-description ol {
  margin-left: 1.5rem;
  margin-bottom: 0.75rem;
}
.tutorial-description pre {
  background: var(--color-bg);
  padding: 0.75rem;
  border-radius: var(--radius);
  overflow-x: auto;
  margin-bottom: 0.75rem;
}
.tutorial-description a {
  color: var(--color-primary);
}
.tutorial-link {
  margin: 1.25rem 0;
}
.actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 1.5rem;
  padding-top: 1rem;
  border-top: 1px solid var(--color-border);
}
.thumb-preview {
  display: block;
  max-width: 120px;
  margin-top: 0.3rem;
  border-radius: var(--radius);
}

/* ===== Link List ===== */
.link-category {
  margin-bottom: 1.5rem;
}
.category-title {
  font-size: 1.1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  margin-bottom: 0.75rem;
}
.link-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
}
.link-card {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  align-content: flex-start;
  gap: 0.75rem;
  background: var(--color-surface);
  padding: var(--card-pad);
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
}
.link-info {
  flex: 1;
  min-width: 0;
}
.link-info h3 {
  font-size: 0.95rem;
  margin-bottom: 0.2rem;
  display: flex;
  align-items: center;
  gap: 0.4rem;
}
.site-icon {
  flex-shrink: 0;
  border-radius: 2px;
}
.link-meta {
  display: flex;
  gap: 0.75rem;
  font-size: 0.78rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
}
.notes {
  font-size: 0.85rem;
  color: var(--color-text);
}
.link-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-top: 0.2rem;
}
.link-actions {
  display: flex;
  gap: 0.35rem;
  flex-shrink: 0;
  align-items: center;
}

/* ===== Drag & Drop ===== */
.drag-handle {
  cursor: grab;
  color: var(--color-text-light);
  font-size: 1rem;
  user-select: none;
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-height: 2rem;
  padding: 0.3rem 0.75rem;
  border-bottom: 1px solid var(--color-border);
  margin: -1rem -1.25rem 0.75rem;
  width: calc(100% + 2.5rem);
  border-radius: var(--radius) var(--radius) 0 0;
  transition: color 0.15s, background 0.15s;
}
.link-card .drag-handle {
  margin: -1rem -1.25rem 0.75rem;
  width: calc(100% + 2.5rem);
}
.drag-handle:hover {
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.06);
}
.drag-handle:active {
  cursor: grabbing;
}
.sortable-ghost {
  opacity: 0.3;
}
.sortable-drag {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

/* ===== Data Table ===== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--color-surface);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th,
.data-table td {
  text-align: left;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  vertical-align: middle;
}
.data-table thead th {
  background: var(--color-bg);
  font-weight: 600;
  border-bottom: 1px solid var(--color-border);
}
.data-table th:first-child,
.data-table td:first-child {
  width: 40%;
}
.data-table tbody tr:not(:last-child) {
  border-bottom: 1px solid var(--color-border);
}
.data-table td.actions {
  white-space: nowrap;
  display: table-cell;
  margin-top: 0;
  padding-top: 0.75rem;
  border-top: none;
}
.data-table td.actions .inline-form {
  display: inline;
  margin: 0;
  padding: 0;
}
.data-table td.actions .inline-form + .inline-form {
  margin-left: 0.35rem;
}
.data-table td.actions select,
.data-table td.actions button {
  vertical-align: middle;
  margin: 0;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.25rem;
  margin-top: 1.5rem;
}
.page-link {
  display: inline-block;
  padding: 0.35rem 0.7rem;
  font-size: 0.85rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}
a.page-link:hover {
  background: var(--color-bg);
  text-decoration: none;
}
.page-link.active {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  border-color: var(--color-primary);
}

/* ===== WYSIWYG Editor ===== */
#editor-container {
  min-height: 200px;
  background: var(--color-surface);
  border-radius: 0 0 var(--radius) var(--radius);
}
.ql-toolbar.ql-snow {
  border-radius: var(--radius) var(--radius) 0 0;
  border-color: var(--color-border);
}
.ql-container.ql-snow {
  border-color: var(--color-border);
  border-radius: 0 0 var(--radius) var(--radius);
  font-size: 0.9rem;
}

/* ===== Data Section (Export/Import) ===== */
.data-section {
  margin-bottom: 1.5rem;
}
.data-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.5rem;
}
.data-section p {
  color: var(--color-text-light);
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
hr {
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 1.5rem 0;
}

/* ===== Error Page ===== */
.error-page {
  text-align: center;
  padding: 3rem 1rem;
}
.error-page h1 {
  font-size: 3rem;
  color: var(--color-text-light);
}
.error-page p {
  margin: 0.5rem 0 1.5rem;
  color: var(--color-text-light);
}

/* ===== Empty State ===== */
.empty {
  text-align: center;
  padding: 2rem;
  color: var(--color-text-light);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .main-nav {
    flex-wrap: wrap;
    height: auto;
    padding: 0.75rem 1rem;
    gap: 0;
  }
  .nav-brand {
    flex: 1;
  }
  .nav-toggle {
    display: flex;
  }
  .nav-links {
    display: none;
    flex-direction: column;
    width: 100%;
    gap: 0;
    padding-top: 0.75rem;
    margin-top: 0.75rem;
    border-top: 1px solid var(--color-border);
  }
  .nav-links.open {
    display: flex;
  }
  .nav-links > a,
  .nav-links .nav-dropdown-toggle {
    display: block;
    width: 100%;
    padding: 0.6rem 0;
    text-align: left;
  }
  .nav-dropdown {
    width: 100%;
  }
  .nav-dropdown-menu {
    position: static;
    box-shadow: none;
    border: none;
    padding: 0 0 0 1rem;
    min-width: 0;
    width: 100%;
    max-height: 0;
    overflow: hidden;
    opacity: 0;
    transition: max-height 0.3s ease, opacity 0.2s ease;
  }
  .nav-dropdown.open .nav-dropdown-menu {
    max-height: 500px;
    opacity: 1;
  }
  .nav-dropdown-toggle::after {
    content: '\25BE';
    margin-left: 0.35rem;
    font-size: 0.75em;
    opacity: 0.6;
    transition: transform 0.2s;
    display: inline-block;
  }
  .nav-dropdown.open .nav-dropdown-toggle::after {
    transform: rotate(180deg);
  }
  .nav-dropdown-menu a {
    display: block;
    width: 100%;
    padding: 0.5rem 0;
    text-align: left;
  }
  /* The base rule hides menus (display: none); on mobile they collapse with
     max-height instead, so they must stay in the layout. */
  .nav-dropdown-menu { display: block; }
  .nav-dropdown.active > .nav-dropdown-toggle { box-shadow: none; color: var(--color-primary); }
  .nav-mega .nav-dropdown-menu { min-width: 0; padding: 0 0 0 1rem; }
  .nav-dropdown-menu a.nav-mega-link { padding: 0.45rem 0; }
  .nav-mega-desc { display: none; }
  .nav-brand-name { font-size: 0.9rem; }
  .nav-user {
    border-left: none;
    border-top: 1px solid var(--color-border);
    padding: 0.5rem 0 0;
    margin: 0.5rem 0 0;
    width: 100%;
  }
  .page-header {
    flex-wrap: wrap;
  }
  .tutorial-list,
  .link-list {
    grid-template-columns: 1fr;
  }
  .tutorial-card {
    flex-direction: column;
  }
  .tutorial-thumb {
    width: 100%;
    height: 160px;
  }
  .link-card {
    flex-direction: column;
    gap: 0.5rem;
  }
  .tutorial-detail-wrapper.has-sidebar {
    flex-direction: column;
  }
  .series-sidebar {
    width: 100%;
    position: static;
    order: -1;
  }
  .tutorials-index-wrapper {
    flex-direction: column;
  }
  .pipeline-sidebar {
    width: 100%;
    position: static;
    order: -1;
  }
  .container-full {
    padding: 1rem;
  }
  .filter-bar input[type="text"] {
    width: 100%;
  }
  .data-table thead {
    display: none;
  }
  .data-table,
  .data-table tbody,
  .data-table tr,
  .data-table td {
    display: block;
    width: 100%;
  }
  .data-table tr {
    background: var(--color-card);
    border: 1px solid var(--color-border);
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 0.75rem;
  }
  .data-table td {
    padding: 0.25rem 0;
    border: none;
    text-align: left;
  }
  .data-table td::before {
    content: attr(data-label);
    font-weight: 600;
    margin-right: 0.5rem;
    color: var(--color-text-light);
    font-size: 0.8rem;
  }
  .data-table td.actions {
    padding-top: 0.5rem;
    margin-top: 0.25rem;
    border-top: 1px solid var(--color-border);
  }
}

/* ===== Executive Dashboard ===== */

/* KPI row */
.exec-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.exec-kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem 1rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.exec-kpi-value {
  font-size: 2rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1.1;
}
.exec-kpi-unit {
  font-size: 0.9rem;
  font-weight: 400;
  opacity: 0.7;
}
/* Tiles that carry an "Adjusted" value stack two numbers, so shrink both ~50% */
.exec-kpi:has(.exec-kpi-rule) .exec-kpi-value {
  font-size: 1.25rem;
}
.exec-kpi:has(.exec-kpi-rule) .exec-kpi-unit {
  font-size: 0.75rem;
}
.exec-kpi-label {
  font-size: 0.8rem;
  color: var(--color-text-light);
  margin-top: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
/* Divider between a KPI's primary value and its "Adjusted" value */
.exec-kpi-rule {
  width: 100%;
  border: none;
  border-top: 1px solid var(--color-border);
  margin: 0.7rem 0 0.6rem;
}
.exec-adj-legend {
  margin: -0.4rem 0 1rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
}
.exec-adj-tag {
  font-weight: 700;
  color: var(--color-text);
}
.exec-kpi-warn .exec-kpi-value {
  color: var(--color-danger);
}

/* Layout grids — varied column widths */
.exec-layout-3 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.exec-layout-2-1 {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.exec-layout-1-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
.exec-layout-2 {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 1rem;
  margin-bottom: 1rem;
}
@media (max-width: 1024px) {
  .exec-layout-3 {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  }
}
@media (max-width: 768px) {
  .exec-layout-3,
  .exec-layout-2-1,
  .exec-layout-1-2,
  .exec-layout-2 {
    grid-template-columns: 1fr;
  }
  .exec-bar-label {
    flex: 0 0 80px;
    font-size: 0.78rem;
  }
  .exec-kpis {
    grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
    gap: 0.75rem;
  }
  .exec-kpi-value {
    font-size: 1.6rem;
  }
  .exec-kpis-narrow {
    max-width: 100%;
  }
  .exec-section-title {
    font-size: 1.1rem;
    margin: 1.5rem 0 0.75rem;
  }
  .exec-popover {
    position: fixed;
    top: auto;
    bottom: 0;
    left: 0;
    right: 0;
    max-width: 100%;
    min-width: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    margin-top: 0;
    max-height: 60vh;
    z-index: 100;
    padding: 1.25rem 1.25rem 1.5rem;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.25);
  }
  .exec-popover-title {
    font-size: 0.85rem;
    margin-bottom: 0.6rem;
  }
  .exec-popover li {
    font-size: 0.9rem;
    padding: 0.4rem 0;
  }
  /* Sticky table headers + scrollable table area on mobile */
  .table-wrap {
    max-height: 70vh;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
  }
  .data-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: var(--color-bg);
  }
  /* Keep exec tables as scrollable tables, not card layout */
  .exec-table,
  .exec-table tbody,
  .exec-table tr,
  .exec-table td {
    display: revert;
    width: revert;
  }
  .exec-table thead {
    display: table-header-group;
  }
  .exec-table tr {
    background: revert;
    border: revert;
    border-radius: revert;
    padding: revert;
    margin-bottom: revert;
  }
  .exec-table th,
  .exec-table td {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--color-border);
    text-align: left;
  }
  .exec-table td::before {
    content: none;
  }
  /* Phase pipeline — 2-column grid on mobile */
  .exec-pipeline {
    display: grid !important;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
    overflow: hidden;
    align-items: stretch;
    padding: 0;
  }
  .exec-phase {
    min-width: 0;
    flex: none;
    background: var(--color-bg);
    border-radius: var(--radius);
    padding: 0.75rem 0.5rem;
  }
  .exec-phase-value {
    font-size: 2rem;
  }
  .exec-phase-label {
    font-size: 0.85rem;
    margin-top: 0.25rem;
  }
  .exec-phase-arrow {
    display: none;
  }
}

/* Narrower KPI row (for launched — fewer cards, don't stretch full width) */
.exec-kpis-narrow {
  max-width: 700px;
}

/* Panel */
.exec-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.25rem;
  margin-bottom: 1rem;
  min-width: 0;
}
.exec-panel h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--color-border);
}

/* Bar charts */
.exec-bars {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.exec-bar-row {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.exec-bar-label {
  flex: 0 0 100px;
  font-size: 0.82rem;
  color: var(--color-text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.exec-bar-track {
  flex: 1;
  height: 20px;
  background: var(--color-bg);
  border-radius: 3px;
  overflow: hidden;
}
.exec-bar-fill {
  height: 100%;
  background: var(--color-primary);
  border-radius: 3px;
  min-width: 4px;
  transition: width 0.3s ease;
}
.exec-bar-count {
  flex: 0 0 auto;
  min-width: 28px;
  text-align: right;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--color-text);
}

/* Clickable bars + popover */
.exec-bar-clickable {
  cursor: pointer;
  position: relative;
  border-radius: 4px;
  padding: 0.2rem 0.35rem;
  margin: -0.2rem -0.35rem;
  transition: background 0.15s;
}
.exec-bar-clickable:hover {
  background: rgba(var(--color-primary-rgb), 0.06);
}
.exec-popover {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  z-index: 20;
  margin-top: 0.35rem;
  background: #ffffff;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  padding: 0.75rem 1rem;
  min-width: 180px;
  max-width: 260px;
  max-height: 220px;
  overflow-y: auto;
}
[data-theme="dark"] .exec-popover {
  background: #2e2e2e;
  border-color: #444;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}
.popover-open > .exec-popover {
  display: block;
  height: fit-content;
}
.exec-popover-title {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--color-primary);
  margin-bottom: 0.4rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.exec-popover ul {
  list-style: none;
  padding: 0;
  margin: 0;
}
.exec-popover li {
  font-size: 0.82rem;
  color: var(--color-text);
  padding: 0.2rem 0;
  border-bottom: 1px solid var(--color-border);
}
.exec-popover li:last-child {
  border-bottom: none;
}

/* Phase durations — two-row (All Projects / Adjusted) table */
.exec-phase-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.exec-phase-table th,
.exec-phase-table td {
  padding: 0.55rem 0.75rem;
  text-align: center;
  border-bottom: 1px solid var(--color-border);
  white-space: nowrap;
}
.exec-phase-table thead th {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
}
.exec-phase-table tbody th {
  text-align: left;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-text-light);
}
.exec-phase-real-row td {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--color-primary);
}
.exec-phase-adj-row td {
  font-size: 1rem;
  font-weight: 600;
  color: var(--color-text-light);
}
.exec-phase-adj-row td.exec-phase-diff {
  color: var(--color-text);
}
.exec-phase-caption {
  margin: 0.75rem 0 0;
  font-size: 0.8rem;
  color: var(--color-text-light);
  line-height: 1.5;
}

/* Phase pipeline */
.exec-pipeline {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  overflow-x: auto;
  padding: 0.5rem 0;
}
.exec-phase {
  text-align: center;
  flex: 1;
  min-width: 70px;
}
.exec-phase-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--color-primary);
}
.exec-phase-label {
  font-size: 0.72rem;
  color: var(--color-text-light);
  margin-top: 0.15rem;
}
.exec-phase-arrow {
  flex: 0 0 20px;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.9rem;
}
.exec-phase-arrow::after {
  content: '\2192';
}

/* Table */
.exec-table {
  font-size: 0.82rem;
}
.exec-table th,
.exec-table td {
  white-space: nowrap;
}
.exec-table .col-notes {
  white-space: normal;
  max-width: 200px;
}
.exec-table .col-partner {
  font-weight: 600;
}
.table-wrap {
  overflow-x: auto;
}

/* Sortable columns */
th[data-sort] {
  cursor: pointer;
  user-select: none;
  position: relative;
  padding-right: 1.2em;
}
th[data-sort]:hover {
  color: var(--color-primary);
}
th[data-sort]::after {
  content: '\25B4\25BE';
  position: absolute;
  right: 0.25em;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.6em;
  letter-spacing: -0.15em;
  opacity: 0.35;
  line-height: 1;
}
th[data-sort].sort-asc::after {
  content: '\25B2';
  opacity: 0.9;
  color: var(--color-primary);
  font-size: 0.65em;
  letter-spacing: 0;
}
th[data-sort].sort-desc::after {
  content: '\25BC';
  opacity: 0.9;
  color: var(--color-primary);
  font-size: 0.65em;
  letter-spacing: 0;
}

/* Status badges */
.exec-badge {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 3px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
}
.exec-badge-final { background: rgba(var(--color-primary-rgb), 0.15); color: var(--color-primary); }
.exec-badge-client { background: rgba(239, 165, 30, 0.15); color: #d4930e; }
.exec-badge-dev { background: rgba(99, 102, 241, 0.15); color: #6366f1; }
.exec-badge-qa { background: rgba(168, 85, 247, 0.15); color: #a855f7; }
.exec-badge-seo { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.exec-badge-design { background: rgba(236, 72, 153, 0.15); color: #ec4899; }
.exec-badge-other { background: var(--color-bg); color: var(--color-text-light); }
.exec-badge-unknown { background: var(--color-bg); color: var(--color-text-light); }

/* Motion status */
.exec-motion {
  font-size: 0.78rem;
  font-weight: 600;
}
.exec-motion-active { color: var(--color-success); }
.exec-motion-waiting { color: #d4930e; }
.exec-motion-stopped { color: var(--color-text-light); }

/* Team dots */
.exec-team-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  vertical-align: middle;
  margin-right: 6px;
}
.exec-team-blue { background: #3b82f6; }
.exec-team-green { background: #22c55e; }
.exec-team-orange { background: #f97316; }
.exec-team-yellow { background: #eab308; }
.exec-team-dev-only { background: #a855f7; }
/* Non-color pods — assigned distinct hues */
.exec-team-elite-pod { background: #ec4899; }
.exec-team-content-only { background: #64748b; }
.exec-team-jurispage { background: #06b6d4; }

/* Section titles */
.exec-section-title {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 2rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--color-primary);
  color: var(--color-text);
}
.exec-section-title:first-of-type {
  margin-top: 0;
}

/* Launched badge */
.exec-badge-launched { background: rgba(34, 197, 94, 0.15); color: #22c55e; }
.exec-badge-content { background: rgba(168, 85, 247, 0.15); color: #a855f7; }

/* Success KPI (for launched count) */
.exec-kpi-success .exec-kpi-value { color: var(--color-success); }

/* Cost analysis colors */
.exec-profit-pos { color: #22c55e; font-weight: 600; }
.exec-profit-neg { color: #ef4444; font-weight: 600; }

/* Team Performance Goals */
.exec-goals-heading {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
  margin: 1rem 0 0.5rem;
}
.exec-goals-heading:first-of-type {
  margin-top: 0;
}
.exec-goals-week {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.5rem;
  margin-bottom: 1rem;
}
.exec-goal-card {
  background: var(--color-bg);
  border-radius: var(--radius);
  padding: 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}
.exec-goal-metric {
  font-size: 0.75rem;
  color: var(--color-text-light);
  font-weight: 600;
  line-height: 1.2;
}
.exec-goal-values {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
}
.exec-goal-actual {
  font-size: 1.2rem;
  font-weight: 700;
  color: var(--color-primary);
}
.exec-goal-target {
  font-size: 0.7rem;
  color: var(--color-text-light);
}
.exec-goal-status {
  display: inline-block;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  font-size: 0.7rem;
  font-weight: 600;
  white-space: nowrap;
}
.exec-goal-on {
  background: rgba(34, 197, 94, 0.15);
  color: #22c55e;
}
.exec-goal-off {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}
.exec-goal-risk {
  background: rgba(239, 165, 30, 0.15);
  color: #d4930e;
}
.exec-goal-done {
  background: rgba(var(--color-primary-rgb), 0.15);
  color: var(--color-primary);
}
.exec-goals-table {
  font-size: 0.8rem;
}
.exec-totals-row td {
  font-weight: 700;
  border-top: 2px solid var(--color-primary);
}

.exec-goals-cat-row td {
  font-weight: 700;
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--color-primary);
  background: rgba(var(--color-primary-rgb), 0.05);
  padding-top: 0.6rem;
  padding-bottom: 0.6rem;
}

[data-theme="dark"] .exec-badge-client { color: #efa51e; }
[data-theme="dark"] .exec-badge-dev { color: #818cf8; }
[data-theme="dark"] .exec-motion-waiting { color: #efa51e; }

/* Small-screen overrides (≤480px — targets down to 320px) */
@media (max-width: 480px) {
  .container-full {
    padding: 0.5rem;
  }
  .page-header {
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .page-header h1 {
    font-size: 1.1rem;
  }
  .page-header .btn {
    font-size: 0.72rem;
    padding: 0.3rem 0.6rem;
  }
  .exec-section-title {
    font-size: 0.95rem;
    margin: 1rem 0 0.5rem;
  }
  .exec-kpis {
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
  }
  .exec-kpi {
    padding: 0.6rem 0.4rem;
  }
  .exec-kpi-value {
    font-size: 1.25rem;
  }
  .exec-kpi-unit {
    font-size: 0.7rem;
  }
  .exec-kpi-label {
    font-size: 0.65rem;
  }
  .exec-panel {
    padding: 0.6rem;
    margin-bottom: 0.5rem;
  }
  .exec-panel h3 {
    font-size: 0.75rem;
    margin-bottom: 0.5rem;
    padding-bottom: 0.35rem;
  }
  .exec-bar-row {
    gap: 0.35rem;
  }
  .exec-bar-label {
    flex: 0 0 60px;
    font-size: 0.7rem;
  }
  .exec-bar-track {
    height: 14px;
  }
  .exec-bar-count {
    font-size: 0.7rem;
    min-width: 22px;
  }
  .exec-bar-clickable {
    padding: 0.15rem 0.25rem;
    margin: -0.15rem -0.25rem;
  }
  .exec-pipeline {
    gap: 0.5rem;
  }
  .exec-phase {
    padding: 0.5rem 0.3rem;
  }
  .exec-phase-value {
    font-size: 1.7rem;
  }
  .exec-phase-label {
    font-size: 0.75rem;
  }
  .exec-table {
    font-size: 0.75rem;
  }
  .exec-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
  }
  .filter-bar input[type="text"] {
    font-size: 0.82rem;
    padding: 0.4rem 0.6rem;
  }
  .data-table tr {
    padding: 0.6rem;
    margin-bottom: 0.5rem;
  }
  .data-table td {
    font-size: 0.75rem;
  }
  .data-table td::before {
    font-size: 0.7rem;
  }
  .main-nav {
    padding: 0.5rem 0.75rem;
  }
}

/* ===== KPI history panels (line graphs under each KPI row) ===== */
.kpi-history {
  margin: 0 0 1rem 0;
  padding: 0.5rem 0.75rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
}
.kpi-history-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.kpi-history-title {
  font-size: 0.85rem;
  color: var(--color-text-light);
}
.kpi-history-toggle {
  flex: 0 0 auto;
}
.kpi-history-body {
  margin-top: 0.75rem;
}
.kpi-history-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  align-items: center;
  margin-bottom: 0.75rem;
}
.kpi-history-ranges {
  display: flex;
  gap: 0.25rem;
}
.kpi-range-btn {
  background: transparent;
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
  padding: 0.15rem 0.5rem;
  border-radius: var(--radius);
  cursor: pointer;
  font-size: 0.8rem;
}
.kpi-range-btn:hover { color: var(--color-text); }
.kpi-range-btn.kpi-range-active {
  background: var(--color-primary);
  color: var(--color-btn-primary-text);
  border-color: var(--color-primary);
}
.kpi-history-custom {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}
.kpi-history-custom label {
  display: flex;
  flex-direction: column;
  font-size: 0.75rem;
  color: var(--color-text-light);
}
.kpi-history-custom input[type="date"] {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  padding: 0.15rem 0.35rem;
  border-radius: var(--radius);
  font-size: 0.8rem;
}
.kpi-history-metrics {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  margin-left: auto;
}
.kpi-metric-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  color: var(--color-text-light);
  cursor: pointer;
}
.kpi-metric-toggle input { margin: 0; }
.kpi-history-canvas-wrap {
  height: 220px;
  position: relative;
}
.kpi-history-canvas { max-width: 100%; }
.kpi-history-empty {
  color: var(--color-text-light);
  font-size: 0.85rem;
  text-align: center;
  padding: 1rem 0;
}

/* ===== PDF-only blocks (hidden on screen, shown by Puppeteer in pdf-mode) ===== */
.pdf-only {
  display: none;
}

/* ===== PDF export styles (applied when Puppeteer adds .pdf-mode to body) ===== */
.pdf-mode {
  /* PDF uses the dark theme to match the portal. Theme tokens come from
     [data-theme="dark"] in the head, which Puppeteer sets before rendering. */
  --shadow: none;
}

.pdf-mode .pdf-only {
  display: block !important;
}

.pdf-mode .main-nav,
.pdf-mode .nav-toggle,
.pdf-mode .nav-links,
.pdf-mode .page-header,
.pdf-mode .filter-bar,
.pdf-mode .alert,
.pdf-mode .drag-handle,
.pdf-mode .pagination,
.pdf-mode .exec-popover,
.pdf-mode .kpi-history-toggle,
.pdf-mode .kpi-history-controls {
  display: none !important;
}

/* Treat KPI history panels like normal panels in PDF (no toggle/controls) */
.pdf-mode .kpi-history-body {
  display: block !important;
  margin-top: 0;
}
.pdf-mode .kpi-history-header {
  margin-bottom: 0.5rem;
}
.pdf-mode .kpi-history-canvas-wrap {
  height: 280px;
  page-break-inside: avoid;
}

/* Print header banner (date stamp at top of PDF) */
.pdf-mode .print-header {
  margin: 0 0 16px 0;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--color-text);
}
.pdf-mode .print-header h1 {
  font-size: 26px;
  margin: 0 0 4px 0;
  color: var(--color-text);
}
.pdf-mode .print-header .print-meta {
  font-size: 12px;
  color: var(--color-text-light);
}

/* Container takes full width and provides the visual breathing room. PDF page
   margin is set to 0 in the controller so the dark theme background extends
   edge-to-edge; this padding replaces what the page margin used to provide. */
.pdf-mode .container,
.pdf-mode .container-wide {
  max-width: none;
  padding: 0.4in;
  margin: 0;
}

/* Panels: theme-driven surface, no shadow. Allow panels to break across pages
   so sections flow continuously instead of leaving gaps before a too-tall
   panel that wouldn't fit on the current page. */
.pdf-mode .exec-panel {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: none;
}
.pdf-mode .exec-kpi {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  box-shadow: none;
  page-break-inside: avoid;
}

/* Section titles stay with the section that follows */
.pdf-mode .exec-section-title {
  page-break-after: avoid;
}

/* Tables: repeat headers across pages, never split a row */
.pdf-mode table {
  page-break-inside: auto;
}
.pdf-mode thead {
  display: table-header-group;
}
.pdf-mode tfoot {
  display: table-footer-group;
}
.pdf-mode tr {
  page-break-inside: avoid;
}

/* Bar chart rows shouldn't split across pages */
.pdf-mode .exec-bar-row,
.pdf-mode .exec-pipeline {
  page-break-inside: avoid;
}

/* PDF: let wide tables show fully (no scroll container) and keep the compact
   two-row phase table together on one page. */
.pdf-mode .table-wrap {
  overflow: visible;
}
.pdf-mode .exec-phase-table {
  page-break-inside: avoid;
}

/* Links: inherit color, no underline (keeps the doc clean on paper) */
.pdf-mode a {
  color: inherit;
  text-decoration: none;
}


/* ===== Google sign-in button ===== */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.6rem 1rem;
  background: #ffffff;
  color: #222222;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  font-weight: 600;
  font-size: 0.9rem;
  text-decoration: none;
}
.btn-google:hover { background: #f1f1f1; }
.auth-divider {
  display: flex;
  align-items: center;
  text-align: center;
  color: var(--color-text-light);
  font-size: 0.8rem;
  margin: 1rem 0;
}
.auth-divider::before,
.auth-divider::after { content: ""; flex: 1; border-top: 1px solid var(--color-border); }
.auth-divider span { padding: 0 0.75rem; }

/* ===== Project notes / comment thread ===== */
.form-subhead {
  margin: 1.25rem 0 0.5rem;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-text-light);
}
.comment-thread {
  list-style: none;
  margin: 0 0 0.75rem;
  padding: 0;
  max-height: 220px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}
.comment {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  padding: 0.5rem 0.65rem;
}
.comment-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  font-size: 0.72rem;
  color: var(--color-text-light);
  margin-bottom: 0.2rem;
}
.comment-body { font-size: 0.875rem; white-space: pre-wrap; word-break: break-word; }
.comment-add-row { display: flex; align-items: center; gap: 0.6rem; margin-top: 0.4rem; }

/* Inline "+ Add person" control on the Specialist/Designer dropdowns. */
.addable-select .add-option-toggle { font-size: 0.72rem; padding: 0; margin-top: 0.35rem; }
.addable-select .add-option-row { display: flex; align-items: center; gap: 0.4rem; margin-top: 0.4rem; }
.addable-select .add-option-row input { flex: 1 1 auto; min-width: 0; }
.addable-select .add-option-status { display: block; margin-top: 0.3rem; }
.addable-select .add-option-status:empty { display: none; }
.comment-actions {
  display: inline-flex;
  gap: 0.5rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.comment:hover .comment-actions,
.comment:focus-within .comment-actions { opacity: 1; }
.comment-actions .btn-link { font-size: 0.72rem; padding: 0; }
.comment-actions .comment-delete { color: var(--color-danger); }
.comment-edit-area { margin-top: 0.4rem; }
.comment-edit-input {
  width: 100%;
  font: inherit;
  padding: 0.4rem 0.5rem;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
  resize: vertical;
}
[data-theme="dark"] .comment-edit-input { background: var(--color-bg); }
.col-note { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-text-light); }

/* ===== Tech project board ===== */

/* Per-status accent colour, shared by columns, cards, and detail sections. */
.tech-col[data-status="requested"],
.tech-card[data-status="requested"],
.tech-modal[data-status="requested"] { --accent: #d4930e; }
.tech-col[data-status="planned"],
.tech-card[data-status="planned"],
.tech-modal[data-status="planned"] { --accent: #8b93a1; }
.tech-col[data-status="in_progress"],
.tech-card[data-status="in_progress"],
.tech-modal[data-status="in_progress"] { --accent: var(--color-primary); }
.tech-col[data-status="ongoing"],
.tech-card[data-status="ongoing"],
.tech-modal[data-status="ongoing"] { --accent: #8b5cf6; }
.tech-col[data-status="blocked"],
.tech-card[data-status="blocked"],
.tech-modal[data-status="blocked"] { --accent: var(--color-danger); }
.tech-col[data-status="on_hold"],
.tech-card[data-status="on_hold"],
.tech-modal[data-status="on_hold"] { --accent: #949494; }
.tech-col[data-status="done"],
.tech-card[data-status="done"],
.tech-modal[data-status="done"] { --accent: var(--color-success); }
.tech-col[data-status="abandoned"],
.tech-card[data-status="abandoned"],
.tech-modal[data-status="abandoned"] { --accent: #7c6f64; }

.tech-request { margin: 0 0 1.75rem; max-width: 1100px; }
.tech-request > summary {
  cursor: pointer;
  font-weight: 600;
  color: var(--color-primary);
  padding: 0.4rem 0;
  list-style: none;
}
.tech-request > summary::before { content: "+ "; font-weight: 700; }
.tech-request[open] > summary::before { content: "\2212 "; }
.tech-request-form { margin-top: 0.75rem; max-width: 640px; }

/* ---- Board (full-width, horizontally scrollable) ---- */
.tech-board {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(300px, 1fr);
  gap: 1.25rem;
  overflow-x: auto;
  padding-bottom: 0.75rem;
  margin: 0 0 2.75rem;
  scroll-snap-type: x proximity;
}
.tech-col {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--accent, var(--color-border));
  border-radius: 10px;
  padding: 0.85rem 0.85rem 1rem;
  min-width: 300px;
  scroll-snap-align: start;
}
.tech-col-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--color-border);
}
.tech-col-title {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
}
.tech-col-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent, var(--color-text-light));
}
.tech-col-count {
  font-size: 0.72rem;
  color: var(--color-text-light);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 999px;
  padding: 0.08rem 0.5rem;
  min-width: 1.5rem;
  text-align: center;
}
.tech-col-body {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
  margin-top: 0.85rem;
}
.tech-col-empty {
  margin: 0.35rem 0 0;
  color: var(--color-text-light);
  font-size: 0.82rem;
  font-style: italic;
}

.tech-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-left: 3px solid var(--accent, var(--color-primary));
  border-radius: 8px;
  padding: 0.8rem 0.85rem;
  box-shadow: var(--shadow);
  text-decoration: none;
  color: var(--color-text);
  transition: transform 0.15s ease, box-shadow 0.15s ease, border-left-color 0.15s ease;
}
.tech-card:hover {
  transform: translateY(-2px);
  box-shadow: 0 5px 16px rgba(0, 0, 0, 0.14);
}
.tech-board[data-admin="1"] .tech-card { cursor: grab; touch-action: none; }
.tech-board[data-admin="1"] .tech-card:active { cursor: grabbing; }
.tech-card.tech-drag-src { opacity: 0.35; }
.tech-ghost {
  position: fixed;
  margin: 0;
  z-index: 9999;
  pointer-events: none;
  opacity: 0.95;
  transform: rotate(1.5deg);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.35);
  cursor: grabbing;
}
.tech-col.drag-over {
  border-color: var(--accent, var(--color-primary));
  background: rgba(var(--color-primary-rgb), 0.06);
}
.tech-col.drag-over .tech-col-body {
  outline: 2px dashed var(--accent, var(--color-primary));
  outline-offset: 4px;
  border-radius: 8px;
  min-height: 44px;
}
.tech-card-title { margin: 0 0 0.35rem; font-size: 0.95rem; line-height: 1.3; }
.tech-card-summary {
  margin: 0 0 0.6rem;
  font-size: 0.82rem;
  line-height: 1.45;
  color: var(--color-text-light);
}
.tech-card-meta { display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tech-progress {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.74rem;
  color: var(--color-text-light);
}
.tech-progress-bar {
  width: 44px;
  height: 5px;
  border-radius: 3px;
  background: var(--color-border);
  overflow: hidden;
}
.tech-progress-fill {
  display: block;
  height: 100%;
  border-radius: 3px;
  background: var(--accent, var(--color-primary));
}
.tech-chip {
  font-size: 0.64rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 0.12rem 0.45rem;
  border-radius: 999px;
  border: 1px solid var(--color-border);
  color: var(--color-text-light);
}
/* Assignee chip on board cards: same pill as .tech-chip, but a name (no caps) in the accent color. */
.tech-chip.tech-assignee {
  text-transform: none;
  letter-spacing: 0;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--color-primary);
  border-color: var(--color-primary);
}
.tech-assignee-form { display: inline-flex; align-items: center; gap: 0.45rem; }
.tech-due { font-size: 0.72rem; color: var(--color-text-light); white-space: nowrap; }
.tech-due--over { color: var(--color-danger); font-weight: 600; }

/* Modal meta row: status age + target date editor */
.tech-modal-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1.25rem;
  margin: 0.6rem 0 0;
  font-size: 0.9rem;
  color: var(--color-text-light);
}
.tech-meta-label {
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-size: 0.66rem;
  color: var(--color-text-light);
}
.tech-target-form { display: inline-flex; align-items: center; gap: 0.45rem; }
.tech-target-form input[type="date"] {
  padding: 0.28rem 0.55rem;
  font-size: 0.85rem;
  font-family: inherit;
  line-height: 1.3;
  border-radius: var(--radius);
  border: 1px solid var(--color-border);
  background: var(--color-surface);
  color: var(--color-text);
}
.tech-target-form input[type="date"]:focus {
  outline: none;
  border-color: var(--color-primary);
  box-shadow: 0 0 0 2px rgba(var(--color-primary-rgb), 0.2);
}
.tech-target-form input[type="date"]::-webkit-calendar-picker-indicator {
  cursor: pointer;
  opacity: 0.6;
}
.tech-target-form input[type="date"]::-webkit-calendar-picker-indicator:hover { opacity: 1; }
[data-theme="dark"] .tech-target-form input[type="date"] { background: var(--color-bg); }
[data-theme="dark"] .tech-target-form input[type="date"]::-webkit-calendar-picker-indicator {
  filter: invert(1) brightness(0.9);
}

/* ---- Detail popups (dialog modals) ---- */
.tech-modal {
  width: min(760px, 92vw);
  max-height: 88vh;
  margin: auto; /* re-center: the global reset zeroes the UA dialog margin */
  padding: 0;
  border: 1px solid var(--color-border);
  border-left: 4px solid var(--accent, var(--color-border));
  border-radius: 12px;
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
  overflow: hidden;
}
.tech-modal::backdrop {
  background: rgba(0, 0, 0, 0.55);
  backdrop-filter: blur(2px);
}
.tech-modal-inner {
  max-height: 88vh;
  overflow-y: auto;
  padding: 1.5rem 1.75rem 1.75rem;
}
.tech-modal-head {
  display: flex;
  align-items: flex-start;
  gap: 0.7rem;
  position: sticky;
  top: 0;
  background: var(--color-surface);
  padding-bottom: 0.6rem;
  margin: -0.25rem 0 0.35rem;
  border-bottom: 1px solid var(--color-border);
  z-index: 1;
}
.tech-modal-title {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}
.tech-modal-title h2 { margin: 0; font-size: 1.3rem; }
.tech-modal-close {
  margin-left: auto;
  flex-shrink: 0;
  background: none;
  border: none;
  color: var(--color-text-light);
  font-size: 1.6rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 0.2rem;
  border-radius: var(--radius);
}
.tech-modal-close:hover { color: var(--color-text); }
.tech-detail-actions { margin: 0.75rem 0 0; display: flex; gap: 0.5rem; align-items: center; flex-wrap: wrap; }
.tech-requested-by { margin: 0.35rem 0 0; font-size: 0.82rem; }
.tech-detail-summary {
  color: var(--color-text);
  font-size: 1.02rem;
  line-height: 1.5;
  margin: 0.5rem 0 0;
}
.tech-detail-body {
  white-space: pre-wrap;
  word-break: break-word;
  margin: 0.9rem 0 0;
  line-height: 1.65;
  max-width: 72ch;
  color: var(--color-text);
}

/* Subsection headers act as labelled dividers for clear hierarchy. */
.tech-tasks,
.tech-notes { margin-top: 1.85rem; }
.tech-tasks > h3,
.tech-notes > h3 {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-light);
  margin: 0 0 0.85rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--color-border);
}
/* Task-add form as a bordered panel (matches the old portal-request styling). */
.tech-add-task {
  margin-top: 1.1rem;
  max-width: 720px;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1.1rem 1.25rem;
}
.tech-add-task-title { margin: 0 0 0.15rem; font-size: 1.05rem; }
.tech-add-task-help { margin: 0 0 0.9rem; font-size: 0.85rem; }
.tech-add-note { margin-top: 0.95rem; max-width: 640px; }
.task-edit-form { margin: 0.4rem 0 0; max-width: 380px; }
.task-edit-form .form-group { margin-bottom: 0.4rem; }
.task-edit-form input[type="text"] { width: 100%; }
.tech-tasks td.actions .task-edit,
.tech-done-tasks td.actions .task-edit { margin-right: 0.4rem; }

/* ---- Team Update (/tech/dashboard) ---- */
.tech-dash-filter {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem 1rem;
  margin: 0 0 1.25rem;
  font-size: 0.85rem;
}
.tech-dash-field { display: grid; gap: 0.25rem; min-width: 0; }
.tech-dash-field label {
  color: var(--color-text-light);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.tech-dash-clear { font-size: 0.85rem; font-weight: 500; padding-bottom: 0.35rem; }
.tech-dash-field select { min-width: 10.5rem; max-width: 100%; }
.exec-kpis.tech-dash-kpis { grid-template-columns: repeat(auto-fit, minmax(118px, 1fr)); }
.tech-dash-kpis .exec-kpi-value { font-size: 1.6rem; }
a.tech-dash-kpi { color: inherit; text-decoration: none; transition: border-color 0.15s, background 0.15s; }
a.tech-dash-kpi:hover { border-color: var(--color-primary); }
a.tech-dash-kpi.is-active { border-color: var(--color-primary); box-shadow: inset 0 -3px 0 var(--color-primary); }
.tech-dash-section { margin-top: 2rem; scroll-margin-top: 1rem; }
.tech-dash-head {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem 1rem;
  margin: 0 0 0.75rem;
}
.tech-dash-head h2 { display: flex; align-items: baseline; gap: 0.6rem; font-size: 1.05rem; margin: 0; }
.tech-dash-count { color: var(--color-text-light); font-weight: 500; font-size: 0.85rem; }
.tech-dash-toggles { display: flex; gap: 0.4rem; }
.tech-dash-groups { display: grid; gap: 0.6rem; }

/* One collapsible card per project */
.tech-dash-group {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  scroll-margin-top: 1rem;
}
.tech-dash-group > summary {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 1rem;
  padding: 0.8rem 1rem;
  cursor: pointer;
  list-style: none;
}
.tech-dash-group > summary::-webkit-details-marker { display: none; }
.tech-dash-group > summary::before {
  content: '\25B8';
  color: var(--color-text-light);
  font-size: 0.8rem;
  transition: transform 0.15s;
}
.tech-dash-group[open] > summary::before { transform: rotate(90deg); }
.tech-dash-group > summary:hover .tech-dash-group-title { color: var(--color-primary); }
.tech-dash-group > summary:focus-visible { outline: 2px solid var(--color-primary); outline-offset: -2px; border-radius: var(--radius); }
.tech-dash-group-title { font-weight: 600; flex: 1 1 14rem; min-width: 0; }
.tech-dash-group-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.tech-dash-oldest { color: var(--color-text-light); font-size: 0.78rem; font-variant-numeric: tabular-nums; margin-left: 0.25rem; }
.tech-dash-group[open] > summary { border-bottom: 1px solid var(--color-border); }

/* Task rows inside a group */
.tech-dash-tasks { list-style: none; margin: 0; padding: 0; }
.tech-dash-task {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto 7.5rem 5.5rem;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 1rem 0.6rem 2.1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.88rem;
}
.tech-dash-task:first-child { border-top: none; }
.tech-dash-completed .tech-dash-task { grid-template-columns: minmax(0, 1fr) 7.5rem 6.5rem; }
.tech-dash-task-main { display: grid; gap: 0.1rem; min-width: 0; }
.tech-dash-task-title { font-weight: 500; overflow-wrap: anywhere; }
.tech-dash-task-who { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tech-dash-task-age { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; color: var(--color-text-light); }
.tech-dash-board-link {
  display: block;
  padding: 0.5rem 1rem 0.65rem 2.1rem;
  border-top: 1px solid var(--color-border);
  font-size: 0.8rem;
}
.tech-dash-completed .tech-dash-ranges { padding: 0.75rem 1rem 0.25rem 2.1rem; margin: 0; }
.tech-dash-completed .empty { padding: 1rem; }
@media (max-width: 640px) {
  .tech-dash-task,
  .tech-dash-completed .tech-dash-task {
    grid-template-columns: minmax(0, 1fr) auto;
    padding-left: 1rem;
  }
  .tech-dash-task-main { grid-column: 1 / -1; }
  .tech-dash-task-who { justify-self: start; }
  .tech-dash-board-link, .tech-dash-completed .tech-dash-ranges { padding-left: 1rem; }
}
.tech-dash-ranges { display: flex; flex-wrap: wrap; gap: 0.4rem; margin: 0 0 0.85rem; }
.tech-dash-portal-link { color: var(--color-text); }
.tech-dash-board-links { display: flex; flex-wrap: wrap; gap: 0 1.25rem; }
.tech-portal-link { font-size: 0.85rem; font-weight: 500; white-space: nowrap; }
.tech-dash-portal-link:hover { color: var(--color-primary); }
.tech-dash-ext { color: var(--color-primary); font-size: 0.85em; }
.tech-dash-hours {
  display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; margin: 1rem 0 0;
  padding: 0.7rem 1rem; background: var(--color-surface); border: 1px solid var(--color-border); border-radius: 10px;
}
.tech-dash-hours-k { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-text-light); }
.tech-dash-hours-p {
  display: inline-flex; align-items: baseline; gap: 0.5rem; padding: 0.25rem 0.7rem; border-radius: 999px;
  background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text);
}
.tech-dash-hours-p:hover { border-color: var(--color-primary); text-decoration: none; }
.tech-dash-hours-name { font-weight: 600; }
.tech-dash-hours-v { font-weight: 700; color: var(--color-primary); font-variant-numeric: tabular-nums; }
.tech-dash-hours-note { margin-left: auto; font-size: 0.78rem; color: var(--color-text-light); }
.tech-dash-weeks { margin-top: 0.6rem; }
.tech-dash-weeks-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.tech-dash-weeks-table th, .tech-dash-weeks-table td { padding: 0.45rem 1rem; text-align: left; border-top: 1px solid var(--color-border); }
.tech-dash-weeks-table thead th { font-size: 0.72rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--color-text-light); border-top: 0; }
.tech-dash-weeks-table tbody th { font-weight: 500; white-space: nowrap; width: 11rem; }
.tech-dash-weeks-h { width: 7rem; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.tech-dash-weeks-bar span { display: block; height: 10px; min-width: 2px; border-radius: 999px; background: var(--color-primary); }
.tech-dash-weeks-table tr.is-zero .tech-dash-weeks-bar span { background: transparent; }
.tech-dash-weeks-table tr.is-zero td, .tech-dash-weeks-table tr.is-earlier { color: var(--color-text-light); }
.tech-dash-weeks-now { margin-left: 0.4rem; font-size: 0.72rem; font-weight: 700; color: var(--color-primary); }
@media (max-width: 520px) {
  .tech-dash-weeks-table th, .tech-dash-weeks-table td { padding: 0.45rem 0.6rem; }
  .tech-dash-weeks-table tbody th { width: auto; }
  .tech-dash-weeks-table th:last-child, .tech-dash-weeks-bar { display: none; }
  .tech-dash-weeks-h { text-align: right; }
}
.tech-dash-tracked { color: var(--color-text-light); font-size: 0.8rem; white-space: nowrap; }
.tech-dash-groupby { display: flex; align-items: center; gap: 0.4rem; margin-left: auto; font-size: 0.85rem; }
.tech-dash-group--blocked { border-left: 3px solid var(--color-danger); }
.tech-dash-group-title .badge { font-size: 0.8rem; }
.tech-dash-groupby .btn-sm.is-active,
.tech-dash-ranges .btn-sm.is-active {
  background: var(--color-primary);
  border-color: var(--color-primary);
  color: var(--color-btn-primary-text);
}
.tech-dash-note { font-size: 0.8rem; margin-top: 0.6rem; }

/* Done tasks: collapsed accordion at the bottom of the project modal. */
.tech-done-tasks { margin-top: 1.85rem; }
.tech-done-tasks > summary {
  cursor: pointer;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--color-text-light);
  padding-bottom: 0.45rem;
  border-bottom: 1px solid var(--color-border);
  list-style: none;
}
.tech-done-tasks > summary::-webkit-details-marker { display: none; }
.tech-done-tasks > summary::before { content: "+ "; }
.tech-done-tasks[open] > summary::before { content: "\2212 "; }
.tech-done-tasks[open] > summary { margin-bottom: 0.85rem; }

.tech-note {
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-bg);
  padding: 0.65rem 0.8rem;
  margin-bottom: 0.6rem;
}
.tech-note-meta {
  display: flex;
  gap: 0.6rem;
  align-items: baseline;
  font-size: 0.75rem;
  color: var(--color-text-light);
  margin-bottom: 0.3rem;
}
.tech-note-meta strong { color: var(--color-text); }
.tech-note-actions {
  margin-left: auto;
  display: inline-flex;
  gap: 0.5rem;
  flex-shrink: 0;
  opacity: 0;
  transition: opacity 0.12s ease;
}
.tech-note:hover .tech-note-actions,
.tech-note:focus-within .tech-note-actions { opacity: 1; }
.tech-note-actions .btn-link { font-size: 0.72rem; padding: 0; }
.tech-note-actions .tech-note-del { color: var(--color-danger); }
.tech-note-actions .inline-form { display: inline; }
.tech-note p { margin: 0; white-space: pre-wrap; word-break: break-word; line-height: 1.5; }
.tech-note-edit-form { margin-top: 0.5rem; }
.tech-mention { color: var(--color-primary); font-weight: 600; }
.tech-mention-wrap { position: relative; }
.tech-mention-help { display: block; margin-top: 0.3rem; font-size: 0.72rem; }
.tech-mention-menu {
  position: absolute;
  left: 0;
  top: 100%;
  z-index: 20;
  min-width: 160px;
  margin: 0.2rem 0 0;
  padding: 0.25rem 0;
  list-style: none;
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.tech-mention-menu li { padding: 0.35rem 0.75rem; font-size: 0.85rem; cursor: pointer; }
.tech-mention-menu li.active, .tech-mention-menu li:hover { background: rgba(20, 238, 238, 0.15); color: var(--color-primary); }

@media (max-width: 768px) {
  .tech-board { grid-auto-flow: row; grid-auto-columns: auto; }
  .tech-col { min-width: 0; }
  .tech-modal { width: 96vw; }
  .tech-modal-inner { padding: 1.15rem 1.15rem 1.35rem; }
}

/* ===== Hosting Clients ===== */
.hosting-stats { display: flex; flex-wrap: wrap; gap: 1rem; margin: 1.25rem 0 1.5rem; }
.hosting-stat {
  background: var(--color-bg);
  border: 1px solid var(--color-border);
  border-radius: 10px;
  padding: 0.9rem 1.15rem;
  min-width: 170px;
}
.hosting-stat-v { font-size: 1.6rem; font-weight: 700; line-height: 1.1; }
.hosting-stat-l {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--color-text-light);
  margin-top: 0.3rem;
}
.hosting-count { color: var(--color-text-light); font-size: 0.85rem; }
.hosting-toolbar { display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap; margin: -0.25rem 0 1rem; }
.hosting-toolbar #hosting-export { margin-left: auto; }
.hosting-toolbar .tag { cursor: pointer; border: 1px solid transparent; font: inherit; font-size: 0.78rem; }
.hosting-toolbar .tag:not(.active):hover { border-color: var(--color-primary); }
.hosting-stat-accent .hosting-stat-v { color: var(--color-success); }
.hosting-table .badge { white-space: nowrap; }
.hosting-sites { min-width: 170px; }
.hosting-sites .hosting-item { white-space: nowrap; }
.hosting-sites a { color: var(--color-primary); text-decoration: none; }
.hosting-sites a:hover { text-decoration: underline; }
.hosting-site-status { font-size: 0.72rem; color: var(--color-text-light); }
.hosting-match { font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.04em; padding: 0.05rem 0.4rem; border-radius: 999px; border: 1px solid; cursor: help; }
.hosting-match-high { color: var(--color-text-light); border-color: var(--color-border); }
.hosting-match-medium { color: #d4930e; border-color: rgba(212, 147, 14, 0.5); }
.hosting-seo { color: var(--color-text); }
.hosting-seo-tag {
  display: inline-block; margin-left: 0.35rem; padding: 0 0.35rem; border-radius: 4px;
  font-size: 0.62rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: rgba(212, 147, 14, 0.15); color: #d4930e; vertical-align: middle;
}
.hosting-table .hosting-num { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.hosting-table .hosting-link { text-align: right; white-space: nowrap; }
.hosting-item { line-height: 1.4; }
.hosting-item:not(:last-child) { margin-bottom: 0.2rem; }
.hosting-item-price { font-size: 0.82rem; }

/* ===== JD Portal (/portal, /portal/transition, /portal/changelog) ===== */
.portal-section { margin-top: 2rem; }
.portal-h2 { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.6rem; font-size: 1.05rem; margin: 0 0 0.75rem; }
.portal-note { font-size: 0.82rem; margin: 0.25rem 0 1rem; max-width: 75ch; }
.portal-tag {
  display: inline-block; margin-left: 0.4rem; padding: 0.05rem 0.4rem; border-radius: 4px;
  font-size: 0.65rem; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  border: 1px solid var(--color-border); color: var(--color-text-light); vertical-align: middle;
}
.alert-inline { padding: 0.75rem 1rem; border-radius: var(--radius); margin: 0 0 1rem; font-size: 0.88rem; }
.alert-inline-warn { background: rgba(212, 147, 14, 0.12); border: 1px solid rgba(212, 147, 14, 0.4); color: var(--color-text); }

/* Strip of links to Transition and Changelog */
.portal-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; margin: 0 0 0.5rem; }
.portal-strip-item {
  display: grid; gap: 0.15rem; padding: var(--card-pad); border: 1px solid var(--color-border);
  border-radius: var(--radius); background: var(--color-surface); color: inherit; text-decoration: none;
  transition: border-color 0.15s;
}
.portal-strip-item:hover { border-color: var(--color-primary); text-decoration: none; }
.portal-strip-k { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-primary); }
.portal-strip-v { font-weight: 600; font-size: 1.05rem; }
.portal-strip-s { color: var(--color-text-light); font-size: 0.8rem; }

/* Project cards */
.portal-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(270px, 1fr)); gap: 0.75rem; }
.portal-card {
  display: flex; flex-direction: column; gap: 0.45rem; padding: var(--card-pad); min-width: 0;
  border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface);
  color: inherit; text-decoration: none; transition: border-color 0.15s;
}
.portal-card:hover { border-color: var(--color-primary); text-decoration: none; }
.portal-card-top { display: flex; align-items: center; flex-wrap: wrap; gap: 0.3rem; }
.portal-card-title { margin: 0; font-size: 1rem; line-height: 1.35; }
.portal-card-summary { margin: 0; color: var(--color-text-light); font-size: 0.85rem; }
.portal-card-meta { display: flex; flex-wrap: wrap; gap: 0.35rem 0.9rem; font-size: 0.8rem; color: var(--color-text-light); margin-top: auto; }
.portal-progress { height: 4px; border-radius: 2px; background: var(--color-border); overflow: hidden; }
.portal-progress span { display: block; height: 100%; background: linear-gradient(90deg, #6fff2c, #14eeee); }
.portal-progress-lg { height: 8px; border-radius: 4px; margin: -0.5rem 0 1rem; }
.portal-requests { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.portal-closed { margin-top: 2rem; }
.portal-closed-row { grid-template-columns: minmax(0, 1fr) auto; }

/* Transition */
.portal-kpis { margin-bottom: 1rem; }
.portal-kpis .exec-kpi-value { font-size: 1.6rem; }
.portal-weeks { display: grid; gap: 0.75rem; margin-top: 1rem; }
.portal-week { border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); scroll-margin-top: 1rem; }
.portal-week.is-current { border-color: var(--color-primary); box-shadow: inset 3px 0 0 var(--color-primary); }
.portal-week.is-overdue { box-shadow: inset 3px 0 0 var(--color-danger); }
.portal-week.is-holiday { border-style: dashed; background: transparent; }
.portal-week.is-cutover { box-shadow: inset 0 -3px 0 var(--color-success); }
.portal-week.is-past:not(.is-overdue) { opacity: 0.8; }
.portal-week-head {
  display: grid; grid-template-columns: 9.5rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: start;
  padding: 0.85rem 1rem; border-bottom: 1px solid var(--color-border);
}
.portal-week-when { display: grid; gap: 0.1rem; }
.portal-week-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--color-primary); }
.portal-week-dates { font-weight: 600; font-variant-numeric: tabular-nums; }
.portal-week-title h2 { margin: 0; font-size: 1rem; }
.portal-gate { display: block; margin-top: 0.2rem; font-size: 0.8rem; color: var(--color-success); font-weight: 500; }
.portal-week-status { display: flex; align-items: center; gap: 0.5rem; }
.portal-week-count { font-variant-numeric: tabular-nums; color: var(--color-text-light); font-size: 0.85rem; }
.portal-steps { list-style: none; margin: 0; padding: 0.35rem 0; }
.portal-step { display: grid; grid-template-columns: 1.5rem minmax(0, 1fr) auto; align-items: start; gap: 0.6rem; padding: 0.4rem 1rem 0.4rem 10.25rem; font-size: 0.9rem; }
.portal-step-form { display: contents; }
.portal-check {
  width: 1.15rem; height: 1.15rem; margin-top: 0.15rem; padding: 0; border-radius: 4px;
  border: 2px solid var(--color-text-light); background: transparent; cursor: pointer; display: inline-grid; place-items: center;
}
span.portal-check { cursor: default; opacity: 0.7; }
.portal-check:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 2px; }
.portal-step.done .portal-check { background: linear-gradient(135deg, #6fff2c, #14eeee); border-color: transparent; }
.portal-step.done .portal-check::after { content: ''; width: 5px; height: 9px; border: solid #222; border-width: 0 2px 2px 0; transform: rotate(45deg) translate(-1px, -1px); }
.portal-step.done .portal-step-text { color: var(--color-text-light); text-decoration: line-through; text-decoration-color: var(--color-border); }
.portal-step-by { font-size: 0.75rem; color: var(--color-text-light); white-space: nowrap; padding-top: 0.15rem; }
@media (max-width: 760px) {
  .portal-week-head { grid-template-columns: minmax(0, 1fr) auto; }
  .portal-week-title { grid-column: 1 / -1; grid-row: 2; }
  .portal-step { padding-left: 1rem; grid-template-columns: 1.5rem minmax(0, 1fr); }
  .portal-step-by { grid-column: 2; white-space: normal; }
}

/* Changelog */
.portal-filters { margin-bottom: 1rem; }
.portal-bots { margin-left: auto; }
.portal-cl-week { margin-top: 1.5rem; }
.portal-cl { list-style: none; margin: 0; padding: 0; border: 1px solid var(--color-border); border-radius: var(--radius); background: var(--color-surface); }
.portal-cl-item {
  display: grid; grid-template-columns: 4rem 6.5rem minmax(0, 1fr) auto; gap: 0.75rem; align-items: baseline;
  padding: 0.55rem 1rem; border-top: 1px solid var(--color-border); font-size: 0.88rem;
}
.portal-cl-item:first-child { border-top: none; }
.portal-cl-item .badge { justify-self: start; }
.portal-cl-date { color: var(--color-text-light); font-variant-numeric: tabular-nums; font-size: 0.8rem; }
.portal-cl-area { display: inline-block; margin-right: 0.4rem; font-weight: 600; text-transform: capitalize; }
.portal-cl-area::after { content: ':'; }
.portal-cl-who { color: var(--color-text-light); font-size: 0.78rem; white-space: nowrap; }
@media (max-width: 640px) {
  .portal-cl-item { grid-template-columns: auto minmax(0, 1fr); }
  .portal-cl-text { grid-column: 1 / -1; }
  .portal-cl-who { grid-column: 1 / -1; }
}
.portal-more { margin-top: 1.25rem; text-align: center; }

/* Transition step explainers: (i) button opens a popover. Anchored to the
   button where CSS anchor positioning is supported; elsewhere the popover
   keeps the browser's default centered placement. */
.portal-step-text { min-width: 0; }
.portal-info {
  display: inline-grid; place-items: center; width: 1.35rem; height: 1.35rem; margin-left: 0.3rem;
  padding: 0; border: none; border-radius: 50%; background: transparent; color: var(--color-text-light);
  cursor: pointer; vertical-align: -0.2rem;
}
.portal-info:hover { color: var(--color-primary); }
.portal-info:focus-visible { outline: 2px solid var(--color-primary); outline-offset: 1px; }
.portal-info-pop {
  max-width: min(26rem, calc(100vw - 2rem));
  padding: 0.85rem 1rem;
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  background: var(--color-surface);
  color: var(--color-text);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  font-size: 0.86rem;
  line-height: 1.5;
}
.portal-info-pop::backdrop { background: transparent; }
.portal-info-title { display: block; margin-bottom: 0.35rem; font-size: 0.82rem; }
.portal-info-pop p { margin: 0; color: var(--color-text-light); }
@supports (position-area: block-end) {
  .portal-info-pop {
    inset: auto;
    margin: 0.4rem 0;
    position-area: block-end span-inline-end;
    position-try-fallbacks: flip-block, flip-inline, flip-block flip-inline;
  }
}

/* ===== Systems (/apps) ===== */
.visually-hidden { position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.sys-filters { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.75rem 1rem; margin: 0 0 0.5rem; }
.sys-chips { margin: 0; }
.sys-filter-form { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; }
.sys-filter-form input[type="search"] { min-width: 13rem; }
.sys-section { margin-top: 1.75rem; }
.sys-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(290px, 1fr)); gap: 0.75rem; }
.sys-card { display: flex; flex-direction: column; gap: 0.55rem; min-width: 0; }
.sys-card-head { display: flex; align-items: center; gap: 0.5rem; min-width: 0; }
.sys-card-head .site-icon { flex: none; }
.sys-card-title { margin: 0; font-size: 1rem; line-height: 1.3; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.sys-card-title a { color: var(--color-text); }
.sys-card-title a:hover { color: var(--color-primary); }
.sys-card-desc { margin: 0; color: var(--color-text-light); font-size: 0.86rem; line-height: 1.5; }
.sys-card-links { display: flex; flex-wrap: wrap; gap: 0.35rem; }
.sys-card-foot {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem;
  margin-top: auto; padding-top: 0.6rem; border-top: 1px solid var(--color-border); font-size: 0.8rem;
}
.sys-card-actions { display: flex; align-items: center; gap: 0.35rem; }
