/* ─── TOKENS ──────────────────────────────────────────────────────────────── */
:root {
  --blue:       #378ADD;
  --blue-dark:  #0C447C;
  --green:      #1D9E75;
  --amber:      #EF9F27;
  --red:        #A32D2D;
  --purple:     #7F77DD;
  --navy:       #3C3489;

  --bg:         #F1EFE8;
  --bg-card:    #FFFFFF;
  --bg-sidebar: #1E2023;
  --bg-list:    #EEEDE6;
  --border:     #D5D2CA;
  --text:       #2A2927;
  --text-sub:   #6B6860;
  --text-inv:   #FFFFFF;

  --sidebar-w:  230px;
  --radius:     8px;
  --radius-sm:  4px;
  --shadow:     0 1px 3px rgba(0,0,0,.12);
  --shadow-lg:  0 8px 32px rgba(0,0,0,.18);
}

/* ─── RESET ──────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
       font-size: 14px; color: var(--text); background: var(--bg); }
ul { list-style: none; }
button { cursor: pointer; border: none; background: none; font-size: inherit; font-family: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }

/* ─── SCREENS ────────────────────────────────────────────────────────────── */
.screen { display: flex; }
.hidden { display: none !important; }

/* ─── SIGN-IN ────────────────────────────────────────────────────────────── */
#signin-screen {
  min-height: 100vh;
  justify-content: center;
  align-items: center;
  background: var(--bg);
}
.signin-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 48px 40px;
  text-align: center;
  width: 340px;
}
.signin-logo { width: 104px; height: 104px; object-fit: contain; margin-bottom: 10px; }
.signin-card h1 { font-size: 26px; font-weight: 700; color: var(--blue-dark); margin-bottom: 6px; }

/* ─── PORCUPINE BRAND ────────────────────────────────────────────────────── */
.brand-icon { width: 34px; height: 34px; object-fit: contain; flex-shrink: 0; }
.brand-name {
  font-size: 18px;
  font-weight: 800;
  letter-spacing: .4px;
  background: linear-gradient(95deg, #C9A87F 0%, #F6C8BC 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: #F6C8BC; /* fallback */
}
h1.brand-name-lg {
  font-size: 32px;
  letter-spacing: .5px;
  background: linear-gradient(95deg, #8A6F52 0%, #E08D7D 90%);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}
.signin-sub { color: var(--text-sub); margin-bottom: 28px; }
.g_id_signin { display: flex; justify-content: center; }
.error-msg { color: var(--red); margin-top: 14px; font-size: 13px; }

/* ─── APP LAYOUT ─────────────────────────────────────────────────────────── */
#app { width: 100vw; height: 100vh; overflow: hidden; }

/* ─── SIDEBAR ────────────────────────────────────────────────────────────── */
#sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  height: 100vh;
  background: var(--bg-sidebar);
  color: var(--text-inv);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  flex-shrink: 0;
}
.sidebar-brand {
  padding: 14px 16px 12px;
  display: flex;
  align-items: center;
  gap: 9px;
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.sidebar-section-label {
  padding: 16px 16px 4px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: rgba(255,255,255,.35);
}
.board-nav { padding: 0 8px; }
.board-nav-section {
  padding: 10px 8px 2px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(255,255,255,.35);
}
.board-nav-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: rgba(255,255,255,.75);
  transition: background .15s;
}
.board-nav-item:hover { background: rgba(255,255,255,.08); }
.board-nav-item.active { background: rgba(55,138,221,.25); color: #fff; }
.board-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.sidebar-spacer { flex: 1; }
.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,.08);
  color: rgba(255,255,255,.7);
  font-size: 13px;
}
.sidebar-user .avatar { width: 28px; height: 28px; font-size: 11px; }
#user-name { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
#signout-btn { color: rgba(255,255,255,.4); font-size: 16px; padding: 2px 4px; }
#signout-btn:hover { color: rgba(255,255,255,.8); }

/* ─── MAIN ───────────────────────────────────────────────────────────────── */
#main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100vh;
}
#board-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
#board-title { font-size: 18px; font-weight: 700; color: var(--blue-dark); }
.board-header-actions { display: flex; gap: 8px; }
#board-content { flex: 1; overflow: hidden; padding: 16px; }
.empty-state { display: flex; align-items: center; justify-content: center;
               height: 100%; color: var(--text-sub); font-size: 15px; }

/* ─── LISTS ──────────────────────────────────────────────────────────────── */
.lists-container {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  height: 100%;
  overflow-x: auto;
  padding-bottom: 8px;
}
.list-column {
  background: rgba(241, 242, 244, .96);
  border-radius: 12px;
  width: 272px;
  min-width: 272px;
  max-height: 100%;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 1px 1px rgba(9,30,66,.13);
}
.list-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 8px;
  flex-shrink: 0;
}
.list-color-bar { width: 4px; height: 20px; border-radius: 2px; flex-shrink: 0; }
.list-title { font-weight: 600; font-size: 13px; flex: 1; }
.list-count {
  background: var(--border);
  border-radius: 10px;
  padding: 1px 7px;
  font-size: 11px;
  color: var(--text-sub);
}
.cards-list {
  flex: 1;
  overflow-y: auto;
  padding: 0 8px;
  min-height: 20px;
}
.cards-list.drop-target { background: rgba(55,138,221,.08); }
.list-add-card-row { padding: 4px 8px 10px; flex-shrink: 0; }
.btn-add-card {
  width: 100%;
  text-align: left;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-sub);
  font-size: 13px;
  transition: background .15s;
}
.btn-add-card:hover { background: var(--border); color: var(--text); }
.list-add-btn {
  min-width: 200px;
  padding: 10px 14px;
  border-radius: var(--radius);
  background: rgba(0,0,0,.06);
  color: var(--text-sub);
  cursor: pointer;
  font-size: 13px;
  display: flex;
  align-items: center;
  height: 40px;
  white-space: nowrap;
}
.list-add-btn:hover { background: rgba(0,0,0,.1); }

