/* ============================================================
   IMT Project Management — Main Stylesheet
   Clean, modern, minimal internal tool aesthetic
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
  --bg:           #f4f5f7;
  --surface:      #ffffff;
  --surface-alt:  #f8f9fa;
  --border:       #e1e4e8;
  --border-light: #f0f1f3;
  --text:         #1a1a2e;
  --text-muted:   #6b7280;
  --text-light:   #9ca3af;
  --accent:       #2563eb;
  --accent-hover: #1d4ed8;
  --accent-light: #eff6ff;
  --success:      #16a34a;
  --success-bg:   #f0fdf4;
  --warning:      #d97706;
  --warning-bg:   #fffbeb;
  --danger:       #dc2626;
  --danger-bg:    #fef2f2;
  --radius:       8px;
  --radius-sm:    4px;
  --shadow:       0 1px 3px rgba(0,0,0,.08), 0 1px 2px rgba(0,0,0,.06);
  --shadow-md:    0 4px 6px rgba(0,0,0,.07), 0 2px 4px rgba(0,0,0,.06);
  --font:         'Inter', system-ui, -apple-system, sans-serif;
  --font-mono:    'JetBrains Mono', 'Fira Code', monospace;

  /* Priority colors */
  --priority-p0: #dc2626;          /* red */
  --priority-p1: #e04e1e;          /* red-orange */
  --priority-p2: #ea580c;          /* orange */
  --priority-p3: #d97706;          /* orange-yellow */
  --priority-p4: #ca8a04;          /* yellow */
  --priority-p5: #b5a642;          /* unsaturated yellow */
  --priority-p6: #c4c8cd;          /* light gray */
  --priority-p7: #5b6370;          /* dark gray */
}

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

html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
  min-height: 100vh;
}

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

img { max-width: 100%; display: block; }

/* ---------- Typography ---------- */
h1 { font-size: 1.75rem; font-weight: 700; line-height: 1.2; }
h2 { font-size: 1.375rem; font-weight: 600; line-height: 1.3; }
h3 { font-size: 1.125rem; font-weight: 600; line-height: 1.4; }
h4 { font-size: 1rem; font-weight: 600; }

p { margin-bottom: .75rem; }
p:last-child { margin-bottom: 0; }

/* ---------- Layout Utilities ---------- */
.container { max-width: 1400px; margin: 0 auto; padding: 0 1.5rem; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-1 { gap: .5rem; }
.gap-2 { gap: 1rem; }
.gap-3 { gap: 1.5rem; }
.mt-1 { margin-top: .5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: .5rem; }
.mb-2 { margin-bottom: 1rem; }
.hidden { display: none !important; }

/* ---------- Nav / Header ---------- */
.navbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  gap: 2rem;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow);
}

.navbar-brand {
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  letter-spacing: -.02em;
  white-space: nowrap;
}
.navbar-brand span { color: var(--accent); }

.navbar-links { display: flex; gap: 1.5rem; align-items: center; flex: 1; }

