/* Copyright (c) 2026 Numerique Innovations Pvt. Ltd. All rights reserved. */
:root {
  --navy: #173867;
  --navy-deep: #0e2446;
  --blue: #2b5fc7;
  --bg: #edf1f7;
  --card: #ffffff;
  --line: #dbe4f0;
  --text: #1f2f45;
  --muted: #73839b;
  --header-row: #1b3b73;
  --row-alt: #f5f8fd;
  --green: #1faa55;
  --amber: #d89b1e;
  --red: #e03a3a;
  --orange: #d98a4b;
  --purple: #5e73d8;
  --teal: #0ea5a0;
  --shadow: 0 1px 3px rgba(20, 33, 90, 0.08), 0 6px 18px rgba(20, 33, 90, 0.05);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  font-family: "Poppins", "Segoe UI", Arial, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 13px;
}

.app {
  display: flex;
  height: 100vh;
  overflow: hidden;
  animation: page-enter .6s cubic-bezier(.2,.75,.2,1) both;
}

@keyframes page-enter {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes rise-in {
  from { opacity: 0; transform: translateY(18px) scale(.985); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chart-rise {
  from { opacity: 0; transform: translateY(14px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chart-draw {
  from { stroke-dashoffset: 180; }
  to { stroke-dashoffset: 0; }
}

@keyframes soft-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(23, 56, 103, 0.1); }
  50% { box-shadow: 0 0 0 6px rgba(23, 56, 103, 0); }
}

/* ===================== SIDEBAR ===================== */
.sidebar {
  width: 236px;
  background: #fff;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 22px 16px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
  transition: width .65s cubic-bezier(.22,1,.36,1), padding .65s cubic-bezier(.22,1,.36,1);
}

.brand {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 8px 22px;
  overflow: hidden;
}
.brand-img {
  height: 62px;
  width: auto;
  max-width: 100%;
  object-fit: contain;
  display: block;
  flex-shrink: 0;
  border-radius: 9px;
  box-shadow: 0 8px 20px rgba(14, 36, 70, 0.12);
  transition: transform .72s cubic-bezier(.22,1,.36,1), filter .35s ease, opacity .35s ease;
}
.brand-img.footer-img {
  height: 38px;
  width: auto;
  max-width: 100%;
  opacity: 0.8;
  margin: 0 auto;
  box-shadow: none;
}

.nav { display: flex; flex-direction: column; gap: 4px; flex: 1; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 14px;
  border-radius: 10px;
  color: #5b647a;
  text-decoration: none;
  font-weight: 500;
  font-size: 13px;
  transition: background .2s, color .2s, transform .2s;
}
.nav-item .ic {
  width: 16px;
  height: 16px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: #90a0ba;
  stroke-width: 2.1;
}
.nav-item:hover {
  background: #f0f5ff;
  color: var(--navy);
  transform: translateX(2px);
}
.nav-item.active {
  background: #e9f1ff;
  color: var(--blue);
  font-weight: 600;
  box-shadow: inset 3px 0 0 var(--blue);
}
.nav-item.active .ic { color: var(--blue); }

.sidebar-footer { text-align: center; padding-top: 20px; display: flex; flex-direction: column; align-items: center; gap: 6px; }
.sidebar-footer .brand-logo { opacity: .35; }
.footer-tag { color: #b6bdcd; font-size: 9.5px; letter-spacing: 1px; margin-top: 6px; font-weight: 600; }
.footer-copy {
  color: #8b95aa;
  font-size: 9.5px;
  line-height: 1.35;
  margin-top: 2px;
  font-weight: 600;
}

.sidebar .brand {
  position: relative;
  cursor: pointer;
  user-select: none;
  outline: none;
}
.sidebar .brand:focus-visible .brand-img {
  box-shadow: 0 0 0 3px rgba(43, 95, 199, 0.18), 0 8px 20px rgba(14, 36, 70, 0.12);
}

.app.sidebar-collapsed .sidebar {
  width: 72px;
  padding-left: 6px;
  padding-right: 6px;
}
.app.sidebar-collapsed .brand {
  padding-left: 0;
  padding-right: 0;
}
.app.sidebar-collapsed .brand-img {
  height: 42px;
}
.app.sidebar-collapsed .nav {
  align-items: center;
}
.app.sidebar-collapsed .nav-item {
  justify-content: center;
  gap: 0;
  padding: 9px 0;
  font-size: 0;
  width: 100%;
}
.app.sidebar-collapsed .nav-item .ic {
  margin: 0;
}
.app.sidebar-collapsed .nav-item:hover {
  transform: scale(1.03);
}
.app.sidebar-collapsed .nav-badge {
  display: none;
}
.app.sidebar-collapsed .sidebar-footer {
  display: none;
}
.app.sidebar-animating .sidebar > .brand .brand-img:not(.footer-img) {
  animation: sidebar-logo-spin .72s cubic-bezier(.22,1,.36,1);
}

@keyframes sidebar-logo-spin {
  0% { transform: rotate(0deg) scale(1); }
  60% { transform: rotate(180deg) scale(.92); }
  100% { transform: rotate(360deg) scale(1); }
}

/* ===================== MAIN ===================== */
.main { flex: 1; padding: 0 26px 40px; min-width: 0; overflow-y: auto; height: 100vh; }

/* Sticky heading + KPI band */
.sticky-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg);
  padding: 22px 0 20px;
  box-shadow: 0 4px 16px rgba(20, 33, 90, 0.07);
  animation: rise-in .52s cubic-bezier(.2,.75,.2,1) both;
}
.sticky-header .kpi-row { margin-bottom: 0; }

.topbar { display: flex; justify-content: space-between; align-items: flex-start; margin-bottom: 18px; }
.topbar .title-block,
.topbar .topbar-right {
  animation: rise-in .5s cubic-bezier(.2,.75,.2,1) both;
}
.title-block h1 { color: var(--navy); font-size: 24px; font-weight: 800; letter-spacing: .3px; }
.subtitle { display: flex; gap: 18px; align-items: center; margin-top: 6px; font-size: 12.5px; }
.chip-date b { color: var(--navy); }
.chip-shift { color: var(--teal); font-weight: 600; }

.icon-inline {
  width: 14px;
  height: 14px;
  margin-right: 5px;
  vertical-align: -2px;
  stroke-width: 2.1;
  color: var(--blue);
}

.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 12.5px; color: #6b748c; }
.topbar-right .login { color: var(--navy); font-weight: 500; }
.topbar-right .divider { color: #d3d8e8; }
.topbar-right .updated b { color: var(--navy); }
.plan-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5f6f8d;
  font-weight: 600;
}
.lang-select-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: #5f6f8d;
  font-weight: 600;
}
.plan-select {
  border: 1px solid #cfdaf0;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  min-width: 156px;
}
.lang-select {
  border: 1px solid #cfdaf0;
  border-radius: 8px;
  background: #fff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 600;
  padding: 6px 10px;
  min-width: 118px;
}
.plan-select:focus {
  outline: none;
  border-color: #7aa1e4;
  box-shadow: 0 0 0 3px rgba(43, 95, 199, 0.12);
}
.lang-select:focus {
  outline: none;
  border-color: #7aa1e4;
  box-shadow: 0 0 0 3px rgba(43, 95, 199, 0.12);
}
.andon-btn {
  border: 1px solid #ffd0d0;
  background: #fff3f3;
  color: #b42222;
  padding: 7px 10px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}
.andon-btn:hover {
  background: #ffe8e8;
}
.refresh-btn {
  border: 1px solid var(--line);
  background: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  color: var(--blue);
  transition: background .2s, transform .2s;
}
.refresh-btn:hover { background: #e7efff; transform: rotate(-12deg); }

/* ===================== CHAT ASSISTANT ===================== */
.nq-chat-root {
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 1200;
}

.nq-chat-launcher {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  background: linear-gradient(135deg, #173867, #2b5fc7 55%, #0ea5a0);
  color: #fff;
  padding: 12px 18px;
  box-shadow: 0 18px 40px rgba(14, 36, 70, 0.26);
  cursor: pointer;
  font: inherit;
  font-weight: 700;
  letter-spacing: 0.2px;
}

.nq-chat-launcher-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.18);
  font-size: 12px;
}

.nq-chat-panel {
  position: absolute;
  right: 0;
  bottom: 70px;
  width: min(420px, calc(100vw - 28px));
  height: min(620px, calc(100vh - 110px));
  display: flex;
  flex-direction: column;
  border: 1px solid rgba(22, 50, 92, 0.12);
  border-radius: 24px;
  background:
    radial-gradient(circle at top right, rgba(43, 95, 199, 0.12), transparent 34%),
    linear-gradient(180deg, rgba(243, 247, 255, 0.98), rgba(255, 255, 255, 0.98));
  box-shadow: 0 26px 80px rgba(14, 36, 70, 0.24);
  overflow: hidden;
}

.nq-chat-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid rgba(22, 50, 92, 0.08);
}

.nq-chat-eyebrow {
  color: #2b5fc7;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
}

.nq-chat-header h3 {
  color: var(--navy);
  font-size: 17px;
  font-weight: 700;
  margin-top: 4px;
}

.nq-chat-close {
  border: 0;
  background: #edf3ff;
  color: #58709b;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
}

.nq-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 16px 10px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.nq-chat-message {
  display: flex;
  flex-direction: column;
  gap: 7px;
}

.nq-chat-user {
  align-items: flex-end;
}

.nq-chat-role {
  color: #6581ad;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.nq-chat-bubble {
  max-width: 92%;
  padding: 12px 14px;
  border-radius: 18px;
  background: #fff;
  color: #27405f;
  font-size: 13px;
  line-height: 1.55;
  box-shadow: 0 10px 28px rgba(18, 44, 85, 0.08);
  white-space: pre-wrap;
}

.nq-chat-user .nq-chat-bubble {
  background: linear-gradient(135deg, #173867, #2b5fc7);
  color: #fff;
}

.nq-chat-sources,
.nq-chat-suggestions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.nq-chat-source,
.nq-chat-suggestion {
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}

.nq-chat-source {
  padding: 6px 10px;
  background: #eef4ff;
  color: #436796;
}

.nq-chat-suggestion {
  border: 1px solid #d4e0f5;
  background: #fff;
  color: #27405f;
  padding: 8px 12px;
  cursor: pointer;
  transition: border-color .2s, transform .2s, box-shadow .2s;
}

.nq-chat-suggestion:hover {
  border-color: #8fb1e8;
  transform: translateY(-1px);
  box-shadow: 0 8px 18px rgba(43, 95, 199, 0.12);
}

.nq-chat-composer {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px 16px 16px;
  border-top: 1px solid rgba(22, 50, 92, 0.08);
  background: rgba(247, 250, 255, 0.92);
}

.nq-chat-input {
  resize: none;
  min-height: 48px;
  max-height: 140px;
  border: 1px solid #d3def0;
  border-radius: 14px;
  padding: 12px 14px;
  font: inherit;
  color: var(--text);
  background: #fff;
}

.nq-chat-input:focus {
  outline: none;
  border-color: #7aa1e4;
  box-shadow: 0 0 0 3px rgba(43, 95, 199, 0.12);
}

.nq-chat-send {
  align-self: end;
  min-width: 84px;
  min-height: 48px;
  border: 0;
  border-radius: 14px;
  background: var(--navy);
  color: #fff;
  font: inherit;
  font-weight: 700;
  cursor: pointer;
}

.nq-chat-root.is-loading .nq-chat-send,
.nq-chat-root.is-loading .nq-chat-input {
  opacity: 0.75;
}

.nq-chat-thinking .nq-chat-bubble {
  color: #5c759e;
}

table tbody tr.nq-chat-selected-row {
  outline: 2px solid rgba(43, 95, 199, 0.6);
  outline-offset: -2px;
  box-shadow: inset 0 0 0 999px rgba(43, 95, 199, 0.06);
}

@media (max-width: 720px) {
  .nq-chat-root {
    right: 14px;
    bottom: 14px;
  }

  .nq-chat-launcher {
    padding: 11px 15px;
  }

  .nq-chat-panel {
    right: -4px;
    bottom: 64px;
    width: calc(100vw - 20px);
    height: min(72vh, 560px);
  }

  .nq-chat-composer {
    grid-template-columns: 1fr;
  }

  .nq-chat-send {
    width: 100%;
  }
}

.chip-status {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 10px;
  border-radius: 999px;
  border: 1px solid var(--line);
  background: #f6f9ff;
  color: var(--navy);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}
.chip-status .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}
.chip-status .dot,
.blink-state {
  animation: status-blink 1.15s ease-in-out infinite;
}
@keyframes status-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.25; }
}
.chip-status.connected {
  background: #f2edff;
  border-color: #e2d9ff;
  color: #5a3fc0;
}
.chip-status.connected .dot { background: var(--purple); }
.chip-status.running {
  background: #fff5e9;
  border-color: #ffd8a6;
  color: #b15e00;
}
.chip-status.running .dot { background: var(--orange); }

