@import url("https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Space+Grotesk:wght@500;600;700&display=swap");

/* ══════════════════════════════════════════════════════
   COSMIC DESIGN — TenderTable
   A light-space aesthetic with deep voids, nebula haze,
   and shimmering star-like elements.
   ══════════════════════════════════════════════════════ */

:root {
  --bg: #050a14;
  --bg-ink: rgba(10, 18, 32, 0.78);
  --panel: rgba(12, 20, 36, 0.72);
  --panel-solid: #0c1424;
  --ink: #e4eeff;
  --ink-soft: #8da4c7;
  --brand: #56c8ff;
  --brand-strong: #2d8cf0;
  --accent: #7effd0;
  --accent-purple: #b07cff;
  --border: rgba(120, 160, 210, 0.22);
  --border-glow: rgba(86, 200, 255, 0.35);
  --ok: #46d58f;
  --warn: #ffb84d;
  --danger: #ff6b84;
  --shadow: 0 32px 80px rgba(2, 6, 14, 0.6);
  --glass: blur(14px) saturate(1.3);
  --radius-sm: 10px;
  --radius-md: 16px;
  --radius-lg: 22px;
  --radius-pill: 999px;
}

/* ── RESET ── */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  min-height: 100dvh;
}

body {
  font-family: "Inter", system-ui, sans-serif;
  color: var(--ink);
  background: var(--bg);
  overflow-x: hidden;
}

body.details-open {
  overflow: hidden;
}

/* ══════════════════════════════════════════════════════
   COSMIC BACKGROUND — stars, nebula & shooting stars
   ══════════════════════════════════════════════════════ */

#stars-canvas {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
}

.page-bg {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  overflow: hidden;
}

/* Static star sprinkles (CSS layer) */
.page-bg::before {
  content: "";
  position: absolute;
  inset: -15%;
  background:
    radial-gradient(1.5px 1.5px at 7% 12%, rgba(255, 255, 255, 0.92), transparent 60%),
    radial-gradient(1px 1px at 14% 38%, rgba(180, 215, 255, 0.8), transparent 54%),
    radial-gradient(2px 2px at 22% 62%, rgba(255, 255, 255, 0.7), transparent 62%),
    radial-gradient(1px 1px at 31% 8%, rgba(196, 228, 255, 0.78), transparent 52%),
    radial-gradient(1.5px 1.5px at 44% 48%, rgba(255, 255, 255, 0.88), transparent 56%),
    radial-gradient(1px 1px at 52% 22%, rgba(190, 224, 255, 0.76), transparent 54%),
    radial-gradient(1.5px 1.5px at 63% 74%, rgba(255, 255, 255, 0.82), transparent 58%),
    radial-gradient(1px 1px at 74% 42%, rgba(176, 208, 255, 0.72), transparent 54%),
    radial-gradient(2px 2px at 81% 16%, rgba(255, 255, 255, 0.9), transparent 60%),
    radial-gradient(1px 1px at 89% 68%, rgba(170, 210, 255, 0.7), transparent 54%),
    radial-gradient(1.5px 1.5px at 96% 34%, rgba(255, 255, 255, 0.84), transparent 58%),
    radial-gradient(1px 1px at 36% 86%, rgba(205, 230, 255, 0.74), transparent 52%),
    radial-gradient(1.5px 1.5px at 58% 92%, rgba(255, 255, 255, 0.8), transparent 56%),
    radial-gradient(1px 1px at 68% 6%, rgba(195, 225, 255, 0.76), transparent 52%),
    radial-gradient(2px 2px at 4% 56%, rgba(255, 255, 255, 0.86), transparent 62%);
  opacity: 0.8;
  animation: starDrift 60s linear infinite;
}

/* Nebula clouds */
.page-bg::after {
  content: "";
  position: absolute;
  inset: -10%;
  background:
    radial-gradient(700px 420px at 18% 28%, rgba(86, 200, 255, 0.14), transparent 72%),
    radial-gradient(650px 380px at 78% 14%, rgba(126, 255, 208, 0.10), transparent 70%),
    radial-gradient(580px 360px at 52% 80%, rgba(176, 124, 255, 0.10), transparent 74%),
    radial-gradient(400px 250px at 92% 66%, rgba(86, 200, 255, 0.06), transparent 68%);
  filter: blur(18px) saturate(1.1);
  opacity: 0.9;
  animation: nebulaFlow 20s ease-in-out infinite alternate;
}

@keyframes starDrift {
  from { transform: translate3d(0, 0, 0) scale(1.06); }
  to   { transform: translate3d(-3%, 2%, 0) scale(1.1); }
}