.navbar-links a {
  color: var(--text-muted);
  font-size: .9rem;
  font-weight: 500;
  padding: .25rem 0;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.navbar-links a:hover,
.navbar-links a.active {
  color: var(--text);
  border-color: var(--accent);
  text-decoration: none;
}

.navbar-user {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: .75rem;
}

.navbar-user .user-badge {
  font-size: .8rem;
  font-weight: 500;
  color: var(--text-muted);
}

.navbar-user .role-badge {
  font-size: .7rem;
  font-weight: 600;
  padding: .2em .6em;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: .05em;
}
.role-badge.admin     { background: #fef3c7; color: #92400e; }
.role-badge.moderator { background: #e0e7ff; color: #3730a3; }
.role-badge.member    { background: #f1f5f9; color: #475569; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .5rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .875rem;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background .15s, border-color .15s, color .15s, opacity .15s;
  line-height: 1.4;
  white-space: nowrap;
}
.btn:disabled { opacity: .55; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: #fff; border-color: var(--accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); text-decoration: none; }

.btn-secondary { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-secondary:hover:not(:disabled) { background: var(--surface-alt); text-decoration: none; }

.btn-danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: #b91c1c; text-decoration: none; }

.btn-ghost { background: transparent; color: var(--text-muted); border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-alt); color: var(--text); text-decoration: none; }

.btn-sm { padding: .3rem .7rem; font-size: .8rem; }

/* ---------- Cards ---------- */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.card-body { padding: 1rem; }
.card-header { padding: .75rem 1rem; border-bottom: 1px solid var(--border); font-weight: 600; font-size: .9rem; }
.card-footer { padding: .75rem 1rem; border-top: 1px solid var(--border); background: var(--surface-alt); font-size: .8rem; color: var(--text-muted); }

/* ---------- Form Elements ---------- */
.form-group { margin-bottom: 1rem; }
.form-label { display: block; font-size: .875rem; font-weight: 500; margin-bottom: .4rem; color: var(--text); }
.form-hint  { font-size: .8rem; color: var(--text-muted); margin-top: .3rem; }

.form-control {
  display: block;
  width: 100%;
  padding: .5rem .75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: .9rem;
  font-family: var(--font);
  color: var(--text);
  background: var(--surface);
  transition: border-color .15s, box-shadow .15s;
  line-height: 1.5;
}
.form-control:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(37,99,235,.15);
}
textarea.form-control { resize: vertical; min-height: 120px; }
select.form-control { cursor: pointer; }

/* ---------- Badges ---------- */
.badge {
  display: inline-block;
  font-size: .72rem;
  font-weight: 600;
  padding: .2em .6em;
  border-radius: 9999px;
  text-transform: uppercase;
  letter-spacing: .05em;
  line-height: 1.4;
}
.badge-blue    { background: #dbeafe; color: #1e40af; }
.badge-green   { background: #dcfce7; color: #166534; }
.badge-yellow  { background: #fef9c3; color: #854d0e; }
.badge-red     { background: #fee2e2; color: #991b1b; }
.badge-gray    { background: #f1f5f9; color: #475569; }
.badge-purple  { background: #ede9fe; color: #5b21b6; }
.badge-orange  { background: #ffedd5; color: #9a3412; }

/* Risk badge colours */
.risk-low    { background: #dcfce7; color: #166534; }
.risk-medium { background: #fef9c3; color: #854d0e; }
.risk-high   { background: #fee2e2; color: #991b1b; }

/* ---------- Alerts / Toast ---------- */
.alert {
  padding: .75rem 1rem;
  border-radius: var(--radius-sm);
  font-size: .9rem;
  margin-bottom: 1rem;
  border-left: 3px solid;
}
.alert-info    { background: #eff6ff; color: #1e40af; border-color: var(--accent); }
.alert-success { background: var(--success-bg); color: var(--success); border-color: var(--success); }
.alert-warning { background: var(--warning-bg); color: var(--warning); border-color: var(--warning); }
.alert-error   { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

#toast-container {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  z-index: 999;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}
.toast {
  background: var(--text);
  color: #fff;
  padding: .7rem 1.2rem;
  border-radius: var(--radius);
  font-size: .875rem;
  box-shadow: var(--shadow-md);
  animation: slideIn .2s ease;
  max-width: 320px;
}
.toast.success { background: var(--success); }
.toast.error   { background: var(--danger); }

/* Sync report modal — chat-log style */
#modal-sync-body {
  display: flex;
  flex-direction: column;
  gap: 0;
  background: var(--bg, #f9fafb);
  padding: .75rem !important;
  border-radius: var(--radius);
}
.sr-section-label {
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .06em;
  text-transform: uppercase;
  padding: .75rem .25rem .3rem;
}
.sr-entry {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .45rem .75rem;
  font-size: .85rem;
  margin-bottom: .3rem;
  line-height: 1.4;
}
.sr-entry.sr-empty {
  color: var(--text-muted);
  font-style: italic;
  background: transparent;
  border-style: dashed;
}
.sr-entry.sr-error {
  border-color: var(--danger);
  background: color-mix(in srgb, var(--danger) 8%, var(--surface));
  display: flex;
  flex-direction: column;
  gap: .2rem;
}
.sr-entry.sr-error span {
  font-size: .78rem;
  color: var(--text-muted);
}

@keyframes slideIn {
  from { transform: translateY(10px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}

/* ---------- Modal ---------- */
.modal-overlay,
.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.4);
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal-box,
.modal {
  background: var(--surface);
  border-radius: var(--radius);
  box-shadow: 0 20px 40px rgba(0,0,0,.15);
  width: 100%;
  max-width: 540px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
}
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.modal-header h2, .modal-header h3, .modal-title { font-size: 1.1rem; margin: 0; font-weight: 600; }
.modal-close {
  background: none; border: none; font-size: 1.5rem; line-height: 1;
  color: var(--text-muted); cursor: pointer; padding: 0 .25rem;
}
.modal-close:hover { color: var(--text); }
.modal-body { padding: 1.5rem; overflow-y: auto; flex: 1 1 auto; }
.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: .75rem;
  background: var(--surface-alt);
}

/* ---------- Kanban Board ---------- */
.board-wrapper {
  padding: 1.5rem;
  overflow-x: auto;
}

.board {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding-bottom: 1rem;
}

.column {
  width: 240px;
  flex-shrink: 0;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 130px);
}

.column-header {
  padding: .65rem 1rem;
  font-size: .8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .07em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface);
  border-radius: var(--radius) var(--radius) 0 0;
}

.column-count {
  background: var(--border);
  color: var(--text-muted);
  font-size: .7rem;
  font-weight: 700;
  padding: .1em .5em;
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}

.column-cards {
  padding: .5rem;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

/* Drag-and-drop states */
.column.drag-over { border-color: var(--accent); background: var(--accent-light); }
.project-card.dragging { opacity: .4; }

.project-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem;
  cursor: pointer;
  transition: box-shadow .15s, transform .15s;
  font-size: .85rem;
  position: relative;
}
.project-card:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-1px);
}
.project-card[draggable="true"] { cursor: grab; }
.project-card[draggable="true"]:active { cursor: grabbing; }

.card-name {
  font-weight: 600;
  font-size: .88rem;
  color: var(--text);
  margin-bottom: .35rem;
  line-height: 1.3;
}

.card-desc {
  font-size: .78rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  margin-bottom: .4rem;
}

.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem;
  margin-top: .4rem;
}

.card-risk {
  position: absolute;
  top: .5rem;
  right: .5rem;
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.card-risk.low    { background: var(--success); }
.card-risk.medium { background: var(--warning); }
.card-risk.high   { background: var(--danger); }

/* ---------- Project Detail ---------- */
.project-layout-width {
  max-width: 1000px;
  margin: 0 auto;
}
.project-layout {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  padding: 1.5rem;
  max-width: 1000px;
  margin: 0 auto;
}
.card-header-toggle:hover { background: var(--surface-alt); }
.card-header-toggle .toggle-chevron { display:inline-block; }
.card-header-toggle.open .toggle-chevron { transform: rotate(90deg); }

.doc-area {
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 1rem;
  align-items: start;
}
.doc-nav {
  display: flex;
  flex-direction: column;
  gap: .25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .4rem;
  box-shadow: var(--shadow);
  position: sticky;
  top: 72px;
}
.doc-nav a {
  display: block;
  padding: .45rem .75rem;
  border-radius: var(--radius-sm);
  font-size: .82rem;
  color: var(--text-muted);
  font-weight: 500;
  transition: background .15s, color .15s;
  white-space: nowrap;
}
.doc-nav a:hover { background: var(--surface-alt); color: var(--text); text-decoration: none; }
.doc-nav a.active { background: var(--accent-light); color: var(--accent); }

.doc-section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow);
}

.doc-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1.25rem;
  padding-bottom: .75rem;
  border-bottom: 1px solid var(--border);
}

/* ---- Files / Media ---- */
.media-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: .5rem .6rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .35rem;
  background: var(--surface);
}
.media-row:hover { background: var(--surface-alt); }

.media-image-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: .75rem;
}
.media-image-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
}
.media-image-card img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}
.media-image-info {
  padding: .35rem .5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: .25rem;
}

.media-video-card {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--surface);
  margin-bottom: .75rem;
  max-width: 560px;
}
.media-video-info {
  padding: .4rem .6rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: .82rem;
}

/* Markdown rendered output */
.markdown-body { font-size: .9rem; line-height: 1.7; color: var(--text); }
.markdown-body h1 { font-size: 1.5rem; margin-bottom: 1rem; padding-bottom: .5rem; border-bottom: 2px solid var(--border); }
.markdown-body h2 { font-size: 1.2rem; margin-top: 1.5rem; margin-bottom: .75rem; }
.markdown-body h3 { font-size: 1rem; margin-top: 1.25rem; margin-bottom: .5rem; }
.markdown-body p  { margin-bottom: .75rem; }
.markdown-body ul,
.markdown-body ol { padding-left: 1.5rem; margin-bottom: .75rem; }
.markdown-body li { margin-bottom: .25rem; }
.markdown-body code {
  font-family: var(--font-mono);
  font-size: .85em;
  background: var(--surface-alt);
  padding: .15em .4em;
  border-radius: 3px;
  border: 1px solid var(--border);
}
.markdown-body pre {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 1rem;
  overflow-x: auto;
  margin-bottom: 1rem;
}
.markdown-body pre code { background: none; border: none; padding: 0; font-size: .85rem; }
.markdown-body blockquote {
  border-left: 3px solid var(--accent);
  padding-left: 1rem;
  color: var(--text-muted);
  margin-bottom: .75rem;
}
.markdown-body table { border-collapse: collapse; width: 100%; margin-bottom: 1rem; font-size: .875rem; }
.markdown-body th { background: var(--surface-alt); font-weight: 600; }
.markdown-body th, .markdown-body td { border: 1px solid var(--border); padding: .5rem .75rem; text-align: left; }
.markdown-body tr:nth-child(even) td { background: var(--surface-alt); }
.markdown-body strong { font-weight: 600; }
.markdown-body em { font-style: italic; color: var(--text-muted); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: 1.5rem 0; }
.markdown-body input[type="checkbox"] { margin-right: .4rem; }

/* ---------- Metadata Table ---------- */
.meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .75rem;
  margin-bottom: 1.5rem;
}
.meta-item { }
.meta-label { font-size: .75rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .2rem; }
.meta-value { font-size: .9rem; color: var(--text); font-weight: 500; }

/* ---------- Tags ---------- */
.tags { display: flex; flex-wrap: wrap; gap: .35rem; }
.tag {
  display: inline-block;
  font-size: .73rem;
  font-weight: 500;
  padding: .2em .6em;
  border-radius: 9999px;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid #bfdbfe;
}

/* ---------- Login Page ---------- */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #2563eb 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 12px;
  padding: 3rem 2.5rem;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 20px 40px rgba(0,0,0,.2);
  text-align: center;
}
.login-logo {
  font-size: 2rem;
  font-weight: 800;
  color: var(--accent);
  margin-bottom: .5rem;
  letter-spacing: -.04em;
}
.login-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 2rem; }
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: .75rem;
  width: 100%;
  padding: .75rem 1.5rem;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface);
  color: var(--text);
  font-size: .95rem;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s, box-shadow .15s;
  text-decoration: none;
}
.btn-google:hover { background: var(--surface-alt); box-shadow: var(--shadow-md); text-decoration: none; }
.btn-google svg { width: 20px; height: 20px; }