/* ===================== KPI CARDS ===================== */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}
body.hourly-page .kpi-row {
  grid-template-columns: repeat(6, 1fr);
}
.kpi-card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px 12px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 8px;
  min-height: 104px;
  justify-content: center;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: rise-in .55s cubic-bezier(.2,.75,.2,1) both;
}
.kpi-card.kpi-clickable {
  cursor: pointer;
}
.kpi-row .kpi-card:nth-child(1) { animation-delay: .03s; }
.kpi-row .kpi-card:nth-child(2) { animation-delay: .06s; }
.kpi-row .kpi-card:nth-child(3) { animation-delay: .09s; }
.kpi-row .kpi-card:nth-child(4) { animation-delay: .12s; }
.kpi-row .kpi-card:nth-child(5) { animation-delay: .15s; }
.kpi-row .kpi-card:nth-child(6) { animation-delay: .18s; }
.kpi-row .kpi-card:nth-child(7) { animation-delay: .21s; }
.kpi-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 24px rgba(23, 56, 103, 0.13);
}
.kpi-icon { font-size: 18px; }
.kpi-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.kpi-icon .lucide {
  width: 18px;
  height: 18px;
  stroke-width: 2.2;
  color: #6d7ea0;
}
.kpi-label { font-size: 9.5px; font-weight: 700; letter-spacing: .6px; color: #6b748c; text-transform: uppercase; }
.kpi-label small { display:block; font-weight: 500; color: #aab2c6; letter-spacing: .3px; }
.kpi-value { font-size: 17px; font-weight: 800; color: var(--navy); }
.kpi-value.green { color: var(--green); }
.kpi-value.purple { color: var(--purple); }
.kpi-value.orange { color: var(--orange); }
.kpi-value.red   { color: var(--red); }
.kpi-value.amber { color: var(--amber); }
.kpi-value.blue  { color: var(--blue); }
.kpi-card .underline { width: 38px; height: 3px; border-radius: 3px; background: var(--green); }
.kpi-sub { font-size: 10px; color: var(--red); font-weight: 600; }

/* ===================== CARD + TABLES ===================== */
.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 12px;
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease;
  animation: rise-in .56s cubic-bezier(.2,.75,.2,1) both;
}
.card:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(23, 56, 103, 0.12);
}
.card-head { padding: 14px 18px 10px; }
.card-head h2 { font-size: 13px; color: var(--navy); font-weight: 700; letter-spacing: .5px; }
.card-head .muted { color: var(--muted); font-weight: 500; font-size: 11px; }

