:root {
  --orange: #F06543;
  --orange-dark: #d4522e;
  --orange-light: #fff3ef;
  --ink: #111827;
  --ink-2: #374151;
  --green: #22c55e;
  --green-dark: #15803d;
  --green-bg: #f0fdf4;
  --blue: #3b82f6;
  --blue-dark: #1d4ed8;
  --blue-bg: #eff6ff;
  --line: #e5e7eb;
  --line-2: #d1d5db;
  --muted: #6b7280;
  --muted-light: #9ca3af;
  --pale: #f9fafb;
  --bg: #f4f5f7;
  --surface: #fff;
  --red: #ef4444;
  --cream: #F7F3EE;
  --col-r1: #2563eb;
  --col-r2: #ea6c44;
  --col-sl: #15803d;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { height: 100%; }
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', sans-serif;
  color: var(--ink);
  background: var(--bg);
  line-height: 1.5;
  font-size: 15px;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

/* ── Header ─────────────────────────────────────────────────────── */
.ws-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #fff;
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.ws-header-inner {
  max-width: 1280px;
  margin: auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 58px;
  padding: 0 20px;
  gap: 16px;
}
.ws-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}
.ws-logo-img {
  display: block;
  width: auto;
  max-height: 32px;
}
.ws-divider {
  width: 1px;
  height: 20px;
  background: var(--line-2);
  flex-shrink: 0;
}
.ws-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--orange-light);
  color: var(--orange-dark);
  border: 1px solid #fcd4c8;
  font-size: .72rem;
  font-weight: 700;
  padding: 3px 10px 3px 8px;
  border-radius: 6px;
  letter-spacing: .4px;
  text-transform: uppercase;
  white-space: nowrap;
}
.ws-badge-dot {
  width: 6px;
  height: 6px;
  background: var(--orange);
  border-radius: 50%;
  flex-shrink: 0;
}
.ws-nav {
  display: flex;
  align-items: center;
  gap: 12px;
}
.user-avatar {
  width: 30px;
  height: 30px;
  background: var(--orange-light);
  border: 1.5px solid #fcd4c8;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .72rem;
  font-weight: 700;
  color: var(--orange-dark);
  flex-shrink: 0;
  text-transform: uppercase;
}
.user-name {
  color: var(--ink-2);
  font-size: .85rem;
  font-weight: 500;
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.btn-signout {
  background: transparent;
  border: 1px solid var(--line-2);
  color: var(--muted);
  padding: 5px 13px;
  border-radius: 6px;
  font-size: .8rem;
  font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-signout:hover {
  border-color: var(--line-2);
  background: var(--pale);
  color: var(--ink);
}

/* ── Auth screens ──────────────────────────────────────────────── */
.auth-screen {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px);
  padding: 32px 20px;
  background: var(--cream);
}
.auth-card {
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 40px 40px 36px;
  width: 100%;
  max-width: 400px;
  text-align: center;
  box-shadow: 0 4px 24px rgba(0,0,0,.07);
}
.auth-brand {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 24px;
}
.auth-brand-inner {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.auth-logo {
  display: block;
  width: auto;
  max-height: 40px;
}
.auth-product-tag {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: var(--orange-light);
  color: var(--orange-dark);
  border: 1px solid #fcd4c8;
  font-size: .68rem;
  font-weight: 700;
  padding: 3px 10px 3px 8px;
  border-radius: 20px;
  letter-spacing: .5px;
  text-transform: uppercase;
}
.auth-product-dot {
  width: 5px;
  height: 5px;
  background: var(--orange);
  border-radius: 50%;
}
.auth-card h2 {
  font-size: 1.3rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -.4px;
  color: var(--ink);
}
.auth-card .auth-sub {
  color: var(--muted);
  font-size: .87rem;
  margin-bottom: 28px;
  line-height: 1.6;
}
.auth-separator {
  font-size: .75rem;
  color: var(--muted-light);
  margin: 20px 0;
  display: flex;
  align-items: center;
  gap: 10px;
}
.auth-separator::before, .auth-separator::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--line);
}
.btn-google {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  width: 100%;
  justify-content: center;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.btn-google:hover {
  border-color: #9ca3af;
  background: var(--pale);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.btn-google svg { width: 20px; height: 20px; flex-shrink: 0; }
.btn-try-again {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 10px;
  padding: 12px 22px;
  font-size: .9rem;
  font-weight: 600;
  color: var(--ink);
  width: 100%;
  margin-top: 16px;
  transition: border-color .15s, box-shadow .15s, background .15s;
}
.btn-try-again:hover {
  border-color: #9ca3af;
  background: var(--pale);
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
}
.auth-denied-icon-wrap {
  width: 52px;
  height: 52px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
}
.auth-denied-icon-wrap svg {
  width: 24px;
  height: 24px;
  color: var(--red);
  flex-shrink: 0;
}
.auth-denied-text {
  color: var(--ink-2);
  font-size: .9rem;
  margin-bottom: 6px;
}
.auth-denied-note {
  color: var(--muted);
  font-size: .82rem;
  margin-bottom: 4px;
  line-height: 1.5;
}

/* ── Dashboard container ─────────────────────────────────────────── */
.ws-container {
  max-width: 1280px;
  margin: 0 auto;
  padding: 20px 20px 40px;
}

/* ── Toolbar ──────────────────────────────────────────────────────── */
.ws-toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 14px;
}
.toolbar-label {
  font-size: .75rem;
  font-weight: 700;
  letter-spacing: .7px;
  text-transform: uppercase;
  color: var(--muted);
  white-space: nowrap;
}
.job-select {
  flex: 1;
  min-width: 240px;
  max-width: 480px;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 12px;
  font: inherit;
  font-size: .9rem;
  background: var(--pale);
  color: var(--ink);
  cursor: pointer;
  transition: border-color .15s, box-shadow .15s;
}
.job-select:focus {
  outline: none;
  border-color: var(--orange);
  box-shadow: 0 0 0 3px rgba(240,101,67,.1);
  background: #fff;
}
.btn-refresh {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--pale);
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  padding: 8px 14px;
  font-size: .82rem;
  font-weight: 500;
  color: var(--muted);
  white-space: nowrap;
  transition: border-color .15s, color .15s, background .15s;
}
.btn-refresh:hover {
  border-color: #9ca3af;
  color: var(--ink);
  background: #fff;
}

