/**
 * Перекрывает жёстко заданные тёмные фоны в инлайн-стилях при светлой теме (data-theme="light").
 */
html[data-theme="light"] body {
  background: var(--page-body-bg) !important;
  color: var(--text-main) !important;
}

html[data-theme="light"] .app-header {
  background: var(--header-bg) !important;
}

html[data-theme="light"] .card,
html[data-theme="light"] .login-card,
html[data-theme="light"] .calendar-wrap {
  background: var(--surface-elevated) !important;
  border: 1px solid var(--surface-elevated-border) !important;
  box-shadow: var(--shadow-card) !important;
  backdrop-filter: none !important;
}

html[data-theme="light"] .calc-modal-backdrop,
html[data-theme="light"] .files-modal-backdrop {
  background: var(--modal-backdrop) !important;
}

html[data-theme="light"] .calc-modal-dialog,
html[data-theme="light"] .files-modal-dialog {
  background: var(--surface-elevated) !important;
  border: 1px solid var(--surface-elevated-border) !important;
  box-shadow: var(--shadow-card) !important;
  backdrop-filter: none !important;
}

html[data-theme="light"] .calc-out-suggest {
  background: var(--surface-elevated) !important;
  border-color: var(--surface-elevated-border) !important;
  box-shadow: var(--shadow-card) !important;
}

html[data-theme="light"] .calc-out-suggest-item:hover,
html[data-theme="light"] .calc-out-suggest-item:focus {
  background: rgba(0, 77, 102, 0.08) !important;
}

html[data-theme="light"] select,
html[data-theme="light"] input[type="text"],
html[data-theme="light"] input[type="number"],
html[data-theme="light"] input[type="date"],
html[data-theme="light"] input[type="email"],
html[data-theme="light"] input[type="password"],
html[data-theme="light"] input[type="search"],
html[data-theme="light"] textarea {
  background: var(--bg-input) !important;
  color: var(--text-main) !important;
}

html[data-theme="light"] table.data-table th,
html[data-theme="light"] table.data-table td {
  border-bottom-color: var(--border-color) !important;
}

html[data-theme="light"] table.data-table tbody tr:hover {
  background: rgba(0, 77, 102, 0.06) !important;
}

html[data-theme="light"] .settings-sidebar a:hover {
  background: rgba(0, 0, 0, 0.04) !important;
}

html[data-theme="light"] .settings-sidebar a.active {
  background: var(--accent-soft) !important;
}

html[data-theme="light"] .perms-table tbody tr:hover {
  background: rgba(0, 77, 102, 0.05) !important;
}

html[data-theme="light"] .app-header-nav a:hover {
  background: rgba(0, 77, 102, 0.07) !important;
}

/* Активный раздел: чуть сильнее контраст (текст темнее + полоска акцента) */
html[data-theme="light"] .app-header-nav a.active {
  color: var(--nav-active-text) !important;
  font-weight: 700 !important;
  background: rgba(240, 128, 90, 0.2) !important;
  border-radius: var(--radius-md);
}

html[data-theme="light"] .app-header .btn-settings {
  background: rgba(0, 77, 102, 0.08);
  color: var(--text-muted);
}

html[data-theme="light"] .app-header .btn-settings:hover {
  background: rgba(0, 77, 102, 0.12);
  color: var(--text-main);
}

html[data-theme="light"] .app-header .header-settings-menu a:hover {
  background: rgba(0, 77, 102, 0.07) !important;
}

html[data-theme="light"] .app-header .header-theme-pill {
  background: rgba(0, 77, 102, 0.06) !important;
}
html[data-theme="light"] .app-header .header-theme-pill-opt.active {
  color: #0f172a !important;
}

/* Календарь */
html[data-theme="light"] .calendar-title {
  background: none !important;
  -webkit-background-clip: border-box !important;
  background-clip: border-box !important;
  color: var(--text-main) !important;
}

html[data-theme="light"] .calendar-weekday {
  background: var(--calendar-weekday-bg) !important;
  color: var(--text-muted) !important;
}

html[data-theme="light"] .calendar-weekday:nth-child(6),
html[data-theme="light"] .calendar-weekday:nth-child(7) {
  background: var(--calendar-weekend-header-bg) !important;
  color: var(--accent) !important;
}

