/* ─── Brand tokens ─────────────────────────────────────────────────────────── */
:root {
  --navy:   #1a2744;
  --navy-2: #243459;
  --gold:   #c9a84c;
  --gold-l: #e0c070;
  --white:  #ffffff;
  --bg:     #f4f6fb;
  --card:   #ffffff;
  --text:   #1e293b;
  --muted:  #64748b;
  --border: #e2e8f0;
}

/* ─── Base ─────────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
body { background: var(--bg); color: var(--text); font-family: 'Segoe UI', system-ui, sans-serif; }

/* ─── Navbar ───────────────────────────────────────────────────────────────── */
.navbar { background: var(--navy) !important; border-bottom: 3px solid var(--gold); }
.navbar-brand { font-weight: 700; letter-spacing: .02em; color: var(--white) !important; }
.navbar-logo { margin-right: .4rem; }

/* ─── Login page ───────────────────────────────────────────────────────────── */
.login-page {
  min-height: 100vh;
  background: linear-gradient(135deg, var(--navy) 0%, #0f172a 100%);
  display: flex; align-items: center; justify-content: center;
}
.login-container { width: 100%; max-width: 420px; padding: 1rem; }
.login-card {
  background: var(--white);
  border-radius: 16px;
  padding: 2.5rem 2rem 2rem;
  box-shadow: 0 25px 60px rgba(0,0,0,.4);
  text-align: center;
}
.login-logo .firm-seal { font-size: 3.5rem; line-height: 1; margin-bottom: .5rem; }
.login-logo h1 { font-size: 1.35rem; font-weight: 800; color: var(--navy); line-height: 1.25; margin-bottom: .25rem; }
.login-logo .subtitle { color: var(--muted); font-size: .9rem; margin-bottom: 1.75rem; }

.btn-google {
  display: flex; align-items: center; justify-content: center; gap: .75rem;
  width: 100%; padding: .75rem 1.5rem;
  background: var(--white);
  border: 2px solid var(--border);
  border-radius: 8px;
  font-size: 1rem; font-weight: 600; color: var(--text);
  text-decoration: none;
  transition: all .2s;
  cursor: pointer;
}
.btn-google:hover { border-color: var(--gold); background: #fffbf0; color: var(--text); box-shadow: 0 4px 16px rgba(201,168,76,.2); }

.login-footer { margin-top: 1.5rem; font-size: .78rem; color: var(--muted); }

/* ─── Stat cards ───────────────────────────────────────────────────────────── */
.stat-card {
  background: var(--card);
  border-radius: 12px;
  padding: 1.25rem 1rem;
  box-shadow: 0 2px 8px rgba(0,0,0,.06);
  text-align: center;
  border: 1px solid var(--border);
  transition: transform .15s;
}
.stat-card:hover { transform: translateY(-2px); }
.stat-icon { width: 44px; height: 44px; border-radius: 10px; display: flex; align-items: center; justify-content: center; margin: 0 auto .75rem; font-size: 1.3rem; }
.stat-value { font-size: 2rem; font-weight: 800; color: var(--navy); line-height: 1; }
.stat-label { font-size: .8rem; color: var(--muted); margin-top: .25rem; text-transform: uppercase; letter-spacing: .05em; }

/* ─── Page title ───────────────────────────────────────────────────────────── */
.page-title { font-size: 1.6rem; font-weight: 800; color: var(--navy); }

/* ─── Cards ────────────────────────────────────────────────────────────────── */
.card { border: 1px solid var(--border) !important; }
.card-header { background: var(--white) !important; border-bottom: 1px solid var(--border); padding: .75rem 1rem; }
.card-header h6 { font-weight: 700; color: var(--navy); }

/* ─── Score badge ──────────────────────────────────────────────────────────── */
.score-badge {
  display: inline-block;
  padding: .2em .65em;
  border-radius: 6px;
  font-size: .8rem; font-weight: 700;
  min-width: 48px; text-align: center;
}
.score-high   { background: #dcfce7; color: #166534; }
.score-medium { background: #fef9c3; color: #713f12; }
.score-low    { background: #fee2e2; color: #991b1b; }
.score-na     { background: #f1f5f9; color: #64748b; }

/* ─── Sortable table header ────────────────────────────────────────────────── */
.sortable { cursor: pointer; user-select: none; }
.sortable:hover { background: rgba(255,255,255,.05); }

/* ─── Call-type badge ──────────────────────────────────────────────────────── */
.calltype-badge {
  font-size: .72rem; font-weight: 600; padding: .2em .6em; border-radius: 20px;
  white-space: nowrap;
}
.ct-intake        { background: #dbeafe; color: #1e40af; }
.ct-post          { background: #f3e8ff; color: #6b21a8; }
.ct-pre           { background: #fce7f3; color: #9d174d; }
.ct-nonintake     { background: #f1f5f9; color: #475569; }

/* ─── Employee performance list ────────────────────────────────────────────── */
.emp-row { padding: .6rem .85rem; display: flex; align-items: center; gap: .75rem; border-bottom: 1px solid var(--border); }
.emp-row:last-child { border-bottom: none; }
.emp-name { flex: 1; font-weight: 600; font-size: .9rem; }
.emp-bar-wrap { flex: 2; background: #e2e8f0; border-radius: 4px; height: 8px; overflow: hidden; }
.emp-bar { height: 100%; border-radius: 4px; transition: width .4s; }
.emp-score-txt { font-weight: 700; font-size: .85rem; min-width: 36px; text-align: right; }

/* ─── Pagination ────────────────────────────────────────────────────────────── */
#page-info { font-size: .85rem; color: var(--muted); }

/* ─── Modal ────────────────────────────────────────────────────────────────── */
.modal-header { background: var(--navy); color: var(--white); }
.modal-header .btn-close { filter: invert(1); }
.criteria-grid { display: grid; grid-template-columns: 1fr 1fr; gap: .4rem; }
@media (max-width: 576px) { .criteria-grid { grid-template-columns: 1fr; } }
.criteria-item { background: #f8fafc; border: 1px solid var(--border); border-radius: 8px; padding: .5rem .75rem; font-size: .82rem; }
.criteria-result { font-size: 1.1rem; }

/* ─── Criteria breakdown filter bar ─────────────────────────────────────────── */
.cb-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .5rem;
  font-size: .82rem;
}
.cb-filter-bar .cb-preset { max-width: 165px; }
.cb-filter-bar .cb-date   { max-width: 150px; }
.cb-filter-bar .cb-date-label {
  display: flex;
  align-items: center;
  gap: .35rem;
  color: var(--muted);
  font-size: .75rem;
  margin-bottom: 0;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.cb-filter-bar .cb-summary {
  font-size: .78rem;
  font-style: italic;
}

/* ─── Criteria breakdown (top-of-dashboard performance grid) ────────────────── */
.criteria-breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
  table-layout: fixed;
}
.criteria-breakdown-table thead th {
  position: sticky;
  top: 0;
  background: var(--navy);
  color: var(--white);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .65rem .55rem;
  text-align: center;
  border-bottom: 3px solid var(--gold);
  z-index: 1;
}
.criteria-breakdown-table thead th.cb-criterion-col { text-align: left; }
.criteria-breakdown-table tbody td { padding: .55rem; vertical-align: middle; border-bottom: 1px solid var(--border); }
.criteria-breakdown-table tbody tr:last-child td { border-bottom: none; }
.criteria-breakdown-table tbody tr:hover { background: #fafbfc; }
.cb-num-col       { width: 44px; text-align: center; }
.cb-criterion-col { width: 32%; min-width: 220px; }
.cb-emp-col       { width: auto; min-width: 95px; }
.cb-num   { color: var(--muted); font-weight: 700; font-variant-numeric: tabular-nums; }
.cb-label { font-weight: 500; line-height: 1.35; color: var(--text); }
.cb-cell  { text-align: center; font-variant-numeric: tabular-nums; cursor: help; }
.cb-pct   { font-weight: 700; font-size: .95rem; line-height: 1.1; }
.cb-meta  { font-size: .68rem; color: var(--muted); margin-top: .1rem; }
.cb-good  { background: #dcfce7; }
.cb-good .cb-pct { color: #15803d; }
.cb-okay  { background: #fef9c3; }
.cb-okay .cb-pct { color: #a16207; }
.cb-bad   { background: #fee2e2; }
.cb-bad .cb-pct  { color: #b91c1c; }
.cb-na    { background: #f8fafc; }
.cb-na .cb-pct   { color: var(--muted); font-weight: 400; }

/* ─── Criteria scoring table (per-call detail modal) ────────────────────────── */
.criteria-summary { display: flex; gap: .4rem; flex-wrap: wrap; margin-bottom: .75rem; }
.criteria-table { width: 100%; font-size: .85rem; border-collapse: collapse; }
.criteria-table thead th {
  background: var(--bg);
  color: var(--text);
  font-weight: 600;
  font-size: .75rem;
  text-transform: uppercase;
  letter-spacing: .03em;
  padding: .55rem .65rem;
  text-align: left;
  border-bottom: 2px solid var(--border);
}
.criteria-table tbody td {
  padding: .6rem .65rem;
  vertical-align: top;
  border-bottom: 1px solid var(--border);
}
.criteria-table tbody tr:last-child td { border-bottom: none; }
.criteria-table tbody tr:hover { background: #fafbfc; }
.crit-num { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }
.crit-label { font-weight: 500; color: var(--text); line-height: 1.35; }
.crit-notes { font-size: .75rem; color: var(--muted); margin-top: .2rem; line-height: 1.4; }
.crit-row.crit-no .crit-num { color: #b91c1c; }
.crit-row.crit-yes .crit-num { color: #15803d; }
.crit-row.crit-partial .crit-num { color: #a16207; }
.result-badge {
  font-size: .72rem;
  font-weight: 600;
  padding: .2rem .5rem;
  border-radius: 999px;
  white-space: nowrap;
  display: inline-block;
  text-transform: uppercase;
  letter-spacing: .03em;
}
.result-yes     { background: #dcfce7; color: #15803d; }
.result-no      { background: #fee2e2; color: #b91c1c; }
.result-partial { background: #fef9c3; color: #a16207; }
.result-na      { background: #e5e7eb; color: #6b7280; }

/* ─── Admin table ────────────────────────────────────────────────────────────── */
.role-badge { font-size: .72rem; font-weight: 700; padding: .2em .65em; border-radius: 20px; text-transform: uppercase; letter-spacing: .04em; }
.role-superadmin { background: #fef3c7; color: #92400e; }
.role-manager    { background: #dbeafe; color: #1e3a8a; }
.role-viewer     { background: #f0fdf4; color: #14532d; }

/* ─── Upload zone ────────────────────────────────────────────────────────────── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: 10px; padding: 2rem; text-align: center;
  cursor: pointer; transition: all .2s;
}
.upload-zone:hover, .upload-zone.drag-over { border-color: var(--gold); background: #fffbf0; }

/* ─── Responsive tweaks ──────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .page-title { font-size: 1.2rem; }
  .stat-value { font-size: 1.5rem; }
  .card-header { flex-wrap: wrap; gap: .4rem; }
}
