:root {
  --bg: #ffffff;
  --surface: #ffffff;
  --text: #2b1618;
  --muted: #7f686c;
  --line: #efd9dc;
  --soft: #ffffff;

  /* Đồng bộ theo ảnh mẫu: đỏ tươi chủ đạo + vàng cam điểm nhấn */
  --nav: #d81f26;
  --nav-soft: #ef343c;
  --nav-deep: #b8161d;

  --primary: #e1262f;
  --primary-dark: #c61d25;
  --primary-strong: #a9151d;
  --primary-soft: #ffffff;

  --accent: #f6a623;
  --accent-dark: #dc8f12;
  --accent-soft: #fff7e8;

  --warning: #c47a0a;
  --warning-soft: #fff7e6;

  --danger: #b71c1c;
  --danger-soft: #fff1f1;

  --success: #24a35a;
  --success-soft: #edf9f1;

  --shadow: 0 10px 28px rgba(177, 23, 30, 0.08);
  --shadow-strong: 0 18px 42px rgba(177, 23, 30, 0.18);
  --radius: 12px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  min-width: 320px;
  min-height: 100vh;
  overflow-x: hidden;
  background: #ffffff;
  color: #333333;
  font-family: Inter, "Segoe UI", Arial, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  opacity: 0;
  animation: fadeInBody 0.35s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

@keyframes fadeInBody {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes slideUpContent {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

button, input, select { font: inherit; }

.app-shell {
  width: 100%;
  min-height: 100vh;
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  align-items: stretch;
}

.sidebar {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  background: 
    linear-gradient(90deg, rgba(255,255,255,0.05) 0%, rgba(255,255,255,0) 50%, rgba(0,0,0,0.12) 100%),
    linear-gradient(180deg, #7A0C11 0%, #D32F2F 55%, #FF4D55 100%);
  color: #fff;
  padding: 24px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: 8px 0 32px rgba(122, 12, 17, 0.15);
}

.brand {
  display: flex;
  gap: 12px;
  align-items: center;
  padding: 0 6px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.16);
}

.brand-mark {
  width: 52px;
  height: 52px;
  flex: 0 0 52px;
  padding: 6px;
  overflow: hidden;
  border-radius: 20px;
  background: #ffffff;
  border: 1px solid #FFCDD2;
  box-shadow: 0 8px 24px rgba(0,0,0,0.06);
  display: grid;
  place-items: center;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  -webkit-box-reflect: below 6px linear-gradient(transparent 50%, rgba(255,255,255,0.15));
}

.brand-mark:hover {
  transform: rotate(5deg) scale(1.05);
}

.brand-mark img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center;
}

.brand strong, .brand span { display: block; }
.brand strong { font-size: 13px; line-height: 1.3; font-weight: 700; letter-spacing: 0.2px; }
.brand span {
  color: rgba(255,255,255,0.72);
  font-size: 10px;
  margin-top: 2px;
}

.main-nav {
  display: grid;
  gap: 8px;
  margin-top: 24px;
}

.nav-item {
  width: 100%;
  border: 0;
  background: transparent;
  color: rgba(255,255,255,0.72);
  display: grid;
  grid-template-columns: 32px minmax(0, 1fr);
  gap: 10px;
  align-items: center;
  text-align: left;
  padding: 12px 10px;
  border-radius: 8px;
  cursor: pointer;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}

.nav-item:hover {
  background: rgba(255,255,255,0.08);
  color: #fff;
}

.nav-item.active {
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
  font-weight: 600;
  box-shadow: 0 4px 16px rgba(255, 255, 255, 0.05);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 15%;
  height: 70%;
  width: 4px;
  background: #ffffff;
  border-radius: 2px;
  box-shadow: 0 0 10px rgba(255, 255, 255, 0.8);
}

.nav-icon {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255,255,255,0.18);
  border-radius: 8px;
  display: grid;
  place-items: center;
  background: rgba(255,255,255,0.05);
  color: rgba(255,255,255,0.8);
  transition: all 0.2s ease;
}

.nav-icon svg {
  display: block;
  stroke: currentColor;
  stroke-width: 1.8;
}

.nav-item.active .nav-icon {
  border-color: rgba(255, 255, 255, 0.4);
  background: rgba(255, 255, 255, 0.18);
  color: #ffffff;
}

.nav-item b, .nav-item small { display: block; }
.nav-item b { font-size: 13px; line-height: 1.3; }
.nav-item small {
  font-size: 10px;
  line-height: 1.35;
  color: rgba(255,255,255,0.72);
  margin-top: 1px;
}

.sidebar-note {
  margin-top: auto;
  display: flex;
  gap: 10px;
  align-items: flex-start;
  background: rgba(255,255,255,0.10);
  border: 1px solid rgba(246,166,35,0.22);
  padding: 12px;
  border-radius: 10px;
}

.sidebar-note b, .sidebar-note small { display: block; }
.sidebar-note b { font-size: 12px; }
.sidebar-note small {
  font-size: 10px;
  color: rgba(255,255,255,0.76);
  margin-top: 3px;
}

.status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  background: var(--accent);
  display: inline-block;
  flex: 0 0 auto;
  margin-top: 4px;
}
.status-dot.online {
  background: var(--success);
  box-shadow: 0 0 0 4px rgba(36,163,90,0.14);
}
.status-dot.offline {
  background: var(--danger);
  box-shadow: 0 0 0 4px rgba(183,28,28,0.12);
}

