:root,
[data-theme="dark"] {
  color-scheme: dark;
  --bg: #080d14;
  --bg-grad-1: rgba(20, 184, 166, 0.16);
  --bg-grad-2: rgba(56, 189, 248, 0.14);
  --bg-grad-3: rgba(99, 102, 241, 0.10);
  --text: #eef5fc;
  --muted: #94a8be;
  --accent: #38f2d2;
  --accent-strong: #14b8a6;
  --accent-ink: #04241f;
  --blue: #38bdf8;
  --card: rgba(17, 26, 39, 0.68);
  --card-solid: #111b27;
  --surface: rgba(11, 18, 28, 0.78);
  --surface-hover: rgba(30, 45, 66, 0.75);
  --border: rgba(148, 184, 219, 0.18);
  --border-highlight: rgba(105, 226, 202, 0.45);
  --shadow: 0 18px 42px -12px rgba(2, 8, 18, 0.65), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  --error: #ff8b8b;
  --on: #22c55e;
  --on-glow: rgba(34, 197, 94, 0.28);

  /* Variables cho Sơ đồ Ladder đồng bộ Sáng / Tối */
  --ld-bg: #0b131e;
  --ld-card: rgba(14, 23, 36, 0.88);
  --ld-wire: #6e8ba8;
  --ld-rail: #4b6580;
  --ld-text: #e6f0fa;
  --ld-muted: #7d93ab;
  --ld-accent: #38f2d2;
  --ld-op: #60a5fa;
  --ld-box: #152436;
  --ld-border: #2f4b69;
  --ld-comment: #fbbf24;
  --ld-on: #22c55e;
  --ld-on-bg: rgba(34, 197, 94, 0.22);
  --ld-live: #38bdf8;
}

[data-theme="light"] {
  color-scheme: light;
  --bg: #eef4fb;
  --bg-grad-1: rgba(14, 165, 233, 0.16);
  --bg-grad-2: rgba(20, 184, 166, 0.14);
  --bg-grad-3: rgba(99, 102, 241, 0.08);
  --text: #0f172a;
  --muted: #475569;
  --accent: #0d9488;
  --accent-strong: #0f766e;
  --accent-ink: #ffffff;
  --blue: #0284c7;
  --card: rgba(255, 255, 255, 0.74);
  --card-solid: #ffffff;
  --surface: rgba(241, 246, 252, 0.88);
  --surface-hover: rgba(226, 236, 248, 0.92);
  --border: rgba(15, 23, 42, 0.12);
  --border-highlight: rgba(13, 148, 136, 0.45);
  --shadow: 0 14px 34px -10px rgba(15, 23, 42, 0.10), inset 0 1px 0 rgba(255, 255, 255, 0.85);
  --error: #dc2626;
  --on: #16a34a;
  --on-glow: rgba(22, 163, 74, 0.22);

  /* Variables cho Sơ đồ Ladder ở chế độ Sáng */
  --ld-bg: #f8fafc;
  --ld-card: #ffffff;
  --ld-wire: #3b5978;
  --ld-rail: #274561;
  --ld-text: #0f172a;
  --ld-muted: #64748b;
  --ld-accent: #0284c7;
  --ld-op: #1d4ed8;
  --ld-box: #eef6ff;
  --ld-border: #93c5fd;
  --ld-comment: #b45309;
  --ld-on: #16a34a;
  --ld-on-bg: rgba(22, 163, 74, 0.16);
  --ld-live: #0369a1;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font: 14.5px/1.55 "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
  background-color: var(--bg);
  color: var(--text);
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
  transition: background-color 0.25s ease, color 0.25s ease;
}

.ambient-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
  background:
    radial-gradient(circle at 12% 10%, var(--bg-grad-1), transparent 42%),
    radial-gradient(circle at 86% 14%, var(--bg-grad-2), transparent 45%),
    radial-gradient(circle at 52% 88%, var(--bg-grad-3), transparent 50%);
}

a {
  color: var(--accent);
  text-decoration: none;
  font-weight: 600;
}

a:hover {
  text-decoration: underline;
}

button,
input,
textarea,
select {
  font: inherit;
}

button,
input:not([type="checkbox"]),
textarea,
select {
  border: 1px solid var(--border);
  border-radius: 0.65rem;
  background: var(--surface);
  color: var(--text);
  padding: 0.5rem 0.78rem;
  transition: border-color 0.18s ease, box-shadow 0.18s ease, background 0.18s ease, transform 0.12s ease;
}

button {
  cursor: pointer;
  font-weight: 650;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.42rem;
}

button:hover:not(:disabled) {
  border-color: var(--border-highlight);
  background: var(--surface-hover);
}

button:active:not(:disabled) {
  transform: translateY(1px);
}

button:disabled {
  opacity: 0.42;
  cursor: not-allowed;
}

button.primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-strong));
  border-color: transparent;
  color: var(--accent-ink);
  font-weight: 700;
}

button.glow-btn:hover:not(:disabled) {
  box-shadow: 0 0 18px rgba(56, 242, 210, 0.35);
}

.glass-btn {
  background: var(--surface);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border);
}

.sm-btn {
  padding: 0.34rem 0.65rem;
  font-size: 0.84rem;
  border-radius: 0.5rem;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

textarea {
  resize: vertical;
  width: 100%;
}

input:not([type="checkbox"]) {
  width: 100%;
}

label {
  display: grid;
  gap: 0.3rem;
  font-weight: 600;
}

h1, h2, h3, p {
  margin: 0 0 0.55rem;
}

h1 { font-size: 1.38rem; letter-spacing: -0.01em; }
h2 { font-size: 1.18rem; letter-spacing: -0.01em; }
h3 { font-size: 0.98rem; }

/* TOP GLASS BAR */
.top,
.section-head,
.toolbar,
.top nav {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.top,
.section-head {
  justify-content: space-between;
}

.glass-bar {
  position: sticky;
  top: 0;
  z-index: 30;
  padding: 0.65rem clamp(1rem, 2.5vw, 2.5rem);
  border-bottom: 1px solid var(--border);
  background: var(--card);
  backdrop-filter: blur(20px) saturate(170%);
  -webkit-backdrop-filter: blur(20px) saturate(170%);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.14);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.65rem;
  color: var(--text);
  text-decoration: none !important;
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.2;
}

.brand-text strong {
  font-size: 1.05rem;
  font-weight: 800;
}

.brand-text small {
  font-size: 0.74rem;
  color: var(--muted);
  font-weight: 500;
}

.user-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.32rem 0.7rem;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  font-size: 0.85rem;
  font-weight: 650;
}

