:root {
  --ctr-navy: #0f2c3c;
  --ctr-navy-2: #164258;
  --ctr-navy-3: #1d536c;
  --ctr-teal: #1f8a7a;
  --ctr-teal-2: #2aa392;
  --ctr-amber: #c99214;
  --ctr-bg: #eef2f4;
  --ctr-card: #ffffff;
  --ctr-text: #1c2a32;
  --ctr-muted: #5c6f7a;
  --ctr-border: #d5dee3;
  --ctr-danger: #b42318;
  --ctr-sidebar: 260px;
}

html, body { height: 100%; }
body.ctr-app {
  background: var(--ctr-bg);
  color: var(--ctr-text);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}

.ctr-shell { display: block; min-height: 100vh; }
.ctr-sidebar {
  width: min(85vw, 360px);
  background: linear-gradient(180deg, var(--ctr-navy) 0%, #0b2230 100%);
  color: #e8eef1;
  position: fixed;
  z-index: 1040;
  top: 0;
  bottom: 0;
  left: 0;
  display: flex;
  flex-direction: column;
  transform: translateX(-100%);
  transition: transform 250ms ease;
}
.ctr-sidebar.is-open { transform: translateX(0); }
.ctr-nav-scrim {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8, 18, 24, .45);
  z-index: 1030;
}
.ctr-nav-scrim.is-open { display: block; }
.ctr-nav-close {
  margin-left: auto;
  border: 0;
  background: transparent;
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}
.ctr-brand {
  padding: 0.9rem 1rem 0.85rem;
  border-bottom: 1px solid rgba(255,255,255,.08);
  display: flex;
  align-items: center;
  gap: .5rem;
}
.ctr-brand .ctr-logo {
  height: 28px;
  width: auto;
  max-width: 148px;
  display: block;
  border-radius: 3px;
}
.ctr-logo-sm {
  height: 28px;
  width: auto;
  display: block;
  border-radius: 3px;
}
.ctr-brand .mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background: var(--ctr-teal);
  color: #fff;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  letter-spacing: .02em;
}
.ctr-brand small { color: #9bb0bb; }
.navbar-brand .ctr-logo {
  height: 32px;
  width: auto;
  display: block;
  border-radius: 3px;
}
.auth-logo {
  height: 52px;
  width: auto;
  max-width: 280px;
  display: inline-block;
  border-radius: 6px;
}
.ctr-nav a {
  color: #c9d6dc;
  text-decoration: none;
  display: flex;
  align-items: center;
  gap: .55rem;
  padding: .5rem .9rem;
  margin: 0 .45rem;
  border-radius: .4rem;
  font-size: .92rem;
}
.ctr-nav a:hover, .ctr-nav a.active,
.ctr-nav-foot a:hover, .ctr-nav-foot a.active {
  background: rgba(255,255,255,.08);
  color: #fff;
}
.ctr-nav {
  flex: 1;
  overflow-x: hidden;
  overflow-y: auto;
  padding: .65rem 0;
}
.ctr-split {
  display: flex;
  align-items: stretch;
  margin: 1px .45rem;
}
.ctr-split a {
  margin: 0;
  flex: 1;
  border-radius: .4rem 0 0 .4rem;
}
.ctr-chevron {
  width: 38px;
  border: 0;
  border-left: 1px solid rgba(255,255,255,.14);
  background: transparent;
  color: #c9d6dc;
  cursor: pointer;
  border-radius: 0 .4rem .4rem 0;
}
.ctr-chevron:hover { background: rgba(255,255,255,.08); color: #fff; }
.ctr-chevron svg { display: block; margin: 0 auto; transition: transform 250ms ease; }
.ctr-chevron[aria-expanded="true"] svg { transform: rotate(180deg); }
.ctr-nav a.ctr-child {
  font-size: .82rem;
  padding: .4rem .9rem .4rem 1.55rem;
}
.ctr-nav a:focus-visible, .ctr-chevron:focus-visible, .ctr-nav-close:focus-visible, .ctr-menu-toggle:focus-visible {
  outline: 2px solid #7dcec3;
  outline-offset: 2px;
}
.ctr-nav-foot {
  border-top: 1px solid rgba(255,255,255,.08);
  padding: .45rem .45rem .8rem;
}
.ctr-nav-foot a {
  color: #9bb0bb;
  text-decoration: none;
  display: flex;
  padding: .4rem .7rem;
  margin: 0 .15rem;
  border-radius: .4rem;
  font-size: .82rem;
}
.ctr-nav-user { color: #d5e0e6 !important; font-weight: 650; }
.ctr-nav-role {
  color: #9bb0bb;
  font-size: .75rem;
  padding: 0 .85rem .35rem;
}
.ctr-nav-signout {
  margin: .35rem .7rem 0;
  background: transparent;
  color: #d5e0e6;
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 6px;
  padding: .3rem .65rem;
  font-size: .82rem;
  cursor: pointer;
}
.ctr-customer-nav .nav-link { white-space: nowrap; }
.ctr-customer-nav .ctr-customer-user {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 10rem;
}
@media (min-width: 1400px) {
  .ctr-customer-nav .navbar-nav { flex-wrap: nowrap; }
}
@media (max-width: 1399.98px) {
  .ctr-customer-nav .navbar-collapse .navbar-nav {
    flex-direction: column;
    align-items: flex-start;
  }
}
.ctr-main { min-width: 0; max-width: 100%; overflow-x: auto; }
.ctr-topbar {
  background: var(--ctr-card);
  border-bottom: 1px solid var(--ctr-border);
}
.ctr-menu-toggle {
  border: 1px solid var(--ctr-border);
  background: #fff;
  border-radius: .4rem;
  padding: .28rem .48rem;
  line-height: 1;
}
.ctr-menu-toggle .navbar-toggler-icon {
  width: 1.35em;
  height: 1.35em;
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 30 30'%3e%3cpath stroke='%230f2c3c' stroke-linecap='round' stroke-miterlimit='10' stroke-width='2' d='M4 7h22M4 15h22M4 23h22'/%3e%3c/svg%3e");
}
@media (min-width: 1024px) {
  .ctr-shell {
    display: grid;
    grid-template-columns: var(--ctr-sidebar) minmax(0, 1fr);
    align-items: start;
  }
  .ctr-sidebar,
  .ctr-sidebar.is-open {
    position: sticky;
    top: 0;
    left: auto;
    bottom: auto;
    transform: none;
    width: var(--ctr-sidebar);
    min-width: var(--ctr-sidebar);
    max-width: var(--ctr-sidebar);
    height: 100vh;
    z-index: auto;
  }
  .ctr-nav-scrim,
  .ctr-menu-toggle,
  .ctr-phone-brand,
  .ctr-nav-close { display: none !important; }
}
.ctr-card {
  background: var(--ctr-card);
  border: 1px solid var(--ctr-border);
  border-radius: .6rem;
  box-shadow: 0 1px 2px rgba(15,44,60,.04);
}
.kpi { padding: 1rem 1.1rem; }
.kpi .label { color: var(--ctr-muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .04em; }
.kpi .value { font-size: 1.6rem; font-weight: 700; color: var(--ctr-navy); }
.badge-status { font-weight: 600; }
.badge-draft, .badge-pending { background: #e8eef2; color: #35515f; }
.badge-active, .badge-ready, .badge-issued, .badge-accepted, .badge-complete, .badge-pass { background: #d9f2ec; color: #0f5f52; }
.badge-review, .badge-quoted, .badge-scheduled { background: #e7eefc; color: #274690; }
.badge-hold, .badge-attention, .badge-prospect { background: #fdf0d5; color: #8a5a00; }
.badge-failed, .badge-declined, .badge-cancelled, .badge-error, .badge-inactive { background: #fde8e6; color: #8a1f18; }
.auth-wrap {
  min-height: 100vh;
  background: radial-gradient(1200px 500px at 10% -10%, #1f8a7a33, transparent),
              linear-gradient(160deg, #0f2c3c 0%, #12384b 55%, #0b2230 100%);
}
.auth-card { max-width: 460px; }
.table thead th { font-size: .78rem; letter-spacing: .04em; text-transform: uppercase; color: var(--ctr-muted); }
.form-label { font-weight: 600; color: #31464f; }
.btn-ctr { background: var(--ctr-teal); border-color: var(--ctr-teal); color: #fff; }
.btn-ctr:hover { background: #18786a; border-color: #18786a; color: #fff; }
.btn-navy { background: var(--ctr-navy); border-color: var(--ctr-navy); color: #fff; }
.btn-navy:hover { background: #0b2230; color: #fff; }
.phase-pill { background: #e8f6f3; color: #0f5f52; font-weight: 600; }
.ctr-row-link {
  color: var(--ctr-navy);
  font-weight: 600;
  text-decoration: none;
}
.ctr-row-link:hover {
  color: var(--ctr-teal);
  text-decoration: underline;
}
.text-navy { color: var(--ctr-navy); }
.training-card {
  transition: box-shadow .15s ease, border-color .15s ease;
}
.training-card:hover {
  border-color: var(--ctr-teal);
  box-shadow: 0 6px 18px rgba(15,44,60,.08);
}
.training-thumb {
  width: 100%;
  height: 92px;
  object-fit: cover;
  border-radius: .4rem;
  margin-bottom: .75rem;
  background: var(--ctr-navy);
}
.training-slide { display: none; }
.training-slide.is-on { display: block; }
.training-hero {
  width: 100%;
  max-height: 360px;
  object-fit: cover;
  display: block;
  background: var(--ctr-navy);
}
.training-dots {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
  justify-content: center;
}
.training-dot {
  width: 10px;
  height: 10px;
  border: 0;
  padding: 0;
  border-radius: 50%;
  background: var(--ctr-border);
}
.training-dot.is-on { background: var(--ctr-teal); }
.ctr-coach-spot {
  position: fixed;
  pointer-events: none;
  z-index: 1075;
  border-radius: 8px;
  box-shadow: 0 0 0 9999px rgba(15, 44, 60, 0.5);
  outline: 2px solid var(--ctr-teal);
}
.ctr-coach {
  position: fixed;
  z-index: 1085;
  right: 16px;
  bottom: 16px;
  width: min(380px, calc(100vw - 24px));
  background: #fff;
  border: 1px solid var(--ctr-border);
  border-radius: .6rem;
  box-shadow: 0 12px 40px rgba(15, 44, 60, .2);
  padding: 1rem 1.1rem;
  max-height: min(70vh, 520px);
  overflow: auto;
}
.ctr-coach p { color: var(--ctr-text); }

/* Estimate upload + 3D preview */
.ctr-dropzone {
  border: 2px dashed var(--ctr-border);
  border-radius: .65rem;
  background: #f7fafb;
  padding: 1.5rem 1.25rem;
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background .15s ease, box-shadow .15s ease;
  color: var(--ctr-navy);
}
.ctr-dropzone:hover,
.ctr-dropzone:focus {
  border-color: var(--ctr-teal);
  background: #f0f8f6;
  outline: none;
}
.ctr-dropzone.is-dragover {
  border-color: var(--ctr-teal);
  background: #e6f4f1;
  box-shadow: inset 0 0 0 1px var(--ctr-teal);
}
.ctr-dropzone.has-file {
  border-style: solid;
  border-color: #b8c9d1;
}
.ctr-dropzone-icon {
  color: var(--ctr-teal);
  margin-bottom: .5rem;
}
.ctr-model-preview {
  border: 1px solid var(--ctr-border);
  border-radius: .65rem;
  background: #fff;
  overflow: hidden;
}
.ctr-model-preview-viewport {
  width: 100%;
  aspect-ratio: 16 / 10;
  max-height: 360px;
  min-height: 200px;
  background: #eef2f4;
}
.ctr-model-preview-viewport canvas {
  width: 100% !important;
  height: 100% !important;
}
@media (max-width: 576px) {
  .ctr-model-preview-viewport {
    max-height: 260px;
    min-height: 180px;
  }
}
