/* ============================================================
   БЮДЖЕТ МАРКЕТИНГА — Premium Liquid Glass
   Visual layer only. Business logic stays in budget.js/server.js.
   ============================================================ */

:root {
  --budget-text-primary: #111827;
  --budget-text-secondary: #4B5563;
  --budget-text-muted: #7C8491;

  --budget-glass: rgba(255, 255, 255, 0.34);
  --budget-glass-strong: rgba(255, 255, 255, 0.50);
  --budget-stroke: rgba(255, 255, 255, 0.66);
  --budget-stroke-soft: rgba(255, 255, 255, 0.38);

  --budget-violet: #8B5CF6;
  --budget-cyan: #38D9D1;
  --budget-blue: #3B82F6;
  --budget-amber: #E5A300;
  --budget-green: #22C55E;
  --budget-red: #EF4444;
  --budget-neutral: #9CA3AF;

  --budget-radius-sm: 14px;
  --budget-radius-md: 20px;
  --budget-radius-lg: 26px;
  --budget-radius-xl: 34px;

  --budget-shadow: 0 18px 42px rgba(31, 41, 55, 0.16), inset 0 1px 1px rgba(255, 255, 255, 0.72), inset 0 -1px 1px rgba(255, 255, 255, 0.24);
  --budget-shadow-strong: 0 22px 54px rgba(31, 41, 55, 0.22), inset 0 1px 1px rgba(255, 255, 255, 0.80);
}

body.budget2-page {
  background:
    radial-gradient(circle at 8% 6%, rgba(255, 205, 145, 0.80) 0%, transparent 38%),
    radial-gradient(circle at 88% 8%, rgba(110, 122, 158, 0.62) 0%, transparent 42%),
    radial-gradient(circle at 62% 36%, rgba(139, 92, 246, 0.30) 0%, transparent 32%),
    radial-gradient(circle at 80% 64%, rgba(56, 217, 209, 0.30) 0%, transparent 36%),
    radial-gradient(circle at 20% 88%, rgba(255, 142, 219, 0.20) 0%, transparent 34%),
    linear-gradient(135deg, #EEDFCB 0%, #D9CDD8 45%, #9CA6BE 100%) fixed;
  background-attachment: scroll;
}

body.budget2-page .bg-orbs {
  display: none;
}

.budget-shell {
  display: flex;
  flex-direction: column;
  width: 100%;
  max-width: 1600px;
  gap: 16px;
  padding-top: 16px !important;
  padding-bottom: 20px !important;
}

.budget-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 0;
}

.budget-topbar h1 {
  margin: 0;
  font-size: 22px;
  line-height: 1.12;
  font-weight: 850;
  letter-spacing: -0.035em;
  color: var(--budget-text-primary);
}

.budget-subtitle {
  margin: 3px 0 0;
  color: var(--budget-text-secondary);
  font-size: 12px;
  font-weight: 600;
}

.budget-toolbar,
.budget-summary-card,
.budget-project-card,
.budget-operation-card,
.budget-plan-card,
.budget-empty,
.budget-modal {
  position: relative;
  border-radius: var(--budget-radius-xl);
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.42), rgba(255, 255, 255, 0.12));
  border: 1px solid var(--budget-stroke);
  box-shadow: var(--budget-shadow);
  -webkit-backdrop-filter: blur(22px) saturate(180%) brightness(1.03);
  backdrop-filter: blur(22px) saturate(180%) brightness(1.03);
}

.budget-toolbar::before,
.budget-summary-card::before,
.budget-project-card::before,
.budget-operation-card::before,
.budget-plan-card::before,
.budget-empty::before,
.budget-modal::before {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  background: linear-gradient(135deg, rgba(255, 255, 255, 0.44), transparent 46%);
  mix-blend-mode: screen;
}

.budget-toolbar::after,
.budget-summary-card::after,
.budget-project-card::after,
.budget-operation-card::after,
.budget-plan-card::after,
.budget-modal::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  padding: 1px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.90) 0%, rgba(255, 255, 255, 0) 18%, rgba(255, 255, 255, 0) 82%, rgba(255, 255, 255, 0.28) 100%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask-composite: exclude;
}

