/* Owner-approved literal fieldcount-prototype identity (8811), superseding the prior console palette.
   The --cpcon- names survive so call sites do not churn; every VALUE is the
   approved one. There is exactly one token set — no second palette. */
:root {
  --cpcon-navy: #0A1628;
  --cpcon-ink: #0A1628;
  --cpcon-gold: #C8A24A;
  --cpcon-gold-dk: #C8A24A;
  --cpcon-teal: #0D9488;
  --cpcon-teal-hi: #14B8A6;
  --cpcon-red: #C41E3A;
  --cpcon-ice: #F4F7FA;
  --cpcon-border: #D8DFE6;
  --cpcon-muted: #5B6B7C;
  --cpcon-bg: #F4F7FA;
  --cpcon-white: #FFFFFF;

  /* TEXT-SAFE variants. The brand gold and teal are decorative weights: on
     white, gold is 2.33:1 and teal 3.74:1, both far under the 4.5:1 a reader
     needs. A figure a PM cannot read fails the same way as a figure that is
     wrong, so anything carrying a WORD or a NUMBER uses these instead, and the
     bright ones stay for fills, rules, underlines and active states. */
  --cpcon-gold-text: #B45309;  /* Prototype CTA orange; contrast is tested. */
  --cpcon-teal-text: #0A6259;  /* 7.23:1 on white, 6.67:1 on the page ground */
  --cpcon-on-gold: #17222E;    /* 6.90:1 — white on gold is 2.33:1 and unusable */

  /* Semantic aliases onto the approved palette. Accent is gold; teal carries
     "good"; red carries "bad". Nothing maps back to the retired blue.
     Note these resolve to the TEXT weights: every current consumer of
     --cpcon-blue / --cpcon-success prints a word or a number. */
  --cpcon-blue: var(--cpcon-gold-text);
  --cpcon-sky: var(--cpcon-gold-dk);
  --cpcon-success: var(--cpcon-teal-text);
  --cpcon-warning: var(--cpcon-gold-text);
  --cpcon-danger: var(--cpcon-red);

  --radius: 10px;
  /* Literal prototype stack. No font download or substitute geometric face. */
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Inter, sans-serif;
  --sidebar-width: 210px;
}

/* Sidebar job / more grouping */
.sidebar-nav .nav-group-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 8px 14px 4px;
  margin: 0;
}
.sidebar-nav details.nav-settings summary::-webkit-details-marker { display: none; }
.sidebar-nav details.nav-settings summary.nav-group-label {
  color: rgba(255, 255, 255, 0.55);
}
.sidebar-nav details.nav-settings a {
  font-size: 13px;
  opacity: 0.92;
}
* { box-sizing: border-box; }
html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--cpcon-white);
  color: var(--cpcon-ink);
  min-height: 100%;
}
a { color: var(--cpcon-blue); text-decoration: none; }
a:hover { text-decoration: underline; }

.cpcon-mark {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 800;
  letter-spacing: 1.2px;
  color: var(--cpcon-navy);
}
.cpcon-mark .badge {
  width: 32px; height: 32px;
  border-radius: 9px;
  background: var(--cpcon-blue);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 16px;
}
.cpcon-mark.on-dark { color: #fff; }

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: var(--radius);
  border: 1px solid transparent;
  font-weight: 600;
  cursor: pointer;
  font-size: 14px;
}
.btn-primary {
  background: var(--cpcon-navy);
  color: #fff;
}
.btn-primary:hover { background: #132a4a; }
.btn-primary:disabled { opacity: 0.6; cursor: not-allowed; }
.btn-ghost {
  background: transparent;
  border-color: var(--cpcon-border);
  color: var(--cpcon-navy);
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}
.field label {
  font-size: 13px;
  font-weight: 600;
  color: var(--cpcon-muted);
}
.field input, .field select {
  min-height: 44px;
  padding: 0 12px;
  border-radius: var(--radius);
  border: 1px solid var(--cpcon-border);
  font-size: 14px;
  background: #fff;
}
.field input:focus, .field select:focus {
  outline: 2px solid var(--cpcon-blue);
  outline-offset: 1px;
}

.card {
  background: #fff;
  border: 1px solid var(--cpcon-border);
  border-radius: 12px;
  padding: 20px;
}

.topnav {
  background: var(--cpcon-navy);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  height: 56px;
}
.topnav .links a {
  color: #dbe7f3;
  margin-left: 16px;
  font-size: 14px;
  font-weight: 500;
}
.topnav .links a:hover { color: #fff; text-decoration: none; }

/* ---- App shell: left sidebar + content ---- */
.shell.app-shell {
  display: flex;
  flex-direction: row;
  min-height: 100vh;
  align-items: stretch;
}
.sidebar {
  width: var(--sidebar-width);
  flex: 0 0 var(--sidebar-width);
  background: var(--cpcon-navy);
  color: #fff;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  position: sticky;
  top: 0;
  align-self: flex-start;
  height: 100vh;
  z-index: 40;
}
.sidebar-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 18px 18px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-brand img {
  height: 32px;
  width: auto;
  display: block;
  object-fit: contain;
}
.sidebar-brand .product {
  font-weight: 600;
  font-size: 15px;
  color: #fff;
  letter-spacing: 0.02em;
}
.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 10px;
  flex: 1;
  overflow-y: auto;
}
.sidebar-nav a {
  display: block;
  color: #dbe7f3;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
  border-left: 3px solid transparent;
  transition: background 0.12s, color 0.12s;
}
.sidebar-nav a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.sidebar-nav a.active {
  color: #fff;
  background: rgba(255, 255, 255, 0.10);
  border-left-color: var(--cpcon-sky);
}
.sidebar-footer {
  padding: 12px 10px 16px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}
.sidebar-footer a {
  display: block;
  color: #dbe7f3;
  font-size: 13px;
  font-weight: 600;
  padding: 10px 12px;
  border-radius: 8px;
  text-decoration: none;
}
.sidebar-footer a:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.08);
  text-decoration: none;
}
.shell.app-shell main,
.shell.app-shell .content {
  flex: 1;
  min-width: 0;
  padding: 24px 28px 40px;
  max-width: none;
  margin: 0;
  width: auto;
}
@media (max-width: 800px) {
  .shell.app-shell {
    flex-direction: column;
  }
  .sidebar {
    width: 100%;
    flex: none;
    height: auto;
    min-height: 0;
    position: relative;
  }
  .sidebar-nav {
    flex-direction: row;
    flex-wrap: wrap;
    overflow-y: visible;
  }
  .sidebar-nav a {
    border-left: 0;
    border-bottom: 2px solid transparent;
    padding: 8px 10px;
    font-size: 12px;
  }
  .sidebar-nav a.active {
    border-left-color: transparent;
    border-bottom-color: var(--cpcon-sky);
  }
  .sidebar-footer {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
}

.login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(1200px 500px at 10% -10%, var(--cpcon-ice), transparent),
    var(--cpcon-white);
}
.login-card {
  width: 100%;
  max-width: 420px;
}
.login-card h1 {
  margin: 12px 0 4px;
  font-size: 22px;
  color: var(--cpcon-navy);
}
.login-card .tagline {
  color: var(--cpcon-muted);
  font-size: 13px;
  line-height: 1.4;
  margin-bottom: 24px;
}
.error {
  color: var(--cpcon-danger);
  font-size: 13px;
  margin-bottom: 12px;
}
.demo-box {
  margin-top: 18px;
  background: var(--cpcon-ice);
  border: 1px solid var(--cpcon-border);
  border-radius: var(--radius);
  padding: 12px;
  font-size: 12px;
  color: var(--cpcon-muted);
  line-height: 1.45;
}
.footer-note {
  text-align: center;
  margin-top: 24px;
  font-size: 11px;
  color: var(--cpcon-muted);
}