.table-wrap { padding: 0 14px 14px; overflow-x: auto; }
.data-table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 12px; }
.data-table thead th {
  background: var(--header-row);
  color: #fff;
  font-weight: 600;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
}
.data-table thead th:first-child { border-radius: 8px 0 0 8px; text-align: left; }
.data-table thead th:last-child { border-radius: 0 8px 8px 0; }
.data-table tbody td {
  padding: 9px 12px;
  text-align: center;
  border-bottom: 1px solid var(--line);
  color: #41506b;
  transition: background-color .2s ease, color .2s ease;
}
.data-table tbody td:first-child { text-align: left; font-weight: 500; color: var(--text); }
.data-table tbody tr:nth-child(odd) { background: #ffffff; }
.data-table tbody tr:nth-child(even) { background: #f3f7ff; }
.data-table tbody tr.row-pending { background: #fdeeee; }
.data-table tbody tr.row-critical { background: #fee9e9; }
.data-table tbody tr.row-warning { background: #fff4e8; }
.data-table tbody tr.row-good { background: #edf9f1; }
.data-table tbody tr.row-ongoing { background: #fff6df; }
.data-table tbody tr.row-dim td { color: #aeb6c8; }
.data-table tbody tr:not(.row-dim) {
  transition: background .22s ease, transform .14s ease;
}
.data-table tbody tr:not(.row-dim):hover {
  background: #e7f0ff;
  transform: translateX(1px);
}

.data-table tbody tr {
  animation: rise-in .36s ease both;
}
.data-table tbody tr:nth-child(1) { animation-delay: .02s; }
.data-table tbody tr:nth-child(2) { animation-delay: .04s; }
.data-table tbody tr:nth-child(3) { animation-delay: .06s; }
.data-table tbody tr:nth-child(4) { animation-delay: .08s; }
.data-table tbody tr:nth-child(5) { animation-delay: .1s; }
.data-table tbody tr:nth-child(n+6) { animation-delay: .12s; }

.data-table tfoot td {
  padding: 11px 12px;
  text-align: center;
  font-weight: 700;
  color: var(--navy);
  background: #eef1fb;
  border-top: 2px solid #dfe4f5;
}
.data-table tfoot td:first-child { text-align: left; }

.pos {
  color: #0e7f3f;
  background: #eaf9f0;
  border: 1px solid #cfeedd;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
}
.neg {
  color: #b42222;
  background: #fdecec;
  border: 1px solid #f4cccc;
  border-radius: 999px;
  padding: 1px 7px;
  font-weight: 700;
}

/* status dots / labels */
.dot { display: inline-block; width: 11px; height: 11px; border-radius: 50%; }
.dot.green { background: var(--green); }
.dot.amber { background: var(--amber); }
.dot.red { background: var(--red); }
.status-pill { display: inline-flex; align-items: center; gap: 6px; font-weight: 600; font-size: 11.5px; }
.status-pill .lucide {
  width: 13px;
  height: 13px;
  stroke-width: 2.2;
}
.status-pill.inprogress { color: var(--amber); }
.status-pill.upcoming { color: #b6bdcd; }
.status-pill.logged { color: var(--green); }
.status-pill.pending { color: var(--red); }
.status-pill.planned { color: var(--blue); }

/* stoppage activity cell tags */
.planned-tag { font-weight: 600; color: var(--blue); }
.downtime-tag {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .3px;
  text-transform: uppercase;
  color: var(--red);
  background: #fdeaea;
  border-radius: 4px;
  padding: 1px 6px;
  margin-right: 6px;
  vertical-align: 1px;
}
.sub-line { font-size: 11px; color: var(--muted); margin-top: 2px; }

.status-voice-cell {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.voice-btn {
  border: 1px solid #c9d2ef;
  background: #fff;
  color: var(--blue);
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
  padding: 0;
  transition: background 0.2s ease, transform 0.1s ease;
}
.voice-btn .voice-icon {
  width: 18px;
  height: 18px;
  fill: currentColor;
}
.voice-btn:hover {
  background: #eef2ff;
  transform: translateY(-1px);
}
.voice-btn.voice-noted {
  border-color: var(--green);
  color: var(--green);
}
.voice-btn.voice-pending {
  border-color: var(--red);
  color: var(--red);
  animation: pulse-red 1.6s ease-in-out infinite;
}
@keyframes pulse-red {
  0%, 100% { box-shadow: 0 0 0 0 rgba(224,58,58,.35); }
  50%       { box-shadow: 0 0 0 5px rgba(224,58,58,0); }
}

/* product colour swatch */
.swatch { display: inline-block; width: 13px; height: 13px; border-radius: 3px; margin-right: 9px; vertical-align: -2px; }

/* ===================== STOPPAGE FOOTER ===================== */
.stoppage-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #fdf1f1;
  border-top: 1px solid var(--line);
  padding: 12px 18px;
}
.stoppage-footer .warn { color: var(--red); font-weight: 600; font-size: 12px; }
.stoppage-footer .warn .lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
  stroke-width: 2.2;
}
.warn-link {
  border: 0;
  padding: 0;
  background: transparent;
  color: var(--red);
  font-weight: 700;
  font-size: 12px;
  cursor: pointer;
}
.warn-link .lucide {
  width: 13px;
  height: 13px;
  vertical-align: -2px;
  margin-right: 4px;
  stroke-width: 2.2;
}
.warn-link:hover {
  text-decoration: underline;
}
.ghost-btn {
  border: 1px solid #c9d2ef;
  background: #fff;
  color: var(--blue);
  padding: 8px 14px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  transition: background .2s ease, transform .2s ease;
}
.ghost-btn:hover { background: #e8f1ff; transform: translateY(-1px); }

.quality-input-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  padding: 0 14px 14px;
}
.quality-mini-card {
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  background: #f8fbff;
  padding: 10px 12px;
}
.quality-mini-head {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #5f7190;
  font-size: 10.5px;
  font-weight: 700;
}
.quality-mini-value {
  margin-top: 6px;
  color: var(--navy);
  font-size: 18px;
  font-weight: 800;
}

.andon-modal {
  position: fixed;
  inset: 0;
  z-index: 1300;
  background: rgba(14, 24, 46, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}
.andon-modal.hidden {
  display: none;
}
.andon-panel {
  width: min(520px, 96vw);
  border-radius: 14px;
  border: 1px solid #dbe4f0;
  background: #ffffff;
  box-shadow: 0 18px 50px rgba(14, 36, 70, 0.24);
  padding: 16px;
}
.andon-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.andon-head h3 {
  color: var(--navy);
  font-size: 17px;
  font-weight: 800;
}
.andon-sub {
  margin-top: 10px;
  color: #5f6f8d;
  font-size: 12px;
  font-weight: 600;
}
.andon-field-label {
  margin-top: 10px;
  display: block;
  color: #5f6f8d;
  font-size: 11px;
  font-weight: 700;
}
.andon-input {
  margin-top: 6px;
  width: 100%;
  border: 1px solid #d2dcf0;
  border-radius: 8px;
  background: #fff;
  color: #36517a;
  font-size: 12px;
  font-weight: 600;
  padding: 8px 10px;
}
.andon-options {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.andon-options button {
  border: 1px solid #d2dcf0;
  background: #f8fbff;
  border-radius: 10px;
  padding: 12px;
  color: #36517a;
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  justify-content: center;
}
.andon-options button:hover {
  background: #edf4ff;
  border-color: #a9c1ef;
}
.andon-ack {
  margin-top: 12px;
  min-height: 20px;
  color: #0e7f3f;
  font-size: 12px;
  font-weight: 700;
}

/* Shared chart animation language across pages */
.qd-chart,
.pa-chart,
.ct-pareto {
  animation: chart-rise .7s cubic-bezier(.2,.75,.2,1) both;
}

.qd-chart-line,
.pa-capacity-line,
.pa-capacity-band {
  stroke-dasharray: 180;
  animation: chart-draw .9s ease-out both;
}

.qd-chart-dot,
.pa-demand-bar,
.ct-pareto rect,
.ct-pareto circle,
.ct-pareto path {
  animation: rise-in .5s ease both;
}

.kpi-value.red,
.kpi-value.amber {
  animation: soft-pulse 1.9s ease-in-out infinite;
}

.dash { color: #b6bdcd; }

@media (max-width: 1200px) {
  .kpi-row { grid-template-columns: repeat(4, 1fr); }
  .quality-input-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 820px) {
  .sidebar { display: none; }
  .kpi-row { grid-template-columns: repeat(2, 1fr); }
  .topbar-right { flex-wrap: wrap; justify-content: flex-end; }
  .lang-select-wrap { width: 100%; justify-content: flex-end; }
  .plan-select-wrap { width: 100%; justify-content: flex-end; }
  .andon-options { grid-template-columns: 1fr; }
  .quality-input-grid { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .app,
  .kpi-card,
  .card,
  .nav-item,
  .refresh-btn,
  .ghost-btn {
    animation: none !important;
    transition: none !important;
    transform: none !important;
  }
}

/* =====================================================================
   LOGIN PAGE
   ===================================================================== */
body.login-page {
  background: var(--navy-deep);
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.login-bg {
  position: relative;
  width: 100%;
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #0f1a5c 0%, #1b2a86 50%, #162660 100%);
}

/* subtle dot-grid overlay */
.login-grid {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.07) 1px, transparent 1px);
  background-size: 30px 30px;
  pointer-events: none;
}

.login-wrap {
  position: relative;
  z-index: 1;
  display: flex;
  border-radius: 20px;
  overflow: hidden;
  box-shadow: 0 24px 80px rgba(10, 18, 60, 0.55);
  max-width: 900px;
  width: 94%;
}

/* ---- Form card ---- */
.login-card {
  background: #fff;
  padding: 48px 44px;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.login-brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 2px;
  margin-bottom: 28px;
}

.login-brand-img {
  height: 72px;
  width: auto;
  object-fit: contain;
}

.login-tagline {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 1.2px;
  color: #b6bdcd;
  margin-top: 2px;
}

.login-title {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin-bottom: 6px;
}

.login-sub {
  font-size: 12.5px;
  color: var(--muted);
  margin-bottom: 28px;
}

/* Error box */
.login-error {
  background: #fdf1f1;
  border: 1px solid #f8c8c8;
  color: var(--red);
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 12.5px;
  font-weight: 500;
  margin-bottom: 18px;
}

.login-error.shake {
  animation: shake .35s ease;
}

@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20%       { transform: translateX(-6px); }
  40%       { transform: translateX(6px); }
  60%       { transform: translateX(-4px); }
  80%       { transform: translateX(4px); }
}

/* Form fields */
.login-form { display: flex; flex-direction: column; gap: 18px; }

.field-group { display: flex; flex-direction: column; gap: 6px; }

.field-group label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text);
  letter-spacing: .3px;
}

.input-wrap {
  position: relative;
  display: flex;
  align-items: center;
}

.input-icon {
  position: absolute;
  left: 12px;
  font-size: 14px;
  pointer-events: none;
  color: #aab2c6;
}

.input-wrap input {
  width: 100%;
  padding: 11px 40px 11px 38px;
  border: 1.5px solid var(--line);
  border-radius: 10px;
  font-family: inherit;
  font-size: 13px;
  color: var(--text);
  background: #fafbff;
  transition: border-color .15s, box-shadow .15s;
  outline: none;
}

.input-wrap input:focus {
  border-color: var(--navy);
  box-shadow: 0 0 0 3px rgba(27, 42, 134, .1);
  background: #fff;
}

.input-wrap input::placeholder { color: #c4cad8; }

.toggle-pw {
  position: absolute;
  right: 10px;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  padding: 4px;
  color: #aab2c6;
  transition: color .15s;
}
.toggle-pw:hover { color: var(--navy); }

/* Submit button */
.login-btn {
  margin-top: 6px;
  padding: 13px;
  background: var(--navy);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-family: inherit;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  letter-spacing: .4px;
  transition: background .15s, transform .1s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 46px;
}
.login-btn:hover:not(:disabled) { background: var(--blue); }
.login-btn:active:not(:disabled) { transform: scale(.99); }
.login-btn:disabled { opacity: .65; cursor: not-allowed; }

/* Spinner */
.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255,255,255,.35);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.login-footer-note {
  margin-top: 28px;
  font-size: 11px;
  color: #c4cad8;
  text-align: center;
}

/* ---- Right panel ---- */
.login-panel {
  width: 300px;
  background: linear-gradient(160deg, #f06a2a 0%, #e05018 100%);
  padding: 48px 36px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  color: #fff;
}

.panel-inner { display: flex; flex-direction: column; gap: 18px; }

.panel-icon { font-size: 48px; }

.login-panel h3 {
  font-size: 18px;
  font-weight: 800;
  line-height: 1.35;
}

.panel-features {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 10px;
  font-size: 12.5px;
  font-weight: 500;
  opacity: .9;
}

.panel-footer {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: .8px;
  opacity: .6;
  text-transform: uppercase;
}

/* ---- User chip in dashboard topbar ---- */
.user-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  background: #eef1fb;
  border: 1px solid var(--line);
  padding: 5px 12px 5px 8px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--navy);
}
.user-chip .avatar {
  width: 24px; height: 24px;
  background: var(--navy);
  color: #fff;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 11px;
  font-weight: 700;
}

.logout-btn {
  border: 1px solid #f8c8c8;
  background: #fff5f5;
  color: var(--red);
  padding: 6px 12px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  font-size: 12px;
  font-family: inherit;
  transition: background .15s;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.logout-btn:hover { background: #fdeaea; }

.btn-ic {
  width: 14px;
  height: 14px;
  stroke-width: 2.2;
}

/* Responsive: hide panel on small screens */
@media (max-width: 720px) {
  .login-panel { display: none; }
  .login-card   { padding: 36px 28px; }
}

/* ===================== VOICE AGENT MODAL ===================== */
.va-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 22, 54, 0.55);
  backdrop-filter: blur(2px);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 20px;
}
.va-overlay.open { display: flex; }

.va-modal {
  width: min(540px, 100%);
  max-height: 90vh;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(16, 22, 54, 0.35);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: va-pop 0.18s ease;
}
@keyframes va-pop {
  from { transform: translateY(12px) scale(0.98); opacity: 0; }
  to   { transform: none; opacity: 1; }
}

.va-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  background: linear-gradient(135deg, var(--navy), var(--blue));
  color: #fff;
}
.va-title { display: flex; align-items: center; gap: 12px; }
.va-title h3 { font-size: 15px; font-weight: 700; }
.va-title p  { font-size: 12px; opacity: 0.8; margin-top: 2px; }
.va-close {
  background: rgba(255,255,255,0.15);
  border: none;
  color: #fff;
  width: 30px; height: 30px;
  border-radius: 8px;
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.va-close:hover { background: rgba(255,255,255,0.28); }

.va-mic-badge {
  width: 40px; height: 40px;
  border-radius: 50%;
  background: rgba(255,255,255,0.18);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  flex-shrink: 0;
}

/* who is speaking — AI orb vs operator */
.va-speakers {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 36px;
  padding: 32px 24px 24px;
  border-bottom: 1px solid var(--line);
  background:
    radial-gradient(ellipse 120% 80% at 30% 40%, rgba(123, 79, 240, 0.08) 0%, transparent 55%),
    radial-gradient(ellipse 100% 70% at 75% 60%, rgba(14, 165, 160, 0.07) 0%, transparent 50%),
    linear-gradient(180deg, #f8f9ff 0%, #fff 100%);
  position: relative;
}
.va-speaker-divider {
  width: 1px;
  height: 72px;
  background: linear-gradient(180deg, transparent, #d8dff5 20%, #d8dff5 80%, transparent);
  opacity: 0.8;
}
.va-speaker {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
  opacity: 0.32;
  transition: opacity 0.35s ease, transform 0.35s ease;
  position: relative;
}
.va-speaker-icon {
  width: 88px;
  height: 88px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  z-index: 1;
}
.va-speaker-icon svg {
  width: 88px;
  height: 88px;
  display: block;
}
.va-speaker-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 1.2px;
  text-transform: uppercase;
  color: var(--muted);
}
/* ---- AI assistant orb ---- */
.va-speaker-ai .va-speaker-icon {
  background: radial-gradient(circle at 35% 30%, #eef2ff 0%, #e8ecff 45%, #f3f0ff 100%);
  box-shadow:
    0 8px 28px rgba(99, 102, 241, 0.12),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.va-speaker-ai .va-speaker-label { color: #6366f1; }
.va-orbit {
  position: absolute;
  top: 50%;
  left: 50%;
  border-radius: 50%;
  border: 1px solid transparent;
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -50%);
  transition: opacity 0.3s ease;
}
.va-orbit-1 {
  width: 104px;
  height: 104px;
  border-color: rgba(99, 102, 241, 0.25);
}
.va-orbit-2 {
  width: 118px;
  height: 118px;
  border-color: rgba(34, 211, 238, 0.18);
}
.va-speaker-ai.speaking .va-orbit-1 {
  opacity: 1;
  animation: va-orbit-spin 4s linear infinite;
}
.va-speaker-ai.speaking .va-orbit-2 {
  opacity: 1;
  animation: va-orbit-spin 6s linear infinite reverse;
}
@keyframes va-orbit-spin {
  from { transform: translate(-50%, -50%) rotate(0deg); }
  to   { transform: translate(-50%, -50%) rotate(360deg); }
}
.va-speaker-ai.speaking .va-ai-orbit {
  animation: va-orbit-dash 2s linear infinite;
}
@keyframes va-orbit-dash {
  to { stroke-dashoffset: -20; }
}
/* ---- Operator ---- */
.va-speaker-human .va-speaker-icon {
  background: radial-gradient(circle at 40% 35%, #f0fdf4 0%, #ecfdf5 100%);
  box-shadow:
    0 8px 24px rgba(16, 185, 129, 0.1),
    inset 0 1px 0 rgba(255, 255, 255, 0.9);
}
.va-speaker-human .va-speaker-label { color: #059669; }
.va-speaker-human.speaking .va-human-wave { opacity: 1 !important; animation: va-wave-pulse 0.8s ease-in-out infinite; }
@keyframes va-wave-pulse {
  0%, 100% { opacity: 0.4; transform: translateX(0); }
  50%       { opacity: 1; transform: translateX(1px); }
}
/* ---- Active / speaking states ---- */
.va-speaker.speaking {
  opacity: 1;
  transform: scale(1.02);
}
.va-speaker-ai.speaking .va-speaker-icon {
  animation: va-ai-pulse 1.2s ease-in-out infinite;
  box-shadow:
    0 0 0 0 rgba(99, 102, 241, 0.35),
    0 12px 36px rgba(99, 102, 241, 0.25),
    0 0 48px rgba(34, 211, 238, 0.15);
}
@keyframes va-ai-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow:
      0 0 0 0 rgba(99, 102, 241, 0.4),
      0 12px 36px rgba(99, 102, 241, 0.2),
      0 0 40px rgba(34, 211, 238, 0.12);
  }
  50% {
    transform: scale(1.06);
    box-shadow:
      0 0 0 14px rgba(99, 102, 241, 0),
      0 16px 44px rgba(99, 102, 241, 0.3),
      0 0 56px rgba(34, 211, 238, 0.22);
  }
}
.va-speaker-human.speaking .va-speaker-icon {
  animation: va-human-pulse 1s ease-in-out infinite;
  box-shadow:
    0 0 0 0 rgba(16, 185, 129, 0.35),
    0 12px 32px rgba(16, 185, 129, 0.2);
}
@keyframes va-human-pulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.4), 0 10px 28px rgba(16, 185, 129, 0.15);
  }
  50% {
    transform: scale(1.05);
    box-shadow: 0 0 0 12px rgba(16, 185, 129, 0), 0 14px 36px rgba(16, 185, 129, 0.25);
  }
}

.va-status {
  padding: 9px 18px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  background: #f7f9fe;
  border-bottom: 1px solid var(--line);
}
.va-status.speaking  { color: var(--green); }
.va-status.listening { color: var(--orange); }
.va-status.processing { color: var(--blue); }
.va-status.processing::after {
  content: "";
  display: inline-block;
  width: 18px;
  margin-left: 4px;
  text-align: left;
  animation: va-thinking-dots 1.2s steps(4, end) infinite;
}
.va-status.warn      { color: var(--red); }
.va-status.ok        { color: var(--green); }
@keyframes va-thinking-dots {
  0%   { content: ""; }
  25%  { content: "."; }
  50%  { content: ".."; }
  75%, 100% { content: "..."; }
}

.va-slots {
  display: grid;
  gap: 8px;
  padding: 10px 18px;
  border-top: 1px solid var(--line);
  background: #fbfcff;
}
.va-slot {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 7px 8px;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}
.va-slot.active {
  background: #eef4ff;
  border-color: rgba(46, 91, 255, 0.28);
  box-shadow: 0 6px 16px rgba(46, 91, 255, 0.08);
}
.va-slot-ic {
  width: 16px;
  height: 16px;
  line-height: 1;
  color: #7a8aa7;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.va-slot.active .va-slot-ic { color: var(--blue); }
.va-slot.filled .va-slot-ic { color: var(--green); }
.va-slot-svg {
  width: 16px;
  height: 16px;
  display: block;
}
.va-slot-label { font-size: 11px; font-weight: 700; color: var(--muted); letter-spacing: .2px; }
.va-slot-value { font-size: 13px; color: var(--text); }
.va-slot.active .va-slot-label { color: var(--blue); }
.va-slot.empty .va-slot-value { color: var(--muted); }

.va-input-row {
  display: flex;
  gap: 8px;
  padding: 12px 18px 6px;
}
.va-input-row input {
  flex: 1;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 9px 12px;
  font-size: 13px;
  font-family: inherit;
}
.va-input-row input:focus { outline: none; border-color: var(--blue); }
.va-send {
  border: none;
  background: var(--blue);
  color: #fff;
  border-radius: 10px;
  padding: 0 16px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
}
.va-send:hover { background: var(--navy); }

.va-foot {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 6px 18px 16px;
}
.va-listen {
  border: 1px solid #c9d2ef;
  background: #fff;
  color: var(--blue);
  border-radius: 10px;
  padding: 9px 16px;
  font-weight: 600;
  font-size: 13px;
  font-family: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
}
.va-listen:hover { background: #eef2ff; }
.va-hint { font-size: 11px; color: var(--muted); }