/* ---------- Admin Users ---------- */
.page-header {
  padding: 1.5rem;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ---------- Tasks two-row page header ---------- */
.tasks-page-header {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.tasks-header-actions {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: .75rem 1.5rem .5rem;
  flex-wrap: wrap;
}
.tasks-header-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  margin-right: auto;
}
.tasks-header-filters {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .5rem;
  padding: 0 1.5rem .75rem;
  flex-wrap: wrap;
}
.filter-select {
  width: auto;
  padding: .3rem .5rem;
  font-size: .8rem;
}


.table-container {
  padding: 1.5rem;
}
.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow);
}
.data-table th {
  background: var(--surface-alt);
  font-size: .8rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--text-muted);
  padding: .65rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.data-table td {
  padding: .75rem 1rem;
  border-bottom: 1px solid var(--border-light);
  font-size: .9rem;
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td { background: var(--surface-alt); }

/* ---------- Loading Spinner ---------- */
.spinner-wrap { display: flex; align-items: center; justify-content: center; padding: 3rem; gap: .75rem; color: var(--text-muted); }
.spinner {
  width: 24px;
  height: 24px;
  border: 3px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Empty State ---------- */
.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--text-muted); }
.empty-state h3 { font-size: 1rem; margin-bottom: .5rem; }
.empty-state p  { font-size: .875rem; }