/* ── Kanban board ─────────────────────────────────────────────────── */
.kanban-board {
  display: grid;
  grid-template-columns: repeat(3, minmax(280px, 1fr));
  gap: 16px;
  align-items: start;
}

/* On mobile: horizontal scroll, keep 3 columns */
@media (max-width: 860px) {
  .kanban-board {
    display: flex;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 12px;
    padding-bottom: 12px;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
    scrollbar-color: var(--line-2) transparent;
  }
  .kanban-board::-webkit-scrollbar {
    height: 5px;
  }
  .kanban-board::-webkit-scrollbar-track {
    background: transparent;
  }
  .kanban-board::-webkit-scrollbar-thumb {
    background: var(--line-2);
    border-radius: 3px;
  }
  .kanban-col {
    flex: 0 0 280px;
    min-width: 280px;
  }
}

.kanban-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-align: center;
  padding: 56px 24px;
  color: var(--muted);
  font-size: .9rem;
  background: #fff;
  border-radius: 12px;
  border: 1px dashed var(--line-2);
  min-height: 160px;
}
@media (max-width: 860px) {
  .kanban-empty {
    /* When board scrolls, empty state fills the row */
    flex: 1 1 auto;
    min-width: 100%;
  }
}
.kanban-empty-icon {
  width: 40px;
  height: 40px;
  background: var(--pale);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}
