/* =====================================================================
   Nutritionist Bangladesh — master stylesheet
   Domain: nutritionists.hno.bd
   Consolidates every module:
     · Auth (login / register)
     · Forms, buttons, alerts, tables
     · Admin layout + colorful dashboard (bento grid)
     · Nutritionist layout
     · Patient registration + view
     · Diet chart builder + meal tables
     · Prescription builder
     · Diagnostic test picker
     · Public patient view (p/view.php)
     · Print styles
     · Live search + server-side pagination
   ===================================================================== */

/* =====================================================================
   1. DESIGN TOKENS
   ===================================================================== */
:root{
  /* Core brand */
  --green:        #0b6b3a;
  --green-dark:   #064d29;
  --green-light:  #e6f4ec;
  --green-soft:   #f0fdf4;

  /* Status */
  --amber:        #b45309;
  --amber-soft:   #fffbea;
  --red:          #b91c1c;
  --red-soft:     #fee2e2;
  --sky:          #0ea5e9;

  /* Neutrals */
  --gray:         #6b7280;
  --gray-light:   #f3f4f6;
  --line:         #e5e7eb;
  --bg:           #f5f7f8;
  --white:        #ffffff;
  --text:         #111827;

  /* Shape & shadow */
  --radius:       10px;
  --radius-sm:    6px;
  --radius-lg:    16px;
  --shadow-sm:    0 1px 2px rgba(0,0,0,.05);
  --shadow-md:    0 4px 12px rgba(0,0,0,.08);
  --shadow-lg:    0 20px 60px rgba(0,0,0,.25);

  /* Dashboard accent palette */
  --c-emerald:    #10b981;
  --c-emerald-2:  #059669;
  --c-indigo:     #6366f1;
  --c-indigo-2:   #4f46e5;
  --c-rose:       #f43f5e;
  --c-rose-2:     #e11d48;
  --c-amber:      #f59e0b;
  --c-amber-2:    #d97706;
  --c-sky:        #0ea5e9;
  --c-sky-2:      #0284c7;
  --c-violet:     #8b5cf6;
  --c-violet-2:   #7c3aed;
  --c-teal:       #14b8a6;
  --c-teal-2:     #0d9488;
  --c-fuchsia:    #d946ef;
  --c-fuchsia-2:  #c026d3;

  /* Fonts */
  --font:         'Segoe UI', system-ui, -apple-system,
                  'Noto Sans Bengali', 'SolaimanLipi', sans-serif;
  --font-mono:    'SF Mono', Consolas, 'Courier New', monospace;
}

/* =====================================================================
   2. RESET & BASE
   ===================================================================== */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body{
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
h1, h2, h3, h4, h5, h6 { margin: 0 0 10px; font-weight: 600; line-height: 1.3; }
h1 { font-size: 1.6rem; }
h2 { font-size: 1.3rem; }
h3 { font-size: 1.1rem; }
h4 { font-size: 1rem; margin-top: 18px; }
p  { margin: 0 0 12px; }
img { max-width: 100%; display: block; }
a { color: var(--green); text-decoration: none; }
a:hover { text-decoration: underline; }
code {
  font-family: var(--font-mono);
  background: var(--gray-light);
  padding: 1px 5px;
  border-radius: 4px;
  font-size: .88em;
}
pre {
  background: #f8fafc;
  border: 1px solid var(--line);
  padding: 12px;
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .85rem;
}
::selection{ background: var(--green-light); color: var(--green-dark); }

/* =====================================================================
   3. AUTH PAGES (login / register)
   ===================================================================== */
.auth-page{
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #0b6b3a 0%, #064d29 100%);
  padding: 20px;
}
.auth-card{
  background: var(--white);
  width: 100%;
  max-width: 440px;
  padding: 34px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-lg);
}
.auth-card h1{
  margin: 0 0 4px;
  color: var(--green-dark);
  font-size: 1.55rem;
}
.auth-card .muted{
  color: var(--gray);
  margin: 0 0 22px;
  font-size: .9rem;
}
.auth-foot{
  margin-top: 20px;
  text-align: center;
  font-size: .9rem;
  color: var(--gray);
}

/* =====================================================================
   4. FORMS
   ===================================================================== */
label{
  display: block;
  margin-bottom: 14px;
  font-size: .9rem;
  font-weight: 600;
  color: #222;
}
input[type="text"],
input[type="email"],
input[type="password"],
input[type="number"],
input[type="date"],
input[type="time"],
input[type="search"],
input[type="file"],
input[type="tel"],
select,
textarea{
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--line);
  border-radius: 8px;
  font-size: .95rem;
  font-family: inherit;
  color: var(--text);
  background: var(--white);
  margin-top: 5px;
  transition: border-color .15s, box-shadow .15s;
}
input:focus,
select:focus,
textarea:focus{
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px var(--green-light);
}
input[readonly],
input:disabled,
select:disabled,
textarea:disabled{
  background: var(--gray-light);
  color: #555;
  cursor: not-allowed;
}
textarea{
  resize: vertical;
  min-height: 70px;
  line-height: 1.5;
}
small.err{
  color: var(--red);
  font-weight: 500;
  font-size: .8rem;
  display: block;
  margin-top: 4px;
}
.muted{ color: var(--gray); }

/* Radio / checkbox rows */
.radios{
  display: flex;
  flex-wrap: wrap;
  gap: 6px 16px;
  margin-top: 4px;
}
.radios.col{
  flex-direction: column;
  gap: 4px;
}
.r{
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-weight: 400;
  font-size: .9rem;
  margin: 0;
  cursor: pointer;
}
.r input{ margin: 0; }
input[type="checkbox"],
input[type="radio"]{
  width: auto;
  accent-color: var(--green);
  cursor: pointer;
}

/* Grid helpers */
.grid-2{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0 16px;
}
.grid-3{
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0 16px;
}
.grid-4{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0 16px;
}

/* =====================================================================
   5. BUTTONS
   ===================================================================== */
.btn{
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 9px 16px;
  border-radius: 8px;
  border: 1px solid transparent;
  cursor: pointer;
  font-size: .92rem;
  font-weight: 600;
  font-family: inherit;
  text-decoration: none;
  white-space: nowrap;
  transition: background .15s, color .15s, border-color .15s;
}
.btn:hover{ text-decoration: none; }
.btn:disabled{ opacity: .55; cursor: not-allowed; }

.btn-primary{
  background: var(--green);
  color: #fff;
}
.btn-primary:hover:not(:disabled){
  background: var(--green-dark);
}

.btn-ghost{
  background: var(--white);
  color: var(--green);
  border-color: var(--green);
}
.btn-ghost:hover:not(:disabled){
  background: var(--green-light);
}

.btn-danger{
  background: var(--red);
  color: #fff;
}
.btn-danger:hover:not(:disabled){
  background: #991b1b;
}

