/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

/* ── Base ── */
:root {
  --blue-50:  #E6F1FB; --blue-100: #B5D4F4; --blue-600: #185FA5; --blue-800: #0C447C;
  --green-50: #EAF3DE; --green-800:#27500A;
  --amber-50: #FAEEDA; --amber-800:#633806;
  --red-50:   #FCEBEB; --red-600:  #A32D2D;
  --purple-50:#EEEDFE; --purple-800:#3C3489;
  --pink-50:  #FBEAF0; --pink-800: #72243E;
  --teal-50:  #E1F5EE; --teal-800: #085041;
  --gray-100: #D3D1C7; --gray-400: #888780; --gray-800: #444441;
  --radius-md: 8px; --radius-lg: 12px;
  --bg-primary: #ffffff; --bg-secondary: #f5f4f0;
  --text-primary: #1a1a18; --text-secondary: #6b6a65;
  --border: rgba(0,0,0,0.12);
}

body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif; font-size: 14px; color: var(--text-primary); background: var(--bg-secondary); line-height: 1.6; }

/* ── Layout ── */
.container { max-width: 900px; margin: 0 auto; padding: 1.5rem 1rem; }
.container-sm { max-width: 480px; margin: 0 auto; padding: 2rem 1rem; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 1rem; }
.metric-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; margin-bottom: 1rem; }
@media(max-width:600px){ .two-col { grid-template-columns:1fr; } }

/* ── Cards ── */
.card { background: var(--bg-primary); border: 0.5px solid var(--border); border-radius: var(--radius-lg); padding: 1.25rem; margin-bottom: 1rem; }
.card-title { font-size: 14px; font-weight: 500; color: var(--text-primary); margin-bottom: 1rem; }
.metric-card { background: var(--bg-secondary); border-radius: var(--radius-md); padding: 1rem; }
.metric-label { font-size: 12px; color: var(--text-secondary); margin-bottom: 4px; }
.metric-val { font-size: 22px; font-weight: 500; }