@keyframes nebulaFlow {
  from { transform: translate3d(0, 0, 0) scale(1); opacity: 0.85; }
  to   { transform: translate3d(1.5%, -1%, 0) scale(1.06); opacity: 1; }
}

/* Shooting star streaks */
.shooting-star {
  position: fixed;
  width: 120px;
  height: 1.5px;
  background: linear-gradient(90deg, rgba(255,255,255,0), rgba(200,230,255,0.9) 30%, rgba(255,255,255,0));
  border-radius: 999px;
  pointer-events: none;
  z-index: 0;
  opacity: 0;
  filter: blur(0.3px);
}

.shooting-star:nth-child(1) {
  top: 12%;
  left: -140px;
  animation: shootStar1 8s 2s ease-in infinite;
}

.shooting-star:nth-child(2) {
  top: 38%;
  left: -140px;
  width: 90px;
  animation: shootStar2 12s 6s ease-in infinite;
}

.shooting-star:nth-child(3) {
  top: 62%;
  left: -140px;
  width: 70px;
  animation: shootStar3 15s 10s ease-in infinite;
}

@keyframes shootStar1 {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-12deg); }
  2%   { opacity: 0.9; }
  10%  { opacity: 0; transform: translate(calc(100vw + 200px), 80px) rotate(-12deg); }
  100% { opacity: 0; transform: translate(calc(100vw + 200px), 80px) rotate(-12deg); }
}

@keyframes shootStar2 {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-8deg); }
  1.5% { opacity: 0.7; }
  8%   { opacity: 0; transform: translate(calc(100vw + 200px), 60px) rotate(-8deg); }
  100% { opacity: 0; transform: translate(calc(100vw + 200px), 60px) rotate(-8deg); }
}

@keyframes shootStar3 {
  0%   { opacity: 0; transform: translate(0, 0) rotate(-15deg); }
  1%   { opacity: 0.6; }
  6%   { opacity: 0; transform: translate(calc(100vw + 200px), 110px) rotate(-15deg); }
  100% { opacity: 0; transform: translate(calc(100vw + 200px), 110px) rotate(-15deg); }
}

/* ══════════════════════════════════════════════════════
   LAYOUT SHELL
   ══════════════════════════════════════════════════════ */

.app-shell {
  position: relative;
  z-index: 1;
  max-width: 1700px;
  margin: 0 auto;
  padding: 22px 26px 32px;
}

/* ══════════════════════════════════════════════════════
   TYPOGRAPHY
   ══════════════════════════════════════════════════════ */

h1, h2, h3, h4, h5 {
  font-family: "Space Grotesk", "Inter", sans-serif;
  letter-spacing: 0.01em;
}

h1 {
  margin: 4px 0 0;
  font-size: clamp(1.8rem, 1.2rem + 1.6vw, 2.6rem);
  line-height: 1.08;
  background: linear-gradient(135deg, #ffffff 0%, #a8d8ff 50%, var(--accent) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: titleShimmer 6s ease-in-out infinite alternate;
}

@keyframes titleShimmer {
  from { filter: brightness(1); }
  50%  { filter: brightness(1.15); }
  to   { filter: brightness(1); }
}

/* ══════════════════════════════════════════════════════
   TOPBAR
   ══════════════════════════════════════════════════════ */

.topbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: center;
  margin-bottom: 20px;
  padding: 16px 20px;
  background: linear-gradient(160deg, rgba(14, 24, 40, 0.8), rgba(8, 16, 28, 0.6));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 8px 32px rgba(2, 6, 14, 0.3);
}

.eyebrow {
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  font-size: 0.7rem;
  font-weight: 600;
  color: var(--brand);
  opacity: 0.8;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* ══════════════════════════════════════════════════════
   STATUS BADGE
   ══════════════════════════════════════════════════════ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid rgba(86, 200, 255, 0.3);
  background: linear-gradient(155deg, rgba(12, 26, 44, 0.85), rgba(10, 18, 34, 0.8));
  border-radius: var(--radius-pill);
  padding: 6px 14px;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--brand);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  animation: badgePulse 3s ease-in-out infinite;
}

@keyframes badgePulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(86, 200, 255, 0); }
  50%      { box-shadow: 0 0 12px 2px rgba(86, 200, 255, 0.15); }
}

/* ══════════════════════════════════════════════════════
   WORKSPACE & BOARD
   ══════════════════════════════════════════════════════ */

.workspace {
  display: block;
}

.board {
  display: grid;
  grid-template-columns: repeat(4, minmax(240px, 1fr));
  gap: 14px;
}

/* ══════════════════════════════════════════════════════
   COLUMNS — Glassmorphism panels
   ══════════════════════════════════════════════════════ */