.online-dot {
  width: 0.5rem;
  height: 0.5rem;
  border-radius: 50%;
  background: var(--on);
  box-shadow: 0 0 8px var(--on);
}

.nav-link {
  padding: 0.35rem 0.65rem;
  border-radius: 0.5rem;
  font-size: 0.88rem;
}

.nav-link:hover {
  background: var(--surface-hover);
  text-decoration: none;
}

.user,
.muted,
.card > p:not(.error) {
  color: var(--muted);
}

.small-note {
  font-size: 0.8rem;
}

/* STUDIO SHELL & GLASS CARDS */
.studio-shell {
  max-width: 1640px;
  margin: 0 auto;
  padding: clamp(0.75rem, 1.6vw, 1.4rem);
  display: grid;
  gap: 1rem;
}

.workspace,
.admin-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.48fr) minmax(380px, 0.95fr);
  align-items: start;
  gap: 1rem;
}

.studio-left-col {
  display: grid;
  gap: 0.9rem;
  min-width: 0;
}

.admin-layout {
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.7fr);
}

.workspace.single-column {
  grid-template-columns: minmax(0, 1fr);
}

.card,
.glass-card {
  background: var(--card);
  backdrop-filter: blur(20px) saturate(165%);
  -webkit-backdrop-filter: blur(20px) saturate(165%);
  border: 1px solid var(--border);
  border-radius: 1.05rem;
  padding: clamp(0.95rem, 1.6vw, 1.35rem);
  box-shadow: var(--shadow);
  min-width: 0;
}

.narrow {
  max-width: 440px;
  margin: clamp(2rem, 10vh, 6rem) auto;
  padding: 1.8rem;
  width: calc(100% - 2rem);
}

.fields {
  display: grid;
  gap: 0.75rem;
}

.section-head {
  align-items: center;
  margin-bottom: 0.55rem;
}

.eyebrow {
  font-size: 0.69rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  color: var(--accent);
  margin-bottom: 0.15rem;
  text-transform: uppercase;
  display: block;
}

.cpu,
.checkbox {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
}

.inline-check {
  margin: 0;
  color: var(--muted);
  font-size: 0.88rem;
  cursor: pointer;
}

.quota {
  color: var(--accent);
  background: rgba(20, 184, 166, 0.1);
  border: 1px solid var(--border-highlight);
  border-radius: 2rem;
  padding: 0.25rem 0.7rem;
  font-size: 0.82rem;
  font-weight: 700;
  white-space: nowrap;
}

/* PRIORITY 1: PLC ONLINE DOCK */
.plc-dock {
  border-color: var(--border-highlight);
}

.plc-dock-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.85rem;
  flex-wrap: wrap;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--border);
}

.plc-title-row,
.editor-title-row,
.cpu-toolbar {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  flex-wrap: wrap;
}

.plc-title-row h2,
.editor-title-row h1 {
  margin: 0;
}

.compact-field {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.86rem;
}

.compact-field input {
  width: 4.6rem;
}

.plc-action-bar {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  flex-wrap: wrap;
  padding-top: 0.75rem;
}

/* REDESIGNED MONITOR BUTTON (SLEEK PILL WITH PULSING LED) */
.monitor-pill {
  position: relative;
  padding: 0.52rem 1rem;
  border-radius: 999px;
  font-weight: 750;
  background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(20, 184, 166, 0.18));
  border: 1px solid rgba(34, 197, 94, 0.5);
  color: var(--text);
  transition: all 0.22s ease;
}

.monitor-pill:hover:not(:disabled) {
  border-color: var(--on);
  box-shadow: 0 0 16px var(--on-glow);
}

.monitor-led {
  width: 0.62rem;
  height: 0.62rem;
  border-radius: 50%;
  background: #64748b;
  border: 1px solid rgba(255, 255, 255, 0.35);
  transition: all 0.2s ease;
}

.monitor-pill.active {
  background: linear-gradient(135deg, #16a34a, #059669);
  border-color: #4ade80;
  color: #ffffff;
  box-shadow: 0 0 22px rgba(34, 197, 94, 0.45);
}

.monitor-pill.active .monitor-led {
  background: #86efac;
  border-color: #ffffff;
  box-shadow: 0 0 10px #ffffff;
  animation: pulse-led 1.2s infinite ease-in-out;
}

@keyframes pulse-led {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.28); opacity: 0.75; }
}

.run-btn:not(:disabled) {
  border-color: rgba(34, 197, 94, 0.5);
}

.stop-btn:not(:disabled) {
  border-color: rgba(239, 68, 68, 0.5);
}

.watch-inline {
  flex: 1 1 210px;
  min-width: 180px;
}

.force-inline {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.force-inline #plc-force-dev {
  width: 7.2rem;
}

.force-inline #plc-force-val {
  width: 6.8rem;
}

.plc-upload-bar {
  margin: 0.65rem 0;
  padding: 0.75rem 0.9rem;
  border-radius: 0.75rem;
  background: var(--surface);
  border: 1px solid var(--border-highlight);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.plc-visual-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr);
  gap: 0.85rem;
  margin-top: 0.65rem;
}

