/* ── Variables ── */
:root {
  --teal:       #1a6b7c;
  --teal-light: #2a8fa5;
  --teal-dark:  #124f5c;
  --teal-bg:    #e8f4f7;
  --gold:       #c9973a;
  --gold-light: #e8b155;
  --gold-bg:    #fef8ec;
  --bg:         #f4f6f8;
  --surface:    #ffffff;
  --surface2:   #f0f4f7;
  --border:     #2456DB;
  --text:       #1e2b34;
  --muted:      #6b7f8c;
  --light:      #9aadb8;
  --red:        #e74c3c;
  --red-bg:     #fde8e6;
  --orange:     #e67e22;
  --yellow:     #f39c12;
  --green:      #27ae60;
  --green-bg:   #e9f7ef;
  --radius:     10px;
  --radius-sm:  6px;
  --shadow:     0 2px 12px rgba(0,0,0,0.08);
  --shadow-lg:  0 8px 32px rgba(0,0,0,0.13);
  --sidebar-w:  230px;
  --topbar-h:   58px;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  overflow: hidden;
}

/* ── LOGIN ── */
#login-screen, #role-select-screen {
  position: fixed; inset: 0;
  background: linear-gradient(135deg, #163F9E 0%, #2456DB 60%, #5B82E8 100%);
  display: flex; align-items: center; justify-content: center;
  z-index: 9000;
}
#login-card {
  background: white; border-radius: 20px;
  padding: 44px 48px; width: min(420px, calc(100vw - 40px));
  box-shadow: 0 24px 64px rgba(0,0,0,0.25);
  text-align: center;
  max-height: calc(100vh - 40px); overflow-y: auto;
}
#login-logo {
  display: flex; align-items: center; justify-content: center;
  gap: 14px; margin-bottom: 28px;
}
#login-logo-mark {
  width: 52px; height: 52px;
  background: var(--teal); border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px; font-weight: 900; color: white;
}
#login-app-name { font-size: 20px; font-weight: 800; text-align: left; }
#login-app-sub { font-size: 11px; color: var(--muted); text-align: left; }
#login-title { font-size: 22px; font-weight: 700; margin-bottom: 8px; }
#login-sub { font-size: 14px; color: var(--muted); margin-bottom: 24px; }
#lang-select-login-wrap { margin-bottom: 24px; }
#lang-select-login-wrap label { font-size: 11px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: 0.5px; display: block; margin-bottom: 8px; }
.google-btn {
  display: flex; align-items: center; justify-content: center; gap: 12px;
  width: 100%; padding: 13px 20px;
  border: 1.5px solid var(--border); border-radius: var(--radius);
  background: white; font-size: 15px; font-weight: 600;
  cursor: pointer; transition: all 0.15s; color: var(--text);
  margin-bottom: 16px;
}
.google-btn:hover { border-color: var(--teal); box-shadow: var(--shadow); }
#login-note { font-size: 11px; color: var(--light); }

/* ── LANGUAGE SELECT (dropdown) ── */
.lang-select { position: relative; display: inline-block; }
.lang-select-trigger {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 20px;
  border: 1.5px solid var(--border); background: white; color: var(--muted);
  font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit;
  transition: all 0.15s;
}
.lang-select-trigger:hover { border-color: var(--teal); color: var(--teal); }
.lang-select-caret { font-size: 9px; opacity: 0.7; }
.lang-select-menu {
  position: absolute; top: calc(100% + 4px); left: 0; z-index: 60;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 170px; max-height: 260px; overflow-y: auto;
  list-style: none; margin: 0; padding: 4px;
}
.lang-select-option {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 8px 10px; font-size: 13px; border-radius: 6px; cursor: pointer; color: var(--text);
}
.lang-select-option:hover { background: var(--surface2); }
.lang-select-option.active { color: var(--teal-dark); font-weight: 600; }
.lang-select-check { color: var(--teal); font-weight: 700; }
#topbar-right .lang-select-trigger { background: transparent; color: white; border-color: rgba(255,255,255,0.4); }
#topbar-right .lang-select-trigger:hover { background: rgba(255,255,255,0.1); border-color: white; color: white; }
#topbar-right .lang-select-menu { left: auto; right: 0; }

