:root {
  --bg: #f1f5f9;
  --card: #ffffff;
  --line: #e2e8f0;
  --line-strong: #cbd5e1;
  --text: #0f172a;
  --muted: #475569;
  --navy: #0f295c;
  --navy2: #1d4ed8;
  --blue: #2563eb;
  --blue-bg: #eff6ff;
  --teal: #0f766e;
  --teal-bg: #f0fdfa;
  --green: #15803d;
  --green-bg: #f0fdf4;
  --orange: #c2410c;
  --orange-bg: #fff7ed;
  --purple: #6d28d9;
  --purple-bg: #f5f3ff;
  --red: #dc2626;
  --red-bg: #fef2f2;
  --shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  height: 100%;
  font-family: "Be Vietnam Pro", "Segoe UI", system-ui, -apple-system, Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  font-size: 15px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

::selection {
  background: #bfdbfe;
  color: #0f295c;
}

:focus-visible {
  outline: 2px solid var(--blue);
  outline-offset: 2px;
}

h1, h2, h3, h4 {
  text-wrap: balance;
  letter-spacing: -0.012em;
}

p, li {
  text-wrap: pretty;
}

.k-val, .date-pill, .hero-stat-pill, td {
  font-variant-numeric: tabular-nums;
}

::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: transparent;
}

::-webkit-scrollbar-thumb {
  background: #cbd5e1;
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: #94a3b8;
}

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

button {
  cursor: pointer;
}

code {
  font-family: Consolas, "Courier New", monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 5px;
  font-size: 0.88em;
  color: #0f172a;
}

.hidden {
  display: none !important;
}

.app-shell {
  display: grid;
  grid-template-columns: 256px minmax(0, 1fr);
  grid-template-rows: 78px minmax(0, 1fr);
  height: 100vh;
}