.plc-face {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
  padding: 0.65rem;
}

.plc-front {
  padding: 0.65rem 0.8rem;
  background: rgba(15, 23, 42, 0.42);
  border: 1px solid var(--border);
  border-radius: 0.6rem;
}

[data-theme="light"] .plc-front {
  background: rgba(255, 255, 255, 0.75);
}

.plc-face-heading,
.plc-indicators {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  flex-wrap: wrap;
}

.plc-model-wrap {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.io-picker {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.78rem;
}

.io-picker select {
  padding: 0.25rem 0.5rem;
  font-size: 0.78rem;
}

.plc-indicators span,
.plc-bank > span {
  font-size: 0.72rem;
  font-weight: 750;
  letter-spacing: 0.06em;
}

.plc-bank {
  display: grid;
  grid-template-columns: 4.8rem minmax(0, 1fr);
  gap: 0.35rem;
  align-items: center;
  padding: 0.42rem 0;
}

.plc-bank + .plc-bank {
  border-top: 1px solid var(--border);
}

.plc-led-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(2.15rem, 1fr));
  gap: 0.3rem;
}

.plc-led-grid span {
  display: grid;
  justify-items: center;
  gap: 0.16rem;
  font: 11.5px ui-monospace, Consolas, monospace;
  padding: 0.22rem 0.15rem;
  border-radius: 0.4rem;
  cursor: pointer;
  user-select: none;
  transition: background 0.15s ease;
}

.plc-led-grid span:hover {
  background: var(--surface-hover);
}

.plc-led {
  display: inline-block;
  width: 0.65rem;
  height: 0.65rem;
  border-radius: 50%;
  border: 1px solid #64748b;
  background: rgba(100, 116, 139, 0.3);
}

.plc-led.unknown {
  background: transparent;
  border-style: dashed;
}

.plc-led.lit {
  background: #22c55e;
  border-color: transparent;
  box-shadow: 0 0 0.5rem rgba(34, 197, 94, 0.8);
}

#plc-led-link.lit {
  background: #38bdf8;
  box-shadow: 0 0 0.5rem rgba(56, 189, 248, 0.8);
}

#plc-led-stop.lit {
  background: #f87171;
  box-shadow: 0 0 0.5rem rgba(248, 113, 113, 0.8);
}

#plc-led-y .lit {
  background: #fb923c;
  box-shadow: 0 0 0.5rem rgba(251, 146, 60, 0.8);
}

.plc-watch-box {
  border: 1px solid var(--border);
  border-radius: 0.8rem;
  background: var(--surface);
  padding: 0.7rem 0.85rem;
  max-height: 12.5rem;
  overflow: auto;
}

.plc-values {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(6.8rem, 1fr));
  gap: 0.38rem;
  margin: 0.45rem 0 0;
}

.plc-values div {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.3rem;
  padding: 0.32rem 0.5rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.42rem;
  font: 12.5px ui-monospace, Consolas, monospace;
  cursor: pointer;
}

.plc-values div:hover {
  border-color: var(--accent);
}

.plc-values dd {
  margin: 0;
  color: var(--accent);
  font-weight: 700;
}

/* EDITOR & THEME-AWARE LADDER STAGE */
.file-badge {
  font: 12px ui-monospace, Consolas, monospace;
  padding: 0.2rem 0.55rem;
  border-radius: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.main-toolbar {
  padding: 0.4rem 0;
}

.sample-bar {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  flex-wrap: wrap;
  padding: 0.45rem 0.65rem;
  margin-top: 0.25rem;
  border-radius: 0.65rem;
  background: var(--surface);
  border: 1px dashed var(--border-highlight);
}

.sample-chip {
  font-weight: 700;
  color: var(--accent);
  border-color: var(--border-highlight);
}

.ladder-panel,
.il-panel {
  margin-top: 0.7rem;
}

.ladder-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-bottom: 0.4rem;
}

.ladder-bar-left {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
}

.badge-offline,
.badge-online {
  font-size: 0.73rem;
  font-weight: 800;
  padding: 0.18rem 0.58rem;
  border-radius: 999px;
  letter-spacing: 0.04em;
}

.badge-offline {
  background: var(--surface);
  border: 1px solid var(--border);
  color: var(--muted);
}

.badge-online {
  background: rgba(34, 197, 94, 0.18);
  border: 1px solid var(--on);
  color: var(--on);
  box-shadow: 0 0 12px var(--on-glow);
}

.ladder-stage {
  width: 100%;
  max-height: 30rem;
  overflow: auto;
  border: 1px solid var(--border);
  background: var(--ld-bg);
  color: var(--ld-text);
  border-radius: 0.75rem;
  padding: 0.65rem;
  transition: background-color 0.22s ease, border-color 0.22s ease;
}

.ladder-stage .ld-intro {
  display: none;
}

.ladder-stage .ld-page {
  margin: 0 0 0.65rem;
  border: 1px solid var(--ld-border);
  border-radius: 0.6rem;
  padding: 0.55rem;
  background: var(--ld-card);
}

.ladder-stage .ld-page:last-child {
  margin-bottom: 0;
}