.shell {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}
.shell main {
  flex: 1;
  padding: 24px;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
}
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.stat strong { display: block; font-size: 22px; color: var(--cpcon-navy); }
.stat span { color: var(--cpcon-muted); font-size: 13px; }

.logo-img {
  display: block;
  height: 40px;
  width: auto;
  object-fit: contain;
}
.logo-img.lg { height: 64px; }
.logo-img.sm { height: 28px; }
.topnav .logo-img { height: 32px; }



/* Wide floor tables: parent scrolls (copy Variance pattern). Do NOT set
   overflow-x on .card globally — dropdowns/popovers break. */
.table-scroll {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  max-width: 100%;
}
/* Soft page guard: content still must not rely on this alone. */
html, body {
  max-width: 100%;
}
.shell.app-shell main,
.shell.app-shell .content {
  min-width: 0;
  max-width: 100%;
}
@media (max-width: 800px) {
  .shell.app-shell main,
  .shell.app-shell .content {
    padding: 12px 12px 28px;
  }
  .page-header .tenant-controls select {
    min-width: 0;
    max-width: 100%;
  }
}

/* ── Location coverage + counters, ported from the approved console ──────────
   The bar is an ACTIVITY indicator, never a completion percentage: nothing in
   the payload knows when a location is finished, so it is scaled against the
   busiest location and every card says "touched", not "done". */
.ovc-h {
  grid-column: 1 / -1;
  font-size: 11px; font-weight: 700; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--cpcon-muted);
  margin: 22px 0 0;
}
.ovc-sub { grid-column: 1 / -1; font-size: 11.5px; color: var(--cpcon-muted); margin: 2px 0 10px; }
.ovc-locgrid {
  grid-column: 1 / -1;
  display: grid; gap: 10px;
  grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
}
.ovc-loc {
  background: var(--cpcon-white); border: 1px solid var(--cpcon-border);
  border-radius: var(--radius); padding: 10px 12px;
}
.ovc-loc-head { display: flex; justify-content: space-between; gap: 8px; align-items: center; }
.ovc-loc-nums { font-size: 12px; color: var(--cpcon-muted); margin-top: 6px; font-variant-numeric: tabular-nums; }
.ovc-loc-sub { font-size: 11px; color: var(--cpcon-muted); margin-top: 6px; }
.ovc-bar { height: 6px; border-radius: 999px; background: var(--cpcon-ice); margin-top: 8px; overflow: hidden; }
.ovc-bar > i { display: block; height: 100%; background: var(--cpcon-gold); }

/* Sidebar freshness + session, from the approved console. Stale is stated in
   red rather than merely dimmed, because a PM must not have to notice a
   shade to learn the feed is old. */
.side-fresh, .side-session {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.62);
  padding: 4px 12px;
  line-height: 1.4;
  word-break: break-word;
}
.side-fresh::before {
  content: "";
  display: inline-block; width: 6px; height: 6px; border-radius: 999px;
  background: var(--cpcon-teal-hi); margin-right: 6px; vertical-align: middle;
}
.side-fresh.is-stale { color: #F3B9C2; }
.side-fresh.is-stale::before { background: var(--cpcon-red); }
.side-session { color: rgba(255, 255, 255, 0.45); padding-bottom: 8px; }
