/* =====================================================
   DESIGN TOKENS – Deep Blue / Teal Professional Theme
   ===================================================== */
:root {
  /* Blue-teal palette – chuyên nghiệp, hiện đại */
  --pink-50:  #f0f7ff;
  --pink-100: #dbeafe;
  --pink-200: #bcd4f5;
  --pink-300: #7fb3ea;
  --pink-400: #4a90d9;
  --pink-500: #2563eb;   /* main brand – xanh dương đậm */
  --pink-600: #1d4ed8;
  --pink-700: #1e3a8a;
  --pink-gradient: linear-gradient(135deg, #1e3a8a 0%, #2563eb 55%, #4a90d9 100%);
  --pink-gradient-soft: linear-gradient(135deg, #f0f7ff 0%, #dbeafe 100%);

  --gray-50:  #f8fafc;
  --gray-100: #f1f5f9;
  --gray-200: #e2e8f0;
  --gray-300: #cbd5e1;
  --gray-600: #64748b;
  --gray-700: #334155;
  --gray-900: #0f172a;

  --green-500: #16a34a;
  --green-100: #f0fdf4;
  --green-border: #86efac;
  --orange-500: #0891b2;   /* xanh xoay – hài hòa với xanh dương */
  --orange-100: #ecfeff;
  --red-500: #dc2626;
  --red-100: #fef2f2;

  --shadow-sm: 0 1px 4px rgba(37,99,235,.07);
  --shadow-md: 0 4px 16px rgba(37,99,235,.11);
  --shadow-lg: 0 8px 32px rgba(37,99,235,.15);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;

  --font: 'Inter', sans-serif;
  --sidebar-width: 300px;
}



/* =====================================================
   RESET & BASE
   ===================================================== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { 
  font-size: 14px; 
  scrollbar-gutter: stable;
}
body {
  font-family: var(--font);
  background: var(--pink-50);
  color: var(--gray-900);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =====================================================
   HEADER
   ===================================================== */
.app-header {
  background: #fff;
  border-bottom: 2px solid var(--pink-100);
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 12px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.header-brand { display: flex; align-items: center; gap: 12px; }
.brand-icon {
  width: 40px; height: 40px;
  background: var(--pink-gradient);
  border-radius: var(--radius-sm);
  display: flex; align-items: center; justify-content: center;
  font-size: 20px;
  box-shadow: 0 4px 12px rgba(37,99,235,.3);
}
.brand-name { font-size: 16px; font-weight: 700; color: var(--pink-600); }
.brand-sub  { font-size: 11px; color: var(--gray-600); }
.header-badge {
  background: var(--pink-gradient);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 12px;
  border-radius: 99px;
  letter-spacing: .5px;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
}

/* =====================================================
   MAIN LAYOUT
   ===================================================== */
/* Main Layout REVERT */
.app-main {
  width: 100%;
  max-width: 1512px;
  margin: 0 auto;
  padding: 24px;
  display: grid;
  grid-template-columns: var(--sidebar-width) 1fr;
  gap: 24px;
  min-height: calc(100vh - 64px);
}

.form-panel {
  display: flex;
  flex-direction: column;
  gap: 12px;
  width: var(--sidebar-width);
  background: transparent;
  padding: 0 4px 20px 0; /* padding right for scrollbar space */
  box-shadow: none;
  border: none;
  position: sticky;
  top: 80px;
  height: fit-content;
  max-height: calc(100vh - 100px);
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: var(--pink-200) transparent;
}
.form-panel::-webkit-scrollbar { width: 4px; }
.form-panel::-webkit-scrollbar-thumb { background: var(--pink-200); border-radius: 10px; }
.sidebar-card {
  background: #fff;
  border: 1.5px solid var(--pink-100);
  border-radius: var(--radius-xl);
  padding: 16px;
  box-shadow: var(--shadow-md);
}

.form-frame {
  background: transparent;
  border: none;
  border-radius: 0;
  padding: 0;
  box-shadow: none;
  display: flex;
  flex-direction: column;
}
.form-panel-title {
  font-size: 13px;
  font-weight: 800;
  color: var(--pink-600);
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}
.sidebar-hr {
  border: none;
  border-top: 1.5px solid var(--pink-50);
  margin: 12px 0;
}
.form-row-compact input {
  padding: 8px 12px !important;
  text-align: left;
}
.tag-group-scroll::-webkit-scrollbar { width: 3px; }
.tag-group-scroll::-webkit-scrollbar-thumb { background: var(--pink-200); border-radius: 4px; }

.preset-mini {
  background: #fff;
  border: 1px solid var(--pink-100);
  border-radius: 4px;
  color: var(--pink-700);
  font-weight: 600;
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s;
}
.preset-mini:hover { background: var(--pink-500); color: #fff; border-color: transparent; }

.form-row {
  display: flex;
  gap: 12px;
  margin-bottom: 2px;
}
.flex-1 { flex: 1; }

.section-sub-label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  color: var(--gray-600);
  margin: 12px 0 8px;
  border-bottom: 1px dashed var(--gray-300);
  padding-bottom: 4px;
}

.form-group {
  margin-bottom: 8px;
}
.form-group label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  color: var(--gray-700);
  margin-bottom: 3px;
}
.input-hint {
  font-size: 10px;
  color: var(--gray-600);
  margin-top: -3px;
  margin-bottom: 6px;
  font-style: italic;
  opacity: 0.8;
}
.form-group input,
.form-group select {
  width: 100%;
  padding: 8px 12px;
  border: 1.5px solid var(--gray-200);
  border-radius: var(--radius-md);
  font-size: 13px;
  background: #fff;
  height: 38px;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  transition: border-color .2s, box-shadow .2s;
}
.form-group select {
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%232563eb' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  padding-right: 36px;
  cursor: pointer;
}
.form-group input:focus,
.form-group select:focus {
  border-color: var(--pink-400);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(37,99,235,.12);
}

.form-section-title {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .8px;
  color: var(--pink-500);
  margin: 16px 0 8px;
  padding-bottom: 6px;
  border-bottom: 1.5px solid var(--pink-100);
}

.tag-group { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 4px; }
.tag-check {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #fff;
  border: 1.5px solid var(--pink-100);
  border-radius: 99px;
  padding: 6px 14px;
  font-size: 13px;
  font-weight: 700;
  color: var(--pink-700);
  cursor: pointer;
  transition: background-color .2s, border-color .2s, color .2s, box-shadow .2s;
  user-select: none;
  position: relative;
}
.tag-remove {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ef4444; /* Red */
  color: #fff;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 800;
  opacity: 0;
  transition: opacity .2s, transform .2s;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  z-index: 5;
}
.tag-check:hover .tag-remove { 
  opacity: 1;
  transform: scale(1.1);
}
.tag-remove:hover { 
  background: #b91c1c; 
  transform: scale(1.3);
}

/* Custom size row */
.custom-size-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 12px;
}
.custom-size-row input {
  height: 32px;
  padding: 0 8px;
  font-size: 12px;
  border-radius: var(--radius-sm);
  background: #fff;
}
.btn-add-size {
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--pink-500);
  color: #fff;
  border: none;
  font-size: 18px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}