.ladder-stage .ld-page h2 {
  font-size: 0.75rem;
  color: var(--ld-muted);
  margin: 0 0 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.ladder-stage .ld-svg {
  width: 100%;
  min-width: 920px;
  height: auto;
  font: 13px ui-monospace, Consolas, monospace;
  fill: none;
  stroke-linecap: round;
}

.ladder-stage .ld-rail {
  stroke: var(--ld-rail);
  stroke-width: 3;
}

.ladder-stage.ld-online .ld-rail {
  stroke: var(--ld-on);
}

.ladder-stage .ld-wire {
  stroke: var(--ld-wire);
  stroke-width: 1.65;
}

.ladder-stage .ld-sym {
  stroke: var(--ld-accent);
  stroke-width: 2;
}

.ladder-stage .ld-sym-txt,
.ladder-stage .ld-accent {
  fill: var(--ld-accent);
  font-weight: 700;
}

.ladder-stage .ld-label,
.ladder-stage .ld-arg {
  fill: var(--ld-text);
  font-weight: 600;
}

.ladder-stage .ld-op {
  fill: var(--ld-op);
  font-weight: 750;
}

.ladder-stage .ld-row-num {
  fill: var(--ld-muted);
}

.ladder-stage .ld-comment {
  fill: var(--ld-comment);
  font-weight: 600;
}

.ladder-stage .ld-box {
  fill: var(--ld-box);
  stroke: var(--ld-border);
  stroke-width: 1.4;
}

.ladder-stage .ld-hit {
  fill: transparent;
  stroke: transparent;
  transition: fill 0.15s, stroke 0.15s;
}

.ladder-stage .ld-live-val {
  fill: var(--ld-live);
  font-weight: 700;
}

.ladder-stage .ld-raw-box {
  fill: rgba(239, 68, 68, 0.14);
  stroke: #ef4444;
  stroke-width: 1.3;
}

.ladder-stage .ld-raw-txt {
  fill: #f87171;
  font-weight: 700;
}

.ladder-stage .ld-contact,
.ladder-stage .ld-coil,
.ladder-stage .ld-block {
  cursor: pointer;
}

.ladder-stage .ld-cell.energized .ld-hit {
  fill: var(--ld-on-bg);
  stroke: var(--ld-on);
  stroke-width: 1.5;
}

.ladder-stage .ld-cell.energized .ld-sym,
.ladder-stage .ld-cell.energized .ld-wire {
  stroke: var(--ld-on);
  stroke-width: 2.4;
}

.ladder-stage .ld-cell.energized .ld-label,
.ladder-stage .ld-cell.energized .ld-sym-txt {
  fill: var(--ld-on);
  font-weight: 800;
}

.ladder-stage .ld-cell.energized .ld-box {
  stroke: var(--ld-on);
  stroke-width: 2;
}

#source {
  min-height: 15rem;
  height: 32vh;
  font: 13.5px/1.55 ui-monospace, Consolas, monospace;
  tab-size: 4;
  background: var(--ld-bg);
}

/* USER SAVED FILES STORAGE */
.user-storage {
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border);
}

.user-files-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 0.55rem;
  margin-top: 0.45rem;
  max-height: 13rem;
  overflow: auto;
}

.file-item {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 0.4rem;
  padding: 0.6rem 0.75rem;
  border-radius: 0.65rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.file-item-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.4rem;
}

.file-item-head strong {
  font-size: 0.86rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.file-item-meta {
  font-size: 0.75rem;
  color: var(--muted);
}

.file-item-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

/* UNIFIED 1-FRAME CHAT PANEL (KHÔNG CHIA 2 KHUNG) */
.chat {
  padding: 0;
  overflow: hidden;
}

.chat-single-frame {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 10rem);
  min-height: 36rem;
  max-height: 54rem;
  background: var(--surface);
}

.chat-frame-header {
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.9rem 1.1rem;
  border-bottom: 1px solid var(--border);
  background: var(--card);
}

.chat-frame-header h2 {
  margin: 0;
}

.chat-header-actions {
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

.messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding: 0.85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.turn {
  padding: 0.75rem 0.9rem;
  border-radius: 0.8rem;
  background: var(--card);
  border: 1px solid var(--border);
  overflow-wrap: anywhere;
}

.turn.user-turn {
  align-self: flex-end;
  width: 92%;
  border-color: var(--border-highlight);
}

.turn p {
  white-space: pre-wrap;
  margin: 0;
}

.turn strong {
  display: block;
  color: var(--accent);
  font-size: 0.8rem;
  margin-bottom: 0.25rem;
}

.turn button {
  margin-top: 0.55rem;
}

.code-snippet {
  margin: 0.5rem 0 0;
  padding: 0.55rem;
  border-radius: 0.5rem;
  background: var(--ld-bg);
  border: 1px solid var(--border);
  font: 12px/1.45 ui-monospace, Consolas, monospace;
  overflow-x: auto;
}

.quick-prompts {
  flex-shrink: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  padding: 0.5rem 1rem;
  border-top: 1px solid var(--border);
  background: var(--surface);
}

.chip {
  font-size: 0.76rem;
  padding: 0.3rem 0.65rem;
  border-radius: 999px;
  white-space: nowrap;
  background: var(--card);
  border: 1px solid var(--border);
  line-height: 1.25;
}

.chat-composer {
  flex-shrink: 0;
  padding: 0.65rem 1rem 0.9rem;
  border-top: 1px solid var(--border);
  background: var(--card);
  display: grid;
  gap: 0.45rem;
}

.chat-composer textarea {
  border-radius: 0.65rem;
  background: var(--ld-bg);
  resize: none;
}

.composer-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
}

.inline-status {
  margin: 0;
  min-height: 0;
  font-size: 0.82rem;
  flex: 1;
}

.status {
  margin: 0.35rem 0 0;
  min-height: 1.25rem;
  color: var(--muted);
  overflow-wrap: anywhere;
  white-space: pre-line;
  font-size: 0.88rem;
}

.error,
.status.error {
  color: var(--error);
  font-weight: 600;
}

.accounts {
  overflow: auto;
}

.admin-chat-log {
  max-height: 24rem;
  border: 1px solid var(--border);
  border-radius: 0.75rem;
}

table {
  border-collapse: collapse;
  width: 100%;
  text-align: left;
  font-size: 0.88rem;
}

td,
th {
  padding: 0.6rem 0.65rem;
  border-bottom: 1px solid var(--border);
  white-space: nowrap;
}

/* CUSTOMER PHONE MODAL & ADMIN ACCESS CODE LINKS */
.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(2, 6, 23, 0.72);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.modal-backdrop[hidden] {
  display: none !important;
}