/* ── TOPBAR ── */
#topbar {
  height: var(--topbar-h);
  background: var(--border);
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 20px; position: fixed; top: 0; left: 0; right: 0; z-index: 100;
  box-shadow: 0 2px 8px rgba(0,0,0,0.2);
}
#topbar-left { display: flex; align-items: center; gap: 12px; }
#sidebar-toggle {
  background: none; border: none; color: rgba(255,255,255,0.7);
  font-size: 20px; cursor: pointer; padding: 4px 8px;
  border-radius: 6px; transition: background 0.15s;
}
#sidebar-toggle:hover { background: rgba(255,255,255,0.1); }
#topbar-logo-mark {
  width: 32px; height: 32px; background: var(--gold);
  border-radius: 8px; display: flex; align-items: center; justify-content: center;
  font-size: 16px; font-weight: 900; color: white;
}
#topbar-title { color: white; font-weight: 700; font-size: 15px; }
#topbar-right { display: flex; align-items: center; gap: 14px; }
#topbar-right .btn-outline { color: white; border-color: rgba(255,255,255,0.4); }
#topbar-right .btn-outline:hover { background: rgba(255,255,255,0.1); }
#user-info { display: flex; align-items: center; gap: 8px; }
#user-avatar { width: 30px; height: 30px; border-radius: 50%; border: 2px solid rgba(255,255,255,0.3); }
#user-name { color: rgba(255,255,255,0.85); font-size: 13px; font-weight: 500; }

/* ── APP BODY ── */
#app-body {
  display: flex;
  width: 100%;
  margin-top: var(--topbar-h);
  height: calc(100vh - var(--topbar-h));
}

/* ── SIDEBAR ── */
#sidebar {
  width: var(--sidebar-w); min-width: var(--sidebar-w);
  background: var(--border);
  display: flex; flex-direction: column;
  transition: width 0.25s, min-width 0.25s;
  overflow: hidden;
}
#sidebar.collapsed { width: 0; min-width: 0; }
#nav { flex: 1; padding: 14px 10px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px;
  width: 100%; padding: 10px 14px;
  background: transparent; border: none;
  color: rgba(255,255,255,0.65); font-size: 13px; font-weight: 500;
  border-radius: var(--radius-sm); cursor: pointer;
  text-align: left; transition: all 0.15s; margin-bottom: 2px;
  white-space: nowrap;
}
.nav-btn:hover { background: rgba(255,255,255,0.1); color: white; }
.nav-btn.active { background: rgba(255,255,255,0.15); color: white; font-weight: 700; }
.nav-icon { font-size: 14px; opacity: 0.8; flex-shrink: 0; }
#sidebar-footer { padding: 14px 10px; border-top: 1px solid rgba(255,255,255,0.1); }
.export-btn {
  display: block; width: 100%; padding: 9px 14px;
  border: none; border-radius: var(--radius-sm);
  background: var(--gold); color: white;
  font-size: 12px; font-weight: 600; cursor: pointer;
  margin-bottom: 8px; transition: background 0.15s; white-space: nowrap;
}
.export-btn:hover { background: var(--gold-light); }
#sync-status { font-size: 10px; color: rgba(255,255,255,0.4); text-align: center; margin-top: 6px; }

/* ── MAIN ── */
#main { flex: 1; min-width: 0; overflow-y: auto; padding: 28px 32px; }
.view { display: none; }
.view.active { display: block; }

/* ── COMMON COMPONENTS ── */
.page-title { font-size: 22px; font-weight: 800; margin-bottom: 4px; }
.page-sub { color: var(--muted); font-size: 14px; margin-bottom: 24px; }