.workspace {
  width: 100%;
  min-width: 0;
  padding: 24px 28px 40px;
  animation: fadeIn 0.4s ease-out forwards;
  background: radial-gradient(circle at 50% 0%, rgba(244, 67, 54, 0.03) 0%, rgba(255, 255, 255, 0) 70%), #FFFFFF;
}

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

.topbar {
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: flex-start;
}

.eyebrow {
  margin: 0 0 5px;
  color: var(--primary);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.topbar h1 {
  font-size: 29px;
  font-weight: 800;
  line-height: 1.25;
  margin: 0;
  color: #D32F2F;
}

.topbar p:not(.eyebrow) {
  color: var(--muted);
  margin: 7px 0 0;
  max-width: 850px;
}

.system-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: 999px;
  padding: 8px 13px;
  color: #694447;
  font-size: 12px;
  white-space: nowrap;
  box-shadow: 0 6px 16px rgba(177,23,30,0.06);
}
.system-badge .status-dot { margin: 0; }

.workflow {
  width: 100%;
  max-width: none;
  margin: 0 0 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  display: flex;
  align-items: center;
  padding: 14px 18px;
  box-shadow: var(--shadow);
}

.workflow-step {
  display: flex;
  align-items: center;
  gap: 9px;
  min-width: 174px;
}

.workflow-step > span {
  width: 29px;
  height: 29px;
  border-radius: 50%;
  border: 1px solid #dfb7bb;
  display: grid;
  place-items: center;
  background: #fff;
  font-size: 12px;
  font-weight: 700;
  color: #966d72;
}

.workflow-step.active > span {
  background: var(--primary);
  border-color: var(--primary);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(225,38,47,0.10);
}

.workflow-step.active b { color: var(--primary-dark); }
.workflow-step b, .workflow-step small { display: block; }
.workflow-step b { font-size: 12px; }
.workflow-step small { font-size: 10px; color: var(--muted); }

.workflow-line {
  height: 2px;
  background: linear-gradient(90deg, var(--line), rgba(246,166,35,0.48), var(--line));
  flex: 1;
  margin: 0 14px;
}

