:root {
  --navy: #1f3a5f;
  --navy-dark: #16294450;
  --teal: #2d9c92;
  --bg: #f4f6f9;
  --card: #ffffff;
  --text: #232a33;
  --muted: #6b7684;
  --border: #dfe4ea;
  --danger: #c0392b;
  --warn: #b8860b;
  --radius: 8px;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  min-height: 100vh;
}
a { color: var(--teal); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { color: var(--navy); }

/* Sidenav */
.sidenav {
  width: 230px;
  background: var(--navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  padding: 16px 0;
  flex-shrink: 0;
}
.sidenav .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 16px 16px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  margin-bottom: 10px;
}
.brand-logo { width: 36px; height: 36px; object-fit: cover; border-radius: 6px; background: #fff; }
.brand-title { font-weight: 700; font-size: 14px; line-height: 1.2; }
.nav-bell {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 16px 10px 16px;
  padding: 8px 10px;
  border-radius: var(--radius);
  background: rgba(255,255,255,0.08);
  color: #dbe6f2;
  font-size: 13px;
}
.nav-bell:hover { background: rgba(255,255,255,0.14); text-decoration: none; }
.nav-bell-badge {
  background: var(--danger, #d9534f);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 10px;
  margin-left: auto;
}
.notification-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 12px 0;
  border-bottom: 1px solid var(--border, #e5e9ef);
}
.notification-row:last-child { border-bottom: none; }
.notification-row.unread { background: #f4f9ff; margin: 0 -14px; padding: 12px 14px; border-radius: var(--radius); }
.chat-panel { max-width: 720px; display: flex; flex-direction: column; }
.chat-messages {
  height: 420px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 6px 4px;
  margin-bottom: 12px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: #fafbfc;
}
.chat-msg {
  align-self: flex-start;
  max-width: 75%;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 14px;
}
.chat-msg.mine {
  align-self: flex-end;
  background: #e3f1ff;
  border-color: #cfe6ff;
}
.chat-msg-meta { margin-bottom: 2px; font-size: 12px; }
.chat-msg-text { white-space: pre-wrap; word-break: break-word; }
.chat-delete-btn {
  background: none;
  border: none;
  color: var(--danger);
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 11px;
  margin-top: 4px;
}
.chat-form { display: flex; gap: 8px; }
.chat-form input[type=text] { flex: 1; }
.bg-swatch-label { cursor: pointer; }
.bg-swatch {
  display: block;
  width: 34px;
  height: 34px;
  border-radius: 8px;
  border: 2px solid transparent;
  box-shadow: 0 0 0 1px var(--border);
}
.bg-swatch.selected { border-color: var(--teal); box-shadow: 0 0 0 2px var(--teal); }
.nav-sections { flex: 1; overflow-y: auto; }
.sidenav ul { list-style: none; margin: 0; padding: 0; }
.nav-section-label {
  padding: 14px 18px 4px 18px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #7d97b8;
}
.sidenav ul li a {
  display: block;
  padding: 10px 18px;
  color: #dbe6f2;
  font-size: 14px;
  border-left: 3px solid transparent;
}
.sidenav ul li a:hover { background: rgba(255,255,255,0.08); text-decoration: none; }
.sidenav ul li a.active {
  background: rgba(255,255,255,0.12);
  border-left: 3px solid var(--teal);
  font-weight: 600;
  color: #fff;
}
.nav-user {
  padding: 14px 18px;
  border-top: 1px solid rgba(255,255,255,0.15);
  font-size: 13px;
}
.role-badge {
  display: inline-block;
  background: var(--teal);
  color: #fff;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  margin: 4px 0 8px 0;
}
.link-btn {
  background: none;
  border: none;
  color: #dbe6f2;
  text-decoration: underline;
  cursor: pointer;
  padding: 0;
  font-size: 13px;
}
.home-switcher { padding: 0 16px 12px 16px; }
.home-switcher select {
  width: 100%;
  padding: 6px;
  border-radius: 6px;
  border: none;
}
.active-home-label {
  display: block;
  padding: 0 16px 12px 16px;
  font-size: 13px;
  color: #a9c3dd;
}

/* Main content */
main.content { flex: 1; padding: 28px 36px; max-width: 1200px; }
main.full { flex: 1; }

.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 16px; font-size: 14px; }
.flash.info { background: #e3f1ff; color: #1a5a9c; }
.flash.success { background: #e2f6ea; color: #1e7b40; }
.flash.error { background: #fdecea; color: var(--danger); }

.muted { color: var(--muted); }

/* Cards / stats */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 16px; margin: 20px 0; }
.stat-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; text-align: center; }
.stat-card.warn { border-color: var(--warn); }
.stat-num { font-size: 30px; font-weight: 700; color: var(--navy); }
.stat-label { color: var(--muted); font-size: 13px; margin-top: 4px; }

.panel-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.panel { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 18px; }
.panel h3 { margin-top: 0; }
.list { list-style: none; padding: 0; margin: 0 0 12px 0; }
.list li { padding: 6px 0; border-bottom: 1px solid var(--border); font-size: 14px; }

/* Forms */
form label { display: block; margin-bottom: 12px; font-size: 14px; font-weight: 600; }
form input, form select, form textarea {
  width: 100%;
  padding: 8px 10px;
  margin-top: 4px;
  border: 1px solid var(--border);
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}
form textarea { min-height: 80px; resize: vertical; }
.form-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; max-width: 640px; margin-bottom: 20px; }
.form-row { display: flex; gap: 16px; }
.form-row > label { flex: 1; }

.btn {
  display: inline-block;
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: #fff;
  color: var(--text);
  cursor: pointer;
  font-size: 14px;
  text-decoration: none;
}
.btn:hover { background: #f0f2f5; text-decoration: none; }
.btn.primary { background: var(--teal); color: #fff; border-color: var(--teal); }
.btn.primary:hover { background: #268a81; }
.btn.danger { background: var(--danger); color: #fff; border-color: var(--danger); }
.btn.small { padding: 4px 10px; font-size: 12px; }

/* Tables */
table { width: 100%; border-collapse: collapse; background: var(--card); }
table th, table td { padding: 10px 12px; border-bottom: 1px solid var(--border); text-align: left; font-size: 14px; }
table th { background: #eef1f5; color: var(--navy); font-size: 12px; text-transform: uppercase; letter-spacing: 0.03em; }
.table-wrap { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-bottom: 20px; }

.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 11px; background: #eef1f5; color: var(--navy); }
.badge.open { background: #fdecea; color: var(--danger); }
.badge.progress { background: #fff6e0; color: var(--warn); }
.badge.resolved { background: #e2f6ea; color: #1e7b40; }
.badge.minor { background: #fff6e0; color: var(--warn); }
.badge.serious { background: #fdecea; color: var(--danger); }

.toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 16px; gap: 12px; flex-wrap: wrap; }
.toolbar .filters { display: flex; gap: 8px; flex-wrap: wrap; }
.toolbar select, .toolbar input { padding: 6px 8px; border-radius: 6px; border: 1px solid var(--border); }

.locked-note { font-size: 12px; color: var(--muted); font-style: italic; }

/* Activity Center - today's activities promoted band */
.today-activities { display: flex; flex-direction: column; gap: 8px; margin-bottom: 20px; }
.today-activity { display: flex; align-items: center; gap: 14px; background: #e3f1ff; border: 1px solid #bcdcfb; border-radius: var(--radius); padding: 10px 14px; }
.today-activity-badge { display: flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 600; color: #1a5a9c; text-transform: uppercase; letter-spacing: .03em; }
.today-activity-badge i { width: 6px; height: 6px; border-radius: 50%; background: #1a5a9c; display: inline-block; }
.thumb { width: 60px; height: 60px; object-fit: cover; border-radius: 6px; border: 1px solid var(--border); }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; }
.photo-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; }
.photo-card img { width: 100%; height: 140px; object-fit: cover; display: block; }
.photo-card .cap { padding: 8px; font-size: 12px; color: var(--muted); }

/* Quick-jump anchor nav for long pages like the client profile */
.quick-jump {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  position: sticky;
  top: 0;
  background: var(--bg);
  padding: 8px 0;
  z-index: 5;
}
.quick-jump a {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 4px 12px;
  font-size: 12px;
  color: var(--navy);
}
.quick-jump a:hover { background: #eef1f5; text-decoration: none; }

/* Documents */
.folder-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; margin-bottom: 20px; }
.folder-card { background: var(--card); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; }
.folder-card .folder-icon { font-size: 22px; margin-bottom: 6px; }
.folder-card h3 { margin: 0 0 4px 0; font-size: 15px; }
.file-name-preview { display: inline-block; margin-top: 6px; font-size: 12px; color: var(--muted); }
.doc-icon { display: inline-block; width: 22px; text-align: center; margin-right: 6px; }

/* Login - redesigned with a Ghanaian adinkra-symbol motif: a faint tiled field of
   line-art adinkra symbols behind the card, a kente-inspired stripe accent, a
   Sankofa emblem ("learn from the past to move forward" - fitting for returning to
   sign in), and a small legend explaining the symbols used. */
.login-wrap {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  width: 100%;
  overflow: hidden;
  background: linear-gradient(160deg, var(--navy) 0%, #142845 45%, #1f3a5f 100%);
}
.adinkra-bg {
  position: absolute;
  inset: 0;
  background-repeat: repeat;
  background-size: 320px 320px;
  opacity: 0.08;
  pointer-events: none;
}
.login-card {
  position: relative;
  z-index: 1;
  background: #fff;
  padding: 36px 32px 28px;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.35);
  width: 380px;
  text-align: center;
}
.login-emblem {
  width: 72px;
  height: 72px;
  margin: 0 auto 14px;
  border-radius: 50%;
  background: linear-gradient(150deg, var(--navy), #2d5583);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 0 4px #f2b70533, inset 0 0 0 1px rgba(255,255,255,0.15);
}
.login-emblem-icon { color: #f2c94c; }
.login-card h1 { font-size: 20px; margin-bottom: 2px; }
.login-card form { text-align: left; }
.demo-accounts { margin-top: 20px; font-size: 12px; color: var(--muted); text-align: left; }
.demo-accounts table { width: 100%; margin-top: 6px; }
.demo-accounts td { padding: 3px 4px; border: none; font-size: 11px; }

.detail-header { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.detail-header img.thumb-lg { width: 80px; height: 80px; object-fit: cover; border-radius: 8px; border: 1px solid var(--border); }
.tag-row { display: flex; gap: 6px; flex-wrap: wrap; margin: 8px 0; }

/* Print view */
.print-page { max-width: 800px; margin: 0 auto; padding: 24px; background: #fff; }
.print-page h1 { margin-bottom: 4px; }
.print-page .print-meta { color: var(--muted); font-size: 13px; margin-bottom: 20px; }
.print-page .print-field { margin-bottom: 12px; }
.print-page .print-field .lbl { font-weight: 700; font-size: 12px; text-transform: uppercase; color: var(--navy); }
.print-actions { margin: 16px 0; }
.print-logo { max-height: 60px; margin-bottom: 10px; }

@media print {
  .no-print { display: none !important; }
  body { background: #fff; }
  .print-page { padding: 0; }
  /* If a page gets printed directly (Ctrl/Cmd+P) instead of via a dedicated print
     view, hide the app "editor" chrome - sidebar nav, toolbars, buttons, and forms -
     so only the actual content prints. */
  .sidenav { display: none !important; }
  main.content { max-width: 100%; padding: 0; }
  .toolbar, form:not(.print-page form) { display: none !important; }
}