/* ---------- Board Sections (grouped by project type) ---------- */
.board-section { margin-bottom: 1.5rem; }
.board-section-header {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .6rem 1rem;
  background: var(--bg-muted);
  border-left: 4px solid #666;
  border-radius: 4px;
  font-weight: 600;
  font-size: .9rem;
  margin-bottom: .5rem;
  width: 43%;
}
.section-icon { font-size: 1.1rem; }
.section-count { font-size: .75rem; color: var(--text-muted); margin-left: auto; }
.section-empty { font-size: .72rem; color: var(--text-muted); font-weight: 400; }
.board-columns { display: flex; gap: .75rem; overflow-x: auto; padding: .5rem 0; }
.board-columns.collapsed { display: none; }

/* ---------- Checklists ---------- */
.checklist-group { margin-bottom: 1.25rem; }
.checklist-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: .35rem;
}
.checklist-progress { font-size: .78rem; color: var(--text-muted); }
.progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: .5rem;
}
.progress-fill {
  height: 100%;
  background: var(--primary);
  border-radius: 3px;
  transition: width .3s ease;
}
.checklist-items {
  list-style: none;
  padding: 0;
  margin: 0;
}
.checklist-items li {
  padding: .25rem 0;
  border-bottom: 1px solid var(--border);
}
.checklist-items li:last-child { border-bottom: none; }
.checklist-label {
  display: flex;
  align-items: center;
  gap: .5rem;
  cursor: pointer;
  font-size: .85rem;
}
.checklist-label input[type="checkbox"] { margin: 0; cursor: pointer; }

/* ---------- Sidebar checklist accordion ---------- */
.nav-cl-accordion { margin-top: .15rem; }
.nav-cl-toggle {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: .4rem .75rem; border: none; border-radius: var(--radius-sm);
  background: transparent; color: var(--text-muted); font-size: .82rem;
  cursor: pointer; text-align: left;
}
.nav-cl-toggle:hover { background: var(--surface-alt); color: var(--text); }
.nav-cl-label { font-weight: 500; }
.nav-cl-badge {
  font-size: .72rem; background: var(--surface-alt); padding: .1rem .4rem;
  border-radius: 8px; color: var(--text-muted);
}
.nav-cl-body { padding: .25rem .75rem .5rem; }
.nav-cl-items { font-size: .8rem; }
.nav-cl-items li { padding: .15rem 0; }
.nav-cl-items .checklist-label { gap: .35rem; font-size: .8rem; }

/* ---------- Scrollbar ---------- */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-light); }

/* ---------- Template Editor ---------- */
.tmpl-tabs {
  display: flex;
  gap: .5rem;
  padding: 1rem 1.5rem 0;
  border-bottom: 1px solid var(--border);
  background: var(--surface);
}
.tmpl-tab {
  padding: .5rem 1rem;
  border: none;
  background: none;
  font-family: var(--font);
  font-size: .875rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
  display: flex;
  align-items: center;
  gap: .4rem;
}
.tmpl-tab:hover { color: var(--text); }
.tmpl-tab.active { color: var(--text); border-color: var(--accent); }
.tmpl-tab-icon { font-size: 1rem; }

.tmpl-editor-wrap {
  max-width: 900px;
  margin: 0 auto;
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.tmpl-section { margin-bottom: 0; }

.tmpl-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .35rem 0;
  border-bottom: 1px solid var(--border-light);
}
.tmpl-row:last-of-type { border-bottom: none; }
.tmpl-row-order {
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-muted);
  min-width: 24px;
  text-align: right;
}
.tmpl-row-input {
  flex: 1;
  padding: .35rem .5rem;
  font-size: .85rem;
}
.tmpl-row-id { flex: 0 0 140px; font-family: var(--font-mono); font-size: .8rem; }
.tmpl-row-type { flex: 0 0 110px; }
.tmpl-row-checkbox {
  display: flex;
  align-items: center;
  gap: .3rem;
  font-size: .78rem;
  color: var(--text-muted);
  white-space: nowrap;
  cursor: pointer;
}
.tmpl-row-actions {
  display: flex;
  gap: .15rem;
  flex-shrink: 0;
}
.tmpl-btn-remove { color: var(--danger); }
.tmpl-btn-remove:hover { background: var(--danger-bg); }

