/* JobsForYou Telecalling CRM — purple primary, neutral surfaces, semantic status colours only. */
:root {
  --brand-900: #3b1a78;
  --brand-700: #5b2bb5;
  --brand-600: #6d3bd8;
  --brand-100: #efe9fc;
  --brand-50: #f7f4fe;
  --ink: #1d1a27;
  --ink-2: #4a4558;
  --muted: #6e6880;
  --line: #e4e1ec;
  --line-2: #d3cfdf;
  --bg: #f6f5f9;
  --surface: #ffffff;
  --success: #17803d;
  --success-bg: #e8f5ec;
  --warning: #a35a00;
  --warning-bg: #fdf3e2;
  --danger: #b42323;
  --danger-bg: #fbeaea;
  --neutral-bg: #f0eff4;
  --radius: 8px;
  --shadow: 0 1px 2px rgba(29, 26, 39, .06);
  --focus: 0 0 0 3px rgba(109, 59, 216, .35);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  color: var(--ink);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--brand-700); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 20px; font-weight: 650; }
h2 { font-size: 15px; font-weight: 650; }
h3 { font-size: 13px; font-weight: 650; color: var(--ink-2); }
p { margin: 0 0 8px; }
:focus-visible { outline: none; box-shadow: var(--focus); border-radius: 4px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.nowrap { white-space: nowrap; }
.num { text-align: right; font-variant-numeric: tabular-nums; }
.stack > * + * { margin-top: 16px; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.grow { flex: 1 1 auto; }
.row input, .row select { width: auto; }
.row input.grow, .row input[type=search] { flex: 1 1 180px; min-width: 0; }
.toolbar { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.toolbar select { max-width: 260px; }
.mt { margin-top: 16px; }

/* ---------- buttons & forms ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  height: 34px; padding: 0 14px; border-radius: var(--radius); border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 550; cursor: pointer; white-space: nowrap;
}
.btn:hover { background: var(--brand-50); text-decoration: none; }
.btn-primary { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.btn-primary:hover { background: var(--brand-700); }
.btn-danger { color: var(--danger); border-color: #e6b8b8; }
.btn-danger:hover { background: var(--danger-bg); }
.btn-sm { height: 28px; padding: 0 10px; font-size: 13px; }
.btn-lg { height: 48px; font-size: 16px; padding: 0 20px; }
.btn-block { width: 100%; }
.btn[disabled] { opacity: .6; cursor: progress; }
.link-btn { background: none; border: 0; padding: 0; color: var(--brand-700); font: inherit; cursor: pointer; }

label { display: block; font-weight: 550; margin-bottom: 4px; color: var(--ink-2); }
.field { margin-bottom: 12px; }
fieldset.plain { border: 0; padding: 0; margin: 0 0 12px; min-width: 0; }
.field-hint { font-size: 12px; color: var(--muted); margin-top: 3px; }
.field-error { font-size: 12px; color: var(--danger); margin-top: 3px; }
input[type=text], input[type=email], input[type=password], input[type=date], input[type=search], input[type=tel],
input[type=number], input[type=file], select, textarea {
  width: 100%; height: 36px; padding: 0 10px; border: 1px solid var(--line-2); border-radius: var(--radius);
  background: #fff; color: var(--ink); font: inherit;
}
input[type=file] { padding: 6px; height: auto; }
textarea { height: auto; min-height: 80px; padding: 8px 10px; resize: vertical; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand-600); box-shadow: var(--focus); }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.check { display: flex; gap: 8px; align-items: flex-start; font-weight: 400; color: var(--ink); }
.check input { margin-top: 3px; }
.password-wrap { position: relative; }
.password-wrap input { padding-right: 64px; }
.password-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); height: 26px; padding: 0 8px;
  border: 0; background: transparent; color: var(--brand-700); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow); }
.card-pad { padding: 16px; }
.card-head { padding: 12px 16px; border-bottom: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.alert { padding: 10px 14px; border-radius: var(--radius); border: 1px solid; margin-bottom: 16px; }
.alert-success { background: var(--success-bg); border-color: #b9dfc5; color: #0f5a2b; }
.alert-error { background: var(--danger-bg); border-color: #efc2c2; color: #8a1a1a; }
.alert-info { background: var(--brand-50); border-color: var(--brand-100); color: var(--brand-900); }
.alert-warning { background: var(--warning-bg); border-color: #f1d6a8; color: #7a4300; }
.empty { padding: 32px 16px; text-align: center; color: var(--muted); }
.empty strong { display: block; color: var(--ink); margin-bottom: 4px; }

.chip { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--neutral-bg); color: var(--ink-2); }
.chip-success { background: var(--success-bg); color: var(--success); }
.chip-warning { background: var(--warning-bg); color: var(--warning); }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-muted { background: var(--neutral-bg); color: var(--muted); }
.chip-brand { background: var(--brand-100); color: var(--brand-700); }
.dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; background: var(--line-2); margin-right: 4px; }
.dot-on { background: var(--success); }

/* ---------- tables ---------- */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 7px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { font-size: 12px; font-weight: 650; color: var(--muted); background: #faf9fc; position: sticky; top: 0; white-space: nowrap; }
tbody tr:hover { background: var(--brand-50); }
td.wrap { max-width: 260px; overflow-wrap: anywhere; }
.table-compact td { white-space: nowrap; }
.table-compact td.wrap { white-space: normal; min-width: 160px; }
.pager { display: flex; gap: 8px; align-items: center; justify-content: space-between; padding: 10px 16px; flex-wrap: wrap; }

/* ---------- KPI ---------- */
.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; }
.kpi { padding: 14px 16px; }
.kpi .label { font-size: 12px; color: var(--muted); font-weight: 600; }
.kpi .value { font-size: 24px; font-weight: 700; font-variant-numeric: tabular-nums; margin-top: 2px; }
.kpi .sub { font-size: 12px; color: var(--muted); }
.kpis-compact { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
.kpis-compact .value { font-size: 20px; }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 16px; }
.grid-3 { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; }
@media (max-width: 1100px) { .grid-3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 800px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

.bars { width: 100%; }
.bars text { font-size: 12px; fill: var(--ink-2); }
.bars .bar { fill: var(--brand-600); }
.bars .track { fill: var(--brand-50); }

.dl { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.dl dt { color: var(--muted); font-size: 13px; }
.dl dd { margin: 0; font-weight: 550; overflow-wrap: anywhere; }
.dl.mt { margin-top: 12px; }
form + .dl { margin-top: 20px; padding-top: 16px; border-top: 1px solid var(--line); }

/* ---------- filters ---------- */
.filters { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px 12px; align-items: end; }
.filters label { font-size: 12px; margin-bottom: 2px; }
.filters input, .filters select { height: 32px; }
details.more > summary { cursor: pointer; color: var(--brand-700); font-weight: 600; margin: 8px 0; list-style: none; }
details.more > summary::-webkit-details-marker { display: none; }

/* ---------- admin shell ---------- */
.admin-shell { display: grid; grid-template-columns: 228px minmax(0, 1fr); min-height: 100vh; }
.sidebar { background: var(--brand-900); color: #fff; padding: 16px 12px; display: flex; flex-direction: column; gap: 4px; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 16px; font-weight: 700; font-size: 15px; color: #fff; }
.brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; color: var(--brand-700); display: grid; place-items: center; font-weight: 800; font-size: 13px; flex: none; }
.brand-logo { width: 36px; height: 36px; border-radius: 8px; background: #fff; display: grid; place-items: center; flex: none; overflow: hidden; }
.brand-logo img { width: 32px; height: 32px; display: block; }
.tc-header .brand-logo { width: 30px; height: 30px; }
.tc-header .brand-logo img { width: 28px; height: 28px; }
.auth-logo { display: block; width: 88px; height: 88px; margin: 0 auto 12px; border-radius: 12px; }
.sidebar a { color: #ddd3f5; padding: 8px 10px; border-radius: 6px; font-weight: 550; display: block; }
.sidebar a:hover { background: rgba(255,255,255,.08); color: #fff; text-decoration: none; }
.sidebar a.active { background: rgba(255,255,255,.14); color: #fff; }
.sidebar .spacer { flex: 1; }
.topbar { display: flex; justify-content: flex-end; align-items: center; gap: 12px; padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5; }
.topbar .who { text-align: right; font-size: 13px; }
.admin-main { padding: 20px 24px 8px; }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.footer { padding: 16px 24px; color: var(--muted); font-size: 12px; text-align: center; }
@media (max-width: 860px) {
  .admin-shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; flex-direction: row; flex-wrap: wrap; padding: 8px; }
  .sidebar .brand { width: 100%; padding-bottom: 8px; }
  .sidebar .spacer { display: none; }
  .admin-main, .topbar { padding-left: 12px; padding-right: 12px; }
}

/* ---------- telecaller (mobile-first) ---------- */
.tc-header { position: sticky; top: 0; z-index: 10; background: var(--brand-900); color: #fff; padding: 10px 14px; display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.tc-header .brand { padding: 0; font-size: 14px; }
.tc-header .btn { height: 30px; background: transparent; color: #fff; border-color: rgba(255,255,255,.4); }
.tc-header .btn:hover { background: rgba(255,255,255,.12); }
.tc-main { max-width: 640px; margin: 0 auto; padding: 12px 12px 4px; }
.tc-profile { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 10px; }
.tc-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.tc-stats .kpi { padding: 10px; }
.tc-stats .value { font-size: 20px; }
.tabs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; margin-bottom: 10px; scrollbar-width: none; }
.tabs a { flex: none; padding: 6px 12px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; color: var(--ink-2); font-weight: 600; font-size: 13px; }
.tabs a.active { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.tabs a:hover { text-decoration: none; }
.lead-card { display: block; padding: 12px 14px; color: var(--ink); border-bottom: 1px solid var(--line); }
.lead-card:last-child { border-bottom: 0; }
.lead-card:hover { background: var(--brand-50); text-decoration: none; }
.lead-card .phone { font-size: 17px; font-weight: 700; letter-spacing: .3px; font-variant-numeric: tabular-nums; }
.lead-card .meta { font-size: 12px; color: var(--muted); margin-top: 2px; }
.call-hero { text-align: center; padding: 18px 14px; }
.call-hero .phone { font-size: 26px; font-weight: 750; letter-spacing: .5px; font-variant-numeric: tabular-nums; margin-bottom: 12px; }
.btn-call { height: 52px; font-size: 17px; width: 100%; background: var(--success); border-color: var(--success); color: #fff; border-radius: 10px; }
.btn-call:hover { background: #126a32; }
.dispositions { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.dispositions label { margin: 0; }
.dispositions input { position: absolute; opacity: 0; pointer-events: none; }
.dispositions span { display: flex; align-items: center; justify-content: center; min-height: 44px; padding: 6px; text-align: center; border: 1px solid var(--line-2); border-radius: var(--radius); background: #fff; font-weight: 600; color: var(--ink); cursor: pointer; }
.dispositions input:checked + span { background: var(--brand-600); border-color: var(--brand-600); color: #fff; }
.dispositions input:focus-visible + span { box-shadow: var(--focus); }
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.timeline li:last-child { border-bottom: 0; }
@media (min-width: 700px) { .tc-stats { grid-template-columns: repeat(6, 1fr); } }

/* ---------- auth ---------- */
.auth-wrap { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px 16px; background: linear-gradient(180deg, var(--brand-50), var(--bg)); }
.auth-card { width: 100%; max-width: 400px; padding: 28px 24px; }
.auth-card .brand-mark { width: 44px; height: 44px; font-size: 16px; background: var(--brand-600); color: #fff; margin: 0 auto 12px; }
.auth-title { text-align: center; margin-bottom: 20px; }
.auth-title h1 { font-size: 22px; }
.auth-title p { color: var(--muted); margin-top: 4px; }

/* Toolbar controls keep their natural width (placed last so it overrides the base form rules). */
.row input:not([type=checkbox]):not([type=radio]):not(.grow):not([type=search]), .row select, .toolbar select, .toolbar input[type=date] { width: auto; }
.row input[type=date], .toolbar input[type=date] { width: 150px; }
.table-compact th, .table-compact td { padding: 6px 8px; font-size: 13px; }