.modal-dialog {
  width: 100%;
  max-width: 28rem;
  padding: 1.4rem 1.5rem;
  border-color: var(--border-highlight);
}

.modal-actions {
  justify-content: flex-end;
  margin-top: 0.35rem;
}

.limit-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.65rem;
}

.copy-link-row {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.share-url-input {
  width: 16.5rem;
  padding: 0.3rem 0.55rem;
  font: 12px ui-monospace, Consolas, monospace;
  background: var(--ld-bg);
}

.phone-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.2rem 0.58rem;
  border-radius: 999px;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid var(--on);
  color: var(--on);
  font-size: 0.8rem;
}

.inline-limit-form {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.inline-limit-form input[type="number"] {
  width: 4.4rem;
  padding: 0.26rem 0.4rem;
  font-size: 0.8rem;
}

.ua-cell {
  max-width: 18rem;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ============================================================================
   HERO NAVIS AI ASSISTANT & WORKFLOW ANIMATIONS (THINKING / CODE / PLC / MONITOR)
   ============================================================================ */
.navis-ai-hero {
  position: sticky;
  top: 4.5rem;
  border: 1.5px solid rgba(45, 212, 191, 0.55);
  box-shadow:
    0 16px 42px rgba(2, 6, 23, 0.48),
    0 0 26px rgba(20, 184, 166, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.16);
  animation: navisHeroGlow 4.2s infinite ease-in-out;
}

.navis-ai-hero.ai-locked {
  animation: none;
}

.ai-locked-body {
  display: grid;
  place-items: center;
  min-height: 19rem;
  position: relative;
  isolation: isolate;
}

.ai-preview-art {
  position: absolute;
  inset: 1rem .25rem;
  z-index: -1;
  display: grid;
  align-content: space-between;
  gap: 1rem;
  filter: blur(5px);
  opacity: .24;
  pointer-events: none;
}

.ai-preview-bubble {
  width: 78%;
  height: 3.5rem;
  background: currentColor;
  border-radius: .9rem;
}

.ai-preview-bubble:first-child {
  justify-self: end;
  width: 58%;
}

.ai-preview-bubble:last-child {
  width: 100%;
}

.ai-locked-message {
  padding: 1rem;
  max-width: 24rem;
  text-align: center;
}

.ai-locked-message a {
  display: inline-block;
  text-decoration: none;
}

@keyframes navisHeroGlow {
  0%, 100% {
    border-color: rgba(45, 212, 191, 0.55);
    box-shadow: 0 16px 42px rgba(2, 6, 23, 0.45), 0 0 22px rgba(20, 184, 166, 0.2);
  }
  50% {
    border-color: rgba(56, 189, 248, 0.85);
    box-shadow: 0 18px 46px rgba(2, 6, 23, 0.5), 0 0 34px rgba(56, 189, 248, 0.34);
  }
}

.navis-ai-hero.is-thinking {
  border-color: #38bdf8;
  animation: navisThinkingPulse 1.15s infinite ease-in-out;
}

@keyframes navisThinkingPulse {
  0%, 100% {
    border-color: #2dd4bf;
    box-shadow: 0 0 28px rgba(45, 212, 191, 0.45), 0 0 55px rgba(56, 189, 248, 0.25);
  }
  50% {
    border-color: #38bdf8;
    box-shadow: 0 0 42px rgba(56, 189, 248, 0.68), 0 0 70px rgba(45, 212, 191, 0.35);
  }
}

.ai-title-line {
  display: inline-flex;
  align-items: center;
  gap: 0.48rem;
}

.navis-orb {
  display: inline-grid;
  place-items: center;
  width: 1.75rem;
  height: 1.75rem;
  border-radius: 50%;
  background: linear-gradient(135deg, #14b8a6, #0284c7);
  color: #ffffff;
  font-size: 0.98rem;
  box-shadow: 0 0 16px rgba(20, 184, 166, 0.65);
  animation: orbFloat 2.8s infinite ease-in-out;
}

.navis-ai-hero.is-thinking .navis-orb {
  animation: orbSpinPulse 1s infinite linear;
}

@keyframes orbFloat {
  0%, 100% { transform: translateY(0) scale(1); box-shadow: 0 0 14px rgba(20, 184, 166, 0.6); }
  50% { transform: translateY(-2px) scale(1.08); box-shadow: 0 0 22px rgba(56, 189, 248, 0.85); }
}

@keyframes orbSpinPulse {
  0% { transform: rotate(0deg) scale(1.05); }
  50% { transform: rotate(180deg) scale(1.18); }
  100% { transform: rotate(360deg) scale(1.05); }
}

.ai-live-pill {
  font-size: 0.7rem;
  font-weight: 800;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0.16rem 0.55rem;
  border-radius: 999px;
  background: linear-gradient(90deg, rgba(20, 184, 166, 0.22), rgba(56, 189, 248, 0.22));
  border: 1px solid rgba(45, 212, 191, 0.5);
  color: var(--accent);
}

.ai-send-btn:not(:disabled) {
  background: linear-gradient(135deg, #14b8a6, #0284c7, #0d9488);
  background-size: 200% 200%;
  animation: sendBtnGradient 3.5s ease infinite;
}

@keyframes sendBtnGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}

/* AI THINKING WAVE CARD IN CHAT */
.ai-thinking-card {
  padding: 0.85rem 1rem;
  border-radius: 0.85rem;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(56, 189, 248, 0.12));
  border: 1px solid rgba(56, 189, 248, 0.55);
  display: grid;
  gap: 0.5rem;
  box-shadow: 0 0 22px rgba(56, 189, 248, 0.18);
}

.thinking-head {
  display: flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 700;
  font-size: 0.86rem;
  color: var(--accent);
}

.thinking-wave {
  display: inline-flex;
  align-items: center;
  gap: 0.22rem;
}

.thinking-wave span {
  width: 0.34rem;
  height: 0.95rem;
  border-radius: 999px;
  background: linear-gradient(180deg, #2dd4bf, #38bdf8);
  animation: waveBounce 0.9s infinite ease-in-out;
}

.thinking-wave span:nth-child(2) { animation-delay: 0.15s; }
.thinking-wave span:nth-child(3) { animation-delay: 0.3s; }
.thinking-wave span:nth-child(4) { animation-delay: 0.45s; }

@keyframes waveBounce {
  0%, 100% { transform: scaleY(0.45); opacity: 0.55; }
  50% { transform: scaleY(1.15); opacity: 1; }
}

.thinking-beam {
  height: 3px;
  width: 100%;
  border-radius: 999px;
  background: rgba(148, 163, 184, 0.2);
  overflow: hidden;
  position: relative;
}

.thinking-beam::after {
  content: "";
  position: absolute;
  inset: 0;
  width: 45%;
  background: linear-gradient(90deg, transparent, #2dd4bf, #38bdf8, transparent);
  animation: beamSweep 1.25s infinite linear;
}

@keyframes beamSweep {
  0% { transform: translateX(-110%); }
  100% { transform: translateX(240%); }
}

/* CODE GENERATED & BUILD REVEAL FLASH */
.code-generated-flash {
  animation: codeRevealGlow 1.5s ease-out;
}

@keyframes codeRevealGlow {
  0% {
    box-shadow: 0 0 0 0 rgba(34, 197, 94, 0.75), inset 0 0 28px rgba(45, 212, 191, 0.45);
    border-color: #22c55e;
  }
  50% {
    box-shadow: 0 0 32px 4px rgba(45, 212, 191, 0.45), inset 0 0 14px rgba(34, 197, 94, 0.25);
    border-color: #2dd4bf;
  }
  100% {
    box-shadow: none;
  }
}

/* SMART NEXT-STEP PLC SUGGESTION BANNER & CHAT ACTION CARD */
.plc-guide-banner {
  margin-top: 0.65rem;
  padding: 0.7rem 0.9rem;
  border-radius: 0.8rem;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.16), rgba(34, 197, 94, 0.12));
  border: 1px solid rgba(45, 212, 191, 0.6);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex-wrap: wrap;
  animation: guideSlideIn 0.35s ease-out;
}

.plc-guide-banner[hidden] {
  display: none !important;
}

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

.plc-guide-content {
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.plc-guide-icon {
  font-size: 1.35rem;
}

.next-step-card {
  margin-top: 0.55rem;
  padding: 0.65rem 0.75rem;
  border-radius: 0.65rem;
  background: linear-gradient(135deg, rgba(20, 184, 166, 0.14), rgba(56, 189, 248, 0.1));
  border: 1px dashed rgba(45, 212, 191, 0.6);
  display: grid;
  gap: 0.45rem;
}

.next-step-card strong {
  color: var(--on);
  font-size: 0.78rem;
  margin: 0;
}

/* PLC DATA TRANSFER BEAM & MONITOR PULSE */
/* NÚT KẾT NỐI CỔNG COM NỔI BẬT KÈM HIỆU ỨNG SONAR / SHIMMER CHO KHÁCH MỚI VÀO */
.com-hero-btn {
  position: relative;
  overflow: visible;
  padding: 0.62rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: 0.01em;
  border-radius: 999px;
  background: linear-gradient(135deg, #10b981 0%, #0ea5e9 55%, #14b8a6 100%);
  background-size: 200% 200%;
  border: 1.5px solid #6ee7b7;
  color: #ffffff;
  box-shadow:
    0 6px 22px rgba(16, 185, 129, 0.45),
    0 0 28px rgba(14, 165, 233, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.4);
  animation: comHeroPulse 2.1s infinite ease-in-out;
  z-index: 2;
}

.com-hero-btn:not(:disabled)::before {
  content: "";
  position: absolute;
  inset: -4px;
  border-radius: 999px;
  border: 2px solid rgba(52, 211, 153, 0.75);
  animation: comRadarRing 2.1s infinite cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

.com-hero-btn:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  box-shadow:
    0 10px 28px rgba(16, 185, 129, 0.6),
    0 0 38px rgba(56, 189, 248, 0.55);
}

.com-hero-btn:disabled {
  animation: none;
  background: rgba(34, 197, 94, 0.18);
  border-color: rgba(34, 197, 94, 0.5);
  color: var(--on);
  box-shadow: none;
  opacity: 0.92;
}

.com-beacon {
  width: 0.68rem;
  height: 0.68rem;
  border-radius: 50%;
  background: #ffffff;
  box-shadow: 0 0 10px #ffffff, 0 0 18px #6ee7b7;
  animation: pulse-led 1.1s infinite ease-in-out;
}

.com-hero-btn:disabled .com-beacon {
  background: #22c55e;
  box-shadow: 0 0 8px #22c55e;
}

@keyframes comHeroPulse {
  0%, 100% {
    background-position: 0% 50%;
    transform: scale(1);
    box-shadow: 0 6px 22px rgba(16, 185, 129, 0.45), 0 0 24px rgba(14, 165, 233, 0.3);
  }
  50% {
    background-position: 100% 50%;
    transform: scale(1.035);
    box-shadow: 0 8px 30px rgba(16, 185, 129, 0.68), 0 0 38px rgba(56, 189, 248, 0.55);
  }
}

@keyframes comRadarRing {
  0% {
    transform: scale(0.98);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.16, 1.38);
    opacity: 0;
  }
}

.plc-dock {
  position: relative;
  overflow: hidden;
}

/* ẨN CÁC NÚT & THÔNG TIN KHÔNG LIÊN QUAN KHI CHƯA KẾT NỐI COM */
#plc-dock-card:not(.plc-connected) .plc-when-connected {
  display: none !important;
}

#plc-dock-card:not(.plc-connected):not(.is-monitoring) .plc-when-active,
#plc-dock-card:not(.plc-connected):not(.is-monitoring) .plc-visual-details {
  display: none !important;
}

.auto-plc-opt {
  display: inline-flex;
  align-items: center;
  gap: 0.32rem;
  padding: 0.22rem 0.58rem;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  background: rgba(20, 184, 166, 0.12);
  border: 1px solid var(--border-highlight);
  color: var(--accent);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}

.auto-plc-opt input {
  width: 0.85rem;
  height: 0.85rem;
  margin: 0;
  accent-color: var(--accent-solid);
}

.plc-transfer-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: rgba(56, 189, 248, 0.18);
  overflow: hidden;
}