html[data-theme="light"] .layer-btn.production {
  color: #1e3a8a !important;
  background: rgba(37, 99, 235, 0.2) !important;
}
html[data-theme="light"] .layer-btn.production.is-on {
  background: rgba(37, 99, 235, 0.35) !important;
  border-color: #2563eb !important;
}
html[data-theme="light"] .layer-btn.shipment {
  color: #14532d !important;
  background: rgba(22, 163, 74, 0.22) !important;
}
html[data-theme="light"] .layer-btn.shipment.is-on {
  background: rgba(22, 163, 74, 0.38) !important;
  border-color: #16a34a !important;
}
html[data-theme="light"] .layer-btn.order-by {
  color: #92400e !important;
  background: rgba(245, 158, 11, 0.28) !important;
}
html[data-theme="light"] .layer-btn.order-by.is-on {
  background: rgba(245, 158, 11, 0.42) !important;
  border-color: #d97706 !important;
}
html[data-theme="light"] .layer-btn.load {
  color: #5b21b6 !important;
  background: rgba(139, 92, 246, 0.22) !important;
}
html[data-theme="light"] .layer-btn.load.is-on {
  background: rgba(139, 92, 246, 0.38) !important;
  border-color: #7c3aed !important;
}

html[data-theme="light"] .day-event.production {
  background: linear-gradient(
    90deg,
    rgba(37, 99, 235, 0.28) 0%,
    rgba(37, 99, 235, 0.12) 100%
  ) !important;
  color: #1e3a8a !important;
  border-left-color: #2563eb !important;
}
html[data-theme="light"] .day-event.shipment {
  background: linear-gradient(
    90deg,
    rgba(22, 163, 74, 0.3) 0%,
    rgba(22, 163, 74, 0.14) 100%
  ) !important;
  color: #14532d !important;
  border-left-color: #16a34a !important;
}
html[data-theme="light"] .day-event.order-by {
  background: linear-gradient(
    90deg,
    rgba(245, 158, 11, 0.32) 0%,
    rgba(245, 158, 11, 0.16) 100%
  ) !important;
  color: #92400e !important;
  border-left-color: #d97706 !important;
}
html[data-theme="light"] .day-event.load {
  background: rgba(139, 92, 246, 0.2) !important;
  color: #5b21b6 !important;
  border-left: 3px solid #7c3aed !important;
}

html[data-theme="light"] .event-block {
  background: rgba(255, 255, 255, 0.82) !important;
  color: var(--text-main) !important;
  border: 1px solid rgba(0, 77, 102, 0.14) !important;
}
html[data-theme="light"] .event-block.event-client {
  color: var(--text-muted) !important;
}

html[data-theme="light"] .load-machine-frame {
  border-color: rgba(91, 33, 182, 0.4) !important;
}
html[data-theme="light"] .load-machine-frame .load-segment {
  color: #312e81 !important;
  font-weight: 700 !important;
}

html[data-theme="light"] .calendar-day.other-month {
  background: rgba(0, 77, 102, 0.08) !important;
}
html[data-theme="light"] .calendar-day.other-month .day-num {
  color: var(--text-muted) !important;
  opacity: 0.9 !important;
}

html[data-theme="light"] .calendar-day-slot:nth-child(7n + 13) .calendar-day,
html[data-theme="light"] .calendar-day-slot:nth-child(7n + 14) .calendar-day,
html[data-theme="light"] .calendar-day-slot:nth-child(7n+13) .calendar-day,
html[data-theme="light"] .calendar-day-slot:nth-child(7n+14) .calendar-day {
  background: var(--calendar-weekend-cell-bg) !important;
  border-left-color: rgba(240, 128, 90, 0.45) !important;
}

html[data-theme="light"] .calendar-day.is-expanded {
  box-shadow: 0 16px 40px rgba(0, 77, 102, 0.12), 0 0 0 1px var(--border-color) !important;
}

html[data-theme="light"] .preview-modal {
  background: var(--page-body-bg) !important;
}

html[data-theme="light"] .preview-modal .preview-iframe {
  background: var(--bg-input) !important;
}

html[data-theme="light"] .modal-dialog {
  background: var(--surface-elevated) !important;
  border-color: var(--surface-elevated-border) !important;
}
