* {
  box-sizing: border-box;
}
body {
  margin: 0;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  background: #0f1419;
  color: #e7e9ea;
  min-height: 100vh;
}

/* До завершения проверки auth не показываем контент страницы. */
body.auth-pending .wrap {
  visibility: hidden;
}

/* Полоса прокрутки в стиле проекта */
* {
  scrollbar-width: thin;
  scrollbar-color: #3d4452 #1a1f26;
}
*::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}
*::-webkit-scrollbar-track {
  background: #1a1f26;
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb {
  background: #3d4452;
  border-radius: 4px;
}
*::-webkit-scrollbar-thumb:hover {
  background: #4a5260;
}
*::-webkit-scrollbar-corner {
  background: #1a1f26;
}

/* Полноэкранная загрузка с блюром */
.global-loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease, visibility 0.3s ease;
}
.global-loader.is-active {
  opacity: 1;
  visibility: visible;
  display: flex;
}
.global-loader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 20, 25, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}
.global-loader-content {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1.25rem;
}
.global-loader-spinner {
  width: 56px;
  height: 56px;
  border: 3px solid #2f3542;
  border-top-color: #1d9bf0;
  border-right-color: rgba(29, 155, 240, 0.5);
  border-radius: 50%;
  animation: global-loader-spin 0.85s linear infinite;
}
.global-loader-text {
  font-size: 0.95rem;
  color: #8b98a5;
  letter-spacing: 0.02em;
  animation: global-loader-pulse 1.2s ease-in-out infinite;
}
@keyframes global-loader-spin {
  to { transform: rotate(360deg); }
}
@keyframes global-loader-pulse {
  0%, 100% { opacity: 0.7; }
  50% { opacity: 1; }
}

.wrap {
  max-width: 1900px;
  margin: 0 auto;
  padding: 1rem;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

#app-footer {
  margin-top: auto;
}

.app-footer {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #2f3542;
  font-size: 0.875rem;
  color: #8b98a5;
}

.app-footer-copy {
  color: #8b98a5;
}

.app-footer-support {
  color: #8b98a5;
}

.app-footer-support a {
  color: #1d9bf0;
  text-decoration: none;
}

.app-footer-support a:hover {
  text-decoration: underline;
}

.app-footer-nickname {
  opacity: 0.75;
}

.sticky-top {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #0f1419;
  padding-bottom: 1rem;
  margin: 0 -1rem;
  padding-left: 1rem;
  padding-right: 1rem;
  margin-bottom: 0.5rem;
  border-bottom: 1px solid #2f3542;
}

@media (max-width: 768px) {
  .sticky-top {
    position: static;
  }
}

