:root {
  --primary: #36809f;
  --primary-dark: #2a6580;
  --primary-light: #4a9fc4;
  --secondary: #263238;
  --secondary-light: #37474f;
  --accent: #ffc107;
  --bg-dark: #1a1a1a;
  --bg-card: #2d2d2d;
  --bg-input: #3d3d3d;
  --text-primary: #ffffff;
  --text-secondary: #b0b0b0;
  --text-muted: #757575;
  --border: #404040;
  --success: #4caf50;
  --danger: #f44336;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
}

/* Light Theme */
[data-theme='light'] {
  --bg-dark: #f5f7fa;
  --bg-card: #ffffff;
  --bg-input: #f0f2f5;
  --text-primary: #1a1a1a;
  --text-secondary: #4a4a4a;
  --text-muted: #6b7280;
  --border: #e0e0e0;
  --shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: 'Montserrat', sans-serif;
  background: var(--bg-dark);
  min-height: 100vh;
  color: var(--text-primary);
}

/* ===== LOGIN PAGE ===== */
.login-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  background:
    linear-gradient(135deg, rgba(54, 128, 159, 0.1) 0%, transparent 50%),
    linear-gradient(225deg, rgba(54, 128, 159, 0.05) 0%, transparent 50%),
    var(--bg-dark);
  position: relative;
  overflow: hidden;
}

.login-container::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 35px,
    rgba(255, 255, 255, 0.01) 35px,
    rgba(255, 255, 255, 0.01) 70px
  );
  animation: slide 20s linear infinite;
}

[data-theme='light'] .login-container::before {
  background: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 35px,
    rgba(0, 0, 0, 0.01) 35px,
    rgba(0, 0, 0, 0.01) 70px
  );
}

@keyframes slide {
  0% {
    transform: translateX(0) translateY(0);
  }
  100% {
    transform: translateX(70px) translateY(70px);
  }
}

.login-logo {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 60px;
  z-index: 1;
}

.login-logo-icon {
  width: 64px;
  height: 64px;
}

.login-title {
  font-size: 2rem;
  font-weight: 700;
  color: var(--text-primary);
  letter-spacing: -0.5px;
}

.login-subtitle {
  font-size: 0.9rem;
  color: var(--text-muted);
  margin-top: 4px;
}

.login-form {
  width: 100%;
  max-width: 420px;
  z-index: 1;
}

.login-card {
  background: var(--bg-card);
  border-radius: 20px;
  padding: 40px;
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.login-card-title {
  font-size: 1.25rem;
  font-weight: 600;
  margin-bottom: 24px;
  text-align: center;
  color: var(--text-secondary);
}

.login-input-wrapper {
  position: relative;
  margin-bottom: 16px;
}

.login-input-icon {
  position: absolute;
  left: 20px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
}

.login-input {
  width: 100%;
  padding: 18px 20px 18px 52px;
  font-size: 1rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s;
}

.login-input::placeholder {
  color: var(--text-muted);
}

.login-input:focus {
  border-color: var(--primary);
  background: rgba(54, 128, 159, 0.05);
}

.login-btn {
  width: 100%;
  padding: 18px;
  font-size: 1rem;
  font-family: inherit;
  font-weight: 600;
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  border: none;
  border-radius: 12px;
  color: white;
  cursor: pointer;
  transition: all 0.3s;
  text-transform: uppercase;
  letter-spacing: 1px;
  margin-top: 8px;
}

.login-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(54, 128, 159, 0.4);
}

.login-btn:active {
  transform: translateY(0);
}

.login-error {
  color: var(--danger);
  text-align: center;
  margin-top: 16px;
  min-height: 20px;
  font-size: 0.9rem;
}

.login-footer {
  margin-top: 32px;
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
}

/* ===== DASHBOARD ===== */
.dashboard {
  min-height: 100vh;
  background: var(--bg-dark);
}

.dashboard-header {
  background: var(--bg-card);
  border-bottom: 1px solid var(--border);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}