.btn-add-size:hover { background: var(--pink-600); }
.tag-check:hover { border-color: var(--pink-300); color: var(--pink-500); background: var(--pink-50); }
.tag-check input { accent-color: var(--pink-500); cursor: pointer; }
.tag-check:has(input:checked) {
  border-color: var(--pink-400);
  background: var(--pink-50);
  color: var(--pink-600);
  font-weight: 600;
}

.btn-calculate {
  width: 100%;
  padding: 16px;
  background: var(--pink-gradient);
  color: #fff;
  border: none;
  border-radius: var(--radius-lg);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  box-shadow: 0 8px 24px rgba(37,99,235,.4);
  transition: background-color .25s, box-shadow .25s, transform .25s;
}
.form-action-frame {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.btn-calculate:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 24px rgba(37,99,235,.45);
}
.btn-calculate:active { transform: translateY(0); }
.btn-icon { font-size: 16px; }

/* Presets */
.preset-list { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.preset-btn {
  padding: 8px 6px;
  border: 1.5px solid var(--pink-200);
  border-radius: var(--radius-sm);
  background: var(--pink-50);
  color: var(--pink-600);
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  cursor: pointer;
  text-align: center;
  line-height: 1.4;
  transition: background-color .2s, color .2s, border-color .2s, box-shadow .2s;
}
.preset-btn small { color: var(--gray-600); font-weight: 400; }
.preset-btn:hover {
  background: var(--pink-gradient);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 2px 8px rgba(37,99,235,.2);
}
.preset-btn:hover small { color: rgba(255,255,255,.8); }

/* =====================================================
   RIGHT RESULTS PANEL
   ===================================================== */
.results-panel {
  flex: 1;
  min-width: 0;
}

/* Empty state */
.empty-state {
  height: 100%;
  min-height: 400px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: var(--radius-xl);
  border: 2px dashed var(--pink-200);
  text-align: center;
  padding: 40px;
  gap: 12px;
}
.empty-icon { font-size: 56px; line-height: 1; }
.empty-title { font-size: 16px; font-weight: 700; color: var(--gray-700); }
.empty-sub { font-size: 13px; color: var(--gray-600); max-width: 360px; line-height: 1.6; }

/* Results content */
.results-content { display: flex; flex-direction: column; gap: 20px; }

/* Summary bar */
.summary-bar {
  background: var(--pink-gradient);
  border-radius: var(--radius-lg);
  padding: 16px 32px;
  display: flex;
  justify-content: space-between;
  box-shadow: var(--shadow-md);
  color: #fff;
}
.summary-value { font-size: 24px; font-weight: 800; }
.summary-label { font-size: 11px; opacity: .8; text-transform: uppercase; font-weight: 600; }

/* Result cards row */
.result-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}