.content-grid {
  width: 100%;
  max-width: none;
  margin: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

/* Khi mở lại cột phụ đang comment trong HTML, bố cục tự chia hai cột. */
.content-grid:has(> .secondary-column) {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.primary-column {
  width: 100%;
  min-width: 0;
  display: grid;
  gap: 16px;
}

.primary-column > * {
  width: 100%;
  min-width: 0;
}

.secondary-column {
  display: grid;
  gap: 16px;
}

.surface {
  width: 100%;
  min-width: 0;
  overflow: hidden;
  background: var(--surface);
  border: 1px solid rgba(0, 0, 0, 0.06);
  border-radius: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.02), 0 8px 24px rgba(0,0,0,0.04), 0 16px 32px rgba(0,0,0,0.06);
  transition: box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideUpContent 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.surface:hover {
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

form.surface { padding: 24px 28px; }

.section-heading, .progress-head, .result-title-row {
  display: flex;
  justify-content: space-between;
  gap: 20px;
  align-items: center;
}

.section-heading > div, .progress-head > div, .result-title-row > div {
  display: flex;
  align-items: center;
  gap: 12px;
}

.section-heading h2, .progress-head h2, .result-title-row h2 {
  margin: 0;
  font-size: 20px;
  color: #D32F2F;
  font-weight: 700;
}

.section-heading p, .progress-head p, .result-title-row p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.section-number {
  width: 34px;
  height: 34px;
  border-radius: 8px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(225,38,47,0.16);
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
}

.privacy-label, .required {
  font-size: 10px;
  font-weight: 800;
  letter-spacing: .04em;
  border-radius: 999px;
  padding: 5px 9px;
}

.privacy-label {
  background: #ffffff;
  color: #8b3a40;
}

.required {
  background: var(--accent-soft);
  color: var(--accent-dark);
  border: 1px solid rgba(246,166,35,0.24);
}

.form-section { margin-top: 18px; }
.divider-top {
  border-top: 0.5px solid rgba(211, 47, 47, 0.15);
  padding-top: 24px;
}

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

.upload-box {
  position: relative;
  min-height: 132px;
  border: 1px dashed #FFCDD2;
  border-radius: 14px;
  background: #FAFAFA;
  padding: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  transition: all .25s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideUpContent 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
}

.upload-box:hover,
.upload-box.has-file {
  border-color: #F44336;
  background: #FFF8F8;
  box-shadow: 0 6px 20px rgba(244, 67, 54, 0.08);
  transform: translateY(-2px);
}

.upload-box.single { max-width: 100%; }
.upload-box input, .file-picker input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #B0BEC5;
  border: 1px solid #E0E0E0;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-icon svg {
  display: block;
  stroke: currentColor;
}

.upload-box:hover .upload-icon {
  background: #FFF5F5;
  color: #F44336;
  border-color: rgba(244, 67, 54, 0.3);
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.06);
}

.upload-box.has-file .upload-icon {
  display: none !important;
}

.upload-badge {
  display: none;
  font-size: 10px;
  font-weight: bold;
  color: #FFFFFF;
  padding: 4px 10px;
  border-radius: 999px;
  margin-bottom: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.upload-badge.success-badge {
  background: #24a35a;
}

.upload-badge.warning-badge {
  background: #FFC107;
  color: #333333;
}

.upload-box.has-file .upload-badge {
  display: inline-block;
}

.remove-single-file {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid #FFCDD2;
  background: #ffffff;
  color: #D32F2F;
  font-size: 14px;
  font-weight: normal;
  display: none;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  z-index: 10;
  transition: all 0.2s ease;
  padding: 0;
}

.upload-box.has-file .remove-single-file {
  display: inline-flex;
}

.remove-single-file:hover {
  background: #D32F2F;
  color: #ffffff;
  border-color: #D32F2F;
  transform: scale(1.05);
}

.upload-box b { font-size: 14px; }
.upload-box small { color: var(--muted); font-size: 11px; }
.upload-box em {
  display: inline-block;
  background: #ffffff;
  border: 1px solid #FFCDD2;
  border-radius: 8px;
  padding: 6px 16px;
  margin-top: 10px;
  font-style: normal;
  font-weight: 500;
  color: #333333;
  max-width: 90%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}

.field-header {
  display: flex;
  justify-content: space-between;
  gap: 15px;
  align-items: flex-start;
}
.field-header h3 { margin: 0; font-size: 15px; }
.field-header p { margin: 4px 0 0; color: var(--muted); font-size: 12px; }

.file-picker {
  position: relative;
  margin-top: 10px;
  min-height: 52px;
  border: 1px solid #e2bcc1;
  border-radius: 8px;
  padding: 11px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  cursor: pointer;
  background: #fff;
  transition: border-color .2s ease, box-shadow .2s ease, background .2s ease;
}

.file-picker.large {
  min-height: 78px;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.file-picker:hover {
  border-color: var(--primary);
  background: var(--primary-soft);
  box-shadow: 0 8px 18px rgba(225,38,47,0.08);
}

.file-picker span { font-weight: 700; color: var(--primary); }
.file-picker small { color: var(--muted); font-size: 11px; }

.selected-list {
  margin-top: 10px;
  display: grid;
  gap: 7px;
}

.selected-list.empty-state,
.recent-jobs.empty-state {
  border: 1px dashed var(--line);
  border-radius: 9px;
  padding: 14px;
  color: #94797d;
  text-align: center;
  font-size: 12px;
}

/* Bố cục mới cho phần Danh sách hồ sơ nhà thầu */
.bidder-section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}

.bidder-section-header h3 {
  font-size: 18px;
  font-weight: 700;
  color: #333333;
}

.bidder-list-container {
  position: relative;
  background: #FFFFFF;
  border: 1px solid #FFCDD2;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  padding: 20px;
  min-height: 124px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.bidder-list-container:not(.empty-state) {
  background: #FFF5F5;
  padding-top: 44px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  justify-content: flex-start;
}

.bidder-list-container:not(.empty-state):hover {
  border-color: #F44336;
  box-shadow: 0 8px 24px rgba(244, 67, 54, 0.08);
}

.bidder-list-upload-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 10;
}

/* Before upload (empty-state) */
.bidder-list-container.empty-state .bidder-list-upload-btn {
  color: #9E9E9E;
  background: transparent;
  border: none;
}

.bidder-list-container.empty-state .bidder-list-upload-btn:hover {
  color: #F44336;
  transform: scale(1.1);
}

/* After upload (populated state) */
.bidder-list-container:not(.empty-state) .bidder-list-upload-btn {
  color: #F44336;
  border: 1px solid rgba(244, 67, 54, 0.15);
  background: #FFF5F5;
  box-shadow: 0 2px 8px rgba(244, 67, 54, 0.06);
  right: 12px;
}

.bidder-list-container:not(.empty-state) .bidder-list-upload-btn:hover {
  background: #FFF0F0;
  box-shadow: 0 4px 12px rgba(244, 67, 54, 0.18), 0 0 0 3px rgba(244, 67, 54, 0.08);
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.06);
}

/* Empty content centered */
.bidder-list-empty-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: #757575;
  text-align: center;
  user-select: none;
}