/* ─── CARD TILES (Trello-style fronts) ───────────────────────────────────── */
.card-tile {
  background: var(--bg-card);
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(9,30,66,.25);
  margin-bottom: 8px;
  cursor: pointer;
  overflow: hidden;
  border: 2px solid transparent;
  transition: border-color .1s;
}
.card-tile:hover { border-color: var(--blue); }
.card-tile.dragging { opacity: .4; transform: rotate(3deg); }
.card-tile.pending { opacity: .55; }
.card-cover { height: 32px; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; padding: 8px 10px 0; }
.card-label-tag {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  color: #fff;
  line-height: 16px;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-title { padding: 8px 10px 4px; font-size: 14px; line-height: 1.4; }
.card-meta {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 0 10px 8px;
}
.card-badge {
  font-size: 12px;
  color: var(--text-sub);
  line-height: 20px;
}
.badge-checklist.complete {
  background: var(--green);
  color: #fff;
  border-radius: 4px;
  padding: 0 5px;
}
.card-due, .card-launch {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-sub);
  line-height: 16px;
}
.card-due.overdue { background: var(--red); color: #fff; }
.card-due.due-soon { background: #F5CD47; color: #533F04; }
.card-avatars { display: flex; gap: 2px; margin-left: auto; }
.card-aging { font-size: 10px; padding: 1px 5px; border-radius: 8px; font-weight: 600; }
.aging-amber { background: #fff3cd; color: #7d5000; }
.aging-red   { background: #fdecea; color: var(--red); }
.card-embargoed { opacity: .7; }
.card-lock { padding: 0 6px 0 8px; }

/* List aging-limits editor (inside the list ⋯ menu) */
.list-aging-form { padding: 10px 12px; min-width: 232px; }
.aging-row { display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text); margin-top: 8px; }
.aging-dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; padding: 0; }
.aging-dot.aging-amber { background: #F5CD47; }
.aging-dot.aging-red { background: var(--red); }
.aging-input { width: 52px; margin-left: auto; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 3px 6px; text-align: center; }
.aging-actions { display: flex; gap: 8px; margin-top: 12px; }
.aging-actions .btn { flex: 1; }

/* ─── AVATAR ─────────────────────────────────────────────────────────────── */
.avatar {
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.avatar-sm { width: 24px; height: 24px; font-size: 10px; }
.avatar-md { width: 32px; height: 32px; font-size: 12px; }
.avatar-lg { width: 40px; height: 40px; font-size: 15px; }

/* ─── BUTTONS ────────────────────────────────────────────────────────────── */
.btn {
  padding: 7px 14px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 500;
  background: var(--bg);
  color: var(--text);
  border: 1px solid var(--border);
  transition: background .12s;
}
.btn:hover { background: var(--border); }
.btn-primary { background: var(--blue); color: #fff; border-color: var(--blue); }
.btn-primary:hover { background: var(--blue-dark); border-color: var(--blue-dark); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--bg); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-full { width: 100%; }
.btn-danger { color: var(--red); border-color: #fbc0c0; }
.btn-danger:hover { background: #fdecea; }
.btn-icon { padding: 4px; border-radius: var(--radius-sm); color: var(--text-sub); }

/* ─── MODAL ──────────────────────────────────────────────────────────────── */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,.45);
  display: flex;
  align-items: flex-start;
  justify-content: center;
  overflow-y: auto;
  padding: 40px 16px;
  z-index: 1000;
}
.modal-card {
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 900px;
  max-width: 100%;
  position: relative;
  overflow: hidden;
}
.modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  font-size: 22px;
  color: var(--text-sub);
  z-index: 2;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
}
.modal-close:hover { background: var(--bg); }
.modal-cover { height: 40px; display: none; }
.modal-body { display: flex; gap: 20px; padding: 20px 24px; }
.modal-main { flex: 1; min-width: 0; }
.modal-title-input {
  font-size: 19px;
  font-weight: 700;
  border: none;
  outline: none;
  width: 100%;
  color: var(--text);
  background: transparent;
  border-bottom: 2px solid transparent;
  padding: 2px 0;
  resize: none;
  overflow: hidden;
  line-height: 1.3;
  font-family: inherit;
  min-height: 30px;
}
.modal-title-input:focus { border-bottom-color: var(--blue); }
.modal-subtitle { font-size: 12px; color: var(--text-sub); margin: 2px 0 12px; }
.modal-subtitle span { font-weight: 600; }
.save-status {
  position: absolute;
  top: 14px;
  right: 46px;
  font-size: 12px;
  z-index: 2;
  color: var(--text-sub);
}
.save-status.saving { color: var(--amber); }
.save-status.saved { color: var(--green); }
.save-status.error { color: var(--red); font-weight: 600; }
.modal-labels-row { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 10px; }
.modal-section { margin-top: 18px; }
.modal-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub);
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.modal-desc {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  resize: vertical;
  outline: none;
  background: var(--bg);
  min-height: 160px;
  line-height: 1.6;
}
.modal-desc:focus { border-color: var(--blue); }
.modal-sidebar { width: 240px; flex-shrink: 0; overflow-y: auto; max-height: 70vh; }
.modal-activity-group { border-top: 1px solid var(--border); padding-top: 12px; }
.modal-sidebar-group { margin-bottom: 16px; }
.modal-sidebar-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-sub);
  margin-bottom: 6px;
}
.modal-date-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  background: var(--bg);
  outline: none;
}
.modal-date-input:focus { border-color: var(--blue); }
.modal-date-input + .modal-date-input,
.modal-date-input + input.modal-date-input { margin-top: 6px; }
select.modal-date-input { cursor: pointer; }
.modal-sidebar-hint {
  font-size: 11px;
  color: var(--text-sub);
  margin-top: 6px;
  line-height: 1.4;
}
.modal-sidebar-hint:empty { display: none; }
.modal-footer {
  display: flex;
  gap: 8px;
  padding: 12px 24px 16px;
  border-top: 1px solid var(--border);
}
.assignees-display, .labels-display {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-bottom: 6px;
  min-height: 10px;
}
.label-tag {
  font-size: 11px;
  padding: 2px 8px;
  border-radius: 10px;
  color: #fff;
  font-weight: 600;
}

