/* ============================================================
   THRYVE ONBOARDING — Design System
   Dark theme. All shared styles.
   ============================================================ */

/* ------------------------------------------------------------
   CSS Variables
   ------------------------------------------------------------ */
:root {
  --dark:     #080F0C;
  --card:     #0E1A14;
  --card2:    #131F18;
  --border:   #1C2E23;
  --purple:   #8F45F6;
  --purple-d: #7535D8;
  --green:    #1DB87A;
  --yellow:   #FAF854;
  --red:      #F25757;
  --light:    #F2F5F3;
  --body:     #A8B8AF;
  --grey:     #5A7060;
  --sidebar-w: 220px;
  --topbar-h:  52px;
  --radius:    12px;
  --radius-sm: 8px;
  --shadow:    0 2px 12px rgba(0,0,0,0.35);
}

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

html, body {
  height: 100%;
  background: var(--dark);
  color: var(--light);
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--purple); text-decoration: none; }
a:hover { text-decoration: underline; }
button { cursor: pointer; font-family: inherit; }

/* ------------------------------------------------------------
   Login Page
   ------------------------------------------------------------ */
.login-wrap {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: var(--dark);
}

.login-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 48px 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: var(--shadow);
}

.login-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.5px;
  color: var(--light);
  margin-bottom: 6px;
}
.login-logo span { color: var(--green); }

.login-sub {
  font-size: 13px;
  color: var(--grey);
  margin-bottom: 36px;
}

.login-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 8px;
}

.login-input {
  width: 100%;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--light);
  font-family: inherit;
  font-size: 14px;
  padding: 12px 14px;
  outline: none;
  transition: border-color .2s;
  margin-bottom: 16px;
}
.login-input:focus { border-color: var(--purple); }
.login-input::placeholder { color: var(--grey); }

.login-btn {
  width: 100%;
  background: var(--purple);
  color: #fff;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 700;
  padding: 13px;
  transition: background .2s;
  margin-top: 4px;
}
.login-btn:hover { background: var(--purple-d); }

.login-error {
  display: none;
  color: var(--red);
  font-size: 13px;
  margin-top: 12px;
  text-align: center;
}

/* ------------------------------------------------------------
   App Shell (sidebar + main)
   ------------------------------------------------------------ */
#app { display: none; height: 100vh; overflow: hidden; }

.app-layout {
  display: flex;
  height: 100vh;
}

/* Sidebar */
.sidebar {
  width: var(--sidebar-w);
  min-width: var(--sidebar-w);
  background: var(--card);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  position: relative;
  z-index: 10;
}

.sidebar-brand {
  padding: 20px 18px 16px;
  border-bottom: 1px solid var(--border);
}
.sidebar-brand-name {
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.3px;
  color: var(--light);
}
.sidebar-brand-name span { color: var(--green); }
.sidebar-person {
  font-size: 12px;
  color: var(--grey);
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sidebar-role {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.8px;
  text-transform: uppercase;
  color: var(--purple);
  margin-top: 2px;
}

.sidebar-progress {
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
}
.progress-label {
  font-size: 11px;
  color: var(--grey);
  margin-bottom: 6px;
  display: flex;
  justify-content: space-between;
}
.progress-bar-bg {
  background: var(--border);
  border-radius: 999px;
  height: 5px;
  overflow: hidden;
}
.progress-bar-fill {
  background: linear-gradient(90deg, var(--green), var(--purple));
  height: 100%;
  border-radius: 999px;
  transition: width .4s ease;
}

.sidebar-nav {
  padding: 10px 0;
  flex: 1;
}
.nav-section-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.5px;
  text-transform: uppercase;
  color: var(--grey);
  padding: 12px 18px 6px;
}
.nav-item {
  padding: 9px 18px;
  font-size: 13px;
  color: var(--body);
  cursor: pointer;
  border-left: 3px solid transparent;
  transition: all .15s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nav-item:hover { color: var(--light); background: rgba(143,69,246,.08); }
.nav-item.active {
  color: var(--light);
  background: rgba(143,69,246,.12);
  border-left-color: var(--purple);
  font-weight: 600;
}

.sidebar-footer {
  padding: 14px 18px;
  border-top: 1px solid var(--border);
}
.sidebar-logout {
  font-size: 12px;
  color: var(--grey);
  cursor: pointer;
  background: none;
  border: none;
  padding: 0;
  width: 100%;
  text-align: left;
}
.sidebar-logout:hover { color: var(--red); }

/* Main content area */
.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.topbar {
  height: var(--topbar-h);
  min-height: var(--topbar-h);
  background: var(--card);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding: 0 28px;
  gap: 10px;
}
.topbar-accent {
  font-size: 14px;
  font-weight: 700;
  color: var(--purple);
}
.topbar-title {
  font-size: 14px;
  color: var(--grey);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Mobile menu toggle */
.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--body);
  font-size: 22px;
  padding: 0;
  margin-right: 10px;
  line-height: 1;
}