.dashboard-logo {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dashboard-logo-icon {
  width: 40px;
  height: 40px;
}

.dashboard-logo-text {
  font-size: 1.1rem;
  font-weight: 600;
}

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

.btn-logout {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 12px;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.3s;
}

.btn-logout:hover {
  background: var(--danger);
  border-color: var(--danger);
  color: white;
}

.btn-logout svg {
  flex-shrink: 0;
}

.dashboard-content {
  max-width: 1600px;
  margin: 0 auto;
  padding: 32px;
}

/* Filters Section */
.filters {
  background: var(--bg-card);
  border-radius: 20px;
  margin-bottom: 32px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
}

.filters-header {
  padding: 20px 32px;
  margin: 8px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  cursor: pointer;
  transition: background 0.2s;
  user-select: none;
}

.filters-header:hover {
  background: rgba(54, 128, 159, 0.08);
}

.filters-title {
  font-size: 1.1rem;
  font-weight: 600;
  margin: 0;
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text-primary);
}

.filters-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 16px;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text-secondary);
  font-size: 0.85rem;
  font-weight: 500;
  transition: all 0.2s;
}

.filters-toggle svg {
  transition: transform 0.3s;
}

.filters.collapsed .filters-toggle svg {
  transform: rotate(180deg);
}

.filters-toggle:hover {
  background: var(--primary);
  border-color: var(--primary);
  color: white;
}

.filters-body {
  padding: 0 32px 32px;
  display: grid;
  grid-template-rows: 1fr;
  transition:
    grid-template-rows 0.3s ease,
    padding 0.3s ease;
}

.filters-body > .filters-grid {
  min-height: 0;
  overflow: visible;
}

.filters.collapsed .filters-body {
  grid-template-rows: 0fr;
  padding-top: 0;
  padding-bottom: 0;
}

.filters.collapsed .filters-body > .filters-grid {
  overflow: hidden;
  visibility: hidden;
}

.filters-title-icon {
  width: 32px;
  height: 32px;
  background: rgba(54, 128, 159, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
}

.filters-grid {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 16px;
}

.filter-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.filter-label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  cursor: pointer;
  transition: color 0.2s;
}

.filter-label:hover {
  color: var(--text-secondary);
}

.filter-input {
  padding: 14px 18px;
  font-size: 0.95rem;
  font-family: inherit;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  outline: none;
  transition: all 0.3s;
  min-height: 52px;
}

.filter-input::placeholder {
  color: var(--text-muted);
}

.filter-input:hover {
  border-color: var(--text-muted);
}

.filter-input:focus {
  border-color: var(--primary);
}

/* Select styling */
select.filter-input {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23757575' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 18px center;
  padding-right: 48px;
  cursor: pointer;
}

