
:root {
  /*
    Light colour palette for a refined glass‑style UI.  The dashboard
    previously used a dark background with bright pastel panels which
    caused contrast and overlay issues.  The new palette uses a light
    neutral background and semi‑transparent panels to evoke a frosted
    glass effect.  Accent colours remain purple to retain brand
    identity.
  */
  /* Page background colour (main canvas).  A very light grey creates
     gentle contrast with pure white panels without being stark. */
  --bg-main: #f3f4f6;
  /* Panel background colour used on cards, nav bars and tables.  The
     alpha channel (0.75) allows the underlying gradient to show
     through, creating a glassy effect when combined with backdrop
     blur. */
  --bg-panel: rgba(255, 255, 255, 0.75);
  /* Soft border colour for panels.  A subtle dark border gives definition
     without drawing attention. */
  --border-soft: rgba(0, 0, 0, 0.05);
  /* Primary text colour for high contrast on light backgrounds. */
  --text-main: #1a1a1a;
  /* Muted text colour for secondary information. */
  --text-muted: #6b7280;
  /* Accent colour for interactive elements and highlights. */
  --accent: #4E1FAC;
  /* Lighter version of the accent colour for hover and focus states. */
  --accent-light: rgba(78, 31, 172, 0.15);
  /* Table head background colour; a faint tint to distinguish header rows. */
  --table-head-bg: rgba(236, 236, 247, 0.9);
  /* Zebra striping for table rows.  Subtle differences in opacity give
     depth without overpowering the content. */
  --table-row-even: rgba(236, 236, 247, 0.6);
  --table-row-odd: rgba(236, 236, 247, 0.4);
  /* Horizontal padding for page layout.  Nav and content use this for
     alignment. */
  --shell-side-pad: 1.5rem;
}

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