/* ─── CHECKLIST ──────────────────────────────────────────────────────────── */
.progress-bar-wrap {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  margin-bottom: 10px;
  overflow: hidden;
}
.progress-bar { height: 100%; border-radius: 2px; transition: width .3s; }
.checklist-progress-label { font-size: 11px; color: var(--text-sub); font-weight: 400; }
.checklist-list { display: flex; flex-direction: column; gap: 2px; }
.checklist-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 4px;
  border-radius: var(--radius-sm);
}
.checklist-item:hover { background: var(--bg); }
.checklist-item input[type=checkbox] { width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.checklist-text { flex: 1; font-size: 13px; }
.checklist-item.done .checklist-text { text-decoration: line-through; color: var(--text-sub); }
.checklist-delete { opacity: 0; font-size: 16px; color: var(--text-sub); padding: 0 4px; }
.checklist-item:hover .checklist-delete { opacity: 1; }
.checklist-add-row { display: flex; gap: 6px; margin-top: 8px; }
.checklist-new-input {
  flex: 1;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  outline: none;
  background: var(--bg);
}
.checklist-new-input:focus { border-color: var(--blue); }

/* ─── COMMENTS ───────────────────────────────────────────────────────────── */
.comments-list { display: flex; flex-direction: column; gap: 10px; margin-bottom: 12px; }
.comment-item { display: flex; gap: 8px; }
.comment-body { flex: 1; }
.comment-meta { font-size: 12px; color: var(--text-sub); margin-bottom: 2px; }
.comment-meta strong { color: var(--text); }
.comment-ts { color: var(--text-sub); font-size: 11px; }
.comment-text { font-size: 13px; white-space: pre-wrap; }
.comment-compose { display: flex; flex-direction: column; gap: 6px; }
.comment-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  resize: vertical;
  outline: none;
  background: var(--bg);
  font-size: 12px;
}
.comment-input:focus { border-color: var(--blue); }

/* ─── ATTACHMENTS ────────────────────────────────────────────────────────── */
.attachments-list { display: flex; flex-direction: column; gap: 4px; margin-bottom: 6px; }
.attachment-item {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 3px 4px;
  border-radius: var(--radius-sm);
  background: var(--bg);
}
.att-icon { font-size: 13px; flex-shrink: 0; }
.att-link {
  flex: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--blue);
  text-decoration: none;
  font-size: 11px;
}
.att-link:hover { text-decoration: underline; }
.att-delete { color: var(--text-sub); font-size: 15px; padding: 0 2px; opacity: 0; }
.attachment-item:hover .att-delete { opacity: 1; }
.attachment-add-row { display: flex; gap: 4px; }

/* ─── COVER COLOUR ───────────────────────────────────────────────────────── */
.cover-color-row { display: flex; flex-wrap: wrap; gap: 4px; }
.cover-swatch {
  width: 24px;
  height: 24px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: transform .1s;
}
.cover-swatch:hover { transform: scale(1.15); }
.cover-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--blue); }
.cover-swatch-clear {
  background: var(--bg);
  border-color: var(--border);
  font-size: 11px;
  color: var(--text-sub);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── PICKERS ────────────────────────────────────────────────────────────── */
.picker-dropdown {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  z-index: 2000;
  min-width: 200px;
  max-height: 300px;
  overflow-y: auto;
}
.picker-search-wrap { padding: 8px 10px 4px; }
.picker-search {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 5px 8px;
  outline: none;
}
.picker-list { padding: 4px; }
.picker-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-size: 13px;
}
.picker-item:hover { background: var(--bg); }
.picker-item.selected { background: rgba(55,138,221,.12); }
.picker-color-dot { width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; }

/* ─── SEARCH ─────────────────────────────────────────────────────────────── */
.search-box {
  position: relative;
  background: var(--bg-card);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  width: 560px;
  max-width: 100%;
  padding: 16px;
}
.search-input {
  width: 100%;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 9px 12px;
  font-size: 15px;
  outline: none;
  background: var(--bg);
}
.search-input:focus { border-color: var(--blue); }
.search-results-list { margin-top: 8px; }
.search-result-item {
  display: flex;
  flex-direction: column;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  cursor: pointer;
}
.search-result-item:hover { background: var(--bg); }
.search-result-title { font-size: 13px; font-weight: 500; }
.search-result-meta { font-size: 11px; color: var(--text-sub); margin-top: 2px; }
.search-empty { padding: 12px 10px; color: var(--text-sub); text-align: center; }
.search-box .modal-close { top: 8px; right: 10px; font-size: 20px; }

/* ─── TOAST ──────────────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  padding: 10px 20px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  font-size: 13px;
  font-weight: 500;
  z-index: 9999;
  transition: opacity .3s;
}
.toast-ok    { background: var(--green); color: #fff; }
.toast-error { background: var(--red);   color: #fff; }

/* ─── SESSION 3: LOADING ─────────────────────────────────────────────────── */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(241,239,232,.88);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  z-index: 5000;
  color: var(--text-sub);
  font-size: 14px;
}
.spinner {
  width: 36px;
  height: 36px;
  border: 4px solid var(--border);
  border-top-color: var(--blue);
  border-radius: 50%;
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ─── DRAG REORDER (SortableJS, mouse + touch) ───────────────────────────── */
/* the gap left where the card will land */
.card-drag-ghost {
  opacity: 1;
  background: rgba(55,138,221,.10);
  border: 2px dashed var(--blue);
  border-radius: var(--radius-sm);
}
.card-drag-ghost > * { visibility: hidden; }
/* the card actually following the cursor / finger */
.card-drag-active {
  box-shadow: var(--shadow-lg);
  transform: rotate(2deg);
  cursor: grabbing;
}
.card-drag-chosen { cursor: grabbing; }

/* ─── SESSION 3: EMPTY LIST ──────────────────────────────────────────────── */
.cards-empty {
  padding: 14px 8px;
  text-align: center;
  color: var(--text-sub);
  font-size: 12px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
}
.cards-list.drop-target .cards-empty { display: none; }

/* ─── SESSION 3: QUICK EDIT ──────────────────────────────────────────────── */
.card-tile { position: relative; }
.card-quick-edit {
  position: absolute;
  top: 4px;
  right: 4px;
  opacity: 0;
  background: var(--bg-card);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 12px;
  color: var(--text-sub);
  box-shadow: var(--shadow);
  transition: opacity .12s;
  z-index: 1;
}
.card-tile:hover .card-quick-edit { opacity: 1; }
.card-quick-edit:hover { color: var(--blue); }
.quick-edit-input {
  width: calc(100% - 12px);
  margin: 6px;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 4px 6px;
  font-size: 13px;
  line-height: 1.45;
  resize: none;
  outline: none;
  display: block;
}

/* ─── SESSION 3: MENTIONS ────────────────────────────────────────────────── */
.mention {
  color: var(--blue);
  font-weight: 600;
  cursor: pointer;
  border-radius: 3px;
  padding: 0 2px;
  background: rgba(55,138,221,.1);
}
.mention:hover { text-decoration: underline; }
.mention-email { color: var(--text-sub); font-size: 11px; }
.picker-item.active { background: rgba(55,138,221,.18); }

/* ─── SESSION 3: MEMBER POPOVER ──────────────────────────────────────────── */
.member-popover {
  position: fixed;
  display: flex;
  gap: 12px;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
  padding: 12px 16px;
  z-index: 3000;
  min-width: 200px;
}
.member-popover-name { font-weight: 700; font-size: 14px; }
.member-popover-email { color: var(--text-sub); font-size: 12px; margin-top: 1px; }
.member-popover-role {
  display: inline-block;
  margin-top: 4px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--blue-dark);
  background: rgba(55,138,221,.12);
  border-radius: 8px;
  padding: 1px 7px;
}

