/* ==========================================================================
   Component: live-console — "DATPRO ENTERPRISE, đang chạy" (Homepage, 2026-10-09)

   A code-built replica of the real DATPRO CMS dashboard (cms.datpro.vn:
   Tổng quan → KPI, PASS/NG trend, 7 quality groups, "Cần chú ý hôm nay").
   Rebuilt in HTML/SVG instead of a screenshot on purpose:
     - the live system's data is either empty or belongs to real customers,
       so every number/name here is neutral demo data (labelled as such);
     - a browser-pane capture is ~800px wide and blurs on retina;
     - it can actually move — numbers count up, the chart draws itself and
       keeps ticking, new events slide into the feed (assets/js/live-console.js).

   Light theme on purpose (client review, same day): the first dark-navy
   version read as "tối, không sáng bóng" and didn't look like the real app,
   which is a white workspace with a deep-blue sidebar. So: bright aurora
   background, white glass frame, the app's own light content area.

   Layout/modules mirror the real product only — never add a module here
   that cms.datpro.vn does not have. The sidebar carries a compact "DATPRO CMS" label,
   not the full logo (the site header already shows it right above). Every selector is .lc- prefixed.
   ========================================================================== */

.lc {
  /* app colours sampled from the live cms.datpro.vn (client: "lấy màu gốc") */
  --lc-bg: #eef4fb;
  --lc-card: #ffffff;
  --lc-line: #d9e2ea;
  --lc-side: #0e4770;
  --lc-side-on: #0b3a5d;
  --lc-text: #0f2140;
  --lc-muted: #6b7c99;
  --lc-blue: #2563eb;
  --lc-violet: #7c3aed;
  --lc-green: #10b981;
  --lc-amber: #f59e0b;
  --lc-red: #ef4444;
  --lc-cyan: #06b6d4;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  padding-block: var(--hv-py, 6rem);
  background:
    radial-gradient(60% 50% at 12% 18%, rgba(147, 197, 253, 0.55), transparent 70%),
    radial-gradient(50% 45% at 88% 30%, rgba(196, 181, 253, 0.5), transparent 70%),
    radial-gradient(55% 50% at 60% 100%, rgba(165, 243, 252, 0.55), transparent 70%),
    linear-gradient(180deg, #f7faff 0%, #eef4ff 100%);
}

/* faint grid that fades out toward the edges */
.lc::before {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background-image: linear-gradient(rgba(37, 99, 235, 0.06) 1px, transparent 1px),
    linear-gradient(90deg, rgba(37, 99, 235, 0.06) 1px, transparent 1px);
  background-size: 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
  mask-image: radial-gradient(ellipse at 50% 40%, #000 20%, transparent 70%);
}

/* ---------- Browser frame ------------------------------------------------- */

.lc-frame {
  position: relative;
  margin-top: clamp(2rem, 4vw, 3.25rem);
  border-radius: 22px;
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.9);
  -webkit-backdrop-filter: blur(16px);
  backdrop-filter: blur(16px);
  box-shadow:
    0 50px 100px -40px rgba(37, 99, 235, 0.45),
    0 20px 40px -20px rgba(15, 33, 64, 0.18),
    inset 0 1px 0 #fff;
  padding: 10px;
}

/* the soft colour ring that slowly turns behind the frame */
.lc-frame::before {
  content: "";
  position: absolute;
  inset: 6%;
  z-index: -1;
  border-radius: 40px;
  background: conic-gradient(from var(--lc-a, 0deg), #60a5fa, #a78bfa, #22d3ee, #34d399, #60a5fa);
  filter: blur(60px);
  opacity: 0.55;
  animation: lc-spin 14s linear infinite;
}

@property --lc-a { syntax: "<angle>"; initial-value: 0deg; inherits: false; }
@keyframes lc-spin { to { --lc-a: 360deg; } }

.lc-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 6px 10px;
}

.lc-dots { display: flex; gap: 6px; }
.lc-dots i { width: 10px; height: 10px; border-radius: 50%; background: #ff5f57; }
.lc-dots i:nth-child(2) { background: #febc2e; }
.lc-dots i:nth-child(3) { background: #28c840; }

.lc-url {
  flex: 1;
  max-width: 360px;
  margin-inline: auto;
  padding: 5px 12px;
  border-radius: 8px;
  background: rgba(15, 33, 64, 0.05);
  color: var(--lc-muted);
  font-size: 12px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lc-demo {
  font-size: 11px;
  font-weight: 600;
  color: var(--lc-muted);
  background: #fff;
  border: 1px solid var(--lc-line);
  border-radius: 999px;
  padding: 3px 10px;
  white-space: nowrap;
}

/* ---------- App shell ----------------------------------------------------- */

.lc-app {
  display: grid;
  grid-template-columns: 188px 1fr;
  min-height: 560px;
  border-radius: 14px;
  overflow: hidden;
  background: var(--lc-bg);
  color: var(--lc-text);
  font-size: 13px;
  box-shadow: 0 0 0 1px rgba(15, 33, 64, 0.06);
}

/* sidebar: the real app's own flat deep blue, no gradient */
.lc-side {
  position: relative;
  background: var(--lc-side);
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.lc-nav {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  color: rgba(255, 255, 255, 0.72);
}

.lc-nav svg { width: 16px; height: 16px; flex: none; }
.lc-nav.is-on {
  background: var(--lc-side-on);
  color: #fff;
  font-weight: 600;
}

/* compact app label, not the full DATPRO logo: the site header right above
   already shows that logo — two big logos stacked looked duplicated
   (client review 2026-10-09). */
.lc-brand {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 2px 8px 16px;
  color: #fff;
  font-weight: 800;
  font-size: 14px;
  letter-spacing: 0.02em;
}
.lc-brand small { font-weight: 500; opacity: 0.7; margin-left: 2px; }
.lc-brand__mark {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: #fff;
  color: var(--lc-side);
  font-size: 13px;
}
.lc-nav em { margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700; background: #f43f5e; color: #fff; border-radius: 999px; padding: 0 7px; }

.lc-main { padding: 18px 20px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }

.lc-top { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.lc-top h3 { margin: 0; font-size: 18px; font-weight: 800; color: var(--lc-text); }
.lc-top span { color: var(--lc-muted); font-size: 12px; }

.lc-live {
  margin-left: auto;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #059669;
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
  border-radius: 999px;
  padding: 3px 10px;
}

.lc-live i {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--lc-green);
  box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.6);
  animation: lc-ping 1.8s ease-out infinite;
}

@keyframes lc-ping { to { box-shadow: 0 0 0 9px rgba(16, 185, 129, 0); } }

/* ---------- Cards --------------------------------------------------------- */

.lc-card {
  background: var(--lc-card);
  border: 1px solid var(--lc-line);
  border-radius: 14px;
  padding: 14px;
  min-width: 0;
  box-shadow: 0 1px 2px rgba(15, 33, 64, 0.04), 0 8px 24px -16px rgba(15, 33, 64, 0.18);
}

.lc-card__h { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.lc-card__h b { font-size: 13px; color: var(--lc-text); }
.lc-card__h small { color: var(--lc-muted); font-size: 11px; }

.lc-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }

/* KPI cards: white with a glossy wash of their own colour */
.lc-kpi {
  position: relative;
  overflow: hidden;
  background:
    radial-gradient(120% 90% at 100% 0%, color-mix(in srgb, var(--c) 16%, transparent), transparent 60%),
    #fff;
}
.lc-kpi small { display: block; color: var(--lc-muted); font-size: 12px; }
.lc-kpi strong { display: block; margin-top: 4px; font-size: 26px; font-weight: 800; color: var(--lc-text); font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.lc-kpi span { font-size: 11px; font-weight: 600; }
.lc-kpi .up { color: #059669; }
.lc-kpi .down { color: #dc2626; }
.lc-kpi::after {
  content: "";
  position: absolute;
  left: 14px;
  right: 14px;
  bottom: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--c, var(--lc-blue));
}

.lc-kpi.is-bump strong { animation: lc-bump 600ms ease; }
@keyframes lc-bump { 40% { color: var(--c, var(--lc-blue)); transform: translateY(-2px); } }

.lc-grid { display: grid; grid-template-columns: 1.65fr 1fr; gap: 12px; }

/* ---------- Trend chart --------------------------------------------------- */
/* Bars, fills and the line are moved frame by frame by live-console.js
   ("Motion"), so they carry no CSS transitions: a transition would lag
   behind every frame and turn the soft wave into a stutter. */

.lc-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.lc-chart .lc-axis { stroke: var(--lc-line); stroke-width: 1; }
.lc-chart .lc-bar-r { fill: url(#lc-bar-g); transform-box: fill-box; transform-origin: 50% 100%; }
.lc-chart .lc-line { fill: none; stroke: url(#lc-line-g); stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(0 4px 6px rgba(124, 58, 237, 0.3)); }
.lc-chart .lc-area { fill: url(#lc-area-g); }
.lc-chart .lc-dot { fill: #fff; stroke: var(--lc-violet); stroke-width: 3; filter: drop-shadow(0 0 6px rgba(124, 58, 237, 0.5)); }
.lc-chart text { fill: var(--lc-muted); font-size: 10px; font-family: inherit; }

.lc-legend { display: flex; gap: 14px; font-size: 11px; color: var(--lc-muted); }
.lc-legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 5px; vertical-align: -1px; }

/* every time the view is shown: line draws itself, area fades in */
.lc-app:not(.is-drawn) .lc-line { stroke-dasharray: 2000; stroke-dashoffset: 2000; }
.lc-app.is-drawn .lc-line { stroke-dasharray: 2000; stroke-dashoffset: 0; transition: stroke-dashoffset 1800ms cubic-bezier(.3,.7,.2,1); }
.lc-app:not(.is-drawn) .lc-area { opacity: 0; }
.lc-app.is-drawn .lc-area { opacity: 1; transition: opacity 900ms 600ms; }

/* ---------- Donut --------------------------------------------------------- */

.lc-donut { display: flex; align-items: center; gap: 14px; }
.lc-donut svg { width: 128px; height: 128px; flex: none; transform: rotate(-90deg); }
.lc-donut circle { fill: none; stroke-width: 14; }
.lc-donut .seg { stroke-dasharray: 0 999; transition: stroke-dasharray 1200ms cubic-bezier(.3,.7,.2,1); }
.lc-donut ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 7px; font-size: 12px; min-width: 0; }
.lc-donut li { display: flex; align-items: center; gap: 7px; color: var(--lc-text); }
.lc-donut li i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.lc-donut li b { margin-left: auto; color: var(--lc-muted); font-weight: 600; padding-left: 8px; }
.lc-donut__c { position: relative; }
.lc-donut__c strong { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; font-size: 20px; font-weight: 800; line-height: 1.1; color: var(--lc-text); }
.lc-donut__c strong small { display: block; font-size: 10px; font-weight: 500; color: var(--lc-muted); }

/* ---------- Quality groups ------------------------------------------------ */

.lc-groups { display: grid; gap: 9px; }
.lc-group { display: grid; grid-template-columns: 44px 1fr 46px; align-items: center; gap: 10px; font-size: 12px; }
.lc-group b { font-size: 11px; font-weight: 800; text-align: center; border-radius: 6px; padding: 3px 0; background: color-mix(in srgb, var(--c) 14%, #fff); color: color-mix(in srgb, var(--c) 75%, #0f2140); }
.lc-group span { height: 8px; border-radius: 99px; background: #eef2f8; overflow: hidden; }
.lc-group span i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--c) 45%, #fff), var(--c)); }
.lc-group em { font-style: normal; color: var(--lc-muted); text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; }

/* ---------- Live feed ----------------------------------------------------- */

.lc-feed { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; overflow: hidden; }
.lc-feed li {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: #f8faff;
  border: 1px solid var(--lc-line);
  font-size: 12px;
}
.lc-feed li.is-new { animation: lc-in 700ms cubic-bezier(.2,.8,.2,1); }
@keyframes lc-in { from { opacity: 0; transform: translateY(-12px) scale(.98); background: #e0ecff; } }
.lc-feed .tag { font-size: 10px; font-weight: 800; padding: 2px 7px; border-radius: 6px; color: color-mix(in srgb, var(--c) 75%, #0f2140); background: color-mix(in srgb, var(--c) 15%, #fff); }
.lc-feed .txt { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--lc-text); }
.lc-feed time { color: var(--lc-muted); font-size: 11px; }

/* ---------- Software tabs -------------------------------------------------- */

.lc-tabs {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: clamp(1.75rem, 3vw, 2.5rem);
}

.lc-tab {
  display: grid;
  gap: 2px;
  text-align: left;
  min-height: 44px;
  padding: 10px 18px;
  border-radius: 14px;
  border: 1px solid rgba(15, 33, 64, 0.08);
  background: rgba(255, 255, 255, 0.7);
  color: var(--lc-text);
  font: inherit;
  cursor: pointer;
  box-shadow: 0 6px 18px -12px rgba(15, 33, 64, 0.35);
  transition: background-color 200ms, box-shadow 200ms, transform 200ms;
}
.lc-tab b { font-size: 14px; }
.lc-tab small { font-size: 12px; color: var(--lc-muted); }
.lc-tab:hover { transform: translateY(-1px); background: #fff; }
.lc-tab.is-on { background: #fff; border-color: rgba(37, 99, 235, 0.35); box-shadow: 0 12px 28px -14px rgba(37, 99, 235, 0.55), inset 0 -3px 0 #2563eb; }
.lc-tab:focus-visible { outline: 3px solid rgba(37, 99, 235, 0.45); outline-offset: 2px; }

.lc-tabs + .lc-frame { margin-top: 18px; }
.lc-app[hidden] { display: none; }
.lc-app:not([hidden]) { animation: lc-swap 450ms cubic-bezier(.2,.8,.2,1); }
@keyframes lc-swap { from { opacity: 0; transform: translateY(8px); } }

/* per-system colours, sampled from each live app */
.lc-app[data-view="factory"] { --lc-side: #0b3e6b; --lc-side-on: #146fe8; --lc-bg: #f3f7fc; --lc-head: #0b5fa8; }
.lc-app[data-view="project"] { --lc-side: #0c3b64; --lc-side-on: #0b5a97; --lc-bg: #eef4fb; }

.lc-col { display: grid; gap: 12px; align-content: start; min-width: 0; }

/* ---------- Shared bits for the factory/project views --------------------- */

.lc-st { display: inline-block; font-size: 11px; font-weight: 700; padding: 2px 8px; border-radius: 999px; color: #047857; background: #d1fae5; white-space: nowrap; }
.lc-st--low { color: #b91c1c; background: #fee2e2; }
.lc-st--wait { color: #92400e; background: #fef3c7; }

.lc-prog { display: block; height: 8px; border-radius: 99px; background: #e8eef6; overflow: hidden; }
.lc-prog i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, color-mix(in srgb, var(--c, #146fe8) 55%, #fff), var(--c, #146fe8)); }

/* stock table (factory) */
.lc-card--flush { padding: 0; overflow: hidden; }
.lc-table { width: 100%; border-collapse: collapse; font-size: 12px; }
.lc-table th { background: var(--lc-head, #0b5fa8); color: #fff; font-weight: 600; text-align: left; padding: 9px 10px; white-space: nowrap; }
.lc-table td { padding: 8px 10px; border-top: 1px solid var(--lc-line); white-space: nowrap; font-variant-numeric: tabular-nums; }
.lc-table td small { display: block; color: var(--lc-muted); font-size: 11px; }
.lc-table .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11px; color: var(--lc-muted); }
.lc-table tbody tr:nth-child(even) td { background: #f8fbff; }
.lc-table tr.is-in td { animation: lc-flash-in 1400ms ease; }
.lc-table tr.is-out td { animation: lc-flash-out 1400ms ease; }
@keyframes lc-flash-in { 15% { background: #dcfce7; } }
@keyframes lc-flash-out { 15% { background: #dbeafe; } }
.lc-stock span { display: block; width: 84px; height: 7px; border-radius: 99px; background: #e8eef6; overflow: hidden; }
.lc-stock i { display: block; height: 100%; width: 0; border-radius: inherit; background: linear-gradient(90deg, #60a5fa, #146fe8); }

.lc-lines { display: grid; gap: 12px; }
.lc-line-row > div { display: flex; justify-content: space-between; font-size: 12px; margin-bottom: 6px; }
.lc-line-row em { font-style: normal; font-weight: 700; color: var(--lc-text); font-variant-numeric: tabular-nums; }

/* projects (project) */
.lc-projects { display: grid; gap: 12px; }
.lc-proj > div { display: flex; align-items: center; gap: 8px; font-size: 12px; margin-bottom: 6px; }
.lc-proj > div span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-proj em { margin-left: auto; font-style: normal; font-weight: 700; font-variant-numeric: tabular-nums; }
.lc-chip { flex: none; font-size: 10px; font-weight: 700; padding: 1px 7px; border-radius: 6px; color: var(--c); background: color-mix(in srgb, var(--c) 14%, #fff); }

.lc-cash { display: flex; align-items: flex-end; gap: 10px; height: 150px; padding-top: 10px; }
.lc-cash__col { flex: 1; display: grid; grid-template-rows: 1fr auto; height: 100%; gap: 6px; text-align: center; }
.lc-cash__col small { color: var(--lc-muted); font-size: 10px; }
.lc-cash__bars { display: flex; align-items: flex-end; justify-content: center; gap: 3px; }
.lc-cash__bars i { width: 38%; height: 0; border-radius: 4px 4px 1px 1px; }
.lc-cash__bars .in { background: linear-gradient(180deg, #3b82f6, #0b5a97); }
.lc-cash__bars .out { background: linear-gradient(180deg, #fcd34d, #f59e0b); }
.lc-cash + * { margin: 0; }
.lc-card .lc-legend { margin: -4px 0 0; }

.lc-approvals { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.lc-approvals li { display: flex; align-items: center; gap: 10px; padding: 9px 10px; border-radius: 10px; background: #f8faff; border: 1px solid var(--lc-line); font-size: 12px; }
.lc-approvals .txt { min-width: 0; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lc-approvals small { display: block; color: var(--lc-muted); font-size: 11px; }
.lc-approvals li.is-done { animation: lc-done 1200ms ease; }
@keyframes lc-done { 20% { background: #dcfce7; border-color: #86efac; } }

/* ---------- Responsive ---------------------------------------------------- */

@media (max-width: 1023px) {
  .lc-app { grid-template-columns: 1fr; }
  .lc-card--flush { overflow-x: auto; }
  .lc-side { display: none; }
  .lc-grid { grid-template-columns: 1fr; }
}

@media (max-width: 640px) {
  .lc-frame { padding: 6px; border-radius: 16px; }
  .lc-url, .lc-demo { display: none; }
  .lc-main { padding: 12px; }
  .lc-kpis { grid-template-columns: repeat(2, 1fr); gap: 8px; }
  .lc-kpi strong { font-size: 22px; }
  .lc-donut svg { width: 104px; height: 104px; }
  .lc-feed .txt { white-space: normal; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; line-height: 1.4; }
  .lc-tabs { flex-wrap: nowrap; gap: 6px; }
  .lc-tab { flex: 1 1 0; padding: 8px 6px; text-align: center; }
  .lc-tab b { font-size: 12px; line-height: 1.3; }
  .lc-tab small { display: none; }
  .lc-proj > div { flex-wrap: wrap; }
  /* the SVG chart is drawn at 600 units and shrinks ~0.5× here: 10-unit
     labels became ~5px, unreadable — scale them back up in SVG units */
  .lc-chart text { font-size: 19px; }
  /* phone portrait: the stacked console was ~2 screens tall. Keep the
     moving parts (KPIs, trend chart, live feed / progress, cash flow) and
     drop the static secondary cards. */
  .lc-app[data-view="cms"] .lc-grid > .lc-card:nth-child(2),
  .lc-app[data-view="cms"] .lc-grid > .lc-card:nth-child(3),
  .lc-app[data-view="project"] .lc-grid > .lc-card:nth-child(3) { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lc-frame::before, .lc-live i { animation: none; }
  .lc .lc-line { stroke-dasharray: none !important; transition: none !important; }
  .lc .lc-area, .lc .lc-bar-r, .lc-group span i, .lc-donut .seg, .lc-prog i, .lc-stock i, .lc-cash__bars i { transition: none !important; opacity: 1; }
  .lc-app:not([hidden]) { animation: none; }
}
