/* ACI brand palette (official) */
:root {
  --aci-dark: #001C22;        /* Dark / Text */
  --aci-white: #FFFFFF;       /* White / Background */
  --aci-blue: #09AACD;        /* Primary Blue */
  --aci-green: #8CC643;       /* Secondary Green */
  --aci-orange: #F8602D;      /* Tertiary Orange (accents/alerts) */
  --aci-blue-dk: #045566;     /* Dark Blue Dk2 */
  --aci-blue-lt: #CDEEF5;     /* Light Blue Lt2 */

  --ink: var(--aci-dark);
  --muted: #5b6b72;
  --line: var(--aci-blue-lt);
  --bg: #f4f8fa;
  --card: var(--aci-white);
}

* { box-sizing: border-box; }
/* the HTML hidden attribute must always win over component display rules
   (otherwise .modal-overlay/.account-menu/.ctx-group display:flex keeps them visible) */
[hidden] { display: none !important; }
html, body { margin: 0; height: 100%; }
body {
  font-family: "Roboto", system-ui, -apple-system, "Segoe UI", Arial, sans-serif;
  font-weight: 400;                 /* Roboto Regular — body 14–16pt */
  font-size: 15px;
  color: var(--ink);
  background: var(--bg);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}
h1, h2, h3 { font-weight: 700; }    /* Roboto Bold — headings */

/* top bar — horizontal logo on white (per brand rule) */
.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 28px;
  background: var(--aci-white);
}
.brand { display: flex; align-items: center; gap: 14px; text-decoration: none; }
.brand-icon { height: 46px; width: auto; flex: none; display: block; }
.wordmark { display: flex; flex-direction: column; line-height: 1.02; }
.wm-line { font-weight: 700; font-size: 21px; letter-spacing: .2px; }
.wm-dark { color: var(--aci-blue); }     /* "Advanced Care" — brand blue, matches lockup */
.wm-green { color: var(--aci-green); }    /* "Innovations" — brand green */