.btn-sm{
  padding: 5px 10px;
  font-size: .82rem;
  border-radius: 6px;
}
.btn-block{ width: 100%; }
.btn-row{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* =====================================================================
   6. ALERTS
   ===================================================================== */
.alert{
  padding: 10px 14px;
  border-radius: 8px;
  margin-bottom: 16px;
  font-size: .9rem;
  line-height: 1.4;
}
.alert-error{
  background: var(--red-soft);
  color: #7f1d1d;
  border: 1px solid #fecaca;
}
.alert-ok{
  background: var(--green-light);
  color: var(--green-dark);
  border: 1px solid #bbf7d0;
}
.alert-info{
  background: #e0f2fe;
  color: #075985;
  border: 1px solid #bae6fd;
}
.alert-warn{
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* =====================================================================
   7. DASHBOARD SHELL (admin + nutritionist layouts)
   ===================================================================== */
.shell{
  display: grid;
  grid-template-columns: 250px 1fr;
  grid-template-rows: auto 1fr;
  min-height: 100vh;
}
.sidebar{
  grid-column: 1;
  grid-row: 1 / span 2;
  background: var(--green-dark);
  color: #eaeaea;
  padding: 20px 0;
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}
.sidebar .brand{
  font-weight: 700;
  font-size: 1.05rem;
  color: #fff;
  padding: 0 20px 18px;
  border-bottom: 1px solid rgba(255,255,255,.15);
  line-height: 1.4;
}
.sidebar nav{
  margin-top: 12px;
  display: flex;
  flex-direction: column;
}
.sidebar nav a{
  padding: 10px 20px;
  color: #d6e4da;
  font-size: .92rem;
  border-left: 3px solid transparent;
  transition: background .15s, color .15s;
}
.sidebar nav a:hover,
.sidebar nav a.active{
  background: rgba(255,255,255,.06);
  color: #fff;
  border-left-color: #7ee0a1;
  text-decoration: none;
}
.sidebar nav .group-title{
  padding: 14px 20px 6px;
  font-size: .72rem;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: #82a48d;
  font-weight: 600;
}
.topbar{
  grid-column: 2;
  grid-row: 1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 32px;
  background: var(--white);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
  gap: 8px;
}
.topbar .who{ font-weight: 500; }
.topbar .who strong{ color: var(--green-dark); }
.topbar .validity{
  font-size: .82rem;
  color: var(--amber);
  font-weight: 500;
}
.content{
  grid-column: 2;
  grid-row: 2;
  padding: 24px 32px;
  background: var(--bg);
  min-width: 0;
}

/* =====================================================================
   8. PAGE HEADERS
   ===================================================================== */
.page-title{
  margin: 0 0 18px;
  font-size: 1.35rem;
  color: var(--green-dark);
  font-weight: 600;
}

/* =====================================================================
   9. CARDS
   ===================================================================== */
.card{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
}
.card > h3:first-child,
.card > h2:first-child{
  margin-top: 0;
}
.sec{
  margin: 0 0 16px;
  color: var(--green-dark);
  font-size: 1.05rem;
  border-bottom: 1px solid var(--line);
  padding-bottom: 8px;
  font-weight: 600;
}

/* =====================================================================
   10. STAT CARDS (used on nutritionist dashboard)
   ===================================================================== */
.stat-grid{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  gap: 14px;
  margin-bottom: 22px;
}
.stat-card{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
.stat-card .l{
  color: var(--gray);
  font-size: .78rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.stat-card .v{
  font-size: 1.9rem;
  font-weight: 700;
  color: var(--green-dark);
  line-height: 1.1;
  margin-top: 4px;
}
.stat-card .sub{
  color: var(--gray);
  font-size: .75rem;
  margin-top: 4px;
}
.stat-card.warn .v{ color: var(--amber); }
.stat-card.bad  .v{ color: var(--red); }

/* =====================================================================
   11. TABLES
   ===================================================================== */
table{
  width: 100%;
  border-collapse: collapse;
  background: var(--white);
  border-radius: var(--radius-sm);
  overflow: hidden;
}
th, td{
  padding: 10px 12px;
  text-align: left;
  font-size: .9rem;
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
}
th{
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
  font-size: .82rem;
  text-transform: uppercase;
  letter-spacing: .03em;
}
th.sortable{
  cursor: pointer;
  user-select: none;
  position: relative;
}
th.sortable::after{
  content: ' ⇅';
  opacity: .4;
  font-size: .75em;
}
th.sortable[data-dir="asc"]::after{ content: ' ↑'; opacity: .8; }
th.sortable[data-dir="desc"]::after{ content: ' ↓'; opacity: .8; }
tr:hover td{ background: #fafffc; }

.table-scroll{
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}
.table-foot{
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
  color: var(--gray);
  font-size: .85rem;
  flex-wrap: wrap;
  gap: 8px;
}
.table-foot label{
  margin: 0;
  font-weight: 400;
}
.table-foot select{
  width: auto;
  display: inline-block;
  padding: 3px 6px;
  margin-left: 4px;
  font-size: .82rem;
}

/* =====================================================================
   12. TAGS / BADGES
   ===================================================================== */
.tag{
  display: inline-block;
  padding: 2px 9px;
  border-radius: 12px;
  font-size: .74rem;
  font-weight: 600;
  line-height: 1.6;
  text-transform: capitalize;
}
.tag-ok  { background: #dcfce7; color: #166534; }
.tag-warn{ background: #fef3c7; color: #92400e; }
.tag-bad { background: #fee2e2; color: #7f1d1d; }
.tag-info{ background: #e0f2fe; color: #075985; }
.tag-team{ background: #eef2ff; color: #4338ca; font-weight: 700; }

/* =====================================================================
   13. PATIENT VIEW
   ===================================================================== */
.pat-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}
.pat-id{
  color: var(--gray);
  font-weight: 600;
  font-size: .9rem;
}
.pat-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.two-col{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.bullets{
  margin: 0;
  padding-left: 18px;
  line-height: 1.7;
}
.bullets li{
  margin: 4px 0;
  font-size: .9rem;
}

/* =====================================================================
   14. MEAL TABLES (diet chart builder)
   ===================================================================== */
.meal-table{
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.meal-table th,
.meal-table td{
  padding: 5px 7px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
.meal-table th{
  background: var(--green-soft);
  font-size: .78rem;
  color: var(--green-dark);
  font-weight: 600;
}
.meal-table input,
.meal-table select{
  padding: 4px 6px;
  font-size: .85rem;
  border-radius: 6px;
  margin: 0;
}
.meal-table .food-inp{ width: 100%; }
.meal-table td[class^="c-"]{
  text-align: right;
  color: var(--green);
  font-variant-numeric: tabular-nums;
  font-weight: 500;
}

/* Autocomplete dropdown (old style — used by inline autocomplete) */
.ac-cell{ position: relative; }
.ac-wrap{
  position: absolute;
  z-index: 30;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
  max-height: 220px;
  overflow-y: auto;
}
.ac-item{
  padding: 7px 10px;
  font-size: .85rem;
  cursor: pointer;
  border-bottom: 1px solid var(--gray-light);
}
.ac-item:last-child{ border-bottom: none; }
.ac-item:hover{ background: var(--green-soft); }

/* =====================================================================
   15. TEST PICKER
   ===================================================================== */
.test-picker{ padding: 4px 0; }
.test-group{ margin: 10px 0; }
.test-group-title{
  font-weight: 600;
  color: var(--green-dark);
  font-size: .88rem;
  margin-bottom: 5px;
}
.test-list{
  display: flex;
  flex-wrap: wrap;
  gap: 5px 12px;
}
.test-checkbox{
  padding: 4px 10px;
  border-radius: 20px;
  font-weight: 400;
  font-size: .86rem;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: background .12s, border-color .12s;
}
.test-checkbox:hover{ border-color: var(--green); }
.test-checkbox.picked{
  background: #dcfce7;
  border-color: var(--green);
  color: var(--green-dark);
}

/* =====================================================================
   16. BRISTOL SCALE
   ===================================================================== */
.bristol-grid{
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.bristol-item{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
  cursor: pointer;
  font-weight: 400;
  margin: 0;
  transition: background .12s, border-color .12s;
}
.bristol-item:hover{
  border-color: var(--green);
  background: var(--green-soft);
}
.bristol-item input{ margin-top: 3px; }
.bristol-num{
  font-weight: 600;
  color: var(--green-dark);
  min-width: 60px;
  font-size: .85rem;
}
.bristol-desc{
  font-size: .85rem;
  color: #333;
  line-height: 1.4;
}

/* =====================================================================
   17. FAMILY HISTORY TABLE
   ===================================================================== */
.fam-table{
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
.fam-table th,
.fam-table td{
  border: 1px solid var(--line);
  padding: 6px 8px;
}
.fam-table th{
  background: var(--green-soft);
  color: var(--green-dark);
  font-weight: 600;
  font-size: .78rem;
  text-align: center;
}
.fam-table .cond-name{
  font-size: .82rem;
  color: #333;
}

/* =====================================================================
   18. NCD CONDITION GROUPS
   ===================================================================== */
.ncd-group{
  margin: 10px 0;
  padding: 8px 12px;
  background: #fafdfb;
  border-radius: 6px;
  border-left: 3px solid var(--green-light);
}
.ncd-group-title{
  font-weight: 600;
  color: var(--green-dark);
  margin-bottom: 6px;
  font-size: .88rem;
}
.ncd-list{
  display: flex;
  flex-wrap: wrap;
  gap: 4px 14px;
}
.ncd-list .r{ font-size: .86rem; }

/* =====================================================================
   19. PRESCRIPTION TABLE
   ===================================================================== */
#rxTable,
.rx-table{
  width: 100%;
  border-collapse: collapse;
  font-size: .85rem;
}
#rxTable th,
#rxTable td,
.rx-table th,
.rx-table td{
  border-bottom: 1px solid var(--line);
  padding: 5px 7px;
  text-align: left;
}
#rxTable th,
.rx-table th{
  background: var(--green-soft);
  color: var(--green-dark);
  font-size: .78rem;
  font-weight: 600;
}
#rxTable input,
.rx-table input{
  padding: 4px 6px;
  font-size: .85rem;
  border-radius: 6px;
  margin: 0;
}

/* =====================================================================
   20. SUMMARY PANEL
   ===================================================================== */
.summary{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
  gap: 10px;
  margin-top: 14px;
  padding: 12px 14px;
  background: var(--green-soft);
  border-radius: 8px;
  border: 1px solid #d6efdd;
}
.summary > div{ font-size: .85rem; }
.summary span{
  display: block;
  color: var(--gray);
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 500;
}
.summary strong{
  display: block;
  color: var(--green-dark);
  font-size: 1.05rem;
  margin-top: 2px;
  font-weight: 700;
}

/* =====================================================================
   21. STICKY ACTION BAR
   ===================================================================== */
.sticky-actions{
  position: sticky;
  bottom: 0;
  background: rgba(255,255,255,.97);
  padding: 12px 0;
  border-top: 1px solid var(--line);
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  z-index: 5;
  margin-top: 12px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

/* =====================================================================
   22. RICH-TEXT (Quill) OVERRIDES
   ===================================================================== */
.sugg{
  min-height: 140px;
  background: var(--white);
  border-radius: 8px;
}
.ql-toolbar.ql-snow{
  border-radius: 8px 8px 0 0;
  border-color: var(--line);
  background: #f9fafb;
}
.ql-container.ql-snow{
  border-radius: 0 0 8px 8px;
  border-color: var(--line);
  font-family: var(--font);
  font-size: .95rem;
  min-height: 140px;
}
.ql-editor{
  min-height: 140px;
  line-height: 1.6;
}
.ql-editor.ql-blank::before{
  color: #9ca3af;
  font-style: normal;
}

/* =====================================================================
   23. PUBLIC PATIENT VIEW (p/view.php)
   ===================================================================== */
.public-wrap{
  max-width: 900px;
  margin: 0 auto;
  background: var(--white);
  padding: 24px 28px;
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.public-header{
  border-bottom: 2px solid var(--green);
  padding-bottom: 10px;
  margin-bottom: 14px;
}
.public-header .name{
  color: var(--green-dark);
  font-weight: 700;
  font-size: 1.5rem;
}
.public-header .deg{
  font-style: italic;
  font-size: .9rem;
}
.pat-bar{
  background: var(--green-soft);
  border-left: 4px solid var(--green);
  padding: 10px 14px;
  margin: 12px 0;
  border-radius: 4px;
}
.pat-bar strong{ color: var(--green-dark); }
h2.sec-public{
  background: var(--green-dark);
  color: #fff;
  padding: 6px 12px;
  font-size: 1rem;
  margin: 18px 0 10px;
  border-radius: 4px;
  font-weight: 600;
}
h3.meal-public{
  background: var(--green-soft);
  border-left: 3px solid var(--green);
  padding: 6px 12px;
  margin: 14px 0 6px;
  font-size: .95rem;
  color: var(--green-dark);
  font-weight: 600;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  border-radius: 4px;
}
h3.meal-public .kcal{
  color: var(--amber);
  font-size: .88rem;
  font-weight: 600;
}
.or-row td{
  background: var(--amber-soft);
  text-align: center;
  font-weight: 600;
  color: var(--amber);
}
.rx-symbol{
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--green-dark);
  margin: 14px 0 6px;
  letter-spacing: 3px;
}
.expiry{
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 14px;
  font-size: .88rem;
}
.public-sig{
  margin-top: 30px;
  text-align: right;
}
.public-sig hr{
  width: 200px;
  border: none;
  border-top: 1px solid #333;
  margin: 0 0 6px auto;
}
.public-foot{
  font-size: .78rem;
  color: var(--gray);
  text-align: center;
  margin-top: 20px;
}
.public-actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

/* =====================================================================
   24. LIST HEADERS (search + action rows on list pages)
   ===================================================================== */
.list-header{
  display: flex;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.list-header input[type="search"]{
  max-width: 340px;
}
.list-header .actions{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* =====================================================================
   25. UTILITIES
   ===================================================================== */
.text-center{ text-align: center; }
.text-right { text-align: right; }
.mt-0{ margin-top: 0; }
.mt-1{ margin-top: 6px; }
.mt-2{ margin-top: 12px; }
.mt-3{ margin-top: 20px; }
.mb-0{ margin-bottom: 0; }
.mb-2{ margin-bottom: 12px; }
.mb-3{ margin-bottom: 20px; }
.flex{ display: flex; }
.flex-between{ display: flex; justify-content: space-between; align-items: center; }
.flex-wrap{ flex-wrap: wrap; }
.gap-1{ gap: 6px; }
.gap-2{ gap: 12px; }
.hide{ display: none !important; }

/* =====================================================================
   26. COLORFUL ADMIN DASHBOARD — bento grid
   ===================================================================== */

/* --- HERO (mesh gradient) --- */
.hero-mesh{
  position: relative;
  padding: 32px 34px;
  border-radius: 20px;
  color: #fff;
  overflow: hidden;
  margin-bottom: 22px;
  background:
    radial-gradient(at 20% 30%, rgba(139,92,246,.55) 0px, transparent 50%),
    radial-gradient(at 80% 20%, rgba(236,72,153,.45) 0px, transparent 50%),
    radial-gradient(at 60% 90%, rgba(14,165,233,.45) 0px, transparent 50%),
    linear-gradient(135deg, #0f172a 0%, #1e293b 100%);
}
.hero-mesh::before{
  content: '';
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle at 1px 1px, rgba(255,255,255,.08) 1px, transparent 0);
  background-size: 22px 22px;
  opacity: .6;
  pointer-events: none;
}
.hero-mesh > *{ position: relative; z-index: 1; }
.hero-mesh .row{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 22px;
  flex-wrap: wrap;
}
.hero-mesh .greet{
  font-size: .78rem;
  letter-spacing: .14em;
  text-transform: uppercase;
  opacity: .7;
  font-weight: 600;
  margin-bottom: 6px;
}
.hero-mesh h1{
  margin: 0 0 10px;
  font-size: 2rem;
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -.02em;
  color: #fff;
}
.hero-mesh h1 .wave{
  display: inline-block;
  animation: wave 2.2s ease-in-out infinite;
  transform-origin: 70% 70%;
}
@keyframes wave{
  0%,60%,100%{ transform: rotate(0deg); }
  10%{ transform: rotate(14deg); }
  20%{ transform: rotate(-8deg); }
  30%{ transform: rotate(14deg); }
  40%{ transform: rotate(-4deg); }
  50%{ transform: rotate(10deg); }
}
.hero-mesh .sub{
  margin: 0;
  opacity: .78;
  font-size: .95rem;
  max-width: 520px;
}
.hero-mesh .sub strong{
  color: #a7f3d0;
  font-weight: 700;
}
.hero-mesh .hero-stats{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.hero-pill{
  background: rgba(255,255,255,.08);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255,255,255,.15);
  border-radius: 14px;
  padding: 12px 18px;
  min-width: 104px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
}
.hero-pill .dot{
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  margin-bottom: 4px;
  box-shadow: 0 0 12px currentColor;
}
.hero-pill .n{
  font-size: 1.5rem;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  color: #fff;
}
.hero-pill .l{
  font-size: .72rem;
  text-transform: uppercase;
  letter-spacing: .08em;
  opacity: .75;
  font-weight: 600;
}
.hero-pill.emerald .dot{ background: #34d399; color: #34d399; }
.hero-pill.amber   .dot{ background: #fbbf24; color: #fbbf24; }
.hero-pill.sky     .dot{ background: #38bdf8; color: #38bdf8; }

/* --- ATTENTION RIBBON --- */
.ribbon{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
  border-radius: 14px;
  margin-bottom: 22px;
  background: linear-gradient(90deg, #fef3c7 0%, #fde68a 100%);
  border: 1px solid #fcd34d;
  color: #78350f;
  font-size: .92rem;
  box-shadow: 0 4px 14px rgba(245,158,11,.15);
}
.ribbon .icon-wrap{
  display: inline-grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: rgba(120,53,15,.12);
  margin-right: 10px;
  vertical-align: middle;
}
.ribbon .body{ display: flex; align-items: center; flex-wrap: wrap; gap: 4px; }
.ribbon .body strong{ margin-right: 6px; }
.ribbon .actions{ display: flex; gap: 8px; flex-wrap: wrap; }
.ribbon .btn-warm{
  background: #78350f;
  color: #fff;
  border: none;
}
.ribbon .btn-warm:hover{ background: #451a03; color: #fff; }

/* --- BENTO GRID --- */
.bento{
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  gap: 16px;
  margin-bottom: 22px;
}
.bento > *{ grid-column: span 3; }

.bento-card{
  position: relative;
  background: #fff;
  border-radius: 16px;
  padding: 20px 20px 18px;
  border: 1px solid var(--line);
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  display: flex;
  flex-direction: column;
  min-height: 148px;
}
.bento-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 12px 28px rgba(15,23,42,.08);
}
.bento-card::after{
  content: '';
  position: absolute;
  inset: 0;
  border-radius: 16px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  -webkit-mask:
    linear-gradient(#000 0 0) content-box,
    linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
  opacity: .35;
  pointer-events: none;
}
.bento-card:hover::after{ opacity: .7; }
.bento-card::before{
  content: '';
  position: absolute;
  left: 0;
  top: 20px;
  bottom: 20px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: linear-gradient(180deg, var(--accent-1), var(--accent-2));
}

/* Color themes */
.t-emerald{ --accent-1:#34d399; --accent-2:#059669; --tint:#ecfdf5; --deep:#047857; }
.t-indigo { --accent-1:#818cf8; --accent-2:#4338ca; --tint:#eef2ff; --deep:#4338ca; }
.t-rose   { --accent-1:#fb7185; --accent-2:#be123c; --tint:#fff1f2; --deep:#be123c; }
.t-amber  { --accent-1:#fbbf24; --accent-2:#b45309; --tint:#fffbeb; --deep:#b45309; }
.t-sky    { --accent-1:#38bdf8; --accent-2:#0369a1; --tint:#f0f9ff; --deep:#0369a1; }
.t-violet { --accent-1:#a78bfa; --accent-2:#6d28d9; --tint:#f5f3ff; --deep:#6d28d9; }
.t-teal   { --accent-1:#2dd4bf; --accent-2:#0f766e; --tint:#f0fdfa; --deep:#0f766e; }
.t-fuchsia{ --accent-1:#e879f9; --accent-2:#a21caf; --tint:#fdf4ff; --deep:#a21caf; }

/* Stat icon chip */
.stat-icon{
  width: 40px;
  height: 40px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(15,23,42,.15);
  margin-bottom: 14px;
}
.stat-icon svg{ width: 20px; height: 20px; }

.stat-value{
  font-size: 1.85rem;
  font-weight: 800;
  color: #0f172a;
  line-height: 1;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-label{
  font-size: .78rem;
  color: #64748b;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 600;
  margin-top: 6px;
}
.stat-trend{
  font-size: .78rem;
  margin-top: auto;
  padding-top: 8px;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-weight: 600;
  color: var(--deep);
  flex-wrap: wrap;
}
.stat-trend .up{ color: #059669; }
.stat-trend .down{ color: #dc2626; }
.stat-trend .badge{
  background: var(--tint);
  color: var(--deep);
  padding: 2px 8px;
  border-radius: 20px;
  font-size: .72rem;
}

/* Featured card */
.bento-card.featured{
  grid-column: span 6;
  background: linear-gradient(135deg, var(--accent-1), var(--accent-2));
  color: #fff;
  border: none;
  min-height: 168px;
  padding: 22px 24px;
}
.bento-card.featured::before,
.bento-card.featured::after{ display: none; }
.bento-card.featured .stat-icon{
  background: rgba(255,255,255,.2);
  color: #fff;
  backdrop-filter: blur(6px);
  box-shadow: none;
}
.bento-card.featured .stat-value{ color: #fff; font-size: 2.4rem; }
.bento-card.featured .stat-label{ color: rgba(255,255,255,.85); }
.bento-card.featured .stat-trend{ color: rgba(255,255,255,.9); }
.bento-card.featured .stat-trend .badge{
  background: rgba(255,255,255,.2);
  color: #fff;
}
.bento-card.featured .bg-shape{
  position: absolute;
  right: -40px;
  bottom: -50px;
  width: 180px;
  height: 180px;
  border-radius: 50%;
  background: radial-gradient(circle, rgba(255,255,255,.18) 0%, transparent 70%);
  pointer-events: none;
}

/* Card spans */
.bento-card.wide{ grid-column: span 6; }
.bento-card.full{ grid-column: span 12; }
.bento-card.half{ grid-column: span 6; }
.bento-card.third{ grid-column: span 4; }
.bento-card.quarter{ grid-column: span 3; }

/* Chart card */
.chart-card{
  display: flex;
  flex-direction: column;
  min-height: 320px;
  padding: 22px 24px;
}
.chart-card .chart-head{
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.chart-card h3{
  margin: 0;
  font-size: 1rem;
  color: #0f172a;
  font-weight: 700;
}
.chart-card .chart-sub{
  font-size: .82rem;
  color: #64748b;
  margin-top: 2px;
}
.chart-card .legend{
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  font-size: .78rem;
  color: #64748b;
}
.chart-card .legend .dot{
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 5px;
  vertical-align: middle;
}
.chart-wrap{
  flex: 1;
  position: relative;
  min-height: 220px;
}
.chart-wrap canvas{
  display: block;
  width: 100% !important;
}

/* Quick actions */
.qa-modern{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qa-modern .qa-tile{
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 14px;
  border-radius: 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  color: #0f172a;
  font-weight: 600;
  font-size: .88rem;
  text-decoration: none;
  transition: all .18s ease;
  position: relative;
  overflow: hidden;
}
.qa-modern .qa-tile:hover{
  background: var(--qa-tint, #f0fdf4);
  border-color: var(--qa-color, var(--green));
  color: var(--qa-deep, var(--green-dark));
  text-decoration: none;
  transform: translateY(-2px);
}
.qa-modern .qa-tile .qa-ico{
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, var(--qa-color, #0b6b3a), var(--qa-deep, #064d29));
  color: #fff;
  flex-shrink: 0;
}
.qa-modern .qa-tile .qa-ico svg{ width: 16px; height: 16px; }
.qa-modern .qa-tile .qa-meta{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.qa-modern .qa-tile .qa-count{
  background: rgba(0,0,0,.06);
  color: var(--qa-deep, #064d29);
  font-size: .72rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 20px;
}

/* Activity list */
.activity-list{
  display: flex;
  flex-direction: column;
  gap: 0;
}
.activity-item{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 4px;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
  color: inherit;
  transition: background .12s ease;
}
.activity-item:last-child{ border-bottom: none; }
.activity-item:hover{ background: #f8fafc; text-decoration: none; }

.activity-avatar{
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: .85rem;
  color: #fff;
  flex-shrink: 0;
  letter-spacing: .02em;
}
.activity-avatar.g-emerald{ background: linear-gradient(135deg,#34d399,#059669); }
.activity-avatar.g-indigo { background: linear-gradient(135deg,#818cf8,#4338ca); }
.activity-avatar.g-rose   { background: linear-gradient(135deg,#fb7185,#be123c); }
.activity-avatar.g-amber  { background: linear-gradient(135deg,#fbbf24,#b45309); }
.activity-avatar.g-sky    { background: linear-gradient(135deg,#38bdf8,#0369a1); }
.activity-avatar.g-violet { background: linear-gradient(135deg,#a78bfa,#6d28d9); }

.activity-body{ min-width: 0; flex: 1; }
.activity-title{
  font-weight: 600;
  font-size: .92rem;
  color: #0f172a;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-sub{
  font-size: .78rem;
  color: #64748b;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.activity-right{
  font-size: .78rem;
  color: #94a3b8;
  text-align: right;
  flex-shrink: 0;
}
.activity-right .tag{ display: inline-block; margin-top: 4px; }

/* Empty state */
.empty-state{
  text-align: center;
  padding: 28px 12px;
  color: #94a3b8;
}
.empty-state svg{
  width: 40px;
  height: 40px;
  opacity: .5;
  margin: 0 auto 10px;
  display: block;
}
.empty-state p{ margin: 0; font-size: .88rem; }

/* =====================================================================
   27. RESPONSIVE
   ===================================================================== */

/* --- Shell collapse: 900px --- */
@media (max-width: 900px){
  .shell{
    grid-template-columns: 1fr;
    grid-template-rows: auto auto 1fr;
  }
  .sidebar{
    grid-column: 1;
    grid-row: 1;
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    padding: 8px 0;
    align-items: center;
  }
  .sidebar .brand,
  .sidebar .group-title{ display: none; }
  .sidebar nav{
    flex-direction: row;
    margin: 0;
    gap: 2px;
    padding: 0 8px;
  }
  .sidebar nav a{
    padding: 8px 12px;
    border-left: none;
    border-bottom: 3px solid transparent;
    white-space: nowrap;
    font-size: .88rem;
  }
  .sidebar nav a.active{
    border-left: none;
    border-bottom-color: #7ee0a1;
    background: rgba(255,255,255,.08);
  }
  .topbar{
    grid-column: 1;
    grid-row: 2;
    padding: 12px 16px;
  }
  .content{
    grid-column: 1;
    grid-row: 3;
    padding: 16px;
  }

  .grid-2,
  .grid-3,
  .grid-4{ grid-template-columns: 1fr 1fr; }
  .two-col{ grid-template-columns: 1fr; }
  .bristol-grid{ grid-template-columns: 1fr; }
  .public-wrap{ padding: 18px; }
}

/* --- Bento responsive --- */
@media (max-width: 1200px){
  .bento > *{ grid-column: span 4; }
  .bento-card.featured,
  .bento-card.half{ grid-column: span 6; }
  .bento-card.wide,
  .bento-card.full{ grid-column: span 12; }
  .bento-card.third{ grid-column: span 6; }
  .bento-card.quarter{ grid-column: span 4; }
}

@media (max-width: 900px){
  .hero-mesh{ padding: 24px; }
  .hero-mesh h1{ font-size: 1.6rem; }
  .hero-mesh .row{ flex-direction: column; align-items: stretch; }
  .hero-mesh .hero-stats{ width: 100%; }
  .hero-pill{ flex: 1; min-width: 0; }

  .bento{ gap: 12px; }
  .bento > *{ grid-column: span 6; }
  .bento-card.featured,
  .bento-card.half,
  .bento-card.wide,
  .bento-card.full,
  .bento-card.third{ grid-column: span 12; }
  .bento-card.quarter{ grid-column: span 6; }
}

/* --- Phone --- */
@media (max-width: 600px){
  body{ font-size: 14px; }
  .content{ padding: 12px; }
  .card{ padding: 14px; }
  .auth-card{ padding: 22px; }

  .grid-2,
  .grid-3,
  .grid-4{ grid-template-columns: 1fr; }

  table{ font-size: .82rem; }
  th, td{ padding: 8px; }
  .meal-table,
  #rxTable,
  .fam-table{ font-size: .78rem; }
  .meal-table th,
  .meal-table td,
  #rxTable th,
  #rxTable td{ padding: 4px 5px; }

  .stat-card .v{ font-size: 1.5rem; }
  .page-title{ font-size: 1.15rem; }
  .topbar{ padding: 10px 12px; }
  .topbar .who,
  .topbar .validity{ font-size: .82rem; }

  .public-wrap{
    padding: 14px;
    border-radius: 0;
  }
  .public-header .name{ font-size: 1.25rem; }

  /* Dashboard hero */
  .hero-mesh{ padding: 20px; border-radius: 16px; }
  .hero-mesh h1{ font-size: 1.35rem; }
  .hero-pill .n{ font-size: 1.25rem; }

  /* Bento goes single column */
  .bento > *,
  .bento-card.featured,
  .bento-card.half,
  .bento-card.wide,
  .bento-card.full,
  .bento-card.third,
  .bento-card.quarter{ grid-column: span 12; }

  .bento-card{ padding: 16px 16px 14px; min-height: auto; }
  .stat-value{ font-size: 1.55rem; }
  .bento-card.featured .stat-value{ font-size: 1.9rem; }

  .qa-modern{ grid-template-columns: 1fr; }
  .activity-item{ padding: 10px 2px; }
  .activity-avatar{ width: 34px; height: 34px; font-size: .78rem; }

  .chart-card{ padding: 16px; }
  .chart-wrap{ min-height: 180px; }
}

@media (max-width: 460px){
  .bento > *{ grid-column: span 12; }
  .kpi-grid{ grid-template-columns: 1fr; }
  .recent-table .avatar{ width: 26px; height: 26px; font-size: .72rem; }
}

/* =====================================================================
   28. PRINT
   ===================================================================== */
@media print{
  body{
    background: #fff;
    padding: 0;
    font-size: 11pt;
  }
  .public-wrap{
    box-shadow: none;
    padding: 0;
    border-radius: 0;
    max-width: none;
  }
  .public-actions,
  .expiry,
  .sidebar,
  .topbar,
  .sticky-actions{ display: none; }
  .shell{ display: block; }
  .content{ padding: 0; }
  a{ color: #111; text-decoration: none; }

  /* Dashboard sections hidden on print */
  .hero-mesh,
  .ribbon,
  .qa-modern,
  .bento-card.chart-card{ display: none; }
  .bento-card{ break-inside: avoid; }
}

/* =====================================================================
   29. VIVID DASHBOARD v2 — colored KPI cards
   ===================================================================== */

.dash{
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---- HERO ---- */
.dash-hero{
  background: linear-gradient(120deg, #0ea5e9 0%, #06b6d4 45%, #10b981 100%);
  border-radius: 18px;
  padding: 26px 30px;
  color: #fff;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  flex-wrap: wrap;
  position: relative;
  overflow: hidden;
  box-shadow: 0 10px 30px rgba(6,182,212,.25);
}
.dash-hero::before{
  content: '';
  position: absolute;
  right: -80px;
  top: -80px;
  width: 260px;
  height: 260px;
  background: radial-gradient(circle, rgba(255,255,255,.22) 0%, transparent 70%);
  border-radius: 50%;
}
.dash-hero::after{
  content: '';
  position: absolute;
  left: -60px;
  bottom: -100px;
  width: 220px;
  height: 220px;
  background: radial-gradient(circle, rgba(255,255,255,.12) 0%, transparent 70%);
  border-radius: 50%;
}
.dash-hero > *{ position: relative; z-index: 1; }

.dash-hero .h-l{
  max-width: 560px;
}
.dash-hero .h-welcome{
  font-size: 12px;
  letter-spacing: .14em;
  text-transform: uppercase;
  font-weight: 700;
  opacity: .85;
  margin-bottom: 4px;
}
.dash-hero h1{
  margin: 0 0 6px;
  font-size: 26px;
  font-weight: 800;
  color: #fff;
  line-height: 1.2;
  letter-spacing: -.01em;
}
.dash-hero p{
  margin: 0;
  font-size: 14px;
  opacity: .9;
  line-height: 1.5;
}
.dash-hero p strong{ font-weight: 700; }

.dash-hero .h-r{
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}
.dash-hero .h-chip{
  background: rgba(255,255,255,.18);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255,255,255,.25);
  border-radius: 12px;
  padding: 10px 16px;
  min-width: 92px;
  text-align: center;
}
.dash-hero .h-chip .n{
  font-size: 20px;
  font-weight: 800;
  line-height: 1.1;
}
.dash-hero .h-chip .l{
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .1em;
  font-weight: 700;
  opacity: .9;
  margin-top: 2px;
}

/* ---- ALERT STRIP ---- */
.dash-alert{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
  padding: 14px 20px;
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: 14px;
  font-size: 14px;
  color: #7c2d12;
}
.dash-alert .a-l{
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 500;
}
.dash-alert .a-ico{
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: #f97316;
  color: #fff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.dash-alert .a-ico svg{ width: 16px; height: 16px; }
.dash-alert .a-r{
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dash-alert .btn-orange{
  background: #ea580c;
  color: #fff;
  border: none;
  padding: 7px 14px;
  font-size: 13px;
}
.dash-alert .btn-orange:hover{ background: #c2410c; color: #fff; }

/* ---- KPI GRID (colorful cards) ---- */
.kpi-row{
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi-card{
  position: relative;
  border-radius: 16px;
  padding: 18px 20px;
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 140px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--k-from), var(--k-to));
  box-shadow: 0 6px 20px var(--k-shadow, rgba(0,0,0,.12));
  transition: transform .2s ease, box-shadow .2s ease;
}
.kpi-card:hover{
  transform: translateY(-3px);
  box-shadow: 0 12px 28px var(--k-shadow, rgba(0,0,0,.15));
}
.kpi-card::after{
  content: '';
  position: absolute;
  right: -40px;
  top: -40px;
  width: 130px;
  height: 130px;
  background: rgba(255,255,255,.14);
  border-radius: 50%;
  pointer-events: none;
}
.kpi-card > *{ position: relative; z-index: 1; }

.kpi-card .k-ico{
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: rgba(255,255,255,.22);
  display: grid;
  place-items: center;
  color: #fff;
  margin-bottom: auto;
  backdrop-filter: blur(4px);
}
.kpi-card .k-ico svg{ width: 16px; height: 16px; }

.kpi-card .k-val{
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  letter-spacing: -.02em;
  margin-top: 14px;
  font-variant-numeric: tabular-nums;
}
.kpi-card .k-lab{
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: .08em;
  font-weight: 700;
  opacity: .92;
  margin-top: 5px;
}
.kpi-card .k-sub{
  font-size: 11.5px;
  opacity: .85;
  font-weight: 500;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid rgba(255,255,255,.2);
}

/* Per-card color themes */
.kpi-emerald { --k-from:#34d399; --k-to:#059669; --k-shadow: rgba(16,185,129,.3); }
.kpi-indigo  { --k-from:#818cf8; --k-to:#4f46e5; --k-shadow: rgba(99,102,241,.3); }
.kpi-amber   { --k-from:#fbbf24; --k-to:#d97706; --k-shadow: rgba(245,158,11,.3); }
.kpi-violet  { --k-from:#a78bfa; --k-to:#7c3aed; --k-shadow: rgba(139,92,246,.3); }
.kpi-pink    { --k-from:#f472b6; --k-to:#db2777; --k-shadow: rgba(236,72,153,.3); }
.kpi-teal    { --k-from:#2dd4bf; --k-to:#0d9488; --k-shadow: rgba(20,184,166,.3); }
.kpi-sky     { --k-from:#38bdf8; --k-to:#0284c7; --k-shadow: rgba(14,165,233,.3); }
.kpi-fuchsia { --k-from:#e879f9; --k-to:#a21caf; --k-shadow: rgba(217,70,239,.3); }

/* ---- MAIN PANELS ---- */
.panel-row{
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 16px;
}
.panel-box{
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 20px 22px;
  display: flex;
  flex-direction: column;
}
.panel-box .p-head{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.panel-box .p-title{
  font-size: 15px;
  font-weight: 700;
  color: #0f172a;
  margin: 0;
}
.panel-box .p-sub{
  font-size: 12.5px;
  color: #64748b;
  margin-top: 2px;
}
.panel-box .p-link{
  font-size: 13px;
  font-weight: 600;
  color: #4f46e5;
}

/* Chart */
.panel-chart{
  min-height: 340px;
}
.panel-chart .chart-canvas{
  flex: 1;
  min-height: 240px;
  position: relative;
}

/* Quick action tiles (colored) */
.qa-colors{
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.qa-c{
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 14px;
  border-radius: 12px;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, var(--q-from), var(--q-to));
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(0,0,0,.08);
}
.qa-c::after{
  content: '';
  position: absolute;
  right: -30px;
  bottom: -30px;
  width: 80px;
  height: 80px;
  background: rgba(255,255,255,.12);
  border-radius: 50%;
}
.qa-c:hover{
  transform: translateY(-3px);
  text-decoration: none;
  color: #fff;
  box-shadow: 0 10px 22px rgba(0,0,0,.15);
}
.qa-c > *{ position: relative; z-index: 1; }
.qa-c .q-ico{
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,.22);
  display: grid;
  place-items: center;
  color: #fff;
}
.qa-c .q-ico svg{ width: 14px; height: 14px; }
.qa-c .q-meta{
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 6px;
}
.qa-c .q-name{
  font-size: 13px;
  font-weight: 700;
  letter-spacing: -.005em;
}
.qa-c .q-count{
  font-size: 11px;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 20px;
  background: rgba(255,255,255,.28);
}
.qa-indigo{ --q-from:#818cf8; --q-to:#4f46e5; }
.qa-amber { --q-from:#fbbf24; --q-to:#d97706; }
.qa-emerald{ --q-from:#34d399; --q-to:#059669; }
.qa-sky   { --q-from:#38bdf8; --q-to:#0284c7; }
.qa-violet{ --q-from:#a78bfa; --q-to:#7c3aed; }
.qa-rose  { --q-from:#fb7185; --q-to:#e11d48; }

/* Activity list */
.act-list{ display: flex; flex-direction: column; gap: 0; }
.act{
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 2px;
  border-bottom: 1px solid #f1f5f9;
}
.act:last-child{ border-bottom: none; }
.act-av{
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  font-size: 13px;
  font-weight: 700;
  color: #fff;
  flex-shrink: 0;
}
.act-body{
  min-width: 0;
  flex: 1;
}
.act-name{
  font-size: 13.5px;
  font-weight: 600;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-sub{
  font-size: 11.5px;
  color: #64748b;
  margin-top: 1px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.act-meta{
  font-size: 11px;
  color: #94a3b8;
  text-align: right;
  flex-shrink: 0;
}
.act-meta .tag{
  font-size: 10px;
  padding: 1px 7px;
  margin-top: 3px;
}

/* Avatar gradient variety */
.av-emerald{ background: linear-gradient(135deg,#34d399,#059669); }
.av-indigo { background: linear-gradient(135deg,#818cf8,#4f46e5); }
.av-rose   { background: linear-gradient(135deg,#fb7185,#e11d48); }
.av-amber  { background: linear-gradient(135deg,#fbbf24,#d97706); }
.av-sky    { background: linear-gradient(135deg,#38bdf8,#0284c7); }
.av-violet { background: linear-gradient(135deg,#a78bfa,#7c3aed); }
.av-pink   { background: linear-gradient(135deg,#f472b6,#db2777); }
.av-teal   { background: linear-gradient(135deg,#2dd4bf,#0d9488); }

/* Empty state */
.act-empty{
  text-align: center;
  padding: 26px 10px;
  color: #94a3b8;
  font-size: 13px;
}
.act-empty svg{
  width: 36px; height: 36px;
  opacity: .4; margin: 0 auto 8px;
  display: block;
}

/* ---- RESPONSIVE ---- */
@media (max-width: 1100px){
  .kpi-row{ grid-template-columns: repeat(2, 1fr); }
  .panel-row{ grid-template-columns: 1fr; }
}
@media (max-width: 700px){
  .dash-hero{
    padding: 20px;
    flex-direction: column;
    align-items: flex-start;
  }
  .dash-hero h1{ font-size: 20px; }
  .dash-hero .h-r{ width: 100%; }
  .dash-hero .h-chip{ flex: 1; }
  .dash-hero .h-chip .n{ font-size: 17px; }

  .kpi-row{ grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-card{ padding: 14px; min-height: 118px; border-radius: 13px; }
  .kpi-card .k-val{ font-size: 22px; margin-top: 10px; }
  .kpi-card .k-lab{ font-size: 10.5px; }
  .kpi-card .k-sub{ font-size: 10.5px; padding-top: 6px; margin-top: 6px; }
  .kpi-card .k-ico{ width: 26px; height: 26px; }
  .kpi-card .k-ico svg{ width: 13px; height: 13px; }

  .qa-colors{ grid-template-columns: 1fr; }
  .panel-box{ padding: 16px; }
}
@media (max-width: 400px){
  .kpi-row{ grid-template-columns: 1fr; }
}

/* =====================================================================
   Searchable select component
   ===================================================================== */
.ss-wrap {
  position: relative;
  width: 100%;
}
.ss-input {
  width: 100%;
  padding: 6px 28px 6px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  font-size: .85rem;
  background: #fff;
  font-family: inherit;
  box-sizing: border-box;
  margin: 0;
}
.ss-input:focus {
  outline: none;
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(11,107,58,.1);
}
.ss-wrap.has-value .ss-input {
  background: #f0fdf4;
  font-weight: 500;
}

.ss-drop {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 200;
  max-height: 280px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  box-shadow: 0 12px 32px rgba(15,23,42,.15);
  margin-top: 3px;
  display: none;
}

.ss-opt {
  padding: 8px 12px;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1.35;
  border-bottom: 1px solid #f1f5f9;
}
.ss-opt:last-child { border-bottom: none; }
.ss-opt:hover, .ss-opt.hl { background: #ecfdf5; }
.ss-opt .ss-name {
  font-weight: 600;
  color: #0f172a;
}
.ss-opt .ss-sub {
  font-size: .76rem;
  color: #94a3b8;
  margin-top: 1px;
}
.ss-opt .ss-sub:empty { display: none; }

.ss-empty {
  padding: 14px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: .82rem;
  font-style: italic;
}

/* =====================================================================
   Searchable select — fixed-position dropdown
   ===================================================================== */
.ss-drop-fixed .ss-opt{
  padding: 8px 12px;
  cursor: pointer;
  font-size: .85rem;
  line-height: 1.35;
  border-bottom: 1px solid #f1f5f9;
}
.ss-drop-fixed .ss-opt:last-child{ border-bottom: none; }
.ss-drop-fixed .ss-opt:hover{ background: #ecfdf5; }
.ss-drop-fixed .ss-opt .ss-name{
  font-weight: 600;
  color: #0f172a;
}
.ss-drop-fixed .ss-opt .ss-sub{
  font-size: .76rem;
  color: #94a3b8;
  margin-top: 1px;
}
.ss-drop-fixed .ss-empty{
  padding: 14px 12px;
  text-align: center;
  color: #94a3b8;
  font-size: .82rem;
  font-style: italic;
}

/* =====================================================================
   30. LIVE FILTER + SERVER-SIDE PAGINATION
   ===================================================================== */

[data-live-target] {
  transition: opacity .15s ease;
}
[data-live-target].is-loading {
  opacity: .55;
  pointer-events: none;
}

.search-form {
  display: flex;
  gap: 8px;
  align-items: center;
  flex: 1;
  min-width: 240px;
  max-width: 440px;
  margin: 0;
  position: relative;
}
.search-form input[type="search"] {
  flex: 1;
  padding: 10px 14px 10px 38px;
  border: 1px solid #e5e7eb;
  border-radius: 10px;
  font-size: .9rem;
  background: #fff url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'><circle cx='11' cy='11' r='7'/><line x1='21' y1='21' x2='16.65' y2='16.65'/></svg>") no-repeat 12px center;
  transition: border-color .15s, box-shadow .15s;
  margin: 0;
}
.search-form input[type="search"]:focus {
  outline: none;
  border-color: #0b6b3a;
  box-shadow: 0 0 0 3px rgba(11,107,58,.1);
}
.search-form .hint {
  position: absolute;
  left: 100%;
  top: 50%;
  transform: translateY(-50%);
  margin-left: 10px;
  font-size: .78rem;
  color: #94a3b8;
  white-space: nowrap;
  opacity: 0;
  transition: opacity .2s;
  pointer-events: none;
}
.hint-too-short .search-form .hint { opacity: 1; }

.pager-wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px 24px;
  flex-wrap: wrap;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid #e5e7eb;
}
.pager {
  display: inline-flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.pager-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 38px;
  height: 38px;
  padding: 0 12px;
  font-size: .86rem;
  font-weight: 600;
  color: #064d29;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 9px;
  text-decoration: none;
  transition: all .15s ease;
  font-family: inherit;
  line-height: 1;
  white-space: nowrap;
  box-sizing: border-box;
}
.pager-btn:hover:not(.disabled):not(.active) {
  background: #f0fdf4;
  border-color: #0b6b3a;
  color: #064d29;
  text-decoration: none;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(11,107,58,.1);
}
.pager-btn.active {
  background: #0b6b3a;
  color: #fff;
  border-color: #0b6b3a;
  cursor: default;
  box-shadow: 0 4px 12px rgba(11,107,58,.22);
}
.pager-btn.disabled {
  opacity: .35;
  cursor: not-allowed;
}
.pager-ellipsis {
  display: inline-flex;
  align-items: center;
  padding: 0 4px;
  color: #94a3b8;
  font-weight: 700;
  user-select: none;
}
.pager-meta {
  display: flex;
  align-items: center;
  gap: 16px 22px;
  flex-wrap: wrap;
  margin-left: auto;
}
.pager-info {
  font-size: .84rem;
  color: #64748b;
  font-weight: 500;
  white-space: nowrap;
}
.pager-info strong {
  color: #064d29;
  font-weight: 700;
}
.pager-perlabel {
  margin: 0 !important;
  font-weight: 500 !important;
  font-size: .84rem !important;
  color: #64748b !important;
  display: inline-flex !important;
  align-items: center;
  gap: 8px;
  white-space: nowrap;
  text-transform: none !important;
  letter-spacing: 0 !important;
}
.pager-perlabel select {
  width: auto !important;
  min-width: 76px !important;
  display: inline-block !important;
  padding: 7px 28px 7px 10px !important;
  margin: 0 !important;
  font-size: .84rem !important;
  font-weight: 600 !important;
  color: #064d29 !important;
  border-radius: 9px !important;
  border: 1px solid #e5e7eb !important;
  background: #fff !important;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='%23064d29' d='M0 0l5 6 5-6z'/></svg>") !important;
  background-repeat: no-repeat !important;
  background-position: right 10px center !important;
  -webkit-appearance: none !important;
  -moz-appearance: none !important;
  appearance: none !important;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.03);
  line-height: 1.4;
}
.pager-perlabel select:focus {
  outline: none !important;
  border-color: #0b6b3a !important;
  box-shadow: 0 0 0 3px rgba(11,107,58,.12) !important;
}

@media (max-width: 640px) {
  .pager-wrap {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  .pager {
    justify-content: center;
  }
  .pager-meta {
    justify-content: space-between;
    margin-left: 0;
    width: 100%;
    padding-top: 8px;
    border-top: 1px dashed #f1f5f9;
  }
  .pager-btn {
    min-width: 34px;
    height: 34px;
    padding: 0 10px;
    font-size: .82rem;
  }
  .search-form { max-width: 100%; }
  .search-form .hint { display: none; }
}