select.filter-input:hover {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%23b0b0b0' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

select.filter-input:focus {
  background-image: url("data:image/svg+xml,%3Csvg width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2336809f' stroke-width='2' xmlns='http://www.w3.org/2000/svg'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
}

.filter-input option {
  background: var(--bg-card);
  color: var(--text-primary);
  padding: 12px;
}

/* Date input calendar icon */
input[type='date'].filter-input::-webkit-calendar-picker-indicator {
  filter: invert(0.7);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.2s;
}

input[type='date'].filter-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

[data-theme='light']
  input[type='date'].filter-input::-webkit-calendar-picker-indicator {
  filter: none;
  opacity: 0.6;
}

[data-theme='light']
  input[type='date'].filter-input::-webkit-calendar-picker-indicator:hover {
  opacity: 1;
}

/* Date Range */
.date-range {
  display: flex;
  align-items: center;
  gap: 8px;
}

.date-range .filter-input {
  flex: 1;
  min-width: 0;
}

.date-range-separator {
  color: var(--text-muted);
  font-size: 1rem;
  flex-shrink: 0;
}

/* Multiselect */
.multiselect {
  position: relative;
}

.multiselect-trigger {
  padding: 14px 18px;
  font-size: 0.95rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.3s;
  min-height: 52px;
}

.multiselect-trigger:hover {
  border-color: var(--text-muted);
}

.multiselect.open .multiselect-trigger {
  border-color: var(--primary);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.multiselect-trigger svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.3s;
}

.multiselect.open .multiselect-trigger svg {
  transform: rotate(180deg);
}

.multiselect-placeholder {
  color: var(--text-muted);
}

.multiselect-selected {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.multiselect-tag {
  background: var(--primary);
  color: white;
  padding: 4px 10px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 500;
}

.multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.multiselect.open .multiselect-dropdown {
  display: block;
}

.multiselect-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.2s;
}

.multiselect-option:hover {
  background: rgba(54, 128, 159, 0.1);
}

.multiselect-option input[type='checkbox'] {
  width: 18px;
  height: 18px;
  accent-color: var(--primary);
  cursor: pointer;
}

.multiselect-option span {
  flex: 1;
  color: var(--text-primary);
}

/* Custom Dropdown (single select) */
.dropdown {
  position: relative;
}

.dropdown-trigger {
  padding: 14px 18px;
  font-size: 0.95rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text-primary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  transition: all 0.3s;
  min-height: 52px;
}

.dropdown-trigger:hover {
  border-color: var(--text-muted);
}

.dropdown.open .dropdown-trigger {
  border-color: var(--primary);
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  border-bottom-color: transparent;
}

.dropdown-trigger svg {
  flex-shrink: 0;
  color: var(--text-muted);
  transition: transform 0.3s;
}

.dropdown.open .dropdown-trigger svg {
  transform: rotate(180deg);
}

.dropdown-value {
  flex: 1;
}

.dropdown-value.placeholder {
  color: var(--text-muted);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: var(--bg-card);
  border: 1px solid var(--primary);
  border-top: none;
  border-bottom-left-radius: 10px;
  border-bottom-right-radius: 10px;
  max-height: 250px;
  overflow-y: auto;
  z-index: 50;
  display: none;
}

.dropdown.open .dropdown-menu {
  display: block;
}

.dropdown-option {
  padding: 12px 18px;
  cursor: pointer;
  transition: background 0.2s;
  color: var(--text-primary);
}

.dropdown-option:hover {
  background: rgba(54, 128, 159, 0.1);
}

.dropdown-option.selected {
  background: rgba(54, 128, 159, 0.15);
  color: var(--primary);
  font-weight: 500;
}

.filter-actions {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 8px;
}

.btn {
  padding: 14px 32px;
  font-size: 0.95rem;
  font-family: inherit;
  font-weight: 600;
  border: none;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.3s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: linear-gradient(
    135deg,
    var(--primary) 0%,
    var(--primary-dark) 100%
  );
  color: white;
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(54, 128, 159, 0.4);
}

.btn-secondary {
  background: var(--bg-input);
  color: var(--text-secondary);
  border: 1px solid var(--border);
}

.btn-secondary:hover {
  border-color: var(--text-muted);
}

/* Tenders Section */
.tenders {
  background: var(--bg-card);
  border-radius: 20px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.tenders-header {
  padding: 24px 32px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.tenders-title {
  font-size: 1.1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 10px;
}

.tenders-title-icon {
  width: 32px;
  height: 32px;
  background: rgba(76, 175, 80, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--success);
}

.tenders-count {
  background: var(--bg-input);
  padding: 6px 14px;
  border-radius: 20px;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

.tenders-table {
  width: 100%;
  border-collapse: collapse;
}

.tenders-table th {
  padding: 16px 20px;
  text-align: left;
  font-weight: 500;
  color: var(--text-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border);
}

[data-theme='light'] .tenders-table th {
  background: rgba(0, 0, 0, 0.03);
}

.tenders-table td {
  padding: 20px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.tenders-table tbody tr {
  transition: all 0.2s;
}

.tenders-table tbody tr:hover {
  background: rgba(54, 128, 159, 0.05);
}

.tenders-table tbody tr:last-child td {
  border-bottom: none;
}

.td-title {
  max-width: 350px;
  min-width: 200px;
}

.td-customer {
  max-width: 250px;
  min-width: 150px;
}

.td-statuses {
  max-width: 250px;
}

.td-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 500;
  white-space: normal;
  word-wrap: break-word;
  overflow-wrap: break-word;
  max-width: 100%;
  margin-bottom: 4px;
  line-height: 1.3;
}

/* Fallback для неизвестных статусов */
.td-status--default {
  background: rgba(158, 158, 158, 0.15);
  color: #b0b0b0;
}

[data-theme='light'] .td-status--default {
  color: #616161;
}

/* Приём заявок / Подача предложений - оранжевый (активный приём) */
.td-status--submission {
  background: rgba(255, 152, 0, 0.15);
  color: #ffb74d;
}

[data-theme='light'] .td-status--submission {
  color: #e65100;
}

/* Работа комиссии - фиолетовый (рассмотрение) */
.td-status--commission {
  background: rgba(156, 39, 176, 0.15);
  color: #ba68c8;
}

[data-theme='light'] .td-status--commission {
  color: #7b1fa2;
}

/* Выбор победителя / поставщика - зелёный (положительный процесс) */
.td-status--winner {
  background: rgba(76, 175, 80, 0.15);
  color: #81c784;
}

[data-theme='light'] .td-status--winner {
  color: #2e7d32;
}

/* Подписание договора - синий */
.td-status--signing {
  background: rgba(33, 150, 243, 0.15);
  color: #64b5f6;
}

[data-theme='light'] .td-status--signing {
  color: #1565c0;
}

/* Закрыт / Завершено - серый (нейтральное завершение) */
.td-status--closed {
  background: rgba(158, 158, 158, 0.15);
  color: #9e9e9e;
}

[data-theme='light'] .td-status--closed {
  color: #616161;
}

/* Завершена без выбора поставщика - тёмно-серый */
.td-status--completed-no-winner {
  background: rgba(117, 117, 117, 0.15);
  color: #8d8d8d;
}

[data-theme='light'] .td-status--completed-no-winner {
  color: #424242;
}

/* Отменён - красный */
.td-status--cancelled {
  background: rgba(244, 67, 54, 0.15);
  color: #ef5350;
}

[data-theme='light'] .td-status--cancelled {
  color: #c62828;
}

.tenders-table-wrapper {
  overflow-x: auto;
}

.td-number {
  white-space: nowrap;
}

.td-number-text {
  font-family: monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.td-source {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 2px 6px;
  border-radius: 4px;
  background: rgba(54, 128, 159, 0.15);
  color: var(--primary);
}

.td-source--icetrade {
  background: rgba(0, 150, 136, 0.15);
  color: #26a69a;
}

[data-theme='light'] .td-source--icetrade {
  color: #00897b;
}

.td-title-text {
  font-weight: 600;
  color: var(--text-primary);
  line-height: 1.4;
  margin-bottom: 4px;
}

.td-industry {
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg-input);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  margin-top: 4px;
}

.td-customer-name {
  font-weight: 500;
  color: var(--text-primary);
}

.td-trade-type {
  font-size: 0.85rem;
  color: var(--text-secondary);
  max-width: 150px;
}

.td-region {
  font-size: 0.85rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

.td-currency {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-left: 4px;
}

.td-no-price {
  color: var(--text-muted);
}

.td-date {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.td-price {
  font-weight: 600;
  color: var(--accent);
}

.tenders-table .td-actions {
  text-align: right;
}

.tenders-table .td-actions .btn-icon {
  margin-top: 8px;
}

.tenders-table .td-actions .btn-icon:first-child {
  margin-top: 0;
}

/* Pagination */
.pagination {
  padding: 20px 32px;
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

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

.pagination-controls {
  display: flex;
  align-items: center;
  gap: 8px;
}

.pagination-btn {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.2s;
}

.pagination-btn:hover:not(.disabled) {
  background: var(--primary);
  color: white;
}

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

.pagination-pages {
  display: flex;
  align-items: center;
  gap: 4px;
}

.pagination-page {
  min-width: 36px;
  height: 36px;
  padding: 0 12px;
  border-radius: 8px;
  background: var(--bg-input);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all 0.2s;
}

.pagination-page:hover:not(.current) {
  background: rgba(54, 128, 159, 0.15);
  color: var(--primary);
}

.pagination-page.current {
  background: var(--primary);
  color: white;
}

.pagination-ellipsis {
  padding: 0 8px;
  color: var(--text-muted);
}

@media (max-width: 600px) {
  .pagination {
    flex-direction: column;
    gap: 16px;
  }

  .pagination-info {
    order: 2;
  }
}

.btn-icon {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-input);
  color: var(--text-secondary);
  text-decoration: none;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.btn-delete {
  color: var(--danger);
}

.btn-delete:hover {
  background: rgba(244, 67, 54, 0.15);
}

.btn-viewed {
  color: var(--text-muted);
}

.btn-viewed:hover {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
}

.btn-viewed.active {
  background: rgba(76, 175, 80, 0.15);
  color: var(--success);
}

.btn-open:hover {
  background: rgba(54, 128, 159, 0.15);
  color: var(--primary);
}

/* Viewed row */
.tenders-table tbody tr.row-viewed {
  opacity: 0.2;
}

.tenders-table tbody tr.row-viewed:hover {
  opacity: 0.5;
}

.btn-view:hover {
  background: rgba(54, 128, 159, 0.15);
  color: var(--primary);
}

.no-data {
  text-align: center;
  color: var(--text-muted);
  padding: 60px 20px !important;
  font-size: 1rem;
}

.no-data-icon {
  font-size: 3rem;
  margin-bottom: 16px;
  opacity: 0.5;
}

/* Theme Toggle */
.theme-toggle {
  width: 44px;
  height: 44px;
  border: none;
  border-radius: 12px;
  background: var(--bg-input);
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s;
  border: 1px solid var(--border);
}

.theme-toggle:hover {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
  transform: scale(1.05);
}

.theme-toggle svg {
  width: 20px;
  height: 20px;
  transition: transform 0.3s;
}

.theme-toggle:hover svg {
  transform: rotate(15deg);
}

.theme-toggle .icon-sun,
.theme-toggle .icon-moon {
  display: none;
}

.theme-toggle .icon-moon {
  display: block;
}

[data-theme='light'] .theme-toggle .icon-moon {
  display: none;
}

[data-theme='light'] .theme-toggle .icon-sun {
  display: block;
}

/* Login theme toggle position */
.login-theme-toggle {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10;
}

/* Responsive */
@media (max-width: 768px) {
  .login-title {
    font-size: 1.5rem;
  }

  .login-card {
    padding: 28px;
  }

  .dashboard-header {
    padding: 12px 16px;
  }

  .dashboard-content {
    padding: 16px;
  }

  .filters,
  .tenders {
    border-radius: 16px;
  }

  .filters-header {
    padding: 16px 20px;
    margin: 6px;
  }

  .filters-body {
    padding: 0 20px 20px;
  }

  .filters-toggle-text {
    display: none;
  }

  .filter-row {
    grid-template-columns: 1fr;
  }

  .tenders-table {
    font-size: 0.85rem;
  }

  .tenders-table th,
  .tenders-table td {
    padding: 12px;
  }

  .td-title,
  .td-customer {
    max-width: 150px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }
}

/* Modal */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 1000;
  align-items: center;
  justify-content: center;
}

.modal.open {
  display: flex;
}

.modal-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: relative;
  background: var(--bg-card);
  border-radius: 16px;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
  max-width: 800px;
  width: 90%;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.modal-title {
  font-size: 1.2rem;
  font-weight: 600;
}

.modal-close {
  width: 40px;
  height: 40px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.modal-close:hover {
  background: var(--bg-input);
  color: var(--text-primary);
}

.modal-body {
  padding: 24px;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 16px 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: flex-end;
  gap: 12px;
}

.modal-footer a {
  text-decoration: none;
}

/* Tender Card */
.tender-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
}

.tender-card-status {
  display: inline-block;
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.85rem;
  font-weight: 500;
}

.tender-card-status.status-active {
  background: rgba(76, 175, 80, 0.15);
  color: #81c784;
}

.tender-card-status.status-pending {
  background: rgba(255, 193, 7, 0.15);
  color: #ffd54f;
}

.tender-card-status.status-closed {
  background: rgba(158, 158, 158, 0.15);
  color: #9e9e9e;
}

.tender-card-status.status-cancelled {
  background: rgba(244, 67, 54, 0.15);
  color: #ef5350;
}

[data-theme='light'] .tender-card-status.status-active {
  color: #2e7d32;
}

[data-theme='light'] .tender-card-status.status-pending {
  color: #f57c00;
}

[data-theme='light'] .tender-card-status.status-cancelled {
  color: #c62828;
}

.tender-card-number {
  font-family: monospace;
  font-size: 0.9rem;
  color: var(--text-muted);
  background: var(--bg-input);
  padding: 6px 12px;
  border-radius: 6px;
}

.tender-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1.5;
  margin-bottom: 8px;
  color: var(--text-primary);
}

.tender-card-industry {
  font-size: 0.85rem;
  color: var(--primary);
  margin-bottom: 24px;
}

.tender-card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 20px;
}

.tender-card-section {
  background: var(--bg-input);
  padding: 16px;
  border-radius: 12px;
}

.tender-card-section-full {
  grid-column: 1 / -1;
  margin-top: 8px;
}

.tender-card-section-full + .tender-card-section-full {
  margin-top: 16px;
}

.tender-card-section-title {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 12px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.tender-card-section-title svg {
  opacity: 0.7;
}

.tender-card-value {
  font-weight: 500;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.tender-card-subvalue {
  font-size: 0.85rem;
  color: var(--text-secondary);
  margin-bottom: 2px;
}

.tender-card-label {
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-right: 8px;
}

.tender-card-date {
  font-weight: 500;
  color: var(--text-primary);
}

.tender-card-dates > div {
  margin-bottom: 8px;
}

.tender-card-dates > div:last-child {
  margin-bottom: 0;
}

.tender-card-price {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--accent);
}

.tender-card-text {
  font-size: 0.9rem;
  line-height: 1.6;
  color: var(--text-secondary);
  white-space: pre-wrap;
}

.tender-card-lots {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tender-card-lot {
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}

.tender-card-lot-number {
  font-weight: 600;
  color: var(--primary);
  font-size: 0.85rem;
  min-width: 60px;
}

.tender-card-lot-subject {
  flex: 1;
  font-size: 0.9rem;
  color: var(--text-primary);
}

.tender-card-lot-status {
  font-size: 0.8rem;
  color: var(--text-muted);
  white-space: nowrap;
}

/* Documents */
.tender-card-documents {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.tender-card-document {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--bg-card);
  padding: 12px 16px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-primary);
  transition: all 0.2s;
}

.tender-card-document:hover {
  background: rgba(54, 128, 159, 0.1);
  color: var(--primary);
}

.tender-card-document-icon {
  width: 36px;
  height: 36px;
  background: rgba(54, 128, 159, 0.15);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  flex-shrink: 0;
}

.tender-card-document-name {
  flex: 1;
  font-size: 0.9rem;
  word-break: break-word;
}

.tender-card-document-download {
  color: var(--text-muted);
  flex-shrink: 0;
}

/* Clickable row */
.tenders-table tbody tr {
  cursor: pointer;
}

.tenders-table tbody tr:hover {
  background: rgba(54, 128, 159, 0.08);
}

/* Hide sections when empty */
.tender-card-section:empty,
.tender-card-section.hidden {
  display: none;
}

@media (max-width: 600px) {
  .tender-card-grid {
    grid-template-columns: 1fr;
  }

  .modal-content {
    width: 95%;
    max-height: 95vh;
  }
}