.column {
  position: relative;
  background: linear-gradient(165deg, rgba(14, 24, 42, 0.82), rgba(8, 16, 30, 0.68));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 16px;
  min-height: 260px;
  backdrop-filter: var(--glass);
  box-shadow:
    inset 0 1px 0 rgba(255, 255, 255, 0.06),
    0 12px 40px rgba(2, 6, 14, 0.25);
  transition: border-color 0.3s ease;
}

.column::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  border: 1px solid rgba(86, 200, 255, 0.08);
  pointer-events: none;
  transition: border-color 0.3s ease;
}

.column:hover::after {
  border-color: rgba(86, 200, 255, 0.18);
}

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

.column h2 {
  margin: 0;
  font-size: 1rem;
  color: #d4e4fa;
}

/* ══════════════════════════════════════════════════════
   COUNT BADGES — Cosmic glow pills
   ══════════════════════════════════════════════════════ */

.count {
  display: inline-flex;
  min-width: 28px;
  justify-content: center;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  font-size: 0.78rem;
  font-weight: 700;
  color: #d8f0ff;
  background: linear-gradient(145deg, rgba(86, 200, 255, 0.28), rgba(126, 255, 208, 0.22));
  border: 1px solid rgba(86, 200, 255, 0.2);
  animation: countGlow 4s ease-in-out infinite alternate;
}

@keyframes countGlow {
  from { box-shadow: 0 0 6px rgba(86, 200, 255, 0.1); }
  to   { box-shadow: 0 0 14px rgba(86, 200, 255, 0.22); }
}

/* ══════════════════════════════════════════════════════
   CARD LIST
   ══════════════════════════════════════════════════════ */

.card-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* ══════════════════════════════════════════════════════
   TENDER CARDS — Aurora glow + sweep effect
   ══════════════════════════════════════════════════════ */

.tender-card {
  position: relative;
  overflow: hidden;
  border: 1px solid rgba(120, 160, 210, 0.26);
  background: linear-gradient(160deg, rgba(14, 26, 44, 0.88), rgba(10, 20, 36, 0.8));
  color: var(--ink);
  border-radius: var(--radius-md);
  padding: 14px;
  cursor: pointer;
  text-align: left;
  backdrop-filter: blur(8px);
  transition: transform 0.22s ease, box-shadow 0.22s ease, border-color 0.22s ease;
  animation: cardEnter 420ms cubic-bezier(0.22, 0.88, 0.25, 1) both;
  animation-delay: var(--card-delay, 0ms);
}

/* Inner cosmic gradient overlay */
.tender-card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(
    125deg,
    rgba(86, 200, 255, 0.04) 0%,
    rgba(126, 255, 208, 0.03) 45%,
    rgba(176, 124, 255, 0.04) 100%
  );
  border-radius: inherit;
  pointer-events: none;
}

/* Aurora light sweep on hover */
.tender-card::after {
  content: "";
  position: absolute;
  inset: -50% -100%;
  background: linear-gradient(
    130deg,
    transparent 30%,
    rgba(174, 232, 255, 0.18) 48%,
    rgba(126, 255, 208, 0.1) 52%,
    transparent 70%
  );
  transform: rotate(12deg) translateX(-30%);
  transition: transform 0.45s cubic-bezier(0.25, 0.46, 0.45, 0.94);
  pointer-events: none;
}

.tender-card:hover {
  transform: translateY(-3px);
  border-color: rgba(86, 200, 255, 0.55);
  box-shadow:
    0 14px 36px rgba(2, 8, 18, 0.4),
    0 0 0 1px rgba(86, 200, 255, 0.1),
    0 0 24px rgba(86, 200, 255, 0.08);
}

.tender-card:hover::after {
  transform: rotate(12deg) translateX(16%);
}

.tender-card.active {
  border-color: rgba(126, 255, 208, 0.65);
  box-shadow:
    0 0 0 2px rgba(126, 255, 208, 0.16),
    0 16px 36px rgba(2, 8, 18, 0.35),
    0 0 20px rgba(126, 255, 208, 0.06);
}

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