.page-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 28px;
}

/* ------------------------------------------------------------
   Pages
   ------------------------------------------------------------ */
.page { display: none; }
.page.active { display: block; }
.page.fade-in { animation: fadeIn .2s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

.section-hero { margin-bottom: 24px; }
.section-hero h1 { font-size: 24px; font-weight: 700; margin-bottom: 6px; line-height: 1.2; }
.section-hero p { font-size: 14px; color: var(--body); line-height: 1.7; max-width: 680px; }

/* ------------------------------------------------------------
   Cards
   ------------------------------------------------------------ */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px 22px;
  margin-bottom: 14px;
}
.card-title {
  font-size: 15px;
  font-weight: 700;
  margin-bottom: 8px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.card-sub {
  font-size: 13px;
  color: var(--body);
  line-height: 1.65;
  margin-bottom: 16px;
}
.card-sub:last-child { margin-bottom: 0; }

/* ------------------------------------------------------------
   Rich reference pages (ops-pages.js content)
   ------------------------------------------------------------ */
.page-heading {
  font-size: 22px;
  font-weight: 700;
  margin-bottom: 6px;
  line-height: 1.2;
  color: var(--text);
}
.page-intro {
  font-size: 13px;
  color: var(--body);
  line-height: 1.7;
  max-width: 680px;
  margin-bottom: 20px;
}
.card-body {
  font-size: 13px;
  color: var(--body);
  line-height: 1.65;
  margin-bottom: 8px;
}
.item-list {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.item-list li {
  font-size: 13px;
  color: var(--body);
  line-height: 1.5;
}
.item-label {
  font-weight: 700;
  color: var(--text);
}
.group {
  margin-bottom: 20px;
}
.group-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--muted);
  padding-bottom: 8px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border);
}
.task-row {
  padding: 10px 0;
  font-size: 13px;
  color: var(--body);
  line-height: 1.5;
}

/* ------------------------------------------------------------
   Alerts
   ------------------------------------------------------------ */
.alert {
  border-radius: var(--radius-sm);
  padding: 13px 16px;
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 14px;
}
.alert-purple { background: rgba(143,69,246,.12); border: 1px solid rgba(143,69,246,.3); }
.alert-green  { background: rgba(29,184,122,.1);  border: 1px solid rgba(29,184,122,.3); }
.alert-yellow { background: rgba(250,248,84,.08); border: 1px solid rgba(250,248,84,.25); }
.alert-red    { background: rgba(242,87,87,.1);   border: 1px solid rgba(242,87,87,.3); }