.bidder-list-empty-content .upload-icon {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: #ffffff;
  color: #D32F2F;
  border: 1px solid #FFCDD2;
  display: grid;
  place-items: center;
  margin-bottom: 12px;
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  cursor: pointer;
}

.bidder-list-container.empty-state:hover .upload-icon {
  background: #FFF5F5;
  color: #F44336;
  border-color: rgba(244, 67, 54, 0.3);
  transform: translateY(-2px) scale(1.05);
  filter: brightness(1.06);
}

.bidder-list-empty-content .empty-text {
  font-size: 13.5px;
  font-weight: 500;
  color: #757575;
}


/* Custom Row-based Bidder selected files */
.bidder-list-container .selected-file {
  border: none;
  background: transparent;
  box-shadow: none;
  padding: 12px 0;
  border-radius: 0;
  width: 100%;
  display: flex;
  flex-direction: row;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  min-height: 0;
  animation: none;
}

.bidder-list-container .selected-file::after {
  display: none !important;
}

.bidder-list-container .selected-file:hover {
  background: transparent;
  border-color: transparent;
  box-shadow: none;
}

.bidder-list-container .selected-file:not(:first-of-type) {
  border-top: 1px dashed rgba(211, 47, 47, 0.15);
  padding-top: 16px;
}

/* Row-based inner items formatting */
.selected-file-left {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
  flex: 1;
}

.selected-file-left .file-name {
  color: #333333;
  font-weight: 700;
  font-size: 13.5px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file-left .success-badge {
  background: #4CAF50 !important;
  color: #FFFFFF !important;
  display: inline-block;
  font-size: 10px;
  font-weight: bold;
  padding: 4px 10px;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 0;
  flex-shrink: 0;
}

.selected-file-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}

.selected-file-right .remove-single-file {
  position: static;
  display: inline-flex;
}

.required.success-badge {
  color: #24a35a !important;
  background: #edf9f1 !important;
}

.mode-note {
  margin-top: 10px;
  border: 1px solid #f3cf96;
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  background: var(--accent-soft);
  color: #8a5412;
  padding: 10px 11px;
  font-size: 11px;
}

.mode-note.single {
  background: #ffffff;
  border-color: #efc9cd;
  border-left-color: var(--primary);
  color: #8b3d43;
}

.mode-note.multi {
  background: var(--accent-soft);
  border-color: #f0cf9a;
  border-left-color: var(--accent);
  color: #8a5412;
}

.selected-file {
  position: relative;
  overflow: hidden;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 16px;
  border: 1px solid #FFCDD2;
  border-radius: 8px;
  background: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.02);
  gap: 16px;
  animation: fileSlideLeft 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
  transition: border-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), background-color 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

@keyframes fileSlideLeft {
  from { opacity: 0; transform: translateX(15px); }
  to { opacity: 1; transform: translateX(0); }
}