.tmpl-checklist-group {
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: .5rem;
  margin-bottom: .5rem;
}
.tmpl-checklist-items {
  padding-left: 1.5rem;
  margin-top: .25rem;
}
.tmpl-cl-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .2rem 0;
}
.tmpl-cl-bullet::before {
  content: "\2022";
  color: var(--text-muted);
  font-size: .9rem;
}
.tmpl-add-item-btn {
  margin-top: .25rem;
  font-size: .78rem;
}

.tmpl-save-bar {
  position: sticky;
  bottom: 0;
  background: var(--surface);
  border-top: 1px solid var(--border);
  padding: .75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: .75rem;
  border-radius: var(--radius);
  box-shadow: 0 -2px 8px rgba(0,0,0,.06);
}
.tmpl-save-status {
  margin-right: auto;
  font-size: .8rem;
  color: var(--warning);
  font-weight: 500;
}

/* ---------- Tasks Page ---------- */
.tasks-summary {
  display: flex;
  gap: 1rem;
  padding: 1.25rem 1.5rem;
  flex-wrap: wrap;
}
.tasks-stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem 1.25rem;
  min-width: 120px;
  box-shadow: var(--shadow);
  text-align: center;
  cursor: pointer;
  transition: box-shadow .15s, border-color .15s;
}
.tasks-stat-card:hover { box-shadow: 0 2px 8px rgba(0,0,0,.12); border-color: var(--accent); }
.tasks-stat-card.filter-active { outline: 2px solid var(--accent); outline-offset: 2px; }
.tasks-stat-card.overdue { border-left: 3px solid var(--danger); }
.tasks-stat-card.due-soon { border-left: 3px solid var(--warning); }
.tasks-stat-card.completed { border-left: 3px solid var(--success); }
.tasks-stat-card.overdue.filter-active  { outline-color: var(--danger); }
.tasks-stat-card.due-soon.filter-active { outline-color: var(--warning); }
.tasks-stat-card.completed.filter-active { outline-color: var(--success); }
.tasks-stat-number { font-size: 1.5rem; font-weight: 700; color: var(--text); line-height: 1.2; }
.tasks-stat-card.overdue .tasks-stat-number { color: var(--danger); }
.tasks-stat-card.due-soon .tasks-stat-number { color: var(--warning); }
.tasks-stat-card.completed .tasks-stat-number { color: var(--success); }
.tasks-stat-label { font-size: .75rem; font-weight: 500; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .2rem; }

.tasks-layout {
  display: grid;
  grid-template-columns: 220px 1fr;
  gap: 1.5rem;
  padding: 0 1.5rem 1.5rem;
  max-width: 1200px;
}