.plc-transfer-bar[hidden] {
  display: none !important;
}

.plc-transfer-beam {
  width: 40%;
  height: 100%;
  background: linear-gradient(90deg, transparent, #22c55e, #2dd4bf, #38bdf8, transparent);
  animation: beamSweep 0.9s infinite linear;
}

.plc-dock.is-transferring {
  border-color: #38bdf8;
  box-shadow: 0 0 28px rgba(56, 189, 248, 0.38);
}

.plc-dock.is-monitoring {
  border-color: var(--on);
  box-shadow: 0 0 26px rgba(34, 197, 94, 0.25);
}

.ladder-stage.ld-online .ld-cell.energized .ld-sym,
.ladder-stage.ld-online .ld-cell.energized .ld-wire {
  animation: ladderCurrentPulse 1.35s infinite ease-in-out;
}

@keyframes ladderCurrentPulse {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(34, 197, 94, 0.55)); }
  50% { filter: drop-shadow(0 0 7px rgba(74, 222, 128, 0.95)); }
}

.plc-visual-details {
  margin-top: 0.55rem;
  border-top: 1px solid var(--border);
  padding-top: 0.45rem;
}

.plc-visual-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  cursor: pointer;
  font-size: 0.84rem;
  font-weight: 700;
  color: var(--accent);
  padding: 0.2rem 0;
  user-select: none;
}

