/* =====================================================================
   AVERMO STAFF DASHBOARD — internal ops tool styling
   Density and clarity over decoration. Neutral grayscale + one accent.
   ===================================================================== */

:root {
  --accent:        #00A651;
  --accent-dark:   #008440;
  --accent-tint:   rgba(0, 166, 81, 0.10);

  --bg:            #FFFFFF;
  --bg-soft:       #F8FAFC;
  --bg-alt:        #F1F5F9;
  --bg-hover:      #F1F5F9;

  --text:          #0F172A;
  --text-2:        #475569;
  --text-3:        #94A3B8;

  --border:        #E2E8F0;
  --border-2:      #CBD5E1;

  /* status colors */
  --amber:     #B45309; --amber-bg:  #FEF3C7;
  --green:     #15803D; --green-bg:  #DCFCE7;
  --red:       #B91C1C; --red-bg:    #FEE2E2;
  --blue:      #1D4ED8; --blue-bg:   #DBEAFE;
  --gray:      #475569; --gray-bg:   #E2E8F0;

  --sidebar-w: 220px;
  --topbar-h:  56px;
  --radius:    6px;
}

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

html, body {
  height: 100%;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-soft);
  -webkit-font-smoothing: antialiased;
}

button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; border: none; background: none; }
a { color: inherit; text-decoration: none; }

.hidden { display: none !important; }
.muted { color: var(--text-3); }
.t-13 { font-size: 13px; }

/* ---------- LOGIN ---------------------------------------------------- */
#login {
  min-height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-soft);
  padding: 24px;
}
.login-card {
  width: 100%;
  max-width: 360px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 32px 28px;
}
.login-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.login-sub { color: var(--text-3); font-size: 13px; margin-bottom: 24px; }

/* Brand lockup — matches the public site header exactly */
.brand-icon {
  width: 38px; height: 38px; border-radius: 6px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; overflow: hidden;
}
.brand-icon img { width: 72%; height: 72%; object-fit: contain; display: block; filter: brightness(0) invert(1); }
.brand-type { display: block; height: 18px; width: auto; object-fit: contain; flex-shrink: 0; }

/* Sidebar brand is smaller than the login card brand */
.sidebar .brand-icon { width: 28px; height: 28px; border-radius: 5px; }
.sidebar .brand-type { height: 14px; }
.field { margin-bottom: 14px; }
.field label { display: block; font-size: 12px; font-weight: 500; color: var(--text-2); margin-bottom: 6px; }
.field input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg);
}
.field input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-tint); }
.login-err { color: var(--red); font-size: 13px; margin: 4px 0 12px; min-height: 18px; }

/* ---------- BUTTONS -------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--border-2);
  background: var(--bg);
  font-weight: 500;
  font-size: 13px;
  transition: background .12s ease, border-color .12s ease;
}
.btn:hover { background: var(--bg-hover); }
.btn.full { width: 100%; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.primary:hover { background: var(--accent-dark); border-color: var(--accent-dark); }
.btn.danger { color: var(--red); border-color: var(--border-2); }
.btn.danger:hover { background: var(--red-bg); border-color: var(--red); }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn.sm { padding: 5px 9px; font-size: 12px; }

/* ---------- APP SHELL ------------------------------------------------ */
#app { display: flex; min-height: 100%; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--bg);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
}
.sidebar .brand {
  height: var(--topbar-h);
  display: flex; align-items: center;
  padding: 0 18px;
  font-weight: 600;
  font-size: 16px;
  letter-spacing: -0.02em;
  border-bottom: 1px solid var(--border);
}
.sidebar .brand span { color: var(--accent); }
.nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.nav a {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--radius);
  color: var(--text-2);
  font-weight: 500;
  margin-bottom: 2px;
}
.nav a:hover { background: var(--bg-hover); color: var(--text); }
.nav a.active { background: var(--accent-tint); color: var(--accent-dark); }
.nav a .ico { width: 18px; text-align: center; opacity: .9; }
.nav a .count {
  margin-left: auto;
  background: var(--amber-bg); color: var(--amber);
  font-size: 11px; font-weight: 600;
  padding: 1px 7px; border-radius: 100px;
}
.nav .sep { height: 1px; background: var(--border); margin: 10px 6px; }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }

.topbar {
  height: var(--topbar-h);
  flex-shrink: 0;
  background: var(--bg);
  border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 16px;
  padding: 0 20px;
  position: sticky; top: 0; z-index: 20;
}
.topbar h1 { font-size: 15px; font-weight: 600; }
.topbar .search {
  margin-left: auto;
  width: 260px;
  padding: 7px 11px;
  border: 1px solid var(--border-2);
  border-radius: var(--radius);
  background: var(--bg-soft);
}
.topbar .search:focus { outline: none; border-color: var(--accent); background: var(--bg); }
.staff-menu { position: relative; }
.staff-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 5px 8px; border-radius: var(--radius);
}
.staff-btn:hover { background: var(--bg-hover); }
.avatar {
  width: 28px; height: 28px; border-radius: 100px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 600;
}
.staff-dropdown {
  position: absolute; right: 0; top: 110%;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius); min-width: 180px;
  padding: 6px; box-shadow: 0 8px 24px rgba(15,23,42,.08);
}
.staff-dropdown .who { padding: 8px 10px; border-bottom: 1px solid var(--border); margin-bottom: 6px; }
.staff-dropdown button { display: block; width: 100%; text-align: left; padding: 7px 10px; border-radius: var(--radius); }
.staff-dropdown button:hover { background: var(--bg-hover); }

.content { flex: 1; padding: 20px; overflow-x: auto; }

/* ---------- STAT CARDS ---------------------------------------------- */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; margin-bottom: 20px; }
.stat-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.stat-card .label { font-size: 12px; color: var(--text-3); font-weight: 500; }
.stat-card .value { font-size: 26px; font-weight: 600; margin-top: 6px; letter-spacing: -0.02em; }

/* ---------- SECTION / PANEL ----------------------------------------- */
.panel { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.panel-head { display: flex; align-items: center; gap: 12px; padding: 12px 16px; border-bottom: 1px solid var(--border); }
.panel-head h2 { font-size: 14px; font-weight: 600; }
.panel-head .right { margin-left: auto; display: flex; gap: 8px; align-items: center; }

.tabs { display: inline-flex; background: var(--bg-alt); border-radius: var(--radius); padding: 2px; }
.tabs button { padding: 5px 12px; border-radius: 4px; font-size: 13px; font-weight: 500; color: var(--text-2); }
.tabs button.active { background: var(--bg); color: var(--text); box-shadow: 0 1px 2px rgba(15,23,42,.06); }

.filter-input {
  padding: 6px 10px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg-soft);
}
.filter-input:focus { outline: none; border-color: var(--accent); }

/* ---------- TABLE --------------------------------------------------- */
.table-wrap { overflow-x: auto; }
table.grid { width: 100%; border-collapse: collapse; }
table.grid thead th {
  position: sticky; top: 0;
  background: var(--bg-soft);
  text-align: left;
  font-size: 12px; font-weight: 600; color: var(--text-2);
  padding: 9px 16px;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
  cursor: pointer; user-select: none;
}
table.grid thead th.no-sort { cursor: default; }
table.grid tbody td { padding: 0 16px; height: 44px; border-bottom: 1px solid var(--border); white-space: nowrap; }
table.grid tbody tr { cursor: pointer; }
table.grid tbody tr:hover { background: var(--bg-hover); }
table.grid tbody tr:last-child td { border-bottom: none; }
.th-arrow { color: var(--text-3); font-size: 10px; margin-left: 4px; }

/* ---------- BADGE --------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 2px 9px; border-radius: 100px;
  font-size: 12px; font-weight: 500;
}
.badge .dot { width: 6px; height: 6px; border-radius: 100px; background: currentColor; }
.badge.amber { background: var(--amber-bg); color: var(--amber); }
.badge.green { background: var(--green-bg); color: var(--green); }
.badge.red   { background: var(--red-bg);   color: var(--red); }
.badge.blue  { background: var(--blue-bg);  color: var(--blue); }
.badge.gray  { background: var(--gray-bg);  color: var(--gray); }

/* ---------- STATES -------------------------------------------------- */
.state { padding: 48px 16px; text-align: center; color: var(--text-3); }
.state .big { font-size: 14px; color: var(--text-2); margin-bottom: 8px; }
.skeleton-row { height: 44px; border-bottom: 1px solid var(--border); display: flex; align-items: center; padding: 0 16px; }
.skeleton-bar { height: 12px; border-radius: 4px; background: linear-gradient(90deg,var(--bg-alt),var(--bg-hover),var(--bg-alt)); background-size: 200% 100%; animation: shimmer 1.2s infinite; width: 40%; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* ---------- SLIDE-OVER ---------------------------------------------- */
.overlay { position: fixed; inset: 0; background: rgba(15,23,42,.35); z-index: 50; opacity: 0; transition: opacity .15s ease; }
.overlay.show { opacity: 1; }
.slideover {
  position: fixed; top: 0; right: 0; height: 100vh; width: 480px; max-width: 92vw;
  background: var(--bg); z-index: 51;
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .15s ease;
  box-shadow: -8px 0 24px rgba(15,23,42,.10);
}
.slideover.show { transform: translateX(0); }
.so-head { display: flex; align-items: center; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.so-head h2 { font-size: 16px; font-weight: 600; }
.so-head .x { margin-left: auto; padding: 4px 8px; border-radius: var(--radius); color: var(--text-3); font-size: 18px; }
.so-head .x:hover { background: var(--bg-hover); }
.so-body { flex: 1; overflow-y: auto; padding: 16px 20px; }
.so-foot { border-top: 1px solid var(--border); padding: 12px 20px; display: flex; gap: 8px; }

.so-section { margin-bottom: 22px; }
.so-section h3 { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--text-3); margin-bottom: 8px; }
.kv { display: flex; justify-content: space-between; gap: 16px; padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--text-3); }
.kv .v { color: var(--text); text-align: right; word-break: break-word; }
textarea.notes { width: 100%; min-height: 84px; padding: 10px; border: 1px solid var(--border-2); border-radius: var(--radius); resize: vertical; }
textarea.notes:focus, select:focus { outline: none; border-color: var(--accent); }
select.sel { padding: 7px 10px; border: 1px solid var(--border-2); border-radius: var(--radius); background: var(--bg); }