.tender-card-header {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.tender-title {
  font-size: 0.95rem;
  font-weight: 600;
  line-height: 1.2;
  color: #f4f8ff;
}

.tender-updated {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.tender-meta,
.tender-progress {
  margin: 8px 0 0;
  font-size: 0.82rem;
  color: var(--ink-soft);
}

/* ══════════════════════════════════════════════════════
   DETAILS PANEL (Inside dialog)
   ══════════════════════════════════════════════════════ */

.details {
  margin: 0;
  width: 100%;
  min-height: 0;
  max-height: calc(92vh - 68px);
  overflow: auto;
  border: none;
  border-radius: 0;
  box-shadow: none;
  padding: 20px;
  background: transparent;
}

.details > * {
  min-width: 0;
}

.details-empty,
.details-state {
  min-height: 54vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: var(--ink-soft);
  gap: 10px;
}

.details-spinner {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 3px solid rgba(86, 200, 255, 0.2);
  border-top-color: var(--brand);
  box-shadow: 0 0 16px rgba(86, 200, 255, 0.15);
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  from { transform: rotate(0deg); }
  to   { transform: rotate(360deg); }
}

/* ══════════════════════════════════════════════════════
   DETAILS DIALOG — Cosmic modal
   ══════════════════════════════════════════════════════ */

.details-dialog {
  border: none;
  padding: 0;
  margin: auto;
  width: min(1700px, 96vw);
  max-height: 92vh;
  background: transparent;
  overflow: visible;
}

.details-dialog::backdrop {
  background: linear-gradient(145deg, rgba(2, 5, 12, 0.72), rgba(4, 8, 18, 0.82));
  backdrop-filter: blur(12px);
  animation: fadeBackdrop 200ms ease-out;
}

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

.details-dialog-shell {
  border: 1px solid rgba(112, 158, 218, 0.32);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background:
    linear-gradient(168deg, rgba(10, 18, 32, 0.97), rgba(6, 12, 24, 0.95)),
    radial-gradient(800px 300px at 20% 0%, rgba(86, 200, 255, 0.12), transparent 60%);
  box-shadow:
    0 48px 100px rgba(2, 6, 14, 0.65),
    inset 0 1px 0 rgba(255, 255, 255, 0.08),
    0 0 60px rgba(86, 200, 255, 0.04);
  animation: detailPop 250ms cubic-bezier(0.22, 0.82, 0.25, 1);
}

@keyframes detailPop {
  from {
    opacity: 0;
    transform: translateY(16px) scale(0.98);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.details-dialog-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-bottom: 1px solid rgba(100, 150, 210, 0.24);
  background:
    linear-gradient(180deg, rgba(18, 32, 52, 0.92), rgba(12, 22, 38, 0.88)),
    radial-gradient(700px 140px at 8% -20%, rgba(86, 200, 255, 0.14), transparent 65%);
}

.details-dialog-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border-radius: var(--radius-pill);
  padding: 7px 14px;
  font-size: 0.76rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--brand);
  border: 1px solid rgba(86, 200, 255, 0.28);
  background: linear-gradient(135deg, rgba(16, 30, 50, 0.92), rgba(10, 22, 38, 0.88));
}

.details-close-btn {
  border-radius: var(--radius-pill);
  padding-inline: 16px;
}

/* ══════════════════════════════════════════════════════
   PANEL TITLE ROW
   ══════════════════════════════════════════════════════ */

.panel-title-row {
  display: flex;
  justify-content: space-between;
  gap: 10px;
  align-items: center;
}

.panel-title-row h3 {
  margin: 0;
  font-size: 1.3rem;
  color: #f2f8ff;
}

.stage-tag {
  border-radius: var(--radius-pill);
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid rgba(86, 200, 255, 0.3);
  color: var(--brand);
  background: rgba(86, 200, 255, 0.08);
}

/* ══════════════════════════════════════════════════════
   BUTTONS — Cosmic glass
   ══════════════════════════════════════════════════════ */

.btn {
  border: 1px solid rgba(120, 160, 210, 0.36);
  background: linear-gradient(160deg, rgba(16, 30, 48, 0.9), rgba(10, 22, 38, 0.84));
  color: #deeaff;
  border-radius: var(--radius-sm);
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  font-weight: 500;
  font-size: 0.88rem;
  backdrop-filter: blur(4px);
  transition:
    transform 0.18s ease,
    border-color 0.18s ease,
    box-shadow 0.18s ease,
    background 0.18s ease;
}

.btn:hover {
  border-color: rgba(140, 195, 255, 0.65);
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(2, 6, 14, 0.3);
}

.btn-primary {
  border: none;
  background: linear-gradient(140deg, var(--brand), var(--brand-strong));
  color: #f6fbff;
  font-weight: 600;
  box-shadow: 0 8px 24px rgba(86, 200, 255, 0.25);
  position: relative;
  overflow: hidden;
}

.btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(120deg, transparent 30%, rgba(255, 255, 255, 0.12) 50%, transparent 70%);
  transform: translateX(-100%);
  transition: transform 0.5s ease;
}