.selected-file.removing {
  opacity: 0;
  transform: translateX(-15px);
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

.selected-file .file-info {
  min-width: 0;
  flex: 1;
}

.selected-file .file-info b {
  font-size: 13px;
  font-weight: 600;
  color: #333333;
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.selected-file .file-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.selected-file .file-size {
  font-size: 11px;
  color: #757575;
}

.threshold-grid input,
.ocr-options select {
  width: 100%;
  border: 1px solid #e0c6ca;
  border-radius: 7px;
  padding: 8px;
  background: #fff;
  color: var(--text);
}

.threshold-grid input:focus,
.ocr-options select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(225,38,47,0.10);
}

.remove-file {
  border: 0;
  background: transparent;
  color: #D32F2F;
  cursor: pointer;
  font-size: 18px;
  display: grid;
  place-items: center;
  padding: 0;
  transition: color 0.2s ease, opacity 0.2s ease, transform 0.2s ease;
  opacity: 0.85;
}
.remove-file:hover {
  color: #B71C1C;
  opacity: 1;
  transform: scale(1.1);
}

.advanced-settings {
  margin-top: 17px;
  border-top: 1px solid var(--line);
  padding-top: 15px;
}
.advanced-settings summary {
  font-weight: 700;
  color: var(--primary-dark);
  cursor: pointer;
}
.advanced-settings > p { color: var(--muted); font-size: 11px; }

.threshold-grid {
  display: grid;
  grid-template-columns: repeat(4,1fr);
  gap: 8px;
}

.threshold-grid label,
.ocr-options label {
  font-size: 11px;
  font-weight: 700;
  color: #6b484d;
}

.ocr-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-top: 14px;
}

.check-row {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  margin-top: 15px;
  cursor: pointer;
}
.check-row input {
  margin-top: 4px;
  accent-color: var(--primary);
}
.check-row b, .check-row small { display: block; }
.check-row b { font-size: 12px; }
.check-row small { font-size: 11px; color: var(--muted); }

.form-actions {
  border-top: 1px solid var(--line);
  margin-top: 20px;
  padding-top: 16px;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.button {
  border: 0;
  border-radius: 24px;
  min-height: 40px;
  padding: 9px 24px;
  font-weight: 700;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

.button:hover:not(:disabled) {
  filter: brightness(1.06);
  transform: scale(1.03);
}

.button:active:not(:disabled) {
  transform: scale(0.97);
  transition: transform 80ms cubic-bezier(0.4, 0, 0.2, 1);
}

.button.primary {
  background: linear-gradient(135deg, #FF5252 0%, #F44336 50%, #D32F2F 100%);
  color: #fff;
  min-width: 185px;
  border-radius: 30px;
  box-shadow: 0 4px 15px rgba(211, 47, 47, 0.25), 0 1px 3px rgba(0, 0, 0, 0.1);
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
}

.button.primary::after {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.25), transparent);
  transition: none;
}

.button.primary:hover::after {
  left: 100%;
  transition: left 0.8s ease-in-out;
}

.button.primary:hover:not(:disabled) {
  transform: scale(1.03);
  box-shadow: 0 8px 24px rgba(211, 47, 47, 0.35), 0 2px 6px rgba(0, 0, 0, 0.15);
  filter: brightness(1.06);
}

.button.ghost {
  background: #ffffff;
  color: #D32F2F;
  border: 1px solid #D32F2F;
  border-radius: 30px;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}
.button.ghost:hover:not(:disabled) {
  background: #FFEBEE;
  color: #D32F2F;
  border-color: #D32F2F;
  transform: scale(1.03);
  filter: brightness(1.06);
}
.button.small { padding: 8px 11px; font-size: 11px; }
.button:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}
.button-arrow {
  margin-left: 15px;
  color: #ffd892;
}

.hidden { display: none !important; }
.progress-panel, .result-panel { padding: 20px 22px; }
.progress-head > b { font-size: 21px; color: var(--primary); }

.progress-track {
  height: 10px;
  background: #ffffff;
  border-radius: 999px;
  overflow: hidden;
  margin-top: 18px;
}

.progress-track > div {
  height: 100%;
  width: 0;
  background: linear-gradient(90deg, var(--primary), var(--accent));
  border-radius: 999px;
  transition: width .3s ease;
  box-shadow: 0 0 14px rgba(246,166,35,0.24);
}

.progress-meta {
  display: flex;
  justify-content: space-between;
  color: var(--muted);
  font-size: 10px;
  margin-top: 8px;
}

.result-check {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(225,38,47,0.16);
  font-weight: 900;
  font-size: 19px;
}

.result-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 9px;
  margin-top: 20px;
}

.download-button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border-radius: 8px;
  padding: 10px 13px;
  text-decoration: none;
  font-weight: 700;
  font-size: 12px;
  transition: transform .2s ease, box-shadow .2s ease, background .2s ease;
}