/* ─── SESSION 3: LIST MANAGEMENT ─────────────────────────────────────────── */
.list-title { cursor: pointer; }
.list-title:hover { color: var(--blue-dark); text-decoration: underline; }
.list-menu-btn {
  color: var(--text-sub);
  padding: 0 6px;
  font-size: 14px;
  border-radius: var(--radius-sm);
  line-height: 1.4;
}
.list-menu-btn:hover { background: var(--border); color: var(--text); }
.list-rename-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 2px 6px;
  font-size: 13px;
  font-weight: 600;
  outline: none;
}
.list-add-form {
  background: var(--bg-list);
  border-radius: var(--radius);
  padding: 8px;
  min-width: 260px;
  width: 260px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex-shrink: 0;
}
.list-add-form-actions { display: flex; gap: 6px; }

/* ─── SESSION 3b: BOARD CANVAS COVER (Trello-style full background) ──────── */
#main.has-cover #board-header {
  background: rgba(0, 0, 0, .18);
  border-bottom: none;
}
#main.has-cover #board-title { color: #fff; text-shadow: 0 1px 2px rgba(0,0,0,.3); }
#main.has-cover .btn { background: rgba(255,255,255,.9); border-color: transparent; }
#main.has-cover .btn:hover { background: #fff; }
#main.has-cover .btn-ghost { background: rgba(255,255,255,.16); color: #fff; }
#main.has-cover .btn-ghost:hover { background: rgba(255,255,255,.28); }
#main.has-cover .view-toggle { border-color: transparent; }
#main.has-cover .view-toggle-btn { background: rgba(255,255,255,.9); }
#main.has-cover .view-toggle-btn.active { background: var(--blue-dark); color: #fff; }
#main.has-cover .cal-month-label { color: #fff; }
#main.has-cover .cal-weekdays div { color: rgba(255,255,255,.85); }
#main.has-cover .cal-out { background: rgba(255,255,255,.25); border-color: transparent; }
#main.has-cover .list-add-btn { background: rgba(255,255,255,.25); color: #fff; }
#main.has-cover .list-add-btn:hover { background: rgba(255,255,255,.35); }
#main.has-cover .empty-state { color: rgba(255,255,255,.85); }

/* ─── SESSION 3b: INLINE CARD COMPOSER ───────────────────────────────────── */
.composer-input {
  width: 100%;
  border: none;
  border-radius: 8px;
  box-shadow: 0 1px 1px rgba(9,30,66,.25);
  padding: 8px 10px;
  font-size: 14px;
  line-height: 1.4;
  resize: none;
  outline: none;
  background: var(--bg-card);
  display: block;
}
.composer-actions {
  display: flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.composer-close {
  font-size: 20px;
  color: var(--text-sub);
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  line-height: 1;
}
.composer-close:hover { background: var(--border); color: var(--text); }

/* ─── SESSION 3b: FILTER ─────────────────────────────────────────────────── */
.filter-popover { min-width: 240px; padding-bottom: 8px; }
.filter-popover .btn-full { width: calc(100% - 16px); margin: 6px 8px 0; }
.filter-section-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-sub);
  padding: 10px 12px 2px;
}
#filter-btn.filter-active { background: var(--blue); color: #fff; border-color: var(--blue); }

/* ─── SESSION 3b: LABEL EDITOR ───────────────────────────────────────────── */
.picker-item-name { flex: 1; }
.label-edit-pencil {
  opacity: 0;
  color: var(--text-sub);
  font-size: 12px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
}
.picker-item:hover .label-edit-pencil { opacity: 1; }
.label-edit-pencil:hover { background: var(--border); color: var(--text); }
.picker-footer-btn {
  display: block;
  width: calc(100% - 16px);
  margin: 2px 8px 8px;
  padding: 6px 8px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  color: var(--text-sub);
  background: var(--bg);
  text-align: center;
}
.picker-footer-btn:hover { background: var(--border); color: var(--text); }
.label-editor {
  padding: 10px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 240px;
}
.label-editor-header {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-sub);
}
.label-editor-back {
  font-size: 18px;
  line-height: 1;
  color: var(--text-sub);
  padding: 0 6px;
  border-radius: var(--radius-sm);
}
.label-editor-back:hover { background: var(--border); color: var(--text); }
.label-editor-preview {
  align-self: flex-start;
  font-size: 12px;
  padding: 4px 12px;
}
.label-color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.label-color-swatch {
  height: 30px;
  border-radius: var(--radius-sm);
  border: 2px solid transparent;
  transition: transform .1s;
}
.label-color-swatch:hover { transform: scale(1.08); }
.label-color-swatch.selected { border-color: #fff; box-shadow: 0 0 0 2px var(--blue-dark); }

/* ─── SESSION 3: VIEW TOGGLE ─────────────────────────────────────────────── */
.view-toggle {
  display: flex;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow: hidden;
  margin-right: 4px;
}
.view-toggle-btn {
  padding: 5px 14px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-sub);
  background: var(--bg-card);
}
.view-toggle-btn:hover { background: var(--bg); }
.view-toggle-btn.active { background: var(--blue); color: #fff; }

/* ─── SESSION 3: CALENDAR ────────────────────────────────────────────────── */
.calendar-container {
  height: 100%;
  display: flex;
  flex-direction: column;
  overflow: auto;
}
.cal-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 10px;
  flex-shrink: 0;
}
.cal-month-label {
  font-weight: 700;
  font-size: 15px;
  color: var(--blue-dark);
  min-width: 150px;
  text-align: center;
}
.cal-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 4px;
  margin-bottom: 4px;
  flex-shrink: 0;
}
.cal-weekdays div {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .5px;
  color: var(--text-sub);
  padding: 2px 6px;
}
.cal-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  grid-auto-rows: minmax(96px, auto);
  gap: 4px;
  flex: 1;
}
.cal-cell {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  overflow: hidden;
  min-width: 0;
}
.cal-out { opacity: .45; background: transparent; }
.cal-today { border-color: var(--blue); box-shadow: inset 0 0 0 1px var(--blue); }
.cal-daynum { font-size: 11px; font-weight: 600; color: var(--text-sub); }
.cal-today .cal-daynum { color: var(--blue); }
.cal-chip {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: var(--radius-sm);
  background: var(--blue);
  color: #fff;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  flex-shrink: 0;
}
.cal-chip:hover { filter: brightness(1.12); }
.cal-chip-launch { background: var(--green); }