.btn-primary:hover {
  background: linear-gradient(140deg, #68d4ff, #3a9cf5);
  box-shadow: 0 12px 30px rgba(86, 200, 255, 0.35);
}

.btn-primary:hover::after {
  transform: translateX(100%);
}

.btn-danger {
  background: linear-gradient(150deg, rgba(255, 84, 117, 0.18), rgba(120, 30, 55, 0.24));
  border-color: rgba(255, 107, 132, 0.42);
  color: #ffd0da;
}

.btn-danger:hover {
  border-color: rgba(255, 130, 160, 0.7);
}

/* ══════════════════════════════════════════════════════
   FORM ELEMENTS
   ══════════════════════════════════════════════════════ */

.hint {
  color: var(--ink-soft);
  font-size: 0.85rem;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
}

label,
.field-label {
  font-weight: 600;
  font-size: 0.87rem;
  color: #c4d6f0;
}

input,
textarea,
select {
  width: 100%;
  font: inherit;
  font-size: 0.92rem;
  color: var(--ink);
  border: 1px solid rgba(110, 155, 205, 0.35);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  background: rgba(8, 16, 30, 0.8);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

input::placeholder,
textarea::placeholder {
  color: #6e8aab;
}

input:focus,
textarea:focus,
select:focus {
  outline: none;
  border-color: rgba(86, 200, 255, 0.75);
  box-shadow:
    0 0 0 3px rgba(86, 200, 255, 0.14),
    0 0 16px rgba(86, 200, 255, 0.08);
}

textarea {
  resize: vertical;
}

/* ══════════════════════════════════════════════════════
   PICKER — Search panels
   ══════════════════════════════════════════════════════ */

.picker-results {
  margin-top: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: rgba(10, 20, 36, 0.8);
  backdrop-filter: blur(8px);
  max-height: 220px;
  overflow: auto;
  padding: 6px;
}

.picker-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid transparent;
  border-radius: 10px;
  padding: 8px;
  margin-bottom: 6px;
  background: rgba(12, 22, 38, 0.7);
  transition: border-color 0.15s ease, background 0.15s ease;
}

.picker-row:last-child {
  margin-bottom: 0;
}

.picker-row:hover {
  border-color: rgba(86, 200, 255, 0.28);
  background: rgba(16, 28, 46, 0.8);
}

.picker-row.active {
  border-color: rgba(126, 255, 208, 0.45);
  background: rgba(126, 255, 208, 0.06);
}

.picker-title {
  font-size: 0.86rem;
  line-height: 1.2;
  color: #dce8f8;
}

.picker-subtitle {
  color: var(--ink-soft);
  font-size: 0.78rem;
}

.picker-empty {
  color: var(--ink-soft);
  font-size: 0.83rem;
  padding: 8px;
}

.picker-selected {
  margin-top: 8px;
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

/* ══════════════════════════════════════════════════════
   CHIPS
   ══════════════════════════════════════════════════════ */

.chip {
  border-radius: var(--radius-pill);
  background: linear-gradient(135deg, rgba(86, 200, 255, 0.15), rgba(126, 255, 208, 0.12));
  border: 1px solid rgba(86, 200, 255, 0.3);
  color: #c8e8ff;
  padding: 5px 12px;
  font-size: 0.8rem;
  font-weight: 500;
}

.chip button {
  margin-left: 8px;
  border: none;
  background: transparent;
  color: inherit;
  cursor: pointer;
  padding: 0;
  font-size: 0.9rem;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.chip button:hover {
  opacity: 1;
}

/* ══════════════════════════════════════════════════════
   LAYOUTS — Split & Response
   ══════════════════════════════════════════════════════ */

.split {
  display: grid;
  grid-template-columns: minmax(300px, 0.95fr) minmax(0, 1.2fr);
  gap: 14px;
  align-items: start;
}

.response-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(380px, 1fr);
  gap: 14px;
  align-items: start;
}

.response-layout > section,
.response-layout > aside {
  min-width: 0;
}

/* ══════════════════════════════════════════════════════
   MAIL LIST & VIEWER
   ══════════════════════════════════════════════════════ */

.mail-list {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 10px;
  background: rgba(10, 20, 36, 0.7);
  backdrop-filter: blur(6px);
  max-height: 430px;
  overflow: auto;
}

.mail-entry {
  border: 1px solid rgba(100, 145, 195, 0.26);
  border-radius: 10px;
  padding: 10px;
  background: rgba(10, 20, 36, 0.85);
  margin-bottom: 8px;
  transition: transform 0.16s ease, border-color 0.16s ease, box-shadow 0.16s ease;
}

.mail-entry:hover {
  transform: translateY(-1px);
  border-color: rgba(86, 200, 255, 0.42);
  box-shadow: 0 8px 20px rgba(2, 8, 16, 0.3);
}

.mail-entry.active {
  border-color: rgba(126, 255, 208, 0.6);
  box-shadow: 0 0 0 2px rgba(126, 255, 208, 0.14);
}

.mail-entry p {
  margin: 4px 0;
  font-size: 0.84rem;
  color: #c8daf0;
}

.mail-entry-meta {
  font-size: 0.76rem;
  color: var(--ink-soft);
}

.mail-entry-actions {
  margin-top: 8px;
  display: flex;
  justify-content: flex-end;
}

.mail-entry .indicator {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
  margin-right: 6px;
}

.indicator.pending {
  background: #5a7088;
  box-shadow: 0 0 6px rgba(90, 112, 136, 0.4);
}

.indicator.answered {
  background: var(--ok);
  box-shadow: 0 0 8px rgba(70, 213, 143, 0.3);
}

.indicator.declined {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(255, 107, 132, 0.3);
}

/* Mail viewer panel */
.mail-viewer-panel {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: linear-gradient(180deg, rgba(12, 22, 38, 0.86), rgba(8, 16, 30, 0.82));
  backdrop-filter: blur(8px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
  max-height: calc(100vh - 180px);
  overflow: auto;
  position: sticky;
  top: 14px;
}

.mail-viewer-card {
  padding: 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.mail-viewer-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.mail-viewer-header h4 {
  margin: 0;
  color: #f0f6ff;
}

.mail-viewer-supplier p {
  margin: 2px 0;
  font-size: 0.84rem;
  color: #bdd0e8;
}

.mail-viewer-empty {
  padding: 18px;
  color: var(--ink-soft);
}

.status-pill {
  display: inline-flex;
  border-radius: var(--radius-pill);
  padding: 4px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border: 1px solid var(--border);
  color: var(--ink-soft);
  background: rgba(12, 22, 38, 0.8);
}

.status-pill.ok {
  color: var(--accent);
  border-color: rgba(126, 255, 208, 0.4);
  background: rgba(126, 255, 208, 0.08);
}

/* ══════════════════════════════════════════════════════
   MAIL TEXT, ATTACHMENTS, HISTORY
   ══════════════════════════════════════════════════════ */

.mail-text-block,
.mail-attachments-block,
.mail-attachment-preview,
.mail-message-history {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: rgba(10, 20, 36, 0.75);
  padding: 12px;
}

.mail-text-block h5,
.mail-attachments-block h5,
.mail-message-history h5 {
  margin: 0 0 8px;
  font-size: 0.88rem;
  color: #d4e4fa;
}

.message-history-item {
  border: 1px solid rgba(100, 145, 195, 0.22);
  border-radius: 8px;
  padding: 8px;
  background: rgba(8, 16, 28, 0.8);
  margin-bottom: 8px;
}

.message-history-item:last-child {
  margin-bottom: 0;
}

.message-history-item p {
  margin: 2px 0;
  font-size: 0.8rem;
  line-height: 1.35;
  color: #c0d6f0;
}

.mail-text-content {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Inter", sans-serif;
  font-size: 0.82rem;
  color: #c8dff8;
  line-height: 1.38;
  background: rgba(6, 14, 26, 0.85);
  border: 1px solid rgba(100, 146, 200, 0.24);
  border-radius: 8px;
  padding: 10px;
}

.mail-text-content.mail-text-focus {
  box-shadow: 0 0 0 2px rgba(255, 184, 77, 0.3);
  transition: box-shadow 0.15s ease;
}

/* Attachments */
.mail-attachments-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mail-attachments-head small {
  color: var(--ink-soft);
}

.attachment-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-item {
  border: 1px solid rgba(100, 148, 200, 0.26);
  border-radius: 10px;
  padding: 10px;
  background: rgba(8, 18, 32, 0.8);
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: center;
  transition: border-color 0.15s ease;
}

.attachment-item:hover {
  border-color: rgba(86, 200, 255, 0.35);
}

.attachment-item-meta {
  min-width: 0;
}

.attachment-item-meta strong {
  display: block;
  font-size: 0.82rem;
  line-height: 1.2;
  word-break: break-all;
  color: #d4e4fa;
}

.attachment-item-meta small {
  color: var(--ink-soft);
  font-size: 0.74rem;
}

.attachment-origin {
  margin-top: 4px;
  font-size: 0.72rem;
  color: #7a98b8;
  line-height: 1.2;
}

.attachment-item-actions {
  display: flex;
  gap: 6px;
}

.attachment-preview-empty,
.attachment-preview-error {
  color: var(--ink-soft);
  font-size: 0.83rem;
  padding: 10px;
  background: rgba(8, 16, 28, 0.6);
  border: 1px dashed rgba(100, 150, 200, 0.3);
  border-radius: 8px;
}

.attachment-preview-error {
  color: #ffb0c0;
  border-color: rgba(255, 107, 132, 0.35);
  background: rgba(100, 20, 40, 0.2);
}

.attachment-preview-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.attachment-preview-title {
  font-size: 0.85rem;
  font-weight: 700;
  line-height: 1.2;
  word-break: break-all;
  color: #e0ecff;
}

.sheet-name {
  color: var(--ink-soft);
  font-weight: 500;
  margin-left: 4px;
}

.attachment-preview-text {
  margin: 0;
  max-height: 260px;
  overflow: auto;
  white-space: pre-wrap;
  font-family: "Inter", sans-serif;
  font-size: 0.8rem;
  line-height: 1.34;
  color: #c0d6f0;
  background: rgba(6, 14, 26, 0.82);
  border: 1px solid rgba(96, 138, 192, 0.24);
  border-radius: 8px;
  padding: 10px;
}

.attachment-preview-table-wrap {
  max-height: 320px;
  overflow: auto;
  border: 1px solid rgba(96, 140, 195, 0.26);
  border-radius: 8px;
}

.attachment-preview-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.78rem;
}

.attachment-preview-table th,
.attachment-preview-table td {
  border: 1px solid rgba(96, 140, 195, 0.22);
  padding: 6px;
  text-align: left;
  vertical-align: top;
  color: #c8daf0;
}

.attachment-preview-table th {
  position: sticky;
  top: 0;
  background: rgba(20, 36, 56, 0.95);
  color: #d8eaff;
  z-index: 1;
  backdrop-filter: blur(3px);
}

.attachment-preview-embed {
  width: 100%;
  min-height: 360px;
  border: 1px solid rgba(100, 145, 200, 0.26);
  border-radius: 8px;
  background: rgba(8, 16, 30, 0.5);
}

/* ══════════════════════════════════════════════════════
   REVIEW MAIL LIST
   ══════════════════════════════════════════════════════ */

.review-mail-list {
  margin-bottom: 12px;
}

/* ══════════════════════════════════════════════════════
   TABLES — Supplier & Price Matrix
   ══════════════════════════════════════════════════════ */

.supplier-table,
.matrix-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
}

[id$="-matrix"] {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  overflow: auto;
  background: rgba(10, 20, 36, 0.7);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05);
}

.matrix-table {
  min-width: 760px;
}

.supplier-table th,
.supplier-table td,
.matrix-table th,
.matrix-table td {
  border: 1px solid rgba(100, 145, 195, 0.24);
  padding: 7px;
  vertical-align: top;
  color: #d0e2f8;
}

.supplier-table th,
.matrix-table th {
  background: rgba(22, 38, 60, 0.95);
  color: #d8eaff;
  font-weight: 600;
  backdrop-filter: blur(2px);
}

/* Matrix cell highlights */
.matrix-cell-min {
  background: rgba(70, 213, 143, 0.18);
}

.matrix-cell-confidence-high {
  background: rgba(70, 213, 143, 0.14);
}

.matrix-cell-confidence-medium {
  background: rgba(255, 184, 77, 0.16);
  cursor: pointer;
}

.matrix-cell-declined {
  background: rgba(255, 107, 132, 0.14);
}

/* Auto hint warning */
.auto-hint-warning {
  margin: 8px 0 10px;
  padding: 12px 14px;
  border: 1px solid rgba(255, 184, 77, 0.45);
  background: rgba(80, 56, 10, 0.3);
  color: #ffdca4;
  border-radius: var(--radius-sm);
  font-size: 0.84rem;
  line-height: 1.4;
  box-shadow: 0 6px 18px rgba(50, 34, 4, 0.2);
}

/* Cell hint badges */
.cell-hint-badge {
  margin-top: 4px;
  display: inline-flex;
  border-radius: var(--radius-pill);
  padding: 2px 8px;
  font-size: 0.7rem;
  font-weight: 600;
  line-height: 1;
  border: 1px solid transparent;
}

.cell-hint-badge.high {
  color: #9ff0be;
  border-color: rgba(126, 215, 160, 0.4);
  background: rgba(20, 80, 45, 0.5);
}

.cell-hint-badge.medium {
  color: #ffe39f;
  border-color: rgba(248, 184, 75, 0.42);
  background: rgba(90, 62, 12, 0.45);
}

.cell-hint-badge.declined {
  color: #ffb8c5;
  border-color: rgba(240, 120, 150, 0.4);
  background: rgba(100, 24, 44, 0.4);
}

.totals-row {
  font-weight: 700;
  background: rgba(18, 32, 52, 0.9);
}

/* ══════════════════════════════════════════════════════
   DIALOGS
   ══════════════════════════════════════════════════════ */

dialog {
  border: none;
  border-radius: var(--radius-lg);
  padding: 0;
  width: min(700px, calc(100vw - 32px));
}

dialog::backdrop {
  background: rgba(2, 6, 14, 0.6);
  backdrop-filter: blur(8px);
}

dialog#create-dialog {
  width: min(760px, calc(100vw - 32px));
  background: linear-gradient(165deg, rgba(12, 22, 40, 0.96), rgba(8, 16, 30, 0.94));
  border: 1px solid rgba(110, 155, 210, 0.32);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(2, 6, 14, 0.5);
}