/* ------------------------------------------------------------
   Badges
   ------------------------------------------------------------ */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  letter-spacing: 0.3px;
}
.badge-purple { background: rgba(143,69,246,.2); color: #B87BFF; }
.badge-green  { background: rgba(29,184,122,.18); color: #3DE09A; }
.badge-yellow { background: rgba(250,248,84,.15); color: #FAF854; }
.badge-grey   { background: rgba(90,112,96,.25);  color: var(--body); }

/* ------------------------------------------------------------
   Checklists
   ------------------------------------------------------------ */
.check-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  transition: opacity .15s;
  user-select: none;
}
.check-item:last-child { border-bottom: none; }
.check-item:hover { opacity: .85; }

.check-box {
  width: 20px;
  min-width: 20px;
  height: 20px;
  border-radius: 5px;
  border: 2px solid var(--border);
  background: var(--dark);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .15s;
  margin-top: 1px;
}
.check-tick { display: none; color: #fff; font-size: 12px; font-weight: 700; }

.check-item.done .check-box {
  background: var(--green);
  border-color: var(--green);
}
.check-item.done .check-tick { display: block; }
.check-item.done .check-text { text-decoration: line-through; color: var(--grey); }

.check-text { font-size: 13px; color: var(--body); line-height: 1.5; }
.check-note { font-size: 11px; color: var(--grey); margin-top: 2px; }

/* ------------------------------------------------------------
   SOPs / Accordions
   ------------------------------------------------------------ */
.sop-block {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 8px;
  overflow: hidden;
}
.sop-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  cursor: pointer;
  background: var(--card2);
  transition: background .15s;
  user-select: none;
}
.sop-toggle:hover { background: rgba(143,69,246,.08); }
.sop-toggle-title { font-size: 13px; font-weight: 600; color: var(--light); }
.sop-toggle-meta  { font-size: 11px; color: var(--grey); margin-top: 1px; }
.sop-chevron {
  color: var(--grey);
  font-size: 14px;
  transition: transform .2s;
  flex-shrink: 0;
}
.sop-block.open .sop-chevron { transform: rotate(180deg); }
.sop-body {
  display: none;
  padding: 16px;
  background: var(--card);
  font-size: 13px;
  color: var(--body);
  line-height: 1.7;
  border-top: 1px solid var(--border);
}
.sop-block.open .sop-body { display: block; }
.sop-body p { margin-bottom: 10px; }
.sop-body p:last-child { margin-bottom: 0; }
.sop-body strong { color: var(--light); }
.sop-body .script-line {
  background: var(--card2);
  border-left: 3px solid var(--purple);
  padding: 10px 14px;
  border-radius: 0 6px 6px 0;
  margin: 8px 0;
  font-style: italic;
  color: var(--light);
}
.sop-body ul, .sop-body ol {
  padding-left: 18px;
  margin: 8px 0;
}
.sop-body li { margin-bottom: 4px; }

/* ------------------------------------------------------------
   KPI / Numbers grid
   ------------------------------------------------------------ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.kpi-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 14px;
  text-align: center;
}
.kpi-num {
  font-size: 28px;
  font-weight: 800;
  color: var(--green);
  line-height: 1;
  margin-bottom: 6px;
}
.kpi-label {
  font-size: 11px;
  color: var(--grey);
  line-height: 1.4;
}

/* ------------------------------------------------------------
   Contact grid
   ------------------------------------------------------------ */
.contact-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}
.contact-card {
  background: var(--card2);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px;
}
.contact-card.featured { border-color: var(--purple); }
.contact-name { font-size: 14px; font-weight: 700; margin-bottom: 3px; }
.contact-role { font-size: 11px; color: var(--purple); font-weight: 600; margin-bottom: 8px; }
.contact-detail { font-size: 12px; color: var(--grey); line-height: 1.6; }
.contact-note { font-size: 11px; color: var(--body); margin-top: 8px; line-height: 1.5; }

/* ------------------------------------------------------------
   Notes / Reflections
   ------------------------------------------------------------ */
.notes-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 8px;
}
.notes-area {
  width: 100%;
  min-height: 120px;
  background: var(--dark);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--light);
  font-family: inherit;
  font-size: 13px;
  line-height: 1.6;
  padding: 12px 14px;
  resize: vertical;
  outline: none;
  transition: border-color .2s;
}
.notes-area:focus { border-color: var(--purple); }
.notes-area::placeholder { color: var(--grey); }
.notes-area.large { min-height: 400px; }

.reflection-wrap { margin-bottom: 20px; }
.reflection-prompt {
  font-size: 13px;
  font-weight: 600;
  color: var(--light);
  margin-bottom: 8px;
}
.reflection-status {
  font-size: 11px;
  color: var(--grey);
  margin-top: 8px;
}
.reflection-status.submitted { color: var(--green); }

.submit-btn {
  background: var(--green);
  color: var(--dark);
  border: none;
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-weight: 700;
  padding: 9px 20px;
  margin-top: 10px;
  transition: opacity .2s;
}
.submit-btn:hover { opacity: .85; }
.submit-btn:disabled { opacity: .5; cursor: not-allowed; }

.privacy-note {
  font-size: 11px;
  color: var(--grey);
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

/* ------------------------------------------------------------
   Admin Dashboard
   ------------------------------------------------------------ */
.admin-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.employee-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 18px 20px;
  cursor: pointer;
  transition: border-color .15s;
}
.employee-card:hover { border-color: var(--purple); }

.employee-card-header {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}
.employee-avatar {
  width: 40px;
  height: 40px;
  min-width: 40px;
  border-radius: 50%;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
}
.employee-info-name { font-size: 15px; font-weight: 700; }
.employee-info-role { font-size: 11px; color: var(--grey); margin-top: 2px; }

.employee-stats {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 14px;
}
.stat-box {
  background: var(--card2);
  border-radius: var(--radius-sm);
  padding: 10px;
  text-align: center;
}
.stat-num { font-size: 20px; font-weight: 800; color: var(--green); }
.stat-label { font-size: 10px; color: var(--grey); margin-top: 2px; }