.kanban-empty-icon svg {
  width: 20px;
  height: 20px;
  color: var(--muted-light);
}
.kanban-loading {
  text-align: center;
  padding: 48px;
  color: var(--muted);
  font-size: .9rem;
}
@media (max-width: 860px) {
  .kanban-loading { flex: 1 1 auto; min-width: 100%; }
}

/* ── Kanban column ─────────────────────────────────────────────────── */
.kanban-col {
  background: #fff;
  border-radius: 12px;
  border: 1px solid var(--line);
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(0,0,0,.04);
}
.kanban-col-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255,255,255,.15);
}
.r1-header { background: var(--col-r1); }
.r2-header { background: var(--col-r2); }
.sl-header  { background: var(--col-sl); }
.col-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}
.col-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
  opacity: .9;
}
.col-title {
  font-weight: 700;
  font-size: .88rem;
  letter-spacing: .2px;
  color: #fff;
}
.col-count {
  background: rgba(255,255,255,.22);
  color: #fff;
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 20px;
  min-width: 24px;
  text-align: center;
  letter-spacing: .2px;
}
.kanban-cards {
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 80px;
}
.col-empty {
  text-align: center;
  padding: 28px 12px;
  color: var(--muted-light);
  font-size: .82rem;
  font-style: italic;
}