.budget-toolbar {
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 14px;
  border-radius: 30px;
}

.budget-tabs {
  position: relative;
  z-index: 1;
  margin: 0;
  padding: 5px;
  background: rgba(255, 255, 255, 0.28);
  border: 1px solid rgba(255, 255, 255, 0.48);
  border-radius: 999px;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.70);
}

.budget-tabs .tab {
  min-height: 34px;
  padding: 0 18px;
  border-radius: 999px;
}

.budget-tabs .tab.active {
  background: rgba(255, 255, 255, 0.84);
  color: var(--budget-text-primary);
  box-shadow: 0 8px 20px rgba(31, 41, 55, 0.14), inset 0 1px 1px rgba(255,255,255,.92);
}

.budget-actions {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.budget-summary-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 16px;
}

.budget-summary-card {
  overflow: hidden;
  min-height: 86px;
  padding: 14px 16px;
  border-radius: 28px;
  box-shadow:
    0 16px 36px rgba(31, 41, 55, 0.14),
    0 0 0 1px rgba(255, 255, 255, 0.16),
    inset 0 1px 1px rgba(255, 255, 255, 0.76),
    inset 0 -1px 1px rgba(255, 255, 255, 0.22);
}

.budget-summary-label,
.budget-metric span {
  display: block;
  color: var(--budget-text-muted);
  font-size: 10px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.budget-summary-value {
  position: relative;
  display: block;
  margin-top: 7px;
  color: var(--budget-text-primary);
  font-size: 25px;
  line-height: 1;
  font-weight: 850;
  letter-spacing: -0.05em;
}

.budget-summary-card[data-tone="good"] .budget-summary-value { color: var(--budget-green); text-shadow: 0 0 20px rgba(34,197,94,.24); }
.budget-summary-card[data-tone="warn"] .budget-summary-value { color: var(--budget-amber); text-shadow: 0 0 20px rgba(247,181,0,.24); }
.budget-summary-card[data-tone="bad"] .budget-summary-value { color: var(--budget-red); text-shadow: 0 0 20px rgba(239,68,68,.22); }

.budget-summary-hint {
  position: relative;
  display: block;
  margin-top: 8px;
  color: var(--budget-text-muted);
  font-size: 11.5px;
  font-weight: 650;
}

.budget-panel {
  display: grid;
  gap: 16px;
}

.budget-panel[hidden],
.budget-modal-host[hidden],
.budget-modal[hidden] {
  display: none;
}

.budget-empty {
  display: grid;
  min-height: 230px;
  place-items: center;
  padding: 30px;
  text-align: center;
}

.budget-empty-inner {
  position: relative;
  z-index: 1;
  max-width: 440px;
}

.budget-empty-icon {
  display: inline-grid;
  place-items: center;
  width: 54px;
  height: 54px;
  margin-bottom: 12px;
  border-radius: 20px;
  background: linear-gradient(135deg, rgba(139,92,246,.24), rgba(56,217,209,.22));
  color: var(--budget-violet);
  font-size: 28px;
  box-shadow: 0 12px 30px rgba(31,41,55,.13), inset 0 1px 1px rgba(255,255,255,.82);
}

.budget-empty h2 {
  margin: 0 0 6px;
  font-size: 18px;
  letter-spacing: -0.02em;
}

.budget-empty p {
  margin: 0;
  color: var(--budget-text-muted);
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.45;
}

.budget-project-card,
.budget-operation-card,
.budget-plan-card {
  overflow: hidden;
  padding: 16px;
  border-radius: 30px;
}

.budget-card-head {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-bottom: 12px;
}

.budget-card-title {
  margin: 0;
  color: var(--budget-text-primary);
  font-size: 18px;
  line-height: 1.15;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.budget-card-meta {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.budget-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 24px;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255,255,255,.46);
  background: rgba(255,255,255,.30);
  color: var(--budget-text-secondary);
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: none;
}

.budget-pill--good {
  color: #0b7d5b;
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.28);
}

.budget-pill--warn {
  color: #9c681d;
  background: rgba(229,163,0,.12);
  border-color: rgba(229,163,0,.30);
}