.employee-progress-label {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--grey);
  margin-bottom: 5px;
}
.activity-time { font-size: 11px; color: var(--grey); margin-top: 10px; }

/* Employee detail view */
.detail-header {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 24px;
}
.detail-avatar {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: var(--purple);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  font-weight: 700;
  color: #fff;
}
.detail-name { font-size: 20px; font-weight: 700; }
.detail-meta { font-size: 13px; color: var(--grey); margin-top: 3px; }

.section-completion-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
}
.section-completion-row:last-child { border-bottom: none; }
.section-completion-label { flex: 1; color: var(--body); }
.section-completion-pct {
  font-weight: 700;
  font-size: 13px;
  color: var(--green);
  min-width: 36px;
  text-align: right;
}
.section-completion-bar {
  width: 80px;
  height: 4px;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.section-completion-fill {
  height: 100%;
  background: var(--green);
  border-radius: 999px;
}

.outstanding-task {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
  font-size: 13px;
  color: var(--body);
  display: flex;
  align-items: center;
  gap: 8px;
}
.outstanding-task:last-child { border-bottom: none; }
.outstanding-task::before {
  content: '○';
  color: var(--grey);
  font-size: 12px;
  flex-shrink: 0;
}

.reflection-entry {
  background: var(--card2);
  border-radius: var(--radius-sm);
  padding: 14px;
  margin-bottom: 10px;
}
.reflection-week {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--purple);
  margin-bottom: 4px;
}
.reflection-prompt-text {
  font-size: 12px;
  color: var(--grey);
  margin-bottom: 8px;
  font-style: italic;
}
.reflection-content {
  font-size: 13px;
  color: var(--body);
  line-height: 1.65;
}

.manager-note-input {
  margin-top: 12px;
}
.manager-note-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 1px;
  text-transform: uppercase;
  color: var(--grey);
  margin-bottom: 6px;
}
.manager-note-save {
  background: rgba(143,69,246,.2);
  color: var(--purple);
  border: 1px solid rgba(143,69,246,.3);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  padding: 7px 16px;
  margin-top: 8px;
  transition: background .15s;
}
.manager-note-save:hover { background: rgba(143,69,246,.35); }

.visible-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--grey);
  margin-top: 8px;
  cursor: pointer;
}
.visible-toggle input { cursor: pointer; }

/* Back button */
.back-btn {
  background: none;
  border: none;
  color: var(--grey);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-bottom: 20px;
  padding: 0;
  transition: color .15s;
}
.back-btn:hover { color: var(--light); }

/* Tabs (admin detail) */
.tab-row {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 20px;
}
.tab-btn {
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--grey);
  font-size: 13px;
  font-weight: 600;
  padding: 10px 14px;
  transition: all .15s;
  margin-bottom: -1px;
}
.tab-btn:hover { color: var(--light); }
.tab-btn.active { color: var(--purple); border-bottom-color: var(--purple); }

.tab-panel { display: none; }
.tab-panel.active { display: block; }

/* Week badge on dashboard */
.week-chip {
  display: inline-block;
  background: rgba(143,69,246,.15);
  color: var(--purple);
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 10px;
}

/* ------------------------------------------------------------
   Utility
   ------------------------------------------------------------ */
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-14 { margin-bottom: 14px; }
.text-grey   { color: var(--grey); }
.text-body   { color: var(--body); }
.text-green  { color: var(--green); }
.text-purple { color: var(--purple); }
.text-sm     { font-size: 12px; }
.text-xs     { font-size: 11px; }
.bold        { font-weight: 700; }
.divider { border: none; border-top: 1px solid var(--border); margin: 18px 0; }
.loading {
  text-align: center;
  color: var(--grey);
  font-size: 13px;
  padding: 40px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 999px; }

/* ------------------------------------------------------------
   Responsive — Mobile
   ------------------------------------------------------------ */
@media (max-width: 768px) {
  .sidebar {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform .25s ease;
    width: 260px;
  }
  .sidebar.open {
    transform: translateX(0);
    box-shadow: 4px 0 30px rgba(0,0,0,.5);
  }
  .sidebar-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.5);
    z-index: 99;
  }
  .sidebar-overlay.visible { display: block; }

  .menu-toggle { display: block; }
  .page-scroll { padding: 18px; }
  .admin-grid { grid-template-columns: 1fr; }
  .contact-grid { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .login-card { padding: 32px 24px; }
  .section-hero h1 { font-size: 20px; }
}
