/* ═══════════════════════════════════════════════════════
   VARIABLES & RESET
═══════════════════════════════════════════════════════ */
:root {
  --primary:       #0052cc;
  --primary-dark:  #0747a6;
  --primary-light: #4c9aff;
  --board-bg:      #f4f5f7;
  --nav-bg:        #026aa7;
  --list-bg:       #ebecf0;
  --card-bg:       #ffffff;
  --sidebar-bg:    #026aa7;
  --sidebar-hover: #055a8c;
  --text:          #172b4d;
  --text-muted:    #5e6c84;
  --text-light:    #97a0af;
  --text-white:    #ffffff;
  --danger:        #eb5a46;
  --danger-dark:   #c9372c;
  --success:       #61bd4f;
  --warning:       #f5a623;
  --border:        #dfe1e6;
  --shadow-sm:     0 1px 3px rgba(0,0,0,.18);
  --shadow:        0 2px 8px rgba(0,0,0,.24);
  --shadow-lg:     0 8px 24px rgba(0,0,0,.3);
  --radius:        4px;
  --radius-lg:     8px;
  --transition:    .18s ease;
  --list-width:    280px;
  --nav-height:    48px;
  /* Semantic surface / state tokens used by UI components */
  --bg:            #f4f5f7;   /* page / pane background          */
  --bg-2:          #ffffff;   /* raised surface (cards, panels)  */
  --bg-hover:      #e8eaed;   /* hover highlight                 */
  --bg-secondary:  #ebecf0;   /* secondary surface               */
  --accent:        #0052cc;   /* avatar / badge accent (= primary) */
}

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

html, body {
  height: 100%;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: #f4f5f7;
}

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

button { cursor: pointer; border: none; background: none; font-family: inherit; font-size: inherit; }
input, textarea, select { font-family: inherit; font-size: inherit; color: var(--text); }

