/* Cashmaster cockpit shell: sidebar nav, topbar, pulse strip, state bar, and toasts. */
@import url("/static/css/charts.css");
@import url("/static/css/responsive.css");

#app {
  min-height: 100%;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.cm-app-shell {
  min-height: 100vh;
  display: flex;
  background: var(--lm-bg);
}

.cm-sb {
  width: 232px;
  flex-shrink: 0;
  background: #fff;
  border-right: 1px solid var(--lm-line);
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  position: sticky;
  top: 0;
  height: 100vh;
}

.cm-sb__tblogo {
  display: block;
  width: 70%;
  height: auto;
  margin: 6px auto 12px;
}

.cm-sb__brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 8px 10px;
}

.cm-sb__logo {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  background: var(--lm-accent);
  color: #fff;
  display: grid;
  place-items: center;
  font-family: var(--lm-font-mono);
  font-weight: 600;
  font-size: 13px;
}

.cm-sb__name {
  font-size: 14px;
  font-weight: 500;
  color: var(--lm-ink);
  line-height: 1.1;
}

.cm-sb__ver {
  font-size: 10px;
  color: var(--lm-muted);
  font-family: var(--lm-font-mono);
}

.cm-sb__clan {
  font-size: 9px;
  letter-spacing: 0.28em;
  color: var(--lm-muted-2);
  text-align: center;
  padding: 4px 0 10px;
  font-weight: 500;
}

.cm-sb__op {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border: 1px solid var(--lm-line);
  border-radius: 8px;
  font-size: 12px;
  color: var(--lm-ink-2);
  margin-bottom: 12px;
  background: #fff;
}

.cm-sb__op-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dx-ok);
}

/* Personal surface, not a cockpit route: styled like a nav link but sitting
   above the route sections so it never reads as one of them. */
.cm-sb__own {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 7px 10px;
  margin-bottom: 12px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 400;
  color: var(--lm-muted);
  transition: background .15s, color .15s;
}

.cm-sb__own:hover {
  background: var(--lm-bg-2);
  color: var(--lm-ink);
}

.cm-sb__op-name {
  font-weight: 500;
  color: var(--lm-ink);
}

.cm-sb__op-role {
  color: var(--lm-muted);
  margin-left: auto;
  font-size: 11px;
}

.cm-sb__scroll {
  overflow-y: auto;
  flex: 1;
  margin: 0 -4px;
  padding: 0 4px;
}

.cm-sb__sec {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--lm-muted-2);
  font-weight: 500;
  padding: 12px 10px 6px;
}

.cm-sb__nav {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.cm-nl {
  display: flex;
  align-items: center;
  gap: 10px;
  min-height: 32px;
  padding: 7px 10px;
  border-radius: 6px;
  font-size: 13px;
  color: var(--lm-ink-2);
  font-weight: 400;
  transition: background .15s, color .15s;
}

.cm-nl:hover {
  background: var(--lm-bg-2);
}

.cm-nl--active {
  background: var(--lm-accent-soft);
  color: var(--lm-accent);
  font-weight: 500;
}

.cm-nl__ico {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  font-family: var(--lm-font-mono);
  font-size: 8px;
  letter-spacing: 0;
  color: var(--lm-muted);
  background: var(--lm-bg-2);
}

.cm-nl--active .cm-nl__ico {
  color: var(--lm-accent);
  background: #fff;
}

.cm-nl__label {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cm-nl__badge {
  margin-left: auto;
  font-family: var(--lm-font-mono);
  font-size: 10px;
  min-width: 18px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  display: grid;
  place-items: center;
  background: var(--lm-bg-2);
  color: var(--lm-muted);
  font-weight: 500;
}

.cm-nl__badge--alert {
  background: var(--dx-crit);
  color: #fff;
}

.cm-nl__badge--warn {
  background: var(--dx-warn-soft);
  color: var(--dx-warn);
}

.cm-sb__user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px;
  border-top: 1px solid var(--lm-line);
  margin-top: auto;
  min-width: 0;
}

.cm-sb__av {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--lm-accent), #6B7CFF);
  color: #fff;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 500;
}

.cm-sb__user-name {
  font-size: 13px;
  font-weight: 500;
  overflow: hidden;
  text-overflow: ellipsis;
}

.cm-sb__chev {
  margin-left: auto;
  color: var(--lm-muted-2);
}

.cm-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.cm-top {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 24px;
  height: 56px;
  background: #fff;
  border-bottom: 1px solid var(--lm-line);
  position: sticky;
  top: 0;
  z-index: 12;
}

.cm-crumb {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--lm-muted);
  min-width: 0;
}

.cm-crumb__sep {
  color: var(--lm-muted-2);
}

.cm-crumb__here {
  color: var(--lm-ink);
  font-weight: 500;
  white-space: nowrap;
}

.cm-top__spacer {
  flex: 1;
}