/* ─── SESSION 3: CARD COVER IMAGE (full image, no crop — Trello style) ───── */
.card-cover-img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
  background: #F7F6F3;
}

/* ─── SESSION 3b: AVATAR PHOTOS ──────────────────────────────────────────── */
.avatar { overflow: hidden; }
.avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* ─── SESSION 3b: CHECKLIST ITEM EDIT ────────────────────────────────────── */
.checklist-text { cursor: pointer; border-radius: var(--radius-sm); }
.checklist-edit-wrap { flex: 1; }
.checklist-edit-input {
  width: 100%;
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 6px 8px;
  font-size: 13px;
  line-height: 1.4;
  resize: none;
  outline: none;
  background: var(--bg-card);
  display: block;
}

/* ─── SESSION 3b: CREATE BOARD ───────────────────────────────────────────── */
.board-nav-add { color: rgba(255,255,255,.45); font-size: 13px; }
.board-nav-add:hover { color: rgba(255,255,255,.8); }
.board-form {
  width: 250px;
  padding: 4px 12px 12px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.board-form .filter-section-label { padding: 6px 0 0; }
.board-form .btn-full { margin-top: 4px; }
#board-settings { width: 290px; max-height: 88vh; }
.bs-hint { font-size: 11px; color: var(--text-sub); line-height: 1.4; margin-top: -2px; }
#bs-archive { color: var(--red); margin-top: 2px; }

/* ─── SESSION 3b: CARD ACTIONS MENU ──────────────────────────────────────── */
.modal-menu-btn {
  position: absolute;
  top: 10px;
  right: 44px;
  font-size: 18px;
  color: var(--text-sub);
  z-index: 2;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  line-height: 1.3;
}
.modal-menu-btn:hover { background: var(--bg); }
.save-status { right: 84px; }
.card-menu { min-width: 200px; padding: 6px; }
.card-menu-item {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  font-size: 13px;
  text-align: left;
  color: var(--text);
}
.card-menu-item:hover { background: var(--bg); }
.card-menu-icon { width: 18px; text-align: center; flex-shrink: 0; }
.card-menu-sep { border-top: 1px solid var(--border); margin: 6px 4px; }
.card-menu-move {
  padding: 6px 8px 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  width: 230px;
}

/* ─── SESSION 3b: CHECKLIST ITEM DUE DATES ───────────────────────────────── */
.checklist-due {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--text-sub);
  flex-shrink: 0;
  line-height: 16px;
}
.checklist-due.overdue { background: var(--red); color: #fff; }
.checklist-due.due-soon { background: #F5CD47; color: #533F04; }
.checklist-due-add {
  opacity: 0;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--text-sub);
  flex-shrink: 0;
}
.checklist-item:hover .checklist-due-add { opacity: 1; }
.checklist-due-add:hover, .checklist-due:hover { background: var(--border); }
.checklist-due-input {
  border: 1px solid var(--blue);
  border-radius: var(--radius-sm);
  padding: 2px 4px;
  font-size: 12px;
  outline: none;
  flex-shrink: 0;
  width: 130px;
}

/* ─── SESSION 3b: TEMPLATE CARDS ─────────────────────────────────────────── */
.template-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 24px;
  background: rgba(55,138,221,.1);
  border-bottom: 1px solid rgba(55,138,221,.25);
  font-size: 13px;
}
.template-banner-label { font-weight: 600; color: var(--blue-dark); }
#template-banner-action { display: flex; gap: 6px; align-items: center; }
.template-title-input { width: 220px; }
.card-tile.card-template { border: 2px dashed var(--blue); }
.card-template-badge {
  display: inline-block;
  margin: 8px 10px 0;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .5px;
  color: var(--blue-dark);
  background: rgba(55,138,221,.12);
  border-radius: 4px;
  padding: 2px 6px;
}

/* ─── SCROLLBARS ─────────────────────────────────────────────────────────── */
::-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: #b0aca4; }

/* ─── STOCKIST DIRECTORY ─────────────────────────────────────────────────── */
.board-nav-directory .dir-dot { font-size: 13px; background: transparent !important; line-height: 1; }
.directory-container { padding: 16px 20px 40px; overflow: auto; height: 100%; }
.dir-toolbar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 16px; }
.dir-title { font-size: 20px; font-weight: 700; color: var(--text); margin-right: 4px; }
.dir-region, .dir-search {
  border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 6px 10px; background: var(--bg-card); outline: none; font-size: 13px;
}
.dir-search { min-width: 200px; }
.dir-region:focus, .dir-search:focus { border-color: var(--blue); }
.dir-toolbar .dir-add-spacer { margin-left: auto; }
#dir-add-btn { margin-left: auto; }
.dir-empty { padding: 48px 0; text-align: center; color: var(--text-sub); }

/* List/table view */
.dir-table { width: 100%; border-collapse: collapse; background: var(--bg-card);
  border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow); }
.dir-table th {
  text-align: left; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  color: var(--text-sub); padding: 10px 12px; border-bottom: 1px solid var(--border);
  background: var(--bg-list);
}
.dir-table td { padding: 10px 12px; border-bottom: 1px solid var(--border); font-size: 13px;
  vertical-align: top; }
.dir-region-row td { background: var(--bg-list); font-weight: 700; font-size: 12px;
  text-transform: uppercase; letter-spacing: .5px; color: var(--text-sub); }