/* ═══════════════════════════════════════════════════════
   UTILITIES
═══════════════════════════════════════════════════════ */
.hidden { display: none !important; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.gap-8 { gap: 8px; }
.mt-8 { margin-top: 8px; }
.mt-16 { margin-top: 16px; }
.text-muted { color: var(--text-muted); }
.text-sm { font-size: 12px; }

/* ═══════════════════════════════════════════════════════
   LOADING SCREEN
═══════════════════════════════════════════════════════ */
.loading-screen {
  position: fixed; inset: 0;
  display: flex; align-items: center; justify-content: center;
  background: #0079bf;
}
.spinner {
  width: 42px; height: 42px;
  border: 4px solid rgba(255,255,255,.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ═══════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
═══════════════════════════════════════════════════════ */
#toast-container {
  position: fixed; bottom: 24px; right: 24px;
  z-index: 9999;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px;
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 13px;
  font-weight: 500;
  box-shadow: var(--shadow);
  animation: slideIn .25s ease;
  max-width: 320px;
}
.toast.success { background: #1d7a3d; }
.toast.error   { background: var(--danger-dark); }
.toast.info    { background: var(--primary); }
@keyframes slideIn { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: none; } }

/* ═══════════════════════════════════════════════════════
   MODAL
═══════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed; inset: 0;
  background: rgba(0,0,0,.6);
  z-index: 1000;
  display: flex; align-items: flex-start; justify-content: center;
  padding: 48px 16px;
  overflow-y: auto;
}
.modal-box {
  background: #f4f5f7;
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 760px;
  min-height: 200px;
  position: relative;
}
/* Small auth modals */
.modal-box.auth-modal {
  max-width: 420px;
  background: #fff;
  padding: 32px;
}
/* Generic modal header / body used by panels (automations, etc.) */
.modal-box .modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem .85rem;
  border-bottom: 1px solid var(--border);
  background: var(--card-bg, #fff);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-box .modal-header h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--text);
}
.modal-box .modal-body {
  background: var(--bg, #f4f5f7);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  overflow-y: auto;
  max-height: calc(100vh - 160px);
}

/* ═══════════════════════════════════════════════════════
   LANDING PAGE
═══════════════════════════════════════════════════════ */
.landing {
  min-height: 100vh;
  background: linear-gradient(135deg, #0079bf 0%, #026aa7 60%, #004e8a 100%);
  display: flex; flex-direction: column;
}
.landing-nav {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 32px;
  height: var(--nav-height);
  background: rgba(0,0,0,.15);
}
.landing-logo {
  font-size: 20px; font-weight: 800;
  color: #fff; letter-spacing: -.5px;
}
.landing-logo i { margin-right: 6px; }
.landing-nav-btns { display: flex; gap: 8px; }
.btn-ghost {
  padding: 7px 16px; border-radius: var(--radius);
  color: #fff; font-weight: 600; font-size: 13px;
  background: rgba(255,255,255,.15);
  transition: var(--transition);
}
.btn-ghost:hover { background: rgba(255,255,255,.25); }
.btn-white {
  padding: 7px 16px; border-radius: var(--radius);
  color: var(--primary); font-weight: 700; font-size: 13px;
  background: #fff;
  transition: var(--transition);
}
.btn-white:hover { background: #e8f0fe; }

.hero {
  flex: 1;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  padding: 80px 24px 60px;
  color: #fff;
}
.hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800; line-height: 1.15;
  margin-bottom: 16px;
  text-shadow: 0 2px 8px rgba(0,0,0,.2);
}
.hero p {
  font-size: 18px; opacity: .9;
  max-width: 520px; line-height: 1.6;
  margin-bottom: 32px;
}
.btn-cta {
  display: inline-block;
  padding: 14px 36px;
  background: #fff;
  color: var(--primary);
  font-weight: 700; font-size: 16px;
  border-radius: var(--radius-lg);
  box-shadow: 0 4px 12px rgba(0,0,0,.2);
  transition: var(--transition);
}
.btn-cta:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,.25); text-decoration: none; }

.features {
  background: #fff;
  padding: 64px 24px;
}
.features-inner {
  max-width: 960px; margin: 0 auto;
  text-align: center;
}
.features h2 {
  font-size: 28px; font-weight: 700; margin-bottom: 8px; color: var(--text);
}
.features-subtitle {
  color: var(--text-muted); font-size: 15px; margin-bottom: 48px;
}
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 32px;
}
.feature-card {
  text-align: center; padding: 24px 16px;
  border-radius: var(--radius-lg);
  transition: var(--transition);
}
.feature-card:hover { background: #f4f5f7; }
.feature-icon {
  width: 56px; height: 56px;
  background: var(--primary);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  margin: 0 auto 16px;
  color: #fff; font-size: 22px;
}
.feature-card h3 { font-size: 16px; font-weight: 700; margin-bottom: 8px; }
.feature-card p  { font-size: 13px; color: var(--text-muted); line-height: 1.6; }

.landing-footer {
  background: #f4f5f7;
  padding: 24px;
  text-align: center;
  color: var(--text-muted);
  font-size: 12px;
}

/* ═══════════════════════════════════════════════════════
   AUTH FORMS
═══════════════════════════════════════════════════════ */
.auth-page {
  min-height: 100vh;
  background: linear-gradient(135deg, #0079bf 0%, #026aa7 100%);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.auth-card {
  background: #fff;
  border-radius: var(--radius-lg);
  padding: 40px 36px;
  width: 100%; max-width: 400px;
  box-shadow: var(--shadow-lg);
}
.auth-logo {
  text-align: center; margin-bottom: 28px;
  font-size: 22px; font-weight: 800;
  color: var(--primary);
}
.auth-logo i { margin-right: 6px; }
.auth-card h2 {
  font-size: 20px; font-weight: 700; margin-bottom: 24px;
  text-align: center; color: var(--text);
}
.form-group { margin-bottom: 16px; }
.form-group label {
  display: block; font-size: 12px; font-weight: 600;
  color: var(--text-muted); text-transform: uppercase;
  letter-spacing: .5px; margin-bottom: 6px;
}
.form-control {
  display: block; width: 100%;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px;
  transition: var(--transition);
  background: #fff;
}
.form-control:focus {
  outline: none; border-color: var(--primary-light);
  box-shadow: 0 0 0 3px rgba(76,154,255,.25);
}
.form-control.error { border-color: var(--danger); }
.form-error {
  font-size: 12px; color: var(--danger);
  margin-top: 4px; display: block;
}
.btn-primary {
  display: block; width: 100%;
  padding: 11px;
  background: var(--primary);
  color: #fff; font-weight: 700; font-size: 14px;
  border-radius: var(--radius);
  transition: var(--transition);
  text-align: center;
}
.btn-primary:hover  { background: var(--primary-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-primary:disabled { opacity: .6; cursor: not-allowed; }
.btn-danger {
  display: block; width: 100%;
  padding: 11px;
  background: #dc2626;
  color: #fff; font-weight: 700; font-size: 14px;
  border-radius: var(--radius);
  border: none; cursor: pointer;
  transition: var(--transition);
  text-align: center;
}
.btn-danger:hover  { background: #b91c1c; }
.btn-danger:active { transform: scale(.98); }
.btn-danger:disabled { opacity: .6; cursor: not-allowed; }
.auth-links {
  text-align: center; margin-top: 20px; font-size: 13px; color: var(--text-muted);
}
.auth-links a { color: var(--primary); font-weight: 600; }
.auth-back-link {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 20px;
  cursor: pointer;
}
.auth-back-link:hover { color: var(--primary); }
.auth-lang-picker {
  display: flex; justify-content: center; gap: 6px;
  flex-wrap: wrap;
  margin-top: 24px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.auth-lang-btn {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px;
  border: 1px solid var(--border);
  border-radius: 20px;
  background: transparent;
  color: var(--text-muted);
  font-size: 12px; font-weight: 500;
  cursor: pointer;
  transition: border-color .15s, color .15s, background .15s;
}
.auth-lang-btn:hover { border-color: var(--primary); color: var(--primary); }
.auth-lang-btn.active { border-color: var(--primary); background: var(--primary); color: #fff; }
.auth-lang-btn img { vertical-align: middle; border-radius: 2px; }
.alert {
  padding: 12px 14px;
  border-radius: var(--radius);
  font-size: 13px; line-height: 1.5;
  margin-bottom: 16px;
}
.alert-success { background: #e3f9e5; color: #1d7a3d; border: 1px solid #b7e4c7; }
.alert-error   { background: #ffebe6; color: var(--danger-dark); border: 1px solid #ffbdad; }
.alert-info    { background: #e8f0fe; color: var(--primary-dark); border: 1px solid #c8d7f5; }

/* ═══════════════════════════════════════════════════════
   APP SHELL (post-login)
═══════════════════════════════════════════════════════ */
.app-shell {
  display: flex; flex-direction: column;
  height: 100vh; overflow: hidden;
}

/* Top nav */
.app-nav {
  height: var(--nav-height);
  background: var(--nav-bg);
  display: flex; align-items: center;
  padding: 0 12px; gap: 8px;
  flex-shrink: 0;
  z-index: 100;
}
.app-nav-logo {
  font-weight: 800; font-size: 17px;
  color: #fff; padding: 4px 8px;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.app-nav-logo:hover { background: rgba(255,255,255,.15); }
.app-nav-logo i { margin-right: 5px; }
.nav-spacer { flex: 1; }

/* Nav search button */
.btn-nav-search {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 12px; border-radius: var(--radius);
  background: rgba(255,255,255,.14); color: rgba(255,255,255,.88);
  font-size: 13px; font-weight: 500; cursor: pointer;
  transition: var(--transition); white-space: nowrap;
  border: 1px solid rgba(255,255,255,.18);
}
.btn-nav-search:hover { background: rgba(255,255,255,.24); color: #fff; }
.nav-search-label { display: none; }
@media (min-width: 700px) { .nav-search-label { display: inline; } }
.nav-search-kbd {
  font-size: 10px; padding: 1px 5px;
  background: rgba(0,0,0,.25); border-radius: 4px; color: rgba(255,255,255,.7);
  font-family: inherit; display: none;
}
@media (min-width: 900px) { .nav-search-kbd { display: inline; } }

.nav-user {
  display: flex; align-items: center; gap: 8px;
  color: rgba(255,255,255,.9);
}
.nav-avatar {
  width: 32px; height: 32px;
  background: rgba(255,255,255,.3);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; color: #fff;
  flex-shrink: 0;
}
.nav-username { font-size: 13px; font-weight: 600; color: rgba(255,255,255,.9); }
.btn-nav {
  padding: 6px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.85);
  font-size: 13px; font-weight: 500;
  background: rgba(255,255,255,.12);
  transition: var(--transition);
}
.btn-nav:hover { background: rgba(255,255,255,.22); color: #fff; }

/* App body */
.app-body {
  display: flex; flex: 1; overflow: hidden;
}

/* Sidebar */
.app-sidebar {
  width: 220px; flex-shrink: 0;
  background: var(--sidebar-bg);
  display: flex; flex-direction: column;
  overflow-y: auto;
  transition: var(--transition);
}
.sidebar-section { padding: 12px 8px 4px; }
.sidebar-label {
  font-size: 11px; font-weight: 700;
  color: rgba(255,255,255,.6);
  text-transform: uppercase; letter-spacing: .8px;
  padding: 4px 8px; margin-bottom: 4px;
}
.sidebar-link {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-radius: var(--radius);
  color: rgba(255,255,255,.85);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.sidebar-link:hover, .sidebar-link.active {
  background: rgba(255,255,255,.2);
  color: #fff;
}
.sidebar-link i { width: 16px; text-align: center; flex-shrink: 0; }
.sidebar-badge {
  margin-left: auto;
  background: var(--danger);
  color: #fff;
  font-size: 10px; font-weight: 700;
  min-width: 18px; height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* Main content */
.app-main {
  flex: 1; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column;
}
/* Board view manages its own scroll — prevent double scrollbar */
.app-main:has(.board-wrapper) {
  overflow: hidden;
}

/* ═══════════════════════════════════════════════════════
   BOARD
═══════════════════════════════════════════════════════ */
.board-wrapper {
  flex: 1;
  min-width: 0;
  background: var(--board-bg);
  overflow-x: auto; overflow-y: hidden;
  padding: 12px;
}
.board {
  display: flex; align-items: flex-start;
  gap: 12px;
  height: 100%; min-height: 100%;
  width: max-content;
  padding-bottom: 8px;
}

/* List column */
.list-col {
  width: var(--list-width);
  background: var(--list-bg);
  border-radius: var(--radius-lg);
  display: flex; flex-direction: column;
  max-height: calc(100vh - var(--nav-height) - 36px);
  flex-shrink: 0;
}
.list-col.drag-over { outline: 2px solid rgba(255,255,255,.6); }

.list-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 12px 8px;
  flex-shrink: 0;
  cursor: grab;
  user-select: none;
  /* Belt-and-suspenders against horizontal overflow inside the fixed-width
     column. Combined with min-width:0 on .list-title (which lets the input
     shrink below its intrinsic content width), this keeps the right-hand
     buttons (collapse, "…" menu) inside the column even when the title is
     long and the WIP badge is shown. */
  overflow: hidden;
}
.list-header:active { cursor: grabbing; }
/* restore normal cursors for interactive children */
.list-header input,
.list-header textarea { cursor: text; user-select: text; }
.list-header button   { cursor: pointer; }

/* Faded appearance while a list is being dragged */
.list-col.list-dragging { opacity: .45; }

.list-title {
  font-weight: 700; font-size: 14px;
  color: var(--text);
  flex: 1;
  /* Critical: <input> elements default to min-width: auto in a flex
     container, which means they refuse to shrink below their intrinsic
     text width. Without min-width:0, a long list title pushes the WIP
     badge, collapse button and "…" menu out past the column edge — and
     the menu was the visible casualty when WIP was set. */
  min-width: 0;
  background: none; border: none;
  border-radius: 4px;
  padding: 2px 4px;
  cursor: pointer;
  text-overflow: ellipsis;
}
.list-title:focus {
  outline: none; background: #fff;
  box-shadow: 0 0 0 2px var(--primary-light);
}
/* List count badge */
.list-count {
  font-size: 11px; font-weight: 600;
  color: var(--text-muted);
  background: rgba(9,30,66,.08);
  padding: 1px 6px; border-radius: 10px;
  flex-shrink: 0; margin-right: 2px;
  line-height: 18px;
}

/* Collapse button */
.list-collapse-btn {
  width: 26px; height: 26px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); font-size: 11px;
  color: var(--text-muted); background: none;
  transition: var(--transition); flex-shrink: 0;
}
.list-collapse-btn:hover { background: rgba(9,30,66,.1); color: var(--text); }

/* Collapsed list: hide cards and footer, shrink the column */
.list-col.list-collapsed .list-cards,
.list-col.list-collapsed .list-footer { display: none; }
.list-col.list-collapsed { min-height: 0; }
.list-col.list-collapsed .list-count { background: rgba(9,30,66,.14); }

.list-menu-btn {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: var(--text-muted); font-size: 16px;
  transition: var(--transition); flex-shrink: 0;
}
.list-menu-btn:hover { background: rgba(9,30,66,.1); color: var(--text); }

.list-cards {
  overflow-y: auto; overflow-x: hidden;
  flex: 1; padding: 0 6px;
  min-height: 4px;
}

/* Todo card */
.todo-card {
  background: var(--card-bg);
  border-radius: var(--radius);
  padding: 10px 12px;
  margin-bottom: 8px;
  box-shadow: 0 1px 3px rgba(0,0,0,.10), 0 1px 2px rgba(0,0,0,.06);
  cursor: pointer;
  transition: box-shadow .18s ease, transform .18s ease, border-color .18s ease;
  border: 1px solid rgba(0,0,0,.07);
  position: relative;
}
.todo-card:hover {
  box-shadow: 0 4px 14px rgba(0,0,0,.13), 0 2px 4px rgba(0,0,0,.07);
  transform: translateY(-2px);
  border-color: rgba(0,82,204,.18);
}
.todo-card.card-focused {
  outline: 2px solid var(--primary);
  outline-offset: 1px;
  box-shadow: 0 4px 14px rgba(0,0,0,.13);
}

/* ── Priority left-border stripe ──────────────────── */
.todo-card.prio-urgent { border-left: 3px solid #de350b; }
.todo-card.prio-high   { border-left: 3px solid #e07e00; }
.todo-card.prio-normal { border-left: 3px solid #0052cc; }
.todo-card.prio-low    { border-left: 3px solid #97a0af; }
.todo-card.prio-urgent,
.todo-card.prio-high,
.todo-card.prio-normal,
.todo-card.prio-low    { padding-left: 11px; }
.todo-card.dragging {
  opacity: .4;
  cursor: grabbing;
  box-shadow: none;
  transform: none;
}
.todo-card { cursor: grab; }
.list-col.drag-over { outline: 2px solid rgba(255,255,255,.7); outline-offset: -2px; }
[data-role="drop-placeholder"] {
  border: 2px dashed var(--primary-light);
  border-radius: var(--radius);
  background: rgba(76,154,255,.12);
  margin-bottom: 8px;
  pointer-events: none;
  animation: phPulse 1s ease infinite alternate;
}
@keyframes phPulse {
  from { background: rgba(76,154,255,.08); }
  to   { background: rgba(76,154,255,.2); }
}
.todo-card.completed .card-title {
  text-decoration: line-through; color: var(--text-muted);
}

.card-labels { display: flex; gap: 4px; margin-bottom: 6px; flex-wrap: wrap; }
.card-label {
  height: 8px; border-radius: 4px;
  min-width: 40px;
}
.card-title {
  font-size: 14px; line-height: 1.4;
  color: var(--text); margin-bottom: 6px;
}
.card-meta {
  display: flex; align-items: center; justify-content: space-between;
  flex-wrap: wrap; gap: 4px;
}
.card-badges { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.card-badge {
  display: flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
  padding: 2px 5px;
  border-radius: var(--radius);
}
.card-badge.overdue { color: var(--danger); background: #ffebe6; }
.card-badge.due-soon { color: var(--warning); background: #fff8e1; }
.card-badge.done { color: var(--success); }
.card-badge i { font-size: 10px; }

.card-assignees { display: flex; gap: 2px; }
.assignee-avatar {
  width: 24px; height: 24px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  margin-left: -6px;
  flex-shrink: 0;
}
.assignee-avatar:first-child { margin-left: 0; }

/* Add card / list buttons */
.list-footer { padding: 6px 8px 8px; flex-shrink: 0; }
.btn-add-card {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-muted); font-size: 13px;
  transition: var(--transition);
}
.btn-add-card:hover { background: rgba(9,30,66,.1); color: var(--text); }

.add-card-form { padding: 4px 6px 6px; display: none; }
.add-card-form.visible { display: block; }
.add-card-input {
  width: 100%; padding: 8px 10px;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  font-size: 14px; resize: none;
  outline: none;
  min-height: 60px;
}
.add-card-actions {
  display: flex; align-items: center; gap: 6px; margin-top: 6px;
}
.btn-sm-primary {
  padding: 6px 12px;
  background: var(--primary); color: #fff;
  font-size: 13px; font-weight: 600;
  border-radius: var(--radius);
  transition: var(--transition);
}
.btn-sm-primary:hover { background: var(--primary-dark); }
.btn-icon-close {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 18px; color: var(--text-muted);
  transition: var(--transition);
}
.btn-icon-close:hover { background: rgba(9,30,66,.1); color: var(--text); }

/* Add list */
.add-list-col {
  width: var(--list-width); flex-shrink: 0;
}
.btn-add-list {
  display: flex; align-items: center; gap: 8px;
  width: 100%; padding: 10px 14px;
  background: var(--list-bg);
  border-radius: var(--radius-lg);
  color: var(--text-muted); font-size: 14px; font-weight: 500;
  transition: var(--transition);
}
.btn-add-list:hover { background: #d6d8dc; color: var(--text); }

.add-list-form {
  background: var(--list-bg);
  border-radius: var(--radius-lg);
  padding: 10px 10px 8px;
  display: none;
}
.add-list-form.visible { display: block; }
.add-list-input {
  width: 100%; padding: 8px 10px;
  border: 2px solid var(--primary-light);
  border-radius: var(--radius);
  font-size: 14px; outline: none;
  margin-bottom: 8px;
}
.add-list-actions { display: flex; align-items: center; gap: 6px; }

/* Board header */
.board-header {
  padding: 8px 16px;
  display: flex; align-items: center; gap: 12px;
  flex-shrink: 0;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}
.board-title {
  font-size: 18px; font-weight: 700;
  color: var(--text);
}

/* ── Filter Bar ─────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 16px;
  background: #fff; border-bottom: 1px solid var(--border);
  flex-shrink: 0; flex-wrap: wrap;
}
.filter-bar-icon { color: var(--text-muted); font-size: 12px; flex-shrink: 0; }
.filter-select {
  font-size: 12px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--list-bg); color: var(--text);
  cursor: pointer;
}
.filter-select:focus { outline: none; border-color: var(--primary-light); }
.filter-clear-btn {
  display: flex; align-items: center; gap: 4px;
  font-size: 12px; font-weight: 600;
  padding: 4px 10px; border-radius: var(--radius);
  background: var(--primary); color: #fff;
  cursor: pointer;
}
.filter-clear-btn:hover { background: var(--primary-dark, #0056a3); }

/* ── View Switcher ─────────────────────────────────── */
.view-switcher {
  margin-left: auto;
  display: flex; gap: 2px;
  background: var(--list-bg);
  border-radius: var(--radius-lg);
  padding: 3px;
}
.view-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 5px 10px; border-radius: var(--radius);
  font-size: 12px; font-weight: 600;
  color: var(--text-muted);
  transition: var(--transition);
  white-space: nowrap;
}
.view-btn:hover  { background: rgba(0,0,0,.06); color: var(--text); }
.view-btn.active { background: var(--primary);  color: #fff; }
.view-btn-lbl { display: none; }
@media (min-width: 860px) { .view-btn-lbl { display: inline; } }

/* ═══════════════════════════════════════════════════════
   TODO DETAIL MODAL
═══════════════════════════════════════════════════════ */
.todo-modal {
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.todo-modal-header {
  background: #fff;
  padding: 20px 20px 16px;
  border-bottom: 1px solid var(--border);
  display: flex; align-items: flex-start; gap: 12px;
}
.todo-modal-header-icon {
  color: var(--text-muted); margin-top: 4px; flex-shrink: 0;
}
.todo-modal-header-body { flex: 1; min-width: 0; }
.todo-title-input {
  font-size: 18px; font-weight: 700; color: var(--text);
  width: 100%; background: none;
  border: 2px solid transparent;
  border-radius: var(--radius);
  padding: 4px 6px; line-height: 1.3;
  transition: var(--transition);
  resize: none; overflow: hidden;
}
.todo-title-input:hover { border-color: var(--border); }
.todo-title-input:focus { outline: none; border-color: var(--primary-light); background: #fff; }
.todo-list-breadcrumb {
  font-size: 12px; color: var(--text-muted); margin-top: 4px; padding-left: 6px;
}
.todo-list-breadcrumb a { color: var(--text-muted); font-weight: 600; text-decoration: underline; cursor: pointer; }
.btn-modal-close {
  width: 32px; height: 32px; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  font-size: 18px; color: var(--text-muted);
  transition: var(--transition);
}
.btn-modal-close:hover { background: var(--border); color: var(--text); }

/* Inline header meta row (members + customer pinned at top of card) */
.todo-header-meta {
  display: flex; flex-wrap: wrap; gap: 14px;
  margin-top: 10px; padding-left: 6px;
}
.todo-header-meta-group {
  display: flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--text-muted);
  cursor: pointer;
}
.todo-header-meta-group .header-meta-icon {
  color: var(--text-light); font-size: 11px;
}
.header-members-row {
  display: flex; align-items: center; gap: -4px;
}
.header-members-row .header-member-avatar {
  margin-left: -6px; width: 24px; height: 24px;
  border: 2px solid #fff; box-sizing: border-box;
  cursor: pointer;
}
.header-members-row .header-member-avatar:first-child { margin-left: 0; }
.header-members-row .header-members-empty {
  font-size: 12px; color: var(--text-light); font-style: italic;
}
.header-add-btn {
  width: 22px; height: 22px; border-radius: 50%;
  border: 1px dashed var(--border); background: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; color: var(--text-muted); cursor: pointer;
  margin-left: 4px; transition: var(--transition);
}
.header-add-btn:hover { color: var(--primary); border-color: var(--primary-light); }
.header-customer-row { display: flex; align-items: center; }
.header-customer-row .header-customer-empty {
  font-size: 12px; color: var(--text-light); font-style: italic;
}

.todo-modal-body {
  display: flex; gap: 0;
  min-height: 300px;
}
.todo-modal-footer {
  padding: 16px 20px 20px;
  background: #f4f5f7;
  border-top: 1px solid var(--border);
}
.todo-modal-main {
  flex: 1; padding: 20px;
  overflow-y: auto;
  border-right: 1px solid var(--border);
  background: #f4f5f7;
}
.todo-modal-sidebar {
  width: 200px; flex-shrink: 0;
  padding: 16px 12px;
  background: #f4f5f7;
}

.modal-section { margin-bottom: 24px; }
.modal-section-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 10px;
}
.modal-section-title i { color: var(--text-light); }

/* Description */
.description-area {
  width: 100%; min-height: 80px;
  padding: 10px 12px;
  border: 2px solid transparent;
  border-radius: var(--radius);
  background: rgba(9,30,66,.05);
  font-size: 14px; line-height: 1.6;
  resize: vertical;
  transition: var(--transition);
  color: var(--text);
}
.description-area:hover { background: rgba(9,30,66,.08); }
.description-area:focus { outline: none; border-color: var(--primary-light); background: #fff; }
.description-area.desc-drop-target {
  border-color: var(--primary); background: rgba(0, 82, 204, .08);
}

/* Inline images embedded in the description preview (Markdown ![](...) ).
   Constrain so a pasted screenshot never blows out the modal width. */
.desc-preview-area.markdown-body img,
.markdown-body img {
  max-width: 100%; height: auto; border-radius: var(--radius);
  margin: 6px 0; display: block;
}

/* Shared card view (/share/card/:token) — standalone read-only page */
.shared-card-page {
  min-height: 100vh; background: #f4f5f7;
  padding: 32px 16px;
}
.shared-card-frame {
  max-width: 760px; margin: 0 auto;
  background: #fff; border-radius: 8px;
  box-shadow: 0 4px 24px rgba(9,30,66,.12);
  overflow: hidden;
}
.shared-card-loading,
.shared-card-error {
  padding: 80px 32px; text-align: center;
}
.shared-card-banner {
  background: #eff6ff; color: #1d4ed8;
  border-bottom: 1px solid #bfdbfe;
  padding: 12px 20px; font-size: 13px;
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
}
.shared-card-banner-link { margin-left: auto; color: #1d4ed8; font-weight: 600; cursor: pointer; }
.shared-card-summary {
  padding: 32px 24px; text-align: center;
}
.shared-card-summary-icon { color: var(--text-muted); margin-bottom: 8px; }
.shared-card-cta-row {
  display: flex; gap: 12px; justify-content: center; margin-top: 20px; flex-wrap: wrap;
}
.shared-card-message {
  background: #f4f5f7; border-left: 3px solid var(--primary);
  padding: 10px 14px; margin: 16px 0; color: #333;
  font-style: italic; border-radius: 4px;
}
.shared-card-body { padding: 24px; }
.shared-card-title {
  font-size: 22px; font-weight: 700; color: var(--text);
  margin: 0 0 16px;
}
.shared-meta-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 16px; }
.shared-meta-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--text-muted); flex-wrap: wrap;
}
.shared-meta-row i { color: var(--text-light); }
.shared-section-title {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  margin: 24px 0 10px;
  display: flex; align-items: center; gap: 8px;
}

/* Share-card sub-dialog (sits above the card modal) */
.share-dialog-overlay {
  position: fixed; inset: 0; background: rgba(9,30,66,.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 9999; padding: 20px;
}
.share-dialog {
  background: #fff; border-radius: 8px;
  width: 100%; max-width: 480px;
  padding: 20px; box-shadow: 0 10px 40px rgba(0,0,0,.3);
  max-height: 90vh; overflow-y: auto;
}
.share-dialog-header {
  display: flex; justify-content: space-between; align-items: center;
  border-bottom: 1px solid var(--border); padding-bottom: 12px; margin-bottom: 12px;
}
.share-dialog-header h3 { margin: 0; font-size: 16px; color: var(--text); display: flex; align-items: center; gap: 8px; }
.share-dialog-card-name {
  font-weight: 600; color: var(--text); margin: 0 0 6px;
}
.share-dialog-help {
  font-size: 13px; color: var(--text-muted); margin: 0 0 14px; line-height: 1.5;
}
.share-dialog-form label {
  font-size: 12px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  display: block; margin-bottom: 4px;
}
.share-dialog-optional {
  font-weight: 500; text-transform: none; letter-spacing: 0;
  color: var(--text-light); margin-left: 4px;
}
.share-dialog-actions { flex-wrap: wrap; }
.share-dialog-suggest {
  margin-top: 4px; max-height: 180px; overflow-y: auto;
  border: 1px solid var(--border); border-radius: var(--radius);
  display: flex; flex-direction: column;
}
.share-dialog-suggest:empty { display: none; }
.share-suggest-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 10px; cursor: pointer;
}
.share-suggest-item:hover { background: var(--bg); }
.share-dialog-actions {
  display: flex; gap: 8px; justify-content: flex-end; margin-top: 16px;
}
.share-link-row {
  display: flex; gap: 8px; margin: 8px 0 16px;
}
.share-link-row input { flex: 1; min-width: 0; font-family: monospace; font-size: 12px; }

/* Checklist */
.checklist-progress {
  background: var(--border);
  border-radius: 99px; height: 8px; margin-bottom: 10px;
  overflow: hidden;
}
.checklist-bar {
  height: 100%; background: var(--success);
  border-radius: 99px;
  transition: width .3s ease;
}
.checklist-item {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 0;
  border-radius: var(--radius);
  transition: var(--transition);
}
.checklist-item:hover .checklist-item-delete { opacity: 1; }
.checklist-checkbox {
  width: 16px; height: 16px;
  flex-shrink: 0; cursor: pointer;
  accent-color: var(--primary);
}
.checklist-text {
  flex: 1; min-width: 0; background: none;
  border: 1px solid transparent;
  border-radius: 3px; padding: 2px 4px;
  font-size: 14px; color: var(--text);
}
.checklist-text:focus { outline: none; border-color: var(--primary-light); background: #fff; }
.checklist-text.checked { text-decoration: line-through; color: var(--text-muted); }
.checklist-item-delete {
  opacity: 0; width: 24px; height: 24px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); color: var(--text-muted);
  font-size: 14px; transition: var(--transition);
}
.checklist-item-delete:hover { background: var(--border); color: var(--danger); }
.add-checklist-btn {
  margin-top: 8px; padding: 7px 12px;
  background: rgba(9,30,66,.08);
  border-radius: var(--radius);
  font-size: 13px; color: var(--text-muted);
  transition: var(--transition); display: inline-flex; align-items: center; gap: 6px;
}
.add-checklist-btn:hover { background: rgba(9,30,66,.14); color: var(--text); }

/* Comments */
.comment-item {
  display: flex; gap: 10px; margin-bottom: 16px;
}
.comment-avatar {
  width: 30px; height: 30px;
  border-radius: 50%;
  background: var(--primary);
  color: #fff; font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.comment-body { flex: 1; }
.comment-meta {
  font-size: 12px; color: var(--text-muted);
  margin-bottom: 4px;
}
.comment-meta strong { color: var(--text); font-weight: 600; }
.comment-text {
  font-size: 13px; line-height: 1.5;
  background: rgba(9,30,66,.05);
  padding: 8px 10px;
  border-radius: 0 var(--radius-lg) var(--radius-lg) var(--radius-lg);
}
.comment-delete {
  font-size: 11px; color: var(--text-muted);
  cursor: pointer; margin-top: 4px; display: inline-block;
}
.comment-delete:hover { color: var(--danger); text-decoration: underline; }
.comment-input-wrap {
  display: flex; gap: 10px; margin-top: 8px;
}
.comment-input {
  flex: 1; min-width: 0; padding: 9px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  font-size: 13px; resize: none; outline: none;
  transition: var(--transition);
  min-height: 40px;
}
.comment-input:focus { border-color: var(--primary-light); }
.comment-input-full {
  width: 100%; box-sizing: border-box;
  resize: vertical; min-height: 72px;
}

/* Modal sidebar sections */
.modal-sb-section { margin-bottom: 16px; }
.modal-sb-label {
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 6px;
}
.modal-sb-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  background: rgba(9,30,66,.08);
  border-radius: var(--radius);
  font-size: 13px; color: var(--text);
  transition: var(--transition); text-align: left;
}
.modal-sb-btn:hover { background: rgba(9,30,66,.14); }
.modal-sb-btn i { color: var(--text-muted); font-size: 12px; }
.modal-sb-value { font-size: 13px; color: var(--text-muted); }
.modal-sb-input {
  width: 100%; padding: 7px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; outline: none;
  transition: var(--transition); background: #fff;
}
.modal-sb-input:focus { border-color: var(--primary-light); }
.modal-sb-select {
  width: 100%; padding: 7px 10px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; outline: none;
  background: #fff; cursor: pointer;
}
.recurring-options { margin-top: 8px; }
.recurring-row { display: flex; gap: 6px; margin-top: 6px; }
.recurring-row input[type="number"] {
  width: 60px; padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; outline: none;
}
.recurring-row input[type="number"]:focus { border-color: var(--primary-light); }
.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 8px;
}
.toggle-label { font-size: 13px; color: var(--text); }

/* Member chips */
.members-list { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 8px; }
.member-chip {
  display: flex; align-items: center; gap: 4px;
  padding: 3px 8px 3px 4px;
  background: var(--primary);
  border-radius: 99px; color: #fff; font-size: 12px;
}
.member-chip .mini-avatar {
  width: 20px; height: 20px; border-radius: 50%;
  background: rgba(255,255,255,.3);
  display: flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700;
}
.member-chip-remove {
  cursor: pointer; opacity: .7;
  font-size: 13px; margin-left: 2px;
}
.member-chip-remove:hover { opacity: 1; }
.member-search-input {
  width: 100%; padding: 6px 8px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; outline: none; margin-bottom: 4px;
}
.member-search-input:focus { border-color: var(--primary-light); }
.member-results {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
  display: none;
}
.member-results.visible { display: block; }
.member-result-item {
  padding: 7px 10px; cursor: pointer;
  font-size: 13px; transition: var(--transition);
  display: flex; align-items: center; gap: 8px;
}
.member-result-item:hover { background: var(--list-bg); }

/* Move card picker */
.move-picker { display: flex; flex-direction: column; }
.move-picker-label { font-size: 11px; font-weight: 600; color: #888; text-transform: uppercase; letter-spacing: .05em; margin-bottom: 3px; }
.move-select {
  width: 100%; padding: 7px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px; background: #fff;
  outline: none; cursor: pointer;
  transition: border-color .15s;
}
.move-select:focus { border-color: var(--primary); }
.move-new-list-btn {
  display: flex; align-items: center; gap: 5px;
  width: 100%; margin-top: 5px; padding: 5px 8px;
  background: none; border: 1px dashed var(--border);
  border-radius: var(--radius); font-size: 12px;
  color: var(--primary); cursor: pointer; transition: var(--transition);
}
.move-new-list-btn:hover { background: rgba(0,82,204,.07); border-color: var(--primary); }
.move-new-list-input {
  width: 100%; padding: 7px 10px; box-sizing: border-box;
  border: 2px solid var(--primary-light); border-radius: var(--radius);
  font-size: 13px; outline: none; transition: border-color .15s;
  background: #fff; color: var(--text);
}
.move-new-list-input:focus { border-color: var(--primary); }
.btn-archive-sm {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  color: var(--text-muted); background: transparent;
  border: 1px solid var(--border);
  transition: var(--transition);
}
.btn-archive-sm:hover { background: rgba(0,0,0,.06); color: var(--text); }
.btn-danger-sm {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: 7px 10px;
  background: rgba(235,90,70,.1);
  border-radius: var(--radius);
  font-size: 13px; color: var(--danger);
  transition: var(--transition);
}
.btn-danger-sm:hover { background: rgba(235,90,70,.2); }

/* ═══════════════════════════════════════════════════════
   ASSIGNED TO ME / CONTACTS views
═══════════════════════════════════════════════════════ */
.view-wrapper {
  flex: 1; overflow-y: auto;
  padding: 24px;
  background: #f4f5f7;
}
.view-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 24px;
}
.view-header h2 { font-size: 20px; font-weight: 700; }
.view-header p { font-size: 13px; color: var(--text-muted); margin-top: 2px; }

/* Assigned todos list */
.assigned-group { margin-bottom: 32px; }
.assigned-group h3 {
  font-size: 13px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  margin-bottom: 12px; padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.assigned-card {
  background: #fff; border-radius: var(--radius-lg);
  padding: 14px 16px; margin-bottom: 10px;
  box-shadow: var(--shadow-sm); cursor: pointer;
  transition: var(--transition);
  border-left: 4px solid var(--primary);
}
.assigned-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.assigned-card.overdue { border-left-color: var(--danger); }
.assigned-card.completed { border-left-color: var(--success); opacity: .7; }
.assigned-card h4 { font-size: 15px; font-weight: 600; margin-bottom: 4px; }
.assigned-card .meta { font-size: 12px; color: var(--text-muted); display: flex; gap: 12px; flex-wrap: wrap; }
.assigned-card .meta span { display: flex; align-items: center; gap: 4px; }
.empty-state {
  text-align: center; padding: 48px 24px;
  color: var(--text-muted);
}
.empty-state i { font-size: 48px; opacity: .3; margin-bottom: 16px; display: block; }
.empty-state p { font-size: 15px; }

/* Contacts */
.search-bar {
  display: flex; gap: 8px; margin-bottom: 20px;
}
.search-input {
  flex: 1; padding: 10px 14px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  font-size: 14px; outline: none;
  transition: var(--transition);
}
.search-input:focus { border-color: var(--primary-light); }
.search-results {
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow); margin-bottom: 16px;
  display: none;
}
.search-results.visible { display: block; }
.search-result-item {
  padding: 12px 16px; cursor: pointer;
  display: flex; align-items: center; justify-content: space-between;
  border-bottom: 1px solid var(--border);
  transition: var(--transition);
}
.search-result-item:last-child { border-bottom: none; }
.search-result-item:hover { background: var(--list-bg); }
.result-info h4 { font-size: 14px; font-weight: 600; }
.result-info p  { font-size: 12px; color: var(--text-muted); }

.contacts-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.contact-card {
  background: #fff; border-radius: var(--radius-lg);
  padding: 16px; box-shadow: var(--shadow-sm);
  display: flex; align-items: center; gap: 14px;
  transition: var(--transition);
}
.contact-card:hover { box-shadow: var(--shadow); }
.contact-avatar {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 17px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.contact-info { flex: 1; min-width: 0; }
.contact-info h4 { font-size: 14px; font-weight: 700; }
.contact-info p  { font-size: 12px; color: var(--text-muted); }
.contact-remove {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius); color: var(--text-light); font-size: 14px;
  transition: var(--transition);
}
.contact-remove:hover { background: #ffebe6; color: var(--danger); }

/* ═══════════════════════════════════════════════════════
   LIST CONTEXT MENU
═══════════════════════════════════════════════════════ */
/* ═══════════════════════════════════════════════════════
   COLOR PICKER
═══════════════════════════════════════════════════════ */
.color-picker-row {
  display: flex; flex-wrap: wrap; gap: 5px;
  padding: 4px 10px 10px;
}
.cp-swatch {
  width: 24px; height: 24px; border-radius: 50%;
  cursor: pointer; flex-shrink: 0;
  border: 3px solid transparent;
  transition: transform .12s ease, border-color .12s ease;
  display: flex; align-items: center; justify-content: center;
}
.cp-swatch:hover { transform: scale(1.18); }
.cp-swatch.cp-active { border-color: rgba(0,0,0,.45); }
.cp-none { background: #e0e0e0; font-size: 11px; color: var(--text-muted); }
.cp-none.cp-active { border-color: var(--text-muted); }

/* Bigger swatches in the modal sidebar */
.todo-modal-sidebar .color-picker-row { padding: 2px 0 6px; gap: 6px; }
.todo-modal-sidebar .cp-swatch { width: 22px; height: 22px; }

/* Color-section header inside context menus */
.cm-color-label {
  padding: 8px 14px 2px;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  display: flex; align-items: center; gap: 6px;
}

/* Full-color list column — cards keep their own white background.
   --list-text / --list-text-muted / --list-btn-hover are set inline by JS
   based on perceived luminance of the chosen color. */
.list-colored .list-title              { color: var(--list-text); }
.list-colored .list-title::placeholder { color: var(--list-text-muted); }
.list-colored .list-title:focus        { background: var(--list-btn-hover); color: var(--list-text); box-shadow: 0 0 0 2px var(--list-text-muted); }
.list-colored .list-menu-btn           { color: var(--list-text-muted); }
.list-colored .list-menu-btn:hover     { background: var(--list-btn-hover); color: var(--list-text); }
.list-colored .list-count              { background: rgba(0,0,0,.15); color: var(--list-text); }
.list-colored .list-collapse-btn       { color: var(--list-text-muted); }
.list-colored .list-collapse-btn:hover { background: var(--list-btn-hover); color: var(--list-text); }
.list-colored .btn-add-card            { color: var(--list-text-muted); }
.list-colored .btn-add-card:hover      { background: var(--list-btn-hover); color: var(--list-text); }

/* Card left-border: add a touch more left padding so text doesn't hug the stripe */
.todo-card[style*="border-left"] { padding-left: 10px; }

.context-menu {
  position: fixed; z-index: 500;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  min-width: 200px; overflow: hidden;
  padding: 6px 0;
}
.context-menu-item {
  padding: 8px 16px;
  font-size: 13px; cursor: pointer;
  transition: var(--transition);
  display: flex; align-items: center; gap: 8px; color: var(--text);
}
.context-menu-item:hover { background: var(--list-bg); }
.context-menu-item.danger { color: var(--danger); }
.context-menu-item.danger:hover { background: #ffebe6; }
.context-menu-divider { height: 1px; background: var(--border); margin: 4px 0; }

/* ═══════════════════════════════════════════════════════
   SCROLLBAR
═══════════════════════════════════════════════════════ */
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(9,30,66,.2); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: rgba(9,30,66,.35); }

/* ═══════════════════════════════════════════════════════
   TABLE VIEW
═══════════════════════════════════════════════════════ */
.table-view {
  flex: 1; overflow: auto;
  padding: 16px; background: #f4f5f7;
}
.todo-table {
  width: 100%; border-collapse: collapse;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.todo-table thead th {
  background: var(--list-bg);
  padding: 10px 14px; text-align: left;
  font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase; letter-spacing: .5px;
  border-bottom: 2px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; z-index: 2;
}
.todo-table th.tbl-sortable { cursor: pointer; user-select: none; }
.todo-table th.tbl-sortable:hover { color: var(--text); }
.tbl-sort-icon { margin-left: 4px; font-size: 10px; }
.tbl-sort-dim { color: var(--border); }
.todo-table tbody td {
  padding: 10px 14px; border-bottom: 1px solid var(--border);
  font-size: 13px; vertical-align: middle;
}
.tbl-row { cursor: pointer; transition: background var(--transition); }
.tbl-row:hover { background: #f5f7ff; }
.tbl-row:last-child td { border-bottom: none; }
.tbl-row-done td { opacity: .7; }
.tbl-col-title { max-width: 300px; }
.tbl-title-text { font-weight: 600; }
.tbl-row-done .tbl-title-text { text-decoration: line-through; color: var(--text-muted); }
.tbl-icon-sm { margin-left: 5px; font-size: 11px; color: var(--text-muted); }
.list-pill {
  display: inline-block; padding: 2px 9px;
  background: rgba(76,154,255,.18); color: var(--primary-dark);
  border-radius: 999px; font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.status-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 600;
}
.status-done    { background: #e3fcef; color: #006644; }
.status-active  { background: #e9f0ff; color: var(--primary); }
.status-overdue { background: #ffebe6; color: var(--danger); }
.cell-overdue { color: var(--danger); font-weight: 600; }
.cell-soon    { color: var(--warning); font-weight: 600; }
.cell-done    { color: var(--success); font-weight: 600; }
.text-dim     { color: var(--text-light); }
.assignee-row { display: flex; gap: 4px; flex-wrap: wrap; }
.mini-avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   CALENDAR VIEW
═══════════════════════════════════════════════════════ */
.calendar-view {
  flex: 1; overflow: auto;
  padding: 16px; background: #f4f5f7;
  display: flex; flex-direction: column; gap: 16px;
}
.cal-nav {
  display: flex; align-items: center; gap: 8px;
}
.cal-month {
  font-size: 18px; font-weight: 700; color: var(--text);
  min-width: 200px; text-align: center;
}
.cal-nav-btn {
  height: 32px; min-width: 32px; border-radius: var(--radius);
  background: #fff; border: 1px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  cursor: pointer; font-size: 13px; font-weight: 600;
  color: var(--text-muted); transition: var(--transition);
  padding: 0 8px;
}
.cal-nav-btn:hover { background: var(--list-bg); color: var(--text); border-color: var(--text-muted); }
.cal-grid {
  display: grid; grid-template-columns: repeat(7, 1fr);
  gap: 4px; background: var(--border);
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-sm);
}
.cal-dow {
  background: var(--list-bg);
  text-align: center; font-size: 11px; font-weight: 700;
  color: var(--text-muted); text-transform: uppercase;
  padding: 7px 0;
}
.cal-day {
  min-height: 90px; background: #fff;
  padding: 4px 5px;
  transition: background .15s, box-shadow .15s;
}
.cal-empty { background: #fafafa; }
.cal-today { background: #ebf3ff; }
.cal-today .cal-day-num { color: var(--primary); font-weight: 800; }
.cal-day-num {
  font-size: 12px; font-weight: 600; color: var(--text-muted);
  margin-bottom: 3px;
}

/* Drop-target highlight */
.cal-day-drop-target {
  background: #dbeafe !important;
  box-shadow: inset 0 0 0 2px var(--primary);
}
.cal-day-drop-target .cal-day-num { color: var(--primary); }

.cal-chips  { display: flex; flex-direction: column; gap: 2px; min-height: 20px; }
.cal-drop-zone { transition: background .1s; }

/* Chips */
.cal-chip {
  display: flex; align-items: center; gap: 4px;
  background: var(--primary-light); color: #fff;
  border-radius: 3px; padding: 2px 5px;
  font-size: 11px; font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  cursor: pointer; transition: opacity .15s, transform .1s;
  user-select: none;
}
.cal-chip:hover { opacity: .88; }
.cal-chip.chip-done    { background: var(--success); opacity: .75; }
.cal-chip.chip-overdue { background: var(--danger); }

/* Draggable chips */
.cal-chip-draggable { cursor: grab; }
.cal-chip-draggable:active { cursor: grabbing; }
.cal-chip-dragging  { opacity: .35; transform: scale(.96); }

/* Grip handle icon — hidden by default, visible on hover */
.cal-chip-grip {
  font-size: 9px; opacity: 0; flex-shrink: 0;
  transition: opacity .1s;
}
.cal-chip-draggable:hover .cal-chip-grip { opacity: .6; }

.cal-chip-more {
  font-size: 10px; color: var(--text-muted);
  padding: 1px 4px; font-weight: 600;
}

/* No-due-date strip */
.cal-nodate {
  background: #fff; border-radius: var(--radius-lg);
  padding: 12px 16px; box-shadow: var(--shadow-sm);
  border: 2px dashed var(--border);
  transition: border-color .15s;
}
.cal-nodate-hdr {
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  margin-bottom: 8px; display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
}
.cal-nodate-count {
  background: var(--list-bg); border-radius: 999px;
  padding: 1px 8px; font-size: 11px;
}
.cal-nodate-hint {
  margin-left: auto; font-size: 11px; font-weight: 400;
  color: var(--text-muted); display: flex; align-items: center; gap: 4px;
}
.cal-nodate-chips { display: flex; flex-wrap: wrap; gap: 6px; min-height: 28px; }
.cal-nodate-empty { font-size: 12px; color: var(--text-light); font-style: italic; }

/* ═══════════════════════════════════════════════════════
   TIMELINE VIEW
═══════════════════════════════════════════════════════ */
.timeline-view {
  flex: 1; overflow: hidden;
  display: flex; flex-direction: column;
  background: #f4f5f7;
}
.tl-scroll {
  flex: 1; overflow: auto;
}
.tl-inner {
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  margin: 16px;
}
.tl-row {
  display: flex;
  border-bottom: 1px solid var(--border);
}
.tl-row:last-child { border-bottom: none; }
.tl-label {
  width: 220px; min-width: 220px;
  padding: 0 12px; font-size: 13px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  position: sticky; left: 0; z-index: 5;
  background: #fff;
  border-right: 2px solid var(--border);
  display: flex; align-items: center;
}
.tl-header-label {
  background: var(--list-bg); font-weight: 700;
  color: var(--text-muted); font-size: 11px; text-transform: uppercase;
  letter-spacing: .5px;
}
.tl-group-label {
  background: var(--list-bg); font-weight: 700;
  color: var(--text); font-size: 13px;
}
.tl-task-label { color: var(--text); font-size: 12px; }
.tl-group-row { background: var(--list-bg); }
.tl-data-row { cursor: pointer; transition: background var(--transition); }
.tl-data-row:hover { background: #f0f4ff; }
.tl-data-row:hover .tl-label { background: #f0f4ff; }

.tl-track {
  flex: none; position: relative;
  height: 40px; overflow: hidden;
}
.tl-header-row .tl-track { height: 48px; }
.tl-group-row .tl-track   { height: 32px; }

/* Today marker */
.tl-today-line {
  position: absolute; top: 0; bottom: 0; width: 2px;
  background: var(--danger); z-index: 3; pointer-events: none;
}
.tl-today-label {
  position: absolute; bottom: 4px;
  font-size: 10px; font-weight: 700; color: var(--danger);
  transform: translateX(-50%); white-space: nowrap; z-index: 3;
}

/* Week header ticks */
.tl-week {
  position: absolute; top: 0; bottom: 0;
  display: flex; align-items: flex-end;
  padding-bottom: 6px; padding-left: 5px;
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  border-left: 1px dashed var(--border);
  white-space: nowrap; overflow: hidden; pointer-events: none;
}

/* Weekend shading strips */
.tl-weekend {
  position: absolute; top: 0; bottom: 0;
  background: rgba(0,0,0,.03); pointer-events: none; z-index: 0;
}

/* Task bars */
.tl-bar {
  position: absolute; top: 8px; height: 24px;
  background: var(--primary-light);
  border-radius: 4px; z-index: 2;
  display: flex; align-items: center; padding: 0 7px;
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: opacity var(--transition);
}
.tl-bar:hover { opacity: .85; }
.tl-bar-done    { background: var(--success); opacity: .75; }
.tl-bar-overdue { background: var(--danger); }
.tl-bar-lbl {
  font-size: 10px; font-weight: 600; color: #fff;
  white-space: nowrap; pointer-events: none;
}

/* No-date diamond marker */
.tl-marker {
  position: absolute; top: 10px;
  width: 20px; height: 20px;
  background: var(--text-muted);
  border-radius: 50%; z-index: 2;
  border: 2px solid #fff; box-shadow: var(--shadow-sm);
}

/* ═══════════════════════════════════════════════════════
   PRIORITY BADGES
═══════════════════════════════════════════════════════ */
.card-badge.priority-urgent { background: #ffd5cc; color: #a81500; font-weight: 700; }
.card-badge.priority-high   { background: #ffe5b0; color: #7a3a00; font-weight: 700; }
.card-badge.priority-normal { background: #cce0ff; color: #003d99; font-weight: 700; }
.card-badge.priority-low    { background: #ebecf0; color: #42526e; font-weight: 600; }

/* Table-view priority pill */
.tbl-priority {
  display: inline-block; font-size: 11px; font-weight: 600;
  padding: 2px 7px; border-radius: 10px;
}
.tbl-priority.priority-urgent { background: #ffebe6; color: #bf2600; }
.tbl-priority.priority-high   { background: #fff4e5; color: #974900; }
.tbl-priority.priority-normal { background: #e8f0ff; color: #0052cc; }
.tbl-priority.priority-low    { background: #f4f5f7; color: #5e6c84; }

/* ═══════════════════════════════════════════════════════
   ATTACHMENTS
═══════════════════════════════════════════════════════ */
.attachment-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 10px;
  border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 13px; background: var(--bg-secondary);
  margin-bottom: 6px;
}
.attachment-item-icon { width: 20px; text-align: center; color: var(--text-muted); flex-shrink: 0; }
.attachment-item-name {
  flex: 1; min-width: 0;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  color: var(--primary); text-decoration: none;
}
.attachment-item-name:hover { text-decoration: underline; }
.attachment-item-size { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.attachment-item-del {
  background: none; border: none; cursor: pointer; color: var(--text-muted);
  padding: 2px 4px; flex-shrink: 0; line-height: 1;
}
.attachment-item-del:hover { color: var(--danger); }
.attachment-upload-btn {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; padding: 7px 10px; cursor: pointer;
  border: 1px dashed var(--border); border-radius: var(--radius);
  color: var(--text-muted); background: none; width: 100%;
  box-sizing: border-box; margin-top: 4px;
}
.attachment-upload-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ═══════════════════════════════════════════════════════
   GLOBAL SEARCH OVERLAY
═══════════════════════════════════════════════════════ */
.search-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(9,30,66,.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
.search-overlay.hidden { display: none; }
.search-box {
  width: 100%; max-width: 640px;
  background: #fff; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
}
.search-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
}
.search-input-icon { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.search-input-field {
  flex: 1; min-width: 0; font-size: 15px; border: none; outline: none;
  background: transparent; color: var(--text);
}
.search-esc-key {
  font-size: 11px; padding: 2px 6px;
  border: 1px solid var(--border); border-radius: 4px;
  color: var(--text-muted); background: var(--list-bg);
  flex-shrink: 0;
}
.search-results-list {
  max-height: 440px; overflow-y: auto;
  padding: 6px 0;
}
.search-hint {
  padding: 16px; font-size: 13px; color: var(--text-muted); text-align: center;
}
.search-result-item {
  padding: 10px 16px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .1s;
}
.search-result-item:hover,
.search-result-item.sr-active {
  background: var(--hover-bg, #f4f5f7);
  border-left-color: var(--primary);
}
.sri-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  margin-bottom: 3px;
}
.sri-meta {
  display: flex; gap: 10px; align-items: center;
  font-size: 12px; color: var(--text-muted);
}
.sri-overdue { color: var(--danger); }
.sri-done    { color: var(--success); }
.sri-priority {
  font-size: 11px; font-weight: 600;
  padding: 1px 6px; border-radius: 10px;
}
.search-hl { background: #fff9c4; color: inherit; border-radius: 2px; }
.sri-match-type {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; color: var(--text-muted);
  background: var(--list-bg); padding: 1px 6px;
  border-radius: 10px; flex-shrink: 0;
}
.sri-board {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 12px; color: var(--text-muted); flex-shrink: 0;
}

/* Search filter row */
.search-filter-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--list-bg);
}
.search-filter-select {
  font-size: 12px; padding: 3px 6px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card-bg); color: var(--text);
  cursor: pointer; outline: none; max-width: 140px;
}
.search-filter-select:focus { border-color: var(--primary); }

/* Save search button */
.search-save-btn {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; padding: 3px 10px;
  border: 1px solid var(--primary); border-radius: 6px;
  background: transparent; color: var(--primary);
  cursor: pointer; margin-left: auto; white-space: nowrap;
  transition: background .15s, color .15s;
}
.search-save-btn:hover { background: var(--primary); color: #fff; }

/* Save search inline form */
.search-save-form {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--list-bg);
}
.search-save-input {
  flex: 1; min-width: 0; font-size: 13px; padding: 4px 8px;
  border: 1px solid var(--border); border-radius: 6px;
  background: var(--card-bg); color: var(--text); outline: none;
}
.search-save-input:focus { border-color: var(--primary); }

/* Section titles inside results list */
.search-section-title {
  padding: 8px 16px 4px;
  font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .06em; color: var(--text-muted);
}

/* Saved filter items */
.search-saved-item {
  display: flex; align-items: center; gap: 6px;
  padding: 9px 16px; cursor: pointer;
  border-left: 3px solid transparent;
  transition: background .1s;
}
.search-saved-item:hover,
.search-saved-item.sr-active {
  background: var(--hover-bg, #f4f5f7);
  border-left-color: var(--primary);
}
.search-saved-item .sri-title { font-size: 13px; flex: 1; }

/* Delete button on saved filter items */
.sf-del-btn {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 13px; padding: 2px 4px;
  border-radius: 4px; flex-shrink: 0; line-height: 1;
  margin-left: auto;
}
.sf-del-btn:hover { color: var(--danger); background: var(--danger-light, rgba(220,53,69,.1)); }

/* ═══════════════════════════════════════════════════════
   ACTIVITY FEED
═══════════════════════════════════════════════════════ */
#activity-feed { display: flex; flex-direction: column; gap: 4px; }

.activity-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 4px 0;
  font-size: 13px;
}
.activity-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 5px;
}
.activity-body {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px;
  flex: 1;
}
.activity-text { color: var(--text); line-height: 1.4; }
.activity-text strong { font-weight: 600; }
.activity-text em { font-style: italic; color: var(--text-muted); }
.activity-time { font-size: 11px; color: var(--text-light); flex-shrink: 0; }

/* ═══════════════════════════════════════════════════════
   ARCHIVE VIEW
═══════════════════════════════════════════════════════ */
.archive-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.archive-card {
  background: var(--card-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  display: flex; flex-direction: column; gap: 8px;
  box-shadow: var(--shadow-sm);
}
.archive-card-title {
  font-size: 14px; font-weight: 600; color: var(--text);
  line-height: 1.4;
}
.archive-card-meta {
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px;
  font-size: 12px; color: var(--text-muted);
}
.archive-card-actions {
  display: flex; gap: 8px; margin-top: 4px;
}
.archive-card-actions .btn-sm-primary,
.archive-card-actions .btn-danger-sm {
  flex: 1; justify-content: center;
  font-size: 12px; padding: 5px 8px;
}

/* ═══════════════════════════════════════════════════════
   NOTIFICATION BELL + PANEL
═══════════════════════════════════════════════════════ */
.btn-notif {
  position: relative;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--radius);
  color: rgba(255,255,255,.85); font-size: 16px;
  transition: var(--transition);
}
.btn-notif:hover { background: rgba(255,255,255,.15); color: #fff; }
.notif-badge {
  position: absolute; top: 2px; right: 2px;
  min-width: 16px; height: 16px;
  background: var(--danger); color: #fff;
  font-size: 9px; font-weight: 700;
  border-radius: 8px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
  pointer-events: none;
}

.notif-panel {
  position: fixed;
  top: calc(var(--nav-height) + 6px);
  right: 12px;
  width: 360px;
  background: #fff;
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--border);
  z-index: 500;
  overflow: hidden;
}
.notif-panel-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
  font-weight: 700; font-size: 14px;
}
.notif-mark-read {
  font-size: 12px; font-weight: 500; color: var(--primary);
  cursor: pointer; background: none; border: none;
}
.notif-mark-read:hover { text-decoration: underline; }
.notif-list { max-height: 400px; overflow-y: auto; }
.notif-empty { padding: 24px 16px; text-align: center; color: var(--text-muted); font-size: 13px; }
.notif-item {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 36px 12px 16px;
  border-bottom: 1px solid var(--border);
  cursor: pointer; transition: background .12s; position: relative;
}
.notif-item:last-child { border-bottom: none; }
.notif-item:hover { background: var(--list-bg); }
.notif-item.unread { background: #f0f7ff; }
.notif-item.unread::before {
  content: ''; position: absolute; left: 6px; top: 50%;
  transform: translateY(-50%);
  width: 6px; height: 6px; border-radius: 50%; background: var(--primary);
}
.notif-icon {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; font-size: 12px;
}
.notif-icon.type-mention    { background: #e3f2fd; color: #1565c0; }
.notif-icon.type-assignment { background: #e8f5e9; color: #2e7d32; }
.notif-icon.type-comment    { background: #fff3e0; color: #e65100; }
.notif-body { flex: 1; min-width: 0; }
.notif-message { font-size: 13px; color: var(--text); line-height: 1.4; }
.notif-time { font-size: 11px; color: var(--text-light); margin-top: 3px; }
.notif-del {
  position: absolute; right: 8px; top: 10px;
  opacity: 0; color: var(--text-light); font-size: 13px;
  background: none; border: none; cursor: pointer; padding: 3px 5px;
  border-radius: var(--radius);
}
.notif-item:hover .notif-del { opacity: 1; }
.notif-del:hover { color: var(--danger); background: rgba(235,90,70,.1); }

/* ═══════════════════════════════════════════════════════
   @MENTION
═══════════════════════════════════════════════════════ */
.mention-highlight { color: var(--primary); font-weight: 600; }

.mention-autocomplete {
  position: absolute;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  z-index: 700;
  min-width: 200px; max-height: 220px; overflow-y: auto;
}
.mention-ac-item {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
}
.mention-ac-item:hover, .mention-ac-item.active { background: var(--list-bg); }
.mention-ac-avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--primary);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700; color: #fff; flex-shrink: 0;
}

/* ═══════════════════════════════════════════════════════
   BOARD SHARING
═══════════════════════════════════════════════════════ */
.btn-board-settings {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 12px; font-size: 12px; font-weight: 600;
  border-radius: var(--radius);
  background: rgba(255,255,255,.15); color: rgba(255,255,255,.9);
  border: 1px solid rgba(255,255,255,.25);
  transition: var(--transition); margin-left: auto;
}
.btn-board-settings:hover { background: rgba(255,255,255,.25); color: #fff; }

.share-section-label { font-weight: 600; font-size: 13px; margin-bottom: 8px; color: var(--text); }
.share-member-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 0; border-bottom: 1px solid var(--border); font-size: 13px;
}
.share-member-row:last-child { border-bottom: none; }

.shared-board-link {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 12px; border-radius: var(--radius);
  color: rgba(255,255,255,.75); font-size: 13px; cursor: pointer; font-weight: 500;
  transition: var(--transition);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.shared-board-link:hover, .shared-board-link.active {
  background: rgba(255,255,255,.2); color: #fff;
}
.shared-board-link i { width: 16px; text-align: center; flex-shrink: 0; }

.shared-label {
  font-size: 11px; font-weight: 700;
  background: rgba(255,255,255,.25); color: #fff;
  padding: 2px 7px; border-radius: 10px; margin-left: 8px;
  vertical-align: middle; text-transform: uppercase; letter-spacing: .5px;
}
.list-title-static {
  font-weight: 700; font-size: 14px; color: var(--text); flex: 1;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.shared-list-col { cursor: default; }
.shared-list-col .list-cards .todo-card { cursor: pointer; }

/* ═══════════════════════════════════════════════════════
   REGISTRATION MULTI-STEP
═══════════════════════════════════════════════════════ */
.reg-steps {
  display: flex; align-items: center; justify-content: center;
  gap: 0; margin-bottom: 28px;
}
.reg-step {
  display: flex; flex-direction: column; align-items: center; gap: 4px;
  flex-shrink: 0;
}
.reg-step span {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
  background: var(--border); color: var(--text-muted);
  transition: background .2s, color .2s;
}
.reg-step small { font-size: 10px; color: var(--text-muted); white-space: nowrap; }
.reg-step.active span { background: var(--primary); color: #fff; }
.reg-step.done span   { background: var(--success); color: #fff; }
.reg-step.done small  { color: var(--success); }
.reg-step-line {
  flex: 1; height: 2px; background: var(--border);
  min-width: 24px; max-width: 48px; margin: 0 4px; margin-bottom: 14px;
}
.reg-step-label {
  font-size: 13px; color: var(--text-muted); margin-bottom: 16px; text-align: center;
}
.reg-type-options {
  display: flex; gap: 12px; margin-bottom: 20px;
}
.reg-type-card {
  flex: 1; border: 2px solid var(--border); border-radius: var(--radius);
  padding: 16px 12px; cursor: pointer; display: flex; flex-direction: column;
  align-items: center; gap: 6px; transition: border-color .15s, background .15s;
  text-align: center;
}
.reg-type-card input[type="radio"] { display: none; }
.reg-type-card i { font-size: 22px; color: var(--text-muted); }
.reg-type-card strong { font-size: 13px; color: var(--text); }
.reg-type-card small  { font-size: 11px; color: var(--text-muted); }
.reg-type-card.selected {
  border-color: var(--primary); background: rgba(0,121,191,.06);
}
.reg-type-card.selected i { color: var(--primary); }
.reg-btn-row {
  display: flex; gap: 10px; align-items: center;
}
.reg-btn-row .btn-primary  { flex: 1; }
.reg-btn-row .btn-secondary { flex-shrink: 0; }
.btn-secondary {
  padding: 10px 16px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text); font-size: 14px; font-weight: 600;
  cursor: pointer; transition: background .15s;
}
.btn-secondary:hover { background: var(--border); }
.reg-company-tabs {
  display: flex; gap: 0; border: 1px solid var(--border);
  border-radius: var(--radius); overflow: hidden;
}
.reg-tab {
  flex: 1; padding: 9px; font-size: 13px; font-weight: 600;
  background: var(--surface); border: none; cursor: pointer;
  color: var(--text-muted); transition: background .15s, color .15s;
}
.reg-tab.active { background: var(--primary); color: #fff; }
.reg-code-row {
  display: flex; gap: 8px;
}
.reg-code-row .form-control { flex: 1; letter-spacing: 2px; font-weight: 700; }
.reg-verify-ok {
  padding: 8px 12px; background: #eafaf1; border: 1px solid #a9dfbf;
  border-radius: var(--radius); color: #1d7a3d; font-size: 13px; margin-top: 8px;
}
.reg-verify-ok i { margin-right: 6px; }
.reg-error { font-size: 13px; color: #e74c3c; margin: 6px 0 0; }
.reg-hint  { font-size: 12px; color: var(--text-muted); margin: 6px 0 0; }

/* ═══════════════════════════════════════════════════════
   CONTACTS GROUPED VIEW
═══════════════════════════════════════════════════════ */
.contacts-group-header {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .6px;
  padding-bottom: 8px; border-bottom: 2px solid var(--border);
  margin-bottom: 12px;
}
.contacts-group-header i { color: var(--primary); }
.contacts-group-badge {
  margin-left: auto;
  background: var(--primary); color: #fff;
  font-size: 11px; font-weight: 700;
  padding: 1px 7px; border-radius: 10px;
  min-width: 20px; text-align: center;
}
.contacts-group-badge:empty { display: none; }

/* ═══════════════════════════════════════════════════════
   AVATAR IMAGE (shared)
═══════════════════════════════════════════════════════ */
.avatar-img {
  border-radius: 50%; object-fit: cover;
  width: 40px; height: 40px; flex-shrink: 0;
  border: 2px solid var(--border);
}
.nav-avatar-img {
  width: 34px; height: 34px; border-radius: 50%; object-fit: cover;
  cursor: pointer; border: 2px solid rgba(255,255,255,.6);
  flex-shrink: 0; transition: border-color .15s;
}
.nav-avatar-img:hover { border-color: #fff; }
.result-avatar { width: 36px; height: 36px; font-size: 13px; }

/* ═══════════════════════════════════════════════════════
   PROFILE PAGE
═══════════════════════════════════════════════════════ */
.profile-layout {
  display: flex; gap: 40px; align-items: flex-start;
}
.profile-avatar-col {
  display: flex; flex-direction: column; align-items: center;
  width: 180px; flex-shrink: 0;
}
.profile-avatar-wrap {
  width: 120px; height: 120px; border-radius: 50%;
  overflow: hidden; border: 3px solid var(--border);
  display: flex; align-items: center; justify-content: center;
  background: var(--primary); color: #fff;
  font-size: 42px; font-weight: 700; flex-shrink: 0;
}
.profile-avatar-img {
  width: 100%; height: 100%; object-fit: cover; border-radius: 50%;
}
.profile-avatar-initials {
  width: 100%; height: 100%; display: flex; align-items: center;
  justify-content: center; font-size: 42px; font-weight: 700; color: #fff;
}
.profile-photo-btn {
  margin-top: 14px; display: inline-flex; align-items: center;
  gap: 6px; white-space: nowrap;
}
.profile-photo-hint {
  font-size: 11px; color: var(--text-muted); margin-top: 8px;
  text-align: center; line-height: 1.4;
}
.btn-link-danger {
  background: none; border: none; cursor: pointer;
  color: #e74c3c; font-size: 12px; padding: 4px 0;
  text-decoration: underline; margin-top: 4px;
}
.btn-link-danger:hover { color: #c0392b; }
.profile-form-col { flex: 1; min-width: 0; }
.profile-section-title {
  font-size: 13px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .6px; color: var(--text-muted);
  margin-bottom: 14px; padding-bottom: 6px;
  border-bottom: 2px solid var(--border);
}
.profile-two-col {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.profile-divider {
  border: none; border-top: 1px solid var(--border);
  margin: 32px 0;
}
.profile-field-note {
  font-size: 11px; color: var(--text-muted);
  font-weight: 400; text-transform: none;
}

/* ── Profile plan card ────────────────────────────────── */
.profile-plan-card {
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  margin-bottom: 4px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.profile-plan-header {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.profile-plan-badge {
  display: inline-flex; align-items: center;
  font-size: 12px; font-weight: 700; letter-spacing: .4px;
  padding: 4px 12px; border-radius: 20px;
  text-transform: uppercase;
}
.profile-plan-badge--free  { background: rgba(148,163,184,.15); color: var(--text-muted); }
.profile-plan-badge--pro   { background: rgba(59,130,246,.18);  color: #3b82f6; }
.profile-plan-badge--biz   { background: rgba(124,58,237,.18);  color: #7c3aed; }
.profile-plan-expiry {
  font-size: 13px; color: var(--text-muted);
}
.profile-plan-expiry--warn   { color: #f59e0b; }
.profile-plan-expiry--danger { color: #ef4444; }
.profile-plan-storage {
  display: flex; flex-direction: column; gap: 5px;
}
.profile-plan-storage-labels {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--text-muted);
}
.profile-plan-pct {
  font-weight: 600; color: var(--text-secondary);
}
.profile-plan-storage-bar {
  height: 6px; border-radius: 4px;
  background: var(--border); overflow: hidden;
}
.profile-plan-storage-fill {
  height: 100%; border-radius: 4px;
  transition: width .3s ease;
}
.profile-plan-nostorage {
  margin: 2px 0 8px;
  font-size: 12.5px; color: var(--text-muted);
  display: flex; align-items: center; gap: 6px;
}
.profile-plan-btn {
  align-self: flex-start;
  font-size: 13px; padding: 8px 18px;
}

.contact-jobtitle {
  font-size: 11px; color: var(--text-muted); margin: 1px 0 0;
}

/* ═══════════════════════════════════════════════════════
   LABELS
═══════════════════════════════════════════════════════ */
.card-labels {
  display: flex; flex-wrap: wrap; gap: 3px;
  margin-bottom: 5px;
}
.card-label-dot {
  display: inline-block;
  height: 8px; width: 36px;
  border-radius: 4px;
  flex-shrink: 0;
}
.badge-blocked {
  background: #ffebe6 !important; color: #bf2600 !important;
}
.badge-time {
  background: #e6f0ff !important; color: #0052cc !important;
}
.label-chips-row {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.label-chip-sm {
  display: inline-block;
  padding: 2px 8px; border-radius: 12px;
  font-size: 11px; font-weight: 600; color: #fff;
  white-space: nowrap;
}
.label-picker-panel {
  margin-top: 8px; border: 1px solid var(--border);
  border-radius: var(--radius); padding: 8px;
  background: #fff;
}
.label-picker-row {
  display: flex; align-items: center; gap: 8px;
  padding: 4px 0; cursor: pointer; font-size: 13px;
}
.label-picker-row input { cursor: pointer; }
.label-picker-dot {
  width: 18px; height: 18px; border-radius: 3px; flex-shrink: 0;
}
.label-picker-name { flex: 1; }
.label-create-row { margin-top: 8px; border-top: 1px solid var(--border); padding-top: 8px; }
.label-color-row {
  display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 4px;
}
.lc-swatch {
  width: 20px; height: 20px; border-radius: 3px; cursor: pointer;
  transition: transform .1s; border: 2px solid transparent;
}
.lc-swatch:hover { transform: scale(1.15); }
.lc-swatch.lc-active { border-color: #172b4d; transform: scale(1.1); }

/* ═══════════════════════════════════════════════════════
   CARD COVER IMAGE
═══════════════════════════════════════════════════════ */
.card-cover {
  height: 112px; border-radius: 3px 3px 0 0;
  background-size: cover; background-position: center;
  margin: -6px -6px 6px; /* bleed to edges of card */
}
.card-has-cover { padding-top: 0; }
.modal-cover-banner {
  height: 160px;
  background-size: cover; background-position: center;
  position: relative; flex-shrink: 0;
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  overflow: hidden;
}
.modal-cover-remove {
  position: absolute; top: 8px; right: 8px;
  background: rgba(0,0,0,.55); color: #fff;
  border: none; border-radius: var(--radius);
  padding: 4px 10px; font-size: 12px; font-weight: 600;
  cursor: pointer; backdrop-filter: blur(4px);
}
.modal-cover-remove:hover { background: rgba(0,0,0,.75); }
.attachment-thumb {
  width: 36px; height: 36px; object-fit: cover;
  border-radius: 3px; flex-shrink: 0;
}
.btn-set-cover {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 11px; padding: 2px 7px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: var(--list-bg); color: var(--text-muted);
  cursor: pointer; white-space: nowrap; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.btn-set-cover:hover, .btn-set-cover.cover-set {
  background: var(--primary); color: #fff; border-color: var(--primary);
}

/* ═══════════════════════════════════════════════════════
   DEPENDENCIES
═══════════════════════════════════════════════════════ */
.dep-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
  background: var(--list-bg); margin-bottom: 5px;
  font-size: 13px;
}
.dep-done { opacity: .65; }
.dep-icon { font-size: 14px; flex-shrink: 0; }
.dep-item:not(.dep-done) .dep-icon { color: var(--danger); }
.dep-done .dep-icon { color: var(--success); }
.dep-title {
  flex: 1; font-weight: 600; cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.dep-title:hover { text-decoration: underline; }
.dep-status { font-size: 11px; color: var(--text-muted); flex-shrink: 0; }
.dep-remove {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px 4px; flex-shrink: 0;
}
.dep-remove:hover { color: var(--danger); }
.dep-blocked-badge {
  display: inline-block; margin-left: 8px;
  background: #ffebe6; color: #bf2600;
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 10px;
}
.dep-add-row { position: relative; margin-top: 8px; }
.dep-results-list {
  display: none; position: absolute; left: 0; right: 0; top: 100%; z-index: 20;
  background: #fff; border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 180px; overflow-y: auto;
}
.dep-result-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 8px 12px; cursor: pointer; font-size: 13px;
  border-bottom: 1px solid var(--border);
}
.dep-result-item:last-child { border-bottom: none; }
.dep-result-item:hover { background: var(--hover-bg); }

/* ═══════════════════════════════════════════════════════
   TIME TRACKING
═══════════════════════════════════════════════════════ */
.time-total-badge {
  display: inline-block; margin-left: 8px;
  background: #e6f0ff; color: var(--primary);
  font-size: 11px; font-weight: 700; padding: 1px 7px;
  border-radius: 10px; font-family: monospace;
}
.time-entries-list { margin-bottom: 10px; }
.time-entry {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius);
  background: var(--list-bg); margin-bottom: 4px;
  font-size: 12px;
}
.time-entry-dur {
  font-weight: 700; font-family: monospace;
  color: var(--primary); flex-shrink: 0; min-width: 40px;
}
.time-entry-meta { flex: 1; color: var(--text-muted); }
.time-entry-del {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); padding: 2px 4px; flex-shrink: 0;
}
.time-entry-del:hover { color: var(--danger); }
.time-log-form { margin-top: 8px; }
.time-inputs-row {
  display: flex; gap: 6px; align-items: center;
}
.time-input { width: 56px !important; text-align: center; }

/* ═══════════════════════════════════════════════════════
   BOARD SWITCHER
═══════════════════════════════════════════════════════ */
/* Board switcher — sits inside the dark sidebar, matches sidebar colour scheme */
.board-switcher { padding: 12px 8px 4px; border-bottom: 1px solid rgba(255,255,255,.12); margin-bottom: 4px; }
.board-switcher-label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: rgba(255,255,255,.6);
  padding: 0 8px 6px;
}
.board-item {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px;
  cursor: pointer; font-size: 14px;
  color: rgba(255,255,255,.85);
  transition: background .15s;
}
.board-item:hover { background: rgba(255,255,255,.15); }
.board-item.active { background: rgba(255,255,255,.22); font-weight: 600; color: #fff; }
.board-item-name { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.board-item-actions { display: none; gap: 2px; }
.board-item:hover .board-item-actions { display: flex; }
.board-item-btn {
  background: none; border: none; cursor: pointer;
  padding: 2px 5px; border-radius: 4px;
  color: rgba(255,255,255,.6); font-size: 12px;
  transition: background .12s, color .12s;
}
.board-item-btn:hover { background: rgba(255,255,255,.2); color: #fff; }
.board-add-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 8px; border-radius: 6px;
  color: rgba(255,255,255,.55); font-size: 13px;
  cursor: pointer; transition: background .15s, color .15s;
}
.board-add-btn:hover { background: rgba(255,255,255,.12); color: rgba(255,255,255,.9); }
.board-inline-input { display: flex; gap: 6px; padding: 4px 8px; }
.board-inline-input input {
  flex: 1; min-width: 0; font-size: 13px; padding: 5px 8px;
  border: 1px solid rgba(255,255,255,.3);
  border-radius: 4px;
  background: rgba(0,0,0,.2); color: #fff;
}
.board-inline-input input::placeholder { color: rgba(255,255,255,.4); }
.board-inline-input input:focus { outline: none; border-color: rgba(255,255,255,.7); }

/* ═══════════════════════════════════════════════════════
   ACTIVITY FEED PANEL
═══════════════════════════════════════════════════════ */
.activity-panel { position: fixed; top: 0; right: 0; width: 380px; height: 100vh; background: #fff; box-shadow: -4px 0 24px rgba(0,0,0,.14); z-index: 600; display: flex; flex-direction: column; transform: translateX(100%); transition: transform .25s ease; }
.activity-panel.open { transform: translateX(0); }
.activity-panel-header { display: flex; align-items: center; padding: 16px 20px; border-bottom: 1px solid #eee; gap: 12px; }
.activity-panel-header h3 { flex: 1; margin: 0; font-size: 16px; }
.activity-list { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 2px; }
.activity-item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.activity-avatar { width: 32px; height: 32px; border-radius: 50%; background: #3b5bdb; color: #fff; font-size: 12px; font-weight: 700; display: flex; align-items: center; justify-content: center; flex-shrink: 0; overflow: hidden; }
.activity-avatar img { width: 100%; height: 100%; object-fit: cover; }
.activity-body { flex: 1; min-width: 0; }
.activity-text { font-size: 13px; line-height: 1.4; color: #333; }
.activity-text strong { font-weight: 600; }
.activity-time { font-size: 11px; color: #999; margin-top: 2px; }
.activity-load-more { text-align: center; padding: 12px; }
.btn-nav-icon { background: none; border: none; cursor: pointer; padding: 6px 8px; border-radius: 6px; font-size: 18px; color: #555; transition: background .15s; }
.btn-nav-icon:hover { background: #f0f4ff; color: #3b5bdb; }

/* ═══════════════════════════════════════════════════════
   COMPANY ADMIN PANEL
═══════════════════════════════════════════════════════ */
.company-page { max-width: 900px; margin: 0 auto; padding: 24px; }
.company-page h2 { font-size: 22px; margin: 0 0 24px; }
.company-info-card { background: #fff; border: 1px solid #e0e0e0; border-radius: 10px; padding: 24px; margin-bottom: 24px; }
.company-info-card h3 { margin: 0 0 16px; font-size: 12px; color: #555; text-transform: uppercase; letter-spacing: .06em; }
.company-name-row { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.company-name-display { font-size: 22px; font-weight: 700; }
.company-code-badge { font-family: monospace; font-size: 14px; font-weight: 700; letter-spacing: .06em; background: #f0f4ff; color: #3b5bdb; border: 2px dashed #c5cff5; border-radius: 8px; padding: 12px 20px; display: block; word-break: break-all; margin: 8px 0 16px; line-height: 1.8; }
.company-code-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.member-table { width: 100%; border-collapse: collapse; }
.member-table th { text-align: left; font-size: 12px; color: #888; text-transform: uppercase; letter-spacing: .06em; padding: 8px 12px; border-bottom: 2px solid #eee; }
.member-table td { padding: 10px 12px; border-bottom: 1px solid #f5f5f5; vertical-align: middle; }
.member-table tr:last-child td { border-bottom: none; }
.member-name-cell { display: flex; align-items: center; gap: 10px; }
.badge-owner { background: #fff3cd; color: #856404; font-size: 11px; font-weight: 600; padding: 2px 7px; border-radius: 10px; border: 1px solid #ffc107; }
.member-count { color: #888; font-size: 13px; margin-bottom: 12px; }

/* ── Company: checkbox column ───────────────────────────── */
.member-cb-cell { width: 36px; text-align: center; padding-left: 8px !important; }
.member-cb-cell input[type="checkbox"] { width: 15px; height: 15px; cursor: pointer; accent-color: var(--primary); }

/* ── Company: plan cell in member table ─────────────────── */
.member-plan-cell { display: flex; flex-direction: column; gap: 3px; }
.member-plan-expiry { font-size: 11px; color: var(--text-muted); }
.member-plan-expiry.warn   { color: #f59e0b; }
.member-plan-expiry.danger { color: #ef4444; }

/* ── Company: action buttons cell ───────────────────────── */
.member-action-btns { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }

/* ── Company: bulk action bar ───────────────────────────── */
.company-bulk-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 14px;
  font-size: 13px;
}
.bulk-bar-count  { font-weight: 700; color: var(--primary); white-space: nowrap; }
.bulk-bar-label  { color: var(--text-muted); white-space: nowrap; }
.bulk-bar-select {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 5px 10px;
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  cursor: pointer;
}
.bulk-bar-btn   { padding: 6px 14px !important; font-size: 12px !important; white-space: nowrap; }
.bulk-bar-clear { padding: 6px 12px !important; font-size: 12px !important; }

/* ═══════════════════════════════════════════════════════
   RESPONSIVE
═══════════════════════════════════════════════════════ */
/* Hamburger — hidden on desktop */
.btn-hamburger {
  display: none;
  align-items: center; justify-content: center;
  width: 36px; height: 36px;
  background: none; border: none; cursor: pointer;
  color: rgba(255,255,255,.85); font-size: 18px;
  border-radius: 6px; flex-shrink: 0;
}
.btn-hamburger:hover { background: rgba(255,255,255,.15); }

/* Sidebar overlay — hidden on desktop */
.sidebar-overlay {
  display: none;
  position: fixed; inset: 0;
  background: rgba(0,0,0,.45);
  z-index: 199;
}

@media (max-width: 640px) {
  .btn-hamburger { display: flex; }
  .sidebar-overlay.active { display: block; }
  .app-sidebar { width: 0; overflow: hidden; }
  .app-sidebar.open { width: 220px; position: absolute; height: 100%; z-index: 200; }
  .profile-layout { flex-direction: column; }
  .profile-avatar-col { width: 100%; }
  .profile-two-col { grid-template-columns: 1fr; }
  .todo-modal-body { flex-direction: column; }
  .todo-modal-sidebar { width: 100%; border-top: 1px solid var(--border); }
  .todo-modal-main { border-right: none; }

  /* Top-bar squeeze: 8 nav-user items don't fit in ~200 px of remaining
     room on a phone, so the rightmost items (logout!) overflow off-screen.
     Hide preferences-style buttons (theme / language / density / activity
     / username) — those are reachable via the profile page anyway — and
     keep the daily-use ones (notifications, avatar, logout) visible. */
  .app-nav .btn-nav-search { padding: 6px 8px; }
  .app-nav #btn-activity,
  .app-nav #btn-theme-pick,
  .app-nav #btn-lang-pick,
  .app-nav #btn-density,
  .app-nav .nav-username { display: none; }
  .app-nav .nav-user { gap: 4px; }
  .app-nav .btn-nav { padding: 6px 8px; font-size: 12px; }
}

/* Smallest phones (≤380 px wide): trim the logout button to the icon
   alone — the right-from-bracket icon is universally read as "log out"
   and saves the ~50 px the text label costs. We can't simply font-size:0
   the whole button (that would also hide the icon, since FontAwesome
   uses an icon font), so the trick is to size the icon explicitly and
   collapse the rest of the button's text node. */
@media (max-width: 380px) {
  .app-nav #logout-btn {
    font-size: 0;        /* collapses the trailing text node */
    padding: 6px 8px;
  }
  .app-nav #logout-btn i {
    font-size: 14px;     /* re-establishes a real size for the icon glyph */
  }
}

/* ── Comment Reactions ─────────────────────────────────── */
.reaction-row { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; align-items: center; }
.reaction-pill { display: inline-flex; align-items: center; gap: 3px; padding: 2px 8px; border: 1px solid #e0e0e0; border-radius: 12px; background: #f9f9f9; cursor: pointer; font-size: 13px; transition: all .15s; }
.reaction-pill:hover { border-color: #aac4ff; background: #eef2ff; }
.reaction-pill.mine { border-color: #748ffc; background: #e8edff; color: #3b5bdb; font-weight: 600; }
.reaction-pill span { font-size: 12px; color: #555; }
.reaction-pill.mine span { color: #3b5bdb; }
.reaction-add-btn { display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; border: 1px dashed #ccc; border-radius: 50%; background: none; cursor: pointer; font-size: 14px; color: #888; transition: all .15s; }
.reaction-add-btn:hover { border-color: #748ffc; color: #3b5bdb; background: #f0f4ff; }
.reaction-picker { position: fixed; background: #fff; border: 1px solid #e0e0e0; border-radius: 10px; box-shadow: 0 4px 20px rgba(0,0,0,.15); padding: 8px; display: flex; gap: 4px; z-index: 900; }
.reaction-picker button { background: none; border: none; cursor: pointer; font-size: 20px; padding: 4px 6px; border-radius: 6px; transition: background .12s; }
.reaction-picker button:hover { background: #f0f4ff; }

/* ── Theme Picker — nav button ────────────────────────── */
.btn-theme-pick {
  display: flex; align-items: center; justify-content: center;
  width: 32px; height: 32px;
  background: rgba(255,255,255,.15);
  border: 2px solid rgba(255,255,255,.35);
  border-radius: 50%;
  cursor: pointer;
  transition: background .15s, border-color .15s, transform .15s;
  padding: 0;
}
.btn-theme-pick:hover { background: rgba(255,255,255,.28); border-color: rgba(255,255,255,.7); transform: scale(1.08); }
.btn-theme-dot {
  display: block; width: 16px; height: 16px;
  border-radius: 50%;
  border: 2px solid rgba(255,255,255,.6);
  transition: background .25s;
}

/* ── Theme Picker — nav popup ─────────────────────────── */
.theme-picker-popup {
  position: fixed;
  z-index: 800;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,.18);
  padding: 12px;
  width: 260px;
  animation: tp-drop .15s ease;
}
@keyframes tp-drop {
  from { opacity: 0; transform: translateY(-6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.tp-header { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .07em; color: #999; margin-bottom: 10px; padding: 0 2px; }
.tp-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.tp-swatch {
  position: relative;
  display: flex; align-items: center;
  gap: 0;
  height: 40px;
  border: 2px solid #e8e8e8;
  border-radius: 8px;
  overflow: hidden;
  cursor: pointer;
  background: none;
  padding: 0;
  transition: border-color .12s, box-shadow .12s;
}
.tp-swatch:hover { border-color: #aaa; box-shadow: 0 2px 8px rgba(0,0,0,.12); }
.tp-swatch.active { border-color: var(--primary); box-shadow: 0 0 0 2px color-mix(in srgb, var(--primary) 25%, transparent); }
.tp-swatch-side { display: block; width: 14px; height: 100%; flex-shrink: 0; }
.tp-swatch-main { display: block; width: 20px; height: 100%; flex-shrink: 0; opacity: .75; }
.tp-swatch-label { flex: 1; font-size: 12px; font-weight: 500; color: #333; padding: 0 6px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tp-check { position: absolute; right: 5px; top: 50%; transform: translateY(-50%); font-size: 11px; font-weight: 800; color: var(--primary); }

/* ── Theme Picker (profile page) ──────────────────────── */
.theme-picker-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid #eee; }
.theme-picker-section h4 { font-size: 14px; font-weight: 600; margin: 0 0 4px; color: #333; }
.theme-picker-hint { font-size: 13px; color: #888; margin: 0 0 16px; }
.theme-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(96px, 1fr));
  gap: 12px;
}
.theme-swatch-card {
  position: relative;
  border: 2px solid #e0e0e0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color .15s, transform .15s, box-shadow .15s;
  background: #fff;
}
.theme-swatch-card:hover { border-color: #aaa; transform: translateY(-2px); box-shadow: 0 4px 12px rgba(0,0,0,.12); }
.theme-swatch-card.active { border-color: var(--primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--primary) 20%, transparent); }
.theme-swatch-preview {
  display: flex;
  height: 56px;
}
.theme-swatch-sidebar { width: 22px; flex-shrink: 0; }
.theme-swatch-content { flex: 1; background: #f5f5f5; display: flex; flex-direction: column; padding: 6px 6px 0; gap: 4px; }
.theme-swatch-bar { height: 8px; border-radius: 3px; width: 70%; }
.theme-swatch-lines { display: flex; flex-direction: column; gap: 3px; }
.theme-swatch-line { height: 5px; background: #ddd; border-radius: 2px; }
.theme-swatch-line.short { width: 60%; }
.theme-swatch-name { font-size: 11px; font-weight: 600; color: #444; padding: 5px 7px 6px; text-align: center; }
.theme-swatch-check {
  position: absolute; top: 4px; right: 5px;
  font-size: 12px; font-weight: 800;
  color: var(--primary);
  text-shadow: 0 0 3px #fff;
}

/* ── Email Prefs (profile page) ───────────────────────── */
.email-prefs-section { margin-top: 28px; padding-top: 20px; border-top: 1px solid #eee; }
.email-prefs-section h4 { font-size: 14px; font-weight: 600; margin: 0 0 14px; color: #333; }
/* ── Profile Danger Zone ───────────────────────────── */
.profile-danger-zone {
  margin-top: 2rem;
  padding: 1.25rem 1.5rem;
  border: 1.5px solid rgba(220,38,38,.22);
  border-radius: 12px;
  background: rgba(254,242,242,.6);
}
.profile-danger-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: .4rem;
}
.profile-danger-header i { color: #dc2626; font-size: 15px; }
.profile-danger-header h4 { margin: 0; font-size: 14.5px; font-weight: 700; color: #dc2626; }
.profile-danger-zone > p { font-size: 13px; color: #64748b; margin: 0 0 1rem; line-height: 1.5; }
.pref-toggle-row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid #f5f5f5; }
.pref-toggle-row:last-child { border-bottom: none; }
.pref-toggle-label { flex: 1; font-size: 14px; color: #444; cursor: pointer; }
.pref-toggle-sub  { font-size: 12px; color: #888; display: block; margin-top: 2px; }
/* toggle switch */
.toggle-switch { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider { position: absolute; inset: 0; background: #ccc; border-radius: 22px; cursor: pointer; transition: .2s; }
.toggle-slider:before { content: ''; position: absolute; width: 16px; height: 16px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.toggle-switch input:checked + .toggle-slider { background: #3b5bdb; }
.toggle-switch input:checked + .toggle-slider:before { transform: translateX(16px); }

/* ── Language Picker (nav bar popup) ─────────────────── */
.btn-lang-pick {
  background: none;
  border: none;
  cursor: pointer;
  padding: 6px 8px;
  border-radius: 6px;
  font-size: 18px;
  line-height: 1;
  transition: background .15s;
  display: flex; align-items: center;
}
.btn-lang-pick img { width: 20px; height: 15px; vertical-align: middle; border-radius: 2px; }
.btn-lang-pick:hover { background: rgba(255,255,255,.15); }

.lang-picker-popup {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 10px;
  box-shadow: 0 8px 24px rgba(0,0,0,.14);
  min-width: 160px;
  padding: 6px 0;
  z-index: 1100;
  animation: fadeInDown .12s ease;
}
.lp-option {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 14px;
  cursor: pointer;
  font-size: 14px;
  color: #333;
  transition: background .1s;
}
.lp-option:hover { background: #f4f6fb; }
.lp-option.active { background: #eef1fb; font-weight: 600; color: var(--primary); }
.lp-flag img { width: 20px; height: 15px; vertical-align: middle; border-radius: 2px; }
.lp-label { flex: 1; }
.lp-check { font-size: 11px; font-weight: 800; color: var(--primary); }

/* ── Language Picker (profile page) ──────────────────── */
.lang-select-section {
  margin-top: 28px;
  padding-top: 20px;
  border-top: 1px solid #eee;
}
.lang-select-section h4 {
  font-size: 14px;
  font-weight: 600;
  margin: 0 0 4px;
  color: #333;
}
.lang-options {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 12px;
}
.lang-option {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  color: #444;
  background: #fafafa;
  transition: border-color .15s, background .15s;
  user-select: none;
}
.lang-option input[type="radio"] { display: none; }
.lang-option:hover { border-color: #aaa; background: #f4f6fb; }
.lang-option.active {
  border-color: var(--primary);
  background: color-mix(in srgb, var(--primary) 8%, #fff);
  color: var(--primary);
  font-weight: 600;
}

/* ════════════════════════════════════════
   REPORTS & ANALYTICS
════════════════════════════════════════ */
.reports-page { padding: 1.5rem; max-width: 1400px; margin: 0 auto; }
.reports-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 1rem; margin-bottom: 1.5rem; }
.reports-header h1 { font-size: 1.4rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: .5rem; }
.reports-board-select { display: flex; align-items: center; gap: .5rem; font-size: .85rem; font-weight: 500; }
.reports-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(380px, 1fr)); gap: 1.2rem; margin-top: 1.2rem; }
.report-card { background: var(--card-bg, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 1.2rem; position: relative; }
.report-card-full { background: var(--card-bg, #fff); border: 1px solid var(--border, #e2e8f0); border-radius: 12px; padding: 1.2rem; margin-bottom: 0; }
.report-card-title { font-weight: 700; font-size: .95rem; margin-bottom: .2rem; display: flex; align-items: center; gap: .4rem; }
.report-card-sub { font-size: .78rem; color: var(--text-muted, #718096); margin-bottom: .8rem; }
.report-empty { color: var(--text-muted, #718096); font-size: .85rem; text-align: center; padding: 2rem 0; }
.report-empty.hidden { display: none; }
.report-range-btns { display: flex; gap: .4rem; margin-bottom: .6rem; }
.btn-range { font-size: .75rem; padding: .2rem .55rem; border: 1px solid var(--border, #e2e8f0); border-radius: 5px; background: transparent; cursor: pointer; color: var(--text-muted); transition: .15s; }
.btn-range.active, .btn-range:hover { background: var(--primary, #0052cc); color: #fff; border-color: var(--primary, #0052cc); }

/* Heatmap */
.heatmap-container { overflow-x: auto; }
.heatmap-scroll { min-width: 600px; padding: .5rem 0; }
.hm-grid-wrap { position: relative; }
.hm-month-row { display: grid; grid-template-rows: 14px; margin-bottom: 4px; font-size: 10px; color: var(--text-muted); position: relative; height: 16px; }
.hm-month-label { position: absolute; font-size: 10px; }
.hm-grid { display: grid; grid-template-rows: repeat(7, 12px); grid-auto-flow: column; gap: 3px; grid-auto-columns: 12px; }
.hm-cell { width: 12px; height: 12px; border-radius: 2px; cursor: default; }
.hm-0 { background: var(--list-bg, #ebecf0); opacity: .5; }
.hm-1 { background: var(--primary-light, #4c9aff); opacity: .4; }
.hm-2 { background: var(--primary-light, #4c9aff); opacity: .65; }
.hm-3 { background: var(--primary, #0052cc); opacity: .75; }
.hm-4 { background: var(--primary, #0052cc); }
.hm-legend { display: flex; align-items: center; gap: 3px; margin-top: 8px; }

.lang-flag img { width: 22px; height: 16px; vertical-align: middle; border-radius: 2px; }
.lang-flag { line-height: 1; }

/* ════════════════════════════════════════
   CARD & BOARD ENHANCEMENTS
════════════════════════════════════════ */

/* Story points badge */
.story-badge { display:inline-flex; align-items:center; justify-content:center; min-width:20px; height:18px; padding:0 5px; border-radius:10px; background:var(--primary,#0052cc); color:#fff; font-size:.68rem; font-weight:700; }
.card-story-badge { position:absolute; top:6px; right:6px; }

/* Subtasks */
.subtask-item { display:flex; align-items:center; gap:.45rem; padding:.3rem 0; border-bottom:1px solid var(--border,#e2e8f0); }
.subtask-item:last-child { border-bottom:none; }
.subtask-check { width:15px; height:15px; flex-shrink:0; cursor:pointer; }
.subtask-title { flex:1; font-size:.83rem; }
.subtask-done { text-decoration:line-through; color:var(--text-muted,#718096); }
.subtask-add-row { display:flex; gap:.4rem; margin-top:.5rem; }
.subtask-count { font-size:.75rem; font-weight:400; color:var(--text-muted); margin-left:.3rem; }

/* Card aging */
.card-item.aged-1 { opacity: .82; }
.card-item.aged-2 { opacity: .65; filter: grayscale(15%); }
.card-item.aged-3 { opacity: .45; filter: grayscale(35%); }

/* WIP limit */
.wip-badge { font-size:.68rem; padding:.1rem .45rem; border-radius:10px; background:var(--list-bg,#ebecf0); color:var(--text-muted,#718096); font-weight:600; margin-left:.4rem; white-space:nowrap; flex-shrink:0; }
.wip-badge.wip-exceeded { background:#fed7d7; color:#c53030; }

/* Board template grid */
.template-grid { display:grid; grid-template-columns:repeat(3,1fr); gap:.7rem; }
@media(max-width:480px){ .template-grid{ grid-template-columns:repeat(2,1fr); } }

/* Template upgrade banner */
.tpl-upgrade-banner {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  border-radius: 12px;
  padding: 1.4rem 1.25rem 1.2rem;
  margin-bottom: 1.1rem;
  color: #fff;
  gap: .5rem;
}
.tpl-upgrade-banner__icon {
  width: 46px; height: 46px;
  background: rgba(255,255,255,.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.25rem;
  margin-bottom: .2rem;
}
.tpl-upgrade-banner__title {
  font-weight: 700;
  font-size: .95rem;
  margin: 0;
}
.tpl-upgrade-banner__body {
  font-size: .8rem;
  opacity: .85;
  line-height: 1.5;
  margin: 0;
  max-width: 320px;
}
.tpl-upgrade-banner__btn {
  margin-top: .5rem;
  background: #fff;
  color: #4f46e5;
  border: none;
  border-radius: 7px;
  padding: .45rem 1.2rem;
  font-weight: 700;
  font-size: .82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: opacity .15s, transform .1s;
}
.tpl-upgrade-banner__btn:hover { opacity: .92; transform: translateY(-1px); }

/* ── Tier limit / upgrade modal ───────────────────────── */
.tier-limit-box {
  background: #fff;
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  min-height: unset;
}
.tier-limit-header {
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  padding: 2rem 1.75rem 1.6rem;
  text-align: center;
  color: #fff;
}
.tier-limit-icon {
  width: 54px; height: 54px;
  background: rgba(255,255,255,.18);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 1.4rem;
  margin: 0 auto .85rem;
}
.tier-limit-title {
  margin: 0 0 .45rem;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
}
.tier-limit-body {
  margin: 0;
  font-size: .875rem;
  opacity: .88;
  line-height: 1.5;
  color: #fff;
}
.tier-limit-content {
  padding: 1.25rem 1.5rem 1.5rem;
}
.tier-compare-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .8rem;
  margin-bottom: .25rem;
}
.tier-compare-table thead th {
  padding: .5rem .65rem;
  text-align: center;
  font-weight: 700;
  background: var(--bg, #f4f5f7);
  border-bottom: 2px solid var(--border);
  color: var(--text);
}
.tier-compare-table thead th:first-child { text-align: left; }
.tier-compare-table thead .tier-compare-current {
  background: rgba(79,70,229,.1);
  color: #4f46e5;
}
.tier-compare-table tbody td {
  padding: .4rem .65rem;
  text-align: center;
  border-bottom: 1px solid var(--border);
  color: var(--text);
}
.tier-compare-table tbody td:first-child {
  text-align: left;
  color: var(--text-muted);
  font-size: .78rem;
}
.tier-compare-table tbody tr:last-child td { border-bottom: none; }
.tier-limit-actions {
  display: flex;
  gap: 10px;
  margin-top: 1.1rem;
  justify-content: center;
  flex-wrap: wrap;
}

/* Custom fields in modal */
#custom-fields-section .form-input { font-size:.82rem; padding:.25rem .4rem; }

/* ── Custom Field Manager panel ───────────────────────── */
.cfm-overlay {
  position: fixed; inset: 0; z-index: 1200;
  background: rgba(0,0,0,.45);
  display: flex; align-items: stretch; justify-content: flex-end;
}
.cfm-panel {
  width: 480px; max-width: 96vw;
  background: var(--card-bg, #fff);
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: -8px 0 40px rgba(0,0,0,.18);
  animation: cfm-slide-in .22s ease;
}
@keyframes cfm-slide-in {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.cfm-header {
  display: flex; align-items: center; gap: 12px;
  padding: 18px 22px 16px;
  background: linear-gradient(135deg, #4f46e5 0%, #7c3aed 100%);
  flex-shrink: 0;
}
.cfm-header-icon {
  width: 34px; height: 34px;
  background: rgba(255,255,255,.18); border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; flex-shrink: 0;
}
.cfm-header-text { flex: 1; min-width: 0; }
.cfm-header-text h3 { margin: 0; font-size: .97rem; font-weight: 700; color: #fff; }
.cfm-header-text p  { margin: 2px 0 0; font-size: 11px; color: rgba(255,255,255,.7); }
.cfm-header .btn-icon-close {
  background: rgba(255,255,255,.15); border: none; border-radius: 6px;
  width: 28px; height: 28px; color: rgba(255,255,255,.85);
  font-size: 16px; cursor: pointer; display: flex;
  align-items: center; justify-content: center; flex-shrink: 0;
  transition: background .15s;
}
.cfm-header .btn-icon-close:hover { background: rgba(255,255,255,.28); color: #fff; }
.cfm-body { flex: 1; overflow-y: auto; padding: 20px; }
.cfm-footer { padding: 14px 20px; border-top: 1px solid var(--border); flex-shrink: 0; }

/* Field list */
.cfm-field-list { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.cfm-field-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg, #f8fafc); border: 1px solid var(--border);
  border-radius: 10px; padding: 10px 12px;
  transition: border-color .15s, box-shadow .15s;
}
.cfm-field-row:hover { border-color: var(--primary-light); box-shadow: 0 2px 8px rgba(79,70,229,.08); }
.cfm-field-row.editing { border-color: #4f46e5; box-shadow: 0 0 0 3px rgba(79,70,229,.15); }
.cfm-field-type-icon {
  width: 32px; height: 32px; border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; flex-shrink: 0;
}
.cfm-ft-text     { background: #eff6ff; color: #3b82f6; }
.cfm-ft-number   { background: #f0fdf4; color: #16a34a; }
.cfm-ft-dropdown { background: #fdf4ff; color: #9333ea; }
.cfm-ft-date     { background: #fff7ed; color: #ea580c; }
.cfm-ft-checkbox { background: #f0fdf4; color: #16a34a; }
.cfm-ft-url      { background: #eff6ff; color: #0ea5e9; }
.cfm-ft-email    { background: #fdf4ff; color: #db2777; }
.cfm-ft-phone    { background: #f0fdf4; color: #059669; }
.cfm-ft-rating   { background: #fffbeb; color: #d97706; }
.cfm-ft-progress { background: #eff6ff; color: #4f46e5; }
.cfm-field-info { flex: 1; min-width: 0; }
.cfm-field-name { font-size: 13px; font-weight: 600; color: var(--text); }
.cfm-field-type-badge {
  font-size: 10px; font-weight: 600; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .04em; margin-top: 2px;
}
.cfm-field-actions { display: flex; gap: 4px; flex-shrink: 0; }
.cfm-btn-icon {
  width: 26px; height: 26px; border-radius: 6px; border: none;
  background: transparent; color: var(--text-muted);
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 11px; transition: background .12s, color .12s;
}
.cfm-btn-icon:hover { background: var(--hover-bg); color: var(--text); }
.cfm-btn-icon.danger:hover { background: #fee2e2; color: #dc2626; }

/* Inline edit area */
.cfm-edit-area {
  padding: 12px; margin-top: 8px;
  background: #fff; border: 1px solid var(--border);
  border-radius: 8px; display: flex; flex-direction: column; gap: 10px;
}
.cfm-edit-area .form-group { margin-bottom: 0; }

/* Add field section */
.cfm-add-section { border-top: 1px solid var(--border); padding-top: 18px; }
.cfm-add-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--text-muted); margin-bottom: 12px; }
.cfm-type-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; margin-bottom: 16px; }
.cfm-type-card {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  padding: 10px 4px; border-radius: 9px; border: 2px solid var(--border);
  cursor: pointer; transition: border-color .15s, background .15s;
  background: var(--bg, #f8fafc);
}
.cfm-type-card:hover { border-color: #4f46e5; background: #f5f3ff; }
.cfm-type-card.selected { border-color: #4f46e5; background: #ede9fe; }
.cfm-type-card-icon { width: 28px; height: 28px; border-radius: 7px; display: flex; align-items: center; justify-content: center; font-size: 12px; }
.cfm-type-card-label { font-size: 10px; font-weight: 600; color: var(--text-muted); text-align: center; }
.cfm-type-card.selected .cfm-type-card-label { color: #4f46e5; }

/* Card modal CF enhancements */
.cf-value-row { margin-bottom: 6px; }
.cf-value-label { font-size: 11px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 3px; display: flex; align-items: center; gap: 5px; }
.cf-value-label i { font-size: 10px; }
.cf-rating-wrap { display: flex; gap: 3px; }
.cf-star { font-size: 18px; cursor: pointer; color: var(--border); transition: color .1s; }
.cf-star.lit { color: #f59e0b; }
.cf-star:hover { color: #fbbf24; }
.cf-progress-wrap { display: flex; align-items: center; gap: 8px; }
.cf-progress-bar { flex: 1; height: 8px; background: var(--border); border-radius: 4px; overflow: hidden; }
.cf-progress-fill { height: 100%; background: #4f46e5; border-radius: 4px; transition: width .2s; }
.cf-progress-input { width: 52px; font-size: 12px; }
.cf-url-link { font-size: 12px; color: var(--primary); word-break: break-all; }

/* ═══════════════════════════════════════════════════════
   COLLABORATION — Watch · Vote · Reactions · Presence · Invites
═══════════════════════════════════════════════════════ */

/* Active sidebar button state (watched / voted) */
.sb-btn-active { background: var(--primary-light, rgba(0,82,204,.12)) !important; color: var(--primary, #0052cc) !important; font-weight: 600; }

/* Vote count badge in sidebar */
.vote-count-badge { display:inline-flex; align-items:center; justify-content:center; min-width:18px; height:18px; padding:0 5px; border-radius:10px; background:var(--primary,#0052cc); color:#fff; font-size:.68rem; font-weight:700; margin-left:auto; }

/* Card reactions row in modal */
.card-reactions-row { display:flex; flex-wrap:wrap; gap:.4rem; min-height:28px; margin-bottom:.5rem; }
.reaction-pill { display:inline-flex; align-items:center; gap:.25rem; padding:.2rem .5rem; border-radius:12px; border:1px solid var(--border,#e2e8f0); background:var(--card-bg,#fff); cursor:pointer; font-size:.85rem; transition:border-color .15s,background .15s; }
.reaction-pill:hover { border-color:var(--primary,#0052cc); background:var(--primary-light,rgba(0,82,204,.07)); }
.reaction-pill.reaction-mine { border-color:var(--primary,#0052cc); background:var(--primary-light,rgba(0,82,204,.12)); font-weight:600; }
.reaction-pill span { font-size:.78rem; font-weight:600; color:var(--text-muted); }

/* Reaction picker row */
.reaction-picker-row { display:flex; flex-wrap:wrap; gap:.3rem; }
.reaction-pick-btn { border:none; background:none; font-size:1.2rem; cursor:pointer; border-radius:8px; padding:.2rem .35rem; transition:background .12s; }
.reaction-pick-btn:hover { background:var(--hover-bg,#f4f5f7); }

/* Vote badge on card tile */
.card-vote-badge { display:inline-flex; align-items:center; gap:.2rem; font-size:.7rem; color:var(--text-muted); padding:.1rem .35rem; border-radius:10px; border:1px solid var(--border,#e2e8f0); background:var(--card-bg); }
.card-vote-badge.voted { color:var(--primary,#0052cc); border-color:var(--primary,#0052cc); background:var(--primary-light,rgba(0,82,204,.08)); }

/* Live presence avatars in board header */
.presence-avatars { display:flex; align-items:center; gap:.3rem; }
.presence-label { font-size:.72rem; color:var(--text-muted); white-space:nowrap; }
.presence-avatar { width:28px; height:28px; border-radius:50%; border:2px solid var(--card-bg,#fff); overflow:hidden; background:var(--primary,#0052cc); color:#fff; display:flex; align-items:center; justify-content:center; font-size:.65rem; font-weight:700; flex-shrink:0; margin-left:-6px; box-shadow:0 0 0 2px var(--bg,#f4f5f7); }
.presence-avatar:first-of-type { margin-left:0; }
.presence-avatar img { width:100%; height:100%; object-fit:cover; }

/* Guest invite panel */
.invite-row { display:flex; align-items:center; gap:.6rem; padding:.5rem 0; border-bottom:1px solid var(--border,#e2e8f0); font-size:.83rem; }
.invite-row:last-child { border-bottom:none; }
.invite-email { flex:1; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.invite-status { font-size:.72rem; font-weight:600; padding:.15rem .4rem; border-radius:6px; white-space:nowrap; }
.invite-status.pending  { background:var(--warning-light,#fffbeb); color:#92400e; }
.invite-status.accepted { background:var(--success-light,#f0fdf4); color:#166534; }
.invite-status.expired  { background:var(--border,#e2e8f0); color:var(--text-muted); }
.invite-revoke { background:none; border:none; cursor:pointer; color:var(--text-muted); font-size:13px; padding:2px 5px; border-radius:4px; }
.invite-revoke:hover { color:var(--danger,#e53e3e); background:rgba(229,62,62,.1); }

/* ═══════════════════════════════════════════════════════
   UX / POLISH — Density · Bulk · Markdown · Board BG · Sidebar
═══════════════════════════════════════════════════════ */

/* ── Density levels ─────────────────────────────────── */
body[data-density="compact"]     { --card-v-pad: 6px; --card-h-pad: 8px; --card-gap: 4px; --card-fs: 12.5px; --list-w: 260px; }
body[data-density="comfortable"] { --card-v-pad: 10px; --card-h-pad: 12px; --card-gap: 6px; --card-fs: 14px; --list-w: 280px; }
body[data-density="spacious"]    { --card-v-pad: 16px; --card-h-pad: 16px; --card-gap: 10px; --card-fs: 14.5px; --list-w: 310px; }

.todo-card { padding: var(--card-v-pad, 10px) var(--card-h-pad, 12px); font-size: var(--card-fs, 14px); }
.list-col { width: var(--list-w, 280px); min-width: var(--list-w, 280px); }
.list-cards { gap: var(--card-gap, 6px); }

/* ── Collapsible sidebar sections ───────────────────── */
.sidebar-label-toggle { cursor: pointer; display: flex; align-items: center; justify-content: space-between; user-select: none; }
.sidebar-label-toggle:hover { opacity: .85; }
.sidebar-chevron { font-size: 10px; transition: transform .2s; flex-shrink: 0; }
.sidebar-section-body { overflow: hidden; transition: max-height .25s ease, opacity .2s; max-height: 500px; opacity: 1; }
.sidebar-section-body.sb-hidden { max-height: 0 !important; opacity: 0; }

/* ── Bulk card selection ────────────────────────────── */
.bulk-cb-wrap { position: absolute; top: 6px; left: 6px; z-index: 2; }
.bulk-cb { width: 16px; height: 16px; cursor: pointer; accent-color: var(--primary); }
.todo-card.bulk-selectable { position: relative; cursor: pointer; padding-left: 28px !important; }
.todo-card.bulk-selected { outline: 2px solid var(--primary); background: var(--primary-light, rgba(0,82,204,.07)); }

/* Floating bulk action bar */
.bulk-bar { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--text, #172b4d); color: #fff; border-radius: 10px; box-shadow: var(--shadow-lg); z-index: 5000; flex-wrap: wrap; max-width: 90vw; }
.bulk-count { font-weight: 700; font-size: 13px; white-space: nowrap; }
.bulk-actions { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.bulk-select-input { font-size: 12px; padding: 4px 6px; border-radius: 4px; border: none; background: rgba(255,255,255,.15); color: #fff; cursor: pointer; }
.bulk-select-input option { color: var(--text); background: #fff; }
.bulk-bar .btn { font-size: 12px; padding: 5px 10px; background: rgba(255,255,255,.15); color: #fff; border-radius: 4px; }
.bulk-bar .btn:hover { background: rgba(255,255,255,.28); }
.bulk-bar .btn-danger { background: rgba(235,90,70,.6); }
.bulk-bar .btn-danger:hover { background: rgba(235,90,70,.9); }
.bulk-exit-btn { background: none; border: none; color: rgba(255,255,255,.6); font-size: 18px; cursor: pointer; margin-left: 4px; line-height: 1; }
.bulk-exit-btn:hover { color: #fff; }

/* ── Markdown description area ──────────────────────── */
.desc-preview-area { min-height: 48px; cursor: text; padding: 8px 4px; border-radius: 4px; transition: background .15s; }
.desc-preview-area:hover { background: var(--hover-bg, #f4f5f7); }
.markdown-body h1,.markdown-body h2,.markdown-body h3 { margin: .6em 0 .3em; font-weight: 700; }
.markdown-body h1 { font-size: 1.3em; }
.markdown-body h2 { font-size: 1.15em; }
.markdown-body h3 { font-size: 1.05em; }
.markdown-body p  { margin: .4em 0; line-height: 1.55; }
.markdown-body ul,.markdown-body ol { margin: .4em 0 .4em 1.4em; }
.markdown-body li { margin: .2em 0; }
.markdown-body code { background: var(--list-bg); padding: .1em .35em; border-radius: 3px; font-family: monospace; font-size: .88em; }
.markdown-body pre { background: var(--list-bg); padding: 10px 12px; border-radius: 6px; overflow-x: auto; margin: .5em 0; }
.markdown-body pre code { background: none; padding: 0; }
.markdown-body blockquote { border-left: 3px solid var(--primary); padding: .2em .8em; color: var(--text-muted); margin: .4em 0; }
.markdown-body strong { font-weight: 700; }
.markdown-body em { font-style: italic; }
.markdown-body a { color: var(--primary); }
.markdown-body hr { border: none; border-top: 1px solid var(--border); margin: .8em 0; }
.desc-toggle-btn { font-size: 11px; padding: 2px 8px; border: 1px solid var(--border); border-radius: 4px; background: var(--list-bg); color: var(--text-muted); cursor: pointer; }
.desc-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }

/* ── Board background picker ────────────────────────── */
.bg-swatch-grid { display: flex; flex-wrap: wrap; gap: 8px; }
.bg-swatch { width: 42px; height: 32px; border-radius: 6px; cursor: pointer; display: flex; align-items: center; justify-content: center; border: 2px solid transparent; transition: transform .15s, border-color .15s; }
.bg-swatch:hover { transform: scale(1.1); }
.bg-swatch-active { border-color: var(--primary) !important; box-shadow: 0 0 0 2px white, 0 0 0 4px var(--primary); }

/* Board wrapper respects background — same transition for the table /
   calendar / timeline / generic view containers so a custom background
   applied via applyBoardBackground() animates smoothly across views. */
.board-wrapper,
.view-wrapper,
.table-view,
.calendar-view,
.timeline-view { transition: background .3s; }

/* ── Board automations panel ─────────────────────────────────────────
   One scrollable panel grouped into sections. Each rule is a card with
   icon + title + description on the left, the controls on the right.
─────────────────────────────────────────────────────────────────── */
.auto-modal-body { max-height: 70vh; overflow-y: auto; }
.auto-section-title {
  font-size: 11px; font-weight: 700; color: var(--text-muted);
  text-transform: uppercase; letter-spacing: .5px;
  margin: 14px 0 6px; padding-bottom: 4px; border-bottom: 1px solid var(--border);
}
.auto-section-title:first-of-type { margin-top: 0; }
.auto-rule {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 12px 4px; border-bottom: 1px solid var(--border);
}
.auto-rule:last-child { border-bottom: none; }
.auto-rule-head { display: flex; gap: 10px; flex: 1; min-width: 0; align-items: flex-start; }
.auto-rule-icon { color: var(--primary); margin-top: 2px; width: 16px; flex-shrink: 0; text-align: center; }
.auto-rule-text { flex: 1; min-width: 0; }
.auto-rule-title { font-size: 13px; font-weight: 600; color: var(--text); }
.auto-rule-desc { font-size: 11px; color: var(--text-muted); margin-top: 2px; line-height: 1.4; }
.auto-rule-body { flex-shrink: 0; }
.auto-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.auto-toggle {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  font-size: 12px; color: var(--text-secondary, var(--text-muted));
}
.auto-toggle input { cursor: pointer; }
.auto-select {
  font-size: 12px; padding: 4px 6px;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--text); min-width: 130px; max-width: 180px;
}
.auto-num {
  font-size: 12px; padding: 4px 6px; width: 70px; text-align: center;
  border: 1px solid var(--border); border-radius: var(--radius);
  background: #fff; color: var(--text);
}
.auto-advanced-link {
  margin-top: 16px; padding-top: 14px;
  border-top: 1px dashed var(--border);
  text-align: center;
}
.auto-advanced-link .btn-link {
  background: none; border: none; cursor: pointer;
  color: var(--primary); font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; gap: 6px;
}
.auto-advanced-link .btn-link:hover { text-decoration: underline; }
.auto-advanced-help {
  font-size: 11px; color: var(--text-muted); margin-top: 4px; line-height: 1.4;
}

/* ── Density toggle popup (reuses theme-picker-popup styles) ── */
.btn-active { background: var(--primary-light, rgba(0,82,204,.12)); color: var(--primary); }

/* ═══════════════════════════════════════════════════════
   ROLES & PERMISSIONS
═══════════════════════════════════════════════════════ */

/* ── Role badges ───────────────────────────────────── */
.role-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border-radius: 20px;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: .3px;
  white-space: nowrap;
}
.role-badge.role-admin  { background: #ebf3ff; color: #0052cc; border: 1px solid #b3d4ff; }
.role-badge.role-editor { background: #e6fcf0; color: #0a7040; border: 1px solid #a3e6c4; }
.role-badge.role-viewer { background: #f3f0ff; color: #5e35b1; border: 1px solid #c5b3ff; }

/* ── Viewer mode badge in board header ─────────────── */
.viewer-mode-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  background: #fff8e1;
  color: #b45309;
  border: 1px solid #fcd34d;
  margin-left: 4px;
}

/* ── Role select dropdown in company members table ─── */
.role-select {
  font-size: 12px;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--card-bg, #fff);
  color: var(--text);
  cursor: pointer;
  transition: border-color .15s;
}
.role-select:focus { outline: none; border-color: var(--primary-light); }
.role-select:hover { border-color: var(--primary); }

/* ── Role legend card ──────────────────────────────── */
.role-legend-card { margin-top: 16px; }
.role-legend { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.role-legend-row {
  display: flex;
  align-items: center;
  gap: 12px;
}
.role-legend-row .role-badge { min-width: 80px; justify-content: center; }
.role-legend-desc { font-size: 13px; color: var(--text-muted); }

/* ── Profile role row ──────────────────────────────── */
.profile-role-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--bg, #f4f5f7);
  border-radius: 8px;
  margin-bottom: 16px;
  border: 1px solid var(--border);
}
.profile-role-label { font-size: 12px; font-weight: 600; color: var(--text-muted); }
.profile-role-desc  { font-size: 12px; color: var(--text-muted); }

/* ── "you" tag in member list ──────────────────────── */
.role-you-tag { font-size: 11px; color: var(--text-muted); font-weight: 400; }

/* ═══════════════════════════════════════════════════════
   ROLE MANAGER — permission matrix
═══════════════════════════════════════════════════════ */
.rm-modal { max-width: 680px; width: 96%; }

.rm-modal .modal-header {
  align-items: flex-start;
  padding: 1.1rem 1.25rem .9rem;
}
.rm-modal .modal-header h2 { font-size: 1rem; margin-bottom: 2px; }
.rm-subtitle { font-size: 12.5px; color: var(--text-muted); margin: 0; }

.rm-table-wrap {
  overflow-y: auto;
  max-height: calc(100vh - 240px);
  padding: 0 1.25rem;
}

/* Table */
.rm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.rm-table thead th {
  position: sticky;
  top: 0;
  background: var(--bg, #f4f5f7);
  padding: 10px 8px;
  border-bottom: 2px solid var(--border);
  font-weight: 600;
  white-space: nowrap;
  z-index: 2;
}
.rm-th-perm  { text-align: left; min-width: 220px; }
.rm-th-role  { text-align: center; width: 96px; }
.rm-th-admin { opacity: .65; }

/* Group rows */
.rm-group-header td {
  padding: 8px 6px 5px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .5px;
  text-transform: uppercase;
  color: var(--text-muted);
  background: var(--bg, #f4f5f7);
  cursor: pointer;
  user-select: none;
  border-bottom: 1px solid var(--border);
}
.rm-group-header:hover td { color: var(--primary); }
.rm-group-chevron { margin-right: 6px; transition: transform .2s; }
.rm-group.rm-group-collapsed .rm-group-chevron { transform: rotate(-90deg); }
.rm-group.rm-group-collapsed .rm-row { display: none; }

/* Permission rows */
.rm-row:hover td { background: rgba(9,30,66,.04); }
.rm-perm-label {
  padding: 7px 8px;
  color: var(--text);
  border-bottom: 1px solid var(--border);
}
.rm-cell {
  text-align: center;
  padding: 7px 4px;
  border-bottom: 1px solid var(--border);
}
.rm-admin-check { color: #0052cc; font-size: 14px; opacity: .5; }

/* Custom checkbox */
.rm-cb-wrap { display: inline-flex; align-items: center; cursor: pointer; }
.rm-cb-wrap input[type="checkbox"] { display: none; }
.rm-cb-custom {
  width: 18px; height: 18px;
  border: 2px solid var(--border);
  border-radius: 4px;
  background: var(--card-bg, #fff);
  transition: background .15s, border-color .15s;
  position: relative;
  display: flex; align-items: center; justify-content: center;
}
.rm-cb-wrap input:checked + .rm-cb-custom {
  background: var(--primary, #0052cc);
  border-color: var(--primary, #0052cc);
}
.rm-cb-wrap input:checked + .rm-cb-custom::after {
  content: '';
  width: 5px; height: 9px;
  border: 2px solid #fff;
  border-top: none; border-left: none;
  transform: rotate(45deg) translate(-1px, -1px);
  display: block;
}
.rm-cb-wrap:hover .rm-cb-custom { border-color: var(--primary-light); }

/* Footer */
.rm-footer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 1.25rem;
  border-top: 1px solid var(--border);
  background: var(--bg, #f4f5f7);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.btn-danger-outline {
  background: transparent;
  color: #d00;
  border: 1px solid #d00;
  border-radius: var(--radius);
  padding: 5px 12px;
  font-size: 12.5px;
  cursor: pointer;
  transition: background .15s;
}
.btn-danger-outline:hover { background: #fff0f0; }

/* ══════════════════════════════════════════════════════
   ADMIN PANEL
══════════════════════════════════════════════════════ */
.sidebar-link-admin {
  color: #ffd700 !important;
  font-weight: 600;
}
.sidebar-link-admin i { color: #ffd700; }
.sidebar-link-admin.active,
.sidebar-link-admin:hover { background: rgba(255,215,0,.12) !important; }

.admin-wrap {
  padding: 1.5rem 2rem;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}
.admin-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 1.25rem;
}
.admin-title {
  margin: 0;
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text, #172b4d);
  display: flex;
  align-items: center;
  gap: 8px;
}
.admin-superadmin-badge {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  color: #fff;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .04em;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Tabs */
.admin-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border, #dfe1e6);
  margin-bottom: 1.5rem;
  overflow-x: auto;
}
.admin-tab {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted, #6b778c);
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  transition: color .15s, border-color .15s;
}
.admin-tab:hover { color: var(--primary, #0052cc); }
.admin-tab.active { color: var(--primary, #0052cc); border-bottom-color: var(--primary, #0052cc); }

/* Content */
.admin-content { min-height: 300px; }
.admin-loading { display: flex; align-items: center; justify-content: center; padding: 3rem; }
.admin-error { color: #d00; padding: 1rem; background: #fff0f0; border-radius: var(--radius); }
.admin-empty { color: var(--text-muted, #6b778c); padding: 2rem; text-align: center; font-size: 14px; }

/* Stats grid */
.admin-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}
.admin-stat-card {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius-lg, 8px);
  padding: 1.25rem 1rem;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
  transition: box-shadow .15s, transform .15s;
}
.admin-stat-card:hover { box-shadow: 0 4px 12px rgba(0,0,0,.1); }
.admin-stat-card--link { cursor: pointer; }
.admin-stat-card--link:hover { box-shadow: 0 4px 16px rgba(0,0,0,.15); transform: translateY(-1px); }
.admin-stat-icon { font-size: 1.6rem; margin-bottom: .4rem; }
.admin-stat-value { font-size: 2rem; font-weight: 800; color: var(--text, #172b4d); line-height: 1; }
.admin-stat-label { font-size: 11.5px; color: var(--text-muted, #6b778c); margin-top: .3rem; font-weight: 500; }

/* ── Revenue Dashboard ─────────────────────────────── */
.rev-dashboard { padding: 0 0 40px; }

.rev-period-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 14px 0 18px;
  border-bottom: 1px solid var(--border, #dfe1e6);
  margin-bottom: 24px;
}
.rev-period-btn {
  padding: 5px 14px;
  border-radius: 20px;
  border: 1.5px solid var(--border, #dfe1e6);
  background: #fff;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text, #172b4d);
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.rev-period-btn:hover  { border-color: var(--primary, #0052cc); color: var(--primary, #0052cc); }
.rev-period-btn.active {
  background: var(--primary, #0052cc);
  border-color: var(--primary, #0052cc);
  color: #fff;
}
.rev-period-range {
  margin-left: auto;
  font-size: 12px;
  color: var(--text-muted, #6b778c);
}
.rev-custom-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  padding: 12px 16px;
  background: #f8faff;
  border: 1px solid var(--border, #dfe1e6);
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
}

.rev-section { margin-bottom: 32px; }
.rev-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text-muted, #6b778c);
  text-transform: uppercase;
  letter-spacing: .6px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  gap: 7px;
}

/* KPI cards row */
.rev-kpi-row {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
}
.rev-kpi-card {
  background: #fff;
  border: 1px solid var(--border, #dfe1e6);
  border-radius: 10px;
  padding: 18px 20px 14px;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.rev-kpi-icon  { font-size: 22px; margin-bottom: 8px; }
.rev-kpi-value { font-size: 28px; font-weight: 800; color: var(--text, #172b4d); line-height: 1.1; }
.rev-kpi-label { font-size: 11.5px; font-weight: 600; color: var(--text-muted, #6b778c); margin-top: 4px; }
.rev-kpi-note  { font-size: 11px; color: var(--text-muted, #6b778c); margin-top: 6px; line-height: 1.4; }

/* Monthly bar chart */
.rev-chart {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  height: 140px;
  padding: 0 4px;
}
.rev-bar-col {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  height: 100%;
}
.rev-bar-label-top {
  font-size: 10px;
  color: var(--text-muted, #6b778c);
  text-align: center;
  flex-shrink: 0;
  min-height: 14px;
}
.rev-bar-track {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: flex-end;
  background: #f4f5f7;
  border-radius: 4px 4px 0 0;
  overflow: hidden;
}
.rev-bar-fill {
  width: 100%;
  background: var(--primary, #0052cc);
  border-radius: 3px 3px 0 0;
  min-height: 3px;
  opacity: .85;
  transition: height .3s ease;
}
.rev-bar-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted, #6b778c);
  white-space: nowrap;
}

.text-right { text-align: right; }

/* Toolbar */
.admin-toolbar { margin-bottom: .75rem; }
.admin-search-input {
  width: 100%;
  max-width: 360px;
  padding: 7px 12px;
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--card-bg, #fff);
  color: var(--text, #172b4d);
}
.admin-search-input:focus { outline: none; border-color: var(--primary, #0052cc); box-shadow: 0 0 0 2px rgba(0,82,204,.18); }

/* Table */
.admin-table-wrap { overflow-x: auto; }
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  background: var(--card-bg, #fff);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.admin-table th {
  background: var(--bg, #f4f5f7);
  padding: 8px 12px;
  text-align: left;
  font-weight: 700;
  color: var(--text-muted, #6b778c);
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-bottom: 1px solid var(--border, #dfe1e6);
}
.admin-table td {
  padding: 9px 12px;
  border-bottom: 1px solid var(--border, #dfe1e6);
  color: var(--text, #172b4d);
  vertical-align: middle;
}
.admin-table tbody tr:last-child td { border-bottom: none; }
.admin-table tbody tr:hover td { background: var(--bg, #f4f5f7); }
.admin-cell-muted { color: var(--text-muted, #6b778c); font-size: 12px; }
.admin-cell-center { text-align: center; }

/* User avatar in table */
.admin-user-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  object-fit: cover;
  vertical-align: middle;
  margin-right: 6px;
}
.admin-user-avatar-initials {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary, #0052cc);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
}

/* Badges */
.admin-badge {
  display: inline-block;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .02em;
}
.admin-badge-green  { background: #e3fcef; color: #006644; }
.admin-badge-red    { background: #ffebe6; color: #bf2600; }
.admin-badge-purple { background: #f3e8ff; color: #5b21b6; }

/* Shared small button */
.btn-sm {
  padding: 5px 12px;
  font-size: 12.5px;
  border-radius: var(--radius);
  border: 1px solid var(--border, #dfe1e6);
  background: var(--card-bg, #fff);
  color: var(--text, #172b4d);
  cursor: pointer;
  transition: background .15s;
}
.btn-sm:hover:not(:disabled) { background: var(--bg, #f4f5f7); }
.btn-sm:disabled { opacity: .4; cursor: not-allowed; }

/* Action buttons */
.admin-actions { display: flex; gap: 4px; flex-wrap: wrap; }
.btn-xs {
  background: var(--bg, #f4f5f7);
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius);
  padding: 4px 8px;
  font-size: 11.5px;
  cursor: pointer;
  color: var(--text, #172b4d);
  transition: background .15s;
}
.btn-xs:hover { background: #e4e6ea; }
.btn-xs-danger { border-color: #ffbdad; color: #bf2600; background: #fff8f6; }
.btn-xs-danger:hover { background: #ffebe6; }

/* Pagination */
.admin-pagination {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-content: center;
  margin-top: 1rem;
}
.admin-page-info { font-size: 13px; color: var(--text-muted, #6b778c); }

/* Activity */
.admin-activity-list { display: flex; flex-direction: column; gap: 0; }
.admin-activity-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border, #dfe1e6);
  font-size: 13px;
}
.admin-activity-row:last-child { border-bottom: none; }
.admin-activity-avatar { flex-shrink: 0; margin-top: 2px; }
.admin-activity-body { flex: 1; line-height: 1.6; }
.admin-activity-user { font-weight: 700; color: var(--text, #172b4d); margin-right: 4px; }
.admin-activity-action { color: var(--text-muted, #6b778c); margin-right: 4px; }
.admin-activity-board {
  background: var(--primary-light, #4c9aff);
  color: #fff;
  padding: 1px 6px;
  border-radius: 4px;
  font-size: 11px;
  margin-right: 4px;
}
.admin-activity-card { color: var(--text, #172b4d); font-style: italic; margin-right: 4px; }
.admin-activity-detail { color: var(--text-muted, #6b778c); font-size: 12px; }
.admin-activity-when { font-size: 11px; color: var(--text-muted, #6b778c); white-space: nowrap; margin-left: auto; }
.admin-activity-more { text-align: center; padding: 1rem 0; }

/* Settings */
.admin-settings-form {
  background: var(--card-bg, #fff);
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.admin-setting-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 14px 1.25rem;
  border-bottom: 1px solid var(--border, #dfe1e6);
}
.admin-setting-row:last-child { border-bottom: none; }
.admin-setting-textarea-row { align-items: flex-start; }
.admin-setting-info { flex: 1; }
.admin-setting-label { font-weight: 600; font-size: 13.5px; color: var(--text, #172b4d); }
.admin-setting-desc { font-size: 12px; color: var(--text-muted, #6b778c); margin-top: 2px; }
.admin-setting-input {
  width: 160px;
  padding: 6px 10px;
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg, #f4f5f7);
  color: var(--text, #172b4d);
  flex-shrink: 0;
}
.admin-setting-input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,82,204,.18); }
.admin-setting-textarea {
  width: 340px;
  min-height: 72px;
  padding: 6px 10px;
  border: 1px solid var(--border, #dfe1e6);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg, #f4f5f7);
  color: var(--text, #172b4d);
  resize: vertical;
  flex-shrink: 0;
}
.admin-setting-textarea:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 2px rgba(0,82,204,.18); }
.admin-settings-footer {
  padding: 12px 1.25rem;
  display: flex;
  justify-content: flex-end;
  background: var(--bg, #f4f5f7);
}
.admin-settings-section-divider {
  padding: 12px 1.25rem 10px;
  font-size: 12px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .06em;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 4px;
}
.admin-settings-section-divider i {
  color: var(--primary);
  font-size: 13px;
}
.admin-settings-section-desc {
  padding: 0 1.25rem 10px;
  font-size: 12px;
  color: var(--text-muted);
}

/* Toggle switch */
.admin-toggle { position: relative; display: inline-block; width: 40px; height: 22px; flex-shrink: 0; }
.admin-toggle input { opacity: 0; width: 0; height: 0; }
.admin-toggle-slider {
  position: absolute; inset: 0;
  background: #ccc;
  border-radius: 22px;
  cursor: pointer;
  transition: background .2s;
}
.admin-toggle-slider::before {
  content: '';
  position: absolute;
  width: 16px; height: 16px;
  left: 3px; top: 3px;
  background: #fff;
  border-radius: 50%;
  transition: transform .2s;
}
.admin-toggle input:checked + .admin-toggle-slider { background: var(--primary, #0052cc); }
.admin-toggle input:checked + .admin-toggle-slider::before { transform: translateX(18px); }

/* Role legend header */
.role-legend-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.role-legend-header h3 { margin: 0; }

/* ──────────────────────────────────────────────────────
   CRM & INVOICING
────────────────────────────────────────────────────── */

/* Shared table */
.crm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.crm-table th {
  text-align: left;
  padding: 8px 10px;
  font-weight: 600;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  background: var(--bg-secondary);
}
.crm-table td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.crm-table tr:hover td { background: var(--hover-bg); }
.crm-table a { color: var(--primary); text-decoration: none; }
.crm-table a:hover { text-decoration: underline; }

/* Customer type badge */
.crm-type-badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.crm-type-person  { background: #dbeafe; color: #1d4ed8; }
.crm-type-company { background: #fef3c7; color: #92400e; }

/* Small danger button */
.btn-danger-sm {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--danger, #dc2626);
}
.btn-danger-sm:hover { background: #fef2f2; border-color: #dc2626; }

/* Customer chip in card modal */
.customer-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
}
.customer-chip-remove {
  cursor: pointer;
  margin-left: 2px;
  opacity: .6;
  font-size: 14px;
  line-height: 1;
}
.customer-chip-remove:hover { opacity: 1; }

/* Invoice status badges */
.inv-status {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.inv-status-draft      { background: #f3f4f6; color: #6b7280; }
.inv-status-sent       { background: #dbeafe; color: #1d4ed8; }
.inv-status-paid       { background: #dcfce7; color: #15803d; }
.inv-status-cancelled  { background: #fee2e2; color: #dc2626; }

/* Invoice tabs */
.inv-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 2px solid var(--border);
  margin-bottom: 16px;
}
.inv-tab {
  background: none;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -2px;
  transition: color .15s, border-color .15s;
}
.inv-tab:hover { color: var(--text); }
.inv-tab.active { color: var(--primary); border-color: var(--primary); }
.inv-tab-content { min-height: 200px; }

/* Invoice summary cards */
.inv-summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 12px;
}
.inv-sum-card {
  border-radius: 10px;
  padding: 14px 16px;
  border: 1px solid transparent;
}
.inv-sum-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; opacity: .7; margin-bottom: 6px; }
.inv-sum-value { font-size: 22px; font-weight: 700; }
.inv-sum-draft       { background: #f9fafb; border-color: #e5e7eb; color: #374151; }
.inv-sum-invoiced    { background: #eff6ff; border-color: #bfdbfe; color: #1d4ed8; }
.inv-sum-paid        { background: #f0fdf4; border-color: #bbf7d0; color: #15803d; }
.inv-sum-outstanding { background: #fffbeb; border-color: #fde68a; color: #92400e; }

/* ── Online presence sidebar panel ────────────────────── */
.online-user-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 12px; border-radius: 6px;
  transition: background .12s;
}
.online-user-item:hover { background: var(--hover-bg); }
.online-avatar-wrap {
  position: relative; flex-shrink: 0;
}
.online-avatar {
  width: 28px; height: 28px;
  border-radius: 50%; object-fit: cover;
  display: block;
}
.online-avatar-init {
  background: var(--primary); color: #fff;
  font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
}
.online-dot {
  position: absolute; bottom: 0; right: 0;
  width: 9px; height: 9px; border-radius: 50%;
  background: #22c55e;
  border: 2px solid var(--sidebar-bg, #fff);
}
.online-user-info { min-width: 0; }
.online-user-name {
  font-size: 13px; font-weight: 600;
  color: rgba(255,255,255,.92); white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis;
}
.online-user-activity {
  font-size: 11px; color: rgba(255,255,255,.55);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.online-empty {
  padding: 8px 12px;
  font-size: 12px; color: rgba(255,255,255,.5);
}

/* ── Contact card online presence indicator ─────────── */
.contact-avatar-wrap {
  position: relative; flex-shrink: 0;
}
.contact-avatar-wrap .online-dot {
  border-color: #fff;
  width: 11px; height: 11px;
}

/* ── File Manager ───────────────────────────────────────── */
.fm-toolbar {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 16px; flex-wrap: wrap;
}
.fm-stats {
  font-size: 13px; color: var(--text-muted); white-space: nowrap;
}
.fm-loading {
  text-align: center; padding: 48px; color: var(--text-muted); font-size: 20px;
}
.fm-table {
  width: 100%; border-collapse: collapse;
  background: var(--card-bg); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); overflow: hidden;
}
.fm-table thead th {
  background: var(--list-bg); font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: .6px;
  color: var(--text-muted); padding: 10px 12px;
  text-align: left; white-space: nowrap;
}
.fm-table tbody tr {
  border-top: 1px solid var(--border);
  transition: background .1s;
}
.fm-table tbody tr:hover { background: rgba(0,0,0,.03); }
.fm-table td { padding: 10px 12px; font-size: 13px; vertical-align: middle; }
.fm-check-col { width: 36px; text-align: center; }
.fm-name-cell {
  display: flex; align-items: center; gap: 8px;
  max-width: 280px;
}
.fm-name-cell a {
  color: var(--primary); font-weight: 500;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  max-width: 220px; display: block;
}
.fm-name-cell a:hover { text-decoration: underline; }
.fm-mime-icon { color: var(--text-muted); font-size: 15px; flex-shrink: 0; }
.fm-embedded-badge {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px; border-radius: 99px;
  background: #fef3c7; color: #92400e;
  font-size: 11px; font-weight: 600;
  white-space: nowrap; flex-shrink: 0;
  cursor: help;
}
.fm-embedded-badge i { font-size: 9px; }
.fm-muted { color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 180px; }
.fm-size  { color: var(--text); white-space: nowrap; font-variant-numeric: tabular-nums; }
.fm-date  { font-size: 12px; }
.fm-action-col { width: 44px; text-align: center; }
.fm-delete-btn {
  width: 30px; height: 30px; border-radius: var(--radius);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-muted); transition: background .12s, color .12s;
  background: none; border: none; cursor: pointer;
}
.fm-delete-btn:hover { background: rgba(235,90,70,.12); color: var(--danger); }

/* ── Styled modal header + body ────────────────────────── */
.modal-accent-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 22px 16px;
  background: linear-gradient(135deg, var(--primary) 0%, #5b6af0 100%);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
}
.modal-accent-header.accent-teal {
  background: linear-gradient(135deg, #0891b2 0%, #0e7490 100%);
}
.modal-accent-header.accent-violet {
  background: linear-gradient(135deg, #7c3aed 0%, #6d28d9 100%);
}
.modal-accent-header.accent-amber {
  background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
}
.modal-accent-header.accent-indigo {
  background: linear-gradient(135deg, #4f46e5 0%, #3730a3 100%);
}

/* ── Automations modal ─────────────────────────────────── */
.auto-count-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px;
  background: rgba(255,255,255,.22); border-radius: 10px;
  font-size: 11px; font-weight: 700; color: #fff; margin-left: 6px;
}
.auto-list-wrap {
  padding: 1rem 1.2rem;
  max-height: 360px; overflow-y: auto;
}
.auto-empty-state {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 2rem 1rem; color: var(--text-muted); font-size: .9rem; text-align: center;
}
.auto-card {
  display: flex; align-items: center; gap: .65rem;
  padding: .7rem .85rem;
  border: 1px solid var(--border);
  border-radius: 10px;
  margin-bottom: .55rem;
  background: var(--card-bg, #fff);
  transition: box-shadow .15s, opacity .15s, border-color .15s;
}
.auto-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  border-color: rgba(0,82,204,.15);
}
.auto-card-inactive {
  opacity: .5;
}
.auto-card-inactive:hover { opacity: .75; }
.auto-card-body {
  flex: 1; min-width: 0;
}
.auto-card-name {
  font-weight: 600; font-size: .85rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 4px;
}
.auto-card-flow {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.auto-chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: .72rem; font-weight: 500;
  padding: 2px 8px; border-radius: 6px;
  white-space: nowrap;
}
.auto-chip i { font-size: .65rem; }
.auto-chip-trigger {
  background: #dbeafe; color: #1e40af;
}
.auto-chip-action {
  background: #dcfce7; color: #166534;
}
.auto-flow-arrow {
  font-size: .6rem; color: var(--text-muted); flex-shrink: 0;
}
.auto-delete-btn {
  background: none; border: none; cursor: pointer;
  width: 30px; height: 30px; border-radius: 6px;
  display: flex; align-items: center; justify-content: center;
  color: #aaa; font-size: .8rem; flex-shrink: 0;
  transition: background .15s, color .15s;
}
.auto-delete-btn:hover {
  background: rgba(239,68,68,.1); color: #ef4444;
}
.auto-add-section {
  padding: .8rem 1.2rem;
  border-top: 1px solid var(--border);
}
.auto-add-toggle-btn {
  display: flex; align-items: center; gap: 6px;
  width: 100%; padding: .6rem 0;
  background: none; border: none; cursor: pointer;
  font-size: .88rem; font-weight: 600; color: var(--primary);
  transition: opacity .15s;
}
.auto-add-toggle-btn:hover { opacity: .75; }
.auto-add-form {
  padding-top: .6rem;
}
.auto-form-grid {
  display: flex; flex-direction: column; gap: .7rem;
}
.auto-form-row {
  display: flex; gap: .65rem; flex-wrap: wrap;
}
.auto-form-label {
  font-size: .78rem; font-weight: 600;
  margin-bottom: 4px; display: block; color: var(--text);
}
.auto-form-actions {
  display: flex; justify-content: flex-end; gap: .5rem;
  margin-top: .8rem; padding-top: .7rem;
  border-top: 1px solid var(--border);
}
.modal-accent-header h3 {
  margin: 0;
  font-size: .97rem;
  font-weight: 700;
  color: #fff;
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header-icon {
  width: 30px; height: 30px;
  background: rgba(255,255,255,.18);
  border-radius: 8px;
  display: flex; align-items: center; justify-content: center;
  font-size: 13px; color: #fff; flex-shrink: 0;
}
.modal-accent-header .btn-modal-close {
  background: rgba(255,255,255,.15);
  border: none; border-radius: 6px;
  color: rgba(255,255,255,.85);
  width: 28px; height: 28px;
  font-size: 18px; line-height: 1;
  cursor: pointer; display: flex;
  align-items: center; justify-content: center;
  transition: background .15s;
}
.modal-accent-header .btn-modal-close:hover {
  background: rgba(255,255,255,.28); color: #fff;
}
.modal-body {
  padding: 22px 24px 20px;
  background: #fff;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
}
.modal-body .form-group { margin-bottom: 14px; }
.modal-body .profile-section-title { margin-top: 6px; }
.modal-footer {
  display: flex; gap: 8px;
  justify-content: flex-end;
  margin-top: 18px; padding-top: 16px;
  border-top: 1px solid var(--border);
}
.profile-three-col {
  display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px;
}
@media (max-width: 520px) {
  .profile-three-col { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   STORAGE METER (card detail panel)
══════════════════════════════════════════════════════ */
.storage-meter-wrap {
  margin: 6px 0 4px;
  font-size: 12px;
  color: var(--text-muted);
}
.storage-meter-bar {
  height: 6px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 3px;
}
.storage-meter-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width .3s;
}
.storage-meter-fill--mid  { background: #f59e0b; }
.storage-meter-fill--warn { background: #ef4444; }

/* ══════════════════════════════════════════════════════
   ATTACHMENT LINK BADGE
══════════════════════════════════════════════════════ */
.attachment-link-badge {
  display: inline-flex; align-items: center; gap: 4px;
  background: #ede9fe; color: #7c3aed;
  border-radius: 4px;
  padding: 2px 7px;
  font-size: 11px; font-weight: 600;
}
.attachment-link-badge i { font-size: 10px; }

/* ══════════════════════════════════════════════════════
   ATTACHMENT ACTION ROW
══════════════════════════════════════════════════════ */
.attach-action-row {
  display: flex; gap: 8px; flex-wrap: wrap;
  margin: 4px 0 8px;
}
.attach-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  background: var(--primary);
  color: #fff;
  border: none; border-radius: var(--radius);
  font-size: 13px; font-weight: 500;
  cursor: pointer;
  transition: background .15s;
}
.attach-btn:hover { background: var(--primary-dark); }
.attach-btn--secondary {
  background: var(--bg, #f4f5f7);
  color: var(--text);
  border: 1px solid var(--border);
}
.attach-btn--secondary:hover { background: var(--border); }
.attach-link-input {
  width: 100%;
  padding: 6px 10px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  background: var(--bg);
  color: var(--text);
  box-sizing: border-box;
  margin-bottom: 4px;
}
.attach-link-input:focus { outline: none; border-color: var(--primary); }

/* ══════════════════════════════════════════════════════
   STORAGE LIMIT POPUP
══════════════════════════════════════════════════════ */
.storage-limit-overlay {
  position: fixed; inset: 0; z-index: 9999;
  background: rgba(0,0,0,.45);
  display: flex; align-items: center; justify-content: center;
}
.storage-limit-box {
  background: var(--bg);
  border-radius: var(--radius-lg);
  padding: 28px 28px 24px;
  max-width: 420px; width: 90%;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  text-align: center;
}
.storage-limit-icon {
  font-size: 2.8rem;
  margin-bottom: 12px;
  color: #ef4444;
}
.storage-limit-title {
  font-size: 18px; font-weight: 700;
  margin-bottom: 8px;
  color: var(--text);
}
.storage-limit-body {
  font-size: 13px; color: var(--text-muted);
  margin-bottom: 18px; line-height: 1.6;
}
.storage-limit-actions {
  display: flex; flex-direction: column; gap: 8px;
  margin-bottom: 12px;
}
.storage-limit-actions .btn-primary { font-size: 14px; padding: 10px 20px; }
.storage-limit-actions .btn-sm      { font-size: 13px; }
.storage-limit-contact-note {
  font-size: 11px; color: var(--text-muted);
  margin-top: 8px;
}

/* ══════════════════════════════════════════════════════
   ADMIN USERS — TIER & STORAGE COLUMNS
══════════════════════════════════════════════════════ */
.admin-tier-cell {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
}
.admin-tier-badge {
  display: inline-block;
  padding: 2px 9px;
  border-radius: 99px;
  font-size: 11px; font-weight: 600;
  white-space: nowrap;
}
.admin-tier-badge--free {
  background: #f3f4f6; color: #6b7280;
  border: 1px solid #d1d5db;
}
.admin-tier-badge--paid {
  background: #ede9fe; color: #7c3aed;
  border: 1px solid #c4b5fd;
}
.admin-tier-change-btn {
  opacity: .55; padding: 2px 6px !important;
}
.admin-tier-change-btn:hover { opacity: 1; }

/* Subscription validity hint shown next to the tier badge in the admin
   users table. Colour escalates as expiry approaches: muted (>30d) →
   amber (≤30d) → red (≤7d) → red+strike (expired). */
.admin-sub-expiry {
  display: inline-block;
  padding: 1px 7px;
  border-radius: 99px;
  font-size: 10.5px; font-weight: 600;
  white-space: nowrap;
  border: 1px solid transparent;
}
.admin-sub-ok       { background: #ecfdf5; color: #059669; border-color: #a7f3d0; }
.admin-sub-warn     { background: #fffbeb; color: #b45309; border-color: #fcd34d; }
.admin-sub-soon     { background: #fef2f2; color: #b91c1c; border-color: #fca5a5; }
.admin-sub-expired  { background: #fee2e2; color: #991b1b; border-color: #f87171; text-decoration: line-through; }
.admin-storage-cell {
  min-width: 110px;
}
.admin-storage-bar {
  height: 5px;
  background: var(--border);
  border-radius: 99px;
  overflow: hidden;
  margin-bottom: 3px;
}
.admin-storage-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--primary);
  transition: width .3s;
}
.admin-storage-fill--mid  { background: #f59e0b; }
.admin-storage-fill--warn { background: #ef4444; }
.admin-storage-label {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
}

/* ══════════════════════════════════════════════════════
   TIER PICKER MODAL
══════════════════════════════════════════════════════ */
.tier-picker-list {
  display: flex; flex-direction: column; gap: 8px;
}
.tier-picker-option {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 10px 12px;
  border: 2px solid var(--border);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color .15s, background .15s;
}
.tier-picker-option:hover {
  border-color: var(--primary);
  background: var(--bg-2);
}
.tier-picker-option--selected {
  border-color: var(--primary);
  background: #eff6ff;
}
.tier-picker-option input[type="radio"] {
  margin-top: 3px; flex-shrink: 0;
  accent-color: var(--primary);
}
.tier-picker-info {
  display: flex; flex-direction: column; gap: 2px;
}
.tier-picker-info strong { font-size: 14px; }
.tier-picker-meta {
  font-size: 12px; color: var(--text-muted);
}
.tier-picker-info small {
  font-size: 11px; color: var(--text-muted);
}

/* ══════════════════════════════════════════════════════
   ADMIN TIERS MANAGEMENT
══════════════════════════════════════════════════════ */
.admin-tiers-wrap { padding: 4px 0; }
.admin-tiers-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 12px;
}
.admin-tier-card {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  display: flex; flex-direction: column; gap: 8px;
  transition: box-shadow .15s;
}
.admin-tier-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,.08); }
.admin-tier-card-head {
  display: flex; flex-direction: column; gap: 6px;
}
.admin-tier-card-title {
  display: flex; align-items: center; gap: 8px;
  font-size: 15px;
  flex-wrap: wrap;
}
.admin-tier-card-title i { color: var(--primary); }
.admin-tier-card-meta {
  display: flex; gap: 12px; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted);
}
.admin-tier-card-meta span {
  display: inline-flex; align-items: center; gap: 4px;
}
.admin-tier-card-desc {
  font-size: 12px; color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 8px;
}
.admin-tier-card-actions {
  display: flex; gap: 6px; justify-content: flex-end;
  margin-top: auto;
}
.admin-tier-flag {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 7px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 500;
  border: 1px solid transparent;
}
.admin-tier-flag.on {
  background: color-mix(in srgb, var(--primary) 12%, transparent);
  color: var(--primary);
  border-color: color-mix(in srgb, var(--primary) 30%, transparent);
}
.admin-tier-flag.off {
  background: var(--bg-2);
  color: var(--text-muted);
  border-color: var(--border);
  opacity: .6;
}
.admin-tier-features-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: .4rem .8rem;
}
.admin-tier-form-wrap {
  background: var(--bg-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  margin-top: 16px;
}
.admin-tier-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 10px;
}
@media (max-width: 600px) {
  .admin-tier-form-grid { grid-template-columns: 1fr; }
}

/* ══════════════════════════════════════════════════════
   SUBSCRIPTION EXPIRY BANNER
══════════════════════════════════════════════════════ */
.sub-expiry-banner {
  position: fixed; top: 0; left: 0; right: 0; z-index: 9990;
  display: flex; align-items: center; gap: 10px;
  padding: 9px 16px;
  font-size: 13px; font-weight: 500;
  box-shadow: 0 2px 8px rgba(0,0,0,.15);
}
.sub-banner--warn   { background: #fef9c3; color: #854d0e; }
.sub-banner--danger { background: #fee2e2; color: #991b1b; }
.sub-expiry-banner i { flex-shrink: 0; }
.sub-expiry-banner span { flex: 1; }
.sub-banner-renew {
  background: #0052cc; color: #fff;
  border: none; border-radius: 5px;
  padding: 4px 12px; font-size: 12px; font-weight: 600;
  cursor: pointer; white-space: nowrap;
}
.sub-banner-renew:hover { background: #0747a6; }
.sub-banner-close {
  background: none; border: none; cursor: pointer;
  font-size: 18px; line-height: 1; opacity: .6;
  padding: 0 4px;
}
.sub-banner-close:hover { opacity: 1; }

/* ══════════════════════════════════════════════════════
   UPGRADE / SUBSCRIPTION PAGE
══════════════════════════════════════════════════════ */
.upg-wrap { max-width: 860px; margin: 0 auto; }
.upg-section-title {
  font-size: 15px; font-weight: 700;
  margin: 28px 0 12px;
  color: var(--text);
}
.upg-tier-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.upg-tier-card {
  background: var(--bg);
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  position: relative;
  display: flex; flex-direction: column; gap: 6px;
  transition: box-shadow .15s;
}
.upg-tier-card:hover { box-shadow: 0 6px 20px rgba(0,0,0,.08); }
.upg-tier-card--current { border-color: var(--primary); }
.upg-current-badge {
  position: absolute; top: -11px; left: 50%;
  transform: translateX(-50%);
  background: var(--primary); color: #fff;
  font-size: 10px; font-weight: 800;
  padding: 3px 12px; border-radius: 20px;
  white-space: nowrap; letter-spacing: .04em;
}
.upg-tier-name {
  font-size: 13px; font-weight: 800;
  text-transform: uppercase; letter-spacing: .07em;
  color: var(--text-muted);
}
.upg-storage-badge {
  display: inline-flex; align-items: center; gap: 5px;
  background: #eff6ff; color: #1d4ed8;
  border: 1px solid #bfdbfe;
  border-radius: 20px;
  padding: 3px 10px; font-size: 12px; font-weight: 600;
  margin: 2px 0 4px; align-self: flex-start;
}
.upg-price {
  font-size: 2rem; font-weight: 900;
  color: var(--text); line-height: 1.1;
  margin: 4px 0;
}
.upg-per { font-size: 13px; font-weight: 400; color: var(--text-muted); }
.upg-note    { font-size: 12px; color: var(--text-muted); margin: 0; }
.upg-prorated { font-size: 11px; color: #15803d; background: #dcfce7; border-radius: 4px; padding: 4px 8px; margin: 0; }
.upg-pay-today { font-size: 12px; color: var(--text-muted); margin: 2px 0 0; }
.upg-btn {
  margin-top: auto;
  width: 100%; padding: 9px;
  border-radius: var(--radius);
  font-size: 13px; font-weight: 600;
  cursor: pointer; text-align: center;
  border: 1px solid var(--border);
  background: var(--bg-2); color: var(--text);
  transition: background .15s;
}
.upg-btn.btn-primary {
  background: var(--primary); color: #fff;
  border-color: var(--primary);
  box-shadow: 0 2px 8px rgba(0,82,204,.25);
}
.upg-btn.btn-primary:hover { background: var(--primary-dark); }
.upg-btn:not(.btn-primary):hover { background: var(--border); }
.upg-btn:disabled { opacity: .5; cursor: not-allowed; }
.upg-history-wrap { margin-top: 32px; padding-top: 24px; border-top: 1px solid var(--border); }
.upg-yearly-total {
  font-size: 11px; color: var(--text-muted);
  margin-top: 2px;
}
@media (max-width: 680px) {
  .upg-tier-grid { grid-template-columns: 1fr; }
}

/* ── Billing period toggle ───────────────────────────────────────────────── */
.billing-toggle {
  display: inline-flex;
  background: var(--sidebar-bg, #f1f5f9);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 3px;
  gap: 2px;
  margin-bottom: 20px;
}
.billing-toggle--centered { display: flex; justify-content: center; margin-bottom: 24px; }
.billing-toggle-btn {
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 6px 16px;
  font-size: 13px; font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition);
  white-space: nowrap;
}
.billing-toggle-btn.active {
  background: var(--accent, #6366f1);
  color: #fff;
  box-shadow: 0 1px 3px rgba(99,102,241,.35);
}
.billing-toggle-btn:not(.active):hover { color: var(--text); }
.billing-save-badge {
  display: inline-block;
  background: #dcfce7;
  color: #15803d;
  font-size: 10px; font-weight: 700;
  border-radius: 4px;
  padding: 1px 5px;
  margin-left: 4px;
  vertical-align: middle;
}

/* ── Mail system ─────────────────────────────────────────────────────────── */

/* Two-pane container */
.mail-layout {
  display: flex;
  border: 1.5px solid var(--border);
  border-radius: 14px;
  overflow: hidden;
  height: calc(100vh - 192px);
  min-height: 500px;
}

/* ── Left pane: list ── */
.mail-list-pane {
  width: 300px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  border-right: 1.5px solid var(--border);
  background: var(--bg);
}
.mail-list-pane-head {
  padding: 14px 12px 0;
  flex-shrink: 0;
}
.mail-items-scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
}

/* Tabs */
.mail-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 14px;
}
.mail-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1.5px solid var(--border);
  background: var(--bg-2);
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s, box-shadow .15s;
  white-space: nowrap;
}
.mail-tab:hover {
  background: var(--bg-hover);
  border-color: var(--primary);
  color: var(--primary);
}
.mail-tab.active {
  background: var(--primary);
  color: #fff;
  border-color: var(--primary);
  font-weight: 700;
  box-shadow: 0 2px 8px color-mix(in srgb, var(--primary) 30%, transparent);
}
.mail-tab-badge {
  background: rgba(255,255,255,.30);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  border-radius: 20px;
  padding: 0 6px;
  min-width: 18px;
  height: 18px;
  line-height: 18px;
  text-align: center;
}
.mail-tab:not(.active) .mail-tab-badge {
  background: var(--primary);
  color: #fff;
}

/* Mail list items */
.mail-item {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  padding: 13px 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  border-left: 3px solid transparent;
  cursor: pointer;
  position: relative;
  transition: background .12s;
}
.mail-item:last-child { border-bottom: none; }
.mail-item:hover { background: var(--bg-hover); }
.mail-item.selected {
  background: color-mix(in srgb, var(--primary) 10%, var(--bg));
  border-left-color: var(--primary);
}
.mail-item.mail-unread {
  background: color-mix(in srgb, var(--primary) 6%, var(--bg));
  border-left-color: var(--primary);
}
.mail-item.mail-unread.selected {
  background: color-mix(in srgb, var(--primary) 16%, var(--bg));
}
.mail-item.mail-unread .mail-item-from    { color: var(--text); font-weight: 700; }
.mail-item.mail-unread .mail-item-subject { font-weight: 700; color: var(--text); }
.mail-item-avatar  { flex-shrink: 0; padding-top: 2px; }
.mail-item-body    { flex: 1; min-width: 0; }
.mail-item-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 3px;
}
.mail-item-from {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-item-time {
  font-size: 11px;
  color: var(--text-muted);
  flex-shrink: 0;
}
.mail-item-subject {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text);
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.mail-item-preview {
  font-size: 12px;
  color: var(--text-secondary, var(--text-muted));
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  opacity: .75;
}
.mail-unread-dot { display: none; }

/* Converted-to-task chip (replaces preview line in list) */
.mail-task-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 600;
  color: var(--success);
  background: color-mix(in srgb, var(--success) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--success) 30%, transparent);
  border-radius: 20px;
  padding: 1px 8px;
  margin-top: 2px;
  width: fit-content;
}
/* Subtle left-border tint for converted items in the list */
.mail-item.mail-has-task {
  border-left-color: var(--success);
}

/* Banner inside detail pane when a task exists */
.mail-task-banner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 26px;
  background: color-mix(in srgb, var(--success) 10%, var(--bg-2));
  border-bottom: 1px solid color-mix(in srgb, var(--success) 25%, transparent);
  font-size: 12.5px;
  font-weight: 600;
  color: color-mix(in srgb, var(--success) 80%, #000);
}

/* Disabled "already converted" button in footer */
.mail-converted-btn {
  color: var(--success) !important;
  border: 1.5px solid color-mix(in srgb, var(--success) 40%, transparent) !important;
  background: color-mix(in srgb, var(--success) 8%, transparent) !important;
  opacity: .85;
  cursor: default;
}

/* ── Right pane: detail ── */
.mail-detail-pane {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-width: 0;
  background: var(--bg-2);
}

/* Empty / welcome state */
.mail-detail-empty {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  color: var(--text-muted);
  user-select: none;
}
.mail-detail-empty i   { font-size: 54px; opacity: .13; }
.mail-detail-empty p   { font-size: 13px; opacity: .55; margin: 0; }

/* Message view */
.mail-msg-head {
  padding: 22px 26px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
  background: var(--bg-2);
}
.mail-msg-subject {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  line-height: 1.35;
  word-break: break-word;
  margin-bottom: 14px;
}
.mail-msg-from-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.mail-msg-from-info { flex: 1; min-width: 0; }
.mail-msg-from-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.mail-msg-from-label {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 2px;
}
.mail-msg-timestamp {
  font-size: 11px;
  color: var(--text-muted);
  white-space: nowrap;
  flex-shrink: 0;
}
.mail-msg-body-wrap {
  flex: 1;
  overflow-y: auto;
  padding: 22px 26px;
}
.mail-msg-body {
  font-size: 14px;
  line-height: 1.8;
  color: var(--text);
  white-space: pre-wrap;
  word-break: break-word;
}
.mail-msg-foot {
  padding: 12px 26px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
  background: var(--bg-2);
}

/* Sidebar unread badge (for sidebar link) */
.mail-badge {
  position: absolute;
  top: 4px; right: 6px;
  background: #ef4444;
  color: #fff;
  font-size: 9px;
  font-weight: 700;
  border-radius: 10px;
  padding: 1px 5px;
  min-width: 16px;
  text-align: center;
  line-height: 1.4;
}

/* accent-green header variant for convert-task modal */
.modal-accent-header.accent-green {
  background: linear-gradient(135deg, #16a34a 0%, #166534 100%);
}

/* ═══════════════════════════════════════════════════════
   COOKIE CONSENT BANNER
   Fixed at the bottom of the viewport on every page (public + auth).
   Removed from the DOM as soon as the user accepts or rejects.
   "Reject" is rendered with the same prominence as "Accept" — same
   button size, same touch target — so the choice is genuinely free
   (GDPR principle: consent must not be pressured by dark patterns).
═══════════════════════════════════════════════════════ */
.cookie-banner {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  z-index: 9999;
  background: #0f172a;
  color: rgba(255,255,255,.92);
  border-top: 1px solid rgba(255,255,255,.12);
  box-shadow: 0 -4px 20px rgba(0,0,0,.25);
  animation: cookieSlideUp .25s ease-out;
}
@keyframes cookieSlideUp {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}
.cookie-banner-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 20px;
}
.cookie-banner-text { flex: 1; min-width: 0; }
.cookie-banner-text strong {
  display: block;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin-bottom: 2px;
}
.cookie-banner-text p {
  margin: 0;
  font-size: 13px;
  line-height: 1.5;
  color: rgba(255,255,255,.78);
}
.cookie-banner-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.cookie-btn {
  padding: 8px 18px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  white-space: nowrap;
  transition: background .15s, color .15s;
}
.cookie-btn-ghost {
  background: rgba(255,255,255,.08);
  color: rgba(255,255,255,.85);
  border: 1px solid rgba(255,255,255,.18);
}
.cookie-btn-ghost:hover  { background: rgba(255,255,255,.15); }
.cookie-btn-primary {
  background: #6366f1;
  color: #fff;
}
.cookie-btn-primary:hover { background: #5658e8; }

/* Phone portrait: stack text above the buttons so neither truncates,
   and let the buttons fill the row at equal width. */
@media (max-width: 640px) {
  .cookie-banner-inner {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
    padding: 14px 16px;
  }
  .cookie-banner-actions { gap: 10px; }
  .cookie-banner-actions .cookie-btn { flex: 1; padding: 10px 12px; }
}

/* ============================================================
   LEGAL PAGES — /privacy, /terms, /cookie-policy, /imprint
   Long-form readable content, mirroring the lp-page palette.
   ============================================================ */
.lp-legal-page {
  background: #0b1024;
  padding: 48px 24px 80px;
  color: #cbd5e1;
}
.lp-legal-inner {
  max-width: 880px;
  margin: 0 auto;
  font-size: 15px;
  line-height: 1.7;
}
.lp-legal-updated {
  color: #94a3b8;
  font-size: 13px;
  margin-top: 12px;
  font-style: italic;
}
.lp-legal-intro {
  background: rgba(99,102,241,0.08);
  border: 1px solid rgba(99,102,241,0.25);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 28px;
  color: #e2e8f0;
}
.lp-legal-section {
  margin-bottom: 28px;
}
.lp-legal-section h2 {
  color: #f1f5f9;
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 12px;
  padding-bottom: 8px;
  border-bottom: 1px solid rgba(148,163,184,0.18);
}
.lp-legal-body p {
  margin: 0 0 12px;
}
.lp-legal-body ul {
  margin: 8px 0 16px;
  padding-left: 22px;
}
.lp-legal-body ul li {
  margin: 4px 0;
}
.lp-legal-body a {
  color: #a5b4fc;
  text-decoration: underline;
}
.lp-legal-body a:hover {
  color: #c7d2fe;
}
.lp-legal-body strong {
  color: #e2e8f0;
}
.lp-legal-contact {
  background: rgba(16,185,129,0.06);
  border: 1px solid rgba(16,185,129,0.2);
  border-radius: 12px;
  padding: 20px 24px;
  margin-top: 36px;
}
.lp-legal-contact h2 {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 8px;
}
@media (max-width: 640px) {
  .lp-legal-page { padding: 32px 16px 56px; }
  .lp-legal-inner { font-size: 14px; }
  .lp-legal-section h2 { font-size: 19px; }
}

/* ============================================================
   FEEDBACK PAGE — message / bug / feature
   ============================================================ */
.feedback-page { max-width: 920px; margin: 0 auto; padding: 24px 20px 80px; }
.feedback-header { margin-bottom: 18px; }
.feedback-header h1 { margin: 0 0 4px; font-size: 22px; }
.feedback-intro { color: var(--text-muted); font-size: 13px; margin: 0 0 14px; }
.feedback-tabs {
  display: flex; gap: 6px; flex-wrap: wrap; align-items: center;
  border-bottom: 1px solid var(--border); padding-bottom: 0;
}
.feedback-tab {
  background: none; border: none;
  padding: 10px 14px; font-size: 13px; font-weight: 600;
  color: var(--text-muted); cursor: pointer; border-radius: 6px 6px 0 0;
  border-bottom: 2px solid transparent;
  display: inline-flex; align-items: center; gap: 6px;
}
.feedback-tab:hover { color: var(--text); background: rgba(99,102,241,.06); }
.feedback-tab--active {
  color: var(--primary); border-bottom-color: var(--primary);
  background: rgba(99,102,241,.06);
}
.feedback-new-btn { margin-left: auto; }

/* Status filter chips on the Features tab. Sit below the tab row. */
.feedback-filters {
  display: flex; gap: 6px; flex-wrap: wrap;
  margin-top: 12px;
}
.feedback-filter-chip {
  padding: 5px 14px;
  font-size: 12px; font-weight: 600;
  border: 1px solid var(--border); border-radius: 99px;
  background: var(--card-bg); color: var(--text-muted);
  cursor: pointer; transition: var(--transition);
}
.feedback-filter-chip:hover { color: var(--text); border-color: var(--text-muted); }
.feedback-filter-chip--active {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.feedback-filter-chip--active:hover { color: #fff; }

.feedback-list { margin-top: 18px; display: flex; flex-direction: column; gap: 10px; }
.feedback-empty {
  text-align: center; padding: 60px 20px; color: var(--text-muted); font-size: 14px;
}
.feedback-empty i { font-size: 32px; opacity: .3; display: block; margin-bottom: 10px; }

.feedback-item {
  display: flex; gap: 12px; align-items: stretch;
  background: var(--card-bg); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; transition: border-color .15s, box-shadow .15s;
}
.feedback-item:hover { border-color: var(--primary-light); box-shadow: 0 1px 3px rgba(0,0,0,.05); }

/* "Unread" highlighting — driven by is_unread flag from the API.
   Drives the badge count: every unread row contributes to the sidebar
   pill. Visual cues:
     - left-edge accent stripe (4px violet)
     - subtle background tint
     - bolder title
     - tiny "new" pill at the start of the title row
   The accent + pill together make the affected items pop without being
   shouty — discoverable but not disruptive when scrolling past read items. */
.feedback-item--unread {
  border-left: 4px solid var(--primary);
  background: rgba(99,102,241,.05);
}
.feedback-item--unread .feedback-item-title { font-weight: 700; color: var(--text); }
.feedback-new-pill {
  display: inline-block;
  background: var(--primary); color: #fff;
  font-size: 9px; font-weight: 700; letter-spacing: .04em;
  padding: 1px 7px; border-radius: 99px;
  text-transform: uppercase;
  vertical-align: middle;
}
.feedback-item-body { flex: 1; min-width: 0; cursor: pointer; }
.feedback-item-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 4px;
}
.feedback-item-title { font-size: 14px; color: var(--text); }
.feedback-item-meta {
  font-size: 11px; color: var(--text-muted);
  display: flex; gap: 5px; align-items: center; margin-bottom: 6px;
}
.feedback-item-snippet { font-size: 13px; color: var(--text-muted); line-height: 1.45; }

/* Vote button (feature only) — vertical, like HN */
.feedback-vote {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-width: 50px; padding: 6px 8px;
  background: rgba(148,163,184,.08); border: 1px solid var(--border);
  border-radius: 8px; cursor: pointer; transition: var(--transition);
  color: var(--text-muted);
}
.feedback-vote:hover { background: rgba(99,102,241,.1); color: var(--primary); border-color: var(--primary-light); }
.feedback-vote--on  { background: var(--primary); color: #fff; border-color: var(--primary); }
.feedback-vote--on:hover { background: var(--primary); color: #fff; }
.feedback-vote i { font-size: 13px; }
.feedback-vote-count { font-size: 13px; font-weight: 700; margin-top: 2px; }

/* Status pill */
.feedback-status {
  display: inline-block; padding: 1px 9px;
  border-radius: 99px; font-size: 11px; font-weight: 600;
  white-space: nowrap; border: 1px solid transparent;
}
.feedback-status-new        { background: #eff6ff; color: #2563eb; border-color: #bfdbfe; }
.feedback-status-accepted   { background: #f0fdf4; color: #16a34a; border-color: #bbf7d0; }
.feedback-status-in-process { background: #fef3c7; color: #b45309; border-color: #fde68a; }
.feedback-status-completed  { background: #ede9fe; color: #7c3aed; border-color: #c4b5fd; }
.feedback-status-rejected   { background: #fee2e2; color: #b91c1c; border-color: #fca5a5; text-decoration: line-through; }

/* Detail modal */
.feedback-detail-meta {
  display: flex; gap: 6px; align-items: center; flex-wrap: wrap;
  font-size: 12px; color: var(--text-muted); margin-bottom: 14px;
}
.feedback-detail-body {
  font-size: 14px; line-height: 1.6;
  white-space: pre-wrap; word-wrap: break-word;
  color: var(--text);
}
.feedback-status-edit {
  margin-top: 14px; display: flex; align-items: center; gap: 8px;
  padding: 10px 12px; background: rgba(124,58,237,.08); border-radius: 8px;
}

/* Type-pick radios (in create modal) */
.feedback-type-pick {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 12px; border: 1px solid var(--border); border-radius: 99px;
  font-size: 12px; font-weight: 600; color: var(--text-muted); cursor: pointer;
}
.feedback-type-pick input { display: none; }
.feedback-type-pick:hover { color: var(--text); }
.feedback-type-pick--on {
  background: rgba(99,102,241,.12); color: var(--primary); border-color: var(--primary);
}

/* Comments */
.feedback-comment {
  padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  margin-bottom: 8px; background: var(--card-bg);
}
.feedback-comment-head {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  font-size: 12px; margin-bottom: 6px;
}
.feedback-comment-date { color: var(--text-muted); font-size: 11px; }
.feedback-comment-body {
  font-size: 13px; line-height: 1.5; white-space: pre-wrap; word-wrap: break-word;
}
.feedback-comment-del {
  margin-left: auto; background: none; border: none; color: var(--text-muted);
  cursor: pointer; padding: 2px 6px; opacity: .5; font-size: 11px;
}
.feedback-comment-del:hover { opacity: 1; color: #d00; }

.feedback-staff-badge {
  font-size: 10px; font-weight: 700; padding: 1px 6px; border-radius: 99px;
  background: rgba(124,58,237,.12); color: #7c3aed; border: 1px solid #c4b5fd;
}

@media (max-width: 640px) {
  .feedback-page { padding: 16px 12px 56px; }
  .feedback-tabs { gap: 0; }
  .feedback-tab { padding: 8px 10px; font-size: 12px; }
  .feedback-new-btn { margin-left: 0; margin-top: 8px; width: 100%; }
}