dialog#create-dialog::backdrop {
  background: rgba(2, 6, 14, 0.7);
  backdrop-filter: blur(10px);
}

dialog#review-submit-dialog {
  width: min(760px, calc(100vw - 32px));
  background: linear-gradient(165deg, rgba(12, 22, 40, 0.96), rgba(8, 16, 30, 0.94));
  border: 1px solid rgba(110, 155, 210, 0.32);
  border-radius: var(--radius-lg);
  box-shadow: 0 28px 70px rgba(2, 6, 14, 0.5);
}

dialog#review-submit-dialog::backdrop {
  background: rgba(2, 6, 14, 0.7);
  backdrop-filter: blur(10px);
}

.dialog-form {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  color: #d8eafe;
}

.dialog-form h3 {
  color: #f0f6ff;
}

.dialog-toggle {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border: 1px solid rgba(110, 155, 210, 0.28);
  border-radius: var(--radius-sm);
  background: rgba(10, 20, 34, 0.72);
  padding: 10px 12px;
}

.dialog-toggle input {
  width: auto;
  margin-top: 2px;
}

#review-employees-block[hidden] {
  display: none;
}

menu {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin: 6px 0 0;
  padding: 0;
}

/* ══════════════════════════════════════════════════════
   REPORT LINKS
   ══════════════════════════════════════════════════════ */