.card {
  background: var(--surface); border-radius: var(--radius);
  padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.card-title { font-size: 11px; font-weight: 700; color: var(--muted); margin-bottom: 14px; text-transform: uppercase; letter-spacing: 0.5px; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid-4 { display: grid; grid-template-columns: repeat(4,1fr); gap: 16px; }

.stat-card {
  background: var(--surface); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); border: 1px solid var(--border);
}
.stat-num { font-size: 36px; font-weight: 900; color: var(--teal); line-height: 1; }
.stat-label { font-size: 12px; color: var(--muted); margin-top: 6px; font-weight: 500; }

/* Forms */
.form-group { margin-bottom: 16px; }
.form-row { display: grid; gap: 14px; margin-bottom: 16px; }
.form-row-2 { grid-template-columns: 1fr 1fr; }
.form-row-3 { grid-template-columns: 1fr 1fr 1fr; }
label { display: block; font-size: 11px; font-weight: 600; color: var(--muted); margin-bottom: 5px; text-transform: uppercase; letter-spacing: 0.4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px;
  border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  font-size: 14px; color: var(--text); background: var(--surface);
  outline: none; transition: border-color 0.15s; font-family: inherit;
}
input:focus, select:focus, textarea:focus { border-color: var(--teal); }
textarea { resize: vertical; min-height: 80px; }

/* Reusable searchable country combobox (countries.js) */
.country-combobox-dropdown {
  position: absolute; top: calc(100% + 4px); left: 0; right: 0; z-index: 40;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); max-height: 220px; overflow-y: auto;
}
.country-combobox-option { padding: 9px 12px; font-size: 14px; cursor: pointer; }
.country-combobox-option:hover, .country-combobox-option.active { background: var(--surface2); color: var(--teal-dark); }
.country-combobox-empty { padding: 9px 12px; font-size: 13px; color: var(--muted); }

.btn {
  padding: 10px 22px; border: none; border-radius: var(--radius-sm);
  font-size: 14px; font-weight: 600; cursor: pointer;
  transition: opacity 0.15s, transform 0.1s;
  display: inline-flex; align-items: center; gap: 7px; font-family: inherit;
  text-decoration: none;
}
.btn:hover { opacity: 0.88; }
.btn:active { transform: scale(0.98); }
.btn-primary { background: var(--teal); color: white; }
.btn-gold { background: var(--gold); color: white; }
.btn-danger { background: var(--red); color: white; }
.btn-outline { background: transparent; border: 1.5px solid var(--border); color: var(--text); }
.btn-sm { padding: 6px 14px; font-size: 12px; }

/* Tables */
.table-wrap { overflow-x: auto; border-radius: var(--radius); border: 1px solid var(--border); }
/* Same visual frame as .table-wrap, but no horizontal scroll -- for tables
   whose columns are deliberately sized (table-layout:fixed + colgroup, see
   the Admin -> All Users table) to always fit their container's width, with
   long content wrapping onto extra lines instead of scrolling or truncating. */
.table-wrap-fit { overflow: visible; border-radius: var(--radius); border: 1px solid var(--border); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { background: var(--surface2); font-weight: 600; font-size: 11px; text-transform: uppercase; letter-spacing: 0.5px; color: var(--muted); padding: 11px 14px; text-align: left; border-bottom: 1px solid var(--border); }
td { padding: 12px 14px; border-bottom: 1px solid var(--border); vertical-align: middle; }
tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--surface2); }

.badge { display: inline-block; padding: 3px 10px; border-radius: 20px; font-size: 11px; font-weight: 600; white-space: nowrap; }

/* Per-row "⋯" actions menu (Admin -> All Users) -- same dropdown mechanics
   as .lang-select (position/absolute + hidden toggle + outside-click/Escape
   to close), under its own class names since it's a different, unrelated
   component, wired by closeRowActionMenus() in app.js. */
.row-menu { position: relative; display: inline-block; }
.row-menu-trigger {
  width: 30px; height: 30px; display: flex; align-items: center; justify-content: center;
  border-radius: 6px; border: 1.5px solid var(--border); background: var(--surface); color: var(--muted);
  font-size: 16px; font-weight: 700; line-height: 1; cursor: pointer; transition: all 0.15s;
}
.row-menu-trigger:hover { border-color: var(--teal); color: var(--teal); }
.row-menu-list {
  position: absolute; top: calc(100% + 4px); right: 0; z-index: 60;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg); min-width: 190px; list-style: none; margin: 0; padding: 4px;
}
.row-menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; font-size: 13px;
  border-radius: 6px; cursor: pointer; color: var(--text); background: none; border: none; font-family: inherit;
}
.row-menu-item:hover { background: var(--surface2); }
.row-menu-item-danger { color: var(--red); }
.row-menu-item-danger:hover { background: var(--red-bg); }

