/* Effinyx CRM — design language mirrored from tasc_masar_ksa:
   Inter, #fafafa page, slate neutrals, blue-600 brand, rounded-xl cards + shadow-sm,
   gradient KPI tiles, Monday-style solid status cells, 87.5% density. Light theme only. */

:root {
  --bg: #fafafa; --surface: #ffffff; --line: #e2e8f0; --line-soft: #f1f5f9;
  --ink: #1e293b; --ink-strong: #0f172a; --muted: #64748b; --muted-2: #94a3b8;
  --brand: #2563eb; --brand-hover: #1d4ed8; --brand-50: #eff6ff; --brand-100: #dbeafe; --brand-700: #1d4ed8;
  --emerald: #10b981; --emerald-600: #059669; --amber: #f59e0b; --orange: #f97316;
  --rose: #f43f5e; --violet: #8b5cf6; --teal: #14b8a6;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06), 0 1px 3px rgba(15,23,42,.04);
  --shadow-md: 0 4px 12px rgba(15,23,42,.08);
}
* { box-sizing: border-box; }
html { font-size: 87.5%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  -webkit-font-smoothing: antialiased; font-size: 1rem; line-height: 1.5;
}
.hidden { display: none !important; }
.muted { color: var(--muted); }
.eyebrow { font-size: .72rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted-2); font-weight: 600; }
.err { color: var(--rose); font-size: .85rem; }
a { color: var(--brand); text-decoration: none; cursor: pointer; }

::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f4f4f5; }
::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
@keyframes fadeIn { from { opacity: 0 } to { opacity: 1 } }
@keyframes slideUp { from { opacity: 0; transform: translateY(8px) } to { opacity: 1; transform: none } }
@keyframes spin { to { transform: rotate(360deg) } }
.animate-fade { animation: fadeIn .3s ease-out; }
.animate-up { animation: slideUp .3s ease-out; }
.spin { display: inline-block; animation: spin 1s linear infinite; }

/* ---- buttons ---- */
button { font: inherit; cursor: pointer; border: 1px solid transparent; border-radius: .5rem;
  padding: .5rem 1rem; font-weight: 500; font-size: .85rem; transition: all .15s;
  display: inline-flex; align-items: center; gap: .4rem; }