.budget-pill--bad {
  color: #b3271f;
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.30);
}

.budget-metrics {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 9px;
  margin-bottom: 11px;
}

.budget-metric {
  min-width: 0;
  padding: 10px 12px;
  border-radius: 18px;
  background: rgba(255,255,255,.28);
  border: 1px solid rgba(255,255,255,.46);
  box-shadow: inset 0 1px 1px rgba(255,255,255,.66);
}

.budget-metric b {
  display: block;
  margin-top: 5px;
  color: var(--budget-text-primary);
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.03em;
}

.budget-metric[data-tone="good"] b { color: var(--budget-green); }
.budget-metric[data-tone="warn"] b { color: var(--budget-amber); }
.budget-metric[data-tone="bad"] b { color: var(--budget-red); }

.budget-progress {
  position: relative;
  z-index: 1;
  height: 7px;
  margin: 2px 0 12px;
  border-radius: 999px;
  overflow: hidden;
  background: rgba(255,255,255,.34);
  border: 1px solid rgba(255,255,255,.42);
}

.budget-progress-fill {
  height: 100%;
  width: min(var(--pct), 100%);
  border-radius: inherit;
  background: linear-gradient(90deg, var(--budget-cyan), var(--budget-blue), var(--budget-violet));
  box-shadow: 0 0 20px rgba(56,217,209,.28);
}

.budget-table,
.budget-list,
.budget-plan-items {
  position: relative;
  z-index: 1;
  display: grid;
  gap: 7px;
}

.budget-table-row {
  display: grid;
  grid-template-columns: minmax(160px, 1.5fr) repeat(4, minmax(92px, .7fr));
  gap: 9px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.24);
  border: 1px solid rgba(255,255,255,.34);
}

.budget-table-row--head {
  padding-top: 0;
  background: transparent;
  border-color: transparent;
  color: var(--budget-text-muted);
  font-size: 10px;
  font-weight: 850;
  text-transform: uppercase;
  letter-spacing: .045em;
}

.budget-table-row strong {
  font-size: 12.5px;
}

.budget-table-row span {
  min-width: 0;
  color: var(--budget-text-secondary);
  font-size: 12px;
  font-weight: 750;
}

.budget-list {
  gap: 16px;
}

.budget-operation-card {
  display: grid;
  gap: 11px;
}

.budget-operation-main {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(220px, 1.3fr) repeat(3, minmax(120px, .7fr));
  gap: 10px;
  align-items: start;
}

.budget-operation-title {
  font-size: 15px;
  font-weight: 850;
  letter-spacing: -0.02em;
}

.budget-operation-sub {
  margin-top: 4px;
  color: var(--budget-text-muted);
  font-size: 11.5px;
  font-weight: 650;
}

.budget-doc-grid,
.budget-upload-row,
.budget-task-links {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}

.budget-doc-chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  min-height: 28px;
  padding: 5px 10px;
  border-radius: 999px;
  background: rgba(255,255,255,.28);
  border: 1px solid rgba(255,255,255,.42);
  color: var(--budget-text-secondary);
  font-size: 10.5px;
  font-weight: 800;
  text-decoration: none;
}

.budget-doc-chip a {
  color: inherit;
  text-decoration: none;
}

.budget-doc-chip--missing {
  color: #b3271f;
  background: rgba(239,68,68,.12);
  border-color: rgba(239,68,68,.28);
}

.budget-doc-chip--ok {
  color: #0b7d5b;
  background: rgba(34,197,94,.12);
  border-color: rgba(34,197,94,.26);
}

.budget-upload-row {
  align-items: center;
  padding-top: 9px;
  border-top: 1px solid rgba(129,143,172,.24);
}

.budget-mini-select,
.budget-input,
.budget-textarea,
.budget-multiselect {
  width: 100%;
  border: 1px solid rgba(255,255,255,.44);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.48), rgba(255,255,255,.24));
  color: var(--budget-text-primary);
  font: inherit;
  font-size: 12.5px;
  font-weight: 700;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.72), 0 8px 18px rgba(31,41,55,.08);
  outline: none;
}