/* Assessment */
.q-card { background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius); padding: 18px 22px; margin-bottom: 14px; }
.q-text { font-size: 14px; font-weight: 500; margin-bottom: 14px; line-height: 1.6; }
.q-num { color: var(--teal); font-weight: 800; margin-right: 6px; }
.scale-hint { font-size: 11px; color: var(--muted); margin-bottom: 12px; font-style: italic; }
.radio-group { display: flex; flex-wrap: wrap; gap: 8px; }
.radio-btn { padding: 7px 16px; border-radius: 20px; border: 1.5px solid var(--border); cursor: pointer; font-size: 13px; font-weight: 500; transition: all 0.15s; background: var(--surface); color: var(--text); font-family: inherit; }
.radio-btn:hover { border-color: var(--teal); color: var(--teal); }
.radio-btn.selected { background: var(--teal); border-color: var(--teal); color: white; }
.yn-group { display: flex; gap: 10px; }
.yn-btn { padding: 8px 28px; border-radius: var(--radius-sm); border: 1.5px solid var(--border); font-size: 14px; font-weight: 600; cursor: pointer; background: var(--surface); color: var(--text); transition: all 0.15s; font-family: inherit; }
.yn-btn.selected-yes { background: var(--green); border-color: var(--green); color: white; }
.yn-btn.selected-no  { background: var(--teal); border-color: var(--teal); color: white; }

.progress-bar { background: var(--border); border-radius: 4px; height: 6px; margin-bottom: 24px; }
.progress-fill { height: 100%; border-radius: 4px; background: var(--teal); transition: width 0.3s; }

.score-result { background: var(--surface); border-radius: var(--radius); padding: 28px; text-align: center; box-shadow: var(--shadow-lg); border: 2px solid var(--border); max-width: 560px; }
.score-big { font-size: 64px; font-weight: 900; line-height: 1; }
.score-label { font-size: 22px; font-weight: 700; margin-top: 8px; }
.score-action { margin-top: 16px; padding: 12px 18px; background: var(--surface2); border-radius: var(--radius-sm); font-size: 13px; color: var(--muted); line-height: 1.5; }

/* Lib cards */
.lib-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; cursor: pointer; transition: all 0.15s; }
.lib-card:hover { box-shadow: var(--shadow-lg); border-color: var(--teal); }
.lib-card-name { font-weight: 700; font-size: 14px; }
.lib-card-domain { font-size: 11px; color: var(--muted); margin-top: 4px; }
.lib-card-meta { font-size: 11px; color: var(--light); margin-top: 8px; line-height: 1.8; }

/* Population charts */
.chart-card { background: var(--surface); border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow); border: 1px solid var(--border); margin-bottom: 20px; }
.chart-title { font-size: 14px; font-weight: 700; margin-bottom: 4px; }
.chart-sub { font-size: 12px; color: var(--muted); margin-bottom: 18px; }
.bar-chart { display: flex; flex-direction: column; gap: 10px; }
.bar-row { display: flex; align-items: center; gap: 12px; }
.bar-label { width: 160px; font-size: 12px; font-weight: 600; color: var(--muted); text-align: right; flex-shrink: 0; }
.bar-track { flex: 1; background: var(--surface2); border-radius: 4px; height: 28px; overflow: hidden; }
.bar-fill { height: 100%; border-radius: 4px; display: flex; align-items: center; padding-left: 10px; transition: width 0.6s ease; }
.bar-value { font-size: 12px; font-weight: 700; color: white; }
.bar-count { width: 60px; font-size: 12px; color: var(--muted); flex-shrink: 0; }
.severity-grid { display: grid; grid-template-columns: repeat(4,1fr); gap: 12px; }
.severity-cell { text-align: center; padding: 16px 8px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.severity-cell .num { font-size: 28px; font-weight: 800; }
.severity-cell .lbl { font-size: 11px; margin-top: 4px; font-weight: 600; }

/* Search */
.search-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.search-bar input { max-width: 340px; }
.flex-between { display: flex; align-items: center; justify-content: space-between; }

/* My Toolkit search-first landing: large, dominant search input at the top
   of the page -- deliberately overrides .search-bar input's tighter
   max-width above, same override pattern the old All Toolkits search used
   (inline max-width:none), just promoted to a reusable class since it's
   now the page's primary element instead of a secondary drill-down field. */
.tk-search-hero { max-width: 640px; margin-bottom: 4px; }
.tk-search-hero input { max-width: none; width: 100%; padding: 14px 16px; font-size: 16px; border-radius: var(--radius); }

/* Tab bar (Admin panel, My Profile) */
.tk-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  padding: 10px 4px; margin-right: 18px; font-size: 13px; font-weight: 600;
  color: var(--muted); cursor: pointer; font-family: inherit;
}
.tk-tab:hover { color: var(--text); }
.tk-tab.active { color: var(--teal-dark); border-bottom-color: var(--teal); }