.result-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--pink-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.result-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  border-bottom: 1.5px solid var(--pink-50);
  background: var(--pink-gradient-soft);
}
.result-card-icon { font-size: 22px; }
.result-card-title { font-size: 14px; font-weight: 700; color: var(--pink-600); }
.result-card-sub   { font-size: 11px; color: var(--gray-600); margin-top: 1px; }

/* Table container for scroll */
.table-scroll-wrap {
  max-height: 280px;
  overflow-y: auto;
  border-bottom: 1.5px solid var(--pink-50);
}
.table-scroll-wrap::-webkit-scrollbar { width: 5px; }
.table-scroll-wrap::-webkit-scrollbar-thumb { background: var(--pink-200); border-radius: 99px; }

.result-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 12px;
}
.result-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
.result-table th {
  background: var(--gray-100);
  color: var(--gray-600);
  font-weight: 600;
  padding: 10px 12px;
  text-align: left;
  font-size: 11px;
  border-bottom: 2px solid var(--gray-200);
}
.result-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--gray-100);
  color: var(--gray-700);
  vertical-align: middle;
}
.result-table tr:hover td { background: var(--pink-50); }
.result-table tr.row-best td { 
  background: rgba(22, 163, 74, 0.05); /* Soft green highlight for the best row */
  border-bottom: 1.5px solid rgba(22, 163, 74, 0.1);
}
.result-table tr.row-best td:first-child {
  border-left: 4px solid var(--green-500);
}
.result-table tr.row-active td { 
  background: var(--pink-100) !important;
  color: var(--pink-700);
}
.result-table tr.row-active td:first-child {
  border-left: 4px solid var(--pink-500);
}

.badge-best {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--pink-gradient);
  color: #fff;
  font-size: 10px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 99px;
}
.badge-preferred {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--orange-100);
  color: var(--orange-500);
  border: 1px solid #ffd591;
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
}
.badge-ok {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  background: var(--green-100);
  color: var(--green-500);
  border: 1px solid var(--green-border);
  font-size: 10px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 99px;
}

