*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Poppins', -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, Arial, sans-serif; background: #e6e6e6; height: 100vh; overflow: hidden; }
#root { height: 100vh; display: flex; flex-direction: column; }

/* ── Layout ── */
.page        { height: 100vh; overflow: hidden; display: flex; flex-direction: column; padding: 8px; gap: 5px; background: #e6e6e6; }
.header-blue  { background: #5b7fa8; color: white; flex-shrink: 0; padding: 10px 12px; position: relative; z-index: 10; display: flex; flex-direction: column; justify-content: center; min-height: 75px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 20px -12px rgba(0,0,0,.35); }
.header-green { background: #3E8552; color: white; flex-shrink: 0; padding: 10px 12px; position: relative; z-index: 10; display: flex; flex-direction: column; justify-content: center; min-height: 75px; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.12), 0 8px 20px -12px rgba(0,0,0,.35); }
.header-title  { font-size: 16px; font-weight: bold; }
.header-meta   { font-size: 12px; }
.header-center { text-align: center; }
.kv-rows  { display: inline-grid; grid-template-columns: max-content max-content max-content; justify-content: center; column-gap: 6px; row-gap: 4px; font-size: 14px; }
.kv-label { text-align: right; }
.kv-colon { text-align: center; }
.kv-value { text-align: left; font-weight: bold; }
.return-btn-left { height: 32px; box-sizing: border-box; background: white; border: none; font-weight: bold; font-size: 12px; padding: 0 14px; cursor: pointer; border-radius: 7px; display: flex; align-items: center; gap: 6px; color: #333; box-shadow: 0 1px 2px rgba(0,0,0,.08); transition: box-shadow .15s; flex-shrink: 0; align-self: flex-start; width: fit-content; }
.return-btn-left:hover { box-shadow: 0 2px 6px rgba(0,0,0,.14); }

/* ── KPI Row ── */
.kpi-row   { background: white; flex-shrink: 0; display: grid; grid-template-columns: repeat(5, 1fr); height: 70px; align-items: center; text-align: center; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.kpi-card  { display: flex; flex-direction: column; position: relative; }
.kpi-card:not(:last-child)::after { content: ""; position: absolute; right: 0; top: 15%; height: 70%; width: 1px; background: #e2e4e8; }
.kpi-label { font-size: 12px; font-weight: bold; color: #333; }
.kpi-value { font-size: 14px; color: #3E8552; font-weight: bold; margin-top: 4px; }

/* ── Chart Panel ── */
.chart-panel        { background: white; flex: 1; padding: 8px; display: flex; flex-direction: column; min-height: 0; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.chart-banner {
  font-size: 13px; font-weight: bold; background: #e8e8e8; color: #333;
  padding: 5px 16px; margin: 0 auto 6px auto;
  width: fit-content; align-self: center;
  border-radius: 20px;
}
.chart-title        { font-size: 13px; margin-bottom: 4px; flex-shrink: 0; }
.chart-scroll-area  { flex: 1; overflow-y: auto; overflow-x: hidden; position: relative; }
.chart-footer-row   { display: flex; justify-content: flex-end; align-items: center; gap: 6px; padding: 4px; flex-shrink: 0; }

/* ── Sidebar layout (Foundation / Drill pages) ── */
.bottom-row   { flex: 1; display: flex; gap: 5px; overflow: hidden; }
.sidebar-box  { background: white; width: 30px; flex-shrink: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; text-decoration: none; border-radius: 8px; box-shadow: 0 1px 3px rgba(0,0,0,.08); transition: box-shadow .15s; }
.sidebar-box:hover { box-shadow: 0 2px 8px rgba(0,0,0,.14); }
.sidebar-text { writing-mode: vertical-rl; transform: rotate(180deg); font-size: 11px; font-weight: bold; color: #5b7fa8; white-space: nowrap; }
.right-col    { flex: 1; display: flex; flex-direction: column; gap: 5px; overflow: hidden; }

/* ── Bar Chart (SVG) ── */
.bar-chart-outer { position: relative; flex: 1; overflow: hidden; display: flex; flex-direction: column; }
.bar-chart-scroll { overflow-y: auto; overflow-x: hidden; flex: 1; }
.bar-chart-scroll::-webkit-scrollbar { width: 8px; }
.bar-chart-scroll::-webkit-scrollbar-thumb { background: #ccc; border-radius: 4px; }

/* ── Pagination ── */
.page-btn { background: white; border: 1px solid #ccc; border-radius: 7px; padding: 2px 10px; cursor: pointer; font-size: 13px; font-weight: bold; color: #5b7fa8; transition: box-shadow .15s, border-color .15s; }
.page-btn:hover:not(:disabled) { box-shadow: 0 1px 4px rgba(0,0,0,.1); border-color: #aaa; }
.page-btn:disabled { opacity: 0.4; cursor: default; }
.page-indicator { font-size: 11px; color: #555; }

/* ── Home ── */
.home { height: 100vh; display: flex; flex-direction: column; font-family: 'Poppins', sans-serif; }

.home-header {
  flex-shrink: 0;
  height: 64px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: #faf7f0;
  border-bottom: 1px solid #e7e2d4;
}
.home-header-title { font-size: 19px; font-weight: 700; color: #1a1a1a; }
.home-header-actions { display: flex; gap: 10px; }

/* Both panels subgrid onto these shared rows, so the eyebrow/title/search of
   one line up with the other's no matter how many lines each heading wraps to. */
.home-panels { flex: 1; display: grid; grid-template-columns: 1fr 1fr; grid-template-rows: auto auto auto 1fr; row-gap: 18px; overflow: hidden; }
.home-panel { grid-row: 1 / -1; display: grid; grid-template-rows: subgrid; justify-items: center; align-content: start; padding: 32px 5%; }
.home-panel.grey  { background: #eef3ee; }
.home-panel.white { background: #eef3ee; border-left: 1px solid #dde5dd; }

.home-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
}
.home-eyebrow.green { color: #3E8552; }
.home-eyebrow.blue  { color: #5b7fa8; }

.home-title { font-size: clamp(22px, 1.8vw + 14px, 34px); font-weight: 700; color: #1a1a1a; text-align: center; line-height: 1.3; max-width: min(560px, 85%); }
.home-title .accent { color: #c0392b; }

/* ── Admin Panel button ── */
.admin-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #fbfaf7;
  color: #333;
  border: 1px solid #e0ddd3;
  border-radius: 20px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: bold;
  cursor: pointer;
  transition: box-shadow .15s, background .15s;
}
.admin-btn:hover { background: #f3f1ea; box-shadow: 0 2px 6px rgba(0,0,0,.08); }

/* ── Signed-in user menu ── */
/* Sits beside the return button on drill-downs, top-right on the home page. */
.page-topbar { display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-shrink: 0; }
.user-menu { position: relative; flex-shrink: 0; }
.user-menu-btn {
  display: flex; align-items: center; gap: 7px;
  background: #fbfaf7; color: #333;
  border: 1px solid #e0ddd3; border-radius: 20px;
  padding: 6px 14px;
  font-family: inherit; font-size: 12px; font-weight: bold;
  cursor: pointer; transition: background .15s, box-shadow .15s;
}
.user-menu-btn:hover { background: #f3f1ea; box-shadow: 0 2px 6px rgba(0,0,0,.08); }
.user-menu-email { max-width: 240px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-menu-caret { font-size: 10px; color: #888; }
.user-menu-list {
  position: absolute; right: 0; top: calc(100% + 6px);
  min-width: 100%;
  background: white; border: 1px solid #e0ddd3; border-radius: 10px;
  box-shadow: 0 4px 14px rgba(0,0,0,.12);
  overflow: hidden; z-index: 50;
}
.user-menu-item {
  display: flex; align-items: center; gap: 8px;
  width: 100%; background: none; border: none;
  padding: 9px 14px;
  font-family: inherit; font-size: 12px; font-weight: bold;
  color: #333; text-align: left; white-space: nowrap; cursor: pointer;
}
.user-menu-item:hover { background: #f5f7f5; }
.user-menu-item + .user-menu-item { border-top: 1px solid #f0f0f0; }

/* ── Home-page Name/EIN search box ── */
.home-search { position: relative; width: min(580px, 85%); display: flex; flex-direction: column; gap: 10px; }

.home-search-toggle { display: flex; gap: 8px; }
.home-toggle-btn {
  border: 1px solid #ccc;
  background: white;
  color: #555;
  font-size: 12px;
  font-weight: bold;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: background .15s, color .15s, border-color .15s;
}
.home-toggle-btn.active.green { background: #3E8552; border-color: #3E8552; color: white; }
.home-toggle-btn.active.blue  { background: #5b7fa8; border-color: #5b7fa8; color: white; }

.home-search-input-wrap {
  position: relative;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  display: flex;
  align-items: center;
  height: 46px;
  padding: 0 16px 0 42px;
  box-shadow: 0 1px 3px rgba(0,0,0,.06);
}
.home-search-icon { position: absolute; left: 16px; display: flex; color: #3E8552; }
.home-search-icon.blue { color: #5b7fa8; }
.home-search-input {
  border: none;
  outline: none;
  width: 100%;
  font-size: 14px;
  color: #333;
  background: transparent;
}
.home-search-input::placeholder { color: #999; }

.home-search-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  margin-top: 6px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 10px;
  overflow-y: auto;
  max-height: 260px;
  box-shadow: 0 6px 16px rgba(0,0,0,.12);
  z-index: 20;
}
.home-search-item {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  padding: 10px 16px;
  font-size: 13px;
  color: #222;
  cursor: pointer;
  border-bottom: 1px solid #f0f0f0;
}
.home-search-item:last-child { border-bottom: none; }
.home-search-item:hover { background: #f5f7f5; }
/* Long names wrap onto another line rather than being cut with an ellipsis. */
.home-search-item-name { overflow-wrap: anywhere; }
.home-search-item-meta { color: #888; font-size: 12px; padding-left: 14px; }

@media (max-width: 700px) {
  .home { height: auto; min-height: 100vh; }
  .home-header { padding: 0 16px; }
  .home-header-title { font-size: 16px; }
  .home-panels { flex-direction: column; overflow: visible; }
  .home-panel { padding: 24px 6%; }
  .home-panel.white { border-left: none; border-top: 1px solid #dde5dd; }
}

/* ── Dropdown search ── */
.search-wrap    { position: relative; width: 260px; }
.search-label   { font-size: 10px; font-weight: bold; color: white; display: block; margin-bottom: 3px; }
.dropdown-ctrl {
  position: relative;
  background: white;
  border: 1px solid #aaa;
  border-radius: 7px;
  display: flex;
  align-items: center;
  height: 32px;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
  transition: box-shadow .15s;
}
.dropdown-ctrl:hover { box-shadow: 0 2px 6px rgba(0,0,0,.14); }

.search-input {
  border: none;
  outline: none;
  width: 100%;
  padding: 4px 28px 4px 8px;
  font-size: 12px;
  background: white;
  color: #333;
  cursor: pointer;
}

.dropdown-caret {
  position: absolute;
  right: 8px;
  color: #333;
  font-size: 16px;
  font-weight: bold;
  pointer-events: none;
}
.dropdown-list  { position: absolute; top: 100%; left: 0; width: 260px; background: white; border: 1px solid #aaa; border-radius: 7px; overflow: hidden; max-height: 220px; overflow-y: auto; z-index: 9999; box-shadow: 0 4px 12px rgba(0,0,0,0.15); margin-top: 4px; }
.dropdown-item  { padding: 6px 10px; font-size: 11px; cursor: pointer; color: #333; }
.dropdown-item:hover  { background: #e8f0f8; }
.dropdown-item.active { background: #d0e4f7; }

/* ── Footer ── */
.footer { background: white; flex-shrink: 0; height: 22px; text-align: center; font-size: 12px; font-weight: bold; line-height: 22px; color: #333; border-radius: 10px; box-shadow: 0 1px 3px rgba(0,0,0,.06); }