.report-links a {
  display: inline-block;
  margin-right: 10px;
  margin-bottom: 6px;
  color: var(--brand);
  transition: color 0.15s;
}

.report-links a:hover {
  color: #80dbff;
}

/* ══════════════════════════════════════════════════════
   SLIDE-IN ANIMATION
   ══════════════════════════════════════════════════════ */

.slide-in {
  animation: slideIn 0.28s ease-out;
}

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

/* ══════════════════════════════════════════════════════
   SCROLLBAR — Cosmic thin scrollbar
   ══════════════════════════════════════════════════════ */

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

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

::-webkit-scrollbar-thumb {
  background: rgba(86, 200, 255, 0.2);
  border-radius: 999px;
}

::-webkit-scrollbar-thumb:hover {
  background: rgba(86, 200, 255, 0.35);
}

/* ══════════════════════════════════════════════════════
   RESPONSIVE
   ══════════════════════════════════════════════════════ */

@media (max-width: 1500px) {
  .board {
    grid-template-columns: repeat(3, minmax(230px, 1fr));
  }
}

@media (max-width: 1240px) {
  .response-layout {
    grid-template-columns: 1fr;
  }

  .mail-viewer-panel {
    position: static;
    max-height: none;
  }

  .details-dialog {
    width: min(96vw, 1500px);
  }

  .details {
    max-height: calc(92vh - 66px);
    padding: 16px;
  }
}