.btn-primary { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.btn-primary:hover { background: var(--brand-hover); }
.btn-secondary { background: #fff; color: var(--ink); border-color: #cbd5e1; box-shadow: var(--shadow-sm); }
.btn-secondary:hover { background: #f8fafc; }
.btn-ghost { background: transparent; color: var(--muted); }
.btn-ghost:hover { background: #f1f5f9; color: var(--ink); }
.btn-sync { background: var(--orange); color: #fff; box-shadow: var(--shadow-sm); }
.btn-sync:hover { filter: brightness(.95); }
button:disabled { opacity: .55; cursor: not-allowed; }
.btn-sm { padding: .3rem .65rem; font-size: .75rem; }

input, select, textarea {
  font: inherit; font-size: .85rem; color: var(--ink); background: #fff; border: 1px solid #cbd5e1;
  border-radius: .5rem; padding: .5rem .65rem; width: 100%;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px var(--brand-50); }

/* ---- auth ---- */
.auth { display: grid; place-items: center; min-height: 100vh; padding: 20px; }
.auth-card { background: #fff; border: 1px solid var(--line); border-radius: 1rem; box-shadow: var(--shadow-md);
  padding: 2rem; width: 100%; max-width: 380px; }
.auth-card h1 { margin: .6rem 0 .1rem; font-size: 1.35rem; color: var(--ink-strong); }
.auth-card label { display: block; margin-top: .9rem; font-size: .78rem; font-weight: 600; color: var(--muted); }
.auth-card input { margin-top: .3rem; }
.auth-card button { width: 100%; margin-top: 1.1rem; padding: .6rem; justify-content: center; }
.logo { display: inline-flex; align-items: center; gap: .5rem; font-weight: 800; letter-spacing: -.02em; }
.logo .mark { width: 1.75rem; height: 1.75rem; border-radius: .5rem; background: linear-gradient(135deg, #3b82f6, #1d4ed8);
  color: #fff; display: grid; place-items: center; font-size: .8rem; font-weight: 800; box-shadow: var(--shadow-sm); }

/* ---- shell ---- */
.app { display: grid; grid-template-columns: 220px 1fr; min-height: 100vh; }
.sidebar { background: #fff; border-right: 1px solid var(--line); display: flex; flex-direction: column;
  padding: 1.1rem .85rem; gap: .4rem; position: sticky; top: 0; height: 100vh; }
.sidebar .logo { padding: .3rem .5rem 1rem; font-size: 1.05rem; }
.sidebar nav { display: flex; flex-direction: column; gap: .15rem; flex: 1; }
.nav-item { padding: .55rem .7rem; border-radius: .5rem; color: var(--ink); font-weight: 500; font-size: .85rem;
  display: flex; align-items: center; gap: .55rem; }
.nav-item:hover { background: #f1f5f9; }
.nav-item.active { background: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.sidebar-foot { border-top: 1px solid var(--line); padding-top: .8rem; }
.sidebar-foot .who { font-size: .78rem; color: var(--muted); margin-bottom: .5rem; }
.content { overflow: auto; }

/* ---- page header ---- */
.page { max-width: 1500px; margin: 0 auto; padding: 1.5rem; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; margin-bottom: 1.1rem; flex-wrap: wrap; }
.page-head h1 { margin: .15rem 0 0; font-size: 1.6rem; font-weight: 700; color: var(--ink-strong); letter-spacing: -.01em; }
.page-head .right { display: flex; align-items: center; gap: .75rem; flex-wrap: wrap; }
.count { font-size: .85rem; color: var(--muted); }
.count b { color: var(--ink); font-weight: 700; }

/* sync banners */
.banner { padding: .6rem .8rem; border-radius: .6rem; font-size: .82rem; margin-bottom: .8rem; border: 1px solid; }
.banner.info { background: #fff7ed; border-color: #fed7aa; color: #9a3412; }
.banner.ok { background: #ecfdf5; border-color: #a7f3d0; color: #047857; }
.banner.bad { background: #fef2f2; border-color: #fecaca; color: #b91c1c; }

/* ---- dashboard pills / tabs ---- */
.pillbar { display: flex; gap: .4rem; margin-bottom: 1rem; flex-wrap: wrap; }
.pill { background: #fff; border: 1px solid var(--line); color: var(--muted); border-radius: .5rem;
  padding: .4rem .85rem; font-size: .8rem; font-weight: 600; }
.pill:hover { border-color: #bfdbfe; color: var(--brand); }
.pill.active { background: var(--brand); border-color: var(--brand); color: #fff; box-shadow: var(--shadow-sm); }
.rowlbl { font-size: .78rem; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---- pager ---- */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 1rem; margin-top: .8rem; flex-wrap: wrap; }
.pager .nums { display: flex; gap: .3rem; align-items: center; }
.pager button { padding: .3rem .7rem; }

/* ---- KPI tiles ---- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: .9rem; margin-bottom: 1.1rem; }
.kpi { border: 1px solid; border-radius: .75rem; padding: 1rem 1.1rem; box-shadow: var(--shadow-sm); }
.kpi .top { display: flex; align-items: flex-start; justify-content: space-between; }
.kpi .lbl { font-size: .68rem; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; color: var(--muted); }
.kpi .ic { width: 1.75rem; height: 1.75rem; border-radius: .5rem; display: grid; place-items: center; font-size: .95rem; }
.kpi .val { margin-top: .35rem; font-size: 1.7rem; font-weight: 700; color: var(--ink-strong); line-height: 1.1; }
.kpi .sub { font-size: .72rem; color: var(--muted); margin-top: .1rem; }
.kpi.slate  { border-color: var(--line); background: #fff; } .kpi.slate .ic { background: #f1f5f9; color: #475569; }
.kpi.blue   { border-color: #bfdbfe; background: linear-gradient(135deg,#eff6ff,#dbeafe66); } .kpi.blue .ic { background: #dbeafe; color: #1d4ed8; }
.kpi.emerald{ border-color: #a7f3d0; background: linear-gradient(135deg,#ecfdf5,#d1fae566); } .kpi.emerald .ic { background: #d1fae5; color: #047857; }
.kpi.amber  { border-color: #fde68a; background: linear-gradient(135deg,#fffbeb,#fef3c766); } .kpi.amber .ic { background: #fef3c7; color: #b45309; }
.kpi.rose   { border-color: #fecdd3; background: linear-gradient(135deg,#fff1f2,#ffe4e666); } .kpi.rose .ic { background: #ffe4e6; color: #be123c; }
.kpi.violet { border-color: #ddd6fe; background: linear-gradient(135deg,#f5f3ff,#ede9fe66); } .kpi.violet .ic { background: #ede9fe; color: #6d28d9; }

/* ---- cards ---- */
.card { background: #fff; border: 1px solid var(--line); border-radius: .75rem; box-shadow: var(--shadow-sm); margin-bottom: 1.1rem; }
.card-head { padding: .75rem 1rem; border-bottom: 1px solid var(--line-soft); display: flex; align-items: center; justify-content: space-between; }
.card-head h3 { margin: 0; font-size: .72rem; text-transform: uppercase; letter-spacing: .06em; font-weight: 700; color: var(--muted); }
.card-body { padding: 1rem; }

/* bars + spark */
.bar-row { display: grid; grid-template-columns: 170px 1fr 44px; align-items: center; gap: .6rem; margin: .35rem 0; }
.bar-track { background: #f1f5f9; border-radius: .4rem; height: 1.1rem; overflow: hidden; }
.bar-fill { height: 100%; border-radius: .4rem; background: var(--brand); }
.spark { display: flex; align-items: flex-end; gap: 3px; height: 90px; }
.spark .col { flex: 1; background: linear-gradient(to top, #2563eb, #60a5fa); border-radius: 3px 3px 0 0; min-height: 2px; }
.spark .col:hover { filter: brightness(1.1); }

/* ---- status cells (Monday-style solid blocks) ---- */
.status { display: inline-block; padding: .2rem .55rem; border-radius: .375rem; font-size: .72rem; font-weight: 600;
  color: #fff; white-space: nowrap; text-align: center; }
.st-grey   { background: #e2e8f0; color: #475569; }
.st-blue   { background: #3b82f6; } .st-amber { background: #f59e0b; } .st-orange { background: #f97316; }
.st-emerald{ background: #10b981; } .st-rose { background: #f43f5e; } .st-violet { background: #8b5cf6; }

.badge { display: inline-block; padding: .1rem .5rem; border-radius: .375rem; font-size: .72rem; font-weight: 600; border: 1px solid transparent; }
.badge.default { background: #f1f5f9; color: #475569; }
.badge.success { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.badge.warning { background: #fffbeb; color: #b45309; border-color: #fde68a; }
.badge.info { background: #eff6ff; color: #1d4ed8; border-color: #bfdbfe; }

/* ---- table ---- */
.table-wrap { background: #fff; border: 1px solid var(--line); border-radius: .75rem; overflow: auto; box-shadow: var(--shadow-sm); }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: .6rem .75rem; border-bottom: 1px solid var(--line-soft); white-space: nowrap; font-size: .82rem; }
th { font-size: .68rem; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); font-weight: 700;
  position: sticky; top: 0; background: #f8fafc; z-index: 1; }
tbody tr:hover { background: #f8fafc; }
tr:last-child td { border-bottom: none; }
td.edit:hover { background: #eff6ff; cursor: text; border-radius: .3rem; }
.cell-input { padding: .25rem .4rem; }
.toolbar { display: flex; gap: .6rem; align-items: center; margin-bottom: .9rem; flex-wrap: wrap; }
.toolbar input, .toolbar select { width: auto; }
.toolbar .search { min-width: 260px; }
.spacer { flex: 1; }

/* ---- kanban ---- */
.board { display: flex; gap: .8rem; overflow-x: auto; padding-bottom: .6rem; }
.board-scroll { scrollbar-width: auto; scrollbar-color: #94a3b8 #eef2f7; }
.board-scroll::-webkit-scrollbar { height: 14px; }
.board-scroll::-webkit-scrollbar-track { background: #eef2f7; border-radius: 8px; }
.board-scroll::-webkit-scrollbar-thumb { background: #94a3b8; border-radius: 8px; border: 3px solid #eef2f7; }
.col { background: #f8fafc; border: 1px solid var(--line); border-radius: .75rem; min-width: 250px; width: 250px;
  display: flex; flex-direction: column; max-height: calc(100vh - 220px); }
.col-head { padding: .6rem .75rem; font-weight: 700; font-size: .78rem; display: flex; justify-content: space-between;
  align-items: center; border-bottom: 1px solid var(--line-soft); }
.col-head .n { background: #e2e8f0; color: #475569; border-radius: 999px; padding: 0 .5rem; font-size: .7rem; }
.col-body { padding: .55rem; overflow-y: auto; display: flex; flex-direction: column; gap: .5rem; flex: 1; }
.col.drop { outline: 2px dashed var(--brand); outline-offset: -4px; background: #eff6ff; }
.kcard { background: #fff; border: 1px solid var(--line); border-radius: .6rem; padding: .6rem .7rem; box-shadow: var(--shadow-sm); cursor: grab; }
.kcard:hover { box-shadow: var(--shadow-md); }
.kcard .nm { font-weight: 600; font-size: .85rem; }
.kcard .co, .kcard .em { font-size: .74rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; }

/* ---- modal ---- */
.modal { position: fixed; inset: 0; background: rgba(15,23,42,.5); display: grid; place-items: center; padding: 20px; z-index: 50; }
.modal-card { background: #fff; border-radius: 1rem; width: 100%; max-width: 760px; max-height: 90vh;
  display: flex; flex-direction: column; box-shadow: 0 24px 60px rgba(0,0,0,.3); }
.modal-head { padding: 1rem 1.25rem; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; }
.modal-head h2 { margin: 0; font-size: 1.05rem; color: var(--ink-strong); }
.modal-body { padding: .5rem 1.25rem; overflow: auto; }
.modal-foot { padding: 1rem 1.25rem; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 1rem; }
.seq-email { border: 1px solid var(--line); border-radius: .6rem; padding: .8rem; margin: .8rem 0; }
.seq-email .lbl { font-size: .7rem; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .05em; margin-bottom: .5rem; }
.seq-email input { margin-bottom: .5rem; }
.seq-email textarea { min-height: 130px; resize: vertical; line-height: 1.55; }

.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--ink-strong);
  color: #fff; padding: .6rem 1.1rem; border-radius: .6rem; box-shadow: var(--shadow-md); z-index: 60; font-size: .85rem; }
.toast.bad { background: var(--rose); }

@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .sidebar { flex-direction: row; align-items: center; height: auto; position: static; overflow-x: auto; }
  .sidebar nav { flex-direction: row; }
  .sidebar-foot { border: none; padding: 0; }
}