.download-button.primary {
  background: var(--primary);
  color: #fff;
  box-shadow: 0 7px 16px rgba(225,38,47,0.18);
}
.download-button.primary:hover {
  background: var(--primary-dark);
  transform: translateY(-1px);
}
.download-button.secondary {
  background: var(--accent-soft);
  color: #8a5412;
  border: 1px solid #f1d39f;
}
.download-button.secondary:hover {
  background: #ffefc9;
  box-shadow: 0 7px 16px rgba(246,166,35,0.12);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 8px;
  margin-top: 16px;
}

.metric {
  border: 1px solid var(--line);
  border-top: 3px solid rgba(246,166,35,0.78);
  border-radius: 9px;
  padding: 12px;
  background: var(--soft);
}
.metric:nth-child(odd) { border-top-color: rgba(225,38,47,0.76); }
.metric b, .metric span { display: block; }
.metric b { font-size: 19px; color: var(--primary-dark); }
.metric span { font-size: 10px; color: var(--muted); margin-top: 2px; }

.block-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.block-title h3 { margin: 0; font-size: 14px; }
.block-title span { font-size: 10px; color: var(--muted); }

.warnings-block, .table-block, .document-results { margin-top: 20px; }
.warnings-block {
  background: var(--warning-soft);
  border: 1px solid #f2d296;
  border-left: 4px solid var(--accent);
  border-radius: 9px;
  padding: 14px;
}
.warning-item {
  font-size: 11px;
  color: #875316;
  padding: 6px 0;
  border-bottom: 1px solid rgba(196,122,10,0.13);
}
.warning-item:last-child { border: 0; }

.table-wrap {
  border: 1px solid var(--line);
  border-radius: 9px;
  overflow: auto;
  max-height: 520px;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 850px;
}

th, td {
  padding: 9px 10px;
  border-bottom: 1px solid #f3e3e5;
  text-align: left;
  vertical-align: top;
  font-size: 11px;
}

th {
  position: sticky;
  top: 0;
  background: #ffffff;
  z-index: 1;
  color: #74494d;
  border-bottom: 2px solid #eccacf;
}