body {
  margin: 0;
  padding: 0;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, 'SF Pro Text', sans-serif;
  /* Use a soft radial gradient on a light base to add subtle depth to
     the background.  The gradient centres near the top to draw the eye
     upward without becoming distracting. */
  background: radial-gradient(circle at 50% -10%, #ffffff 0%, #f3f4f6 100%);
  color: var(--text-main);
}

/*
 * The app shell contains the main page content. Use a shared horizontal
 * padding so the navigation bar and table align. The padding-left and
 * padding-right are based on the --shell-side-pad variable defined above.
 */
.app-shell {
  min-height: 100vh;
  width: 100%;
  margin: 0 auto;
  padding: 1.5rem var(--shell-side-pad) 2rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.app-shell.wide .main-content,
.app-shell.wide .app-header {
  max-width: 100%;
}

.glassy {
  /*
    Panels and nav bars appear as frosted glass.  The semi‑transparent
    background defined in --bg-panel combined with backdrop‑filter
    produces a blurred, luminous effect reminiscent of macOS and iOS
    interfaces.  A soft box shadow lifts the panel slightly off the
    page.  Rounded corners mirror the modern aesthetic of the
    landing page.
  */
  background: var(--bg-panel);
  border-radius: 1.5rem;
  border: 1px solid var(--border-soft);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(10px);
}

.app-header {
  padding: 1.1rem 1.4rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
}

.header-main {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1.5rem;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-header h1 {
  font-size: 1.4rem;
  margin: 0 0 0.25rem 0;
}

.subtitle {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.85rem;
}

.header-stats {
  margin-top: 0.75rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.stat-card {
  padding: 0.7rem 1rem;
  border-radius: 1rem;
  border: 0.3px solid #FFFFFF;
  background: var(--bg-panel);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  position: relative;
}

/* Subtle animated glow on statistic cards */
.stat-card::after {
  /* Hide the animated glow on statistic cards for the new design */
  display: none;
}

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

.stat-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.stat-value {
  margin-top: 0.15rem;
  font-size: 1rem;
  font-weight: 600;
}

.lang-switch {
  display: flex;
  gap: 0.3rem;
}

.lang-btn {
  border: 1px solid var(--border-soft);
  background: rgba(15, 23, 42, 0.8);
  border-radius: 999px;
  padding: 0.25rem 0.6rem;
  cursor: pointer;
  font-size: 0.9rem;
}

.lang-btn.active {
  background: var(--accent);
  /* Off‑white text colour for language buttons */
  color: #e5e9f7;
}

.main-content {
  /* Stretch the main content horizontally to use the entire screen width.  Use
     the same horizontal padding as the nav bar so both align. */
  padding: 0.9rem var(--shell-side-pad) 1.1rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.main-content.wide {
  /* Remove side margin for full-width layout */
  margin: 0;
}

/* Ensure the navigation bar and main content align and fill the viewport width.
   The nav bar uses the same width as the main content and does not restrict its
   children. */
/*
 * Navigation bar: align horizontally with the main content. The
 * left/right margins mirror the shell's side padding, ensuring that
 * the nav and table share the same starting and ending positions.
 */
.nav-bar.glassy {
  /* Stretch the nav bar across the entire available width.  Align with the
     main content by using the same side padding variables.  Removing
     left/right margins ensures the nav and table share the same width. */
  width: 100%;
  max-width: none;
  margin-left: 0;
  margin-right: 0;
  margin-bottom: 0.8rem;
  padding: 0.85rem var(--shell-side-pad);
  border-radius: 1.5rem;
  display: block;
}

.nav-container {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

/* Top section: home button and title */
.nav-top {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.nav-home {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  border-radius: 14px;
  border: none;
  /* Use a softer purple gradient for the home button.  The previous
     gradient (#845ec2 → #d65db1) was quite vibrant and clashed with
     the new light theme.  These pastel tones harmonise with the
     accent colour defined in :root. */
  background: linear-gradient(135deg, #9873e6, #c9a5f3);
  box-shadow: 0 4px 8px rgba(0,0,0,0.35);
  /* Darker icon colour for better contrast on pastel background */
  color: #2e1065;
  text-decoration: none;
  font-size: 1.2rem;
}
.nav-title {
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  line-height: 1.2;
  /* Dark text for the dashboard title to improve contrast on the new
     light theme.  Previously the title used an off‑white colour,
     which reduced legibility when the background became lighter. */
  color: var(--text-main);
}

/* Mid section: search and info */
.nav-mid {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}
.nav-search {
  position: relative;
  display: flex;
  align-items: center;
}
.nav-search input {
  width: 100%;
  padding: 0.68rem 2.7rem 0.68rem 0.9rem;
  border-radius: 25px;
  border: 0.3px solid var(--border-soft);
  background: var(--bg-panel);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  color: var(--text-main);
  font-size: 0.95rem;
}
.nav-search input::placeholder {
  color: var(--text-muted);
}
.nav-search input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), 0 12px 24px rgba(0,0,0,0.35);
}
.nav-search .search-icon {
  position: absolute;
  right: 0.9rem;
  opacity: 0.8;
  pointer-events: none;
}

/* Info row: stats and language buttons */
.nav-info-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.6rem;
}
.nav-stats {
  display: flex;
  gap: 0.55rem;
  flex-wrap: wrap;
}
.nav-stat {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.52rem 0.75rem;
  border-radius: 14px;
  border: 0.3px solid var(--border-soft);
  background: var(--bg-panel);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  text-decoration: none;
  color: var(--text-main);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.nav-stat:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.3);
}
.nav-stat .stat-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.nav-stat .stat-value {
  font-size: 1rem;
  font-weight: 800;
}

.nav-lang-switch {
  display: flex;
  gap: 0.35rem;
}
.lang-btn {
  border: 0.3px solid #FFFFFF;
  background: var(--bg-panel);
  color: var(--text-main);
  border-radius: 999px;
  padding: 0.35rem 0.55rem;
  font-size: 0.8rem;
  cursor: pointer;
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.lang-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 10px rgba(0,0,0,0.3);
}
.lang-btn.active {
  background: var(--accent);
  color: #F8FAFC;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light), 0 6px 12px rgba(0,0,0,0.3);
}

/* Main content uses full width and no min-width restriction */
.main-content.glassy.wide {
  /* Allow the main content to fill the width of the page.  Use the same
     horizontal padding as the nav so that tables align perfectly. */
  width: 100%;
  max-width: none;
  margin: 0;
  padding: 0.9rem var(--shell-side-pad) 1.2rem;
}

/* Remove the outer table wrapper margin and border, but keep the element for JS queries. */
.table-wrapper {
  display: contents;
  margin: 0;
  border: 0;
  border-radius: 0;
  overflow: visible;
}

/* Additional style for closeness percentage in flags */
.flag-percent {
  margin-left: 0.2rem;
  font-size: 0.65rem;
  color: var(--text-muted);
}

/* Show year beneath the day inside the date badge */
/* Year inside the date badge: use muted colour but slightly brighter for visibility */
.date-year {
  font-size: 0.55rem;
  font-weight: 500;
  color: rgba(148,163,184,0.85);
  line-height: 1;
}

/* Mobile card layout: compact tender cards with emphasis on title. */
@media (max-width: 768px) {
  .tender-table thead {
    display: none;
  }
  .tender-table,
  .tender-table tbody,
  .tender-table tr,
  .tender-table td {
    display: block;
    width: 100%;
  }
  .tender-table tbody tr {
    background: radial-gradient(circle at top, rgba(15,23,42,0.90), rgba(15,23,42,0.65));
    border: 1px solid rgba(148,163,184,0.22);
    border-radius: 0.9rem;
    box-shadow: 0 12px 24px rgba(0,0,0,0.45);
    padding: 0.7rem 0.8rem;
    margin-bottom: 0.65rem;
  }
  .tender-table td {
    padding: 0.35rem 0 !important;
    border: none !important;
  }
  /* Order the cells for compact reading: title first with emphasis */
  .tender-table td:nth-child(2) {
    order: 1;
  }
  .tender-table td:nth-child(2) .title-main {
    font-size: 1rem;
    font-weight: 800;
    line-height: 1.25;
  }
  /* Amounts row next */
  .tender-table td:nth-child(6) {
    order: 2;
  }
  /* Institution row */
  .tender-table td:nth-child(3) {
    order: 3;
  }
  /* Winner and bidders combined but separate rows; reduce font size */
  .tender-table td:nth-child(4),
  .tender-table td:nth-child(5) {
    order: 4;
    font-size: 0.72rem;
  }
  /* Flags */
  .tender-table td:nth-child(8) {
    order: 5;
  }
  /* REF row last and compact */
  .tender-table td:nth-child(1) {
    order: 6;
    font-size: 0.6rem;
    color: var(--text-muted);
  }
  /* Date at bottom */
  .tender-table td:nth-child(7) {
    order: 7;
  }
}

.controls-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: flex-end;
}

.search-box {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 220px;
}

.search-box input {
  padding: 0.55rem 0.85rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  /* Use pastel background for search inputs */
  background: var(--bg-panel);
  color: var(--text-main);
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-box input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 150px;
}

.filter-group.small {
  min-width: 120px;
}

.filter-group label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}

.filter-group select {
  padding: 0.4rem 0.7rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  /* Pastel background for filter selects */
  background: var(--bg-panel);
  color: var(--text-main);
  font-size: 0.8rem;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.filter-group select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* Remove default styling for table wrapper. It acts as a passthrough container */
.table-wrapper {
}

.tender-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.82rem;
}

/* On wider screens, widen the amounts column to improve readability */
@media (min-width: 900px) {
  .tender-table th:nth-child(6),
  .tender-table td:nth-child(6) {
    min-width: 320px;
  }
}

.tender-table thead {
  background: var(--table-head-bg);
}

.tender-table th,
.tender-table td {
  padding: 0.5rem 0.6rem;
  /* Use a soft pastel border between rows */
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
}

.tender-table th {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-main);
  text-align: left;
}

/* Use light pastel backgrounds for table rows instead of dark bands. */
.tender-table tbody tr:nth-child(even) {
  background: var(--table-row-even);
}
.tender-table tbody tr:nth-child(odd) {
  background: var(--table-row-odd);
}
/* Highlight a row on hover with a gentle accent tint instead of a dark blue. */
.tender-table tbody tr:hover {
  background: var(--accent-light);
}

.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-top: 0.15rem;
}