/* Top Header */
.top-header {
  grid-column: 1 / 3;
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 0 22px;
  color: #ffffff;
  background: linear-gradient(90deg, #082f74 0%, #0d45a6 55%, #1556c2 100%);
  box-shadow: 0 2px 8px rgba(8, 47, 116, 0.25);
  z-index: 20;
}

.brand-area {
  display: flex;
  align-items: center;
  gap: 11px;
  min-width: 215px;
  cursor: pointer;
}

.brand-area svg {
  width: 40px;
  height: 46px;
  flex-shrink: 0;
}

.org-full {
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.org-mob {
  display: none;
}

.header-divider {
  width: 1px;
  height: 42px;
  background: rgba(255, 255, 255, 0.28);
}

.header-title h1 {
  margin: 0;
  font-size: 24px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}

.header-sub {
  font-size: 13px;
  opacity: 0.92;
}

.header-sub code {
  background: rgba(255, 255, 255, 0.16);
  color: #ffffff;
}

.ai-pill {
  font-size: 13px;
  font-weight: 700;
  background: #2a7bf0;
  border: 2px solid #82b6ff;
  border-radius: 999px;
  padding: 0 10px;
  line-height: 22px;
  color: #fff;
}

.header-tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 14px;
}

.btn-header-upload {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  padding: 7px 13px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 13.5px;
}

.btn-header-upload:hover {
  background: rgba(255, 255, 255, 0.26);
}

.icon-btn {
  position: relative;
  background: none;
  border: 0;
  color: #ffffff;
  padding: 5px;
  display: flex;
}

.icon-btn svg {
  width: 24px;
  height: 24px;
}

.bell-dot {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: #ff4d4f;
  border: 2px solid #0d45a6;
}

.profile-select {
  background: rgba(255, 255, 255, 0.14);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 10px;
  padding: 6px 10px;
  font-size: 13.5px;
  font-weight: 600;
  max-width: 220px;
}

.profile-select option {
  color: #13233d;
  background: #ffffff;
}

/* Desktop Sidebar */
.sidebar {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 14px 10px;
  background: linear-gradient(180deg, #0c3f98 0%, #0e4cb0 62%, #1257c0 100%);
}

.side-nav {
  display: flex;
  flex-direction: column;
  gap: 4px;
  position: relative;
  z-index: 2;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  border: 0;
  background: transparent;
  color: #e6eefc;
  padding: 10px 13px;
  border-radius: 10px;
  font-size: 15px;
  text-align: left;
  transition: background 0.14s;
}

.nav-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.nav-btn.active {
  background: linear-gradient(90deg, #2b7cf0, #1f6be0);
  color: #ffffff;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(0, 30, 90, 0.3);
}

.nav-btn svg {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.nav-badge {
  margin-left: auto;
  background: rgba(255, 255, 255, 0.22);
  color: #fff;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 7px;
  border-radius: 999px;
}

.nav-badge.alert {
  background: #ef4444;
}

.sidebar-art {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 220px;
  pointer-events: none;
  opacity: 0.9;
}

.sidebar-art svg {
  width: 100%;
  height: 100%;
  display: block;
}

.sidebar-art:before {
  content: "";
  position: absolute;
  inset: 0 0 45% 0;
  background: linear-gradient(180deg, #0f51b8, rgba(15, 81, 184, 0));
  z-index: 1;
}

.sidebar-status-box {
  position: relative;
  z-index: 2;
  margin-top: auto;
  background: rgba(8, 30, 75, 0.58);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 10px;
  padding: 10px;
  color: #e2e8f0;
  font-size: 12px;
}

.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e;
  margin-right: 6px;
}

.status-dot.offline {
  background: #f59e0b;
}

/* Main View */
.main-view {
  overflow-y: auto;
  padding: 16px 20px 30px;
  min-width: 0;
}

.tab-brand-bar {
  background: linear-gradient(90deg, #082f74 0%, #0d45a6 55%, #1556c2 100%);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  padding: 13px 20px;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.tab-brand-title {
  font-size: 20px;
  font-weight: 700;
  color: #ffffff;
  line-height: 1.25;
}

.tab-brand-sub {
  margin-top: 3px;
  font-size: 13.5px;
  color: rgba(255, 255, 255, 0.92);
  line-height: 1.4;
}

.card {
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow);
}

.card-h {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px 8px;
  flex-wrap: wrap;
}

.card-h h3 {
  margin: 0;
  font-size: 17px;
  font-weight: 700;
}

.card-h .more {
  margin-left: auto;
  background: none;
  border: 0;
  color: var(--blue);
  font-size: 13.5px;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 0;
}

.card-body {
  padding: 10px 18px 16px;
}

.muted-text {
  color: var(--muted);
  font-size: 13px;
}

/* Onboarding Banner */
.onboarding-strip {
  background: linear-gradient(135deg, #e8f1ff, #f8fafd);
  border: 1px solid #bcd4f8;
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.onboarding-strip h3 {
  margin: 0 0 3px;
  color: var(--navy);
  font-size: 16px;
}

.onboarding-strip p {
  margin: 0;
  font-size: 13.5px;
  color: #33415a;
}

/* Hero Banner */
.hero {
  position: relative;
  min-height: 124px;
  background: #0a3a8a;
  border-radius: 14px;
  overflow: hidden;
  margin-bottom: 14px;
  box-shadow: var(--shadow);
}

.hero.hero-clean {
  display: flex;
  align-items: center;
}

.hero.hero-clean p {
  max-width: 680px;
}

.hero svg.scene {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: 64%;
  height: 100%;
}

.hero .shade {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #082f74 0%, #0a3a8a 38%, rgba(13, 69, 166, 0.55) 55%, rgba(13, 69, 166, 0) 75%);
}

.hero .txt {
  position: relative;
  color: #ffffff;
  padding: 16px 28px;
  z-index: 2;
}

.hero .hi {
  font-size: 17px;
  font-weight: 600;
}

.hero h2 {
  margin: 2px 0 6px;
  font-size: 30px;
  font-weight: 700;
}

.hero p {
  margin: 0;
  font-size: 14.5px;
  opacity: 0.95;
  max-width: 560px;
}

/* 6 Shortcut Tiles */
.tiles {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 11px;
  margin-bottom: 14px;
}

.tile {
  border: 0;
  border-radius: 14px;
  padding: 13px 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 7px;
  font-size: 15px;
  font-weight: 600;
  line-height: 1.25;
  text-align: center;
  min-height: 98px;
  transition: transform 0.12s;
}

.tile:hover {
  transform: translateY(-2px);
}

.tile svg {
  width: 40px;
  height: 40px;
}

.t-purple { background: var(--purple-bg); }
.t-green  { background: var(--green-bg); }
.t-blue   { background: var(--blue-bg); }
.t-orange { background: var(--orange-bg); }
.t-lav    { background: #ecebfb; }
.t-sky    { background: #e3effc; }

/* Dashboard Mid Grid: 12 Folders + Inline AI Chat */
.mid-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.42fr) minmax(0, 1fr);
  gap: 14px;
  margin-bottom: 14px;
}

.folders-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
  padding: 8px 16px 16px;
}

.folders-grid.big {
  grid-template-columns: repeat(auto-fill, minmax(245px, 1fr));
  gap: 10px;
  padding: 16px;
}

.folder-card {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 1px solid var(--line);
  background: #ffffff;
  border-radius: 10px;
  padding: 8px 10px;
  text-align: left;
  min-height: 54px;
  transition: border-color 0.14s, background 0.14s;
}

.folder-card:hover {
  border-color: #93c5fd;
  background: #f5f9ff;
}

.folder-card.active {
  border-color: var(--blue);
  background: #e8f1ff;
}

.folder-card.locked {
  opacity: 0.55;
}

.folder-card svg {
  width: 34px;
  height: 28px;
  flex-shrink: 0;
}

.folder-card .fname {
  font-size: 13.5px;
  font-weight: 600;
  line-height: 1.25;
}

.folder-card .fmeta {
  font-size: 12px;
  color: var(--muted);
}

/* Inline Chat Card */
.chatcard {
  display: flex;
  flex-direction: column;
}

.ai-circle {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: var(--blue);
  color: #ffffff;
  font-weight: 700;
  font-size: 12.5px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.model-chip {
  margin-left: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 3px 10px;
  font-size: 12px;
  font-weight: 600;
  background: #f8fafd;
  color: var(--navy);
}

.assist-row {
  display: flex;
  gap: 10px;
  align-items: center;
  padding: 6px 16px 0;
  flex: 1;
}

.robot {
  width: 80px;
  flex-shrink: 0;
}

.bubble-help {
  flex: 1;
  background: #eaf2fe;
  border-radius: 14px;
  padding: 10px 14px;
  font-size: 13.5px;
}

.bubble-help ul {
  list-style: none;
  margin: 5px 0 0;
  padding: 0;
}

.bubble-help li {
  display: flex;
  gap: 7px;
  align-items: center;
  margin: 4px 0;
}

.chk {
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--green);
  flex-shrink: 0;
  display: grid;
  place-items: center;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
}

.quick-ask-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid #cdd8e8;
  border-radius: 999px;
  margin: 12px 16px 15px;
  padding: 4px 5px 4px 12px;
  background: #ffffff;
}

.quick-ask-bar input {
  flex: 1;
  border: 0;
  outline: 0;
  padding: 7px 4px;
  min-width: 0;
}

.btn-send-round {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 0;
  background: var(--blue);
  color: #ffffff;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}

.mic-btn {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  border: 1px solid #dbe4f0;
  background: #f8fafc;
  color: var(--navy);
  display: grid;
  place-items: center;
  font-size: 16px;
  flex-shrink: 0;
  transition: all 0.16s ease;
}

.mic-btn:hover {
  background: #eff6ff;
  border-color: #93c5fd;
}

.mic-btn.recording {
  background: #dc2626;
  border-color: #dc2626;
  color: #ffffff;
  animation: micPulse 1.2s ease-in-out infinite;
}

@keyframes micPulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(220, 38, 38, 0.45); }
  50% { box-shadow: 0 0 0 8px rgba(220, 38, 38, 0); }
}

.ai-status-box {
  padding: 10px 12px;
  border-radius: 10px;
  font-size: 13px;
  border: 1px solid var(--line);
  background: #f8fafc;
}

.ai-status-box.ok {
  background: #ecfdf5;
  border-color: #a7f3d0;
  color: #065f46;
}

.ai-status-box.err {
  background: #fef2f2;
  border-color: #fecaca;
  color: #991b1b;
}

.empty-kho-cta {
  display: flex;
  flex-direction: column;
  gap: 10px;
  background: linear-gradient(135deg, #f8fbff, #f0f9ff);
  border: 1px dashed #93c5fd;
}

/* ==================== PHASE 2: AUTH LOGIN & MAKER-CHECKER WORKFLOW ==================== */
.auth-user-bar {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.auth-user-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border-radius: 999px;
  padding: 5px 12px;
  font-size: 12.5px;
  font-weight: 700;
  white-space: nowrap;
  max-width: 210px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.btn-header-auth {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.14);
  border: 1px solid rgba(255, 255, 255, 0.28);
  color: #ffffff;
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.btn-header-auth:hover {
  background: rgba(255, 255, 255, 0.26);
}

.btn-header-auth.logout:hover {
  background: rgba(239, 68, 68, 0.85);
  border-color: rgba(254, 202, 202, 0.6);
}

.login-overlay {
  position: fixed;
  inset: 0;
  z-index: 320;
  background: radial-gradient(circle at 20% 20%, #1d4ed8 0%, #0f295c 55%, #091836 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 18px;
}

.login-overlay.hidden {
  display: none;
}

.login-card {
  width: 100%;
  max-width: 440px;
  background: #ffffff;
  border-radius: 18px;
  padding: 28px 28px 22px;
  box-shadow: 0 24px 60px rgba(3, 12, 34, 0.45);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.login-brand svg {
  width: 40px;
  height: 48px;
  flex-shrink: 0;
}

.login-org {
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.05em;
  color: var(--blue);
}

.login-card h2 {
  margin: 2px 0 0;
  font-size: 18px;
  color: var(--navy);
}

.login-sub {
  margin: 0 0 16px;
  font-size: 13px;
  color: var(--muted);
  line-height: 1.5;
}

.login-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  border-radius: 9px;
  padding: 8px 11px;
  font-size: 13px;
  font-weight: 600;
}

.login-foot {
  margin-top: 16px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
  text-align: center;
  font-size: 11.8px;
  color: var(--muted);
}

.wf-progress-strip {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.wf-stat-box {
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 3px solid #2563eb;
  border-radius: 12px;
  padding: 12px 14px;
  text-align: center;
  box-shadow: var(--shadow);
}

.wf-stat-box.good { border-top-color: #16a34a; background: #f5fdf8; }
.wf-stat-box.warn { border-top-color: #f59e0b; background: #fffdf5; }
.wf-stat-box.alert { border-top-color: #dc2626; background: #fff7f7; }

.wf-stat-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
}

.wf-stat-val {
  font-size: 22px;
  font-weight: 800;
  color: var(--navy);
  margin: 3px 0 2px;
  font-variant-numeric: tabular-nums;
}

.wf-entry-table {
  width: 100%;
  min-width: 960px;
  border-collapse: collapse;
  font-size: 12.8px;
  font-variant-numeric: tabular-nums;
}

.wf-entry-table th {
  background: #f1f5f9;
  color: var(--navy);
  font-weight: 700;
  font-size: 12px;
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1.5px solid var(--line-strong);
  border-right: 1px solid #e2e8f0;
  line-height: 1.3;
}

.wf-entry-table th:last-child,
.wf-entry-table td:last-child {
  border-right: 0;
}

.wf-entry-table td {
  padding: 8px 6px;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
  text-align: center;
}

.wf-entry-table td.unit-col {
  text-align: left;
  padding-left: 10px;
  white-space: nowrap;
}

.wf-entry-table tr.row-missing {
  background: #fafafa;
}

.wf-entry-table tr.row-returned {
  background: #fff7ed;
}

.wf-entry-table tr.row-synced {
  background: #f5fdf8;
}

.wf-input {
  width: 100%;
  min-width: 78px;
  padding: 6px 7px;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  background: #ffffff;
  color: var(--navy);
  font-variant-numeric: tabular-nums;
}

.wf-input:focus {
  outline: none;
  border-color: var(--blue);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.14);
}

.wf-input:disabled {
  background: #f1f5f9;
  color: #64748b;
  cursor: not-allowed;
}

.wf-input.note-in {
  min-width: 120px;
  text-align: left;
  font-weight: 400;
  font-size: 12.2px;
}

.wf-prev-hint {
  font-size: 11px;
  color: #64748b;
  margin-top: 3px;
  white-space: nowrap;
}

.wf-warn-tag {
  display: inline-block;
  margin-top: 3px;
  padding: 2px 6px;
  border-radius: 6px;
  background: #fef2f2;
  color: #b91c1c;
  font-size: 10.8px;
  font-weight: 600;
}

.wf-sync-box {
  background: linear-gradient(135deg, #eff6ff 0%, #f0fdf4 100%);
  border: 1.5px solid #93c5fd;
  border-radius: 14px;
  padding: 16px 18px;
  margin-top: 14px;
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 14px;
  flex-wrap: wrap;
}

.wf-sync-fields {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 260px;
}

.wf-sync-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.wf-return-banner {
  background: #fff7ed;
  border: 1px solid #fdba74;
  color: #9a3412;
  border-radius: 12px;
  padding: 11px 15px;
  margin-bottom: 14px;
  font-size: 13.5px;
}

.pill-badge.missing {
  background: #f1f5f9;
  color: #475569;
  border: 1px solid #cbd5e1;
}

.pill-badge.info {
  background: #eff6ff;
  color: #1d4ed8;
  border: 1px solid #bfdbfe;
}

@media (max-width: 900px) {
  .auth-user-pill {
    background: #eff6ff;
    color: var(--navy);
    border-color: #bfdbfe;
    max-width: 110px;
    font-size: 11.5px;
    padding: 4px 8px;
  }
  .btn-header-auth {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--line-strong);
    padding: 5px 7px;
  }
  .btn-header-auth .d-label { display: none; }
  .wf-progress-strip { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* ==================== SXKD EXECUTIVE COMMAND CENTER ==================== */
.sxkd-main-tabs {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px;
  background: #e2e8f0;
  border-radius: 13px;
  margin-bottom: 14px;
  width: fit-content;
  max-width: 100%;
  flex-wrap: wrap;
}

.sxkd-main-tab {
  border: 0;
  background: transparent;
  color: #334155;
  font-size: 13.5px;
  font-weight: 700;
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.16s ease;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.sxkd-main-tab:hover {
  color: var(--navy);
  background: rgba(255, 255, 255, 0.55);
}

.sxkd-main-tab.active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 2px 8px rgba(15, 41, 92, 0.14);
}

.sxkd-branch-select {
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid var(--line-strong);
  background: #ffffff;
  font-size: 12.2px;
  font-weight: 600;
  color: var(--navy);
  max-width: 210px;
}

.sxkd-matrix-table {
  width: 100%;
  min-width: 1040px;
  border-collapse: collapse;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}

.sxkd-matrix-table th {
  background: #f1f5f9;
  color: var(--navy);
  font-weight: 700;
  font-size: 11.5px;
  padding: 8px 4px;
  text-align: center;
  border-bottom: 1.5px solid var(--line-strong);
  border-right: 1px solid #e2e8f0;
  white-space: nowrap;
}

.sxkd-matrix-table td {
  padding: 7px 4px;
  text-align: center;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  white-space: nowrap;
}

.sxkd-matrix-table th:last-child,
.sxkd-matrix-table td:last-child {
  border-right: 0;
}

.sxkd-matrix-table th.sticky-col,
.sxkd-matrix-table td.sticky-col {
  position: sticky;
  left: 0;
  z-index: 2;
  background: #ffffff;
  text-align: left;
  padding-left: 10px;
  padding-right: 8px;
  border-right: 1.5px solid #cbd5e1;
  min-width: 138px;
}

.sxkd-matrix-table th.sticky-col {
  background: #f1f5f9;
  text-align: center;
  z-index: 3;
}

.sxkd-matrix-table tbody tr:nth-child(even) td {
  background: #fafcff;
}

.sxkd-matrix-table tbody tr:nth-child(even) td.sticky-col {
  background: #fafcff;
}

.sxkd-matrix-table tbody tr:hover td,
.sxkd-matrix-table tbody tr:hover td.sticky-col {
  background: #eff6ff;
}

.sxkd-matrix-table td.cell-alert {
  background: #fef2f2 !important;
  color: #b91c1c;
  font-weight: 700;
}

.sxkd-matrix-table td.cell-warn {
  background: #fffbeb !important;
  color: #b45309;
  font-weight: 600;
}

.sxkd-matrix-table td.cell-good {
  background: #f0fdf4 !important;
  color: #15803d;
  font-weight: 600;
}

.sxkd-matrix-table td.cell-ytd {
  background: #f8fafc;
  font-weight: 800;
  color: var(--navy);
  border-left: 1.5px solid #cbd5e1;
}

.sxkd-matrix-table tfoot td,
.sxkd-matrix-table tfoot td.sticky-col {
  background: #eff6ff !important;
  color: var(--navy);
  font-weight: 800;
  border-top: 1.5px solid #bfdbfe;
  padding: 9px 4px;
}

.yoy-pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 7px;
  border-radius: 999px;
  font-size: 11.2px;
  font-weight: 700;
  white-space: nowrap;
}

.yoy-pill.up {
  background: #dcfce7;
  color: #15803d;
}

.yoy-pill.down {
  background: #fee2e2;
  color: #b91c1c;
}

.yoy-pill.flat {
  background: #f1f5f9;
  color: #475569;
}

.sxkd-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}

.sxkd-period-group {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.sxkd-period-select {
  padding: 7px 12px;
  border-radius: 10px;
  border: 1.5px solid var(--line-strong);
  background: #ffffff;
  font-weight: 700;
  color: var(--navy);
  min-width: 170px;
}

.sxkd-report-banner {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-radius: 12px;
  background: linear-gradient(180deg, #ffffff 0%, #f8fbff 100%);
  border: 1px solid #cbd5e1;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.sxkd-banner-spacer {
  min-width: 0;
}

.sxkd-report-banner-title {
  margin: 0;
  font-size: 18px;
  font-weight: 800;
  letter-spacing: 0.02em;
  color: var(--navy);
  text-align: center;
}

.sxkd-report-banner-meta {
  display: flex;
  align-items: center;
  justify-self: end;
  gap: 8px;
  flex-wrap: wrap;
}

.sxkd-kpi-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 14px;
  align-items: stretch;
}

.sxkd-kpi-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-top: 3px solid #2563eb;
  border-radius: 14px;
  padding: 13px 10px;
  box-shadow: var(--shadow);
  display: grid;
  grid-template-rows: 36px auto 1fr auto;
  justify-items: center;
  align-items: center;
  text-align: center;
  row-gap: 5px;
}

.sxkd-kpi-card.tone-alert {
  background: #fff7f7;
  border-color: #fecaca;
  border-top-color: #dc2626;
}

.sxkd-kpi-card.tone-good {
  background: #f5fdf8;
  border-color: #bbf7d0;
  border-top-color: #16a34a;
}

.sxkd-kpi-label {
  font-size: clamp(11px, 0.84vw, 12.2px);
  font-weight: 700;
  color: #334155;
  line-height: 1.35;
  height: 36px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.sxkd-kpi-label > span {
  white-space: nowrap;
}

.sxkd-kpi-val {
  font-size: clamp(19px, 1.75vw, 24px);
  font-weight: 800;
  color: var(--navy);
  line-height: 1.2;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.sxkd-kpi-unit {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--muted);
}

.sxkd-kpi-sub {
  font-size: 11.4px;
  color: var(--muted);
  line-height: 1.35;
  font-variant-numeric: tabular-nums;
}

.sxkd-kpi-sub.compact-dots {
  font-size: 11px;
  letter-spacing: -0.01em;
}

.sxkd-kpi-sub.up { color: var(--green); font-weight: 600; }
.sxkd-kpi-sub.down { color: var(--red); font-weight: 600; }

.sxkd-insights-panel {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  margin-bottom: 14px;
}

.sxkd-insights-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sxkd-insights-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.sxkd-insight-item {
  border-radius: 11px;
  padding: 11px 13px;
  border: 1px solid var(--line);
  background: #f8fafc;
  font-size: 13.5px;
  line-height: 1.55;
}

.sxkd-insight-item.good  { background: #f0fdf4; border-color: #bbf7d0; color: #14532d; }
.sxkd-insight-item.alert { background: #fef2f2; border-color: #fecaca; color: #7f1d1d; }
.sxkd-insight-item.warn  { background: #fffbeb; border-color: #fde68a; color: #78350f; }
.sxkd-insight-item.info  { background: #eff6ff; border-color: #bfdbfe; color: #1e3a8a; }

.sxkd-insight-title {
  font-weight: 700;
  margin-bottom: 3px;
}

.sxkd-charts-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 14px;
  width: 100%;
  max-width: 100%;
}

.sxkd-chart-card {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 14px 16px;
  box-shadow: var(--shadow);
  display: flex;
  flex-direction: column;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
}

.sxkd-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
}

.sxkd-chart-head h3 {
  margin: 0;
  font-size: 15px;
  color: var(--navy);
}

.seg-group {
  display: inline-flex;
  background: #f1f5f9;
  border-radius: 9px;
  padding: 2px;
  gap: 2px;
}

.seg-btn {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  padding: 4px 9px;
  border-radius: 7px;
}

.seg-btn.active {
  background: #ffffff;
  color: var(--navy);
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.1);
}

.chart-box {
  position: relative;
  width: 100%;
  max-width: 100%;
  min-width: 0;
  height: 360px;
  overflow: hidden;
}

.chart-box.compact {
  height: 310px;
}

.chart-box.matrix-box {
  height: 340px;
}

.matrix-quad-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 10px;
  justify-content: center;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px dashed #e2e8f0;
}

.mq-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.mq-chip.alert { color: #b91c1c; background: #fef2f2; border-color: #fecaca; }
.mq-chip.warn { color: #b45309; background: #fffbeb; border-color: #fde68a; }
.mq-chip.good { color: #15803d; background: #f0fdf4; border-color: #bbf7d0; }
.mq-chip.info { color: #1d4ed8; background: #eff6ff; border-color: #bfdbfe; }

.plants-split {
  display: grid;
  grid-template-columns: minmax(185px, 212px) minmax(0, 1fr);
  gap: 14px;
  align-items: center;
  min-height: 295px;
  min-width: 0;
}

.plant-donut-wrap {
  position: relative;
  height: 245px;
  min-width: 0;
}

.plant-bars-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.plant-bar-card {
  border: 1px solid var(--line);
  border-radius: 11px;
  padding: 10px 12px;
  background: #f8fafd;
  min-width: 0;
}

.plant-bar-top {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 4px 8px;
  font-size: 13px;
  font-weight: 700;
  color: var(--navy);
}

.plant-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
  margin: 6px 0 5px;
}

.plant-fill {
  height: 100%;
  border-radius: 999px;
}

.sxkd-data-table {
  width: 100%;
  min-width: 900px;
  table-layout: fixed;
  border-collapse: collapse;
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}

.sxkd-data-table th {
  background: #f1f5f9;
  color: var(--navy);
  font-weight: 700;
  font-size: 12.2px;
  padding: 10px 6px;
  text-align: center;
  border-bottom: 1.5px solid var(--line-strong);
  border-right: 1px solid #e2e8f0;
  white-space: normal;
  line-height: 1.32;
  vertical-align: middle;
  cursor: pointer;
}

.sxkd-data-table th:last-child,
.sxkd-data-table td:last-child {
  border-right: 0;
}

.sxkd-data-table th.num {
  text-align: center;
  white-space: normal;
}

.sxkd-data-table td.num {
  text-align: center;
  white-space: nowrap;
}

.sxkd-data-table td {
  padding: 9px 6px;
  text-align: center;
  border-bottom: 1px solid #eef2f7;
  border-right: 1px solid #f1f5f9;
  vertical-align: middle;
}

.sxkd-data-table.plant-table {
  font-size: 12.6px;
}

.sxkd-data-table.plant-table th,
.sxkd-data-table.plant-table td {
  padding: 9px 5px;
}

.sxkd-data-table td.branch-col {
  text-align: left;
  padding-left: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sxkd-data-table td.region-col {
  font-size: 12.2px;
  color: var(--muted);
  text-align: center;
  white-space: nowrap;
}

.sxkd-data-table td.status-col {
  text-align: center;
  white-space: nowrap;
}

.sxkd-data-table .pill-badge {
  font-size: 11.5px;
  padding: 2px 8px;
}

.sxkd-data-table tbody tr:nth-child(even) {
  background: #fafcff;
}

.sxkd-data-table tbody tr:hover {
  background: #eff6ff;
}

.sxkd-data-table tfoot td {
  font-weight: 700;
  text-align: center;
  padding: 10px 6px;
  background: #eff6ff;
  color: var(--navy);
  border-top: 1.5px solid #bfdbfe;
  border-right: 1px solid #dbeafe;
}

.sxkd-edit-grid {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.sxkd-edit-grid th {
  background: #f1f5f9;
  padding: 7px 6px;
  text-align: left;
  font-size: 12px;
  color: var(--navy);
  position: sticky;
  top: 0;
}

.sxkd-edit-grid td {
  padding: 5px 5px;
  border-bottom: 1px solid #eef2f7;
}

.sxkd-edit-grid input {
  width: 100%;
  padding: 5px 7px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  font-size: 13px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1240px) {
  .sxkd-kpi-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .sxkd-charts-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  .sxkd-report-banner { grid-template-columns: 1fr; justify-items: center; }
  .sxkd-banner-spacer { display: none; }
  .sxkd-report-banner-meta { justify-self: center; }
  .sxkd-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sxkd-insights-grid { grid-template-columns: 1fr; }
  .plants-split { grid-template-columns: 1fr; }
  .chart-box { height: 320px; }
}

/* Dashboard Bottom 2-Column Grid (Tasks + Recent Documents) */
.bottom-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}

.task-mini-row {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 13.5px;
}

.task-mini-row:last-child {
  border-bottom: 0;
}

.date-pill {
  margin-left: auto;
  background: var(--red-bg);
  color: var(--red);
  font-size: 12px;
  font-weight: 700;
  border-radius: 6px;
  padding: 1px 8px;
  white-space: nowrap;
}

.kpis-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  padding: 6px 10px 10px;
}

.kpi-cell {
  padding: 6px 8px;
  border-left: 1px solid var(--line);
}

.kpi-cell:first-child {
  border-left: 0;
}

.kpi-cell .k-label {
  font-size: 12px;
  color: var(--muted);
}

.kpi-cell .k-val {
  font-size: 20px;
  font-weight: 700;
  color: var(--navy);
  margin: 3px 0 2px;
}

.kpi-cell .k-delta {
  font-size: 12px;
  font-weight: 600;
}

.k-delta.up { color: var(--green); }
.k-delta.down { color: var(--orange); }
.k-delta.flat { color: var(--muted); }

.doc-mini-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 7px 0;
  border: 0;
  border-bottom: 1px solid #f1f5f9;
  background: none;
  text-align: left;
  width: 100%;
}

.doc-mini-row:last-child {
  border-bottom: 0;
}

.ext-badge {
  font-size: 10px;
  font-weight: 700;
  border-radius: 4px;
  padding: 2px 5px;
  color: #fff;
  background: var(--red);
  margin-top: 2px;
  flex-shrink: 0;
}

.ext-badge.img { background: #7c3aed; }
.ext-badge.doc { background: #1d4ed8; }
.ext-badge.xls { background: #047857; }

/* Buttons & Form Controls */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: 9px;
  font-size: 13.5px;
  font-weight: 600;
  border: 1px solid transparent;
  transition: all 0.14s;
  text-decoration: none;
}

.btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--blue);
  color: #ffffff;
}

.btn-primary:hover:not(:disabled) {
  background: #175bc2;
}

.btn-secondary {
  background: #e2e8f0;
  color: var(--text);
}

.btn-secondary:hover:not(:disabled) {
  background: #cbd5e1;
}

.btn-outline {
  background: #ffffff;
  color: var(--text);
  border-color: var(--line-strong);
}

.btn-outline:hover:not(:disabled) {
  background: #f5f9ff;
}

.btn-warn {
  background: #fff7ed;
  color: #9a3412;
  border-color: #fed7aa;
}

.btn-danger {
  background: var(--red-bg);
  color: var(--red);
  border-color: #fecaca;
}

.btn-sm {
  padding: 5px 10px;
  font-size: 12.5px;
  border-radius: 7px;
}

.input-field,
.select-field,
.textarea-field {
  width: 100%;
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 8px 11px;
  background: #ffffff;
  font-size: 14px;
}

.input-search {
  border: 1px solid var(--line-strong);
  border-radius: 9px;
  padding: 7px 12px;
  min-width: 220px;
  background: #fff;
}

.page-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.page-header h2 {
  margin: 0;
  font-size: 21px;
}

.page-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

/* Full Chat Workspace */
.chat-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 310px;
  gap: 14px;
  height: calc(100vh - 236px);
  min-height: 410px;
}

.chat-thread {
  display: flex;
  flex-direction: column;
  min-height: 0;
  overflow: hidden;
}

.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.msg-wrap {
  max-width: 860px;
  margin: 0 auto 16px;
}

.msg-user {
  margin-left: auto;
  width: fit-content;
  max-width: 82%;
  background: var(--blue);
  color: #ffffff;
  border-radius: 16px 16px 4px 16px;
  padding: 10px 14px;
  font-size: 14.5px;
}

.msg-ai-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.msg-ai-body {
  flex: 1;
  min-width: 0;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 4px 16px 16px 16px;
  padding: 14px 16px;
  box-shadow: 0 1px 4px rgba(16, 42, 90, 0.05);
}

.ans-md {
  color: #1e293b;
  font-size: 14.8px;
  line-height: 1.68;
}

.ans-md p {
  margin: 0 0 10px;
  max-width: none;
}

.ans-md h3 {
  margin: 20px 0 8px;
  font-size: 15.5px;
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
  border-bottom: 1.5px solid #e2e8f0;
  padding-bottom: 5px;
}

.ans-md h3:first-child {
  margin-top: 0;
}

.ans-md ul, .ans-md ol {
  margin: 6px 0 12px 20px;
  padding: 0;
  max-width: none;
}

.ans-md li {
  margin-bottom: 7px;
  padding-left: 2px;
}

.ans-md li strong {
  color: #0f172a;
}

.md-table-wrap {
  width: 100%;
  overflow-x: auto;
  margin: 12px 0 16px;
  border: 1px solid var(--line-strong);
  border-radius: 10px;
  background: #ffffff;
}

.ans-md table {
  width: 100%;
  border-collapse: collapse;
  margin: 0;
  font-size: 13.5px;
  line-height: 1.55;
}

.ans-md th {
  background: #f1f5f9;
  color: var(--navy);
  font-weight: 700;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1.5px solid var(--line-strong);
  white-space: nowrap;
}

.ans-md td {
  padding: 9px 12px;
  border-bottom: 1px solid #eef2f7;
  vertical-align: top;
}

.ans-md tbody tr:nth-child(even) {
  background: #fafcff;
}

.ans-md tbody tr:last-child td {
  border-bottom: 0;
}

.ans-md blockquote {
  margin: 10px 0 12px;
  padding: 10px 14px;
  border: 1px solid #fde68a;
  background: #fffbeb;
  border-radius: 10px;
  font-size: 13.5px;
  color: #78350f;
}

.cite-chip {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: #dbeafe;
  color: #1e40af;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  margin: 0 2px;
}

.cite-chip:hover {
  background: #bfdbfe;
}

.ext-chip {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: #ccfbf1;
  color: #0f766e;
  font-size: 11.5px;
  font-weight: 700;
  padding: 1px 6px;
  border-radius: 6px;
  margin: 0 2px;
}

.ext-chip:hover {
  background: #99f6e4;
}

.followup-row {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}

.followup-btn {
  border: 1px dashed #93c5fd;
  background: #f8fafc;
  color: #1e3a8a;
  border-radius: 9px;
  padding: 5px 10px;
  font-size: 12.5px;
  text-align: left;
}

.followup-btn:hover {
  background: #eff6ff;
}

.hero-stats-strip {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 10px;
}

.hero-stat-pill {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #ffffff;
  border-radius: 999px;
  padding: 3px 11px;
  font-size: 12.5px;
  font-weight: 600;
}

.srcs-panel {
  padding: 14px;
  overflow-y: auto;
}

.src-item {
  width: 100%;
  text-align: left;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafd;
  padding: 9px 11px;
  margin-bottom: 8px;
}

.src-item:hover {
  border-color: var(--blue);
  background: #ffffff;
}

.chat-composer {
  border-top: 1px solid var(--line);
  padding: 10px 14px;
  background: #ffffff;
}

.domain-scope-row {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 8px;
}

.scope-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  padding: 3px 9px;
  border-radius: 999px;
  border: 1px solid var(--line-strong);
  background: #f8fafd;
  cursor: pointer;
}

.chat-input-box {
  display: flex;
  align-items: flex-end;
  gap: 8px;
  border: 1px solid #cbd5e1;
  border-radius: 18px;
  padding: 6px 8px 6px 14px;
}

.chat-input-box textarea {
  flex: 1;
  border: 0;
  outline: 0;
  resize: none;
  min-height: 24px;
  max-height: 110px;
  background: transparent;
}

/* Lists & Rows */
.list-stack {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.row-card {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 13px 15px;
  background: #ffffff;
}

.row-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  flex-wrap: wrap;
}

.pill-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 600;
  padding: 2px 9px;
  border-radius: 999px;
  background: var(--blue-bg);
  color: var(--navy);
}

.pill-badge.green { background: var(--green-bg); color: #166534; }
.pill-badge.warn  { background: var(--orange-bg); color: #9a3412; }
.pill-badge.red   { background: var(--red-bg); color: var(--red); }

.two-col-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 14px;
}

/* Upload Modal & Dual Zones */
.upload-dual-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 5px;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  padding: 16px 12px;
  text-align: center;
  cursor: pointer;
  background: #f5f9ff;
}

.dropzone.camera-zone {
  border-color: #34d399;
  background: #ecfdf5;
}

.dz-icon {
  font-size: 26px;
}

.selected-files-box {
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 13px;
}

/* Modals */
.modal {
  position: fixed;
  inset: 0;
  z-index: 250;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(10, 30, 70, 0.5);
}

.modal-card {
  position: relative;
  z-index: 1;
  background: #ffffff;
  border-radius: 16px;
  width: 100%;
  max-width: 600px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 18px 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
}

.sheet .sheet-card {
  max-width: 780px;
}

.sheet .sheet-card.eval-wide {
  max-width: 960px;
}

.eval-editor-section {
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 12px 14px;
  background: #f8fafd;
  margin-bottom: 12px;
}

.eval-edit-card {
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-left: 4px solid #1d4ed8;
  border-radius: 10px;
  padding: 11px 13px;
  margin-bottom: 10px;
}
.eval-edit-card.lvl-good  { border-left-color: #16a34a; }
.eval-edit-card.lvl-alert { border-left-color: #dc2626; }
.eval-edit-card.lvl-warn  { border-left-color: #d97706; }
.eval-edit-card.lvl-info  { border-left-color: #0284c7; }

.eval-edit-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.eval-grid-3 {
  display: grid;
  grid-template-columns: 1.4fr 1fr 0.9fr;
  gap: 8px;
  margin-bottom: 8px;
}
@media (max-width: 720px) {
  .eval-grid-3 { grid-template-columns: 1fr; }
}

.sheet-grab {
  display: none;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 12px;
}

.modal-header h3 {
  margin: 0;
  font-size: 17px;
}

.icon-close {
  border: 0;
  background: #f1f5f9;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  font-size: 15px;
}

.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 14px;
  flex-wrap: wrap;
}

.form-stack {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.form-group label {
  font-size: 13px;
  font-weight: 600;
}

.form-row-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.toggle-inline {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 13.5px;
  cursor: pointer;
}

.chunk-block {
  background: #f8fafd;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px 13px;
  margin-bottom: 8px;
}

.chunk-block pre {
  white-space: pre-wrap;
  font-family: inherit;
  margin: 5px 0 0;
  font-size: 13.5px;
  line-height: 1.55;
}

/* Mobile List & Bottom Tab Bar */
.m-only {
  display: none;
}

.mobile-tabbar {
  display: none;
}

.mobile-action-row {
  display: flex;
  align-items: center;
  gap: 13px;
  width: 100%;
  border: 0;
  border-bottom: 1px solid #eef2f7;
  background: #fff;
  padding: 13px 16px;
  font-size: 16px;
  font-weight: 500;
  text-align: left;
}

.mobile-action-row:last-child {
  border-bottom: 0;
}

.toast-container {
  position: fixed;
  bottom: 76px;
  right: 18px;
  z-index: 290;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  background: #0f172a;
  color: #fff;
  padding: 10px 15px;
  border-radius: 10px;
  font-size: 13.5px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  max-width: 360px;
}

.toast.success { background: #047857; }
.toast.error   { background: #b91c1c; }

/* Phụ lục 01 13-Criteria Table & Unit Detail Drill-Down */
.phuluc-table tr.is-parent-row {
  background: #f8fbff;
}
.phuluc-table tr.is-sub-row td:nth-child(2) {
  padding-left: 24px;
  color: #334155;
  font-weight: 500;
}
.phuluc-table td.crit-tt {
  text-align: center;
  font-weight: 700;
  color: var(--navy);
}
.phuluc-table td.crit-name {
  text-align: left;
  color: #0f172a;
}
.branch-link-btn {
  border: 0;
  background: transparent;
  padding: 0;
  color: var(--navy);
  font-weight: 700;
  font-size: inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
}
.branch-link-btn:hover {
  color: var(--blue);
  text-decoration: underline;
}
.branch-link-btn .drill-ico {
  font-size: 11px;
  opacity: 0.6;
}
.unit-pills-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 14px;
  padding: 10px 12px;
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 12px;
}
.unit-pill {
  border: 1px solid var(--line-strong);
  background: #f8fafd;
  color: #334155;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.14s ease;
}
.unit-pill:hover {
  border-color: var(--blue);
  background: #eff6ff;
  color: var(--navy);
}
.unit-pill.active {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}
.unit-pill.plant-pill {
  border-color: #c4b5fd;
  background: #faf5ff;
  color: #5b21b6;
}
.unit-pill.plant-pill.active {
  background: #6d28d9;
  color: #ffffff;
  border-color: #6d28d9;
}
.sxkd-charts-grid.two-up {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (max-width: 1024px) {
  .sxkd-charts-grid.two-up {
    grid-template-columns: 1fr;
  }
}

/* ==================== EXECUTIVE POLISH & TABULAR NUMBERS ==================== */
.sxkd-kpi-val,
.sxkd-data-table td.num,
.sxkd-data-table th.num,
.sxkd-matrix-table td,
.wf-stat-val {
  font-variant-numeric: tabular-nums;
}

.sxkd-kpi-card {
  position: relative;
  border-top: 3px solid var(--blue);
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
.sxkd-kpi-card:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 22px rgba(15, 41, 92, 0.08);
}
.sxkd-kpi-card.tone-good {
  border-top-color: #16a34a;
}
.sxkd-kpi-card.tone-alert {
  border-top-color: #dc2626;
}
.sxkd-kpi-exact {
  font-size: 11.5px;
  color: #475569;
  font-variant-numeric: tabular-nums;
  margin-top: 1px;
}

.sxkd-chart-card {
  border: 1px solid #dbe4f0;
  box-shadow: 0 2px 10px rgba(15, 41, 92, 0.04);
  transition: box-shadow 0.16s ease, border-color 0.16s ease;
}
.sxkd-chart-card:hover {
  border-color: #bfd2ec;
  box-shadow: 0 6px 20px rgba(15, 41, 92, 0.07);
}

.sxkd-data-table tbody tr:nth-child(even):not(.is-parent-row) {
  background: #fafcff;
}
.sxkd-data-table tbody tr:hover {
  background: #eff6ff !important;
}
.phuluc-table tr.is-parent-row {
  background: #eef5ff;
  border-top: 1.5px solid #cbd5e1;
}
.phuluc-table td.crit-vnd {
  font-weight: 700;
  color: var(--navy);
  letter-spacing: -0.01em;
}

/* Compact Workflow Tables so 1280px displays all columns without right-edge clipping */
.wf-entry-table th,
.wf-entry-table td {
  padding: 7px 6px !important;
  font-size: 12.5px;
}
.wf-entry-table .wf-input {
  padding: 5px 6px;
  font-size: 12.5px;
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}

/* ==================== FULLSCREEN PRESENTATION TRIGGER & OVERLAY ==================== */
.btn-present-trigger {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid #cbd5e1;
  background: #f8fafc;
  color: var(--navy);
  border-radius: 8px;
  padding: 4px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: all 0.14s ease;
}
.btn-present-trigger:hover {
  background: var(--navy);
  color: #ffffff;
  border-color: var(--navy);
}
.sxkd-head-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.present-overlay {
  position: fixed;
  inset: 0;
  z-index: 200;
  background: #0b162c;
  color: #f8fafc;
  display: flex;
  flex-direction: column;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
}
.present-overlay.hidden {
  display: none !important;
}
.present-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 12px 22px;
  background: linear-gradient(90deg, #0b1c3d 0%, #122d5e 100%);
  border-bottom: 1px solid rgba(148, 163, 184, 0.22);
  flex-shrink: 0;
}
.present-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.present-badge {
  background: rgba(56, 189, 248, 0.16);
  border: 1px solid rgba(56, 189, 248, 0.45);
  color: #7dd3fc;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  padding: 4px 10px;
  border-radius: 999px;
  white-space: nowrap;
}
.present-titles {
  min-width: 0;
}
.present-titles h2 {
  margin: 0;
  font-size: 18px;
  font-weight: 700;
  color: #ffffff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.present-sub {
  font-size: 12.5px;
  color: #cbd5e1;
  margin-top: 2px;
}
.present-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  flex-shrink: 0;
}
.present-counter {
  font-size: 13px;
  font-weight: 700;
  color: #93c5fd;
  padding: 0 6px;
  font-variant-numeric: tabular-nums;
}
.present-sep {
  width: 1px;
  height: 20px;
  background: rgba(148, 163, 184, 0.3);
  margin: 0 2px;
}
.present-btn {
  border: 1px solid rgba(203, 213, 225, 0.28);
  background: rgba(255, 255, 255, 0.09);
  color: #ffffff;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.14s ease, border-color 0.14s ease;
}
.present-btn:hover:not(:disabled) {
  background: rgba(59, 130, 246, 0.35);
  border-color: #60a5fa;
}
.present-btn:disabled {
  opacity: 0.38;
  cursor: not-allowed;
}
.present-btn.close {
  background: rgba(220, 38, 38, 0.22);
  border-color: rgba(248, 113, 113, 0.5);
  color: #fecaca;
}
.present-btn.close:hover {
  background: #dc2626;
  color: #ffffff;
}

.present-stage {
  flex: 1;
  min-height: 0;
  padding: 20px 28px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: auto;
  background: radial-gradient(circle at top, #132547 0%, #0b162c 100%);
}
.present-slide-card {
  background: #ffffff;
  color: #0f172a;
  border-radius: 16px;
  width: 100%;
  max-width: 1640px;
  padding: 22px 26px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.45);
  display: flex;
  flex-direction: column;
  min-height: 100%;
  overflow: auto;
}
.present-chart-wrap {
  flex: 1;
  position: relative;
  min-height: 520px;
  width: 100%;
}
.present-slide-card .sxkd-data-table th,
.present-slide-card .sxkd-data-table td,
.present-slide-card .sxkd-matrix-table th,
.present-slide-card .sxkd-matrix-table td {
  font-size: calc(14px * var(--present-zoom, 1));
  padding: 10px 12px;
}
.present-slide-card .sxkd-kpi-val {
  font-size: calc(28px * var(--present-zoom, 1));
}
.present-slide-card .sxkd-insight-item {
  font-size: calc(14.5px * var(--present-zoom, 1));
  padding: 14px 16px;
}
.present-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 9px 22px;
  background: #081224;
  border-top: 1px solid rgba(148, 163, 184, 0.18);
  flex-shrink: 0;
}
.present-dots {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.present-dot {
  border: 1px solid rgba(148, 163, 184, 0.35);
  background: rgba(255, 255, 255, 0.08);
  color: #cbd5e1;
  border-radius: 999px;
  padding: 4px 11px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}
.present-dot:hover {
  background: rgba(59, 130, 246, 0.3);
  color: #ffffff;
}
.present-dot.active {
  background: #2563eb;
  border-color: #60a5fa;
  color: #ffffff;
}
.present-hint {
  font-size: 12px;
  color: #94a3b8;
}

/* ==================== RICH 6-PILLAR EXECUTIVE EVALUATION & CEO DIRECTIVES ==================== */
.sxkd-insights-grid.rich-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}
@media (max-width: 980px) {
  .sxkd-insights-grid.rich-grid {
    grid-template-columns: 1fr;
  }
}
.sxkd-insight-item.rich-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 13px 15px;
  border-radius: 12px;
  border-left-width: 4px;
}
.insight-meta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.insight-tag {
  font-size: 10.5px;
  font-weight: 800;
  letter-spacing: 0.04em;
  color: #475569;
  text-transform: uppercase;
}
.insight-kpi-pill {
  font-size: 11.5px;
  font-weight: 700;
  padding: 2px 9px;
  border-radius: 999px;
  background: rgba(15, 41, 92, 0.09);
  color: var(--navy);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.sxkd-insight-item.good .insight-kpi-pill { background: rgba(22, 163, 74, 0.14); color: #166534; }
.sxkd-insight-item.warn .insight-kpi-pill { background: rgba(245, 158, 11, 0.18); color: #9a3412; }
.sxkd-insight-item.alert .insight-kpi-pill { background: rgba(220, 38, 38, 0.15); color: #b91c1c; }
.sxkd-insight-lead {
  font-size: 13px;
  color: #1e293b;
  line-height: 1.5;
  font-weight: 500;
}
.sxkd-insight-bullets {
  margin: 2px 0 0;
  padding-left: 17px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 12.5px;
  color: #334155;
  line-height: 1.48;
  font-variant-numeric: tabular-nums;
}
.sxkd-insight-bullets li::marker {
  color: var(--blue);
}

/* CEO Directives Strip inside Evaluation Panel */
.ceo-directives-box {
  margin-top: 14px;
  padding: 13px 16px;
  border-radius: 12px;
  background: linear-gradient(135deg, #f0f6ff 0%, #f8fafc 100%);
  border: 1px solid #bfdbfe;
}
.ceo-directives-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.ceo-directives-head strong {
  font-size: 14px;
  color: var(--navy);
}
.ceo-directives-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 980px) {
  .ceo-directives-grid {
    grid-template-columns: 1fr;
  }
}
.ceo-dir-card {
  background: #ffffff;
  border: 1px solid #dbe4f0;
  border-radius: 10px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.ceo-dir-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}
.ceo-dir-prio {
  font-size: 10.5px;
  font-weight: 800;
  padding: 2px 8px;
  border-radius: 999px;
  background: #fee2e2;
  color: #b91c1c;
  white-space: nowrap;
}
.ceo-dir-prio.p2 { background: #ffedd5; color: #9a3412; }
.ceo-dir-prio.p3 { background: #dbeafe; color: #1d4ed8; }
.ceo-dir-owner {
  font-size: 12px;
  font-weight: 700;
  color: var(--navy);
}
.ceo-dir-target {
  font-size: 12px;
  font-weight: 600;
  color: #0f766e;
  font-variant-numeric: tabular-nums;
}
.ceo-dir-action {
  font-size: 12.5px;
  color: #334155;
  line-height: 1.45;
}

/* Presentation Mode: rich 3-column or spacious 2-column executive slide */
.present-slide-card .sxkd-insights-grid.rich-grid {
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
}
.present-slide-card .sxkd-insight-item.rich-card {
  padding: 14px 16px;
}
.present-slide-card .sxkd-insight-lead {
  font-size: calc(13.5px * var(--present-zoom, 1));
}
.present-slide-card .sxkd-insight-bullets {
  font-size: calc(13px * var(--present-zoom, 1));
}
.present-slide-card .ceo-directives-grid {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.present-slide-card .ceo-dir-action,
.present-slide-card .ceo-dir-target {
  font-size: calc(13px * var(--present-zoom, 1));
}

/* Presentation Slide 1: 3 Executive KPI Visual Charts filling the stage cleanly */
.present-kpi-charts-grid {
  margin-top: 16px;
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 14px;
  flex: 1;
  min-height: 360px;
}
@media (max-width: 1100px) {
  .present-kpi-charts-grid {
    grid-template-columns: 1fr;
  }
}
.present-kpi-chart-box {
  background: #f8fbff;
  border: 1px solid #dbe4f0;
  border-radius: 12px;
  padding: 13px 15px;
  display: flex;
  flex-direction: column;
  min-height: 340px;
}
.present-kpi-chart-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
}
.present-kpi-chart-head h4 {
  margin: 0;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--navy);
}
.present-kpi-canvas-wrap {
  flex: 1;
  position: relative;
  min-height: 220px;
}
.present-kpi-gauges {
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px dashed #cbd5e1;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.present-gauge-row {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.present-gauge-top {
  display: flex;
  justify-content: space-between;
  font-size: 12px;
  font-weight: 600;
  color: #334155;
  font-variant-numeric: tabular-nums;
}
.present-gauge-track {
  height: 8px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}
.present-gauge-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}
.present-nrw-split {
  display: flex;
  height: 10px;
  border-radius: 999px;
  overflow: hidden;
  background: #e2e8f0;
  gap: 2px;
}
.present-nrw-seg.alert { background: #dc2626; }
.present-nrw-seg.warn  { background: #f59e0b; }
.present-nrw-seg.good  { background: #16a34a; }

/* Presentation Mode: Slide 5 (3 Plants Split) & Slide 6 (4-Quadrant Legend Strip) */
.present-plants-split {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
  gap: 24px;
  align-items: center;
  flex: 1;
  min-height: 480px;
}
@media (max-width: 1000px) {
  .present-plants-split {
    grid-template-columns: 1fr;
  }
}
.present-plants-split .present-chart-wrap {
  min-height: 440px;
}
.present-plants-side {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.present-plants-side .plant-bar-card {
  padding: 16px 18px;
  border-radius: 12px;
  background: #f8fbff;
  border: 1px solid #dbe4f0;
}
.present-plants-side .plant-bar-top {
  font-size: calc(15px * var(--present-zoom, 1));
  margin-bottom: 8px;
}
.present-plants-side .plant-track {
  height: 12px;
  margin-bottom: 8px;
}
.present-plants-side .muted-text {
  font-size: calc(13.5px * var(--present-zoom, 1)) !important;
}

.present-quadrant-strip {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid #e2e8f0;
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
}
@media (max-width: 1000px) {
  .present-quadrant-strip {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
.present-q-card {
  border-radius: 10px;
  padding: 9px 11px;
  font-size: 12px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
}
.present-q-card.q-alert { background: #fef2f2; border-color: #fecaca; }
.present-q-card.q-good  { background: #f0fdf4; border-color: #bbf7d0; }
.present-q-card.q-warn  { background: #fffbeb; border-color: #fde68a; }
.present-q-card.q-info  { background: #eff6ff; border-color: #bfdbfe; }
.present-q-title {
  font-weight: 800;
  font-size: 12px;
  margin-bottom: 3px;
  color: #0f172a;
}
.present-q-list {
  color: #334155;
  line-height: 1.4;
}

.sxkd-banner-left {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  min-width: 170px;
}
.sxkd-banner-left .sxkd-period-select {
  min-width: 162px;
  font-size: 13.5px;
  padding: 5px 10px;
}

@media (max-width: 1180px) {
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .mid-grid, .bottom-grid { grid-template-columns: 1fr; }
}

@media (max-width: 900px) {
  html, body {
    overflow-x: hidden;
    max-width: 100%;
  }
  .app-shell {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto minmax(0, 1fr);
    height: 100dvh;
    width: 100%;
    overflow-x: hidden;
  }
  .sidebar, .header-divider, .header-title, .d-only {
    display: none !important;
  }
  .m-only {
    display: block;
  }
  .top-header {
    grid-column: 1;
    padding: 8px 10px;
    gap: 8px;
    background: #ffffff;
    color: var(--text);
    border-bottom: 1px solid var(--line);
    min-width: 0;
    width: 100%;
  }
  .brand-area {
    min-width: 0;
    flex: 1;
    gap: 7px;
    overflow: hidden;
  }
  .brand-area svg {
    width: 28px;
    height: 34px;
  }
  .org-full { display: none; }
  .org-mob {
    display: block;
    font-size: 13px;
    font-weight: 700;
    color: var(--navy);
    line-height: 1.25;
    min-width: 0;
  }
  .org-mob small {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11.5px;
    color: var(--navy2);
    white-space: nowrap;
  }
  .org-mob .ai-pill {
    font-size: 10px;
    padding: 0 6px;
    line-height: 16px;
    border-width: 1px;
  }
  .header-tools {
    gap: 6px;
    flex-shrink: 0;
  }
  .btn-header-upload .d-label { display: none; }
  .btn-header-upload {
    background: var(--blue-bg);
    color: var(--navy);
    border-color: #bfdbfe;
    padding: 6px 8px;
    font-size: 13px;
  }
  .icon-btn { color: var(--text); padding: 3px; }
  .icon-btn svg { width: 21px; height: 21px; }
  .profile-select {
    background: #f1f5f9;
    color: var(--text);
    border-color: var(--line-strong);
    max-width: 96px;
    padding: 5px 6px;
    font-size: 11.5px;
  }
  .main-view {
    padding: 10px 10px 84px;
    overflow-x: hidden;
  }
  .tab-brand-bar {
    padding: 9px 12px;
    margin-bottom: 10px;
  }
  .tab-brand-title { font-size: 17px; }
  .tab-brand-sub { font-size: 12.5px; }
  .hero { min-height: 108px; }
  .hero .txt { padding: 14px 16px; }
  .hero h2 { font-size: 21px; }
  .hero p { font-size: 13px; max-width: 78%; }
  .tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; }
  .tile { min-height: 78px; font-size: 13px; padding: 8px 4px; }
  .tile svg { width: 34px; height: 34px; }
  .folders-grid, .folders-grid.big { grid-template-columns: 1fr 1fr; }
  .upload-dual-grid, .form-row-2, .two-col-grid { grid-template-columns: 1fr; }
  .chat-workspace { grid-template-columns: 1fr; height: calc(100dvh - 216px); }
  .srcs-panel { display: none; }
  .sheet { align-items: flex-end; padding: 0; }
  .sheet .sheet-card {
    border-radius: 18px 18px 0 0;
    max-height: 85dvh;
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
  }
  .sheet-grab {
    display: block;
    width: 42px;
    height: 5px;
    border-radius: 3px;
    background: #cbd5e1;
    margin: 0 auto 10px;
  }
  .mobile-tabbar {
    display: flex;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #ffffff;
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    z-index: 40;
  }
  .mobile-tabbar button {
    flex: 1;
    border: 0;
    background: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    font-size: 11.5px;
    color: var(--muted);
    padding: 4px 0;
  }
  .mobile-tabbar button.active {
    color: var(--blue);
    font-weight: 700;
  }
  .mobile-tabbar svg {
    width: 22px;
    height: 22px;
  }
}

/* ==================== Raw Excel Upload & PKH Publish Workflow ==================== */
.raw-upload-card {
  border-top: 3px solid var(--blue);
}
.pkh-publish-card {
  border-top: 3px solid var(--green);
  background: linear-gradient(180deg, #f8fffb 0%, #ffffff 42%);
}
.raw-upload-form {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.raw-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 26px 18px;
  border: 2px dashed #93c5fd;
  border-radius: 14px;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
  transition: border-color 0.16s ease, background 0.16s ease, transform 0.12s ease;
}
.raw-dropzone:hover,
.raw-dropzone.dragover {
  border-color: var(--blue);
  background: #eff6ff;
}
.pkh-dropzone {
  border-color: #86efac;
  background: #f4fdf7;
}
.pkh-dropzone:hover,
.pkh-dropzone.dragover {
  border-color: var(--green);
  background: #ecfdf5;
}
.raw-dz-icon {
  font-size: 32px;
  line-height: 1;
}
.raw-dz-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--navy);
}
.raw-dz-sub {
  font-size: 12.5px;
  color: var(--muted);
}
.raw-picked-preview {
  margin-top: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  background: #dcfce7;
  color: #166534;
  font-size: 13px;
}
.raw-upload-row {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}
.raw-submit-btn {
  padding: 10px 18px;
  font-size: 14px;
  white-space: nowrap;
}
.raw-period-latest {
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.raw-version-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.raw-version-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  padding: 8px 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  font-size: 13px;
}
.pkh-preview-box {
  margin-top: 14px;
  padding: 14px 16px;
  border-radius: 12px;
  background: #ffffff;
  border: 1.5px solid #86efac;
  box-shadow: 0 6px 20px rgba(22, 101, 52, 0.06);
}
.pkh-preview-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.pkh-preview-period {
  padding: 12px;
  border-radius: 10px;
  background: #f8fafc;
  border: 1px solid var(--line);
  margin-bottom: 10px;
}
.pkh-preview-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 10px;
}
.pkh-preview-kpis > div {
  background: #ffffff;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.pkh-preview-kpis small {
  font-size: 11.5px;
  color: var(--muted);
}
.pkh-preview-kpis strong {
  font-size: 14.5px;
  color: var(--navy);
}
.btn-xs {
  padding: 4px 9px;
  font-size: 12px;
  border-radius: 7px;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Phase 2: Inline PDF Viewer, Highlighted Chunk, [SXKD] Pill & Dropzone Dragover */
.doc-split-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(320px, 0.9fr);
  gap: 14px;
  align-items: start;
}
.doc-split-layout.no-preview {
  grid-template-columns: 1fr;
}
.doc-viewer-card {
  position: sticky;
  top: 12px;
}
.doc-viewer-frame {
  width: 100%;
  height: 74vh;
  min-height: 460px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: #f8fafc;
}
.admin-perm-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px 10px;
  padding: 10px 12px;
  background: #f8fafc;
  border: 1px solid var(--line);
  border-radius: 10px;
}
.admin-action-group {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.admin-toolbar-bar {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  align-items: center;
  margin-bottom: 12px;
}
.admin-toolbar-bar .input-field {
  min-width: 240px;
  flex: 1;
}

/* SXKD AI Workbench & 10-Report Giao Ban Upload */
.sxkd-ai-workbench {
  margin-bottom: 14px;
  background: #ffffff;
  border: 1.5px solid #bfd7fb;
  border-radius: 14px;
  box-shadow: 0 6px 20px rgba(13, 69, 166, 0.08);
  overflow: hidden;
}
.sxkd-ai-collapsed-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
  padding: 10px 16px;
  background: linear-gradient(90deg, #eff6ff 0%, #f8fbff 100%);
}
.sxkd-ai-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
  padding: 12px 16px;
  background: linear-gradient(90deg, #0b3a6e 0%, #1656b8 100%);
  color: #ffffff;
}
.sxkd-ai-body {
  padding: 14px 16px 16px;
}
.sxkd-ai-qgrid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.sxkd-ai-qcard {
  text-align: left;
  background: #f8fbff;
  border: 1px solid #d4e3fa;
  border-radius: 10px;
  padding: 10px 12px;
  cursor: pointer;
  transition: border-color 0.14s, box-shadow 0.14s, transform 0.12s;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sxkd-ai-qcard:hover {
  border-color: var(--blue);
  background: #eff6ff;
  box-shadow: 0 4px 12px rgba(37, 99, 235, 0.12);
  transform: translateY(-1px);
}
.sxkd-ai-qmeta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--blue);
}
.sxkd-ai-qtxt {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--navy);
  line-height: 1.4;
}
.sxkd-ai-qwhy {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}
.sxkd-ai-chatbox {
  margin-top: 14px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fcfdff;
  padding: 12px;
}
.sxkd-ai-msgs {
  max-height: 440px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 10px;
}
.sxkd-brief-dropzone {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 20px 16px;
  border: 2px dashed #93c5fd;
  border-radius: 12px;
  background: #f8fbff;
  cursor: pointer;
  text-align: center;
  transition: background 0.15s, border-color 0.15s;
}
.sxkd-brief-dropzone:hover,
.sxkd-brief-dropzone.dragover {
  background: #eff6ff;
  border-color: var(--blue);
}
@media (max-width: 900px) {
  .sxkd-ai-qgrid {
    grid-template-columns: 1fr;
  }
}
.chunk-block.is-highlighted {
  border-color: #2563eb;
  background: #eff6ff;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.16);
}
.sxkd-chip {
  display: inline-flex;
  align-items: center;
  padding: 1px 7px;
  margin: 0 2px;
  border-radius: 999px;
  font-size: 11.5px;
  font-weight: 700;
  background: #eef2ff;
  color: #3730a3;
  border: 1px solid #c7d2fe;
}
#fileDropzone.drag-over {
  border-color: #2563eb;
  background: #eff6ff;
}
.streaming-cursor::after {
  content: "▍";
  display: inline-block;
  margin-left: 2px;
  color: #2563eb;
  animation: blinkCursor 0.9s infinite;
}
@keyframes blinkCursor {
  0%, 49% { opacity: 1; }
  50%, 100% { opacity: 0; }
}
@media (max-width: 1024px) {
  .doc-split-layout {
    grid-template-columns: 1fr;
  }
  .doc-viewer-card {
    position: static;
  }
  .doc-viewer-frame {
    height: 420px;
  }
}

/* =====================================================================
   SXKD 2.1 — GIAO DIỆN HIỆN ĐẠI (03/12/2026)
   Chỉ áp dụng trong trang Báo cáo SXKD (#mainView) + Trung tâm AI SXKD
   ===================================================================== */
:root {
  --x-ink: #0b1b3a;
  --x-ink-2: #334155;
  --x-soft: #64748b;
  --x-line: #e6ebf3;
  --x-bg: #f5f7fb;
  --x-card: #ffffff;
  --x-brand: #1554d1;
  --x-brand-2: #0ea5e9;
  --x-grad: linear-gradient(120deg, #0b2a6b 0%, #1554d1 55%, #0ea5e9 100%);
  --x-ai: linear-gradient(120deg, #6d28d9 0%, #2563eb 60%, #06b6d4 100%);
  --x-radius: 16px;
  --x-shadow: 0 1px 2px rgba(15, 23, 42, 0.04), 0 8px 24px rgba(15, 23, 42, 0.06);
  --x-shadow-hover: 0 2px 4px rgba(15, 23, 42, 0.05), 0 14px 34px rgba(21, 84, 209, 0.12);
}

/* Thanh công cụ thành 1 thẻ tiêu đề */
#mainView .sxkd-toolbar {
  background: var(--x-card);
  border: 1px solid var(--x-line);
  border-radius: var(--x-radius);
  padding: 14px 18px;
  box-shadow: var(--x-shadow);
  position: relative;
  overflow: visible;
}
#mainView .sxkd-toolbar::before {
  content: "";
  position: absolute;
  left: 0; top: 14px; bottom: 14px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background: var(--x-grad);
}
#mainView .sxkd-toolbar h2 {
  font-size: 22px !important;
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--x-ink) !important;
}

/* Nút AI nổi bật */
.btn.btn-ai {
  background: var(--x-ai);
  color: #fff;
  border: 0;
  box-shadow: 0 6px 16px rgba(109, 40, 217, 0.25);
}
.btn.btn-ai:hover { filter: brightness(1.06); transform: translateY(-1px); }

/* Menu "⚙️ Số liệu" */
.sxkd-menu { position: relative; display: inline-block; }
.sxkd-menu > summary { list-style: none; cursor: pointer; }
.sxkd-menu > summary::-webkit-details-marker { display: none; }
.sxkd-menu-pop {
  position: absolute;
  right: 0; top: calc(100% + 6px);
  z-index: 60;
  min-width: 240px;
  background: #fff;
  border: 1px solid var(--x-line);
  border-radius: 12px;
  box-shadow: 0 18px 40px rgba(15, 23, 42, 0.16);
  padding: 6px;
  display: grid;
  gap: 2px;
}
.sxkd-menu-item {
  display: block;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 9px 12px;
  border-radius: 8px;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--x-ink-2);
  text-decoration: none;
  cursor: pointer;
}
.sxkd-menu-item:hover { background: #eef4ff; color: var(--x-brand); }

/* Tab chính dạng segmented */
#mainView .sxkd-main-tabs {
  background: #e9eef7;
  border-radius: 14px;
  padding: 5px;
  box-shadow: inset 0 1px 2px rgba(15, 23, 42, 0.06);
}
#mainView .sxkd-main-tab { border-radius: 10px; font-size: 13px; letter-spacing: 0.01em; }
#mainView .sxkd-main-tab.active {
  background: #fff;
  color: var(--x-brand);
  box-shadow: 0 2px 10px rgba(21, 84, 209, 0.16);
}

/* Băng tiêu đề kỳ báo cáo */
#mainView .sxkd-report-banner {
  background: var(--x-grad);
  border: 0;
  border-radius: var(--x-radius);
  box-shadow: 0 10px 28px rgba(21, 84, 209, 0.25);
  padding: 14px 20px;
}
#mainView .sxkd-report-banner-title { color: #fff; font-size: 19px; letter-spacing: 0.04em; }
#mainView .sxkd-report-banner .sxkd-period-select {
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.4);
}
#mainView .sxkd-report-banner .sxkd-period-select option { color: var(--x-ink); }
#mainView .sxkd-report-banner .pill-badge { background: rgba(255, 255, 255, 0.18); color: #fff; border-color: rgba(255, 255, 255, 0.35); }

/* Thẻ KPI */
#mainView .sxkd-kpi-grid { gap: 14px; }
#mainView .sxkd-kpi-card {
  border: 1px solid var(--x-line);
  border-top: 0;
  border-radius: var(--x-radius);
  padding: 16px 12px 14px;
  box-shadow: var(--x-shadow);
  background: var(--x-card);
  overflow: hidden;
}
#mainView .sxkd-kpi-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: var(--x-grad);
}
#mainView .sxkd-kpi-card.tone-good { background: linear-gradient(180deg, #f3fdf7 0%, #fff 60%); }
#mainView .sxkd-kpi-card.tone-good::before { background: linear-gradient(90deg, #16a34a, #22c55e); }
#mainView .sxkd-kpi-card.tone-alert { background: linear-gradient(180deg, #fff5f5 0%, #fff 60%); }
#mainView .sxkd-kpi-card.tone-alert::before { background: linear-gradient(90deg, #dc2626, #f97316); }
#mainView .sxkd-kpi-card:hover { transform: translateY(-2px); box-shadow: var(--x-shadow-hover); }
#mainView .sxkd-kpi-label { text-transform: uppercase; letter-spacing: 0.04em; font-size: 11px; color: var(--x-soft); }
#mainView .sxkd-kpi-val { font-size: clamp(21px, 1.9vw, 27px); letter-spacing: -0.02em; color: var(--x-ink); }

/* Thẻ biểu đồ & bảng */
#mainView .sxkd-chart-card,
#mainView .sxkd-insights-panel {
  border: 1px solid var(--x-line);
  border-radius: var(--x-radius);
  box-shadow: var(--x-shadow);
  padding: 16px 18px;
}
#mainView .sxkd-chart-card:hover { box-shadow: var(--x-shadow-hover); border-color: #cfdcf3; }
#mainView .sxkd-chart-head h3 { font-size: 15.5px; font-weight: 800; color: var(--x-ink); }
#mainView .seg-group { background: #eef2f8; border-radius: 10px; padding: 3px; }
#mainView .seg-btn.active { background: #fff; color: var(--x-brand); box-shadow: 0 1px 6px rgba(21, 84, 209, 0.15); }
#mainView .sxkd-data-table thead th {
  background: #f1f5fb;
  color: var(--x-ink-2);
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  border-bottom: 1px solid var(--x-line);
}

/* ---------- Thanh khởi động Trung tâm AI ---------- */
.sxkd-ai-workbench { margin-bottom: 14px; }
.xai-launcher {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 14px;
  padding: 14px 16px;
  border-radius: var(--x-radius);
  background: radial-gradient(1200px 120px at 0% 0%, rgba(124, 58, 237, 0.12), transparent 60%),
    radial-gradient(900px 120px at 100% 100%, rgba(6, 182, 212, 0.12), transparent 60%), #fff;
  border: 1px solid #e4e0fb;
  box-shadow: var(--x-shadow);
}
.xai-launcher-main { display: flex; align-items: center; gap: 12px; }
.xai-launcher-icon {
  width: 44px; height: 44px; border-radius: 12px;
  display: grid; place-items: center; font-size: 22px;
  background: var(--x-ai); color: #fff;
  box-shadow: 0 8px 18px rgba(79, 70, 229, 0.3);
}
.xai-launcher-title { font-weight: 800; font-size: 15.5px; color: var(--x-ink); }
.xai-launcher-sub { font-size: 12.5px; color: var(--x-soft); }
.xai-launcher-quick { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; }
.xai-launcher-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.xai-chip {
  border: 1px solid #dfe6f3; background: #fff; color: var(--x-ink-2);
  font: inherit; font-size: 12.5px; font-weight: 600;
  padding: 6px 11px; border-radius: 999px; cursor: pointer;
  transition: all 0.15s ease;
}
.xai-chip:hover { border-color: #a5b4fc; color: #4338ca; background: #f5f3ff; }

/* Nút nổi góc phải */
.xai-fab {
  position: fixed; right: 22px; bottom: 22px; z-index: 230;
  border: 0; cursor: pointer;
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 18px; border-radius: 999px;
  background: var(--x-ai); color: #fff;
  font: inherit; font-weight: 700; font-size: 14px;
  box-shadow: 0 14px 30px rgba(79, 70, 229, 0.35);
  transition: transform 0.15s ease;
}
.xai-fab:hover { transform: translateY(-2px); }
.xai-fab.hidden { display: none; }
.xai-fab-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 4px rgba(74, 222, 128, 0.25); }
@media (max-width: 760px) {
  .xai-fab { bottom: 78px; right: 14px; padding: 11px 14px; }
  .xai-fab span:last-child { display: none; }
  .xai-launcher { grid-template-columns: 1fr; }
  .xai-launcher-quick { justify-content: flex-start; }
}

/* ---------- Overlay TOÀN TRANG ---------- */
body.xai-lock { overflow: hidden; }
.xai-hub {
  position: fixed; inset: 0; z-index: 240; /* dưới modal (250), toast (290), đăng nhập (320) */
  background: rgba(8, 15, 35, 0.55);
  backdrop-filter: blur(4px);
  display: flex;
}
.xai-hub.hidden { display: none; }
.xai-shell {
  flex: 1;
  margin: 12px;
  background: var(--x-bg);
  border-radius: 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 30px 80px rgba(0, 0, 0, 0.35);
}
.xai-top {
  display: flex; align-items: center; gap: 16px;
  padding: 14px 20px;
  background: var(--x-grad);
  color: #fff;
}
.xai-brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.xai-brand-icon { width: 40px; height: 40px; border-radius: 12px; display: grid; place-items: center; font-size: 20px; background: rgba(255, 255, 255, 0.16); }
.xai-brand-title { font-weight: 800; font-size: 17px; }
.xai-brand-sub { font-size: 12px; opacity: 0.88; }
.xai-context { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.xai-ctx-chip { background: rgba(255, 255, 255, 0.16); border: 1px solid rgba(255, 255, 255, 0.3); padding: 5px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 600; }
.xai-close {
  border: 0; cursor: pointer; width: 38px; height: 38px; border-radius: 10px;
  background: rgba(255, 255, 255, 0.16); color: #fff; font-size: 17px;
}
.xai-close:hover { background: rgba(255, 255, 255, 0.3); }
.xai-body { flex: 1; display: flex; min-height: 0; }
.xai-nav {
  width: 230px; flex: none;
  background: #fff;
  border-right: 1px solid var(--x-line);
  padding: 14px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.xai-nav-btn {
  display: flex; align-items: center; gap: 10px;
  border: 0; background: transparent; cursor: pointer;
  font: inherit; font-size: 14px; font-weight: 600; color: var(--x-ink-2);
  padding: 11px 12px; border-radius: 10px; text-align: left;
}
.xai-nav-btn:hover { background: #f1f5fb; }
.xai-nav-btn.active { background: #eaf1ff; color: var(--x-brand); box-shadow: inset 3px 0 0 var(--x-brand); }
.xai-nav-foot { margin-top: auto; padding: 12px; border-top: 1px solid var(--x-line); font-size: 12px; color: var(--x-soft); display: grid; gap: 6px; }
.xai-nav-note { font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; font-size: 10.5px; }
.xai-src { display: flex; align-items: center; gap: 7px; }
.xai-dot { width: 8px; height: 8px; border-radius: 50%; background: #94a3b8; }
.xai-dot.green { background: #22c55e; }
.xai-main { flex: 1; min-width: 0; display: flex; flex-direction: column; overflow: hidden; }

/* Hỏi đáp */
.xai-ask { flex: 1; display: grid; grid-template-columns: minmax(0, 1fr) 330px; min-height: 0; }
.xai-chat { display: flex; flex-direction: column; min-height: 0; }
.xai-msgs { flex: 1; overflow-y: auto; padding: 22px clamp(14px, 4vw, 56px); display: flex; flex-direction: column; gap: 16px; }
.xai-turn.user { display: flex; justify-content: flex-end; }
.xai-bubble {
  max-width: min(760px, 85%);
  background: var(--x-grad); color: #fff;
  padding: 12px 16px; border-radius: 16px 16px 4px 16px;
  font-size: 14.5px; line-height: 1.55;
  box-shadow: 0 8px 20px rgba(21, 84, 209, 0.2);
}
.xai-answer {
  background: #fff;
  border: 1px solid var(--x-line);
  border-radius: 16px;
  padding: 16px 20px 14px;
  box-shadow: var(--x-shadow);
}
.xai-answer-head { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.xai-avatar {
  width: 30px; height: 30px; border-radius: 10px;
  display: grid; place-items: center;
  background: var(--x-ai); color: #fff; font-weight: 800; font-size: 12px;
}
.xai-avatar.pulse { animation: xaiPulse 1.2s ease-in-out infinite; }
@keyframes xaiPulse { 50% { opacity: 0.55; transform: scale(0.94); } }
.xai-answer-meta { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; flex: 1; }
.xai-tag { font-size: 11.5px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: #eef2ff; color: #4338ca; }
.xai-tag.green { background: #dcfce7; color: #166534; }
.xai-model { font-size: 12px; color: var(--x-soft); margin-left: auto; }
.xai-md { font-size: 14.5px; line-height: 1.7; color: var(--x-ink); }
.xai-md h3 { font-size: 16px; margin: 16px 0 6px; color: var(--x-brand); }
.xai-md table { font-size: 13px; }
.xai-answer-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 12px; padding-top: 10px; border-top: 1px dashed var(--x-line); }
.xai-composer {
  border-top: 1px solid var(--x-line);
  background: #fff;
  padding: 12px clamp(14px, 4vw, 56px) 14px;
  display: flex; gap: 10px; align-items: flex-end;
}
.xai-composer textarea {
  flex: 1; resize: none;
  font: inherit; font-size: 14.5px;
  border: 1.5px solid #d8e0ee; border-radius: 14px;
  padding: 11px 14px; outline: none;
  max-height: 160px;
}
.xai-composer textarea:focus { border-color: var(--x-brand); box-shadow: 0 0 0 4px rgba(21, 84, 209, 0.12); }
.xai-composer-actions { display: flex; gap: 6px; align-items: center; }
.xai-side { border-left: 1px solid var(--x-line); background: #fff; padding: 16px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.xai-side-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; color: var(--x-ink); }
.xai-topics { display: flex; flex-wrap: wrap; gap: 5px; }
.xai-topic { border: 1px solid #dfe6f3; background: #fff; border-radius: 999px; padding: 4px 10px; font: inherit; font-size: 12px; cursor: pointer; color: var(--x-ink-2); }
.xai-topic.active { background: var(--x-brand); color: #fff; border-color: var(--x-brand); }
.xai-sugg-list { display: grid; gap: 8px; }
.xai-sugg {
  text-align: left; border: 1px solid #e3e9f4; background: #fbfcff;
  border-radius: 12px; padding: 10px 12px; cursor: pointer;
  font: inherit; font-size: 13px; line-height: 1.45; color: var(--x-ink);
  transition: all 0.15s ease;
}
.xai-sugg:hover { border-color: #a5b4fc; background: #f5f3ff; transform: translateX(2px); }
.xai-sugg-cat { display: block; font-size: 10.5px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.05em; color: #6d28d9; margin-bottom: 3px; }
.xai-sugg-loading, .xai-sugg-empty { font-size: 13px; color: var(--x-soft); padding: 8px 2px; }

/* Màn hình chào + thẻ phân tích nhanh */
.xai-welcome { margin: auto; max-width: 980px; width: 100%; text-align: center; padding: 20px 0; }
.xai-welcome-title { font-size: clamp(20px, 2.2vw, 28px); font-weight: 800; color: var(--x-ink); letter-spacing: -0.01em; }
.xai-welcome-sub { color: var(--x-soft); margin: 6px auto 20px; max-width: 680px; }
.xai-quick-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; text-align: left; }
.xai-quick-card {
  display: grid; gap: 4px; align-content: start;
  border: 1px solid var(--x-line); background: #fff; border-radius: 16px;
  padding: 16px; cursor: pointer; font: inherit; color: var(--x-ink);
  box-shadow: var(--x-shadow); transition: all 0.16s ease; position: relative;
}
.xai-quick-card:hover { transform: translateY(-3px); box-shadow: var(--x-shadow-hover); border-color: #c7d2fe; }
.xai-quick-card strong { font-size: 14.5px; }
.xai-quick-card small { color: var(--x-soft); font-size: 12.5px; }
.xai-q-ic { font-size: 24px; width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: #f1f5ff; margin-bottom: 4px; }
.xai-quick-card.big { min-height: 160px; }
.xai-q-go { margin-top: 8px; font-size: 12.5px; font-weight: 700; color: var(--x-brand); }

/* Trang con: lịch sử, giao ban */
.xai-page { flex: 1; overflow-y: auto; padding: 22px clamp(14px, 3vw, 40px); }
.xai-page-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.xai-page-title { margin: 0; font-size: 20px; font-weight: 800; color: var(--x-ink); }
.xai-page-sub { margin: 4px 0 16px; color: var(--x-soft); font-size: 13.5px; }
.xai-hist-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.xai-hist-card {
  text-align: left; font: inherit; cursor: pointer;
  background: #fff; border: 1px solid var(--x-line); border-radius: 16px;
  padding: 14px 16px; box-shadow: var(--x-shadow); display: grid; gap: 6px;
  transition: all 0.16s ease;
}
.xai-hist-card:hover { transform: translateY(-2px); box-shadow: var(--x-shadow-hover); }
.xai-hist-top { display: flex; gap: 6px; }
.xai-hist-q { font-weight: 700; color: var(--x-ink); font-size: 14px; line-height: 1.4; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.xai-hist-prev { font-size: 12.5px; color: var(--x-soft); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.xai-hist-foot { font-size: 11.5px; color: #94a3b8; }
.xai-drop { border-radius: 16px; }

@media (max-width: 1100px) {
  .xai-ask { grid-template-columns: 1fr; }
  .xai-side { display: none; }
}
@media (max-width: 760px) {
  .xai-shell { margin: 0; border-radius: 0; }
  .xai-body { flex-direction: column; }
  .xai-nav { width: auto; flex-direction: row; overflow-x: auto; border-right: 0; border-bottom: 1px solid var(--x-line); padding: 8px; }
  .xai-nav-btn { white-space: nowrap; padding: 8px 10px; font-size: 13px; }
  .xai-nav-foot { display: none; }
  .xai-context { display: none; }
  .xai-brand-sub { display: none; }
}

/* Trung tâm AI SXKD: văn bản trả lời trải đều toàn bộ bề rộng khung, căn đều 2 bên (03/12/2026) */
.xai-md,
.xai-md p,
.xai-md ul,
.xai-md ol,
.xai-md li,
.xai-md blockquote {
  max-width: none;
}
.xai-md p,
.xai-md li,
.xai-md blockquote {
  text-align: justify;
  text-justify: inter-word;
  hyphens: auto;
}
.xai-md .md-table-wrap,
.xai-md table {
  width: 100%;
}
.xai-answer {
  padding: 20px clamp(18px, 2.4vw, 34px) 16px;
}