tbody tr:hover { background: #fff8f8; }

.severity {
  font-weight: 800;
  white-space: nowrap;
}
.severity.critical { color: var(--danger); }
.severity.warning { color: var(--accent-dark); }
.severity.review { color: #a86308; }

.document-card {
  border: 1px solid var(--line);
  border-left: 3px solid rgba(225,38,47,0.6);
  border-radius: 9px;
  padding: 13px;
  margin-top: 9px;
  background: #fff;
}

.document-card-head {
  display: flex;
  justify-content: space-between;
  gap: 12px;
}
.document-card h4 { margin: 0; font-size: 13px; }
.document-card p { margin: 3px 0 0; color: var(--muted); font-size: 10px; }

.document-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 10px;
}
.document-stats span {
  background: var(--accent-soft);
  color: #8a5412;
  border: 1px solid #f1d5a7;
  border-radius: 6px;
  padding: 5px 8px;
  font-size: 10px;
}

.guide-card, .recent-card { padding: 18px; }
.guide-card h2, .recent-card h2 { margin: 0; font-size: 15px; }
.guide-card ol {
  list-style: none;
  padding: 0;
  margin: 16px 0 0;
  display: grid;
  gap: 14px;
}
.guide-card li {
  display: flex;
  gap: 10px;
}
.guide-card li > span {
  width: 25px;
  height: 25px;
  border-radius: 7px;
  background: var(--primary-soft);
  color: var(--primary);
  border: 1px solid rgba(225,38,47,0.14);
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 10px;
  flex: 0 0 auto;
}
.guide-card p { margin: 0; }
.guide-card b, .guide-card small { display: block; }
.guide-card b { font-size: 11px; }
.guide-card small { color: var(--muted); font-size: 10px; margin-top: 2px; }

.side-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.side-heading button {
  border: 0;
  background: transparent;
  color: var(--primary);
  font-size: 10px;
  cursor: pointer;
}
.side-heading button:hover { color: var(--accent-dark); }

.recent-jobs {
  display: grid;
  gap: 8px;
  margin-top: 13px;
}

.recent-job {
  border: 1px solid var(--line);
  border-left: 3px solid rgba(246,166,35,0.68);
  border-radius: 8px;
  padding: 10px;
  cursor: pointer;
  background: var(--soft);
  transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.recent-job:hover {
  border-color: #ecab58;
  transform: translateY(-1px);
  box-shadow: 0 7px 16px rgba(196,122,10,0.08);
}
.recent-job b, .recent-job small { display: block; }
.recent-job b { font-size: 11px; }
.recent-job small { font-size: 9px; color: var(--muted); margin-top: 3px; }

.security-card {
  background: #ffffff;
  border: 1px solid #efc8cb;
  border-radius: var(--radius);
  padding: 15px;
  display: flex;
  gap: 11px;
}

.shield {
  width: 29px;
  height: 29px;
  border-radius: 8px;
  background: linear-gradient(135deg, var(--primary), var(--accent-dark));
  color: #fff;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  box-shadow: 0 6px 14px rgba(225,38,47,0.20);
}

.security-card b { font-size: 12px; color: var(--primary-dark); }
.security-card p { margin: 3px 0 0; color: #7c555a; font-size: 10px; }

.toast {
  position: fixed;
  right: 24px;
  bottom: 24px;
  max-width: 380px;
  background: #1F1F1F;
  color: #ffffff;
  padding: 16px 20px;
  border-left: 4px solid #D32F2F;
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.18), 0 2px 6px rgba(0, 0, 0, 0.06);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  font-size: 13.5px;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.toast.success {
  border-left-color: #24a35a;
}

.toast.error {
  position: fixed;
  left: 50%;
  top: 50%;
  right: auto;
  bottom: auto;
  transform: translate(-50%, -50%) scale(0.95);
  max-width: 500px;
  width: 90%;
  padding: 24px;
  background: #FFFFFF;
  color: #333333;
  border: 2px solid #D32F2F;
  border-radius: 12px;
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
  text-align: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}

.toast.error.show {
  opacity: 1;
  transform: translate(-50%, -50%) scale(1);
  pointer-events: auto;
}

.toast-error-title {
  font-size: 20px;
  font-weight: bold;
  color: #D32F2F;
  margin: 0 0 12px 0;
  text-align: center;
  letter-spacing: 0.5px;
}

.toast-error-body {
  font-size: 14.5px;
  color: #333333;
  margin-bottom: 16px;
  text-align: center;
  line-height: 1.6;
  font-weight: 500;
}

.toast-error-close {
  background: #FFFFFF;
  border: 1.5px solid #D32F2F;
  color: #D32F2F;
  font-size: 13.5px;
  font-weight: 600;
  border-radius: 24px;
  padding: 10px 24px;
  cursor: pointer;
  transition: transform 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              filter 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              background-color 0.2s cubic-bezier(0.4, 0, 0.2, 1), 
              border-color 0.2s cubic-bezier(0.4, 0, 0.2, 1),
              box-shadow 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  outline: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
}

.toast-error-close:hover {
  background: #F44336;
  color: #FFFFFF;
  border-color: #F44336;
  box-shadow: 0 4px 14px rgba(244, 67, 54, 0.35);
  transform: scale(1.03);
  filter: brightness(1.06);
}

.toast-error-close:active {
  transform: scale(0.97);
  transition: transform 80ms cubic-bezier(0.4, 0, 0.2, 1);
}

/* Backdrop blur overlay when error modal is active */
body.modal-open::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1999;
  animation: toastBackdropFadeIn 0.25s ease forwards;
}

body:has(#toast.error.show)::before {
  content: "";
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.40);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  z-index: 1999;
  animation: toastBackdropFadeIn 0.25s ease forwards;
}

@keyframes toastBackdropFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (min-width: 0px) {
  .toast.error {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%) scale(0.95);
    max-width: 500px;
    width: 90%;
    padding: 24px;
    border: 2px solid #D32F2F;
    border-radius: 12px;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    transition: opacity 0.25s cubic-bezier(0.4, 0, 0.2, 1), transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  }
  .toast.error.show {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
  }
}

@media (max-width: 1180px) {
  .content-grid { grid-template-columns: minmax(0,1fr); }
  .secondary-column { grid-template-columns: 1fr 1fr; }
  .security-card { grid-column: 1 / -1; }
  .metrics { grid-template-columns: repeat(3,1fr); }
}

@media (max-width: 900px) {
  .app-shell { display: block; }
  .sidebar {
    position: relative;
    height: auto;
    padding: 14px;
  }
  .brand { padding-bottom: 14px; }
  .main-nav {
    display: flex;
    overflow: auto;
    margin-top: 12px;
  }
  .nav-item { min-width: 210px; }
  .sidebar-note { display: none; }
  .workspace { padding: 20px; }
  .workflow { overflow: auto; }
  .workflow-step { min-width: 170px; }
  .content-grid { display: block; }
  .secondary-column {
    margin-top: 18px;
    display: grid;
  }
  .topbar { align-items: flex-start; }
  .system-badge { display: none; }
}

