:root {
  --kzn-bg: #ecfaf2;
  --kzn-fg: #0f2c23;
  --kzn-accent: #047857;
  --kzn-accent-soft: #34d399;
  --kzn-muted: rgba(6, 78, 59, 0.72);
  --kzn-border: rgba(255, 255, 255, 0.64);
  --kzn-shadow: 0 26px 50px -30px rgba(4, 71, 50, 0.45);
}

body {
  background:
    radial-gradient(circle at 10% 15%, rgba(52, 211, 153, 0.28), transparent 42%),
    radial-gradient(circle at 85% 10%, rgba(16, 185, 129, 0.18), transparent 35%),
    linear-gradient(140deg, #ecfdf5 0%, #dcfce7 46%, #ccfbf1 100%);
  background-attachment: fixed;
  color: var(--kzn-fg);
  min-height: 100vh;
}

.app-shell {
  max-width: 76rem;
  margin: 0 auto;
  padding: 1.5rem;
}

.text-emerald { color: #064e3b !important; }

.glass-card {
  border: 1px solid var(--kzn-border);
  border-radius: 1.25rem;
  background: linear-gradient(155deg, rgba(255,255,255,.82), rgba(255,255,255,.62));
  box-shadow: var(--kzn-shadow);
  backdrop-filter: blur(16px);
  position: relative;
  overflow: hidden;
}

.solid-card {
  border: 1px solid rgba(255,255,255,.75);
  border-radius: .85rem;
  background: rgba(255,255,255,.92);
  box-shadow: 0 12px 28px -24px rgba(6,78,59,.55);
}

.app-title { font-size: clamp(1.5rem, 1.2rem + 1vw, 2.2rem); font-weight: 780; line-height: 1.05; }
.app-subtitle { color: var(--kzn-muted); font-size: .95rem; }

.kzn-eyebrow {
  display: inline-flex; align-items: center; border-radius: 999px;
  border: 1px solid rgba(16,185,129,.25); background: rgba(255,255,255,.65);
  color: var(--kzn-accent); font-size: .72rem; font-weight: 700;
  letter-spacing: .08em; padding: .3rem .65rem; text-transform: uppercase;
}

.kzn-headline-gradient {
  background: linear-gradient(135deg, #064e3b, #047857 50%, #10b981);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}

.kzn-metric {
  border-radius: .85rem; border: 1px solid rgba(255,255,255,.75);
  background: rgba(255,255,255,.78); padding: .75rem .85rem;
}
.kzn-metric-label { color: rgba(6,78,59,.66); font-size: .7rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; }
.kzn-metric-value { color: #064e3b; font-size: .92rem; font-weight: 700; margin: .15rem 0 0; }

.kzn-badge {
  display: inline-flex; border-radius: 999px; border: 1px solid rgba(16,185,129,.22);
  background: rgba(167,243,208,.55); color: #065f46; font-size: .75rem; font-weight: 700; padding: .25rem .6rem;
}

.kzn-card-hover { transition: transform .15s ease, box-shadow .2s ease; display: block; color: inherit; }
.kzn-card-hover:hover { transform: translateY(-3px); box-shadow: 0 20px 36px -28px rgba(6,95,70,.75); }

.btn-kzn-primary {
  background: linear-gradient(145deg, #059669, #047857 60%, #065f46);
  border: none; color: #fff; font-weight: 650; border-radius: .75rem;
  box-shadow: 0 12px 24px -16px rgba(4,120,87,.9);
}
.btn-kzn-primary:hover { background: linear-gradient(145deg, #10b981, #059669); color: #fff; }

.btn-kzn-secondary {
  border: 1px solid rgba(6,95,70,.35); background: rgba(255,255,255,.82); color: #064e3b; font-weight: 650; border-radius: .75rem;
}
.btn-kzn-secondary:hover { background: #fff; color: #064e3b; }

.form-control-kzn, .form-select.form-control-kzn {
  border: 1px solid rgba(167,243,208,.95); border-radius: .65rem;
  background: rgba(255,255,255,.9);
}
.form-control-kzn:focus { border-color: #10b981; box-shadow: 0 0 0 .2rem rgba(16,185,129,.25); }

.kzn-fade-in { animation: kznFadeIn .35s ease both; }
@keyframes kznFadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

.wizard-sticky { position: sticky; top: .75rem; z-index: 20; }
.wizard-tabs { display: grid; grid-template-columns: repeat(3, 1fr); gap: .25rem; }
@media (min-width: 576px) { .wizard-tabs { grid-template-columns: repeat(5, 1fr); } }
@media (min-width: 992px) { .wizard-tabs { grid-template-columns: repeat(9, 1fr); } }
.wizard-progress { height: .5rem; background: rgba(255,255,255,.7); }

.a3-lean-sheet {
  border: 1px solid rgba(6,78,59,.2); padding: .5rem; font-size: 9px; line-height: 1.35;
  background: #fff; color: #052e23;
}
.a3-kicker { font-size: 10px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: rgba(6,78,59,.8); }
.a3-title { font-size: 1rem; font-weight: 700; line-height: 1.2; color: #064e3b; }
.a3-section { border: 1px solid rgba(6,78,59,.25); border-radius: .25rem; background: #fff; padding: .35rem; }
.a3-section-title { font-size: 10px; font-weight: 700; border-bottom: 1px solid rgba(6,78,59,.2); padding-bottom: .15rem; margin-bottom: .35rem; color: #064e3b; }
.a3-box { border: 1px solid #a7f3d0; border-radius: .25rem; background: rgba(236,253,245,.6); padding: .35rem; font-size: 9px; }
.a3-cell, .a3-mini { border: 1px solid #a7f3d0; border-radius: .2rem; background: #ecfdf5; padding: .25rem; font-size: 9px; }
.a3-mini { display: inline-block; min-width: 4.5rem; }
.a3-role { font-size: 8px; font-style: italic; color: rgba(6,78,59,.65); margin: .2rem 0 0; }
.a3-hint { font-size: 8px; color: rgba(6,78,59,.55); margin: .15rem 0 0; }
.a3-table th, .a3-table td { border-color: #a7f3d0 !important; font-size: 8px; padding: .15rem .25rem !important; }
.a3-thumb { width: 100%; max-height: 110px; object-fit: contain; border: 1px solid #d1fae5; border-radius: .2rem; }
.a3-ishikawa-slot { min-height: 150px; max-height: 200px; overflow: hidden; }
.a3-ishikawa-slot svg { max-height: 190px; width: 100%; }
#pareto-a3 .pareto-chart-title { font-size: 9px; margin-bottom: .25rem !important; }
#pareto-a3 .pareto-chart-inner { padding: .25rem !important; }
.a3-header-title-wrap { min-width: 40%; }

.wizard-step-btn {
  border: 1px solid rgba(6,95,70,.25); background: rgba(255,255,255,.7);
  border-radius: 999px; padding: .35rem .75rem; font-size: .78rem; font-weight: 600; color: #065f46;
}
.wizard-step-btn.active { background: #047857; color: #fff; border-color: #047857; }
.wizard-step-btn.done { background: rgba(167,243,208,.5); }
.wizard-step-btn.last-completed {
  border-color: #34d399 !important;
  background: rgba(167,243,208,.65) !important;
  color: #064e3b !important;
  box-shadow: 0 0 0 1px rgba(52,211,153,.45);
}

.info-tooltip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 1.25rem;
  height: 1.25rem;
  margin-left: .35rem;
  border-radius: 999px;
  border: 1px solid rgba(6,95,70,.45);
  background: linear-gradient(145deg, #fff, rgba(167,243,208,.55));
  color: #064e3b;
  font-size: .72rem;
  font-weight: 800;
  cursor: help;
  vertical-align: middle;
}

.pareto-field-label {
  display: block;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: rgba(6,78,59,.75);
  margin-bottom: .25rem;
}

.results-gallery-img {
  height: 16rem;
  object-fit: cover;
}

.closure-awaiting-msg {
  min-height: 8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .95rem;
  color: #064e3b;
}

.brand-logo-link {
  display: inline-block;
  text-decoration: none;
  line-height: 0;
  border-radius: .5rem;
  transition: opacity .15s ease, transform .15s ease;
}
.brand-logo-link:hover { opacity: .88; }
.brand-logo-link:focus-visible {
  outline: 2px solid rgba(5, 150, 105, .55);
  outline-offset: 3px;
}

.field-label { font-size: .82rem; font-weight: 650; color: #064e3b; margin-bottom: .25rem; }
.field-hint { font-size: .75rem; color: var(--kzn-muted); }

.action-matrix-wrap { position: relative; min-height: 18rem; border: 1px solid rgba(6,78,59,.15); border-radius: .65rem; background: rgba(255,255,255,.85); }
.action-matrix-wrap .axis-v { position: absolute; left: 50%; top: 0; bottom: 0; border-left: 1px solid rgba(6,78,59,.2); }
.action-matrix-wrap .axis-h { position: absolute; top: 50%; left: 0; right: 0; border-top: 1px solid rgba(6,78,59,.2); }
.matrix-dot {
  position: absolute; transform: translate(-50%, -50%);
  width: 1.75rem; height: 1.75rem; border-radius: 999px;
  background: #047857; color: #fff; font-size: .72rem; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  border: none; padding: 0; cursor: pointer; z-index: 2;
}
.matrix-dot:hover { background: #065f46; }

.matrix-hover-tip {
  position: absolute; z-index: 5; left: .75rem; right: .75rem; top: .5rem;
  border: 1px solid rgba(6,78,59,.2); border-radius: .5rem;
  background: rgba(255,255,255,.95); padding: .5rem .65rem; font-size: .75rem;
  font-weight: 650; color: #064e3b;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.25);
  pointer-events: none;
}

.ishikawa-container { width: 100%; min-height: 280px; overflow: auto; }
.ishikawa-container svg { max-width: 100%; height: auto; }

.toast-kzn {
  position: fixed; bottom: 1.25rem; right: 1.25rem; z-index: 1080;
  background: #065f46; color: #fff; padding: .75rem 1rem; border-radius: .65rem;
  box-shadow: 0 12px 30px -12px rgba(0,0,0,.35);
}

@media print {
  @page { size: A4 portrait; margin: 8mm; }

  body { background: #fff !important; margin: 0 !important; }
  .no-print { display: none !important; }
  .glass-card, .solid-card {
    box-shadow: none !important;
    backdrop-filter: none !important;
    background: #fff !important;
    break-inside: avoid;
  }
  .glass-card::before { content: none !important; display: none !important; }
  .kzn-headline-gradient { background: none !important; color: #064e3b !important; -webkit-text-fill-color: #064e3b !important; }
  .kzn-fade-in { animation: none !important; }

  .print-full-only { display: block !important; visibility: visible !important; }
  .print-a3-only { display: none !important; visibility: hidden !important; }

  html[data-print-mode="full"] .print-a3-only { display: none !important; }
  html[data-print-mode="full"] .print-full-only { display: block !important; visibility: visible !important; }

  html:not([data-print-mode]) .print-a3-only { display: none !important; }
  html:not([data-print-mode]) .print-full-only { display: block !important; }

  html[data-print-mode="a3"] .print-full-only {
    display: none !important;
    visibility: hidden !important;
    height: 0 !important;
    overflow: hidden !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  html[data-print-mode="a3"] body {
    min-height: 0 !important;
    height: auto !important;
    background: #fff !important;
  }

  html[data-print-mode="a3"] .print-a3-only {
    display: block !important;
    visibility: visible !important;
    margin: 0 !important;
    padding: 0 !important;
    overflow: visible !important;
    page-break-before: avoid !important;
    page-break-after: auto !important;
    break-before: avoid-page !important;
    break-after: auto !important;
  }

  html[data-print-mode="a3"] .app-shell {
    max-width: none !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  html[data-print-mode="a3"] .print-a3-only > .a3-lean-sheet {
    min-height: 0 !important;
    height: auto !important;
    max-height: none !important;
    overflow: visible !important;
    page-break-inside: avoid !important;
    break-inside: avoid-page !important;
    zoom: 0.835 !important;
  }

  html[data-print-mode="a3"] .a3-header-title-wrap {
    text-align: center !important;
    margin: 0 auto;
  }

  html[data-print-mode="a3"] .a3-ishikawa-slot {
    min-height: 240px !important;
    max-height: 280px !important;
  }

  html[data-print-mode="a3"] .a3-ishikawa-slot svg {
    max-height: 270px !important;
  }

  html[data-print-mode="a3"] .a3-ishikawa-slot svg text {
    fill: #052e23 !important;
    stroke: #ffffff !important;
    stroke-width: 2.5px !important;
    paint-order: stroke !important;
  }

  html[data-print-mode="a3"] #pareto-a3 .pareto-chart-card {
    margin-top: .15rem !important;
  }

  html[data-print-mode="a3"] #pareto-a3 .pareto-chart-title {
    font-size: 8px !important;
    margin-bottom: .15rem !important;
  }

  html[data-print-mode="a3"] #pareto-a3 svg {
    min-height: 150px;
  }

  html[data-print-mode="a3"] #action-matrix-a3 .action-matrix-wrap {
    min-height: 9rem !important;
  }

  html[data-print-mode="a3"] #action-matrix-a3 .matrix-hover-tip,
  html[data-print-mode="a3"] #action-matrix-a3 .text-muted.mb-0 {
    display: none !important;
  }

  html[data-print-mode="a3"] .a3-thumb {
    max-height: 118px !important;
    object-fit: contain !important;
  }

  .print-a3-only,
  .print-a3-only * {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }

  .print-full-only,
  .print-full-only * {
    color: #052e23 !important;
    -webkit-text-fill-color: #052e23 !important;
  }
}

.print-a3-only { display: none; }

.a3-sheet {
  border: 1px solid #d1fae5; padding: .75rem; font-size: .72rem;
  background: #fff;
}

.report-table th, .report-table td { border: 1px solid #d1fae5 !important; vertical-align: top; }
.report-table tr.top80 { background: rgba(167,243,208,.55) !important; }
.report-table tr.top80 td { border-color: #6ee7b7 !important; font-weight: 600; color: #064e3b; }
.report-table tr.top80 td:first-child { border-left: 3px solid #047857 !important; }

.pareto-embed-table tr.top80 { background: rgba(167,243,208,.55) !important; }
.pareto-embed-table tr.top80 td { border-color: #6ee7b7 !important; font-weight: 600; color: #064e3b; }
.pareto-embed-table tr.top80 td:first-child { border-left: 3px solid #047857 !important; }
.pareto-legend-swatch { display: inline-block; width: .75rem; height: .75rem; border-radius: 2px; }
.pareto-legend-swatch.bg-emerald-700 { background: #047857; }
.pareto-legend-swatch.bg-emerald-300 { background: #6ee7b7; }
.pareto-legend-line { display: inline-block; width: 1.25rem; height: 2px; background: #0f766e; vertical-align: middle; }

.kzn-metric-lg { padding: 1.25rem 1.5rem !important; }
.kzn-metric-lg .kzn-metric-value { font-size: 1rem; }

.report-logo-card {
  border: 1px solid rgba(255,255,255,.75);
  border-radius: .85rem;
  background: rgba(255,255,255,.78);
  padding: 1.25rem 1.5rem;
}
.report-logo-divider { width: 1px; height: 2rem; background: rgba(6,78,59,.15); }
.report-cocari-top { object-fit: contain; }
.report-breadcrumb-link { color: #047857; text-decoration: none; }
.report-breadcrumb-link:hover { color: #065f46; text-decoration: underline; }

.home-hero .home-kaizen-logo { flex-shrink: 0; height: 72px; width: auto; }
.home-cocari-stack img { max-width: 180px; object-fit: contain; }

.kzn-page-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
}

.kzn-brand-cluster {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  width: 100%;
  gap: 1rem 1.5rem;
}

.kzn-brand-left {
  display: flex;
  align-items: flex-start;
  gap: 1rem;
}

.kzn-brand-kaizen-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .35rem;
}

.kzn-brand-kaizen-stack .home-kaizen-logo {
  height: 68px;
  width: auto;
}

.kzn-brand-kaizen-stack .home-kaizen-logo.compact-kaizen-logo {
  height: 56px;
}

.kzn-brand-cocari-right {
  margin-left: auto;
  display: flex;
  align-items: flex-start;
  justify-content: flex-end;
}

.kzn-brand-cocari-right img {
  height: 62px;
  width: auto;
  max-width: 260px;
  object-fit: contain;
}

.kzn-cocariup-logo {
  height: 44px;
  width: auto;
  max-width: 220px;
  object-fit: contain;
}

.btn-kzn-hero {
  padding: .55rem .95rem;
  font-size: .95rem;
}

.wizard-brand-strip {
  margin-bottom: 1rem;
}

@media (max-width: 991.98px) {
  .kzn-brand-cocari-right {
    width: 100%;
    margin-left: 0;
    justify-content: flex-start;
  }
}

.login-card { max-width: 28rem; margin-top: 2rem; }
.login-page .app-shell { max-width: 32rem; }

.app-topbar {
  border: 1px solid var(--kzn-border);
  border-radius: .85rem;
  background: rgba(255,255,255,.78);
  padding: .65rem 1rem;
  box-shadow: 0 10px 24px -20px rgba(6,78,59,.45);
}

.btn-download-asset { font-size: .78rem; }

.results-comparison-card {
  border: 1px solid rgba(6,78,59,.15);
  border-radius: .85rem;
  background: rgba(255,255,255,.92);
  padding: 1rem 1.25rem;
}
.results-comparison-card h4 { font-size: .95rem; font-weight: 700; color: #064e3b; margin: 0 0 .35rem; }
.results-comparison-card .variation { font-size: .82rem; font-weight: 650; color: #047857; }
.results-comparison-card .summary { font-size: .85rem; color: rgba(6,78,59,.85); margin: .25rem 0; }
.results-comparison-card .values { font-size: .78rem; color: rgba(6,78,59,.7); }

.pareto-chart-card {
  border: 1px solid rgba(6,78,59,.12);
  border-radius: .85rem;
  background: #fff;
  padding: .75rem;
  box-shadow: 0 8px 24px -18px rgba(6,78,59,.35);
}

.action-matrix-quadrant-label {
  position: absolute; font-size: .68rem; font-weight: 650; color: rgba(6,78,59,.55);
  max-width: 42%; line-height: 1.2;
}
.action-matrix-tooltip {
  position: absolute; z-index: 5; max-width: 14rem;
  border: 1px solid rgba(6,78,59,.2); border-radius: .5rem;
  background: #fff; padding: .5rem .65rem; font-size: .75rem;
  box-shadow: 0 10px 24px -14px rgba(0,0,0,.25);
  pointer-events: none;
}
.action-matrix-footer { font-size: .78rem; color: rgba(6,78,59,.7); margin-top: .5rem; }
.action-matrix-badge {
  display: inline-flex; border-radius: 999px; background: rgba(167,243,208,.45);
  color: #065f46; font-size: .72rem; font-weight: 700; padding: .2rem .55rem;
}

.report-image-block img { width: 100%; max-height: 28rem; object-fit: contain; }