/* ── Kanban card ────────────────────────────────────────────────────── */
.kanban-card {
  background: var(--pale);
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 14px 14px 12px;
  position: relative;
  overflow: hidden;
  transition: box-shadow .15s, transform .1s;
}
.kanban-card:hover {
  box-shadow: 0 3px 14px rgba(0,0,0,.09);
  transform: translateY(-1px);
}
.card-selected {
  border-color: #86efac;
  background: var(--green-bg);
}
.selected-ribbon {
  position: absolute;
  top: 0;
  right: 0;
  background: var(--green-dark);
  color: #fff;
  font-size: .63rem;
  font-weight: 700;
  letter-spacing: .4px;
  text-transform: uppercase;
  padding: 3px 10px;
  border-radius: 0 10px 0 8px;
}
.card-name {
  font-weight: 700;
  font-size: 1rem;
  color: var(--ink);
  margin-bottom: 6px;
  padding-right: 58px;
  line-height: 1.3;
}
.card-meta {
  display: flex;
  flex-direction: column;
  gap: 3px;
  margin-bottom: 8px;
}
.card-phone {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: .84rem;
  color: var(--ink-2);
  font-weight: 500;
}
.card-phone-icon {
  width: 13px;
  height: 13px;
  flex-shrink: 0;
  color: var(--muted);
}
.card-job {
  font-size: .8rem;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.card-date {
  font-size: .74rem;
  color: var(--muted-light);
  margin-bottom: 8px;
}
.card-promoted {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .72rem;
  color: var(--muted-light);
  background: var(--line);
  border-radius: 4px;
  padding: 2px 7px;
  margin-bottom: 8px;
  width: fit-content;
}
.card-actions { display: flex; flex-direction: column; gap: 6px; }

/* ── Card action buttons ─────────────────────────────────────────── */
.btn-promote {
  background: var(--orange);
  color: #fff;
  border: none;
  border-radius: 7px;
  padding: 8px 12px;
  font-size: .8rem;
  font-weight: 600;
  letter-spacing: .1px;
  transition: background .15s, box-shadow .15s;
  width: 100%;
  text-align: center;
}
.btn-promote:hover {
  background: var(--orange-dark);
  box-shadow: 0 2px 8px rgba(240,101,67,.3);
}
.btn-demote {
  background: transparent;
  color: var(--muted);
  border: 1px solid var(--line-2);
  border-radius: 7px;
  padding: 6px 10px;
  font-size: .76rem;
  font-weight: 500;
  transition: border-color .15s, color .15s, background .15s;
  width: 100%;
  text-align: center;
}
.btn-demote:hover {
  border-color: #9ca3af;
  color: var(--ink);
  background: #fff;
}
.shortlist-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.btn-select {
  background: #fff;
  color: var(--green-dark);
  border: 1.5px solid var(--green);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: .79rem;
  font-weight: 600;
  transition: background .15s, color .15s;
  text-align: center;
}
.btn-select:hover { background: var(--green-bg); }
.btn-selected {
  background: var(--green-dark);
  color: #fff;
  border: 1.5px solid var(--green-dark);
  border-radius: 7px;
  padding: 7px 8px;
  font-size: .79rem;
  font-weight: 600;
  text-align: center;
  transition: opacity .15s;
}
.btn-selected:hover { opacity: .88; }
.btn-share {
  background: var(--blue-bg);
  color: var(--blue-dark);
  border: 1.5px solid #bfdbfe;
  border-radius: 7px;
  padding: 7px 8px;
  font-size: .79rem;
  font-weight: 600;
  transition: background .15s;
  text-align: center;
}
.btn-share:hover { background: #dbeafe; }

/* ── Share modal ─────────────────────────────────────────────────── */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(17,24,39,.55);
  z-index: 500;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(2px);
}
.modal-card {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 440px;
  overflow: hidden;
  box-shadow: 0 24px 64px rgba(0,0,0,.2);
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  background: var(--pale);
}
.modal-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
}
.modal-header-icon {
  width: 32px;
  height: 32px;
  background: var(--blue-bg);
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.modal-header-icon svg {
  width: 16px;
  height: 16px;
  color: var(--blue-dark);
}
.modal-header h3 {
  margin: 0;
  font-size: .95rem;
  font-weight: 700;
  color: var(--ink);
}
.modal-close {
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--muted);
  line-height: 1;
  padding: 4px 6px;
  border-radius: 6px;
  transition: color .15s, background .15s;
}
.modal-close:hover { color: var(--ink); background: var(--line); }
.modal-body { padding: 20px; }
.share-field {
  display: flex;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--pale);
}
.share-field:last-child { border-bottom: none; }
.share-field label {
  font-size: .72rem;
  font-weight: 700;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .5px;
  width: 76px;
  flex-shrink: 0;
  padding-top: 2px;
}
.share-field span {
  font-size: .9rem;
  color: var(--ink);
  word-break: break-all;
}
.modal-actions {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  padding: 14px 20px 18px;
  border-top: 1px solid var(--line);
}
.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #fff;
  border: 1.5px solid var(--line-2);
  border-radius: 8px;
  padding: 10px;
  font-size: .84rem;
  font-weight: 600;
  color: var(--ink);
  transition: border-color .15s, background .15s;
}
.btn-copy:hover { border-color: #9ca3af; background: var(--pale); }
.btn-copy svg { width: 15px; height: 15px; flex-shrink: 0; }
.btn-whatsapp {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  background: #25d366;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 10px;
  font-size: .84rem;
  font-weight: 600;
  text-align: center;
  transition: opacity .15s, box-shadow .15s;
}
.btn-whatsapp:hover { opacity: .9; box-shadow: 0 2px 8px rgba(37,211,102,.35); }

/* ── Toast ────────────────────────────────────────────────────────── */
#toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(80px);
  background: var(--ink);
  color: #fff;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: .84rem;
  font-weight: 500;
  opacity: 0;
  transition: opacity .25s, transform .25s;
  pointer-events: none;
  z-index: 9999;
  white-space: nowrap;
  max-width: 90vw;
  box-shadow: 0 4px 16px rgba(0,0,0,.2);
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ── Loading ─────────────────────────────────────────────────────── */
.loading-center {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 58px);
  color: var(--muted);
  font-size: .9rem;
  gap: 10px;
}
.loading-spinner {
  width: 18px;
  height: 18px;
  border: 2px solid var(--line-2);
  border-top-color: var(--orange);
  border-radius: 50%;
  animation: spin .7s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