/* Toast */
#toast { position: fixed; bottom: 28px; left: 50%; transform: translateX(-50%) translateY(80px); background: #1e2b34; color: white; padding: 12px 24px; border-radius: 24px; font-size: 13px; font-weight: 500; box-shadow: var(--shadow-lg); transition: transform 0.3s; z-index: 9999; pointer-events: none; }
#toast.show { transform: translateX(-50%) translateY(0); }

/* Modal */
#modal-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.45); display: flex; align-items: center; justify-content: center; z-index: 9500; }
#modal-overlay.hidden { display: none; }
#modal-box { background: var(--surface); border-radius: 14px; padding: 32px; max-width: 640px; width: 92%; max-height: 85vh; overflow-y: auto; position: relative; box-shadow: var(--shadow-lg); }
#modal-close { position: absolute; top: 14px; right: 16px; background: var(--surface2); border: none; width: 30px; height: 30px; border-radius: 50%; font-size: 13px; cursor: pointer; color: var(--muted); }

/* Misc */
.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }
.empty-state .empty-icon { font-size: 48px; margin-bottom: 14px; }
.danger-text { color: var(--red); font-weight: 700; }
.risk-High { background: var(--red-bg); color: var(--red); }
.risk-Moderate { background: #fef8e7; color: var(--yellow); }
.risk-Low { background: var(--green-bg); color: var(--green); }

/* Loading */
#loading { position: fixed; inset: 0; background: var(--border); display: flex; align-items: center; justify-content: center; z-index: 9999; }
.spinner { width: 40px; height: 40px; border: 3px solid rgba(255,255,255,0.2); border-top-color: white; border-radius: 50%; animation: spin 0.8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 768px) {
  #sidebar { position: fixed; left: 0; top: var(--topbar-h); bottom: 0; z-index: 50; box-shadow: 4px 0 24px rgba(0,0,0,0.25); }
  #sidebar.collapsed { width: 0; min-width: 0; box-shadow: none; }
  #sidebar-backdrop { display: block; position: fixed; inset: var(--topbar-h) 0 0 0; background: rgba(0,0,0,0.4); z-index: 45; }
  #sidebar-backdrop.hidden { display: none; }
  #main { padding: 20px 16px; }
  .grid-4 { grid-template-columns: 1fr 1fr; }
  .grid-2 { grid-template-columns: 1fr; }
  .form-row-2, .form-row-3 { grid-template-columns: 1fr; }
  #topbar { padding: 0 10px; gap: 6px; }
  #topbar-right { gap: 8px; }
  #user-name { display: none; }
  #btn-download-desktop .btn-label-full { display: none; }
  #btn-download-desktop { padding: 8px; }
  #topbar-right .btn-sm { padding: 8px 10px; font-size: 12px; }
  #modal-box { padding: 22px; width: calc(100vw - 24px); }
  .mood-emoji { font-size: 24px; }
  .mood-label { font-size: 9px; }
  .mood-btn { padding: 10px 2px; }
}

@media (min-width: 769px) {
  #sidebar-backdrop { display: none; }
}

@media (max-width: 480px) {
  #topbar-title { display: none; }
  #login-card { padding: 32px 22px; }
  .grid-4 { grid-template-columns: 1fr; }
  .stat-card { padding: 16px; }
  .card { padding: 16px; }
  .page-title { font-size: 19px; }
  #topbar-right { gap: 6px; }
}

/* ── Logo styles ── */
#login-logo-wrap {
  text-align: center; margin-bottom: 16px; overflow: hidden;
}
#login-logo-img {
  height: 52px; width: auto; max-width: 200px;
  object-fit: contain; display: block; margin: 0 auto;
  mix-blend-mode: multiply; background: transparent;
}
#login-divider-top {
  border-top: 1px solid var(--border); margin: 0 0 20px;
}
.lang-label {
  font-size: 11px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.5px;
  margin-bottom: 8px; text-align: center;
}
.login-or {
  display: flex; align-items: center; gap: 12px;
  margin: 14px 0; color: var(--muted); font-size: 12px;
}
.login-or::before, .login-or::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}
#email-login-form input, #email-register-form input {
  margin-bottom: 0;
}
#topbar-logo-img {
  height: 26px; width: auto; object-fit: contain; display: block;
}
#topbar-logo-chip {
  background: white; border-radius: 8px; padding: 5px 10px;
  display: inline-flex; align-items: center;
}
#sidebar-logo-wrap {
  padding: 18px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1);
}
#sidebar-app-name {
  color: white; font-size: 15px; font-weight: 800; line-height: 1.3;
}