/* Base chip: light pastel background with dark text. Chips can be tinted
   using additional classes like .chip-success, .chip-warning, etc. */
.chip {
  display: inline-flex;
  align-items: center;
  padding: 0.14rem 0.55rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  background: var(--table-row-even);
  font-size: 0.7rem;
  color: var(--text-main);
}

.chip-small {
  font-size: 0.68rem;
  padding-inline: 0.5rem;
}

/* Accent chip: tinted pastel with accent border and contrasting text */
.chip-accent {
  border-color: var(--accent);
  background: rgba(78, 31, 172, 0.1);
  color: var(--accent);
}

/* Success/warning/danger chips: tinted backgrounds derived from their
   respective colours with dark text for readability. */
.chip-success {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.chip-warning {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.15);
  color: #7c2d12;
}

.chip-danger {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: #7f1d1d;
}

.amount-stack {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.amount-row {
  display: flex;
  justify-content: space-between;
  gap: 0.25rem;
}

.amount-label {
  font-size: 0.7rem;
  color: var(--text-muted);
}

.amount-value {
  font-size: 0.75rem;
  font-weight: 500;
}

.amount-bar {
  margin-top: 0.15rem;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  /* Use pastel colour for bar backgrounds to enhance readability */
  background: var(--table-row-even);
  overflow: hidden;
}

.amount-bar-fill {
  height: 100%;
  border-radius: inherit;
  /* Smooth animation for dynamic width changes */
  transition: width 0.8s ease-in-out;
  background: linear-gradient(to right, #22d3ee, #0ea5e9);
}

.amount-bar-fill.chip-success {
  background: #22c55e;
}

.amount-bar-fill.chip-warning {
  background: #f97316;
}

.amount-bar-fill.chip-danger {
  background: #ef4444;
}

/* Calendar-style date icon */
.date-badge {
  /* Modern calendar badge with soft gradient and accent border */
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 0.35rem 0.55rem;
  border-radius: 0.7rem;
  border: 1px solid rgba(59, 130, 246, 0.5);
  background: linear-gradient(to bottom right,
    rgba(59, 130, 246, 0.2), /* accent tint */
    rgba(30, 41, 59, 0.85));
  box-shadow: 0 3px 8px rgba(0, 0, 0, 0.5);
}

/* Label shown below each date badge */
.date-label {
  margin-top: 0.15rem;
  font-size: 0.6rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  text-align: center;
}

/* Month abbreviation within date badge */
.date-month {
  font-size: 0.6rem;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--accent);
  line-height: 1;
}

/* Day number within date badge */
.date-day {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1;
}

.date-top {
  background: #ef4444;
  color: #f9fafb;
  text-align: center;
  font-size: 0.55rem;
  font-weight: 600;
  padding: 2px 0;
}

.date-bottom {
  background: #f9fafb;
  color: #0f172a;
  text-align: center;
  padding: 3px 0 4px;
}

.date-main {
  font-size: 0.95rem;
  font-weight: 700;
  line-height: 1;
}

.date-sub {
  font-size: 0.55rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 2px;
}

.flag-row {
  display: flex;
  gap: 0.25rem;
}

.flag-chip {
  display: inline-flex;
  align-items: center;
  padding: 0.08rem 0.5rem;
  border-radius: 999px;
  font-size: 0.65rem;
  border: 1px solid rgba(148, 163, 184, 0.7);
  background: var(--table-row-even);
  color: var(--text-main);
}

.flag-chip.chip-success {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.flag-chip.chip-warning {
  border-color: #f97316;
  background: rgba(249, 115, 22, 0.15);
  color: #7c2d12;
}

.flag-chip.chip-danger {
  border-color: #ef4444;
  background: rgba(239, 68, 68, 0.15);
  color: #7f1d1d;
}

/* Improve visibility and hierarchy of REF column */
.ref-main {
  font-size: 0.7rem;
  font-weight: 400;
  color: var(--text-muted);
}

/* Emphasised links for institutions and companies */
.inst-link,
.company-link,
.winner-link {
  color: var(--accent);
  font-weight: 500;
  text-decoration: none;
}
.inst-link:hover,
.company-link:hover,
.winner-link:hover {
  text-decoration: underline;
}

.pagination-row {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.75rem;
}

.page-info {
  font-size: 0.75rem;
  color: var(--text-muted);
}

.btn {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  border: 1px solid var(--border-soft);
  /* Light pastel buttons with dark text for improved legibility. */
  background: var(--table-row-even);
  color: var(--text-main);
  font-size: 0.8rem;
  cursor: pointer;
  text-decoration: none;
  transition: background 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
}

.btn.secondary {
  background: transparent;
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

/* Hover state for enabled buttons */
.btn:not(:disabled):hover {
  background: var(--accent-light);
  border-color: var(--accent);
}

/* Bidders dropdown styles */
.bidders-container {
  display: inline-flex;
  flex-direction: row;
  align-items: center;
  position: relative;
  gap: 0.2rem;
}
.bidders-main {
  font-size: 0.75rem;
  font-weight: 500;
}
.bidders-toggle {
  margin-left: 0.3rem;
  background: transparent;
  border: none;
  color: var(--accent);
  font-size: 0.8rem;
  cursor: pointer;
  padding: 0;
}
.bidders-toggle:focus {
  outline: none;
}
  .bidders-list {
  position: absolute;
  top: calc(100% + 0.2rem);
  left: 0;
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  border-radius: 0.6rem;
  padding: 0.4rem 0.6rem;
  display: none;
  min-width: 160px;
  max-width: 220px;
  white-space: normal;
  z-index: 50;
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.6);
  font-size: 0.6rem;
  line-height: 1.35;
  color: var(--text-main);
}
.bidder-entry {
  margin-bottom: 0.15rem;
}

/* Container for improved bar and percentage */
.amount-bar-container {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.15rem;
}
.amount-bar {
  position: relative;
  flex-grow: 1;
  height: 0.45rem;
  /* Pastel background for the bar used in comparative views */
  background: var(--table-row-even);
  border-radius: 0.3rem;
  overflow: hidden;
}
.amount-bar-fill {
  height: 100%;
  border-radius: inherit;
}
.amount-percent {
  font-size: 0.7rem;
  font-weight: 600;
}

/* Hyperlinks inside chips inherit colouring and remove underline */
a.chip {
  color: inherit;
  text-decoration: none;
}
a.chip:hover {
  text-decoration: underline;
}

/* clickable stat card links */
.stat-link {
  text-decoration: none;
  color: inherit;
  display: inline-block;
}

.stat-link .stat-card {
  cursor: pointer;
}

/* aggregated list table styles */
.list-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1rem;
}
.list-table th,
.list-table td {
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--border-soft);
  vertical-align: top;
  font-size: 0.75rem;
}
.list-table th {
  text-align: left;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  background: var(--table-head-bg);
  color: var(--text-main);
}
.list-count {
  color: var(--text-muted);
  font-size: 0.75rem;
  margin-left: 0.25rem;
}
.list-entry {
  font-size: 0.7rem;
  margin-bottom: 0.15rem;
  line-height: 1.3;
  color: var(--text-main);
}

