/* ========== Medi Track UI - v4 (lightweight, green theme) ========== */
:root{
  /* Palette */
  --bg: #f6faf7;           /* airy mint background */
  --card: #ffffff;
  --text: #0f172a;         /* slate-900, keep readable */
  --muted: #5b6b7e;        /* softer slate */
  --border: #e6ede8;       /* pale green-gray */
  --line: #eff5f1;

  /* Green-first primary */
  --primary: #16a34a;      /* green-600 */
  --primary-600: #16a34a;
  --primary-700: #15803d;
  --accent: #0ea5e9;       /* sky-500 (secondary accent for charts/badges) */
  --warn: #f59e0b;         /* amber-500 */
  --danger: #ef4444;       /* red-500 */

  /* Radii / Shadows / Focus */
  --radius-lg: 14px;
  --radius-md: 10px;
  --shadow-sm: 0 2px 8px rgba(0,0,0,.04);
  --shadow-md: 0 8px 24px rgba(2,6,23,.06);
  --ring: 0 0 0 3px rgba(22,163,74,.18);  /* green ring */
}

*{ box-sizing: border-box; }
html,body{ height:100%; }
body{
  margin:0; padding:0;
  font-family: ui-sans-serif, system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial, "Noto Sans", "Liberation Sans", sans-serif;
  color: var(--text);
  background: linear-gradient(180deg, #f9fdfb 0%, var(--bg) 100%);
}

/* Remove default link underlines globally (we’ll re-add on hover where useful) */
a{ text-decoration: none; color: inherit; }

/* ------- Layout ------- */
.container{ width:100%; max-width: 1100px; margin: 0 auto; padding: 16px; }
.center-screen{ min-height: 100dvh; display:flex; align-items:center; justify-content:center; padding: 16px; }

/* ------- Navbar ------- */
.navbar{
  background: rgba(255,255,255,.92);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 50;
  box-shadow: var(--shadow-sm);
}
.nav-wrap{ max-width:1100px; margin:0 auto; padding: 10px 16px; display:flex; align-items:center; justify-content:space-between; }
.brand{ display:flex; align-items:center; gap:10px; color:var(--text); font-weight:700; letter-spacing:.2px; }
.brand .dot{ width:8px; height:8px; border-radius:50%; background:var(--primary); display:inline-block; box-shadow:0 0 0 4px rgba(22,163,74,.10); }

.hamburger{ background:none; border:0; padding:8px; border-radius:12px; cursor:pointer; }
.hamburger:focus-visible{ outline:none; box-shadow: var(--ring); }
.hamburger-bar{ width:22px; height:2px; background:#1f2937; display:block; margin:4px 0; border-radius:2px; }

.nav-drawer{ display:none; border-top:1px solid var(--border); background:#fff; }
.nav-drawer.open{ display:block; }
.nav-list{ list-style:none; margin:0; padding:8px; }
.nav-list li a{
  display:block; padding:10px 12px; color:var(--text);
  border-radius:12px; font-weight:600; /* toned down */
}
.nav-list li a.active{ background:#e8faee; color:#065f46; }  /* soft green pill */
.nav-list li a:hover{ background:#f3f7f4; }
.nav-list li a:focus-visible{ outline:none; box-shadow: var(--ring); }
@media (min-width:768px){
  .hamburger{ display:none; }
  .nav-drawer{ display:block !important; border:0; background:transparent; }
  .nav-list{ display:flex; gap:6px; padding:0; }
  .nav-list li a{ padding:8px 10px; }
}

/* ------- Cards & Sections ------- */
.page{ padding-top: 18px; }
.page-title{ font-size: 20px; font-weight:700; letter-spacing:.2px; margin: 4px 0 12px; }
.page-sub{ color:var(--muted); font-size: 13px; margin-bottom: 14px; }

.card{
  width:100%; background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  padding: 18px;
}
.card h1{ margin:0 0 8px; font-size: 20px; font-weight:700; }
.card .sub{ margin:0 0 14px; color: var(--muted); font-size: 13px; }

/* ------- Form ------- */
.form{ display:block; }
.field{ margin-bottom: 12px; }
.label{ display:block; margin:0 0 6px; font-size: 13px; color: var(--text); font-weight:600; }
.input, .select, .textarea{
  width:100%; border:1px solid var(--border); border-radius: 12px; background:#fff;
  padding: 10px 12px; font-size: 15px; transition: box-shadow .15s ease, border-color .15s ease;
}
.input:focus, .select:focus, .textarea:focus{ outline:none; border-color: var(--primary-600); box-shadow: var(--ring); }
.textarea{ min-height: 110px; resize: vertical; }

/* ------- Buttons ------- */
/* Buttons work on <a> and <button> */
.btn{
  display:inline-flex; align-items:center; justify-content:center; gap:8px;
  border:0; border-radius: 12px; padding: 10px 14px; font-size: 14px;
  font-weight:600; cursor:pointer; text-decoration:none;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease, transform .02s ease-in;
  user-select:none;
}
.btn:active{ transform: translateY(1px); }
.btn:focus-visible{ outline:none; box-shadow: var(--ring); }
.btn:disabled, .btn[disabled]{ opacity:.55; cursor:not-allowed; }

/* Primary = green */
.btn-primary{ background: var(--primary); color:#fff; }
.btn-primary:hover{ background: var(--primary-700); }

/* Subtle (ghost) */
.btn-ghost{
  background: #ffffff;
  color: #0b1220;
  border:1px solid var(--border);
}
.btn-ghost:hover{ background:#f6fbf7; border-color:#d5e5d9; }

/* Outline (soft green border) */
.btn-outline{
  background: transparent;
  color: var(--primary-700);
  border:1px solid rgba(22,163,74,.55);
}
.btn-outline:hover{ background:#eefaf2; }

/* Destructive */
.btn-danger{
  background: #fee2e2; color:#991b1b; border:1px solid #fecaca;
}
.btn-danger:hover{ background:#fecaca; }

/* Icon-only (small) */
.btn-sm{ padding: 8px 10px; font-size: 13px; border-radius: 10px; }

/* Ensure anchors styled as buttons have no underline anywhere */
a.btn, a.btn-ghost, a.btn-primary, a.btn-outline, a.btn-danger{ text-decoration:none; }

/* ------- Alerts / Badges ------- */
.alert{ padding: 10px 12px; border-radius: 12px; font-size: 13px; border:1px solid transparent; margin-bottom: 12px; }
.alert-danger{ background:#fef2f2; border-color:#fecaca; color:#b91c1c; }
.alert-info{ background:#ecfeff; border-color:#bae6fd; color:#075985; }   /* softer blue info */

.badge{
  display:inline-block; font-size:12px; padding:4px 8px; border-radius: 999px;
  border:1px solid var(--border); color:#0b1220; background:#f8fafc;
}
.badge.success{ background:#ecfdf5; border-color:#bbf7d0; color:#166534; }
.badge.warn{ background:#fffbeb; border-color:#fde68a; color:#92400e; }
.badge.danger{ background:#fef2f2; border-color:#fecaca; color:#991b1b; }
.badge.info{ background:#eff6ff; border-color:#bfdbfe; color:#1e3a8a; }

/* ------- Grid & KPI ------- */
.row{ display:grid; grid-template-columns: 1fr; gap:10px; }
@media (min-width:640px){ .row.sm-2{ grid-template-columns: repeat(2,1fr); } }
@media (min-width:1024px){ .row.lg-3{ grid-template-columns: repeat(3,1fr); } }
@media (min-width:1024px){ .row.lg-4{ grid-template-columns: repeat(4,1fr); } } /* NEW */

.kpi{
  padding:14px; border-radius:14px; border:1px solid var(--line);
  background:#fff; box-shadow: var(--shadow-sm);
}
.kpi .k{ font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:.5px; }
.kpi .v{ font-size:22px; font-weight:700; margin-top:6px; }
.kpi .t{ font-size:12px; color:var(--muted); margin-top:6px; }

/* ------- Tables ------- */
.table-wrap{
  width:100%; overflow:auto; border:1px solid var(--border);
  border-radius: 12px; background:#fff; box-shadow: var(--shadow-sm);
}
.table{ width:100%; border-collapse: collapse; min-width: 640px; }
.table th, .table td{ padding:10px 12px; text-align:left; border-bottom: 1px solid var(--line); }
.table th{
  background:#f3f7f4; font-size:13px; color:#334155; font-weight:600; position:sticky; top:0; z-index:1;
}
.table tr:hover td{ background:#f8fbf9; }

/* Small table variant (for dashboard lists) */
.table.small th, .table.small td{ padding:8px 10px; font-size:13px; }

/* ------- Footer Note ------- */
.note{ text-align:center; color: var(--muted); font-size: 12px; margin-top: 10px; }

/* ------- Utilities ------- */
.mt-2{ margin-top:8px; } .mt-3{ margin-top:12px; } .mt-4{ margin-top:16px; }
.mb-2{ margin-bottom:8px; } .mb-3{ margin-bottom:12px; } .mb-4{ margin-bottom:16px; }
.text-right{ text-align:right; } .right{ margin-left:auto; }
.hidden{ display:none !important; }

/* Brand text */
.brand-title{
  font-size: 18px;
  font-weight:700;     /* was 800 → lighter */
  letter-spacing: .2px;
  color: var(--text);
  display: inline-block;
  line-height: 1.2;
}
@media (min-width:768px){
  .brand-title{ font-size: 20px; }
}

/* Content links: re-introduce subtle underline only in content (not buttons/nav) */
.card a:not(.btn):hover, .page a:not(.btn):hover{
  text-decoration: underline;
  text-underline-offset: 2px;
  color: var(--primary-700);
}

/* Segmented controls */
.seg{ display:flex; gap:8px; flex-wrap:wrap; }
.seg label{
  border:1px solid var(--border); border-radius:10px; padding:6px 10px; cursor:pointer;
  background:#fff; user-select:none; font-size:13px;
}
.seg input{ margin-right:6px; }
.seg input:checked + span, .seg label:has(input:checked){
  border-color: rgba(22,163,74,.55); background:#eefaf2;
}

/* tiny swatch for pie legends */
.swatch {
  display:inline-block; width:12px; height:12px;
  border-radius:3px; margin-right:8px; vertical-align:middle;
  border:1px solid var(--border);
}

/* Pie ↔ legend hover sync (consultant + agent legends) */
.pie-slice-hi { opacity: .85; stroke-width: 2 !important; }
#pieLegend tr.tr-hi td,
#pieLegendAgents tr.tr-hi td { background: #eef2ff; }  /* soft indigo tint */