.cm-top__act {
  display: flex;
  align-items: center;
  gap: 8px;
}

.cm-btn {
  padding: 8px 14px;
  border: 1px solid transparent;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  line-height: 1;
  white-space: nowrap;
}

.cm-btn--dark {
  background: var(--lm-ink);
  color: #fff;
}

.cm-btn--dark:hover {
  background: #000;
  color: #fff;
}

.cm-btn--sec {
  background: #fff;
  color: var(--lm-ink);
  border-color: var(--lm-line-2);
}

.cm-btn--sec:hover {
  background: var(--lm-bg-2);
  color: var(--lm-ink);
}

.cm-btn--sm {
  padding: 5px 10px;
  font-size: 12px;
}

.cm-btn__glyph {
  font-family: var(--lm-font-mono);
  font-size: 9px;
  letter-spacing: 0;
}

.cm-iconbtn {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  color: var(--lm-muted);
  position: relative;
  transition: background .15s, color .15s;
}

.cm-iconbtn:hover {
  background: var(--lm-bg-2);
  color: var(--lm-ink);
}

.cm-iconbtn__badge {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 15px;
  height: 15px;
  border-radius: 999px;
  background: var(--dx-crit);
  color: #fff;
  font-size: 9px;
  font-weight: 600;
  display: grid;
  place-items: center;
  border: 2px solid #fff;
  font-family: var(--lm-font-mono);
}

.cm-logout__btn {
  height: 32px;
  border: 1px solid var(--lm-line);
  border-radius: 8px;
  padding: 0 10px;
  color: var(--lm-muted);
  background: #fff;
}

.cm-logout__btn:hover {
  background: var(--lm-bg-2);
  color: var(--lm-ink);
}

.cm-pulse {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 8px 24px;
  background: #fff;
  border-bottom: 1px solid var(--lm-line);
  font-size: 12px;
  color: var(--lm-muted);
  position: sticky;
  top: 56px;
  z-index: 11;
  flex-wrap: wrap;
}

.cm-pulse__g {
  display: flex;
  align-items: center;
  gap: 7px;
  min-height: 22px;
}

.cm-pulse__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dx-ok);
  position: relative;
}

.cm-pulse__dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--dx-ok);
  opacity: .5;
  animation: cm-ping 2s cubic-bezier(.2, .7, .2, 1) infinite;
}

@keyframes cm-ping {
  0% {
    transform: scale(.8);
    opacity: .6;
  }
  80%, 100% {
    transform: scale(1.6);
    opacity: 0;
  }
}

.cm-pulse__lbl {
  color: var(--lm-ink);
  font-weight: 500;
}

.cm-pulse__mono {
  font-family: var(--lm-font-mono);
  color: var(--lm-ink);
}

.cm-pulse__sep {
  width: 1px;
  height: 14px;
  background: var(--lm-line);
}

.cm-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 10px;
  font-weight: 500;
  background: var(--dx-mute-soft);
  color: var(--lm-ink-2);
  white-space: nowrap;
  line-height: 1.5;
}

.cm-pill--ok {
  background: var(--dx-ok-soft);
  color: var(--dx-ok);
}

.cm-pill--info {
  background: var(--dx-info-soft);
  color: var(--dx-info);
}

.cm-pill--mute {
  background: var(--dx-mute-soft);
  color: var(--lm-muted);
}

.cm-body {
  padding: 22px 24px 72px;
  max-width: none;
  width: 100%;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.cm-statebar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: #fff;
  border: 1px solid var(--lm-line-2);
  border-radius: 10px;
  flex-wrap: wrap;
  box-shadow: var(--dx-shadow-card);
}

.cm-statebar__lbl {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .07em;
  font-weight: 500;
  color: var(--lm-muted-2);
}

.cm-statebar__b {
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-family: var(--lm-font-mono);
  color: var(--lm-muted);
  background: var(--lm-bg-2);
  border: 1px solid transparent;
  transition: all .15s;
}

.cm-statebar__b:hover {
  color: var(--lm-ink);
  background: #fff;
  border-color: var(--lm-line-2);
}

.cm-statebar__b--on {
  background: var(--lm-ink);
  color: #fff;
}

.cm-statebar__b--on:hover {
  color: #fff;
  background: var(--lm-ink);
}

.cm-statebar__note {
  margin-left: auto;
  font-size: 11px;
  color: var(--lm-muted);
}

.cm-pagehead {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.cm-pagehead h1 {
  margin: 0;
  font-size: 24px;
  line-height: 1.16;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--lm-ink);
}

.cm-pagehead p {
  margin: 4px 0 0;
  font-size: 13px;
  color: var(--lm-muted);
  max-width: 720px;
  line-height: 1.5;
}

.cm-pagehead__meta {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}

.cm-eyebrow {
  font-family: var(--lm-font-mono);
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 500;
  color: var(--lm-accent);
}

.cm-kpis {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
}