/* Zebra striping for aggregated tables to match the tender table styling */
.list-table tbody tr:nth-child(even) {
  background: var(--table-row-even);
}
.list-table tbody tr:nth-child(odd) {
  background: var(--table-row-odd);
}
.list-table tbody tr:hover {
  background: var(--accent-light);
}

/* Global links use the primary accent colour for consistency across the site */
.link {
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
}

.link:hover {
  text-decoration: underline;
}

/*
 * Amounts container styles
 * Provides a clear display of the limit value, awarded value
 * and a horizontal bar visualising the closeness between them.  The
 * percentage indicator floats above the bar on the right.
 */
.amounts-container {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-width: 140px;
}

.amount-line {
  display: flex;
  justify-content: space-between;
  font-size: 0.65rem;
}

.amount-label {
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.amount-value {
  font-weight: 600;
}

.amount-bar {
  position: relative;
  height: 0.4rem;
  background: var(--table-row-even);
  border-radius: 0.3rem;
  overflow: hidden;
}

.amount-bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: inherit;
}

.amount-percent {
  position: absolute;
  right: 0;
  top: -0.95rem;
  font-size: 0.55rem;
  color: var(--text-muted);
}

.tooltip {
  position: fixed;
  z-index: 9999;
  max-width: 260px;
  padding: 0.4rem 0.6rem;
  border-radius: 0.6rem;
  font-size: 0.7rem;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  pointer-events: none;
}