.header-actions { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
.session { display: flex; align-items: center; gap: 14px; font-size: 14px; color: var(--ink); }

/* external link CTAs next to the tabs */
.btn.portal { background: var(--aci-green); color: #fff; }     /* Practice Portal (Monday.com) */
.btn.portal:hover { background: #76a830; }
.btn.mabel { background: var(--aci-blue-dk); color: #fff; }    /* Mabel SVA */
.btn.mabel:hover { background: #023c4a; }

/* manage-updates button (used inside the modal) + light button */
.btn.manage { background: #fff; color: var(--aci-blue-dk); border-color: var(--aci-blue); }
.btn.manage:hover { background: var(--aci-blue-lt); }
.btn.light { background: var(--bg); color: var(--ink); }
.btn.light:hover { background: var(--line); }

/* account dropdown menu (header) — hides Manage updates / Sign out until clicked */
.account { position: relative; }
.account-btn {
  display: inline-flex; align-items: center; gap: 6px; background: transparent; border: 0;
  cursor: pointer; font-family: inherit; font-size: 14px; color: var(--ink);
  padding: 6px 8px; border-radius: 8px;
}
.account-btn:hover { background: var(--bg); }
.account-name { font-weight: 500; }
.caret { color: var(--muted); font-size: 11px; }
.account-menu {
  position: absolute; right: 0; top: calc(100% + 6px); background: #fff;
  border: 1px solid var(--line); border-radius: 10px; box-shadow: 0 8px 24px rgba(0,28,34,.16);
  min-width: 180px; padding: 6px; z-index: 40; display: flex; flex-direction: column;
}
.menu-item {
  display: block; text-align: left; background: transparent; border: 0; cursor: pointer;
  font-family: inherit; font-size: 14px; color: var(--ink); padding: 9px 12px; border-radius: 7px;
  text-decoration: none;
}
.menu-item:hover { background: var(--aci-blue-lt); color: var(--aci-blue-dk); }

/* modal (manage updates) */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,28,34,.45); z-index: 50;
  display: flex; align-items: flex-start; justify-content: center; padding: 40px 16px; overflow: auto;
}
.modal { background: #fff; border-radius: 14px; width: 100%; max-width: 720px; box-shadow: 0 12px 40px rgba(0,28,34,.3); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px 2px; }
.modal-head h2 { margin: 0; color: var(--aci-blue-dk); font-size: 20px; }
.modal-close { font-size: 24px; line-height: 1; border: 0; background: transparent; cursor: pointer; color: var(--muted); }
.modal-sub { padding: 0 20px; color: var(--muted); font-size: 13px; margin: 4px 0 8px; }
.modal-body { padding: 8px 20px; max-height: 56vh; overflow: auto; }
.modal-foot { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px 18px; border-top: 1px solid var(--line); gap: 10px; flex-wrap: wrap; }
.modal-foot-right { display: flex; align-items: center; gap: 10px; }
.modal-msg { font-size: 13px; color: var(--muted); }

.mrow { border: 1px solid var(--line); border-radius: 10px; padding: 12px; margin-bottom: 12px; display: flex; flex-direction: column; gap: 8px; }
.mrow-top { display: flex; gap: 8px; align-items: center; }
.mrow-bottom { display: flex; gap: 8px; }
.mrow input, .mrow select { font-family: inherit; font-size: 13px; padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); }
.mrow .m-title, .mrow .m-message { width: 100%; }
.mrow-bottom input { flex: 1; min-width: 0; }
.m-type { min-width: 92px; }
.m-del { margin-left: auto; font-size: 18px; line-height: 1; border: 0; background: transparent; color: var(--aci-orange); cursor: pointer; }
.m-del:hover { color: #c4411b; }
.mrow-groups { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding-top: 2px; }
.m-glabel { font-size: 12px; color: var(--muted); font-weight: 600; }
.m-groups { display: flex; gap: 14px; flex-wrap: wrap; }
.m-gchk { display: inline-flex; align-items: center; gap: 5px; font-size: 13px; color: var(--ink); cursor: pointer; }
.m-gchk input { margin: 0; }
.m-gnote { font-size: 11px; color: var(--muted); }

/* blue -> green accent bar under the header */
.accent-bar { height: 4px; background: linear-gradient(90deg, var(--aci-blue), var(--aci-green)); }

/* buttons */
.btn {
  display: inline-block; padding: 10px 18px; border-radius: 8px;
  text-decoration: none; font-weight: 500; font-size: 14px; cursor: pointer;
  border: 1px solid transparent; transition: background .15s ease, color .15s ease;
}
.btn.primary { background: var(--aci-blue); color: #fff; }
.btn.primary:hover { background: var(--aci-blue-dk); }
.btn.ghost { background: transparent; color: var(--aci-blue-dk); border-color: var(--aci-blue); }
.btn.ghost:hover { background: var(--aci-blue-lt); }

/* main */
main { flex: 1; padding: 28px; max-width: 1200px; width: 100%; margin: 0 auto; }
.welcome { text-align: center; padding: 88px 20px; }
.welcome h1 { color: var(--aci-blue-dk); font-size: 38px; margin-bottom: 10px; }
.welcome p { color: var(--muted); margin-bottom: 26px; font-size: 16px; }

.toolbar { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; }
.toolbar h1 { color: var(--aci-blue-dk); font-size: 24px; margin: 0; }
.who { color: var(--muted); font-size: 13px; }

.report {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  min-height: 540px; display: grid; place-items: center; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,28,34,.06);
}
.report iframe { border: 0; width: 100%; height: 100%; }
.report.report-v2 { display: block; height: calc(100vh - 230px); min-height: 820px; }
.placeholder { text-align: center; color: var(--muted); max-width: 560px; padding: 32px; }
.placeholder h2 { color: var(--aci-blue-dk); }
.placeholder code { background: var(--aci-blue-lt); padding: 1px 5px; border-radius: 4px; font-size: 12px; color: var(--aci-blue-dk); }

/* alerts / notifications / updates banner */
.alert-banner {
  margin-bottom: 16px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden;
  background: #fff; box-shadow: 0 1px 3px rgba(0,28,34,.06);
}
.ab-main {
  display: flex; align-items: center; gap: 12px; padding: 11px 14px;
  border-left: 5px solid var(--ab, var(--aci-blue));
}
.ab-icon { color: var(--ab, var(--aci-blue)); flex: none; display: flex; }
.ab-text { flex: 1; font-size: 14px; color: var(--ink); }
.ab-text strong { color: var(--aci-blue-dk); margin-right: 6px; }
.ab-actions { display: flex; align-items: center; gap: 8px; }
.ab-toggle {
  font-family: inherit; font-size: 12px; font-weight: 600; color: var(--aci-blue-dk);
  background: var(--aci-blue-lt); border: 0; border-radius: 20px; padding: 4px 11px; cursor: pointer;
}
.ab-dismiss {
  font-size: 18px; line-height: 1; color: var(--muted); background: transparent; border: 0;
  cursor: pointer; padding: 0 4px;
}
.ab-dismiss:hover { color: var(--ink); }
.ab-list { border-top: 1px solid var(--line); }
.ab-item { display: flex; align-items: flex-start; gap: 10px; padding: 10px 14px; border-top: 1px solid #f0f4f7; }
.ab-item:first-child { border-top: 0; }
.ab-pill {
  font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  padding: 2px 8px; border-radius: 20px; color: #fff; flex: none; margin-top: 2px;
}
.ab-item-body { flex: 1; font-size: 13px; color: var(--ink); }
.ab-item-body strong { display: block; color: var(--aci-blue-dk); }
.ab-item-date { color: var(--muted); font-size: 11px; }
.ab-link { color: var(--aci-blue); text-decoration: none; font-weight: 600; font-size: 12px; white-space: nowrap; }
.t-alert { background: var(--aci-orange); }
.t-update { background: var(--aci-green); }
.t-info { background: var(--aci-blue); }

/* context bar — group + tabs */
.context-bar {
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; margin-bottom: 18px; flex-wrap: nowrap;
}
.ctx-filters { display: flex; gap: 22px; align-items: flex-end; flex-wrap: nowrap; }
.ctx-group { display: flex; flex-direction: column; gap: 4px; }
.ctx-eyebrow { font-size: 11px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted); font-weight: 500; }
.ctx-single { font-weight: 700; font-size: 20px; color: var(--aci-blue-dk); }
.group-select {
  font-family: inherit; font-size: 16px; font-weight: 700; color: var(--aci-blue-dk);
  border: 1px solid var(--line); border-radius: 8px; padding: 7px 12px; background: #fff; cursor: pointer;
  min-width: 220px;
}
.group-select:focus { outline: 2px solid var(--aci-blue); }

.ctx-actions { display: flex; align-items: center; gap: 10px; flex-wrap: nowrap; }
.tabs { display: flex; gap: 4px; background: var(--aci-blue-lt); padding: 4px; border-radius: 10px; }
.tab {
  font-family: inherit; font-size: 14px; font-weight: 500; color: var(--aci-blue-dk);
  border: 0; background: transparent; padding: 8px 18px; border-radius: 7px; cursor: pointer;
}
.tab.is-active { background: #fff; color: var(--aci-blue-dk); box-shadow: 0 1px 2px rgba(0,28,34,.12); font-weight: 700; }

/* documents */
.doc-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.doc-head h2 { color: var(--aci-blue-dk); font-size: 20px; margin: 0 0 2px; }
.doc-sub { color: var(--muted); font-size: 13px; }
.doc-kind {
  display: inline-block; font-size: 9px; font-weight: 700; letter-spacing: .3px;
  padding: 1px 6px; border-radius: 4px; background: var(--aci-blue-lt); color: var(--aci-blue-dk);
  margin-right: 6px; vertical-align: middle;
}

/* upload form */
.up-grid { display: flex; flex-direction: column; gap: 12px; }
.up-f { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--muted); font-weight: 600; }
.up-f select, .up-f input { font-family: inherit; font-size: 14px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 7px; color: var(--ink); }
.up-static { font-weight: 700; color: var(--aci-blue-dk); font-size: 15px; }

.doc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 16px; }
.doc-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,28,34,.06); display: flex; flex-direction: column;
}
.doc-card-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-left: 5px solid var(--sec, var(--aci-blue));
}
.doc-card-head h3 { margin: 0; font-size: 15px; color: var(--aci-dark); }
.doc-count { font-size: 12px; color: var(--muted); background: var(--bg); padding: 2px 9px; border-radius: 20px; }
.doc-list { list-style: none; margin: 0; padding: 4px 0 8px; }
.doc-row {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 9px 16px; border-top: 1px solid #f0f4f7;
}
.doc-row:first-child { border-top: 0; }
.doc-name { font-size: 13px; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-meta { font-size: 11px; color: var(--muted); }
.dl {
  font-family: inherit; font-size: 12px; font-weight: 600; color: #fff; background: var(--aci-blue);
  border: 0; border-radius: 6px; padding: 6px 12px; cursor: pointer; white-space: nowrap;
}
.dl:hover { background: var(--aci-blue-dk); }
.dl:disabled { opacity: .6; cursor: default; }
.doc-group-badge {
  display: inline-block; font-size: 10px; font-weight: 700; color: var(--aci-blue-dk);
  background: var(--aci-blue-lt); padding: 1px 7px; border-radius: 20px; vertical-align: middle;
}
.doc-practice-badge {
  display: inline-block; font-size: 10px; font-weight: 700; color: #3f6d12;
  background: #eaf4d7; padding: 1px 7px; border-radius: 20px; vertical-align: middle;
}
.doc-empty, .doc-loading { color: var(--muted); padding: 28px; text-align: center; }

/* scorecard section header (selected Section chip + RLS context) */
.section-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; flex-wrap: wrap; }
/* full-screen toggle for the embedded report (pushed to the right of the section header) */
.fs-btn { margin-left: auto; padding: 6px 14px; font-size: 13px; border: 1px solid var(--aci-blue); white-space: nowrap; }
.section-chip {
  display: inline-flex; align-items: center; font-weight: 700; font-size: 15px; color: #fff;
  background: var(--sec, var(--aci-blue)); padding: 5px 14px; border-radius: 20px;
}
.section-rls { font-size: 12px; color: var(--muted); }

/* Q&A and Insights */
.insights { margin-top: 18px; }
.insights-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.insights-head h2 { color: var(--aci-blue-dk); font-size: 19px; margin: 0 0 2px; }
.insights-sub { color: var(--muted); font-size: 12px; }
/* "Ask the data" callout — points to the live Power BI Q&A visual in the report */
.ask-data {
  display: flex; align-items: center; gap: 12px; margin-bottom: 14px; padding: 11px 14px;
  background: var(--aci-blue-lt); border: 1px solid var(--aci-blue); border-radius: 10px;
}
.ask-data-icon { font-size: 18px; flex: none; }
.ask-data-text { flex: 1; font-size: 13px; color: var(--ink); }
.ask-data-text strong { color: var(--aci-blue-dk); margin-right: 4px; }
.ask-data .btn.light { flex: none; white-space: nowrap; border: 1px solid var(--aci-blue); }

/* "Your numbers" strip — this group's headline metrics above the guidance */
.your-numbers {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px;
  padding: 10px 14px; background: #fff; border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 1px 3px rgba(0,28,34,.06);
}
.yn-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .5px; color: var(--muted); margin-right: 4px; }
.yn-chip {
  display: inline-flex; align-items: baseline; gap: 6px; padding: 5px 11px;
  background: var(--bg); border-radius: 20px;
}
.yn-v { font-size: 16px; font-weight: 700; color: var(--aci-blue-dk); }
.yn-k { font-size: 12px; color: var(--muted); }
.yn-d { font-size: 11px; color: var(--muted); }