.cm-kpi,
.cm-card {
  background: #fff;
  border-radius: 8px;
  box-shadow: var(--dx-shadow-card);
}

.cm-kpi {
  padding: 15px 18px;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.cm-kpi__label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: .05em;
  color: var(--lm-muted);
  font-weight: 500;
}

.cm-kpi__value {
  font-size: 24px;
  font-weight: 500;
  letter-spacing: 0;
  color: var(--lm-ink);
  line-height: 1.1;
  font-family: var(--lm-font-mono);
}

.cm-kpi__delta {
  font-size: 11px;
  color: var(--lm-muted);
  margin-top: 2px;
}

.cm-card {
  padding: 18px 20px;
}

.cm-card--flush {
  padding: 0;
  overflow: hidden;
}

.cm-cardhead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--lm-line);
}

.cm-cardhead h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 500;
  color: var(--lm-ink);
}

.cm-cardhead__meta {
  font-size: 11px;
  color: var(--lm-muted-2);
  font-family: var(--lm-font-mono);
}

.cm-route-preview {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.cm-route-preview__actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.cm-route-preview h2 {
  margin: 0 0 4px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: 0;
}

.cm-route-preview p {
  margin: 0;
  color: var(--lm-muted);
  font-size: 13px;
  line-height: 1.55;
}

.cm-inventory {
  display: flex;
  flex-direction: column;
}

.cm-inventory__row {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr) auto;
  gap: 12px;
  align-items: center;
  padding: 12px 18px;
  border-bottom: 1px solid var(--lm-line);
  font-size: 13px;
}

.cm-inventory__row:last-child {
  border-bottom: 0;
}

.cm-inventory__idx {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  background: var(--lm-bg-2);
  color: var(--lm-muted);
  display: grid;
  place-items: center;
  font-family: var(--lm-font-mono);
  font-size: 11px;
}

.cm-toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 60;
  align-items: flex-end;
  pointer-events: none;
}

.cm-toast {
  min-width: 240px;
  max-width: min(420px, calc(100vw - 40px));
  padding: 11px 14px;
  border-radius: 8px;
  box-shadow: var(--dx-shadow-pop);
  font-size: 12.5px;
  line-height: 1.4;
  background: var(--dx-ok-soft);
  border: 1px solid color-mix(in srgb, var(--dx-ok) 18%, transparent);
  color: #14532d;
  animation: cm-fade .15s ease;
}

.cm-toast--warn {
  background: var(--dx-warn-soft);
  border-color: color-mix(in srgb, var(--dx-warn) 22%, transparent);
  color: #7a4100;
}

.cm-toast--err {
  background: var(--dx-crit-soft);
  border-color: color-mix(in srgb, var(--dx-crit) 24%, transparent);
  color: #b42318;
}

.cm-toast--info {
  background: var(--dx-info-soft, #eef4ff);
  border-color: color-mix(in srgb, var(--dx-info, #2c3dda) 22%, transparent);
  color: #23348f;
}

.cm-toast--leaving {
  opacity: 0;
  transform: translateY(4px);
  transition: opacity .18s ease, transform .18s ease;
}

@keyframes cm-fade {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1100px) {
  .cm-sb {
    width: 64px;
    padding: 14px 8px;
  }

  .cm-sb__tblogo,
  .cm-sb__name,
  .cm-sb__ver,
  .cm-sb__clan,
  .cm-sb__sec,
  .cm-nl__label,
  .cm-sb__op-name,
  .cm-sb__op-role,
  .cm-nl__badge,
  .cm-sb__user-name,
  .cm-sb__chev {
    display: none;
  }

  .cm-sb__brand,
  .cm-sb__op,
  .cm-sb__user {
    justify-content: center;
    padding-left: 0;
    padding-right: 0;
  }

  .cm-nl {
    justify-content: center;
    padding: 9px 0;
  }

  .cm-kpis {
    grid-template-columns: 1fr;
  }

  .cm-route-preview {
    align-items: flex-start;
    flex-direction: column;
  }
}

@media (max-width: 720px) {
  .cm-app-shell {
    min-width: 0;
  }

  .cm-top {
    height: auto;
    min-height: 56px;
    padding: 10px 14px;
    align-items: flex-start;
    flex-direction: column;
    gap: 10px;
  }

  .cm-top__spacer {
    display: none;
  }

  .cm-top__act {
    width: 100%;
    justify-content: flex-start;
    flex-wrap: wrap;
  }

  .cm-pulse {
    position: static;
    padding: 10px 14px;
    gap: 8px 12px;
  }

  .cm-pulse__sep {
    display: none;
  }

  .cm-body {
    padding: 16px 14px 72px;
  }

  .cm-statebar__note {
    width: 100%;
    margin-left: 0;
  }

  .cm-inventory__row {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .cm-inventory__row .cm-pill {
    grid-column: 2;
    justify-self: start;
  }
}