/* Insights & heatmap styles – compact */
.insights-shell {
  margin-top: 0.3rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  width: 100%;
}

.insights-shell.compact {
  margin-top: 0.1rem;
}

.insights-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: flex-end;
}

.filter-group.tiny {
  min-width: 90px;
}

.filter-group.tiny select {
  padding: 0.2rem 0.6rem;
  font-size: 0.75rem;
  background: var(--bg-panel);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
}

.insights-panel {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.insights-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.5rem;
}

.insight-card {
  padding: 0.45rem 0.6rem;
  border-radius: 0.9rem;
  border: 1px solid var(--border-soft);
  background: var(--bg-panel);
  box-shadow: 0 4px 8px rgba(0,0,0,0.25);
  color: var(--text-main);
}

.insight-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 1px;
}

.insight-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.insights-subtitle {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}

.ranking-list {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.ranking-row {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.ranking-main {
  display: flex;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.78rem;
}

.ranking-name {
  font-weight: 500;
  min-width: 0;
}

.ranking-name .link {
  white-space: nowrap;
  text-overflow: ellipsis;
  overflow: hidden;
  display: inline-block;
  max-width: 260px;
}

.ranking-stats {
  font-size: 0.7rem;
  color: var(--text-muted);
  white-space: nowrap;
}

.heat-bar {
  width: 100%;
  height: 5px;
  border-radius: 999px;
  background: var(--table-row-even);
  overflow: hidden;
}

.heat-bar-fill {
  height: 100%;
  border-radius: inherit;
  background: linear-gradient(to right, var(--accent-light), var(--accent));
}

.insights-empty {
  font-size: 0.78rem;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .app-header {
    padding: 1rem;
  }
  .header-main {
    flex-direction: column;
    align-items: flex-start;
  }
  .app-shell {
    padding-inline: 0.75rem;
  }
}


/* --- Custom tweaks: bigger chips + status emphasis --- */
.chip {
  padding: 0.14rem 0.55rem;
  font-size: 0.7rem;
  line-height: 1.1;
}

.chip-small {
  font-size: 0.68rem;
  padding-inline: 0.5rem;
}

/* Funding chip shown under tender title */
.chip-funding {
  border-color: rgba(59, 130, 246, 0.7);
  color: #dbeafe;
}

/* Status chip: always show full text */
.status-chip {
  font-size: 0.72rem;
  padding: 0.16rem 0.6rem;
  color: #e2e8f0;
}

.status-final {
  border-color: rgba(34, 197, 94, 0.8);
  background: rgba(34, 197, 94, 0.15);
  color: #166534;
}

.status-active {
  border-color: rgba(56, 189, 248, 0.8);
  background: rgba(56, 189, 248, 0.15);
  color: #0c4a6e;
}

.status-cancelled {
  border-color: rgba(239, 68, 68, 0.8);
  background: rgba(239, 68, 68, 0.15);
  color: #7f1d1d;
}

.status-disqualified {
  border-color: rgba(251, 191, 36, 0.8);
  background: rgba(251, 191, 36, 0.15);
  color: #78350f;
}

.status-other {
  border-color: rgba(148, 163, 184, 0.8);
  background: rgba(148, 163, 184, 0.15);
  color: #1e293b;
}

/* ========================================================================
 * Additional styling to move the dashboard closer to the mock‑up look.
 * These overrides adjust the navigation bar, statistic cards and table
 * header to use richer gradients and icons. They are placed near the end
 * of the stylesheet to take precedence over earlier rules.
 */

/* Nav bar: allow the dark page background to show through. Remove the
   pastel panel background so the stats cards stand out. */
.nav-bar.glassy {
  background: transparent;
  border: none;
  box-shadow: none;
  padding: 0.5rem var(--shell-side-pad);
}

/* Arrange the stats row horizontally with more space */
.nav-info-row {
  justify-content: flex-start;
  gap: 1rem;
  align-items: flex-start;
}

/* Statistic cards: use vibrant gradient backgrounds and include icons.
   Remove borders to create sleek cards and increase padding for emphasis. */
.nav-stats .nav-stat {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  padding: 0.65rem 1rem;
  border: none;
  border-radius: 0.9rem;
  box-shadow: 0 4px 8px rgba(0,0,0,0.45);
  color: #f8fafc;
  font-weight: 600;
  text-decoration: none;
}

/* Use distinct gradients for each card to differentiate metrics. */
.nav-stats .nav-stat:nth-child(1) {
  background: linear-gradient(135deg, #845ec2, #d65db1);
}
.nav-stats .nav-stat:nth-child(2) {
  background: linear-gradient(135deg, #007c82, #40b3b7);
}
.nav-stats .nav-stat:nth-child(3) {
  background: linear-gradient(135deg, #0064c8, #6aa4e8);
}

/* Add icons to statistic cards using pseudo‑elements. */
.nav-stats .nav-stat::before {
  content: '\1F4C4'; /* page with curl icon representing tenders */
  font-size: 1.2rem;
  line-height: 1;
  margin-right: 0.35rem;
}
.nav-stats .nav-stat:nth-child(2)::before {
  content: '\1F3E2'; /* office building icon for institutions */
}
.nav-stats .nav-stat:nth-child(3)::before {
  content: '\1F3ED'; /* factory icon for companies */
}

/* Adjust stat labels to be lighter and uppercase */
.nav-stat .stat-label {
  /* Use an off‑white tint instead of pure white to reduce brightness */
  color: #dbe4f9;
  font-size: 0.68rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}

/* Statistic values: emphasise numbers with larger size */
.nav-stat .stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  /* Off‑white for better contrast on gradients */
  color: #eff3fe;
  margin-right: 0.2rem;
}

/* Search box: lightly tinted background and subtle border similar to the mock‑up */
.nav-search input {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
  /* Reduce brightness of text inside search input */
  color: #dce3f5;
  font-weight: 500;
}
.nav-search input::placeholder {
  color: rgba(231, 236, 245, 0.65);
}
.nav-search .search-icon {
  color: rgba(229, 233, 247, 0.8);
}

/* Language buttons: unify size and reduce border prominence */
.lang-btn {
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.25);
  color: #f8fafc;
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}
.lang-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}
.lang-btn.active {
  background: #845ec2;
  border-color: #845ec2;
}

/* Table header: deep purple gradient to mirror the mock‑up's header row */
.tender-table thead {
  background: linear-gradient(90deg, #332e77, #523d85);
}
.tender-table th {
  /* Off‑white for header text */
  color: #e5e9f7;
  font-weight: 600;
  font-size: 0.75rem;
}

/* Zebra striping: lighten row backgrounds and adjust hover to use accent tint */
.tender-table tbody tr:nth-child(even) {
  background: rgba(96, 118, 188, 0.15);
}
.tender-table tbody tr:nth-child(odd) {
  background: rgba(96, 118, 188, 0.1);
}
.tender-table tbody tr:hover {
  background: rgba(132, 94, 194, 0.25);
}

/* Buttons: replicate the view‑more style from the mock‑up with a vibrant purple gradient */
.btn {
  background: linear-gradient(90deg, #845ec2, #d65db1);
  border: none;
  /* Use off‑white text on buttons to reduce glare */
  color: #e5e9f7;
  font-weight: 600;
}
.btn:not(:disabled):hover {
  background: linear-gradient(90deg, #6c3bcf, #b94aa0);
}

/* Distinguish clickable navigation cards (links) from non-clickable ones.
   Clickable cards have a larger shadow and pointer cursor, while
   non-clickable spans are slightly dimmed. */
.nav-stats a.nav-stat {
  box-shadow: 0 6px 12px rgba(0, 0, 0, 0.55);
  cursor: pointer;
  transition: transform 0.1s ease, box-shadow 0.1s ease;
}
.nav-stats a.nav-stat:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 16px rgba(0, 0, 0, 0.6);
}
.nav-stats span.nav-stat {
  opacity: 0.9;
  cursor: default;
}

/* Clickable chips: emphasise anchor chips with accent colour and border.  The
   entire chip will redirect the user, matching the behaviour of the text
   inside. */
a.chip {
  border-color: var(--accent);
  color: var(--accent);
  cursor: pointer;
  text-decoration: none;
}
a.chip:hover {
  box-shadow: 0 0 0 2px var(--accent-light);
}

/* General clickable links: underline and accent colour to stand out from
   plain text.  Non-link text remains less prominent. */
.inst-link,
.company-link,
.winner-link,
.link {
  color: var(--accent);
  font-weight: 600;
  text-decoration: underline;
  cursor: pointer;
}
.inst-link:hover,
.company-link:hover,
.winner-link:hover,
.link:hover {
  opacity: 0.85;
}

/* ------------------------------------------------------------------
   Loading overlay styles

   A fullscreen overlay used while fetching large datasets.  The
   overlay centres its contents and uses a semi-transparent background
   to gently obscure the underlying UI.  The `hidden` class hides
   the overlay.  The spinner employs a simple rotation animation.
*/
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.85);
  z-index: 10000;
}
.loading-overlay.hidden {
  display: none;
}
.loading-overlay .spinner {
  border: 6px solid #f3f3f3;
  border-top: 6px solid #3498db;
  border-radius: 50%;
  width: 48px;
  height: 48px;
  animation: spin 1s linear infinite;
  margin-bottom: 1rem;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
.loading-overlay .loading-text {
  font-size: 1rem;
  color: #333;
}




/* ============================================================
   Production-grade dashboard glass overrides
   These rules intentionally come last so they replace older dark/mockup
   experiments without changing the HTML structure or app logic.
   ============================================================ */
body {
  background:
    radial-gradient(circle at 12% 0%, rgba(91,52,214,.08), transparent 22%),
    radial-gradient(circle at 88% 10%, rgba(44,182,125,.08), transparent 20%),
    linear-gradient(180deg, #fbfcff 0%, var(--bg-main) 100%);
  color: var(--text-main);
}
.nav-bar.glassy,
.main-content.glassy.wide,
.glassy {
  background: var(--bg-panel);
  border: 1px solid var(--border-soft);
  box-shadow: 0 18px 40px rgba(15,23,42,.08);
  backdrop-filter: blur(14px);
}
.nav-title,
.app-header h1,
.header-main,
.header-right,
.page-info,
.ref-main,
.title-main,
.inst-link,
.winner-link,
.company-link,
.link,
.amount-value,
.amount-label,
.date-label,
.bidders-main,
.bidder-entry,
.flag-percent {
  color: var(--text-main);
}
.subtitle,
.nav-stat .stat-label,
.amount-label,
.date-label,
.preview-meta,
.page-info,
.bidder-entry,
.flag-percent {
  color: var(--text-muted);
}
.nav-home {
  background: linear-gradient(135deg, #8b78ef, #c6b7fb);
  color: #2e1065;
  box-shadow: 0 8px 18px rgba(91,52,214,.15);
}
.nav-search input,
.lang-btn,
.nav-stat {
  background: rgba(255,255,255,.86);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.nav-search input::placeholder { color: #94a3b8; }
.nav-search .search-icon { color: #94a3b8; }
.lang-btn.active {
  background: var(--accent);
  color: #fff;
  border-color: transparent;
  box-shadow: 0 10px 24px rgba(91,52,214,.24);
}
.nav-stats .nav-stat,
.nav-stat {
  color: var(--text-main);
  border-radius: 16px;
  padding: .65rem .9rem;
}
.nav-stats .nav-stat:nth-child(1),
.nav-stats .nav-stat:nth-child(2),
.nav-stats .nav-stat:nth-child(3),
.nav-stats .nav-stat:nth-child(4) {
  background: rgba(255,255,255,.88);
}
.nav-stats .nav-stat::before {
  color: var(--accent);
  margin-right: .25rem;
}
.nav-stat .stat-value { color: var(--text-main); }
.nav-stat .stat-label { color: var(--text-muted); }
.tender-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0 10px;
}
.tender-table thead {
  background: transparent;
}
.tender-table th {
  background: rgba(236,236,247,.9);
  color: #334155;
  font-weight: 700;
  padding: 14px 12px;
  border-top: 1px solid var(--border-soft);
  border-bottom: 1px solid var(--border-soft);
}
.tender-table th:first-child { border-left: 1px solid var(--border-soft); border-top-left-radius: 16px; border-bottom-left-radius: 16px; }
.tender-table th:last-child { border-right: 1px solid var(--border-soft); border-top-right-radius: 16px; border-bottom-right-radius: 16px; }
.tender-table tbody tr {
  background: rgba(255,255,255,.82);
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
}
.tender-table tbody td {
  padding: 14px 12px;
  border-top: 1px solid rgba(17,24,39,.05);
  border-bottom: 1px solid rgba(17,24,39,.05);
  background: rgba(255,255,255,.84);
  vertical-align: top;
}
.tender-table tbody td:first-child { border-left: 1px solid rgba(17,24,39,.05); border-top-left-radius: 18px; border-bottom-left-radius: 18px; }
.tender-table tbody td:last-child { border-right: 1px solid rgba(17,24,39,.05); border-top-right-radius: 18px; border-bottom-right-radius: 18px; }
.tender-table tbody tr:nth-child(odd) td,
.tender-table tbody tr:nth-child(even) td { background: rgba(255,255,255,.84); }
.tender-table tbody tr:hover td { background: rgba(244,241,255,.96); }
.ref-main { font-weight: 800; }
.title-main { font-weight: 800; line-height: 1.35; }
.chip,
.chip.chip-small,
.chip.chip-small.inst-link,
.chip-status,
.chip-funding {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid rgba(17,24,39,.06);
  background: rgba(255,255,255,.92);
  color: #475569;
  font-size: 12px;
  font-weight: 700;
  text-decoration: none;
}
.chip-row { display:flex; flex-wrap:wrap; gap:6px; margin-top:8px; }
.chip-status.status-open,
.chip-status.status-active { background: rgba(34,197,94,.12); color: #166534; }
.chip-status.status-closed,
.chip-status.status-cancelled { background: rgba(239,68,68,.10); color: #991b1b; }
.chip-status.status-awarded { background: rgba(59,130,246,.10); color: #1d4ed8; }
.inst-link,
.winner-link,
.company-link,
.link {
  color: #1f3a8a;
  text-decoration: none;
  font-weight: 600;
}
.inst-link:hover,
.winner-link:hover,
.company-link:hover,
.link:hover { text-decoration: underline; }
.bidders-container {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  position: relative;
}
.bidders-main {
  min-width: 32px;
  height: 32px;
  display: inline-grid;
  place-items: center;
  border-radius: 999px;
  background: rgba(91,52,214,.10);
  color: var(--accent);
  font-weight: 800;
}
.bidders-toggle {
  border: 1px solid rgba(17,24,39,.08);
  background: rgba(255,255,255,.94);
  border-radius: 999px;
  width: 30px;
  height: 30px;
  cursor: pointer;
}
.bidders-list {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  min-width: 240px;
  max-width: 320px;
  padding: 10px;
  border-radius: 16px;
  border: 1px solid rgba(17,24,39,.08);
  background: rgba(255,255,255,.97);
  box-shadow: 0 16px 36px rgba(15,23,42,.12);
  z-index: 8;
}
.bidder-entry + .bidder-entry { margin-top: 6px; }
.amounts-container { display:grid; gap:8px; min-width: 180px; }
.amount-line { display:flex; justify-content:space-between; gap:10px; }
.amount-bar-container { margin-top: 4px; }
.amount-bar {
  width: 100%;
  height: 8px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(148,163,184,.18);
}
.amount-bar-fill { height:100%; border-radius:999px; transition: width .6s ease; }
.date-badge {
  width: 74px;
  min-height: 82px;
  display: grid;
  justify-items: center;
  align-content: center;
  gap: 2px;
  padding: 10px 8px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255,255,255,.95), rgba(245,247,251,.92));
  border: 1px solid rgba(17,24,39,.06);
  box-shadow: inset 0 1px 0 rgba(255,255,255,.6);
}
.date-month { font-size: 12px; font-weight: 800; color: var(--accent); text-transform: uppercase; }
.date-day { font-size: 24px; font-weight: 800; color: var(--text-main); line-height: 1; }
.date-year { font-size: 11px; color: var(--text-muted); }
.flag-icon { filter: none; }
.btn,
.btn.secondary,
button.btn,
.pagination-row .btn {
  background: linear-gradient(135deg, var(--accent), #7c5cff);
  color: #fff;
  border: none;
  border-radius: 999px;
  box-shadow: 0 10px 24px rgba(91,52,214,.22);
}
.btn.secondary {
  background: rgba(255,255,255,.92);
  color: var(--text-main);
  border: 1px solid var(--border-soft);
  box-shadow: 0 10px 24px rgba(15,23,42,.06);
}
.pagination-row {
  display:flex;
  align-items:center;
  justify-content:center;
  gap:14px;
  padding-top: 12px;
}
.page-info {
  padding: 10px 14px;
  background: rgba(255,255,255,.85);
  border: 1px solid var(--border-soft);
  border-radius: 999px;
  box-shadow: 0 8px 18px rgba(15,23,42,.05);
}
.tooltip {
  background: rgba(15,23,42,.94);
  color: #fff;
  border-radius: 12px;
  padding: 8px 10px;
  box-shadow: 0 16px 34px rgba(15,23,42,.18);
}
@media (max-width: 768px) {
  .nav-title { font-size: .98rem; }
  .nav-info-row { align-items:flex-start; }
  .nav-stats { width:100%; }
  .nav-stat { flex:1 1 calc(50% - 8px); justify-content:flex-start; }
  .tender-table tbody tr {
    background: transparent;
    box-shadow: none;
    margin-bottom: 12px;
  }
  .tender-table tbody tr,
  .tender-table tbody td { background: transparent !important; }
  .tender-table tbody tr {
    border: 1px solid rgba(17,24,39,.06);
    border-radius: 20px;
    background: rgba(255,255,255,.88) !important;
    box-shadow: 0 12px 28px rgba(15,23,42,.08);
    padding: 14px;
  }
  .tender-table td { border: none !important; padding: 8px 0 !important; }
}