/* ---------- CLIENT DETAIL ------------------------------------------- */
.page-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.page-head h1 { font-size: 20px; font-weight: 600; letter-spacing: -0.02em; }
.page-head .right { margin-left: auto; display: flex; gap: 8px; }
.back-link { color: var(--text-3); font-size: 13px; margin-bottom: 12px; display: inline-block; }
.back-link:hover { color: var(--accent); }
.detail-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.detail-tabs button { padding: 8px 14px; font-weight: 500; color: var(--text-2); border-bottom: 2px solid transparent; margin-bottom: -1px; }
.detail-tabs button.active { color: var(--accent-dark); border-bottom-color: var(--accent); }

/* ---------- ALLOCATION ---------------------------------------------- */
.alloc-row { display: flex; align-items: center; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.alloc-row:last-child { border-bottom: none; }
.alloc-cur { width: 56px; font-weight: 600; }
.alloc-controls { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; }
.alloc-controls input { padding: 7px 10px; border: 1px solid var(--border-2); border-radius: var(--radius); width: 180px; }

/* ---------- PROVIDERS ----------------------------------------------- */
.prov-group { margin-bottom: 20px; }
.prov-group h3 { font-size: 13px; font-weight: 600; color: var(--text-2); margin-bottom: 10px; }
.prov-cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; }
.prov-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius); padding: 14px 16px; display: flex; align-items: center; gap: 12px; }
.prov-card .meta { flex: 1; }
.prov-card .meta .name { font-weight: 600; }
.prov-card .meta .slug { font-size: 12px; color: var(--text-3); }

/* toggle */
.toggle { position: relative; width: 38px; height: 22px; flex-shrink: 0; }
.toggle input { opacity: 0; width: 0; height: 0; }
.toggle .track { position: absolute; inset: 0; background: var(--border-2); border-radius: 100px; transition: background .12s; }
.toggle .track::before { content: ""; position: absolute; left: 3px; top: 3px; width: 16px; height: 16px; background: #fff; border-radius: 100px; transition: transform .12s; }
.toggle input:checked + .track { background: var(--accent); }
.toggle input:checked + .track::before { transform: translateX(16px); }

/* ---------- CONFIRM DIALOG ------------------------------------------ */
.dialog { position: fixed; inset: 0; z-index: 60; display: flex; align-items: center; justify-content: center; background: rgba(15,23,42,.35); }
.dialog .box { background: var(--bg); border-radius: var(--radius); width: 380px; max-width: 92vw; padding: 20px; }
.dialog .box h3 { font-size: 15px; font-weight: 600; margin-bottom: 8px; }
.dialog .box p { color: var(--text-2); font-size: 13px; margin-bottom: 18px; }
.dialog .box .row { display: flex; gap: 8px; justify-content: flex-end; }

/* ---------- TOAST --------------------------------------------------- */
.toasts { position: fixed; bottom: 18px; right: 18px; z-index: 70; display: flex; flex-direction: column; gap: 8px; }
.toast {
  background: var(--text); color: #fff;
  padding: 10px 14px; border-radius: var(--radius); font-size: 13px;
  box-shadow: 0 8px 24px rgba(15,23,42,.18);
  opacity: 0; transform: translateY(8px); transition: all .15s ease; max-width: 320px;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.err { background: var(--red); }
.toast.ok { background: var(--accent-dark); }

/* signature image in request slide-over */
.sig-img { display: block; width: 100%; max-width: 280px; height: auto; border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-soft); padding: 6px; }

/* external nav link (KYC → Persona) */
.nav a.nav-external .ico { opacity: .7; }

/* json block */
.json { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 10px; font-family: ui-monospace, monospace; font-size: 12px; white-space: pre-wrap; word-break: break-word; }