.budget-input,
.budget-mini-select {
  min-height: 40px;
  padding: 0 12px;
}

.budget-textarea {
  min-height: 78px;
  padding: 11px 12px;
  resize: vertical;
}

.budget-multiselect {
  min-height: 116px;
  padding: 8px;
}

.budget-upload-row .budget-mini-select {
  width: 160px;
}

.budget-file-picker,
.budget-danger-btn,
.budget-ghost-btn {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 34px;
  padding: 0 13px;
  border: 1px solid rgba(255,255,255,.42);
  border-radius: 999px;
  background: rgba(255,255,255,.34);
  color: var(--budget-text-secondary);
  font-size: 11.5px;
  font-weight: 800;
  cursor: pointer;
  box-shadow: inset 0 1px 1px rgba(255,255,255,.60);
  overflow: hidden;
}

.budget-file-picker input {
  position: absolute;
  inset: 0;
  opacity: 0;
  cursor: pointer;
}

.budget-danger-btn:hover {
  color: var(--budget-red);
  border-color: rgba(239,68,68,.32);
  background: rgba(239,68,68,.12);
}

.budget-task-link {
  text-decoration: none;
}

.budget-plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(520px, 100%), 1fr));
  gap: 16px;
}

.budget-plan-card {
  display: grid;
  gap: 11px;
}

.budget-plan-edit {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 160px auto;
  gap: 9px;
  align-items: end;
}

.budget-plan-item {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 120px auto;
  gap: 9px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 16px;
  background: rgba(255,255,255,.24);
  border: 1px solid rgba(255,255,255,.34);
}

.budget-plan-item b {
  font-size: 12.5px;
}

.budget-plan-item span {
  color: var(--budget-text-muted);
  font-size: 11.5px;
  font-weight: 750;
}

.budget-add-item {
  position: relative;
  z-index: 1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 150px auto;
  gap: 9px;
  align-items: end;
  padding-top: 11px;
  border-top: 1px solid rgba(129,143,172,.24);
}

.budget-modal-host {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: grid;
  place-items: center;
  padding: 22px;
  background: rgba(37,44,66,.24);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.budget-modal {
  width: min(680px, calc(100vw - 32px));
  max-height: calc(100vh - 44px);
  overflow: auto;
  padding: 18px;
}

.budget-modal-head,
.budget-modal-grid,
.budget-modal-actions {
  position: relative;
  z-index: 1;
}

.budget-modal-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}

.budget-modal-title {
  margin: 0;
  font-size: 19px;
  letter-spacing: -0.02em;
}

.budget-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.budget-modal-grid .field--wide {
  grid-column: 1 / -1;
}

.budget-modal-actions {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  gap: 9px;
  margin-top: 14px;
}

.budget-status {
  color: var(--budget-text-muted);
  font-size: 12px;
  font-weight: 700;
}

.budget-status.is-error { color: var(--budget-red); }
.budget-status.is-success { color: var(--budget-green); }

@media (max-width: 1180px) {
  .budget-summary-grid,
  .budget-metrics {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 760px) {
  .budget-shell {
    gap: 13px;
    padding-top: 12px !important;
  }
  .budget-toolbar,
  .budget-card-head {
    flex-direction: column;
    align-items: stretch;
  }
  .budget-actions {
    justify-content: stretch;
  }
  .budget-actions > * {
    flex: 1 1 150px;
  }
  .budget-tabs {
    width: 100%;
    justify-content: space-between;
  }
  .budget-tabs .tab {
    flex: 1 1 0;
    padding-inline: 10px;
  }
  .budget-summary-grid,
  .budget-metrics,
  .budget-operation-main,
  .budget-plan-edit,
  .budget-add-item,
  .budget-plan-item,
  .budget-modal-grid,
  .budget-table-row {
    grid-template-columns: 1fr;
  }
  .budget-table-row--head {
    display: none;
  }
  .budget-summary-card {
    min-height: 82px;
  }
  .budget-modal-host {
    place-items: start center;
    padding: 12px;
  }
  .budget-modal {
    width: 100%;
  }
}
