:root {
  --bg: #f4f5f7;
  --surface: #ffffff;
  --ink: #172b4d;
  --ink-soft: #5e6c84;
  --line: #dfe1e6;
  --brand: #0052cc;
  --brand-dark: #0747a6;
  --green: #36b37e;
  --amber: #ffab00;
  --red: #de350b;
  --radius: 10px;
  --shadow: 0 1px 3px rgba(9,30,66,.14), 0 0 1px rgba(9,30,66,.18);
  font-family: Calibri, "Segoe UI", -apple-system, BlinkMacSystemFont, Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); }
a { color: var(--brand); }
.hidden { display: none !important; }
.muted { color: var(--ink-soft); line-height: 1.5; }

/* top bar */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 24px; background: var(--surface); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 10;
}
.brand { display: flex; align-items: center; gap: 12px; }
.brand-mark { font-size: 26px; }
.brand-title { font-weight: 700; font-size: 16px; }
.brand-sub { font-size: 12px; color: var(--ink-soft); }
.conn-pill { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-soft); }
.conn-pill .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--green); }
.link-btn { background: none; border: none; color: var(--brand); cursor: pointer; font-size: 13px; }
.pill-btn { background: #fff; border: 1px solid var(--line); border-radius: 6px; color: var(--ink); cursor: pointer; font-size: 12px; font-weight: 600; padding: 5px 10px; }
.pill-btn:hover { background: #f4f5f7; border-color: var(--brand); color: var(--brand); }
.pill-btn:disabled { opacity: .6; cursor: default; }
.brand-mark { display: block; flex: none; }

/* footer: powered by CloudEagle */
.footer { display: flex; align-items: center; justify-content: center; gap: 8px; padding: 18px 16px 28px; margin-top: 16px; border-top: 1px solid var(--line); background: var(--surface); font-size: 13px; }
.ce-brand { display: inline-flex; align-items: center; text-decoration: none; }
.ce-logo { height: 22px; width: auto; display: block; }

.container { max-width: 1240px; margin: 14px auto 24px; padding: 0 24px; }
.view { margin-bottom: 20px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 24px; }
h1 { font-size: 20px; margin: 0 0 6px; }

/* connect */
.field-row { display: flex; gap: 10px; margin: 18px 0 6px; }
.field-row input { flex: 1; }
input, select { font: inherit; padding: 9px 11px; border: 1px solid var(--line); border-radius: 6px; background: #fafbfc; color: var(--ink); }
input:focus, select:focus { outline: 2px solid var(--brand); border-color: var(--brand); background: #fff; }
.btn { font: inherit; padding: 9px 16px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; font-weight: 600; }
.btn.primary { background: var(--brand); color: #fff; }
.btn.primary:hover { background: var(--brand-dark); }
.btn.primary:disabled { background: #a5adba; cursor: not-allowed; }
.btn.ghost { background: #fff; border-color: var(--line); color: var(--ink); font-weight: 500; }
.btn.ghost:hover { background: #f4f5f7; }
.help { margin-top: 18px; font-size: 13px; color: var(--ink-soft); }
.help summary { cursor: pointer; color: var(--brand); }
.help ol { margin: 10px 0 0; padding-left: 20px; line-height: 1.7; }

.alert { margin-top: 14px; padding: 10px 14px; border-radius: 6px; background: #ffebe6; color: var(--red); border: 1px solid #ffbdad; font-size: 14px; }

/* org list */
.org-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 12px; margin: 18px 0; }
.org-card { display: flex; align-items: center; gap: 12px; padding: 14px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; transition: .12s; }
.org-card:hover { border-color: var(--brand); }
.org-card.selected { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand) inset; background: #f0f6ff; }
.org-card .ava { width: 36px; height: 36px; border-radius: 8px; background: var(--brand); color: #fff; display: grid; place-items: center; font-weight: 700; }
.org-card .nm { font-weight: 600; }
.org-card .id { font-size: 11px; color: var(--ink-soft); word-break: break-all; }
.actions { display: flex; justify-content: flex-end; gap: 10px; }

/* product picker */
.prod-controls { display: flex; align-items: center; gap: 10px; margin: 16px 0 10px; }
.prod-controls .grow { flex: 1; }
.product-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 8px; margin-bottom: 16px; max-height: 420px; overflow-y: auto; padding: 2px; }
.product-item { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 8px; cursor: pointer; }
.product-item:hover { border-color: var(--brand); background: #f7faff; }
.product-item input { width: 16px; height: 16px; }
.product-item .p-name { font-weight: 600; }
.product-item .chip { background: #eae6ff; color: #403294; font-family: ui-monospace, monospace; }
.product-item .p-inst { margin-left: auto; font-size: 12px; color: var(--ink-soft); }

/* stats */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(136px, 1fr)); gap: 8px; margin-bottom: 0; align-content: start; }
.stat {
  display: flex; align-items: center; gap: 13px; position: relative; overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); border-radius: 14px;
  padding: 8px 11px; box-shadow: var(--shadow); transition: transform .12s ease, box-shadow .12s ease;
  gap: 8px; border-radius: 9px;
}
.stat:hover { transform: translateY(-2px); box-shadow: 0 8px 20px rgba(9,30,66,.13); }
.stat::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px; background: var(--tone, var(--brand)); }
/* Small and faint. The filled, tinted 44px tile dominated the card and fought
   with the tone bar on the left for attention. */
.stat-ico {
  flex: none; width: auto; height: auto; border-radius: 0; background: none;
  font-size: 13px; line-height: 1; opacity: .3;
}
.stat .n { font-size: 19px; font-weight: 800; line-height: 1.05; color: var(--ink); }
.stat .l { font-size: 10px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .04em; margin-top: 2px; line-height: 1.25; }
.tone-brand { --tone: #0052cc; }
.tone-green { --tone: #36b37e; }
.tone-amber { --tone: #ff8b00; }
.tone-red { --tone: #de350b; }
.tone-purple { --tone: #6554c0; }
.tone-teal { --tone: #00b8d9; }

/* toolbar */
.toolbar { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 14px; }
.toolbar .grow { flex: 1 1 240px; }
.toolbar .num { width: 70px; }
.inline { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--ink-soft); }

/* table */
.table-wrap { position: relative; overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
thead th { text-align: left; padding: 10px 12px; background: #fafbfc; border-bottom: 1px solid var(--line); color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .03em; white-space: nowrap; cursor: pointer; user-select: none; }
thead th[data-sort]::after { content: " ⇅"; opacity: .35; }
thead th.sorted-asc::after { content: " ↑"; opacity: 1; }
thead th.sorted-desc::after { content: " ↓"; opacity: 1; }
tbody td { padding: 10px 12px; border-bottom: 1px solid #ebecf0; vertical-align: middle; }
tbody tr:hover { background: #f7f8fa; }
.u { display: flex; align-items: center; gap: 10px; }
.u .ava { width: 30px; height: 30px; border-radius: 50%; background: #dfe1e6; color: #42526e; display: grid; place-items: center; font-weight: 700; font-size: 12px; background-size: cover; }
.u .nm { font-weight: 600; }
.u .aid { font-size: 11px; color: var(--ink-soft); }
.badge { display: inline-block; padding: 2px 8px; border-radius: 10px; font-size: 12px; font-weight: 600; }
.badge.active { background: #e3fcef; color: #006644; }
.badge.inactive { background: #fffae6; color: #974f0c; }
.badge.closed { background: #ffebe6; color: #bf2600; }
.badge.neutral { background: #ebecf0; color: #42526e; }
.chip { display: inline-block; padding: 1px 7px; margin: 1px; border-radius: 4px; background: #deebff; color: #0747a6; font-size: 11px; }
.la-never { color: var(--red); font-weight: 600; }
.la-date { white-space: nowrap; }
.la-rel { font-size: 11px; color: var(--ink-soft); }
.detail-btn { border: 1px solid var(--line); background: #fff; border-radius: 6px; padding: 3px 9px; cursor: pointer; font-size: 12px; }
.detail-row td { background: #f4f8ff; }
.detail-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 8px; }
.detail-grid .pa { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; background: #fff; }
.detail-grid .pa .k { font-weight: 600; font-size: 13px; }
.detail-grid .pa .d { font-size: 12px; color: var(--ink-soft); }
.sitewise { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 10px; }
.sitewise .site { border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 10px 12px; }
.sitewise .site-h { font-weight: 700; margin-bottom: 6px; }
.sitewise .site-row { display: flex; align-items: center; gap: 8px; justify-content: space-between; font-size: 12px; color: var(--ink-soft); padding: 3px 0; border-top: 1px dashed #ebecf0; }
.sitewise .site-row .chip { background: #eae6ff; color: #403294; }
.table-msg { padding: 24px; text-align: center; color: var(--ink-soft); }
/* count + pagination bar. It sits ABOVE the table and sticks to the top of the
   viewport, so changing page never means scrolling to the bottom of a long
   list first. */
.table-bar {
  position: sticky; top: 0; z-index: 3;
  padding: 7px 2px; font-size: 13px; color: var(--ink-soft);
  background: var(--surface); border-bottom: 1px solid var(--line); margin-bottom: 8px;
}

@media (max-width: 640px) {
  .container { padding: 0 12px; }
  .card { padding: 16px; }
}

/* ---- loading indicator: the Atlassian Marketplace app icon in a spinning ring ----
   public/loading-icon.png is a local copy of
   https://marketplace.atlassian.com/product-listing/files/56f84e20-4bd3-4524-86d6-338434052230?width=144&height=144
   kept on disk so the dashboard still shows it with no internet access. */
@keyframes ce-spin { to { transform: rotate(1turn); } }

.loading { display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: 10px; padding: 28px 12px; color: var(--ink-soft); font-size: 13px; text-align: center; }
.loading.row { flex-direction: row; padding: 14px; }
.product-list > .loading { grid-column: 1 / -1; }

.spin-wrap { position: relative; display: grid; place-items: center; width: 56px; height: 56px; flex: none; }
.spin-wrap::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  background: conic-gradient(from 0turn, rgba(38,132,255,0) 0 55%, #2684FF 92%, #0052CC 100%);
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 calc(100% - 3px));
  mask: radial-gradient(farthest-side, #0000 calc(100% - 3px), #000 calc(100% - 3px));
  animation: ce-spin .9s linear infinite;
}
.spin-wrap img { width: 34px; height: 34px; border-radius: 8px; display: block; }
.spin-wrap.sm { width: 26px; height: 26px; }
.spin-wrap.sm::after {
  -webkit-mask: radial-gradient(farthest-side, #0000 calc(100% - 2px), #000 calc(100% - 2px));
  mask: radial-gradient(farthest-side, #0000 calc(100% - 2px), #000 calc(100% - 2px));
}
.spin-wrap.sm img { width: 16px; height: 16px; border-radius: 4px; }

/* activity-fetch progress chip in the dashboard toolbar */
.la-progress { display: inline-flex; align-items: center; font-size: 12px; color: var(--ink-soft); }
.la-progress .loading { padding: 0; gap: 6px; }

@media (prefers-reduced-motion: reduce) {
  .spin-wrap::after { animation-duration: 3s; }
}

/* the Debug log toolbar item is a link, not a button */
a.btn { text-decoration: none; display: inline-flex; align-items: center; }

/* activity stopped early (rate limit) */
.la-warn { color: #974f0c; background: #fff7e6; border: 1px solid #f5d9a8;
  border-radius: 6px; padding: 4px 8px; font-size: 12px; }

/* ---- product labels under the user, and the pager ---- */
.u { align-items: center; }
.u-txt { min-width: 0; }

/* Product labels: their own row, spanning every column, so they wrap across the
   full table width instead of inside the User cell. The user's data row drops
   its bottom border so the two read as one record. */
tbody tr.has-prods > td { border-bottom: none; }
tbody tr.prods-row > td { padding: 0 12px 10px 54px; }  /* 54px lines up under the name */
tbody tr.has-prods:hover, tbody tr.has-prods:hover + tr.prods-row,
tbody tr.prods-row:hover { background: #f7f8fa; }
.u-prods { display: flex; flex-wrap: wrap; gap: 4px; }
.u-prods .chip { margin: 0; }

.table-bar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.table-bar .grow { flex: 1 1 auto; }
.pager { display: flex; align-items: center; gap: 6px; }
.pager .btn { padding: 4px 10px; }
.pager .btn:disabled { opacity: .45; cursor: default; }
#pg-info { min-width: 110px; text-align: center; font-size: 12px; }

/* ---- per-user activity refresh ---- */
.row-actions { white-space: nowrap; }
.refresh-btn { margin-left: 6px; border: 1px solid var(--line); background: #fff; color: var(--ink-soft);
  border-radius: 6px; width: 26px; height: 26px; line-height: 1; cursor: pointer; font-size: 14px; }
.refresh-btn:hover { border-color: var(--brand); color: var(--brand); }
.refresh-btn:disabled { opacity: .5; cursor: default; }
.refresh-btn.spinning { animation: ce-spin .8s linear infinite; }

.detail-bar { display: flex; align-items: center; gap: 10px; justify-content: space-between;
  margin-bottom: 10px; padding-bottom: 8px; border-bottom: 1px solid var(--line); font-size: 12px; }
.detail-bar .btn { padding: 3px 10px; font-size: 12px; }

/* ---- actions card + filters card ----
   Filters and actions used to share one wrapping flex row of twelve bare
   controls. Separating them, and giving every control a label, means the row
   count can be explained by looking at the screen. */
/* 80 / 20: the stat tiles, then the data source and its actions stacked in a
   narrow column beside them. */
.top-grid {
  display: grid; grid-template-columns: minmax(0, 7fr) minmax(250px, 3fr);
  gap: 10px; margin-bottom: 10px; align-items: start;
}
.actions-card {
  display: flex; flex-direction: column; gap: 7px;
  padding: 10px 11px; margin-bottom: 0;
}
.actions-btns { display: flex; flex-wrap: wrap; gap: 7px; }
.actions-btns .btn { flex: 1 1 auto; padding: 6px 10px; font-size: 13px; white-space: nowrap; }
@media (max-width: 900px) { .top-grid { grid-template-columns: 1fr; } }

.filters-card { padding: 13px 14px 10px; margin-bottom: 10px; }

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-l { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .04em;
  color: var(--ink-soft); white-space: nowrap; }
.field-hint { font-weight: 400; text-transform: none; letter-spacing: 0; opacity: .75; }
.field select, .field input { width: 100%; }
.field-unit { display: flex; align-items: center; gap: 6px; }
.field-unit input { width: 68px; }
.field-unit span { font-size: 12px; color: var(--ink-soft); }

.search-row { position: relative; margin-bottom: 10px; }
.search-row input { width: 100%; padding: 11px 12px 11px 36px; font-size: 14px; }
.search-ico { position: absolute; left: 12px; top: 50%; transform: translateY(-50%) rotate(-45deg);
  color: var(--ink-soft); font-size: 15px; pointer-events: none; }

/* Content-sized, not a uniform grid: "Account status" needs far less room than
   "Site focus", and equal columns left the short ones padded with empty space.
   A select is as wide as its longest option, so each is capped to stop one long
   site name stretching the row. */
.filter-grid { display: flex; flex-wrap: wrap; gap: 9px 14px; align-items: flex-end; }
.filter-grid .field { flex: 0 1 auto; min-width: 0; }
.filter-grid .field select, .filter-grid .field input { width: auto; max-width: 210px; }
.filter-grid #f-site { max-width: 260px; }
.filter-grid #f-status, .filter-grid #f-type, .filter-grid #f-login { max-width: 170px; }

.filters-foot { display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  margin-top: 10px; padding-top: 9px; border-top: 1px solid var(--line); }
.filters-foot .grow { flex: 1 1 auto; }
.filter-chips { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; font-size: 12px; }
.fchip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 4px 3px 9px;
  border-radius: 999px; background: #deebff; color: #0747a6; font-weight: 500; }
.fchip-x { border: 0; background: none; color: inherit; cursor: pointer; font-size: 14px;
  line-height: 1; padding: 0 4px; border-radius: 999px; opacity: .7; }
.fchip-x:hover { opacity: 1; background: rgba(7,71,166,.14); }

@media (max-width: 720px) {
  .filter-grid .field { flex: 1 1 140px; }
  .filter-grid .field select, .filter-grid .field input { max-width: none; width: 100%; }
}

/* ---- header right-hand side ---- */
.top-right { display: flex; align-items: center; gap: 10px; }
a.pill-btn { text-decoration: none; display: inline-flex; align-items: center; gap: 5px; }

/* The table card carries its own padding: the shared 24px .card padding pushed
   the table a long way down the page once three cards were stacked. */
.table-card { padding: 10px 12px 12px; }
.filters-foot .btn { padding: 7px 13px; }

/* caveat about the focused site's activity data */
.site-note { color: #974f0c; background: #fff7e6; border: 1px solid #f5d9a8;
  border-radius: 6px; padding: 3px 9px; font-size: 12px; }

/* ---- landing / sign-in page ---- */
body.landing { min-height: 100vh; display: flex; flex-direction: column;
  background: linear-gradient(170deg, #f4f7fc 0%, var(--bg) 46%); }
.landing-wrap { flex: 1; width: 100%; max-width: 980px; margin: 0 auto; padding: 56px 24px 32px;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(320px, .85fr);
  gap: 40px; align-items: center; }
.landing-logo { border-radius: 10px; display: block; margin-bottom: 14px; }
.landing-pitch h1 { margin: 0 0 10px; font-size: 30px; line-height: 1.15; }
.landing-sub { margin: 0 0 18px; color: var(--ink-soft); font-size: 15px; line-height: 1.55; }
.landing-points { margin: 0; padding-left: 18px; color: var(--ink-soft); font-size: 13.5px; line-height: 1.95; }
.landing-points strong { color: var(--ink); font-weight: 600; }
.landing-card { padding: 26px 24px; }
.landing-card h2 { margin: 0 0 4px; font-size: 19px; }
.landing-note { margin: 0 0 18px; font-size: 12.5px; }
.landing-note code { background: #f4f5f7; border-radius: 4px; padding: 1px 5px; font-size: 12px; }
.landing-field { margin-bottom: 13px; }
.landing-field input { width: 100%; padding: 10px 12px; font-size: 14px; }
.landing-go { width: 100%; margin-top: 4px; padding: 11px 16px; }
@media (max-width: 820px) {
  .landing-wrap { grid-template-columns: 1fr; gap: 26px; padding-top: 32px; }
}

/* site count on a product label */
.chip-n { display: inline-block; margin-left: 5px; padding: 0 5px; border-radius: 999px;
  background: #0747a6; color: #fff; font-size: 10px; font-weight: 700; line-height: 15px;
  vertical-align: 1px; }

/* sign-in divider, organization switcher, SSO settings */
.landing-or { display: flex; align-items: center; gap: 10px; margin: 18px 0 14px; color: var(--ink-soft); font-size: 12px; }
.landing-or::before, .landing-or::after { content: ""; flex: 1; border-top: 1px solid var(--line); }
.who { font-size: 12px; color: var(--ink-soft); }
.who .tag { background: #eae6ff; color: #403294; border-radius: 4px; padding: 1px 6px; font-weight: 600; margin-left: 4px; }
.org-card .tag { margin-left: auto; font-size: 11px; background: #eae6ff; color: #403294; border-radius: 4px; padding: 2px 6px; font-weight: 600; }
.sso-form { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; margin: 18px 0; }
.sso-form .wide { grid-column: 1 / -1; }
.sso-form input[type=text], .sso-form input[type=password], .sso-form input[type=url] { width: 100%; padding: 8px 10px; }
.sso-form code, .sso-box code { background: #f4f5f7; border-radius: 4px; padding: 1px 5px; font-size: 12px; word-break: break-all; }
.sso-check { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.ok-note { margin-top: 14px; padding: 10px 14px; border-radius: 6px; background: #e3fcef; color: #006644; border: 1px solid #abf5d1; font-size: 14px; }
@media (max-width: 700px) { .sso-form { grid-template-columns: 1fr; } }
.access-h { margin-top: 28px; font-size: 16px; }
#l-atlassian { justify-content: center; width: 100%; box-sizing: border-box; }