/* Location custom input transition */
#nf-location-custom { transition: all 0.15s; }

/* ── Role picker (registration) ── */
.role-card {
  display: block; width: 100%; text-align: left;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.role-card:hover { border-color: var(--border); }
.role-card.selected { border-color: var(--teal); background: var(--teal-bg); }
.role-card-title { font-weight: 700; font-size: 13px; color: var(--text); }
.role-card-desc { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── Toolkit ── */
.toolkit-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; cursor: pointer; transition: all 0.15s; display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.toolkit-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; margin-bottom: 20px; }
.toolkit-grid .toolkit-card { margin-bottom: 0; height: 100%; max-width: 340px; min-width: 0; flex-direction: column; align-items: stretch; justify-content: flex-start; gap: 10px; }
.toolkit-card:hover { box-shadow: var(--shadow-lg); border-color: var(--teal); }
.toolkit-card-title { font-weight: 700; font-size: 14px; }
.toolkit-card-summary { font-size: 12px; color: var(--muted); margin-top: 4px; }
.toolkit-card-meta { font-size: 11px; color: var(--light); margin-top: 6px; }

.toolkit-card-summary-clamp {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; margin-top: 0;
}

.toolkit-card-remove-btn {
  flex-shrink: 0; width: 28px; height: 28px; padding: 0;
  display: flex; align-items: center; justify-content: center;
  border: 1.5px solid var(--border); border-radius: 50%;
  background: transparent; color: var(--muted); font-size: 14px; line-height: 1;
  cursor: pointer; transition: all 0.15s;
}
.toolkit-card-remove-btn:hover { border-color: var(--red); color: var(--red); background: var(--red-bg); }
.toolkit-chip { padding: 6px 14px; border-radius: 20px; border: 1.5px solid var(--border); background: var(--surface); font-size: 12px; font-weight: 600; cursor: pointer; font-family: inherit; color: var(--text); }
.toolkit-chip:hover { border-color: var(--teal); color: var(--teal); }
.toolkit-step { display: flex; gap: 12px; padding: 12px 0; border-top: 1px solid var(--border); }
.toolkit-step-num { width: 24px; height: 24px; border-radius: 50%; background: var(--teal-bg); color: var(--teal); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.crisis-banner { background: var(--red-bg); border: 1px solid #f0b8b3; border-radius: var(--radius-sm); padding: 12px 16px; margin-bottom: 16px; }
.crisis-banner-title { color: var(--red); font-weight: 700; font-size: 13px; margin-bottom: 4px; }
.crisis-banner-body { color: #8e2f26; font-size: 12px; }


/* ── Task list ── */
.task-row {
  display: flex; align-items: center; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 12px 16px; margin-bottom: 10px;
}
.task-row input[type="checkbox"] { width: 18px; height: 18px; flex-shrink: 0; accent-color: var(--teal); cursor: pointer; }

/* ── Check-In mood picker ── */
.mood-btn {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 14px 6px; cursor: pointer; transition: all 0.15s; font-family: inherit;
}
.mood-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.mood-btn.selected { border-color: var(--teal); background: var(--teal-bg); }
.mood-emoji { font-size: 30px; line-height: 1; }
.mood-label { font-size: 10px; font-weight: 600; color: var(--muted); text-align: center; }
.mood-btn.selected .mood-label { color: var(--teal-dark); }

/* ── Sidebar Check-In quick-access button ── */
.nav-btn-highlight {
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  margin: 2px 10px 10px;
}
.nav-btn-highlight:hover { background: rgba(255,255,255,0.15); }

/* ── Patient detail: notes ── */
.note-row {
  display: flex; align-items: flex-start; gap: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 10px 14px; margin-bottom: 8px;
}
.patient-name-link { text-decoration: none; color: var(--text); }
.patient-name-link:hover { color: var(--teal); text-decoration: underline; }

/* ── Offline banner ── */
#offline-banner {
  background: #8e2f26; color: white; font-size: 11px; font-weight: 600;
  padding: 8px 12px; border-radius: 6px; margin-bottom: 10px; text-align: center;
}

/* ── Toolkit category tiles ── */
.tk-section-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px; margin-bottom: 18px;
}
.tk-section-tile {
  background: var(--surface); border: 1.5px solid var(--border); border-radius: 12px;
  padding: 16px 12px; text-align: left; cursor: pointer; font-family: inherit;
  transition: all 0.15s; display: flex; flex-direction: column; gap: 4px;
  border-top: 3px solid var(--tile-color, var(--border));
}
.tk-section-tile:hover { box-shadow: var(--shadow-lg); transform: translateY(-2px); }
.tk-section-tile.active { border-color: var(--tile-color, var(--teal)); background: var(--surface2); }
.tk-section-icon { font-size: 20px; color: var(--tile-color, var(--teal)); }
.tk-section-label { font-size: 13px; font-weight: 700; color: var(--text); }
.tk-section-desc { font-size: 11px; color: var(--muted); }

/* ── Resources tab ── */
.resource-tile {
  display: block; background: var(--surface); border: 1px solid var(--border); border-radius: 10px;
  padding: 12px 14px; text-decoration: none; transition: all 0.15s;
}
.resource-tile:hover { border-color: var(--teal); box-shadow: var(--shadow-lg); }
.resource-tile-title { font-size: 13px; font-weight: 600; color: var(--text); }
.resource-tile-org { font-size: 11px; color: var(--muted); margin-top: 2px; }

/* ── My Toolkit hub: compact bento row ── */
.tk-hub-row { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 8px; }
.tk-hub-row .card { height: 100%; display: flex; flex-direction: column; }
.tk-mini-list { display: flex; flex-direction: column; gap: 8px; }
.tk-mini-list a { font-size: 13px; font-weight: 600; color: var(--text); text-decoration: none; }
.tk-mini-list a:hover { color: var(--teal); text-decoration: underline; }
.tk-resource-count { font-size: 13px; color: var(--text); }
.tk-evidence-toggle { font-size: 12px; color: var(--teal); font-weight: 600; cursor: pointer; list-style: none; }
.tk-evidence-toggle::-webkit-details-marker { display: none; }
details.tk-evidence[open] .tk-evidence-toggle { margin-bottom: 4px; }

/* ── Toolkit deep-dive accordion ── */
.toolkit-deepdive {
  border: 1px solid var(--border); border-radius: 8px; padding: 10px 14px;
  margin-bottom: 8px; background: var(--surface);
}
.toolkit-deepdive summary {
  font-size: 13px; font-weight: 600; cursor: pointer; color: var(--text);
  list-style: none; display: flex; align-items: center; gap: 8px;
}
.toolkit-deepdive summary::before { content: '+'; color: var(--teal); font-weight: 700; width: 14px; }
.toolkit-deepdive[open] summary::before { content: '\2212'; }
.toolkit-deepdive summary::-webkit-details-marker { display: none; }
.toolkit-deepdive p { font-size: 12px; color: var(--muted); margin: 8px 0 0 22px; line-height: 1.6; }

/* ── Toolkit: Daily Affirmation & Recommended Assessment ── */
.toolkit-affirmation {
  background: linear-gradient(135deg, var(--teal-bg), var(--surface2));
  border-left: 3px solid var(--teal); border-radius: 8px;
  padding: 12px 16px; margin-bottom: 14px;
}
.toolkit-affirmation-label { font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--teal-dark); margin-bottom: 4px; }
.toolkit-affirmation-text { font-size: 14px; font-style: italic; color: var(--text); line-height: 1.5; }
.toolkit-assessment-callout {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
  background: var(--surface2); border: 1px solid var(--border); border-radius: 8px;
  padding: 12px 16px; margin-bottom: 16px;
}

/* ── Structured resource row repeater (admin) ── */
.resource-row {
  display: grid; grid-template-columns: 2fr 1fr 2fr auto; gap: 8px;
  margin-bottom: 8px; align-items: center;
}
.resource-row input, .resource-row select { margin-bottom: 0; }
.btn-remove-resource-row {
  background: var(--red-bg); color: var(--red); border: none; border-radius: 6px;
  width: 32px; height: 32px; font-size: 16px; cursor: pointer; line-height: 1;
}