@media (max-width: 650px) {
  .workspace { padding: 14px; }
  .topbar h1 { font-size: 22px; }
  .workflow { display: none; }
  .two-columns,
  .threshold-grid,
  .ocr-options,
  .secondary-column {
    grid-template-columns: 1fr;
  }
  .selected-file {
    flex-wrap: wrap;
    gap: 8px;
  }
  .metrics { grid-template-columns: repeat(2,1fr); }
  .section-heading,
  .progress-head,
  .result-title-row {
    align-items: flex-start;
  }
  .privacy-label { display: none; }
  .form-actions { flex-direction: column-reverse; }
  .button.primary { width: 100%; }
  .progress-meta { display: block; }
  .result-title-row { flex-direction: column; }
  .toast {
    left: 14px;
    right: 14px;
    bottom: 14px;
  }
}


/* ========================================================================== 
   BỐ CỤC CUỐI — PHỦ HẾT CHIỀU RỘNG, KHÔNG ĐỂ CỘT TRỐNG
   ========================================================================== */

.topbar,
.workflow,
.content-grid {
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
}

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

.content-grid:has(> .secondary-column) {
  grid-template-columns: minmax(0, 1fr) 300px;
}

.primary-column,
#workForm,
#progressPanel,
#resultPanel {
  width: 100%;
  min-width: 0;
}

@media (min-width: 1600px) {
  .app-shell {
    grid-template-columns: 270px minmax(0, 1fr);
  }

  .workspace {
    padding-left: 34px;
    padding-right: 34px;
  }

  .upload-box {
    min-height: 140px;
  }
}

@media (max-width: 1180px) {
  .app-shell {
    grid-template-columns: 238px minmax(0, 1fr);
  }

  .workspace {
    padding: 22px;
  }

  .content-grid:has(> .secondary-column) {
    grid-template-columns: minmax(0, 1fr);
  }

  .secondary-column {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .threshold-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 900px) {
  .app-shell {
    display: block;
  }

  .sidebar {
    position: relative;
    width: 100%;
    height: auto;
    overflow: visible;
    padding: 14px;
  }

  .workspace {
    padding: 18px;
  }

  .content-grid,
  .content-grid:has(> .secondary-column) {
    display: block;
  }

  .secondary-column {
    margin-top: 16px;
  }
}

@media (max-width: 650px) {
  .workspace {
    padding: 12px;
  }

  form.surface,
  .progress-panel,
  .result-panel {
    padding: 16px;
  }

  .two-columns,
  .threshold-grid,
  .ocr-options,
  .secondary-column {
    grid-template-columns: 1fr;
  }

  .file-picker {
    align-items: flex-start;
    flex-direction: column;
    gap: 2px;
  }

  .file-picker small {
    text-align: left;
  }
}

/* --- CUSTOM MICRO-INTERACTIONS AND ANIMATIONS --- */

/* Scroll behavior for long file lists */
.bidder-list-container,
.selected-list,
.table-wrap {
  scroll-behavior: smooth;
}

/* Label status fade-in */
@keyframes labelFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}
.upload-badge,
.required {
  animation: labelFadeIn 0.2s ease-in-out forwards;
}

/* Underline sweep effect for file names */
.selected-file:hover b,
.selected-file:hover .file-name,
.selected-file:hover .file-info b,
.upload-box:hover em {
  text-decoration: none !important;
}

.selected-file .file-info b {
  display: inline-block;
}

/* Diagonal shine sweep effect on hover */
.selected-file::after {
  content: '';
  position: absolute;
  top: 0;
  left: -150%;
  width: 50%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(244, 67, 54, 0.08), transparent);
  transform: skewX(-25deg);
  pointer-events: none;
  z-index: 1;
}

.selected-file:hover::after {
  left: 150%;
  transition: left 0.6s ease-in-out;
}

/* Icon click shake animation */
@keyframes iconClickShake {
  0% { transform: translateY(-2px) rotate(0deg); }
  25% { transform: translateY(-2px) translateX(-2px) rotate(-4deg); }
  50% { transform: translateY(-2px) translateX(2px) rotate(4deg); }
  75% { transform: translateY(-2px) translateX(-1px) rotate(-2deg); }
  100% { transform: translateY(-2px) rotate(0deg); }
}

.upload-box:active .upload-icon,
.bidder-list-empty-upload-icon-wrapper:active .upload-icon,
.bidder-list-upload-btn:active {
  animation: iconClickShake 120ms ease-in-out 1;
}