@media (max-width: 900px) {
  .board {
    grid-template-columns: repeat(2, minmax(240px, 1fr));
  }

  .split {
    grid-template-columns: 1fr;
  }

  .app-shell {
    padding: 12px;
  }

  .attachment-item {
    flex-direction: column;
    align-items: stretch;
  }

  .attachment-item-actions {
    justify-content: flex-start;
  }

  .attachment-preview-embed {
    min-height: 280px;
  }

  .details-dialog {
    width: 98vw;
    max-height: 95vh;
  }

  .details {
    max-height: calc(95vh - 66px);
  }

  .details-dialog-top {
    padding: 10px 12px;
  }

  .details-dialog-badge {
    font-size: 0.7rem;
    padding: 6px 10px;
  }
}

@media (max-width: 760px) {
  .board {
    grid-template-columns: 1fr;
  }

  .details {
    min-height: 56vh;
    padding: 14px;
  }

  .matrix-table {
    min-width: 640px;
  }
}

/* ══════════════════════════════════════════════════════
   ACCESSIBILITY — Reduced motion
   ══════════════════════════════════════════════════════ */

@media (prefers-reduced-motion: reduce) {
  .page-bg::before,
  .page-bg::after,
  .tender-card,
  .tender-card::after,
  .btn-primary::after,
  .shooting-star {
    animation: none !important;
    transition: none !important;
  }

  h1 {
    animation: none;
  }
}