.header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.75rem;
}
.header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
}
.header-nav {
  display: flex;
  align-items: center;
  gap: 0.75rem 1.25rem;
  flex-wrap: wrap;
}
.header-nav .nav-link {
  color: #8b98a5;
  text-decoration: none;
  font-size: 0.95rem;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
}
.header-nav .nav-link:hover,
.header-nav .nav-link.active { color: #e7e9ea; }
.nav-dropdown {
  position: relative;
}
.nav-dropdown-trigger {
  display: inline-flex;
  align-items: center;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: none;
  background: transparent;
  color: #8b98a5;
  font-size: 0.95rem;
  font-family: inherit;
  cursor: pointer;
  gap: 0.25rem;
}
.nav-dropdown-trigger::after {
  content: '';
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 5px solid currentColor;
  opacity: 0.8;
  margin-left: 0.15rem;
}
.nav-dropdown-trigger:hover,
.nav-dropdown-trigger.active { color: #e7e9ea; }
.nav-dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 140px;
  padding: 0.35rem 0;
  background: #1a1f26;
  border: 1px solid #2f3542;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.4);
  z-index: 100;
  display: none;
}
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown.nav-dropdown-open .nav-dropdown-menu {
  display: block;
}
.nav-dropdown-menu .nav-link {
  display: block;
  padding: 0.5rem 1rem;
  white-space: nowrap;
  border-radius: 0;
}
.nav-dropdown-menu .nav-link:hover {
  background: rgba(255,255,255,0.06);
}
.secret-toggle-wrap {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  cursor: pointer;
  user-select: none;
  color: #8b98a5;
  font-size: 0.95rem;
}
.secret-toggle-wrap:hover { color: #e7e9ea; }
.secret-toggle-input {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  border: 0;
}
.secret-toggle-track {
  display: inline-flex;
  align-items: center;
  width: 2.25rem;
  height: 1.25rem;
  border-radius: 999px;
  background: #2f3542;
  border: 1px solid #3d4452;
  transition: background 0.2s, border-color 0.2s;
  flex-shrink: 0;
}
.secret-toggle-thumb {
  width: 1rem;
  height: 1rem;
  border-radius: 50%;
  background: #6e7681;
  margin-left: 0.15rem;
  transition: transform 0.2s, background 0.2s;
}
.secret-toggle-input:checked + .secret-toggle-track .secret-toggle-thumb {
  transform: translateX(0.95rem);
  background: #1d9bf0;
}
.secret-toggle-input:focus-visible + .secret-toggle-track {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}
.secret-toggle-input:checked + .secret-toggle-track {
  background: rgba(29, 155, 240, 0.2);
  border-color: #1d9bf0;
}
.secret-toggle-label { font-weight: 600; }

/* Режим Secret: блюр всех сумм */
body.secret-amounts .totals-value,
body.secret-amounts .totals-currency,
body.secret-amounts [class*="cost-"],
body.secret-amounts .project-card-balance-value,
body.secret-amounts .project-card-balance-plan,
body.secret-amounts .invoice-detail-total,
body.secret-amounts .amount-blur {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}
body.secret-amounts #budgetCardExpensePlan,
body.secret-amounts #budgetCardExpenseFact,
body.secret-amounts #budgetCardIncomePlan,
body.secret-amounts #budgetCardIncomeFact,
body.secret-amounts #budgetCardBalanceValue,
body.secret-amounts #taskDetailCost {
  filter: blur(5px);
  user-select: none;
  pointer-events: none;
}

.header-nav .nav-user {
  color: #8b98a5;
  font-size: 0.85rem;
}
.btn-sm {
  padding: 0.4rem 0.75rem;
  font-size: 0.85rem;
}
.btn-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
}
.btn-icon svg {
  flex-shrink: 0;
}
.btn {
  padding: 0.5rem 1rem;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  cursor: pointer;
  background: #2f3542;
  color: #e7e9ea;
}
.btn:hover {
  background: #3d4452;
}
.btn-primary {
  background: #1d9bf0;
  color: #fff;
}
.btn-primary:hover {
  background: #1a8cd8;
}
.btn-secondary {
  background: #2f3542;
}
.btn.danger {
  background: #5c2a2a;
  color: #e74c3c;
}
.btn.danger:hover {
  background: #7a3535;
}
.totals {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.25rem;
  flex-wrap: wrap;
}
.totals-card {
  flex: 1;
  min-width: 140px;
  padding: 0.6rem 1rem;
  border-radius: 10px;
  background: #1a1f26;
  border: 1px solid #2f3542;
  text-align: left;
  cursor: pointer;
  font: inherit;
  color: inherit;
}
.totals-card:hover {
  border-color: #3d4452;
  background: #1e242c;
}
.totals-card:focus {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}
.totals-card[data-card="estimate"] { border-left: 4px solid #95a5a6; }
.totals-card[data-card="inProgress"] { border-left: 4px solid #f39c12; }
.totals-card[data-card="accepted"] { border-left: 4px solid #3498db; }
.totals-card[data-card="inPayment"] { border-left: 4px solid #9b59b6; }
.totals-card[data-card="paid"] { border-left: 4px solid #27ae60; }
.totals-card-total {
  border-left: 4px solid #1a8cd8;
  font-weight: 600;
}
.totals-card-total .totals-value { font-size: 1.45rem; }
.totals-card { position: relative; }
.totals-card-remove {
  position: absolute;
  top: 0.2rem;
  right: 0.3rem;
  display: none;
  width: 1.25rem;
  height: 1.25rem;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: rgba(255,255,255,0.15);
  color: #e7e9ea;
  font-size: 1rem;
  line-height: 1;
  cursor: pointer;
  align-items: center;
  justify-content: center;
}
.totals-card-remove:hover { background: rgba(255,255,255,0.25); }
.totals-card--filter-active .totals-card-remove { display: flex; }
.totals-label {
  display: block;
  font-size: 0.8rem;
  color: #8b98a5;
  margin-bottom: 0.15rem;
}
.totals-value {
  font-size: 1.35rem;
  font-weight: 700;
}
.totals-currency { font-size: 0.95rem; color: #8b98a5; margin-left: 0.2rem; }
.filters {
  display: flex;
  flex-wrap: nowrap;
  align-items: center;
  gap: 0.75rem 1rem;
  margin-bottom: 0.75rem;
  min-width: 0;
}
.filters .filter-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}
.filters .filter-row.filter-projects {
  flex-shrink: 1;
  min-width: 0;
}
.filters .filter-row.filter-actions {
  margin-left: auto;
  gap: 0.5rem;
}
.filters .filter-sep { color: #8b98a5; margin: 0 0.1rem; font-size: 0.85rem; }

/* Блок выбора периода (диапазон дат) — компактный */
.filters .filter-period {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.15rem 0.35rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
}
.filters .filter-period .filter-date {
  flex: 0 0 auto;
  border: none;
  background: transparent;
  padding: 0.2rem 0rem 0.2rem 0.35rem;
  width: 105px;
  height: 1.6rem;
  font-size: 0.8rem;
  box-sizing: border-box;
}
.filters .filter-period .filter-date:hover {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 4px;
}
.filters .filter-period .filter-sep {
  color: #6b7280;
  font-size: 0.75rem;
  margin: 0;
}

.filters select,
.filters .filter-date {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.85rem;
  min-width: 0;
  width: 118px;
  height: 1.9rem;
  box-sizing: border-box;
}
.filters select {
  padding-right: 1.75rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238b98a5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}
.filters .filter-date {
  width: 130px;
  color-scheme: dark;
}
.filters .filter-period .filter-date::-webkit-calendar-picker-indicator {
  width: 14px;
  height: 14px;
  padding: 0;
  margin-left: 0;
  opacity: 0.8;
  cursor: pointer;
  filter: invert(1);
}
.filters .filter-date::-webkit-calendar-picker-indicator {
  opacity: 0.8;
  cursor: pointer;
  filter: invert(1);
}
.filters .filter-date::-webkit-datetime-edit {
  color: #e7e9ea;
}
.filters .filter-date::-webkit-datetime-edit-fields-wrapper { color: #e7e9ea; }
.filters .filter-date::-webkit-datetime-edit-text { color: #8b98a5; }
.filters select:focus,
.filters .filter-date:focus { outline: none; border-color: #1d9bf0; }
.filters .filter-period .filter-date:focus {
  background: rgba(29, 155, 240, 0.08);
  box-shadow: 0 0 0 1px #1d9bf0;
}

.filters .filter-search {
  flex: 1;
  min-width: 0;
  max-width: 220px;
}
.filters .filter-search-input {
  width: 100%;
  padding: 0.35rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.85rem;
  height: 1.9rem;
  box-sizing: border-box;
}
.filters .filter-search-input::placeholder {
  color: #6b7280;
}
.filters .filter-search-input:focus {
  outline: none;
  border-color: #1d9bf0;
}
.filters .filter-search-input::-webkit-search-cancel-button {
  filter: invert(1);
  opacity: 0.7;
  cursor: pointer;
}
@media (max-width: 900px) {
  .filters { flex-wrap: wrap; }
}
.project-checkboxes {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1rem;
  align-items: center;
}
.project-checkboxes label {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  cursor: pointer;
  color: #e7e9ea;
  font-size: 0.9rem;
  white-space: nowrap;
}
.project-checkboxes input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: #1d9bf0;
  cursor: pointer;
}
.project-checkboxes label:hover { color: #fff; }

.multiselect-wrap {
  position: relative;
}
.multiselect-btn {
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.85rem;
  min-width: 0;
  width: 120px;
  max-width: 160px;
  height: 1.9rem;
  box-sizing: border-box;
  text-align: left;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238b98a5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}
.multiselect-btn:hover { border-color: #3d4452; }
.multiselect-btn:focus { outline: none; border-color: #1d9bf0; }
.multiselect-dropdown {
  position: absolute;
  top: 100%;
  left: 0;
  margin-top: 2px;
  min-width: 100%;
  max-height: 280px;
  overflow-y: auto;
  border-radius: 8px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  box-shadow: 0 4px 12px rgba(0,0,0,0.4);
  z-index: 100;
}
.multiselect-dropdown[hidden] { display: none; }
.multiselect-dropdown .option {
  padding: 0.5rem 0.75rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}
.multiselect-dropdown .option:hover { background: #2f3542; }
.multiselect-dropdown .option input { flex-shrink: 0; accent-color: #1d9bf0; cursor: pointer; }
.multiselect-dropdown .option span { flex: 1; }

.task-work-clickable {
  cursor: pointer;
  text-align: left;
  width: 100%;
  padding: 0.25rem 0;
  border: none;
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font: inherit;
  display: block;
  position: relative;
}
.task-work-clickable:hover {
  background: rgba(29, 155, 240, 0.12);
  outline: none;
}
.task-work-clickable:focus {
  outline: 2px solid #1d9bf0;
  outline-offset: 2px;
}
.task-has-comment {
  margin-left: 0.35em;
  font-size: 0.85em;
  opacity: 0.85;
  vertical-align: middle;
}
.task-comment-popover {
  position: fixed;
  z-index: 200;
  min-width: 280px;
  max-width: 420px;
  padding: 0.75rem;
  border-radius: 10px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  box-shadow: 0 8px 24px rgba(0,0,0,0.5);
}
.task-comment-popover textarea {
  width: 100%;
  min-height: 72px;
  padding: 0.5rem 0.6rem;
  border-radius: 8px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font: inherit;
  font-size: 0.9rem;
  resize: vertical;
  box-sizing: border-box;
}
.task-comment-popover textarea::placeholder {
  color: #6e767d;
}
.task-comment-popover textarea:focus {
  outline: none;
  border-color: #1d9bf0;
}

/* Страница настроек — вкладки и контент на всю ширину */
.settings-tabs-wrap {
  width: 100%;
  max-width: none;
}
.settings-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 1.25rem;
  border-bottom: 1px solid #2f3542;
  padding-bottom: 0;
}
.settings-tab {
  padding: 0.6rem 1rem;
  border: none;
  border-radius: 8px 8px 0 0;
  background: transparent;
  color: #8b98a5;
  font-size: 0.9rem;
  cursor: pointer;
  margin-bottom: -1px;
  border-bottom: 2px solid transparent;
}
.settings-tab:hover {
  color: #e7e9ea;
  background: rgba(47, 53, 66, 0.5);
}
.settings-tab.active {
  color: #e7e9ea;
  background: #1a1f26;
  border-bottom-color: #1d9bf0;
}
.settings-panels {
  width: 100%;
}
.settings-panel {
  display: none;
  padding: 0;
}
.settings-panel.active {
  display: block;
}
.settings-panel__desc {
  font-size: 0.9rem;
  color: #8b98a5;
  line-height: 1.5;
  margin: 0 0 1rem;
}
.settings-panel__desc code {
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  background: #0f1419;
  border-radius: 4px;
  color: #8b98a5;
}
.settings-panel .form-row {
  margin-bottom: 1rem;
}
.settings-table-wrap {
  overflow-x: auto;
  border: 1px solid #2f3542;
  border-radius: 10px;
  background: #1a1f26;
}
.settings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.settings-table th,
.settings-table td {
  padding: 0.6rem 0.85rem;
  text-align: left;
  border-bottom: 1px solid #2f3542;
}
.settings-table thead th {
  background: #0f1419;
  color: #8b98a5;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: 0.02em;
}
.settings-table tbody tr:last-child td {
  border-bottom: none;
}
.settings-table tbody tr:hover {
  background: rgba(47, 53, 66, 0.25);
}
.settings-table-code {
  font-size: 0.85em;
  background: #0f1419;
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: #8b98a5;
}
.user-sources-cell { display: flex; flex-direction: column; gap: 0.35rem; }
.user-sources-cell select[multiple] { min-width: 140px; }
.user-default-label { font-size: 0.85rem; color: #8b98a5; white-space: nowrap; }
.user-default-label .form-select { margin-left: 0.25rem; }

.settings-table-empty {
  color: #8b98a5;
  font-size: 0.9rem;
  text-align: center;
  padding: 1.25rem !important;
}
.settings-section {
  margin-bottom: 2rem;
}
.settings-section h2 {
  font-size: 1.1rem;
  margin: 0 0 0.5rem;
  color: #e7e9ea;
}
.settings-desc {
  font-size: 0.9rem;
  color: #8b98a5;
  margin: 0 0 1rem;
}
.settings-desc code { font-size: 0.85em; color: #8b98a5; }

/* ---------- Страница входа ---------- */
.page-login {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 1rem;
}

.page-login .wrap {
  width: 100%;
}

.login-wrap {
  max-width: 360px;
  margin: 0 auto;
}

.login-card {
  background: #1a1f26;
  border: 1px solid #2f3542;
  border-radius: 12px;
  padding: 1.75rem;
}

.login-title {
  margin: 0 0 1.25rem;
  font-size: 1.25rem;
  font-weight: 600;
  color: #e7e9ea;
}

.login-card input[type="email"],
.login-card input[type="password"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  margin-bottom: 1rem;
  border-radius: 8px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font-size: 1rem;
  box-sizing: border-box;
}

.login-card input:focus {
  outline: none;
  border-color: #1d9bf0;
}

.login-card .btn-block {
  width: 100%;
  margin-bottom: 0.5rem;
}

.login-card .login-email-display {
  margin: 0 0 1rem;
  font-size: 0.9rem;
  color: #8b98a5;
}

.login-card .login-error {
  margin: 1rem 0 0;
  font-size: 0.875rem;
  color: #e74c3c;
  display: none;
}

.bulk-actions-bar {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 0.75rem;
  padding: 0.4rem 0.75rem;
  margin-bottom: 0.5rem;
  min-height: 36px;
  background: #1e242c;
  border: 1px solid #2f3542;
  border-radius: 6px;
}
.bulk-actions-bar[hidden] { display: none !important; }
.bulk-actions-label { color: #8b98a5; font-size: 0.85rem; white-space: nowrap; flex-shrink: 0; }
.bulk-actions-sum { margin-left: 1rem; }
.bulk-actions-controls { display: flex; align-items: center; flex-wrap: nowrap; gap: 0.5rem; flex: 1; min-width: 0; }
.bulk-actions-item { display: inline-flex; align-items: center; gap: 0.35rem; flex-shrink: 0; }
.bulk-actions-item-label { color: #8b98a5; font-size: 0.8rem; white-space: nowrap; }
.bulk-actions-select {
  padding: 0.3rem 0.5rem;
  border-radius: 4px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e6edf3;
  font-size: 0.85rem;
  min-width: 0;
  width: 140px;
}
.bulk-actions-select:focus { outline: none; border-color: #1a8cd8; }
.bulk-actions-bar .btn { flex-shrink: 0; }

.table-section {
  overflow: auto;
  max-height: calc(100vh - 320px);
  border-radius: 12px;
  border: 1px solid #2f3542;
}
.table-wrap { border-radius: 0; border: none; overflow: visible; }
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}
.data-table th,
.data-table td {
  padding: 0.6rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #2f3542;
}
.data-table thead {
  position: sticky;
  top: 0;
  z-index: 10;
}
.data-table thead th {
  background: #1a1f26;
  color: #8b98a5;
  font-weight: 600;
  white-space: nowrap;
  box-shadow: 0 1px 0 0 #2f3542;
}
.data-table th.th-checkbox,
.data-table td.td-checkbox { width: 2.5rem; text-align: center; vertical-align: middle; }
.data-table th.th-checkbox input,
.data-table td.td-checkbox input { cursor: pointer; margin: 0; accent-color: #1a8cd8; }
.data-table.view-only-expenses th.th-checkbox,
.data-table.view-only-expenses td.td-checkbox { display: none; }
.data-table thead th.th-sortable {
  cursor: pointer;
  user-select: none;
}
.data-table thead th.th-sortable:hover {
  color: #e7e9ea;
}
.data-table thead th.th-sortable.sort-active {
  color: #1d9bf0;
}
.data-table thead th .sort-indicator {
  font-size: 0.75em;
  opacity: 0.8;
}
.data-table tbody tr:hover { background: #1a1f26; }
.data-table .loading { text-align: center; color: #8b98a5; padding: 2rem; }
.data-table a { color: #1d9bf0; text-decoration: none; }
.data-table a:hover { text-decoration: underline; }
.data-table select {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font-size: 0.85rem;
  min-width: 120px;
}
.data-table select:focus { outline: none; border-color: #1d9bf0; }
/* Цвета сумм соответствуют цветам карточек totals-card */
.cost-estimate { color: #95a5a6; }   /* На согласовании */
.cost-planned { color: #f39c12; }    /* В работе */
.cost-accepted { color: #3498db; }   /* Принято */
.cost-inPayment { color: #9b59b6; }  /* В оплату */
.cost-paid { color: #27ae60; }       /* Оплачено */
.data-table .paid-cell { text-align: center; vertical-align: middle; }
.data-table .paid-cell input[type="checkbox"] { accent-color: #27ae60; cursor: pointer; margin: 0; }
.data-table .paid-cell input:disabled { cursor: not-allowed; opacity: 0.6; }
.data-table tbody tr.task-orphan { background: rgba(231, 76, 60, 0.08); border-left: 3px solid #e74c3c; }
.data-table tbody tr.task-orphan:hover { background: rgba(231, 76, 60, 0.12); }
.data-table tbody tr.task-snapshot-mismatch { background: rgba(243, 156, 18, 0.08); border-left: 3px solid #f39c12; }
.data-table tbody tr.task-snapshot-mismatch:hover { background: rgba(243, 156, 18, 0.12); }
.data-table tbody tr.data-table tbody tr.task-over-budget { background: rgba(210, 140, 0, 0.15); border-left: 3px solid #d28c00; }
.data-table tbody tr.task-over-budget:hover { background: rgba(210, 140, 0, 0.22); }

.task-excessive-hours { background: rgba(230, 126, 34, 0.08); border-left: 3px solid #e67e22; }
.data-table tbody tr.task-excessive-hours:hover { background: rgba(230, 126, 34, 0.12); }
.data-table .hours-excessive { color: #e67e22; }
.data-table .warning-excessive-hours { margin-left: 0.2rem; }
.data-table .cost-excluded { opacity: 0.75; }
.data-table .badge-orphan { color: #e74c3c; font-weight: bold; margin-left: 0.25rem; }
dialog {
  border: 1px solid #2f3542;
  border-radius: 12px;
  padding: 0;
  background: #1a1f26;
  color: #e7e9ea;
  max-width: 90vw;
  width: 420px;
}
dialog::backdrop { background: rgba(0,0,0,0.6); }
.modal-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid #2f3542;
}
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-close {
  background: none;
  border: none;
  color: #8b98a5;
  font-size: 1.5rem;
  cursor: pointer;
  line-height: 1;
  padding: 0 0.25rem;
}
.modal-close:hover { color: #e7e9ea; }
.modal-body { padding: 1rem 1.25rem; }
.breakdown-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.95rem;
}
.breakdown-table th,
.breakdown-table td {
  padding: 0.5rem 0.75rem;
  text-align: left;
  border-bottom: 1px solid #2f3542;
}
.breakdown-table th {
  color: #8b98a5;
  font-weight: 600;
}
.breakdown-table td:last-child {
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.breakdown-table tbody tr:last-child td { border-bottom: none; }
.modal-card-breakdown .modal-body { min-width: 280px; }
.form-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}
.form-row input {
  padding: 0.5rem;
  border-radius: 8px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font-size: 0.9rem;
}
.form-row input[type="number"] { width: 100px; }
.form-row input[type="date"] { width: 140px; }
.form-row input[type="text"] { flex: 1; min-width: 140px; }
.form-row .form-select,
.settings-panel .form-select {
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.9rem;
  min-height: 2rem;
  min-width: 160px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238b98a5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.5rem center;
}
.form-row .form-select:focus,
.settings-panel .form-select:focus { outline: none; border-color: #1d9bf0; }
.form-row .form-select:hover,
.settings-panel .form-select:hover { border-color: #3d4452; }
#projectsList, #tariffsList {
  list-style: none;
  margin: 0;
  padding: 0;
}
#projectsList li, #tariffsList li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.5rem 0;
  border-bottom: 1px solid #2f3542;
}
#projectsList li:last-child, #tariffsList li:last-child { border-bottom: none; }
.item-name { flex: 1; }
.btn-small {
  padding: 0.25rem 0.5rem;
  font-size: 0.8rem;
  background: #2f3542;
  color: #e7e9ea;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}
.btn-small:hover { background: #3d4452; }
.btn-small.danger { background: #5c2a2a; color: #e74c3c; }
.btn-small.danger:hover { background: #7a3535; }
.btn-small.btn-icon-small {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.35rem;
  min-width: 1.8rem;
}
.btn-small.btn-icon-small svg { flex-shrink: 0; }
.error-msg {
  padding: 1rem;
  background: #2a1a1a;
  border: 1px solid #5c2a2a;
  border-radius: 8px;
  color: #e74c3c;
  margin-bottom: 1rem;
}

/* ---------- Недели (Weekly) — календарная сетка по неделям ---------- */
.weekly-wrap {
  max-width: 1900px;
  margin: 0 auto;
  padding-left: 0.5rem;
  padding-right: 0.5rem;
  --weekly-header-height: 200px;
}
.weekly-scroll-area {
  max-width: 1900px;
  margin: 0 auto;
}
.weekly-view-bar {
  display: flex;
  align-items: center;
  gap: 1rem;
  flex-wrap: wrap;
  margin-bottom: 0.5rem;
}
.weekly-active-month {
  margin: 0;
  font-size: 0.9rem;
  color: #8b98a5;
}
.weekly-view-toggle {
  display: flex;
  gap: 0;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid #2f3542;
}
.weekly-view-btn {
  padding: 0.35rem 0.75rem;
  font-size: 0.85rem;
  border: none;
  background: #1a1f26;
  color: #8b98a5;
  cursor: pointer;
}
.weekly-view-btn:hover { color: #e7e9ea; background: #2f3542; }
.weekly-view-btn.active {
  background: #1d9bf0;
  color: #fff;
}
.weekly-filter-label {
  font-size: 0.85rem;
  color: #8b98a5;
  margin: 0;
}
.weekly-source-select {
  padding: 0.35rem 1.75rem 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.85rem;
  min-width: 140px;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 12 12'%3E%3Cpath fill='%238b98a5' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.45rem center;
}
.weekly-source-select:focus { outline: none; border-color: #1d9bf0; }
.weekly-filter-input {
  padding: 0.35rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.85rem;
  min-width: 140px;
}
.weekly-filter-input::placeholder { color: #6e7681; }
.weekly-filter-input:focus { outline: none; border-color: #1d9bf0; }
.weekly-view-bar .multiselect-wrap { flex-shrink: 0; }
.weekly-view-bar .multiselect-btn { min-width: 120px; font-size: 0.85rem; padding: 0.35rem 0.5rem; }
.weekly-months { padding-bottom: 10px; }
.weekly-month-section,
.weekly-week-section {
  display: flex;
  flex-direction: column;
  height: calc(100vh - var(--weekly-header-height) - 10px);
  min-height: 280px;
  padding: 0.5rem 0;
  margin-bottom: 10px;
  scroll-margin-top: calc(var(--weekly-header-height) + 10px);
}
.weekly-period-title-wrap {
  display: flex;
  align-items: baseline;
  flex-wrap: wrap;
  gap: 0.5rem 0.75rem;
  margin-bottom: 0.35rem;
  flex-shrink: 0;
  cursor: default;
}
.weekly-period-title-wrap .weekly-month-title,
.weekly-period-title-wrap .weekly-week-title {
  margin: 0;
}
.weekly-month-title,
.weekly-week-title {
  margin: 0 0 0.35rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: #e7e9ea;
  flex-shrink: 0;
}
.period-label {
  font-size: 0.9rem;
  color: #8b949e;
  font-weight: 400;
}
.period-label--typing {
  border-right: 2px solid #8b949e;
  animation: period-label-blink 0.6s step-end infinite;
}
@keyframes period-label-blink {
  50% { border-color: transparent; }
}
.weekly-calendar-wrap {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  border-radius: 8px;
  border: 1px solid #2a3038;
  background: #161b22;
  display: flex;
  flex-direction: column;
}
.weekly-week-section .weekly-calendar-wrap { overflow: hidden; }
.weekly-calendar {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
  font-size: 0.85rem;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.weekly-calendar thead {
  flex-shrink: 0;
  display: table;
  width: 100%;
  table-layout: fixed;
}
.weekly-calendar tbody {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.weekly-calendar tbody tr {
  flex: 1;
  display: flex;
  min-height: 60px;
}
.weekly-calendar tbody td {
  flex: 1;
  display: block;
  min-width: 0;
  width: 0;
}
.weekly-month-section .weekly-calendar tbody td {
  min-height: 0;
}
/* Неделя: таблица с ограниченной высотой ячеек и локальным скроллом в каждом дне */
.weekly-week-section .weekly-calendar-wrap {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.weekly-calendar-week {
  display: flex !important;
  flex-direction: column !important;
  height: 100%;
  width: 100%;
  min-height: 0;
  border-collapse: collapse;
}
.weekly-calendar-week thead {
  flex-shrink: 0;
  display: table !important;
  width: 100%;
  table-layout: fixed;
}
.weekly-calendar-week thead tr {
  display: table-row !important;
}
.weekly-calendar-week thead th {
  display: table-cell !important;
  padding: 0.35rem 0.25rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.8rem;
  color: #7d8590;
  border-bottom: 1px solid #21262d;
  background: #161b22;
}
.weekly-calendar-week thead th:first-child {
  width: 2.5rem;
  min-width: 2.5rem;
}
.weekly-calendar-week thead th.weekly-th-day {
  width: calc((100% - 2.5rem) / 7);
}
.weekly-calendar-week tbody {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
}
.weekly-calendar-week tbody tr {
  flex: 1 !important;
  min-height: 0 !important;
  display: flex !important;
}
.weekly-calendar-week tbody td {
  flex: 1 !important;
  min-height: 0 !important;
  overflow: hidden !important;
  display: flex !important;
  flex-direction: column !important;
  vertical-align: top;
  border: 1px solid #21262d;
  background: #0d1117;
}
.weekly-calendar-week tbody td:first-child {
  flex: 0 0 2.5rem !important;
  min-width: 2.5rem;
}
.weekly-calendar thead { position: sticky; top: 0; z-index: 5; background: #161b22; }
.weekly-th-day {
  padding: 0.35rem 0.25rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.8rem;
  color: #7d8590;
  border-bottom: 1px solid #21262d;
  width: 14.28%;
}
.weekly-day {
  vertical-align: top;
  padding: 0.25rem 0.3rem;
  border: 1px solid #21262d;
  background: #0d1117;
  min-height: 60px;
}
.weekly-week-section .weekly-day {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  padding: 0.25rem 0.3rem;
}
.weekly-week-section .weekly-day-tasks {
  flex: 1;
  min-height: 0;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.weekly-week-section .weekly-day-tasks-list {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
}
.weekly-week-section .weekly-day-more { display: none !important; }
/* В режиме «Неделя» показываем все карточки дня, не только первую */
.weekly-week-section .weekly-day-tasks-list .weekly-task:nth-child(n+2) { display: block; }
.weekly-week-section .weekly-day-tasks-list .weekly-task:nth-child(n+5) { display: block; }
.weekly-week-section .weekly-task {
  padding: 0.4rem 0.5rem;
  font-size: 0.85rem;
  line-height: 1.35;
  min-height: 2.8em;
  white-space: normal;
  text-overflow: clip;
}
.weekly-th-week {
  width: 2rem;
  min-width: 2rem;
  padding: 0.35rem 0.2rem;
  text-align: center;
  font-weight: 500;
  font-size: 0.75rem;
  color: #7d8590;
  border-bottom: 1px solid #21262d;
}
.weekly-week-num {
  width: 2rem;
  min-width: 2rem;
  padding: 0.25rem 0.2rem;
  text-align: center;
  font-size: 0.75rem;
  color: #7d8590;
  border: 1px solid #21262d;
  background: #161b22;
  vertical-align: middle;
}
.weekly-week-num--active {
  cursor: pointer;
  color: #58a6ff;
}
.weekly-week-num--active:hover {
  background: #21262d;
  color: #79c0ff;
}
.weekly-week-num--static {
  background: #0d1117;
  cursor: default;
  vertical-align: middle;
  text-align: center;
}
.weekly-calendar-month tbody td.weekly-week-num { flex: 0 0 2rem; width: 2rem; }
.weekly-week-section .weekly-week-num--static { vertical-align: middle; }
.weekly-day--other-month {
  background: #0d1117;
  color: #484f58;
}
.weekly-day-num {
  display: inline-block;
  font-weight: 600;
  color: #e7e9ea;
  margin-bottom: 0.25rem;
  font-size: 0.9rem;
}
.weekly-day--other-month .weekly-day-num {
  color: #8b98a5;
  opacity: 0.8;
}
.weekly-day-tasks {
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  flex: 1;
  min-height: 0;
}
.weekly-month-section .weekly-day {
  display: flex;
  flex-direction: column;
  min-height: 0;
}
.weekly-day-tasks-list {
  flex: 1;
  min-height: 0;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
/* По умолчанию видна только 1 карточка в ячейке дня */
.weekly-day-tasks-list .weekly-task:nth-child(n+2) { display: none; }
@media (min-width: 1920px) {
  .weekly-day-tasks-list .weekly-task:nth-child(n+2) { display: block; }
  .weekly-day-tasks-list .weekly-task:nth-child(n+5) { display: none; }
}
.weekly-day-more { flex-shrink: 0; }
.weekly-day-more-narrow { display: inline; }
.weekly-day-more-wide { display: none; }
@media (min-width: 1920px) {
  .weekly-day-more:not(.has-wide) { display: none; }
  .weekly-day-more-narrow { display: none; }
  .weekly-day-more-wide { display: inline; }
}
.weekly-task {
  padding: 0.2rem 0.3rem 0.2rem 0.4rem;
  border-radius: 4px;
  background: rgba(33, 38, 45, 0.8);
  color: #e6edf3;
  font-size: 0.72rem;
  line-height: 1.3;
  white-space: nowrap;
  overflow: hidden;
}
.weekly-task.weekly-task-over-budget {
  background: rgba(210, 140, 0, 0.35);
  border-left: 3px solid #d28c00;
  text-overflow: ellipsis;
  cursor: pointer;
  border: none;
  border-left: 3px solid #7d8590;
  width: 100%;
  text-align: left;
  font: inherit;
  box-sizing: border-box;
}
.weekly-task[data-status="На согласовании"] { border-left-color: #95a5a6; }
.weekly-task[data-status="В работе"] { border-left-color: #d29922; }
.weekly-task[data-status="Принято"] { border-left-color: #3498db; }
.weekly-task[data-paid="1"] { border-left-color: #27ae60; }
.weekly-task:hover { background: rgba(48, 54, 61, 0.9); }
.weekly-day-more {
  display: inline-block;
  font-size: 0.72rem;
  color: #58a6ff;
  padding: 0.15rem 0.25rem;
  cursor: pointer;
  background: none;
  border: none;
  font: inherit;
  margin-top: 0.1rem;
}
.weekly-day-more:hover { text-decoration: underline; color: #79c0ff; }

/* Модальное окно задачи (редактирование) */
.modal-task-detail { width: 100%; max-width: 560px; border-left: 4px solid #2f3542; }
.modal-task-detail[data-status="На согласовании"] { border-left-color: #95a5a6; }
.modal-task-detail[data-status="В работе"] { border-left-color: #e67e22; }
.modal-task-detail[data-status="Принято"] { border-left-color: #3498db; }
.modal-task-detail[data-status="Оплачено"] { border-left-color: #27ae60; }
.modal-task-detail .modal-head.modal-task-head {
  padding: 0.5rem 1rem 0.55rem 1.25rem;
  border-bottom: 1px solid #2f3542;
  gap: 0.5rem;
  align-items: center;
}
.modal-task-detail .modal-task-title {
  flex: 1;
  min-width: 0;
  margin: 0;
  font-size: 0.9rem;
  font-weight: 600;
  color: #e7e9ea;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.modal-task-status-badge {
  flex-shrink: 0;
  font-size: 0.7rem;
  font-weight: 500;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  color: #0d1117;
}
.modal-task-detail[data-status="На согласовании"] .modal-task-status-badge { background: #95a5a6; }
.modal-task-detail[data-status="В работе"] .modal-task-status-badge { background: #e67e22; }
.modal-task-detail[data-status="Принято"] .modal-task-status-badge { background: #3498db; }
.modal-task-detail[data-status="Оплачено"] .modal-task-status-badge { background: #27ae60; }
.modal-task-body { padding: 1rem 1.25rem; }
.modal-task-row {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}
.modal-task-row:last-child { margin-bottom: 0; }
.modal-task-label {
  flex: 0 0 90px;
  font-size: 0.8rem;
  font-weight: 400;
  color: #8b98a5;
}
.modal-task-value,
.modal-task-work-text {
  font-size: 0.9rem;
  font-weight: 400;
  color: #c9d1d9;
}
.modal-task-work {
  display: flex;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.modal-task-work-text { flex: 1; min-width: 0; word-break: break-word; }
.modal-task-select {
  flex: 1;
  min-width: 0;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font-size: 0.9rem;
  font-weight: 400;
}
.modal-task-checkbox { accent-color: #27ae60; cursor: pointer; margin: 0; }
.modal-task-cost { font-weight: 600; color: #c9d1d9; }
.modal-task-textarea {
  flex: 1;
  min-width: 0;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #c9d1d9;
  font-size: 0.9rem;
  font-weight: 400;
  resize: vertical;
}
.modal-task-refresh-row { margin-top: 0.25rem; }
.modal-task-refresh-row .modal-task-label { flex: 0 0 90px; }
.modal-task-comment-row .modal-task-label { align-self: flex-start; padding-top: 0.35rem; }
.task-comment-popover {
  position: fixed;
  z-index: 2000;
  background: #1a1f26;
  border: 1px solid #2f3542;
  border-radius: 8px;
  padding: 0.5rem;
  box-shadow: 0 4px 20px rgba(0,0,0,0.4);
}
.task-comment-popover textarea {
  width: 260px;
  min-height: 60px;
  padding: 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #0f1419;
  color: #e7e9ea;
  font-size: 0.9rem;
  resize: vertical;
}

@media (max-width: 768px) {
  .weekly-sticky { position: static; }
  .weekly-month-section,
  .weekly-week-section { min-height: 80vh; padding: 0.5rem 0 1.5rem; }
  .weekly-day { min-height: 70px; height: auto; padding: 0.25rem; }
  .weekly-task { font-size: 0.7rem; }
}

/* Проекты: список и карточка */
.projects-list-toolbar {
  margin-bottom: 1rem;
}
.projects-search-input {
  width: 100%;
  max-width: 360px;
  padding: 0.5rem 0.75rem;
  font-size: 1rem;
  border: 1px solid #2f3542;
  border-radius: 6px;
  background: #1a1f26;
  color: #e6edf3;
}
.projects-search-input::placeholder { color: #8b98a5; }
.projects-search-input:focus {
  outline: none;
  border-color: #1a8cd8;
}
.projects-list-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}
.project-card {
  background: #1a1f26;
  border: 1px solid #2f3542;
  border-radius: 8px;
  padding: 1rem;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}
.project-card:hover {
  border-color: #3d4452;
  background: #1e242c;
}
.project-card-name { font-weight: 600; font-size: 1.05rem; margin-bottom: 0.35rem; }
.project-card-desc {
  font-size: 0.9rem;
  color: #8b98a5;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.project-card-balance {
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #2f3542;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 0.5rem;
}
.project-card-balance-label { font-size: 0.9rem; color: #8b98a5; }
.project-card-balance-value { font-weight: 600; font-size: 1.05rem; }
.project-card-balance-plan { font-size: 0.85rem; color: #8b98a5; }
.project-card-balance-negative .project-card-balance-value { color: #e74c3c; }
.project-card-balance-positive .project-card-balance-value { color: #2d8a6e; }
.project-detail-section { margin-top: 1rem; }
.project-detail-section.project-detail-fade-in {
  animation: project-detail-fade-in 0.25s ease-out;
}
@keyframes project-detail-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.project-back-link {
  display: inline-block;
  color: #1d9bf0;
  text-decoration: none;
  font-size: 0.9rem;
  margin-bottom: 0.75rem;
}
.project-back-link:hover { text-decoration: underline; }
.project-detail-name { margin: 0 0 1rem; font-size: 1.35rem; }
.project-detail-tabs-wrap { margin-top: 1rem; }
.project-detail-tabs {
  display: flex;
  gap: 0.25rem;
  border-bottom: 1px solid #2f3542;
  margin-bottom: 1rem;
}
.project-detail-tab {
  padding: 0.5rem 1rem;
  border: none;
  background: transparent;
  color: #8b98a5;
  font-size: 0.95rem;
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}
.project-detail-tab:hover { color: #e7e9ea; }
.project-detail-tab.active { color: #e7e9ea; border-bottom-color: #1d9bf0; }
.project-detail-panel { display: none; }
.project-detail-panel.active { display: block; }
.project-detail-desc-block {
  max-width: 560px;
}
.project-detail-desc-block .project-detail-label {
  display: block;
  margin-bottom: 0.35rem;
  font-size: 0.9rem;
  color: #8b98a5;
}
.project-detail-description {
  display: block;
  width: 100%;
  box-sizing: border-box;
  padding: 0.5rem 0.6rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.95rem;
  resize: vertical;
  min-height: 100px;
  margin-bottom: 0.75rem;
}
.project-detail-description:focus {
  outline: none;
  border-color: #1d9bf0;
}
.project-budget-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1rem;
}
.project-budget-summary {
  font-size: 0.95rem;
  color: #8b98a5;
}
.project-budget-summary strong { color: #e7e9ea; }
.project-budget-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}
.budget-card {
  background: #1a1f26;
  border: 1px solid #2f3542;
  border-radius: 8px;
  padding: 0.75rem 1rem;
}
.budget-card-label { display: block; font-size: 0.8rem; color: #8b98a5; margin-bottom: 0.25rem; }
.budget-card-value { font-size: 1.25rem; font-weight: 700; }
.budget-card-currency { font-size: 0.9rem; color: #8b98a5; margin-left: 0.2rem; }
.budget-card-expense-plan { border-left: 4px solid #95a5a6; }
.budget-card-expense-fact { border-left: 4px solid #27ae60; }
.budget-card-income-plan { border-left: 4px solid #3498db; }
.budget-card-income-fact { border-left: 4px solid #1d9bf0; }
.budget-card-balance { border-left: 4px solid #3d4452; }
.budget-card-plan-hint {
  display: block;
  font-size: 0.65rem;
  color: #8b98a5;
  margin-top: 0.25rem;
  line-height: 1.2;
}
.budget-card.budget-card-negative {
  background: #3d2826;
  border-color: #5c3a36;
}
.budget-card.budget-card-negative .budget-card-label,
.budget-card.budget-card-negative .budget-card-currency { color: #c9b8b6; }
.budget-card.budget-card-negative .budget-card-value { color: #e8a8a0; }
.budget-card.budget-card-positive {
  background: #243d30;
  border-color: #355544;
}
.budget-card.budget-card-positive .budget-card-label,
.budget-card.budget-card-positive .budget-card-currency { color: #b8cfc2; }
.budget-card.budget-card-positive .budget-card-value { color: #8fddab; }
.budget-card.budget-card-negative .budget-card-plan-hint,
.budget-card.budget-card-positive .budget-card-plan-hint { color: rgba(255,255,255,0.75); }
.budget-table .th-num { text-align: right; }
.budget-table td:nth-child(4),
.budget-table td:nth-child(5),
.budget-table td:nth-child(6) { text-align: right; }
.budget-table-task-desc {
  cursor: pointer;
}
.budget-table-task-desc:hover { color: #1d9bf0; }
.budget-table tr.budget-row-status-estimate td:first-child { border-left: 4px solid #95a5a6; }
.budget-table tr.budget-row-status-inProgress td:first-child { border-left: 4px solid #f39c12; }
.budget-table tr.budget-row-status-accepted td:first-child { border-left: 4px solid #3498db; }
.budget-table tr.budget-row-status-inPayment td:first-child { border-left: 4px solid #9b59b6; }
.budget-table tr.budget-row-status-paid td:first-child { border-left: 4px solid #27ae60; }
.budget-table thead th.budget-th-sort {
  cursor: pointer;
  user-select: none;
}
.budget-table thead th.budget-th-sort:hover { color: #e7e9ea; }
.budget-table thead th.budget-th-sort.sort-active { color: #1d9bf0; }
.project-budget-actions { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.cbr-rates-info { font-size: 0.8rem; color: #6b7280; margin-right: 0.5rem; }
.modal-body .form-group { margin-bottom: 0.75rem; }
.modal-body .form-group label { display: block; margin-bottom: 0.25rem; font-size: 0.9rem; color: #8b98a5; }
.modal-body .form-group .required { color: #e74c3c; }
.modal-body .form-actions { margin-top: 1rem; display: flex; gap: 0.5rem; flex-wrap: wrap; }
.modal-body .form-group input,
.modal-body .form-group select {
  width: 100%;
  max-width: 280px;
  padding: 0.4rem 0.5rem;
  border-radius: 6px;
  border: 1px solid #2f3542;
  background: #1a1f26;
  color: #e7e9ea;
  font-size: 0.95rem;
}
.modal-actions { margin-top: 1rem; gap: 0.5rem; display: flex; }
.modal-mark-paid-hint { font-size: 0.9rem; color: #8b98a5; margin-bottom: 1rem; }

/* Счета на оплату */
.invoices-desc { color: #8b98a5; font-size: 0.95rem; margin-bottom: 1.5rem; }
.invoices-list-section { margin-bottom: 2rem; }
.invoices-list-section h2, .invoice-detail-section h2 { font-size: 1.1rem; margin-bottom: 0.75rem; }
.invoices-list-wrap { overflow-x: auto; }
.invoices-empty { color: #8b98a5; }
.invoice-detail-section { margin-top: 2rem; }
.invoice-detail-actions { margin-bottom: 0.75rem; }
.invoice-detail-table-wrap { overflow-x: auto; margin-bottom: 0.5rem; }
.invoice-detail-total { font-weight: 600; }
.invoice-row-diverged { background: rgba(240, 80, 80, 0.15) !important; }
.invoice-diverged-badge { color: #f05050; font-size: 0.85rem; }
.invoice-paid-badge { color: #0e8c6c; font-size: 0.85rem; }
.invoice-status { font-weight: 500; }
.invoice-status-paid { color: #27ae60; }
.invoice-status-partially_paid { color: #b8860b; }
.invoice-status-not_paid { color: #95a5a6; }
/* Цветовая схема статуса оплаты строки счёта (как в списке задач/проектах) */
.invoice-detail-table-wrap .data-table tr.invoice-row-status-estimate td:first-child { border-left: 4px solid #95a5a6; }
.invoice-detail-table-wrap .data-table tr.invoice-row-status-inProgress td:first-child { border-left: 4px solid #f39c12; }
.invoice-detail-table-wrap .data-table tr.invoice-row-status-accepted td:first-child { border-left: 4px solid #3498db; }
.invoice-detail-table-wrap .data-table tr.invoice-row-status-inPayment td:first-child { border-left: 4px solid #9b59b6; }
.invoice-detail-table-wrap .data-table tr.invoice-row-status-paid td:first-child { border-left: 4px solid #27ae60; }