/* ── Buttons ── */
.btn { display: inline-flex; align-items: center; gap: 6px; padding: 8px 18px; border-radius: var(--radius-md); font-size: 13px; font-weight: 500; cursor: pointer; border: 0.5px solid var(--border); background: var(--bg-primary); color: var(--text-primary); transition: all 0.15s; text-decoration: none; }
.btn:hover { background: var(--bg-secondary); }
.btn-primary { background: var(--blue-600); color: var(--blue-50); border-color: var(--blue-600); }
.btn-primary:hover { background: var(--blue-800); border-color: var(--blue-800); }
.btn-danger { color: var(--red-600); border-color: #F09595; }
.btn-danger:hover { background: var(--red-50); }
.btn-sm { font-size: 12px; padding: 4px 10px; }
.btn-full { width: 100%; justify-content: center; }

/* ── Forms ── */
.form-group { margin-bottom: 0.9rem; }
.form-group label { font-size: 12px; color: var(--text-secondary); display: block; margin-bottom: 4px; }
input[type=text], input[type=password], input[type=email], input[type=number], select, textarea {
  width: 100%; font-size: 13px; padding: 8px 10px; border-radius: var(--radius-md);
  border: 0.5px solid var(--border); background: var(--bg-primary); color: var(--text-primary);
  font-family: inherit; transition: border-color 0.15s;
}
input:focus, select:focus, textarea:focus { outline: none; border-color: #378ADD; }
.req { color: var(--red-600); margin-left: 2px; }

/* ── Nav bar ── */
.navbar { background: var(--bg-primary); border-bottom: 0.5px solid var(--border); padding: 0.75rem 1.5rem; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 10px; position: sticky; top: 0; z-index: 100; }
.navbar-brand { font-size: 15px; font-weight: 500; color: var(--text-primary); display: flex; align-items: center; gap: 8px; }
.navbar-actions { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.nav-tabs { display: flex; gap: 6px; }
.nav-tab { font-size: 12px; padding: 5px 12px; border-radius: var(--radius-md); border: 0.5px solid var(--border); background: var(--bg-primary); color: var(--text-secondary); cursor: pointer; transition: all 0.15s; }
.nav-tab.active { background: var(--blue-50); color: var(--blue-800); border-color: #378ADD; }
.nav-tab:hover:not(.active) { background: var(--bg-secondary); }

/* ── Pills / badges ── */
.pill { display: inline-block; font-size: 11px; padding: 2px 8px; border-radius: var(--radius-md); }
.pill-high { background: var(--green-50); color: var(--green-800); }
.pill-mid  { background: var(--amber-50); color: var(--amber-800); }
.pill-low  { background: var(--red-50);   color: var(--red-600); }
.badge { font-size: 11px; font-weight: 500; padding: 2px 8px; border-radius: var(--radius-md); }

/* ── Tables ── */
.tbl { width: 100%; border-collapse: collapse; font-size: 13px; }
.tbl th { text-align: left; font-size: 12px; font-weight: 500; color: var(--text-secondary); padding: 6px 8px; border-bottom: 0.5px solid var(--border); }
.tbl td { padding: 6px 8px; border-bottom: 0.5px solid var(--border); color: var(--text-primary); }
.tbl tr:last-child td { border-bottom: none; }

/* ── Survey ── */
.progress-wrap { background: var(--bg-secondary); border-radius: 99px; height: 4px; margin-bottom: 1.5rem; }
.progress-fill { background: var(--blue-600); border-radius: 99px; height: 4px; transition: width 0.3s; }
.q-row { padding: 0.75rem 0; border-bottom: 0.5px solid var(--border); }
.q-row:last-child { border-bottom: none; }
.q-text { font-size: 13px; color: var(--text-primary); margin-bottom: 8px; line-height: 1.6; }
.q-options { display: flex; gap: 8px; }
.q-opt { flex: 1; }
.q-opt input[type=radio] { display: none; }
.q-opt label { display: block; text-align: center; font-size: 12px; padding: 6px 4px; border: 0.5px solid var(--border); border-radius: var(--radius-md); cursor: pointer; color: var(--text-secondary); transition: all 0.15s; }
.q-opt input[type=radio]:checked + label { background: var(--blue-50); border-color: #378ADD; color: var(--blue-800); font-weight: 500; }

/* ── Misc ── */
.section-header { display: flex; align-items: center; gap: 8px; margin-bottom: 1rem; }
.divider { border: none; border-top: 0.5px solid var(--border); margin: 1rem 0; }
.text-muted { color: var(--text-secondary); font-size: 12px; }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; } .mt-2 { margin-top: 1rem; } .mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; } .mb-2 { margin-bottom: 1rem; }
.flex { display: flex; } .gap-1 { gap: 6px; } .gap-2 { gap: 10px; } .items-center { align-items: center; }
.hidden { display: none !important; }
.alert { font-size: 13px; padding: 10px 14px; border-radius: var(--radius-md); margin-bottom: 1rem; }
.alert-error { background: var(--red-50); color: var(--red-600); border: 0.5px solid #F09595; }
.alert-success { background: var(--green-50); color: var(--green-800); border: 0.5px solid #97C459; }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--blue-50); border-top-color: var(--blue-600); border-radius: 50%; animation: spin 0.7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Toast ── */
#toast { position: fixed; top: 16px; right: 16px; background: var(--green-50); color: var(--green-800); border: 0.5px solid #97C459; border-radius: var(--radius-md); font-size: 12px; padding: 8px 16px; opacity: 0; transition: opacity 0.3s; pointer-events: none; z-index: 9999; }
#toast.show { opacity: 1; }

/* ── Legend ── */
.legend { display: flex; flex-wrap: wrap; gap: 14px; margin-top: 0.75rem; justify-content: center; font-size: 12px; color: var(--text-secondary); }
.legend-dot { width: 10px; height: 10px; border-radius: 2px; display: inline-block; margin-right: 4px; vertical-align: middle; }

/* ── Filter row ── */
.filter-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-bottom: 1rem; }
.filter-row select { width: auto; font-size: 12px; padding: 5px 10px; }
.filter-row label { margin: 0; font-size: 12px; color: var(--text-secondary); }

/* ── Rec items ── */
.rec-item { display: flex; gap: 10px; padding: 0.6rem 0; border-bottom: 0.5px solid var(--border); }
.rec-item:last-child { border-bottom: none; }
.rec-text { font-size: 13px; color: var(--text-secondary); line-height: 1.6; }
.rec-text strong { color: var(--text-primary); font-weight: 500; }

/* ── Admin item rows ── */
.item-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 0; border-bottom: 0.5px solid var(--border); }
.item-row:last-child { border-bottom: none; }
.item-num { font-size: 12px; color: var(--text-secondary); min-width: 22px; margin-top: 2px; }
.item-text { font-size: 13px; color: var(--text-primary); flex: 1; line-height: 1.6; }