.util-bar-wrap { display: flex; align-items: center; gap: 6px; }
.util-bar {
  flex: 1;
  height: 6px;
  background: var(--gray-200);
  border-radius: 99px;
  overflow: hidden;
}
.util-bar-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--pink-gradient);
  transition: width .5s ease;
}
.util-pct { font-size: 11px; font-weight: 700; color: var(--pink-500); min-width: 32px; }

/* Viz card */
.viz-card {
  background: #fff;
  border-radius: var(--radius-lg);
  border: 1.5px solid var(--pink-100);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.viz-tabs {
  display: flex;
  gap: 0;
  border-bottom: 1.5px solid var(--pink-100);
  background: var(--pink-gradient-soft);
  padding: 0 16px;
  overflow-x: auto;
  scrollbar-width: none; /* Hide scrollbar for cleaner look */
  -ms-overflow-style: none;
}
.viz-tabs::-webkit-scrollbar { display: none; }
.viz-tab {
  flex-shrink: 0;
  padding: 12px 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--gray-600);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -1.5px;
  transition: transform .2s, border-color .2s;
  white-space: nowrap;
}
.viz-tab:hover { color: var(--pink-500); }
.viz-tab.active {
  color: var(--pink-500);
  border-bottom-color: var(--pink-500);
  background: rgba(255,255,255,.6);
}
.viz-tab br { display: block; content: ""; margin-top: 2px; }

.viz-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0;
  padding: 20px;
  gap: 20px;
}
.viz-col { display: flex; flex-direction: column; gap: 10px; }

