:root{
  --brand-1:#0B3D91;
  --brand-2:#00BFA6;
  --brand-3:#FFB000;
  --ink:#0B1220;
  --muted:#5C667A;
  --bg:#F6F8FC;
  --card:#FFFFFF;
  --border:#E7ECF5;
  --shadow: 0 8px 24px rgba(11,18,32,.08);
  --radius: 18px;
}
*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  color: var(--ink);
  background: linear-gradient(180deg, #F6F8FC 0%, #FFFFFF 60%);
}
.container{max-width:1120px;margin:0 auto;padding:22px}
.topbar{
  position:sticky;top:0;z-index:10;
  background: rgba(246,248,252,.85);
  backdrop-filter: blur(10px);
  border-bottom:1px solid var(--border);
}
.topbar-inner{display:flex;align-items:center;justify-content:space-between;gap:16px}
.brand{display:flex;align-items:center;gap:12px;text-decoration:none;color:inherit}
.logo{
  width:42px;height:42px;border-radius:14px;
  background: radial-gradient(circle at 30% 30%, var(--brand-2), var(--brand-1));
  box-shadow: 0 10px 18px rgba(11,61,145,.18);
}
.brand h1{font-size:16px;margin:0;letter-spacing:.2px}
.brand small{display:block;color:var(--muted);font-size:12px;margin-top:2px}
.topbar-right{display:flex;align-items:center;gap:10px}
.nav-menu-toggle{display:none}
.nav-collapse-toggle{
  display:inline-flex;
  width:40px;
  height:40px;
  padding:0;
  border-radius:10px;
}
.burger-icon,
.burger-icon::before,
.burger-icon::after{
  display:block;
  width:18px;
  height:2px;
  background:currentColor;
  border-radius:2px;
  transition:transform .2s ease, opacity .2s ease;
}
.burger-icon{position:relative}
.burger-icon::before,
.burger-icon::after{
  content:"";
  position:absolute;
  left:0;
}
.burger-icon::before{top:-6px}
.burger-icon::after{top:6px}
body.nav-collapsed .burger-icon{background:transparent}
body.nav-collapsed .burger-icon::before{top:0;transform:rotate(45deg)}
body.nav-collapsed .burger-icon::after{top:0;transform:rotate(-45deg)}
.app-shell{
  --sidebar-width:260px;
  --shell-gap:18px;
  display:grid;
  grid-template-columns:var(--sidebar-width) minmax(0,1fr);
  gap:var(--shell-gap);
  align-items:start;
}
.app-shell{transition:grid-template-columns .2s ease}
.sidebar{
  position:sticky;
  top:86px;
  width:260px;
  max-width:100%;
  transform:translateX(0);
  transition:transform .22s ease, opacity .2s ease;
}
body.nav-collapsed .app-shell{
  --sidebar-width:0px;
  --shell-gap:0px;
}
body.nav-collapsed .sidebar{
  opacity:0;
  transform:translateX(-110%);
  pointer-events:none;
}
.nav-backdrop{display:none}
.nav{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.sidebar-nav{
  display:flex;
  flex-direction:column;
  gap:10px;
  padding:12px;
  border:1px solid var(--border);
  border-radius:14px;
  background:#fff;
  box-shadow: var(--shadow);
}
.nav a{
  text-decoration:none;
  padding:10px 12px;
  border:1px solid var(--border);
  border-radius:10px;
  background: #fff;
  color:var(--ink);
}
.nav a:hover{background:rgba(11,61,145,.04)}
.nav a.active{
  border-color: rgba(0,191,166,.45);
  background: rgba(0,191,166,.08);
  box-shadow:none;
  font-weight:700;
}
.nav-group{
  display:flex;
  align-items:center;
  gap:8px;
  padding:6px 8px;
  border:1px solid var(--border);
  border-radius:12px;
  background:rgba(255,255,255,.5);
}
.nav-group-title{
  font-size:11px;
  font-weight:700;
  color:var(--muted);
  text-transform:uppercase;
  letter-spacing:.3px;
  white-space:nowrap;
  cursor:pointer;
  list-style:none;
}
.nav-group-title::-webkit-details-marker{display:none}
.nav-group-links{
  display:flex;
  gap:8px;
  flex-wrap:wrap;
}
.sidebar-nav .nav-group{
  width:100%;
  align-items:flex-start;
  flex-direction:column;
  gap:8px;
}
.sidebar-nav .nav-group-title{
  width:100%;
  font-size:12px;
}
.sidebar-nav .nav-group-links{
  width:100%;
  flex-direction:column;
}
.sidebar-nav a{
  width:100%;
  border-radius:10px;
  background:#fff;
}
.app-main{min-width:0}
.grid{display:grid;grid-template-columns:repeat(12,1fr);gap:16px}
.card{
  background:var(--card);
  border:1px solid var(--border);
  border-radius:var(--radius);
  box-shadow: var(--shadow);
  padding:18px;
}
.card h2{margin:0 0 8px 0;font-size:18px}
.card p{margin:0;color:var(--muted);line-height:1.45}
.hero{grid-column:span 12; padding:22px; overflow:hidden; position:relative}
.hero::after{
  content:"";
  position:absolute;inset:-60px -90px auto auto;
  width:240px;height:240px;border-radius:999px;
  background: radial-gradient(circle at 30% 30%, rgba(255,176,0,.55), rgba(0,191,166,.25));
  filter: blur(2px);
}
.kpi{display:flex;gap:14px;flex-wrap:wrap;margin-top:14px}
.pill{
  display:inline-flex;align-items:center;gap:8px;
  padding:8px 12px;border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.85);
  font-size:12px;color:var(--muted)
}
.dot{width:10px;height:10px;border-radius:999px;background:var(--muted)}
.dot.red{background:#E11D48}
.dot.amber{background:#F59E0B}
.dot.green{background:#16A34A}
.dot.blue{background:var(--brand-1)}
.dot.teal{background:var(--brand-2)}
.table{width:100%;border-collapse:separate;border-spacing:0 10px;margin-top:10px}
.table th{font-size:12px;color:var(--muted);font-weight:600;text-align:left;padding:0 12px}
.row{background:#fff;border:1px solid var(--border);border-radius:14px}
.row td{padding:12px}
.row td:first-child{border-top-left-radius:14px;border-bottom-left-radius:14px}
.row td:last-child{border-top-right-radius:14px;border-bottom-right-radius:14px}
.badge{
  display:inline-flex;align-items:center;gap:8px;
  padding:6px 10px;border-radius:999px;font-weight:700;font-size:12px;
  border:1px solid var(--border);
}
.badge.red{background:rgba(225,29,72,.08); color:#BE123C; border-color: rgba(225,29,72,.25)}
.badge.amber{background:rgba(245,158,11,.12); color:#B45309; border-color: rgba(245,158,11,.25)}
.badge.green{background:rgba(22,163,74,.10); color:#166534; border-color: rgba(22,163,74,.25)}
.badge.muted{background:rgba(148,163,184,.18); color:#475569; border-color: rgba(148,163,184,.35)}
.badge.teal{background:rgba(0,191,166,.12); color:#0F766E; border-color: rgba(0,191,166,.25)}
.btn{
  display:inline-flex;align-items:center;justify-content:center;gap:8px;
  padding:10px 14px;border-radius:12px;border:1px solid var(--border);
  background:var(--ink);color:#fff;text-decoration:none;cursor:pointer;
}
.btn.secondary{background:#fff;color:var(--ink)}
.btn:disabled{opacity:.6;cursor:not-allowed}
.input{padding:10px 12px;border-radius:12px;border:1px solid var(--border);width:260px;max-width:100%}
.footer{padding:26px 0;color:var(--muted);font-size:12px}
.notice{padding:12px 14px;border-radius:14px;border:1px solid rgba(225,29,72,.25);background:rgba(225,29,72,.06)}
.notice strong{color:#BE123C}
@media (max-width:1024px){
  .app-shell{grid-template-columns:1fr}
  .sidebar{position:static}
  .nav-menu-toggle{display:inline-flex}
  .nav-collapse-toggle{display:none}
  .nav-backdrop{
    position:fixed;
    inset:0;
    z-index:29;
    border:0;
    background:rgba(11,18,32,.35);
    display:none;
    padding:0;
    margin:0;
  }
  body.nav-open .nav-backdrop{display:block}
  .sidebar-nav{
    position:fixed;
    top:74px;
    left:0;
    z-index:30;
    display:none;
    flex-direction:column;
    gap:8px;
    width:min(90vw, 360px);
    max-height:calc(100vh - 88px);
    overflow:auto;
    border:1px solid var(--border);
    border-left:none;
    border-radius:0 12px 12px 0;
    background:#fff;
    padding:10px;
    box-shadow:var(--shadow);
  }
  .sidebar-nav.nav-open{display:flex}
  .nav-group{
    width:100%;
    align-items:flex-start;
    flex-direction:column;
    padding:0;
    border:none;
    background:transparent;
  }
  .nav-group[open]{
    border:1px solid var(--border);
    border-radius:10px;
    background:#fff;
    padding:8px;
  }
  .nav-group-title{font-size:12px;width:100%}
  .nav-group-links{width:100%}
  .input{width:100%}
}
/* UI v2 additions */
.split{display:flex;gap:12px;flex-wrap:wrap;align-items:center}
.chip{
  display:inline-flex;align-items:center;gap:8px;
  padding:7px 10px;border-radius:999px;
  border:1px solid var(--border);
  background:rgba(255,255,255,.85);
  font-size:12px;color:var(--muted)
}
.chip strong{color:var(--ink)}
.actions{display:flex;gap:10px;flex-wrap:wrap;justify-content:flex-end}
.hr{height:1px;background:var(--border);margin:14px 0}
.mono{font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size:12px; color:var(--muted)}
textarea.input{width:100%;min-height:90px}
.chart{display:flex;gap:10px;align-items:flex-end;margin-top:10px}
.bar{flex:1;border:1px solid var(--border);border-radius:14px;background:#fff;overflow:hidden}
.bar .fill{height:120px;display:flex;align-items:flex-end;justify-content:center;color:#111;font-weight:700;font-size:12px;padding-bottom:8px}
.bar .label{padding:10px 12px;border-top:1px solid var(--border);color:var(--muted);font-size:12px}
.fill.red{background:linear-gradient(180deg, rgba(225,29,72,.25), rgba(225,29,72,.08))}
.fill.amber{background:linear-gradient(180deg, rgba(245,158,11,.28), rgba(245,158,11,.10))}
.fill.green{background:linear-gradient(180deg, rgba(22,163,74,.22), rgba(22,163,74,.08))}
.fill.teal{background:linear-gradient(180deg, rgba(0,191,166,.25), rgba(0,191,166,.08))}
.small{font-size:12px;color:var(--muted)}

/* UI v3 polish */
.toast-wrap{position:fixed;top:74px;right:18px;z-index:9999;display:flex;flex-direction:column;gap:10px;max-width:360px}
.toast{border:1px solid var(--border);background:#fff;border-radius:16px;box-shadow: var(--shadow);padding:12px 14px;display:flex;gap:10px;align-items:flex-start}
.toast .icon{width:18px;height:18px;border-radius:6px;margin-top:2px}
.toast .title{font-weight:800;font-size:13px;margin:0}
.toast .msg{margin:2px 0 0 0;font-size:12px;color:var(--muted);line-height:1.35}
.toast.success{border-color: rgba(22,163,74,.25)} .toast.success .icon{background:rgba(22,163,74,.25)}
.toast.error{border-color: rgba(225,29,72,.25)} .toast.error .icon{background:rgba(225,29,72,.25)}
.toast.info{border-color: rgba(0,191,166,.25)} .toast.info .icon{background:rgba(0,191,166,.25)}
.table-wrap{overflow:auto;-webkit-overflow-scrolling:touch}
.table{min-width:860px}
@media (max-width:820px){.toast-wrap{left:18px;right:18px;max-width:none}.table{min-width:720px}}

/* UI v4 polish+ */
.spinner{
  width:16px;height:16px;border-radius:999px;
  border:2px solid rgba(255,255,255,.55);
  border-top-color:#fff;
  animation:spin .9s linear infinite;
}
@keyframes spin{to{transform:rotate(360deg)}}
.btn.loading{opacity:.85; pointer-events:none}
.btn.loading .spinner{display:inline-block}
.btn .spinner{display:none}
/* Modal */
.modal-backdrop{position:fixed;inset:0;background:rgba(11,18,32,.45);z-index:10000;display:none;align-items:center;justify-content:center;padding:18px}
.modal{max-width:520px;width:100%;background:#fff;border:1px solid var(--border);border-radius:20px;box-shadow: var(--shadow);padding:16px}
.modal h3{margin:0 0 6px 0;font-size:16px}
.modal p{margin:0;color:var(--muted);line-height:1.45}
.modal .actions{margin-top:12px;justify-content:flex-end}
/* Toast history */
.toast-history-btn{
  position:fixed;bottom:18px;right:18px;z-index:9998;
  width:46px;height:46px;border-radius:16px;
  border:1px solid var(--border);background:#fff;box-shadow: var(--shadow);
  display:flex;align-items:center;justify-content:center;cursor:pointer;
}
.toast-history-panel{
  position:fixed;bottom:74px;right:18px;z-index:9998;
  width:min(420px, calc(100vw - 36px));
  background:#fff;border:1px solid var(--border);border-radius:18px;box-shadow: var(--shadow);
  padding:12px;display:none;
}
.toast-history-panel h4{margin:0 0 8px 0;font-size:14px}
.toast-history-item{padding:10px;border:1px solid var(--border);border-radius:14px;margin-top:8px}
.toast-history-item .meta{font-size:11px;color:var(--muted)}
.toast-history-item .text{margin-top:4px;font-size:12px}
/* Table fit */
.table-fit{min-width:0;table-layout:fixed}
.table-fit th, .table-fit td{word-break:break-word}


/* Register Patient form layout */
.form-grid{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:16px;margin-top:14px}
.form-grid .input,.form-grid select{width:100%}
@media (max-width:820px){
  .form-grid{grid-template-columns:1fr}
}

.lbl{display:block;font-size:12px;font-weight:600;color:var(--muted);margin:10px 0 6px}

.card-head{display:flex;align-items:flex-start;justify-content:space-between;gap:12px;margin-bottom:12px}

.card-grid-2{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:12px}
@media (max-width:900px){.card-grid-2{grid-template-columns:1fr}}

/* Register Patient sticky actions (matches Employer card feel) */
.card-actions-sticky{position:sticky;bottom:12px;display:flex;gap:10px;justify-content:flex-end;margin-top:14px;padding-top:12px;border-top:1px solid rgba(255,255,255,.06);background:linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(16,18,24,.9) 35%, rgba(16,18,24,1) 100%);backdrop-filter:blur(8px)}
@media (max-width:900px){.card-actions-sticky{position:static;background:none;backdrop-filter:none;border-top:0;padding-top:0}}

/* Register Patient - single card layout */
.reg-onecard-grid{display:grid;grid-template-columns:1fr 1fr;gap:18px}
.reg-onecard-grid .section{min-width:0}
.section-title{font-weight:700;margin:6px 0 10px}
@media (max-width:1000px){.reg-onecard-grid{grid-template-columns:1fr}}

/* Register Patient full-width card */
.reg-full{width:100%;max-width:none}

/* Register Patient actions */
.reg-actions{display:flex;gap:10px;justify-content:flex-end;margin-top:16px;padding-top:12px;border-top:1px solid rgba(255,255,255,.06)}
@media (max-width:900px){.reg-actions{justify-content:stretch;flex-direction:column}}


/* UX uplift */
.table-wrap{overflow:auto}
.tbl{width:100%;border-collapse:separate;border-spacing:0 10px}
.tbl thead th{font-size:12px;color:var(--muted);text-align:left;padding:6px 10px}
.tbl tbody td{background:rgba(255,255,255,.03);padding:10px;border-top:1px solid rgba(255,255,255,.06);border-bottom:1px solid rgba(255,255,255,.06)}
.tbl tbody tr td:first-child{border-left:1px solid rgba(255,255,255,.06);border-top-left-radius:14px;border-bottom-left-radius:14px}
.tbl tbody tr td:last-child{border-right:1px solid rgba(255,255,255,.06);border-top-right-radius:14px;border-bottom-right-radius:14px}
.t-right{text-align:right}
.strong{font-weight:700}
.mono{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,"Liberation Mono","Courier New",monospace;font-size:12px}
.pill{display:inline-flex;align-items:center;justify-content:center;min-width:26px;height:22px;padding:0 8px;border-radius:999px;background:rgba(255,255,255,.06);border:1px solid rgba(255,255,255,.08)}
.badge{display:inline-flex;align-items:center;gap:6px;padding:4px 10px;border-radius:999px;border:1px solid rgba(255,255,255,.12);font-size:12px}
.badge.red{background:rgba(255,59,48,.12);border-color:rgba(255,59,48,.25)}
.badge.amber{background:rgba(255,159,10,.12);border-color:rgba(255,159,10,.25)}
.badge.green{background:rgba(52,199,89,.12);border-color:rgba(52,199,89,.25)}
.kpi-grid{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.kpi{background:rgba(255,255,255,.03);border:1px solid rgba(255,255,255,.06);border-radius:16px;padding:12px}
.kpi-val{font-size:28px;font-weight:800;margin-top:4px}
.queue{display:flex;flex-direction:column;gap:10px}
.alert-card{display:flex;align-items:flex-start;justify-content:space-between;gap:14px;padding:12px;border:1px solid rgba(255,255,255,.06);border-radius:16px;background:rgba(255,255,255,.03)}
.alert-left{min-width:0}
.alert-actions{display:flex;gap:10px;align-items:center}
.btn.sm{padding:8px 10px;font-size:12px;border-radius:12px}
@media (max-width:900px){
  .kpi-grid{grid-template-columns:1fr}
  .alert-card{flex-direction:column}
  .alert-actions{justify-content:flex-end;width:100%}
}


/* AFYA360 UX Polish */
:root{
  --afya-card-radius: 16px;
  --afya-shadow: 0 10px 25px rgba(0,0,0,.08);
  --afya-border: rgba(0,0,0,.08);
}

.container, .container-fluid { max-width: 1200px; }

.afya-page-title { display:flex; align-items:center; justify-content:space-between; gap:12px; margin: 14px 0 16px; }
.afya-page-title h1, .afya-page-title h2 { margin:0; }

.afya-card { border-radius: var(--afya-card-radius) !important; box-shadow: var(--afya-shadow); border: 1px solid var(--afya-border); }
.afya-card .card-header { border-top-left-radius: var(--afya-card-radius); border-top-right-radius: var(--afya-card-radius); background: rgba(255,255,255,.75); backdrop-filter: blur(6px); }

.afya-toolbar { display:flex; flex-wrap:wrap; align-items:end; gap:10px; }
.afya-toolbar .form-group { margin-bottom:0; }
.afya-toolbar .btn { white-space:nowrap; }

.afya-table { border-radius: 14px; overflow: hidden; border: 1px solid var(--afya-border); }
.afya-table table { margin-bottom:0; }
.afya-table thead th { font-weight: 600; background: rgba(0,0,0,.03); }

.afya-pill { display:inline-flex; align-items:center; gap:6px; padding: 4px 10px; border-radius: 999px; font-size: .85rem; border:1px solid var(--afya-border); background: rgba(255,255,255,.8); }
.afya-pill .dot{ width:8px; height:8px; border-radius:50%; display:inline-block; background: currentColor; opacity:.9; }

.afya-muted { color: rgba(0,0,0,.60); }
.afya-kpi { display:grid; grid-template-columns: repeat(4, minmax(0,1fr)); gap:12px; }
@media (max-width: 992px){ .afya-kpi{ grid-template-columns: repeat(2, minmax(0,1fr)); } }
@media (max-width: 540px){ .afya-kpi{ grid-template-columns: 1fr; } }

.afya-kpi .kpi-card{ padding:14px; border-radius:14px; border:1px solid var(--afya-border); background: rgba(255,255,255,.85); }
.afya-kpi .kpi-card .label{ font-size:.85rem; }
.afya-kpi .kpi-card .value{ font-size:1.35rem; font-weight:700; margin-top:4px; }

.afya-empty { padding: 18px; border-radius: 14px; border: 1px dashed var(--afya-border); background: rgba(0,0,0,.02); }


/* ClinicianCarePlans layout helpers */
.ccp-actions{
  display:flex;
  gap:8px;
  justify-content:flex-end;
  align-items:center;
  flex-wrap:nowrap;
  white-space:nowrap;
}
.btn.btn-sm{
  padding:6px 10px;
  font-size:12px;
  line-height:1.1;
}
/* Patient history table: avoid horizontal scroll */
.ccp-tablewrap{
  margin-top:10px;
  max-height:420px;
  overflow-y:auto;
  overflow-x:hidden;
  border:1px solid rgba(0,0,0,.06);
  border-radius:10px;
}
.ccp-table{
  width:100%;
  table-layout:fixed;
}
.ccp-table th, .ccp-table td{
  word-wrap:break-word;
  overflow-wrap:anywhere;
  white-space:normal;
}
/* 3-panel area: documents/alerts/engagement */
.ccp-3col{
  display:grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap:14px;
}
.ccp-panel{
  box-shadow:none;
  border:1px solid rgba(0,0,0,.08);
  min-width:0;
}
.ccp-panel *{
  min-width:0;
}
/* Plan config cards */
.ccp-config{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:14px;
}
.ccp-config-card{
  box-shadow:none;
  border:1px solid rgba(0,0,0,.06);
  min-width:0;
}
.ccp-config-card pre{
  white-space:pre-wrap;
  word-break:break-word;
  overflow-wrap:anywhere;
}
/* Responsive fallback */
@media (max-width: 1100px){
  .ccp-3col{ grid-template-columns: 1fr; }
  .ccp-config{ grid-template-columns: 1fr; }
  .ccp-actions{ justify-content:flex-start; }
}

.ccp-config .ccp-config-card[style*="grid-column:span 12"]{ grid-column:1 / -1; }


/* JSON renderer (ClinicianCarePlans) */
.json-table td, .json-table th{ vertical-align:top; }
.json-key{ font-weight:700; }
.json-details{ border:1px solid rgba(0,0,0,.08); border-radius:10px; padding:8px 10px; }
.json-details > summary{ cursor:pointer; list-style:none; }
.json-details > summary::-webkit-details-marker{ display:none; }
.json-details > summary{ display:flex; gap:8px; align-items:center; }
.json-details > summary:before{ content:"▸"; opacity:.7; }
.json-details[open] > summary:before{ content:"▾"; }
.json-array{ display:flex; flex-direction:column; gap:8px; margin-top:6px; }


/* Plan configuration readability */
.pc-row {
  display:flex;
  gap:12px;
  padding:4px 0;
}
.pc-label {
  min-width:140px;
  font-weight:600;
  opacity:.7;
}
.pc-value {
  flex:1;
}

.ccp-config {
  grid-template-columns: repeat(2, minmax(0,1fr));
}

.ccp-config-card {
  box-shadow:none;
  border:1px solid rgba(0,0,0,.08);
}

.ccp-config-card > .small {
  margin-bottom:6px;
}



/* Plan summary panels */
.pc-panels {
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:12px;
}
.pc-panel {
  border:1px solid rgba(0,0,0,.08);
  border-radius:14px;
  padding:12px;
  background: rgba(0,0,0,.01);
}
.threshold-table code { font-size:12px; }


/* ClinicianCarePlans - ensure patient history table fits container */
.ccp-history-table {
  width: 100%;
  table-layout: fixed;
}
.ccp-history-table th,
.ccp-history-table td {
  padding: 6px 8px;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: top;
}
/* Prefer narrower timestamp + type columns (if present) */
.ccp-history-table th:nth-child(1),
.ccp-history-table td:nth-child(1) { width: 120px; }
.ccp-history-table th:nth-child(2),
.ccp-history-table td:nth-child(2) { width: 120px; }
.ccp-history-table th:nth-child(3),
.ccp-history-table td:nth-child(3) { width: 110px; }



/* ClinicianCarePlans - Plan config table */
.ccp-config-table {
  width: 100%;
  table-layout: fixed;
}
.ccp-config-table td {
  vertical-align: top;
  padding: 8px 10px;
}
.ccp-config-label {
  width: 170px;
  font-weight: 600;
  opacity: .75;
  white-space: nowrap;
}
.ccp-config-table td:nth-child(2) {
  overflow: hidden;
}

/* Tighter formatting for Configuration details */
.ccp-config-table {
  font-size: 12px;
}
.ccp-config-table td {
  padding: 6px 8px;
}
.ccp-config-table pre,
.ccp-config-table code {
  font-size: 11px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.ccp-config-table details > summary {
  font-size: 12px;
}


/* Employer dashboard - compact tables that always fit their cards */
.emp-mini-table {
  width: 100%;
  max-width: 100%;
  table-layout: fixed;
  font-size: 12px;
}
.emp-mini-table th,
.emp-mini-table td {
  padding: 6px 8px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.emp-mini-table th {
  opacity: .75;
  font-weight: 700;
}
/* Make the 4-col risk table even tighter */
.emp-risk-mini th,
.emp-risk-mini td {
  padding: 6px 6px;
  text-align: center;
}
/* Overdue table: constrain columns */
.emp-overdue-mini th:nth-child(1),
.emp-overdue-mini td:nth-child(1) { width: 90px; }
.emp-overdue-mini th:nth-child(3),
.emp-overdue-mini td:nth-child(3) { width: 120px; }
.emp-overdue-mini th:nth-child(4),
.emp-overdue-mini td:nth-child(4) { width: 70px; text-align:right; }
.emp-overdue-mini td:nth-child(2) { width: auto; }


/* Employer dashboard graphs */
.emp-stacked{
  width:100%;
  height:18px;
  display:flex;
  border-radius:10px;
  overflow:hidden;
  border:1px solid rgba(0,0,0,.08);
  background:rgba(0,0,0,.03);
}
.emp-seg{height:100%;min-width:1px;}
.emp-seg.green{background: rgba(0,160,0,.55);}
.emp-seg.amber{background: rgba(255,140,0,.55);}
.emp-seg.red{background: rgba(220,0,0,.55);}
.emp-seg.gray{background: rgba(0,0,0,.18);}

.emp-legend{
  display:grid;
  grid-template-columns: repeat(2, minmax(0,1fr));
  gap:8px;
  font-size:12px;
}
.emp-legend .item{display:flex;align-items:center;gap:8px;white-space:nowrap}
.emp-legend .sw{width:10px;height:10px;border-radius:3px;display:inline-block}
.emp-legend .sw.green{background: rgba(0,160,0,.55);}
.emp-legend .sw.amber{background: rgba(255,140,0,.55);}
.emp-legend .sw.red{background: rgba(220,0,0,.55);}
.emp-legend .sw.gray{background: rgba(0,0,0,.18);}

.emp-bars .bar{
  display:grid;
  grid-template-columns: 90px 1fr 40px;
  gap:10px;
  align-items:center;
  margin-top:8px;
  font-size:12px;
}
.emp-bars .label{opacity:.8;white-space:nowrap}
.emp-bars .track{
  height:10px;
  border-radius:10px;
  background:rgba(0,0,0,.06);
  overflow:hidden;
  border:1px solid rgba(0,0,0,.06);
}
.emp-bars .fill{height:100%;}
.emp-bars .fill.amber{background: rgba(255,140,0,.55);}
.emp-bars .fill.red{background: rgba(220,0,0,.55);}
.emp-bars .value{text-align:right;white-space:nowrap}

.link{color:inherit;text-decoration:underline;text-underline-offset:3px;opacity:.9}
.link:hover{opacity:1}


/* Employer dashboard trends */
.trend-grid{
  display:grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap:12px;
}
.trend-item{
  border:1px solid rgba(0,0,0,.06);
  background:rgba(0,0,0,.02);
  border-radius:12px;
  padding:10px 12px;
}
.trend-item .label{font-size:12px;opacity:.75;white-space:nowrap}
.trend-item .value{margin-top:6px;font-weight:700;font-size:14px}
.spark{width:100%;height:48px;display:block;margin-top:6px}
.spark polyline{stroke-width:3;stroke-linecap:round;stroke-linejoin:round}
.spark.eng polyline{stroke: rgba(0,110,255,.65);}
.spark.alerts polyline{stroke: rgba(220,0,0,.65);}
.spark.due polyline{stroke: rgba(255,140,0,.75);}
.spark.comp polyline{stroke: rgba(0,160,0,.65);}

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


.row-danger { background: rgba(220, 53, 69, 0.08) !important; }

.btn.small{padding:6px 10px;font-size:12px;border-radius:10px}