/* available-tokens hint inside the manage modal */
.ins-tokens { padding: 0 20px 4px; font-size: 12px; color: var(--muted); }
.ins-tokens code {
  background: var(--aci-blue-lt); color: var(--aci-blue-dk); padding: 1px 5px; border-radius: 4px;
  font-size: 11px; margin: 0 1px;
}

.insights-grid { display: grid; grid-template-columns: 1.2fr 1fr; gap: 16px; }
.ins-col-title {
  font-size: 12px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
  font-weight: 700; margin: 0 0 8px;
}
.ins-cards { display: flex; flex-direction: column; gap: 12px; }
.ins-card {
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px 16px;
  box-shadow: 0 1px 3px rgba(0,28,34,.06);
}
.ins-card-top { display: flex; align-items: flex-start; gap: 9px; }
.ins-title { color: var(--aci-blue-dk); font-size: 15px; }
.ins-trend { font-size: 13px; line-height: 1.4; flex: none; }
.tr-up { color: var(--aci-green); }
.tr-down { color: var(--aci-orange); }
.tr-flat { color: var(--aci-blue); }
.ins-why, .ins-action { font-size: 13px; color: var(--ink); margin: 9px 0 0; line-height: 1.45; }
.ins-tag {
  display: inline-block; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: .4px;
  color: var(--aci-blue-dk); background: var(--aci-blue-lt); padding: 1px 7px; border-radius: 5px; margin-right: 7px;
}
.ins-tag.act { color: #3f6d12; background: #eaf4d7; }
.ins-empty { color: var(--muted); font-size: 13px; padding: 16px; text-align: center; }

.qa-list { display: flex; flex-direction: column; gap: 8px; }
.qa-item { background: var(--card); border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.qa-q {
  cursor: pointer; padding: 11px 14px; font-weight: 500; font-size: 14px; color: var(--aci-blue-dk);
  list-style: none; position: relative;
}
.qa-q::-webkit-details-marker { display: none; }
.qa-q::after { content: "+"; position: absolute; right: 14px; color: var(--muted); font-weight: 700; }
.qa-item[open] .qa-q::after { content: "–"; }
.qa-item[open] .qa-q { border-bottom: 1px solid var(--line); }
.qa-a { padding: 11px 14px; font-size: 13px; color: var(--ink); line-height: 1.5; }
.qa-rowlabel { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .4px; }
/* shareable link under a Q&A answer */
.qa-link {
  display: inline-block; margin-top: 9px; font-size: 12.5px; font-weight: 600;
  color: var(--aci-blue-dk); text-decoration: none; border-bottom: 1px solid var(--aci-blue);
}
.qa-link:hover { color: var(--aci-blue); }

/* end-user "ask a question" — full-width thin bar at the bottom of the insights section */
.qa-ask {
  margin-top: 16px; padding: 10px 12px; border: 1px dashed var(--aci-blue);
  border-radius: 10px; background: var(--aci-blue-lt);
}
.qa-ask-label { display: block; font-size: 13px; font-weight: 700; color: var(--aci-blue-dk); margin-bottom: 6px; }
.qa-ask-row { display: flex; align-items: center; gap: 10px; }
.qa-ask-input {
  flex: 1; min-width: 0; height: 38px; font-family: inherit; font-size: 13px; padding: 8px 9px;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink); resize: none; background: #fff; line-height: 1.35;
}
.qa-ask-row .btn.primary { flex: none; white-space: nowrap; }
.qa-ask-msg { display: block; font-size: 12px; color: var(--aci-blue-dk); margin-top: 6px; }

/* submitted questions surfaced in Manage insights */
.ins-submitted {
  border: 1px solid var(--aci-blue); border-radius: 10px; padding: 10px 12px 4px;
  margin-bottom: 14px; background: #f3fbfd;
}
.ins-sub-count { font-weight: 700; color: var(--aci-orange); }
.ins-sub-list { display: flex; flex-direction: column; gap: 8px; margin: 8px 0 10px; }
.ins-sub-item {
  border: 1px solid var(--line); border-radius: 8px; padding: 9px 11px; background: #fff;
}
.ins-sub-q { font-size: 13px; color: var(--ink); font-weight: 500; }
.ins-sub-meta { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.ins-sub-actions { display: flex; gap: 8px; margin-top: 8px; }
.ins-sub-actions .btn { font-size: 12px; padding: 4px 10px; }

/* manage-insights modal extras */
.modal.modal-wide { max-width: 860px; }
.modal-rows { display: flex; flex-direction: column; gap: 10px; margin-bottom: 10px; }
.ins-edit-h { font-size: 14px; color: var(--aci-blue-dk); margin: 14px 0 8px; }
.mrow textarea {
  font-family: inherit; font-size: 13px; padding: 8px 9px; border: 1px solid var(--line);
  border-radius: 7px; color: var(--ink); width: 100%; min-height: 60px; resize: vertical;
}
.ai-draft {
  margin-left: auto; font-family: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
  color: var(--aci-blue-dk); background: var(--aci-blue-lt); border: 1px solid var(--aci-blue);
  border-radius: 7px; padding: 5px 10px;
}
.ai-draft:hover { background: #b6e6f2; }
.ai-draft:disabled { opacity: .6; cursor: default; }
/* when AI-draft sits next to the delete button, don't let both claim margin-left:auto */
.mrow-top .ai-draft + .m-del { margin-left: 8px; }

@media (max-width: 720px) {
  .insights-grid { grid-template-columns: 1fr; }
}

/* footer — dark brand band */
.foot {
  padding: 14px 28px; display: flex; align-items: center; justify-content: space-between;
  color: rgba(255,255,255,.75); font-size: 12px; background: var(--aci-dark);
}
.foot-url { color: var(--aci-blue-lt); }

@media (max-width: 640px) {
  .foot { flex-direction: column; gap: 4px; }
  .wm-line { font-size: 17px; }
  /* allow the context bar to stack on narrow screens instead of overflowing */
  .context-bar, .ctx-filters, .ctx-actions { flex-wrap: wrap; }
}