.pulse-attention {
  animation: attentionPulse 1.2s ease-in-out 3;
}

@keyframes attentionPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(45, 212, 191, 0.7); }
  50% { transform: scale(1.05); box-shadow: 0 0 22px 6px rgba(45, 212, 191, 0.55); }
}

[hidden] {
  display: none !important;
}

/* NÚT NẠP PLC TRỰC TIẾP TRONG THANH LADDER & INSTRUCTION LIST */
.plc-download-hero-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.48rem 0.98rem;
  font-weight: 800;
  color: #ffffff;
  background: linear-gradient(135deg, #2563eb 0%, #0d9488 55%, #16a34a 100%);
  border: 1.5px solid rgba(56, 189, 248, 0.75);
  border-radius: 0.58rem;
  box-shadow: 0 0 18px rgba(37, 99, 235, 0.35), 0 3px 10px rgba(0, 0, 0, 0.16);
  cursor: pointer;
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.plc-download-hero-btn:hover:not(:disabled) {
  transform: translateY(-1px) scale(1.02);
  box-shadow: 0 0 24px rgba(14, 165, 233, 0.55), 0 5px 14px rgba(0, 0, 0, 0.22);
}

.plc-download-ready-glow {
  background: linear-gradient(135deg, #f59e0b 0%, #10b981 55%, #0284c7 100%) !important;
  border-color: #fde047 !important;
  color: #ffffff !important;
  animation: plcDownloadReadyPulse 1.15s infinite ease-in-out !important;
}

@keyframes plcDownloadReadyPulse {
  0%, 100% {
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(250, 204, 21, 0.75), 0 0 20px rgba(16, 185, 129, 0.65);
  }
  50% {
    transform: scale(1.06);
    box-shadow: 0 0 0 9px rgba(250, 204, 21, 0), 0 0 32px rgba(245, 158, 11, 0.95);
  }
}

/* TRANG QUẢN TRỊ: CẢNH BÁO ĐỎ NỔI BẬT CHO CODE LỖI / FILE DVP LỖI & CHẶN IP/MAC */
.danger-alert-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.85rem;
  padding: 0.9rem 1.15rem;
  border-radius: 0.9rem;
  background: linear-gradient(135deg, rgba(220, 38, 38, 0.18) 0%, rgba(185, 28, 28, 0.1) 100%);
  border: 2px solid #ef4444;
  box-shadow: 0 0 26px rgba(239, 68, 68, 0.28);
}

.danger-alert-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.danger-pulse-dot {
  width: 0.85rem;
  height: 0.85rem;
  border-radius: 999px;
  background: #ef4444;
  box-shadow: 0 0 12px #ef4444;
  flex-shrink: 0;
  animation: dangerDotPulse 1.3s infinite ease-in-out;
}

@keyframes dangerDotPulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.75); }
  50% { transform: scale(1.22); box-shadow: 0 0 0 8px rgba(239, 68, 68, 0); }
}

.danger-alert-title {
  color: #ef4444;
  font-size: 0.95rem;
  letter-spacing: 0.02em;
}

html[data-theme="dark"] .danger-alert-title {
  color: #fca5a5;
}

.danger-alert-sub {
  margin: 0.15rem 0 0;
  font-size: 0.84rem;
  color: var(--ink);
}

.danger-alert-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.9rem;
  border-radius: 0.55rem;
  font-size: 0.82rem;
  font-weight: 800;
  text-decoration: none;
  color: #ffffff !important;
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
  border: 1.5px solid #f87171;
  box-shadow: 0 0 18px rgba(239, 68, 68, 0.45);
  animation: dangerBtnGlow 2s infinite ease-in-out;
}

.danger-alert-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 0 26px rgba(239, 68, 68, 0.7);
}