.viz-legend {
  grid-column: 1 / -1;
  display: flex;
  flex-wrap: wrap;
  gap: 15px;
  justify-content: center;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--pink-100);
  margin-bottom: 5px;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  color: var(--gray-700);
}
.legend-box {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  display: inline-block;
}
.legend-box.norm { background: rgba(37,99,235,.7); border: 1px solid #2563eb; }
.legend-box.rot  { background: rgba(8,145,178,.7); border: 1px solid #0891b2; }
.legend-box.dash { border: 1px dashed #1d4ed8; background: rgba(37,99,235,.1); }

.viz-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--gray-700);
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.canvas-wrap {
  border: 1.5px solid var(--pink-100);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--gray-50);
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 260px;
  position: relative;
}
.clickable-canvas {
  cursor: pointer;
  transition: all .25s ease;
}
.clickable-canvas:hover {
  border-color: var(--pink-300);
  box-shadow: 0 8px 24px rgba(37,99,235,.15);
  transform: translateY(-2px);
}
.canvas-zoom-hint {
  position: absolute;
  bottom: 15px;
  background: rgba(15,23,42,.7);
  color: #fff;
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 11px;
  font-weight: 500;
  pointer-events: none;
  opacity: 0;
  transform: translateY(10px);
  transition: background-color .2s, border-color .2s;
}
.clickable-canvas:hover .canvas-zoom-hint {
  opacity: 1;
  transform: translateY(0);
}
.canvas-wrap canvas { max-width: 100%; }

/* =====================================================
   LOADING OVERLAY
   ===================================================== */
.calculating-pulse {
  animation: pulse 1s infinite alternate;
}
@keyframes pulse {
  from { opacity: 1; }
  to   { opacity: .6; }
}

/* =====================================================
   SCROLLBAR GLOBAL
   ===================================================== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--pink-200); border-radius: 99px; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .result-cols { grid-template-columns: 1fr; }
  .viz-body    { grid-template-columns: 1fr; }
}
/* =====================================================
   CUSTOM SIZE ROW
   ===================================================== */
.custom-size-row {
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 6px;
  margin-bottom: 4px;
}
.custom-size-row input {
  flex: 1;
  padding: 6px 8px;
  border: 1.5px dashed var(--pink-200);
  border-radius: var(--radius-sm);
  font-family: var(--font);
  font-size: 12px;
  color: var(--gray-900);
  background: var(--pink-50);
  outline: none;
  min-width: 0;
  transition: border-color .2s, transform .2s;
}
.custom-size-row input:focus {
  border-color: var(--pink-400);
  border-style: solid;
  background: #fff;
  box-shadow: 0 0 0 2px rgba(235,47,150,.1);
}
.custom-size-x {
  font-size: 13px;
  font-weight: 700;
  color: var(--pink-400);
  flex-shrink: 0;
}
.btn-add-size {
  width: 28px;
  height: 28px;
  background: var(--pink-gradient);
  color: #fff;
  border: none;
  border-radius: 50%;
  font-size: 18px;
  font-weight: 700;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px rgba(37,99,235,.3);
  transition: all .2s;
  line-height: 1;
}
.btn-add-size:hover {
  transform: scale(1.15);
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}

/* =====================================================
   POPUP / MODAL
   ===================================================== */
#popupModal {
  position: fixed;
  inset: 0;
  z-index: 9999;
}
.popup-overlay {
  width: 100%;
  height: 100%;
  background: rgba(15,23,42,.55);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  box-sizing: border-box;
  animation: fadeInOverlay .2s ease;
}
@keyframes fadeInOverlay {
  from { opacity: 0; }
  to   { opacity: 1; }
}
.popup-card {
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: 0 24px 80px rgba(15,23,42,.3);
  max-width: 820px;
  width: 100%;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: slideUpCard .25s cubic-bezier(.4,0,.2,1);
  display: flex;
  flex-direction: column;
  gap: 0;
}
@keyframes slideUpCard {
  from { transform: translateY(30px); opacity: 0; }
  to   { transform: translateY(0);    opacity: 1; }
}
.popup-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 32px; height: 32px;
  background: var(--gray-100);
  border: none;
  border-radius: 50%;
  font-size: 14px;
  color: var(--gray-600);
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: all .15s;
  z-index: 1;
}
.popup-close:hover {
  background: var(--pink-100);
  color: var(--pink-600);
}
.popup-header {
  padding: 24px 28px 12px;
  border-bottom: 1px solid var(--gray-100);
}
.popup-title {
  font-size: 18px;
  font-weight: 700;
  color: var(--gray-900);
  margin: 0 0 4px;
}
.popup-subtitle {
  font-size: 12px;
  color: var(--gray-600);
  margin: 0;
  line-height: 1.5;
}
.popup-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 12px 28px;
  background: var(--pink-50);
  border-bottom: 1px solid var(--pink-100);
}
.legend-item {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 99px;
  color: #fff;
}
.legend-normal  { background: #2563eb; }
.legend-rotated { background: #0891b2; }
.popup-canvas-wrap {
  padding: 20px 28px;
  display: flex;
  justify-content: center;
  align-items: center;
  background: var(--gray-50);
}
.popup-canvas-wrap canvas {
  max-width: 100%;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-md);
}
.popup-footer {
  padding: 10px 28px 18px;
  border-top: 1px solid var(--gray-100);
}
.popup-hint {
  font-size: 11px;
  color: var(--gray-600);
  font-style: italic;
}

/* ── Popup trigger button in table ── */
.btn-popup {
  background: none;
  border: 1.5px solid var(--pink-200);
  border-radius: var(--radius-sm);
  padding: 3px 7px;
  font-size: 14px;
  cursor: pointer;
  color: var(--pink-500);
  transition: all .15s;
  white-space: nowrap;
}
.btn-popup:hover {
  background: var(--pink-50);
  border-color: var(--pink-400);
  transform: scale(1.1);
}

/* ── MIX badge in table row ── */
.result-table td { vertical-align: middle; }

/* =====================================================
   RESPONSIVE
   ===================================================== */
@media (max-width: 1024px) {
  .result-cols { grid-template-columns: 1fr; }
  .viz-body    { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  .app-main { flex-direction: column; padding: 12px; }
  .form-panel { width: 100%; position: static; max-height: none; }
  .popup-card { border-radius: var(--radius-lg); }
  .popup-header, .popup-canvas-wrap { padding-left: 16px; padding-right: 16px; }
}

/* =====================================================
   USER MENU & AUTH UI
   ===================================================== */
.header-right {
  display: flex;
  align-items: center;
  gap: 20px;
}
.btn-login-header {
  background: var(--pink-gradient);
  color: #fff !important;
  text-decoration: none;
  font-size: 13px;
  font-weight: 700;
  padding: 8px 18px;
  border-radius: 99px;
  transition: all 0.2s;
  box-shadow: 0 4px 12px rgba(37,99,235,.25);
}
.btn-login-header:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 15px rgba(37,99,235,.35);
}

.user-menu {
  position: relative;
  display: flex;
  align-items: center;
}
.user-info {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  padding: 6px 14px;
  border-radius: 99px;
  background: var(--pink-50);
  border: 1.5px solid var(--pink-100);
  transition: all 0.2s;
}
.user-info:hover {
  background: var(--pink-100);
  border-color: var(--pink-200);
}
.user-info span {
  font-weight: 700;
  color: var(--pink-700);
  font-size: 13px;
}
.user-avatar {
  width: 28px;
  height: 28px;
  background: #fff;
  border: 1px solid var(--pink-200);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
}

.user-dropdown {
  position: absolute;
  top: 100%;
  right: 0;
  margin-top: 10px;
  background: #fff;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  border: 1px solid var(--pink-100);
  min-width: 200px;
  display: none;
  z-index: 1000;
  overflow: hidden;
  animation: slideDown 0.2s ease-out;
}
@keyframes slideDown {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}
.user-dropdown a {
  display: block;
  padding: 12px 16px;
  color: var(--gray-700);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
  transition: background 0.2s;
}
.user-dropdown a:hover {
  background: var(--pink-50);
  color: var(--pink-600);
}
.user-dropdown hr {
  margin: 0;
  border-top: 1px solid var(--pink-100);
}

/* =====================================================
   HIGHLIGHT PRICE
   ===================================================== */
.summary-item.highlight-price {
  background: rgba(255, 255, 255, 0.12);
  padding: 8px 24px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(255, 255, 255, 0.25);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.summary-item.highlight-price .summary-value {
  color: #fff;
  font-size: 24px;
  font-weight: 900;
  line-height: 1.2;
}
.summary-item.highlight-price .summary-label {
  color: var(--pink-100);
  font-size: 10px;
  margin-bottom: 2px;
}
.summary-item.highlight-price .summary-unit {
  color: rgba(255,255,255,.7);
  font-size: 10px;
}

.summary-item.highlight-clicks {
  background: rgba(8, 145, 178, 0.15); /* Cyan-ish tint */
  padding: 8px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(8, 145, 178, 0.3);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.summary-item.highlight-clicks .summary-value {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}
.summary-item.highlight-clicks .summary-label {
  color: #ecfeff;
  font-size: 10px;
  margin-bottom: 2px;
}
.summary-item.highlight-clicks .summary-unit {
  color: rgba(236, 254, 255, 0.8);
  font-size: 9px;
}

.summary-item.highlight-paper {
  background: rgba(37, 99, 235, 0.1); /* Soft Blue tint */
  padding: 8px 20px;
  border-radius: var(--radius-lg);
  border: 1px solid rgba(37, 99, 235, 0.2);
  text-align: center;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.summary-item.highlight-paper .summary-value {
  color: #fff;
  font-size: 22px;
  font-weight: 800;
  line-height: 1.2;
}
.summary-item.highlight-paper .summary-label {
  color: var(--pink-100);
  font-size: 10px;
  margin-bottom: 2px;
}
.summary-item.highlight-paper .summary-unit {
  color: rgba(255, 255, 255, 0.8);
  font-size: 9px;
}