.dir-row:hover { background: #FAF9F6; }
.dir-name { font-weight: 600; }
.dir-notes { color: var(--text-sub); max-width: 280px; }
.dir-row-dormant, .dir-row-closed { opacity: .55; }
.dir-actions { white-space: nowrap; text-align: right; }
.dir-actions .btn { margin-left: 4px; }
.dir-visit { font-size: 11px; padding: 2px 7px; border-radius: 8px; font-weight: 600;
  background: var(--bg-list); color: var(--text-sub); white-space: nowrap; }
.dir-visit.overdue { background: #fdecea; color: var(--red); }
.dir-visit.due-soon { background: #FFF3CD; color: #7D5000; }
.dir-visit-none { color: var(--text-sub); }
.dir-status { font-size: 11px; padding: 2px 8px; border-radius: 10px; font-weight: 600; }
.dir-status-active { background: #E3F4EC; color: var(--green); }
.dir-status-dormant { background: #f0eee8; color: var(--text-sub); }
.dir-status-closed { background: #fdecea; color: var(--red); }

/* Route view */
.route-group { background: var(--bg-card); border-radius: var(--radius); box-shadow: var(--shadow);
  margin-bottom: 16px; overflow: hidden; }
.route-group-title { padding: 12px 14px; font-weight: 700; border-bottom: 1px solid var(--border);
  background: var(--bg-list); }
.route-group-count { font-weight: 500; color: var(--text-sub); font-size: 12px; margin-left: 6px; }
.route-stop { display: flex; align-items: center; gap: 12px; padding: 10px 14px;
  border-bottom: 1px solid var(--border); }
.route-stop:last-child { border-bottom: none; }
.route-seq { width: 26px; height: 26px; flex-shrink: 0; border-radius: 50%; background: var(--blue);
  color: #fff; font-weight: 700; font-size: 13px; display: flex; align-items: center; justify-content: center; }
.route-info { flex: 1; min-width: 0; }
.route-name { font-weight: 600; }
.route-sub { font-size: 12px; color: var(--text-sub); }

/* Add/edit form */
.stockist-form-card { background: var(--bg-card); border-radius: var(--radius); padding: 22px;
  width: 640px; max-width: 94vw; max-height: 90vh; overflow: auto; position: relative;
  box-shadow: var(--shadow-lg); }
.stockist-form-card h3 { font-size: 18px; font-weight: 700; margin-bottom: 16px; }
.stockist-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stockist-form-grid label { display: flex; flex-direction: column; font-size: 12px;
  font-weight: 600; color: var(--text-sub); gap: 4px; }
.stockist-form-grid input, .stockist-form-grid select, .stockist-form-grid textarea {
  border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 7px 9px;
  font-size: 13px; font-weight: 400; color: var(--text); background: var(--bg-card); outline: none;
}
.stockist-form-grid input:focus, .stockist-form-grid select:focus,
.stockist-form-grid textarea:focus { border-color: var(--blue); }
.stockist-form-grid .sf-wide { grid-column: 1 / -1; }
.stockist-form-grid .sf-check { flex-direction: row; align-items: center; gap: 8px; }
.stockist-form-grid .sf-check input { width: auto; }
.stockist-form-actions { display: flex; gap: 10px; margin-top: 18px; }

/* ─── MY DAY ─────────────────────────────────────────────────────────────── */
.board-nav-myday .myday-dot, .board-nav-sop .sop-dot {
  background: transparent !important; font-size: 13px; line-height: 1;
}
.myday-sub { color: var(--text-sub); font-size: 13px; }
.myday-body { max-width: 760px; }
.myday-section { margin-bottom: 22px; }
.myday-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .5px; color: var(--text-sub); margin-bottom: 8px; }
.myday-section-title.myday-overdue { color: var(--red); }
.myday-section-title.myday-today { color: var(--blue-dark); }
.myday-count { background: var(--bg-list); border-radius: 9px; padding: 0 7px;
  margin-left: 4px; font-weight: 600; }
.myday-row { display: flex; align-items: center; gap: 10px; background: var(--bg-card);
  border: 1px solid var(--border); border-radius: var(--radius); padding: 10px 14px;
  margin-bottom: 6px; cursor: pointer; transition: border-color .12s; }
.myday-row:hover { border-color: var(--blue); }
.myday-row-main { flex: 1; min-width: 0; }
.myday-card-title { font-weight: 600; }
.myday-card-ctx { font-size: 12px; color: var(--text-sub); margin-top: 2px; }
.myday-meta { font-size: 12px; color: var(--text-sub); }

/* ─── SOP LIBRARY ─ gallery index ────────────────────────────────────────── */
.sop-index-head { display: flex; align-items: flex-end; justify-content: space-between;
  flex-wrap: wrap; gap: 14px; margin-bottom: 28px; }
.sop-index-title { display: flex; align-items: center; gap: 14px; }
.sop-index-emoji { font-size: 38px; line-height: 1; }
.sop-index-sub { color: var(--text-sub); font-size: 13px; margin-top: 2px; }
.sop-index-tools { display: flex; align-items: center; gap: 8px; }

.sop-body { max-width: 980px; }
.sop-cat { margin-bottom: 30px; }
.sop-cat-title { font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-sub); margin-bottom: 12px; }
.sop-cat-count { background: var(--bg-list); color: var(--text-sub); border-radius: 9px;
  padding: 1px 7px; font-size: 11px; margin-left: 4px; }
.sop-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(232px, 1fr));
  gap: 14px; }
.sop-card { background: var(--bg-card); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px 16px 14px; cursor: pointer;
  transition: border-color .14s, box-shadow .14s, transform .14s;
  display: flex; flex-direction: column; min-height: 116px; }
.sop-card:hover { border-color: var(--blue); box-shadow: var(--shadow);
  transform: translateY(-2px); }
.sop-card-icon { font-size: 28px; line-height: 1; margin-bottom: 10px; }
.sop-card-title { font-weight: 650; font-size: 15px; line-height: 1.3; }
.sop-card-desc { font-size: 13px; color: var(--text-sub); margin-top: 5px; line-height: 1.45;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.sop-card-meta { font-size: 11px; color: var(--text-sub); margin-top: auto; padding-top: 10px;
  opacity: .8; }

.sop-empty { text-align: center; color: var(--text-sub); padding: 70px 20px; }
.sop-empty-emoji { font-size: 46px; margin-bottom: 12px; }
.sop-empty p { margin: 4px 0; }
.sop-empty-sub { font-size: 13px; }

/* ─── SOP ─ full-page reader / editor chrome ─────────────────────────────── */
.sop-fullpage { position: fixed; inset: 0; z-index: 60; background: var(--bg);
  display: flex; flex-direction: column; }
.sop-fp-bar { display: flex; align-items: center; gap: 12px; padding: 10px 18px;
  border-bottom: 1px solid var(--border); background: var(--bg-card); flex-shrink: 0; }
.sop-fp-bar-right { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.sop-reader-link { text-decoration: none; }

/* ─── SOP ─ the document (shared by reader + editor preview) ──────────────── */
.sop-doc { overflow-y: auto; flex: 1; min-height: 0; }
#sop-reader-doc { padding: 8px 24px 120px; }
.sop-doc-inner, #sop-reader-doc > * { }
#sop-reader-doc { max-width: 760px; margin: 0 auto; width: 100%; }
.sop-doc-icon { font-size: 60px; line-height: 1; margin: 40px 0 14px; }
.sop-doc-title { font-size: 40px; font-weight: 800; letter-spacing: -.6px;
  line-height: 1.12; color: var(--text); }
.sop-doc-meta { font-size: 13px; color: var(--text-sub); margin-top: 12px; }
.sop-doc-lead { font-size: 18px; color: var(--text-sub); line-height: 1.6; margin-top: 16px; }
.sop-doc-divider { border-top: 1px solid var(--border); margin: 26px 0 8px; }
.sop-doc-empty { color: var(--text-sub); font-style: italic; padding: 20px 0; }

.sop-doc-body { font-size: 16px; line-height: 1.75; color: var(--text); }
.sop-doc-body .md-h1 { font-size: 27px; font-weight: 750; margin: 30px 0 10px; letter-spacing: -.3px; }
.sop-doc-body .md-h2 { font-size: 21px; font-weight: 700; margin: 26px 0 8px; }
.sop-doc-body .md-h3 { font-size: 17px; font-weight: 700; margin: 22px 0 6px; }
.sop-doc-body .md-p { margin: 0 0 14px; }
.sop-doc-body .md-ul { margin: 0 0 14px; padding-left: 26px; list-style: disc; }
.sop-doc-body .md-ol { margin: 0 0 14px; padding-left: 26px; list-style: decimal; }
.sop-doc-body .md-ul li, .sop-doc-body .md-ol li { margin: 5px 0; padding-left: 4px; }
.sop-doc-body .md-ul li::marker { color: var(--text-sub); }
.sop-doc-body .md-ol li::marker { color: var(--text-sub); font-weight: 600; }
.sop-doc-body a { color: var(--blue); text-decoration: none; border-bottom: 1px solid rgba(55,138,221,.35); }
.sop-doc-body a:hover { border-bottom-color: var(--blue); }
.sop-doc-body strong { font-weight: 700; }
.sop-doc-body code { font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: .86em;
  background: var(--bg-list); padding: 2px 6px; border-radius: 5px; color: var(--red); }
.sop-doc-body .md-pre { background: #1E2023; color: #E8E6E0; border-radius: 8px;
  padding: 14px 16px; overflow-x: auto; margin: 0 0 16px; }
.sop-doc-body .md-pre code { background: none; color: inherit; padding: 0; font-size: 13px; }
.sop-doc-body .md-hr { border: none; border-top: 1px solid var(--border); margin: 26px 0; }
.sop-doc-body .md-callout { display: flex; gap: 12px; background: #FBF3E2;
  border: 1px solid #F0E2C4; border-radius: 8px; padding: 14px 16px; margin: 0 0 16px; }
.sop-doc-body .md-callout-icon { font-size: 18px; line-height: 1.5; flex-shrink: 0; }
.sop-doc-body .md-callout-body { line-height: 1.65; }
.sop-doc-body .md-checklist { list-style: none; padding-left: 2px; margin: 0 0 14px; }
.sop-doc-body .md-check { display: flex; gap: 9px; align-items: flex-start; margin: 6px 0; }
.sop-doc-body .md-box { color: var(--blue); font-size: 18px; line-height: 1.4; flex-shrink: 0; }
.sop-doc-body .md-check.md-checked { color: var(--text-sub); }
.sop-doc-body .md-check.md-checked .md-box { color: var(--green); }
.sop-doc-body .md-check.md-checked span:last-child { text-decoration: line-through; }

/* ─── SOP ─ editor ───────────────────────────────────────────────────────── */
.sop-ed-meta { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; }
.sop-ed-emoji { font-size: 24px; line-height: 1; padding: 4px 6px; border-radius: 6px;
  transition: background .12s; }
.sop-ed-emoji:hover { background: var(--bg-list); }
.sop-ed-title { flex: 1; min-width: 0; font-size: 20px; font-weight: 700; border: none;
  background: none; padding: 4px 2px; color: var(--text); }
.sop-ed-title:focus { outline: none; }
.sope-del-btn { color: var(--red); }

.sop-ed-fields { display: flex; gap: 14px; padding: 12px 18px; border-bottom: 1px solid var(--border);
  background: var(--bg-card); flex-shrink: 0; flex-wrap: wrap; }
.sop-ed-fields label { display: flex; flex-direction: column; gap: 4px; font-size: 12px;
  font-weight: 600; color: var(--text-sub); flex: 1; min-width: 160px; }
.sop-ed-fields input { border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 7px 9px; font-weight: 400; color: var(--text); background: var(--bg); }
.sop-ed-fields input:focus { outline: none; border-color: var(--blue); }

.sop-ed-split { display: flex; flex: 1; min-height: 0; }
.sop-ed-pane { flex: 1; min-width: 0; display: flex; flex-direction: column;
  border-right: 1px solid var(--border); }
.sop-ed-pane:last-child { border-right: none; }
.sop-ed-pane-head { display: flex; align-items: baseline; gap: 10px; padding: 8px 22px;
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-sub); border-bottom: 1px solid var(--border); flex-shrink: 0; }
.sop-ed-hint { text-transform: none; letter-spacing: 0; font-weight: 400; font-size: 11px;
  opacity: .8; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sop-ed-textarea { flex: 1; min-height: 0; border: none; resize: none; padding: 22px 24px;
  font-family: 'SF Mono', ui-monospace, Menlo, monospace; font-size: 14px; line-height: 1.7;
  color: var(--text); background: var(--bg-card); }
.sop-ed-textarea:focus { outline: none; }
.sop-ed-preview { padding: 22px 24px 80px; background: var(--bg); }
.sop-ed-preview .sop-doc-body { font-size: 15px; }

/* ─── SOP ─ emoji picker ─────────────────────────────────────────────────── */
.sop-emoji-picker { position: fixed; z-index: 70; width: 268px; padding: 10px;
  display: grid; grid-template-columns: repeat(8, 1fr); gap: 2px; }
.sop-emoji-opt { font-size: 19px; line-height: 1; padding: 5px; border-radius: 6px;
  transition: background .1s; }
.sop-emoji-opt:hover { background: var(--bg-list); }

/* ─── MOBILE NAV ELEMENTS (base — hidden on desktop) ─────────────────────── */
.nav-toggle { display: none; }
.nav-backdrop { display: none; }
.sop-ed-tabs { display: none; }

/* ─── RESPONSIVE · phones & small tablets (≤768px) ───────────────────────── */
@media (max-width: 768px) {
  /* sidebar → off-canvas slide-in drawer */
  #sidebar { position: fixed; top: 0; left: 0; height: 100vh; z-index: 90;
    transform: translateX(-100%); transition: transform .22s ease;
    box-shadow: var(--shadow-lg); }
  #app.nav-open #sidebar { transform: translateX(0); }
  .nav-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 80; }
  #app.nav-open .nav-backdrop { display: block; }

  /* floating hamburger */
  .nav-toggle { display: flex; align-items: center; justify-content: center;
    position: fixed; top: 8px; left: 8px; z-index: 50;
    width: 40px; height: 40px; border-radius: var(--radius-sm);
    background: var(--bg-card); color: var(--text); font-size: 20px;
    border: 1px solid var(--border); box-shadow: var(--shadow); }

  /* board header makes room for the hamburger; actions wrap */
  #board-header { padding: 12px 14px 12px 56px; flex-wrap: wrap; gap: 8px; }
  #board-title { font-size: 16px; }
  .board-header-actions { gap: 6px; flex-wrap: wrap; }

  /* content + module views clear the floating hamburger */
  #board-content { padding: 12px; }
  .directory-container { padding-top: 44px; }

  /* kanban lists → near-full-width with snap scrolling */
  .lists-container { gap: 10px; scroll-snap-type: x mandatory; -webkit-overflow-scrolling: touch; }
  .list-column { width: 84vw; min-width: 84vw; scroll-snap-align: start; }

  /* card-back modal stacks vertically */
  .modal-overlay { padding: 10px 8px; }
  .modal-body { flex-direction: column; gap: 14px; padding: 16px 16px 20px; }
  .modal-sidebar { width: 100%; max-height: none; }

  /* SOP gallery → two columns */
  .sop-grid { grid-template-columns: 1fr 1fr; gap: 10px; }
  .sop-index-head { margin-bottom: 18px; }

  /* SOP reader doc tightens */
  #sop-reader-doc { padding: 4px 16px 90px; }
  .sop-doc-icon { font-size: 48px; margin: 18px 0 10px; }
  .sop-doc-title { font-size: 28px; }
  .sop-doc-lead { font-size: 16px; }
  .sop-doc-body { font-size: 15px; }

  /* SOP editor → single pane with Write/Preview tabs */
  .sop-ed-tabs { display: flex; background: var(--bg-card); border-bottom: 1px solid var(--border); }
  .sop-ed-tab { flex: 1; padding: 11px; font-size: 13px; font-weight: 600;
    color: var(--text-sub); border-bottom: 2px solid transparent; }
  .sop-ed-tab.active { color: var(--blue); border-bottom-color: var(--blue); }
  .sop-ed-pane-head { display: none; }
  .sop-ed-pane { border-right: none; }
  .sop-ed-split:not(.show-preview) .sop-ed-pane:last-child { display: none; }
  .sop-ed-split.show-preview .sop-ed-pane:first-child { display: none; }
  .sop-ed-fields { gap: 10px; padding: 10px 14px; }
  .sop-ed-fields label { min-width: 100%; }
  .sop-ed-meta { gap: 6px; }
  .sop-ed-title { font-size: 17px; }
  .sop-ed-textarea { padding: 16px; }
  .sop-ed-preview { padding: 16px 16px 70px; }

  /* stockist / form grids → single column, full width */
  .stockist-form-grid { grid-template-columns: 1fr; }
  .stockist-form-card { width: 100%; }

  /* directory table scrolls horizontally instead of squashing */
  .directory-body { overflow-x: auto; -webkit-overflow-scrolling: touch; }
  .dir-table { min-width: 640px; }

  /* dropdown pickers never exceed the screen */
  .picker-dropdown { max-width: calc(100vw - 20px); }
  #board-settings, .board-form { width: auto; max-width: calc(100vw - 20px); }

  /* sign-in card fits tiny screens */
  .signin-card { width: 100%; max-width: calc(100vw - 32px); }

  /* comfier tap targets */
  .btn { min-height: 38px; }
  .board-nav-item { padding: 9px 8px; }
}

/* ─── ACCESS / VISIBILITY CONTROLS ───────────────────────────────────────── */
.vis-checks { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 2px 0 4px; }
.vis-check { display: flex; align-items: center; gap: 6px; font-size: 13px;
  color: var(--text); cursor: pointer; white-space: nowrap; }
.vis-check input { width: auto; cursor: pointer; }
.sope-vis-field { display: flex; flex-direction: column; gap: 2px; font-size: 12px;
  font-weight: 600; color: var(--text-sub); flex-basis: 100%; }
.sope-vis-cap { margin-bottom: 2px; }
.sope-vis-hint { font-weight: 400; font-size: 11px; opacity: .8; }
.sop-card-vis { display: inline-flex; align-self: flex-start; margin-top: 6px;
  font-size: 11px; font-weight: 600; color: var(--blue-dark);
  background: rgba(55,138,221,.10); border-radius: 9px; padding: 1px 8px; }

/* ─── BOARD NAV — restricted-board lock badge (admins) ───────────────────── */
.board-nav-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.board-nav-lock { font-size: 10px; opacity: .6; flex-shrink: 0; }