@keyframes dangerBtnGlow {
  0%, 100% { box-shadow: 0 0 12px rgba(239, 68, 68, 0.4); }
  50% { box-shadow: 0 0 24px rgba(239, 68, 68, 0.75); }
}

.danger-alert-card {
  border: 2px solid #ef4444 !important;
  box-shadow: 0 0 28px rgba(239, 68, 68, 0.2) !important;
}

.danger-eyebrow {
  color: #ef4444 !important;
  font-weight: 900;
}

.danger-heading {
  color: #dc2626;
}

html[data-theme="dark"] .danger-heading {
  color: #f87171;
}

.danger-tag {
  display: inline-block;
  padding: 0.16rem 0.5rem;
  border-radius: 0.4rem;
  font-size: 0.75rem;
  font-weight: 800;
  color: #ffffff;
  background: #dc2626;
}

.quota-edit-pair {
  display: inline-flex;
  align-items: center;
  gap: 0.2rem;
  padding: 0.15rem 0.35rem;
  border-radius: 0.45rem;
  background: var(--surface);
  border: 1px solid var(--border);
}

.quota-edit-pair small {
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

.quota-edit-pair input[type="number"] {
  width: 4.1rem;
  padding: 0.2rem 0.35rem;
  font-size: 0.8rem;
  font-weight: 700;
}

.block-manager-bar {
  display: flex;
  flex-direction: column;
  gap: 0.55rem;
  padding: 0.7rem 0.85rem;
  margin-bottom: 0.75rem;
  border-radius: 0.7rem;
  background: rgba(239, 68, 68, 0.06);
  border: 1px dashed rgba(239, 68, 68, 0.45);
}

.block-input {
  min-width: 16rem;
}

.block-reason-input {
  min-width: 13rem;
}

.blocked-pills-wrap {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.4rem;
  font-size: 0.8rem;
}

.danger-text {
  color: #ef4444;
}

.inline-block-form {
  display: inline-flex;
  margin: 0;
}

.blocked-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.2rem 0.55rem;
  border-radius: 999px;
  background: rgba(220, 38, 38, 0.15);
  border: 1px solid rgba(239, 68, 68, 0.55);
  font-size: 0.76rem;
  font-weight: 700;
}

.unblock-pill-btn {
  padding: 0.1rem 0.4rem;
  font-size: 0.72rem;
  border-radius: 999px;
  background: #dc2626;
  color: #ffffff;
  border: none;
  cursor: pointer;
}

.ip-mac-cell {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.35rem;
}

.xs-btn {
  padding: 0.18rem 0.48rem;
  font-size: 0.72rem;
  border-radius: 0.4rem;
}

.danger-btn {
  background: rgba(220, 38, 38, 0.14);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.5);
  font-weight: 700;
}

.danger-btn:hover {
  background: #dc2626;
  color: #ffffff;
}

.unblock-btn {
  background: #dc2626;
  color: #ffffff;
  border: 1px solid #f87171;
  font-weight: 700;
}

.blocked-row {
  background: rgba(239, 68, 68, 0.09);
}

/* MCP MODAL & TRIGGER BUTTON STYLES */
.sim-hero-btn {
  border-color: rgba(16, 185, 129, 0.5);
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.14), rgba(6, 182, 212, 0.14));
  color: var(--text);
  font-weight: 700;
}

.sim-hero-btn:hover:not(:disabled),
.sim-hero-btn.active {
  border-color: #10b981;
  background: linear-gradient(135deg, rgba(16, 185, 129, 0.28), rgba(6, 182, 212, 0.25));
  box-shadow: 0 0 14px rgba(16, 185, 129, 0.35);
}

.mcp-trigger-btn {
  border-color: rgba(56, 189, 248, 0.45);
  color: var(--accent);
  font-weight: 700;
}

.mcp-trigger-btn:hover {
  border-color: var(--accent);
  background: rgba(56, 189, 248, 0.14);
}

.mcp-modal-dialog {
  max-width: 44rem;
  width: 94vw;
  max-height: 88vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mcp-modal-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
}

.mcp-modal-head h2 {
  margin: 0.15rem 0 0;
  font-size: 1.15rem;
}

.mcp-section {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.mcp-label-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  font-size: 0.85rem;
}

.mcp-readonly-input {
  width: 100%;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.82rem;
  padding: 0.48rem 0.65rem;
  border-radius: 0.5rem;
  background: var(--input-bg);
  border: 1px solid var(--line-strong);
  color: var(--accent);
}

.mcp-code-box {
  margin: 0;
  padding: 0.6rem 0.75rem;
  border-radius: 0.55rem;
  background: var(--code-bg);
  border: 1px solid var(--line);
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.78rem;
  line-height: 1.45;
  overflow-x: auto;
  white-space: pre;
}

.mcp-tools-list {
  margin: 0.2rem 0 0;
  padding-left: 1.2rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

@media (max-width: 1024px) {
  .workspace,
  .admin-layout,
  .plc-visual-grid {
    grid-template-columns: 1fr;
  }
  .navis-ai-hero {
    position: static;
  }
  .chat-single-frame {
    height: 36rem;
  }
}
.login-shell {
  display: grid;
  place-items: start center;
  padding-block: clamp(2rem, 8vh, 5rem);
}

.login-card {
  width: min(100%, 30rem);
  padding: clamp(1.25rem, 4vw, 2.25rem);
}

.login-intro {
  text-align: center;
  margin-bottom: 1.5rem;
}

.login-intro img {
  display: inline-block;
  object-fit: contain;
  margin-bottom: .75rem;
}

.login-google {
  width: 100%;
}

.login-divider {
  display: flex;
  align-items: center;
  gap: .75rem;
  margin: 1rem 0;
  font-size: .875rem;
}

.login-divider::before,
.login-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: currentColor;
  opacity: .25;
}

.login-return {
  display: inline-block;
  margin-top: 1.25rem;
}