.tasks-sidebar {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: .75rem;
  align-self: start;
  position: sticky;
  top: 70px;
  box-shadow: var(--shadow);
}
.tasks-sidebar-title { font-size: .8rem; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.tasks-empty-hint { font-size: .8rem; color: var(--text-light); padding: .25rem 0; }

.tasks-space-item,
.tasks-list-item {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .4rem .5rem;
  border-radius: var(--radius-sm);
  font-size: .85rem;
  color: var(--text);
  cursor: default;
}
.tasks-list-item[data-list-id] {
  cursor: pointer;
  user-select: none;
}
.tasks-space-item:hover,
.tasks-list-item:hover { background: var(--surface-alt); }
.tasks-list-item.active {
  background: var(--accent, #1a73e8);
  color: #fff;
}
.tasks-list-item.active .tasks-list-count {
  background: rgba(255,255,255,0.25);
  color: #fff;
}
.tasks-list-item.active .tasks-list-name { color: #fff; }
.tasks-space-icon { color: var(--text-muted); font-weight: 600; font-size: .9rem; }
.tasks-space-name,
.tasks-list-name { flex: 1; font-weight: 500; }
.tasks-list-count {
  font-size: .72rem;
  font-weight: 700;
  background: var(--border);
  color: var(--text-muted);
  padding: .1em .5em;
  border-radius: 9999px;
  min-width: 20px;
  text-align: center;
}

.tasks-main { min-width: 0; }

.tasks-item {
  display: flex;
  gap: .75rem;
  padding: .75rem 1rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  transition: box-shadow .15s;
}
.tasks-item:hover { box-shadow: var(--shadow-md); }
.tasks-item.checked { opacity: .6; }
.tasks-item.overdue { border-left: 3px solid var(--danger); }

/* Priority left-border colors (override default) */
.tasks-item.priority-p0 { border-left: 3px solid var(--priority-p0); }
.tasks-item.priority-p1 { border-left: 3px solid var(--priority-p1); }
.tasks-item.priority-p2 { border-left: 3px solid var(--priority-p2); }
.tasks-item.priority-p3 { border-left: 3px solid var(--priority-p3); }
.tasks-item.priority-p4 { border-left: 3px solid var(--priority-p4); }
.tasks-item.priority-p5 { border-left: 3px solid var(--priority-p5); }
.tasks-item.priority-p6 { border-left: 3px solid var(--priority-p6); }
.tasks-item.priority-p7 { border-left: 3px solid var(--priority-p7); }

/* Priority badge */
.priority-badge { font-size:.65rem; font-weight:700; padding:.1em .45em; border-radius:3px; color:#fff; text-transform:uppercase; letter-spacing:.03em; }
.priority-badge.p0 { background:var(--priority-p0); }
.priority-badge.p1 { background:var(--priority-p1); }
.priority-badge.p2 { background:var(--priority-p2); }
.priority-badge.p3 { background:var(--priority-p3); }
.priority-badge.p4 { background:var(--priority-p4); }
.priority-badge.p5 { background:var(--priority-p5); }
.priority-badge.p6 { background:var(--priority-p6); color:#444; }
.priority-badge.p7 { background:var(--priority-p7); color:#fff; }

/* Due date badge */
.tasks-item-due-badge { font-size:.72rem; font-weight:600; padding:.12em .4em; border-radius:3px; }
.tasks-item-due-badge.warning { background:var(--warning-bg); color:var(--warning); }
.tasks-item-due-badge.danger { background:var(--danger-bg); color:var(--danger); }
.tasks-item-due-badge.completed { background:var(--success-bg); color:var(--success); }

.tasks-item-check {
  width: 20px;
  height: 20px;
  border: 2px solid var(--border);
  border-radius: 4px;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .75rem;
  color: var(--success);
  margin-top: 2px;
}
.tasks-item-check.checked { background: var(--success-bg); border-color: var(--success); }

.tasks-item-content { flex: 1; min-width: 0; }
.tasks-item-title { font-size: .9rem; font-weight: 500; color: var(--text); }
.tasks-item.checked .tasks-item-title { text-decoration: line-through; color: var(--text-muted); }

.tasks-item-notes { font-size: .78rem; color: var(--text-muted); margin-top: .2rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.tasks-item-meta { display: flex; gap: .75rem; margin-top: .35rem; font-size: .75rem; }
.tasks-item-due { color: var(--text-muted); font-weight: 500; }
.tasks-item-due.overdue { color: var(--danger); font-weight: 600; }
.tasks-item-list { color: var(--text-light); }

/* Local task indicators */
.tasks-item-local-badge {
  display: inline-block;
  margin-left: .4rem;
  font-size: .65rem;
  font-weight: 600;
  letter-spacing: .03em;
  color: var(--accent);
  border: 1px solid var(--accent);
  border-radius: 8px;
  padding: .05rem .35rem;
  vertical-align: middle;
  opacity: .8;
}
.tasks-item-delete-btn {
  flex-shrink: 0;
  align-self: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.1rem;
  line-height: 1;
  cursor: pointer;
  padding: .2rem .4rem;
  border-radius: 4px;
  opacity: .5;
  transition: opacity .15s, color .15s;
}
.tasks-item:hover .tasks-item-delete-btn { opacity: 1; }
.tasks-item-delete-btn:hover { color: var(--danger); }

.tasks-sync-status { font-size: .78rem; color: var(--text-muted); }

/* ---------- Project Tasks Cards (Phase 8a) ---------- */
.project-tasks-summary { display:flex; gap:1.5rem; margin-bottom:1rem; font-size:.85rem; color:var(--text-muted); }
.project-tasks-grid { display:grid; grid-template-columns:repeat(auto-fill, minmax(280px, 1fr)); gap:.75rem; }
.project-task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: .75rem 1rem;
  transition: box-shadow .15s;
  border-left: 3px solid var(--border);
}
.project-task-card:hover { box-shadow: var(--shadow-md); transform: translateY(-1px); }
.project-task-card:active { transform: translateY(0); box-shadow: none; }
.project-task-card.completed { opacity: .55; }
.project-task-card.completed .ptc-title { text-decoration: line-through; }
.project-task-card.priority-p0 { border-left-color: var(--priority-p0); }
.project-task-card.priority-p1 { border-left-color: var(--priority-p1); }
.project-task-card.priority-p2 { border-left-color: var(--priority-p2); }
.project-task-card.priority-p3 { border-left-color: var(--priority-p3); }
.project-task-card.priority-p4 { border-left-color: var(--priority-p4); }
.project-task-card.priority-p5 { border-left-color: var(--priority-p5); }
.project-task-card.priority-p6 { border-left-color: var(--priority-p6); }
.project-task-card.priority-p7 { border-left-color: var(--priority-p7); }
.ptc-header { display:flex; align-items:center; gap:.4rem; }
.ptc-status { font-size:.85rem; color:var(--text-muted); min-width:1rem; text-align:center; }
.project-task-card.completed .ptc-status { color:var(--success, #10b981); }
.ptc-title { font-size:.88rem; font-weight:500; flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.ptc-meta { display:flex; flex-wrap:wrap; gap:.5rem; margin-top:.4rem; font-size:.78rem; color:var(--text-muted); align-items:center; }
.ptc-assignee { display:inline-flex; align-items:center; gap:.25rem; }
.ptc-due { color:var(--text-muted); }
.ptc-due.overdue { color:var(--danger); font-weight:600; }
.ptc-hours { color:var(--accent); }
.ptc-files { color:var(--text-muted); }

/* ---------- Responsive ---------- */
@media (max-width: 768px) {
  .project-layout { padding: 1rem; }
  .doc-area { grid-template-columns: 1fr; }
  .doc-nav { position: static; flex-direction: row; flex-wrap: wrap; }
  .board { min-width: 100%; flex-direction: column; }
  .column { width: 100%; max-height: none; }
  .tmpl-row { flex-wrap: wrap; }
  .tmpl-row-id { flex: 1 1 100px; }
  .tasks-layout { grid-template-columns: 1fr; }
  .tasks-sidebar { position: static; }
  .tasks-summary { flex-direction: column; }
}

/* ---------- Board Page Sticky Header ---------- */
.board-page-header {
  position: sticky;
  top: 56px;          /* below navbar */
  z-index: 20;
}

/* ---------- Board Filter Bar ---------- */
.board-filter-bar {
  display: flex;
  gap: .5rem;
  align-items: center;
  flex-wrap: wrap;
  padding: .5rem 1.5rem .25rem;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 135px;         /* navbar 56px + page-header ~79px */
  z-index: 19;
}

.project-card.filter-hidden { display: none; }
.column.filter-empty-col .column-cards .empty-state { display: block; }

/* ---------- Assignee Avatars ---------- */
.card-assignees { display: inline-flex; gap: 2px; align-items: center; margin-left: .25rem; }
.assignee-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: var(--accent-light);
  color: var(--accent);
  font-size: .62rem;
  font-weight: 600;
  border: 1px solid var(--border);
  cursor: default;
}

/* ---------- Assignee Chips (project detail) ---------- */
.assignee-chip {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  background: var(--accent-light);
  color: var(--accent);
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 500;
  padding: .15rem .55rem;
}
.assignee-remove {
  background: none;
  border: none;
  color: var(--accent);
  cursor: pointer;
  font-size: .85rem;
  line-height: 1;
  padding: 0;
  opacity: .7;
}
.assignee-remove:hover { opacity: 1; }

/* ---------- Board Type Selector (now a dropdown in the filter bar) ---------- */
  transition: all .15s;
  font-family: inherit;
}

.board-section-header .section-collapse-icon {
  margin-left: auto;
  font-size: .75rem;
  color: var(--text-muted);
  transition: transform .2s;
}
.board-section-header.is-collapsed .section-collapse-icon { transform: rotate(-90deg); }

/* ---------- Task Project/Assignee Badges ---------- */
.tasks-item-project {
  color: var(--accent);
  font-weight: 500;
  font-size: .73rem;
  text-decoration: none;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .1rem .4rem;
  background: var(--accent-light);
}
.tasks-item-project:hover { text-decoration: underline; }
.tasks-item-assignee {
  font-size: .73rem;
  color: var(--text-muted);
  font-weight: 500;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: .1rem .4rem;
}

/* Phase 5/6: Attachment badge on task cards */
.tasks-item-files-badge {
  font-size: .72rem;
  font-weight: 600;
  color: var(--text-muted);
  padding: .1em .35em;
  border: 1px solid var(--border);
  border-radius: 3px;
  white-space: nowrap;
}

/* Phase 6: Attachment list in edit modal */
.attachment-list, .link-list { margin-top: .25rem; }
.attachment-row, .link-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.attachment-filename {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  max-width: 200px;
}
.attachment-filename:hover { text-decoration: underline; }
.attachment-type {
  font-size: .72rem;
  color: var(--text-muted);
  background: var(--surface);
  padding: .1em .3em;
  border-radius: 3px;
}
.attachment-delete-btn {
  margin-left: auto;
  background: none;
  border: none;
  color: var(--danger, #e55);
  font-size: 1.1rem;
  cursor: pointer;
  padding: 0 .3rem;
  line-height: 1;
}
.attachment-delete-btn:hover { opacity: .7; }
.link-type-badge {
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .1em .35em;
  border-radius: 3px;
  background: var(--surface);
  color: var(--text-muted);
  flex-shrink: 0;
}
.link-target {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--accent);
}

/* ---------- Autocomplete Dropdown (Phase 8d) ---------- */
.autocomplete-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 1000;
  background: var(--card);
  border: 1px solid var(--border);
  border-top: none;
  border-radius: 0 0 6px 6px;
  max-height: 220px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0,0,0,.15);
}
.autocomplete-dropdown.hidden { display: none; }
.autocomplete-item {
  display: flex;
  align-items: center;
  gap: .4rem;
  padding: .45rem .6rem;
  font-size: .82rem;
  cursor: pointer;
  border-bottom: 1px solid var(--border);
}
.autocomplete-item:last-child { border-bottom: none; }
.autocomplete-item:hover { background: var(--surface); }
.autocomplete-item.disabled {
  color: var(--text-muted);
  cursor: default;
  font-style: italic;
}
.autocomplete-item.disabled:hover { background: transparent; }

/* ---------- Time Entries (Phase 7e) ---------- */
.time-entry-row {
  display: flex;
  align-items: center;
  gap: .5rem;
  padding: .3rem 0;
  border-bottom: 1px solid var(--border);
  font-size: .85rem;
}
.time-entry-date {
  font-size: .78rem;
  color: var(--text-muted);
  min-width: 50px;
  white-space: nowrap;
}
.time-entry-hours {
  font-weight: 700;
  min-width: 40px;
  color: var(--accent);
}
.time-entry-desc {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.time-entry-meta {
  font-size: .75rem;
  color: var(--text-muted);
  white-space: nowrap;
}
.time-entry-delete-btn {
  background: none; border: none; cursor: pointer;
  color: var(--danger, #e74c3c); font-size: 1rem; padding: 0 .2rem;
}
.time-total {
  font-weight: 600;
}

/* ---------- Assignee Avatar Initials (project detail chips) ---------- */
.avatar-initials {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  margin-right: 6px;
  flex-shrink: 0;
}

/* ---------- My Projects filter button active state ---------- */
#btn-my-projects.active {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
}

/* ---------- Media Drop Zone ---------- */
.media-dropzone {
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  padding: 2rem;
  text-align: center;
  color: #94a3b8;
  cursor: pointer;
  transition: all .2s;
  margin-bottom: 1rem;
}
.media-dropzone.dragover {
  border-color: #3b82f6;
  background: #eff6ff;
  color: #3b82f6;
}

/* ---------- Upload Progress Bar ---------- */
.upload-progress {
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  margin-top: 8px;
  overflow: hidden;
}
.upload-progress-bar {
  height: 100%;
  background: #3b82f6;
  transition: width .2s;
}

/* ---------- Image Gallery Overlay ---------- */
.gallery-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.92);
  z-index: 10000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
}
.gallery-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  max-width: calc(100vw - 140px);
  max-height: 100vh;
}
.gallery-img {
  max-width: 100%;
  max-height: calc(100vh - 100px);
  object-fit: contain;
  border-radius: var(--radius-sm);
  display: block;
}
.gallery-caption {
  color: #e5e7eb;
  font-size: .85rem;
  margin-top: .6rem;
  text-align: center;
  max-width: 60vw;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.gallery-counter {
  color: #9ca3af;
  font-size: .75rem;
  margin-top: .25rem;
}
.gallery-close {
  position: fixed;
  top: 1rem;
  right: 1.25rem;
  background: none;
  border: none;
  color: #fff;
  font-size: 2rem;
  line-height: 1;
  cursor: pointer;
  opacity: .7;
  z-index: 10001;
}
.gallery-close:hover { opacity: 1; }
.gallery-nav {
  background: none;
  border: none;
  color: #fff;
  font-size: 3.5rem;
  line-height: 1;
  cursor: pointer;
  padding: 0 1rem;
  opacity: .6;
  user-select: none;
  flex-shrink: 0;
}
.gallery-nav:hover { opacity: 1; }
@media (max-width: 600px) {
  .gallery-content { max-width: calc(100vw - 80px); }
  .gallery-nav { font-size: 2.5rem; padding: 0 .5rem; }
}

/* ---------- EasyMDE table-picker toolbar button ---------- */
.editor-toolbar button.table-picker::before { content: '⊞'; font-style: normal; font-size: .95rem; }

/* ---------- Google Docs Link ---------- */
.gdoc-link { display:inline-flex; align-items:center; gap:6px; padding:4px 10px; background:#e8f0fe; border-radius:4px; color:#1a73e8; text-decoration:none; font-size:.85rem; }
.gdoc-link:hover { background:#d2e3fc; }
.gdoc-link::before { content:''; display:inline-block; width:16px; height:16px; background:url('https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico') center/contain no-repeat; }

.card-task-progress {
  font-size: .72rem;
  color: var(--text-light);
  margin-top: .3rem;
}

.card-task-progress.no-tasks {
  color: var(--text-muted, #aaa);
  font-style: italic;
}

/* ---------- User Multi-Select Filter (Select2-style) ---------- */
.user-filter-wrapper {
  position: relative;
  min-width: 240px;
  max-width: 360px;
  flex-shrink: 0;
}
.user-filter-control {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px;
  min-height: 30px;
  padding: 2px 6px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface);
  cursor: text;
  font-size: .82rem;
}
.user-filter-control:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px rgba(37, 99, 235, .15);
}
.user-filter-input {
  border: none;
  outline: none;
  background: transparent;
  font-size: .82rem;
  font-family: var(--font);
  color: var(--text);
  min-width: 80px;
  flex: 1;
  padding: 2px 0;
}
.user-filter-input::placeholder {
  color: var(--text-light);
}
.user-filter-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 1px 6px 1px 8px;
  background: var(--accent-light);
  color: var(--accent);
  border-radius: 12px;
  font-size: .75rem;
  font-weight: 500;
  white-space: nowrap;
  line-height: 1.6;
}
.user-filter-pill-remove {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 10px;
  color: var(--accent);
  padding: 0;
  line-height: 1;
}
.user-filter-pill-remove:hover {
  background: var(--accent);
  color: #fff;
}
.user-filter-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 2px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 240px;
  overflow-y: auto;
  z-index: 100;
}
.user-filter-dropdown.hidden {
  display: none;
}
.user-filter-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  font-size: .82rem;
  color: var(--text);
  cursor: pointer;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  font-family: var(--font);
}
.user-filter-option:hover,
.user-filter-option.highlighted {
  background: var(--accent-light);
}
.user-filter-option-avatar {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: .65rem;
  font-weight: 600;
  flex-shrink: 0;
}
.user-filter-option-email {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.user-filter-no-results {
  padding: 8px 10px;
  font-size: .8rem;
  color: var(--text-muted);
  text-align: center;
}
