/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #f2f1ed;
  --surface: #ffffff;
  --border: #d9d6ce;
  --text: #1a2e1a;
  --text-secondary: #4a5e4a;
  --text-muted: #8a9485;
  --green-600: #008e51;
  --green-50: #e8f5ee;
  --green-100: #d8efd8;
  --green-700: #03663f;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-600: #dc2626;
  --accent: #39bc48;
  --shadow-sm: 0 1px 3px rgba(3,102,63,0.06);
  --shadow-md: 0 4px 16px rgba(3,102,63,0.1);
  --radius: 12px;
  --radius-sm: 8px;
  font-family: 'Geologica', -apple-system, BlinkMacSystemFont, sans-serif;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
}

.dark {
  --bg: #0a1f14;
  --surface: #122a1c;
  --border: #1e3d2a;
  --text: #e2ece6;
  --text-secondary: #8fb09a;
  --text-muted: #5a7d68;
  --green-50: rgba(0,142,81,0.12);
  --green-100: rgba(57,188,72,0.15);
  --red-50: rgba(220,38,38,0.12);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.5);
}

body { min-height: 100vh; background: var(--bg); }
#app { max-width: 1480px; margin: 0 auto; padding: 12px 16px 24px; }

/* ===== HEADER ===== */
.header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0 12px;
  gap: 12px;
  flex-wrap: wrap;
}
.header-left { display: flex; align-items: center; gap: 10px; }
.header-logo { height: 32px; width: auto; flex-shrink: 0; }
.header-logo-dark { display: none; }
.dark .header-logo-light { display: none; }
.dark .header-logo-dark { display: block; }
.header-divider {
  width: 1px;
  height: 20px;
  background: var(--border);
  flex-shrink: 0;
}
.header-title {
  font-size: 15px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--text-secondary);
  white-space: nowrap;
}
.header-actions { display: flex; align-items: center; gap: 6px; }

/* ===== BUTTONS ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 6px 12px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.15s;
}
.btn:hover { background: var(--bg); }
.btn-primary {
  background: linear-gradient(135deg, #008e51, #39bc48);
  color: #fff;
  border-color: #008e51;
}
.btn-primary:hover { background: linear-gradient(135deg, #03663f, #008e51); }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--border); }
.btn-icon { padding: 6px; border: none; background: transparent; cursor: pointer; color: var(--text-secondary); }
.btn-icon:hover { color: var(--text); }
.btn-save {
  background: var(--surface);
  color: var(--green-600);
  border: 1px solid var(--green-600);
}
.btn-save:hover { background: var(--green-50); }
.btn-label { display: inline; }

/* ===== RATE INDICATOR ===== */
.rate-indicator {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 10px;
  background: var(--green-50);
  border: 1px solid var(--green-100);
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 700;
  color: var(--green-600);
  cursor: pointer;
  white-space: nowrap;
}
.rate-indicator:hover {
  background: var(--green-100);
  border-color: var(--green-600);
}
.dark .rate-indicator {
  background: rgba(0,142,81,0.1);
  border-color: rgba(0,142,81,0.25);
}
.dark .rate-indicator:hover {
  background: rgba(0,142,81,0.18);
  border-color: var(--green-600);
}
.date-badge {
  font-size: 11px;
  color: var(--text-muted);
  padding: 4px 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* ===== KPI BAR ===== */
.kpi-bar {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 12px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 10px 14px;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}
.kpi-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 2px;
}
.kpi-value {
  font-size: 20px;
  font-weight: 700;
  letter-spacing: -0.02em;
  line-height: 1.2;
}
.kpi-sub { font-size: 11px; color: var(--text-muted); }
.kpi-highlight {
  border-color: var(--green-600);
  background: var(--green-50);
}
.dark .kpi-highlight {
  background: rgba(0,142,81,0.1);
  border-color: rgba(0,142,81,0.3);
}

/* ===== MAIN 3-COLUMN GRID ===== */
.main-grid {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-bottom: 12px;
}

/* ===== SECTIONS ===== */
.section {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
}
.section-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: 13px;
  font-weight: 600;
  color: #fff;
}
.section-header-green { background: linear-gradient(135deg, #008e51, #39bc48); }
.section-header-blue { background: linear-gradient(135deg, #008e51, #2da86b); }
.section-header-orange { background: linear-gradient(135deg, #03663f, #008e51); }
.section-body { padding: 10px 12px 14px; flex: 1; }

/* ===== FIELDS ===== */
.field-row { display: flex; gap: 8px; margin-bottom: 8px; }
.field-row-compact { margin-bottom: 4px; }
.field { flex: 1; display: flex; flex-direction: column; gap: 3px; }
.field-sm { flex: 1 1 0; min-width: 0; }
.field label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.field input, .field select {
  width: 100%;
  padding: 6px 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 13px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  transition: border-color 0.15s, box-shadow 0.15s;
  min-width: 0;
}
.field input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 2px rgba(0,142,81,0.15);
}
.field input[type="number"] { -moz-appearance: textfield; }
.field input[type="number"]::-webkit-inner-spin-button,
.field input[type="number"]::-webkit-outer-spin-button { -webkit-appearance: none; }
.input-invalid {
  border-color: var(--red-600) !important;
  box-shadow: 0 0 0 2px rgba(220,38,38,0.12) !important;
  background: #fef2f2 !important;
}
.dark .input-invalid { background: rgba(220,38,38,0.08) !important; }
.synced-input {
  background: var(--green-50) !important;
  border-style: dashed !important;
  color: var(--text-secondary);
  cursor: default;
}
.dark .synced-input { background: rgba(0,142,81,0.08) !important; }
.synced-label {
  font-size: 9px;
  color: var(--green-600);
  font-weight: 500;
  text-transform: none;
}
.readonly-field {
  background: var(--bg) !important;
  color: var(--text-secondary);
  cursor: default;
}

/* ===== INLINE RESULTS ===== */
.inline-result {
  display: flex;
  justify-content: space-between;
  padding: 6px 10px;
  border-radius: var(--radius-sm);
  font-size: 12px;
  font-weight: 500;
  margin-bottom: 8px;
}
.green-bg { background: var(--green-50); color: var(--green-700); }
.blue-bg { background: var(--blue-50); color: var(--blue-700); }

/* ===== PAYMENT TOGGLE ===== */
.payment-block { border-top: 1px solid var(--border); padding-top: 8px; }
.toggle-row {
  display: flex;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 2px;
  margin-bottom: 8px;
  gap: 2px;
}
.toggle-btn {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  font-weight: 500;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  background: transparent;
  color: var(--text-secondary);
  transition: all 0.15s;
  font-family: inherit;
}
.toggle-btn.active {
  background: linear-gradient(135deg, #008e51, #39bc48);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

/* ===== EXPENSE GROUPS ===== */
.expense-group {
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}
.expense-group:last-child { border-bottom: none; }
.expense-group-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--green-700);
  margin-bottom: 6px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.rate-highlight {
  background: var(--green-50) !important;
  color: var(--green-600) !important;
  font-weight: 700 !important;
  text-align: center;
}
.dark .rate-highlight { background: rgba(0,142,81,0.1) !important; }

/* ===== INTEREST FOOTERS ===== */
.interest-footer {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 14px;
  font-size: 11px;
  color: var(--text-secondary);
  border-top: 1px solid var(--border);
  background: var(--bg);
  border-radius: 0 0 var(--radius) var(--radius);
}
.interest-footer .if-label { font-weight: 500; }
.interest-footer .if-value {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  margin-left: auto;
  font-size: 12px;
}
.section-purchase .interest-footer .if-icon { background: var(--green-50); color: var(--green-600); }
.section-purchase .interest-footer .if-value { color: var(--green-600); }
.section-sale .interest-footer .if-icon { background: var(--blue-50); color: var(--blue-600); }
.section-sale .interest-footer .if-value { color: var(--blue-600); }
.section-expenses .interest-footer .if-icon { background: var(--orange-50); color: var(--orange-600); }
.section-expenses .interest-footer .if-value { color: var(--orange-600); }

/* ===== FINANCIAL SECTION ===== */
.fin-section { margin-bottom: 12px; }
.fin-section-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 8px;
  padding-left: 2px;
}
.fin-hero {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 10px;
}
.fin-hero-main { display: flex; flex-direction: column; gap: 2px; flex-shrink: 0; }
.fin-hero-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.fin-hero-value {
  font-size: 28px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--text);
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
}
.fin-hero-kpis { display: flex; gap: 20px; align-items: flex-start; }
.fin-hero-kpi {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 64px;
  text-align: center;
  align-items: center;
}
.fin-hero-kpi-val {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  color: var(--text);
}
.fin-hero-kpi-lbl {
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.meter-bar { height: 3px; background: var(--bg); border-radius: 2px; overflow: hidden; margin-top: 3px; }
.meter-fill { height: 100%; border-radius: 2px; transition: width 0.4s ease; }
.meter-fill-blue { background: #008e51; }
.meter-fill-green { background: #39bc48; }
.meter-fill-teal { background: #03663f; }
.risk-level {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 8px;
  background: var(--red-50);
  color: var(--red-600);
  margin-top: 2px;
  display: inline-block;
}
.fin-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.fin-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.fin-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 14px 8px;
}
.fin-card-icon {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.fin-card-icon-green { background: var(--green-50); color: var(--green-600); }
.fin-card-icon-red { background: var(--red-50); color: var(--red-600); }
.fin-card-icon-blue { background: var(--blue-50); color: var(--blue-600); }
.fin-card-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
}
.fin-card-rows { padding: 0 14px 10px; }
.fin-card-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  font-size: 12px;
  border-bottom: 1px solid color-mix(in srgb, var(--border) 50%, transparent);
}
.fin-card-row:last-child { border-bottom: none; }
.fin-card-row > span:first-child { color: var(--text); font-weight: 500; }
.fin-card-row > span:last-child {
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.fin-card-row-dim > span:first-child { font-weight: 400; color: var(--text-secondary); }
.fin-card-row-dim > span:last-child { font-weight: 600; color: var(--text-secondary); }
.fin-card-row-accent {
  background: var(--green-50);
  margin: 4px -14px 0;
  padding: 6px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  border-bottom: none;
}
.fin-card-row-accent > span:last-child { color: var(--green-700); }
.fin-card-row-accent em {
  font-style: normal;
  font-size: 10px;
  font-weight: 500;
  color: var(--green-600);
  margin-left: 4px;
}
.fin-card-row-total-red {
  background: var(--red-50);
  margin: 4px -14px 0;
  padding: 6px 14px;
  border-radius: 0 0 var(--radius) var(--radius);
  border-bottom: none;
}
.fin-card-row-total-red > span:first-child { font-weight: 600; }
.fin-card-row-total-red > span:last-child { color: var(--red-600); }
@media (max-width: 768px) {
  .fin-hero { flex-direction: column; align-items: flex-start; }
  .fin-cards { grid-template-columns: 1fr; }
}

/* ===== TOGGLE SWITCH ===== */
.switch {
  position: relative;
  display: inline-block;
  width: 44px;
  height: 24px;
}
.switch input { opacity: 0; width: 0; height: 0; }
.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: #ccc;
  transition: 0.3s;
  border-radius: 24px;
}
.slider:before {
  position: absolute;
  content: "";
  height: 18px;
  width: 18px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  transition: 0.3s;
  border-radius: 50%;
}
input:checked + .slider { background-color: var(--green-600); }
input:checked + .slider:before { transform: translateX(20px); }

/* ===== FILTER PANEL (для страницы сделок) ===== */
.filter-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 24px;
}
.filter-row {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 16px;
}
.filter-row:last-child { margin-bottom: 0; }
.filter-group {
  flex: 1;
  min-width: 160px;
}
.filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-bottom: 4px;
}
.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
  font-family: inherit;
  background: var(--surface);
  color: var(--text);
}
.filter-group select:focus,
.filter-group input:focus {
  outline: none;
  border-color: var(--green-600);
  box-shadow: 0 0 0 2px rgba(0,142,81,0.15);
}
.range-inputs {
  display: flex;
  gap: 8px;
  align-items: center;
}
.range-inputs input { width: calc(50% - 4px); }
.range-inputs span { color: var(--text-muted); font-size: 12px; }
.filter-actions { display: flex; gap: 8px; align-items: center; }
/* ===== FILTER BADGES WITH ICONS ===== */
.filter-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: var(--green-50);
    padding: 4px 10px;
    border-radius: 16px;
    font-size: 11px;
    color: var(--green-700);
}

.filter-badge svg {
    width: 12px;
    height: 12px;
    flex-shrink: 0;
}

.filter-badge .remove {
    cursor: pointer;
    font-weight: bold;
    margin-left: 4px;
    font-size: 12px;
}

.filter-badge .remove:hover {
    color: var(--red-600);
}

.filter-badge[data-type="search"] svg { color: #1565c0; }
.filter-badge[data-type="profit"] svg { color: #2e7d32; }
.filter-badge[data-type="roi"] svg { color: #e65100; }
.filter-badge[data-type="date"] svg { color: #6a1b9a; }
.filter-badge[data-type="partner"] svg { color: #c62828; }

.no-filters {
    font-size: 12px;
    color: var(--text-muted);
}
.active-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}
.sortable-header {
  cursor: pointer;
  user-select: none;
  transition: background 0.2s;
}
.sortable-header:hover { background: var(--green-100); }
.sort-icon {
  display: inline-block;
  margin-left: 6px;
  font-size: 12px;
  opacity: 0.6;
}
.sort-icon.active {
  opacity: 1;
  color: var(--green-600);
  font-weight: bold;
}

/* ===== USER PROFILE ===== */
.user-profile {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 4px 8px 4px 4px;
  background: var(--green-50);
  border-radius: 40px;
  border: 1px solid var(--green-100);
}
.user-avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--green-600), var(--accent));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 600;
  font-size: 14px;
}
.user-info { display: flex; flex-direction: column; }
.user-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.3;
}
.user-role { font-size: 10px; color: var(--text-muted); }
.logout-btn {
  display: flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 6px 10px;
  border-radius: 30px;
  font-size: 12px;
  transition: all 0.15s;
}
.logout-btn:hover { background: var(--red-50); color: var(--red-600); }
.logout-btn svg { width: 16px; height: 16px; }
.dark .user-profile { background: rgba(0,142,81,0.12); }
@media (max-width: 768px) {
  .user-profile { padding: 4px; }
  .user-info { display: none; }
  .logout-btn .btn-label { display: none; }
}

/* ===== USER MANAGEMENT TABLE ===== */
.users-table { width: 100%; border-collapse: collapse; }
.users-table th {
  text-align: left;
  padding: 16px;
  font-weight: 600;
  color: var(--green-700);
  background: var(--green-50);
  border-bottom: 1px solid var(--border);
}
.users-table td {
  padding: 14px 16px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
.users-table tr:hover { background: var(--green-50); }
.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
  gap: 6px;
}
.badge-active { background: #e8f5e9; color: #2e7d32; }
.badge-inactive { background: #ffebee; color: #c62828; }
.badge-role-admin { background: #e3f2fd; color: #1565c0; }
.badge-role-director { background: #fff3e0; color: #e65100; }
.badge-role-manager { background: #e8f5e9; color: #2e7d32; }
.badge-super-admin { background: #f3e5f5; color: #6a1b9a; }
.action-buttons { display: flex; gap: 8px; }
.action-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 8px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
}
.action-btn svg { width: 14px; height: 14px; }
.action-btn:hover { background: var(--green-50); border-color: var(--green-600); }
.action-btn-danger { color: var(--red-600); border-color: var(--red-200); }
.action-btn-danger:hover { background: var(--red-50); border-color: var(--red-600); }
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-bottom: 24px;
}
.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 20px;
  text-align: center;
}
.stat-value {
  font-size: 32px;
  font-weight: 800;
  color: var(--green-600);
  line-height: 1.2;
}
.stat-label {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ===== USER MODAL STYLES ===== */
.user-modal {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
}

.user-modal-content {
    background: var(--surface);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    padding: 0;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    animation: modalSlideIn 0.2s ease;
}

.user-modal-content h3 {
    font-size: 20px;
    font-weight: 600;
    color: var(--green-600);
    margin: 0;
    padding: 20px 24px;
    border-bottom: 1px solid var(--border);
}

.user-modal-content .field {
  margin-bottom: 20px;
  padding: 0 24px;
}

.user-modal-content .field:first-child {
  margin-top: 20px;
}

.user-modal-content .field label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.user-modal-content .field input,
.user-modal-content .field select {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 14px;
    font-family: inherit;
    background: var(--surface);
    color: var(--text);
    transition: all 0.2s;
}

.user-modal-content .field input:focus,
.user-modal-content .field select:focus {
    outline: none;
    border-color: var(--green-600);
    box-shadow: 0 0 0 3px rgba(0, 142, 81, 0.1);
}

.user-modal-content .field input:read-only {
    background: var(--bg);
    color: var(--text-muted);
}

/* Чекбокс "Активен" */
.user-modal-content .checkbox-group {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 0 24px;
    margin: 20px 0;
}

.user-modal-content .checkbox-group input {
    width: 18px;
    height: 18px;
    cursor: pointer;
    accent-color: var(--green-600);
}

.user-modal-content .checkbox-group label {
    margin: 0;
    cursor: pointer;
    text-transform: none;
    font-weight: 500;
    font-size: 14px;
    color: var(--text);
}

/* Кнопки в модальном окне */
.user-modal-buttons {
    display: flex;
    gap: 12px;
    justify-content: flex-end;
    padding: 16px 24px 24px;
    border-top: 1px solid var(--border);
    background: var(--surface);
    border-radius: 0 0 20px 20px;
}

.user-modal-buttons button {
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: none;
    font-family: inherit;
}

.user-modal-buttons .btn-save {
    background: linear-gradient(135deg, var(--green-600), var(--accent));
    color: white;
}

.user-modal-buttons .btn-save:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 142, 81, 0.3);
}

.user-modal-buttons .btn-cancel {
    background: var(--bg);
    border: 1px solid var(--border);
    color: var(--text);
}

.user-modal-buttons .btn-cancel:hover {
    background: var(--border);
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .user-modal-content {
        width: 95%;
        margin: 10px;
    }
    
    .user-modal-content h3 {
        font-size: 18px;
        padding: 16px 20px;
    }
    
    .user-modal-content .field {
        padding: 0 20px;
        margin-bottom: 16px;
    }
    
    .user-modal-content .checkbox-group {
        padding: 0 20px;
        margin: 16px 0;
    }
    
    .user-modal-buttons {
        padding: 12px 20px 20px;
        flex-direction: column;
        gap: 8px;
    }
    
    .user-modal-buttons button {
        width: 100%;
        padding: 10px;
    }
}

/* ===== MODAL OVERLAY (общие стили для всех модальных окон) ===== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10000;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.modal-overlay.open {
    opacity: 1;
    visibility: visible;
}

.modal {
    background: var(--surface);
    border-radius: 20px;
    width: 90%;
    max-width: 500px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    transform: scale(0.95);
    transition: transform 0.3s ease;
}

.modal-overlay.open .modal {
    transform: scale(1);
}

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

.modal-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 18px;
    font-weight: 600;
    color: var(--green-600);
}

.modal-title svg {
    width: 20px;
    height: 20px;
}

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

.modal-close:hover {
    background: var(--red-50);
    color: var(--red-600);
}

.modal-body {
    padding: 24px;
}

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

/* Секции внутри модального окна */
.modal-section {
    margin-bottom: 24px;
}

.modal-section:last-child {
    margin-bottom: 0;
}

.modal-section-label {
    display: block;
    font-size: 12px;
    font-weight: 600;
    color: var(--green-600);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 12px;
}

/* Адаптация для мобильных */
@media (max-width: 480px) {
    .modal {
        width: 95%;
        max-height: 95vh;
    }
    
    .modal-header {
        padding: 16px 20px;
    }
    
    .modal-title {
        font-size: 16px;
    }
    
    .modal-body {
        padding: 20px;
    }
    
    .modal-footer {
        padding: 12px 20px 20px;
        flex-direction: column;
        gap: 8px;
    }
    
    .modal-footer button {
        width: 100%;
    }
}

/* Анимация */
@keyframes modalFadeIn {
    from {
        opacity: 0;
        transform: scale(0.95);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

.modal {
    animation: modalFadeIn 0.2s ease;
}

/* ===== MULTI-DEAL STYLES ===== */
.deals-container { display: flex; flex-direction: column; gap: 16px; margin-bottom: 16px; }
.deal-accordion {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}
.deal-accordion-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  background: linear-gradient(135deg, #f8fafc, #f1f5f9);
  cursor: pointer;
  border-bottom: 1px solid transparent;
}
.dark .deal-accordion-header { background: linear-gradient(135deg, #1e2a2a, #1a2a1f); }
.deal-accordion-header:hover { background: var(--green-50); }
.deal-accordion.open .deal-accordion-header { border-bottom-color: var(--border); }
.deal-header-left {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  flex-wrap: wrap;
}
.deal-number {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-600);
  background: var(--green-50);
  padding: 2px 8px;
  border-radius: 12px;
}
.deal-title { font-size: 14px; font-weight: 600; color: var(--text); }
.deal-summary { font-size: 12px; color: var(--text-muted); margin-left: 8px; }
.deal-header-right {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-shrink: 0;
}
.deal-profit {
  font-size: 13px;
  font-weight: 700;
  color: var(--green-600);
  font-variant-numeric: tabular-nums;
}
.deal-profit.negative { color: var(--red-600); }
.deal-actions { display: flex; gap: 4px; }
.deal-action-btn {
  background: none;
  border: none;
  padding: 4px 6px;
  cursor: pointer;
  color: var(--text-muted);
  border-radius: 4px;
  transition: all 0.15s;
}
.deal-action-btn:hover { background: var(--bg); color: var(--text); }
.deal-action-btn.delete:hover { background: var(--red-50); color: var(--red-600); }
.deal-accordion-content {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}
.deal-accordion.open .deal-accordion-content { max-height: 2000px; }
.deal-accordion .main-grid { padding: 16px; margin: 0; }
.add-deal-wrapper { display: flex; justify-content: center; margin: 8px 0 16px; }
.btn-add-deal {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  background: var(--surface);
  border: 2px dashed var(--green-600);
  border-radius: 40px;
  font-size: 14px;
  font-weight: 600;
  color: var(--green-600);
  cursor: pointer;
  transition: all 0.2s;
}
.btn-add-deal:hover { background: var(--green-50); border-style: solid; }
.total-profit-summary {
  background: linear-gradient(135deg, #008e51, #39bc48);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: white;
}
.total-profit-summary span:first-child { font-size: 14px; font-weight: 500; opacity: 0.9; }
.total-profit-summary span:last-child { font-size: 24px; font-weight: 800; font-variant-numeric: tabular-nums; }

/* ===== PRODUCT ROWS ===== */
.products-label-row { margin: 6px 0 4px; }
.products-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-muted);
}
.product-row {
  display: flex;
  gap: 6px;
  align-items: flex-end;
  margin-bottom: 6px;
  padding: 8px 8px 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  position: relative;
}
.product-row .field label { font-size: 9px; }
.product-row .field input { font-size: 12px; }
.btn-add-product {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 12px;
  font-size: 11px;
  font-weight: 500;
  color: var(--green-600);
  background: transparent;
  border: 1px dashed var(--green-600);
  border-radius: var(--radius-sm);
  cursor: pointer;
  margin-bottom: 8px;
  transition: all 0.15s;
}
.btn-add-product:hover { background: var(--green-50); }
.btn-remove-product {
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-bottom: 4px;
}
.btn-remove-product:hover { background: var(--red-50); color: var(--red-600); }

/* ===== ACTION BAR ===== */
.action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  margin-bottom: 16px;
  border-bottom: 1px solid var(--border);
  flex-wrap: wrap;
  gap: 12px;
}
.action-bar-left, .action-bar-right { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.action-divider {
  width: 1px;
  height: 28px;
  background: var(--border);
  margin: 0 4px;
}
@media (max-width: 768px) {
  .action-bar { flex-direction: column; align-items: stretch; }
  .action-bar-left, .action-bar-right { justify-content: center; }
  .action-divider { display: none; }
}

/* ===== DEALS SIDE PANEL ===== */
.deals-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.35);
  backdrop-filter: blur(3px);
  z-index: 1000;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s;
}
.deals-overlay.open {
  opacity: 1;
  pointer-events: auto;
}
.deals-panel {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 360px;
  max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.3s cubic-bezier(0.16,1,0.3,1);
  box-shadow: -8px 0 30px rgba(0,0,0,0.12);
}
.deals-overlay.open .deals-panel { transform: translateX(0); }
.deals-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}
.deals-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 15px;
  font-weight: 700;
  color: var(--text);
}
.deals-panel-body { flex: 1; overflow-y: auto; padding: 8px; }
.deals-panel-footer {
  padding: 12px 16px;
  border-top: 1px solid var(--border);
  flex-shrink: 0;
}
.deal-card {
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 6px;
  cursor: pointer;
  transition: all 0.15s;
  position: relative;
}
.deal-card:hover { background: var(--bg); border-color: var(--green-600); }
.deal-card.active {
  border-color: var(--green-600);
  background: var(--green-50);
}
.deal-card-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 3px;
  padding-right: 24px;
}
.deal-card-meta {
  font-size: 10px;
  color: var(--text-muted);
  display: flex;
  gap: 8px;
}
.deal-card-amount {
  font-size: 12px;
  font-weight: 600;
  color: var(--green-600);
  margin-top: 4px;
}
.deal-card-delete {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 22px;
  height: 22px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: all 0.15s;
}
.deal-card:hover .deal-card-delete { opacity: 1; }
.deal-card-delete:hover { background: var(--red-50); color: var(--red-600); }
.deals-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px 20px;
  gap: 8px;
  color: var(--text-muted);
  font-size: 13px;
}
.deals-empty-hint { font-size: 11px; color: var(--text-muted); opacity: 0.6; }
.draft-preview {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 10px 12px;
  margin-top: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}
.draft-preview strong { color: var(--text); }

/* ===== RISK BLOCK ===== */
.risk-block {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 12px;
  overflow: hidden;
}
.risk-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  background: linear-gradient(135deg, #7f1d1d, #b91c1c);
  color: #fff;
}
.risk-head-left {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}
.risk-badge {
  font-size: 12px;
  font-weight: 400;
  background: rgba(255,255,255,0.14);
  padding: 3px 12px;
  border-radius: 20px;
}
.risk-badge strong { font-weight: 700; font-size: 13px; margin-left: 2px; }
.risk-badge-date { font-size: 11px; font-weight: 400; opacity: 0.8; margin-left: 4px; }
.risk-slider-area {
  padding: 18px 20px 10px;
  display: flex;
  align-items: center;
  gap: 24px;
}
.risk-slider-wrap { flex: 1; min-width: 0; }
.risk-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 10px;
  border-radius: 5px;
  outline: none;
  cursor: pointer;
  background: linear-gradient(to right, #22c55e 0%, #84cc16 15%, #eab308 30%, #f97316 55%, #ef4444 75%, #991b1b 100%);
  box-shadow: inset 0 1px 2px rgba(0,0,0,0.15), 0 0 0 1px rgba(0,0,0,0.06);
}
.risk-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: radial-gradient(circle at 40% 35%, #fff 60%, #e5e7eb);
  border: 3px solid #dc2626;
  box-shadow: 0 2px 8px rgba(0,0,0,0.25), 0 0 0 3px rgba(220,38,38,0.15);
  cursor: grab;
}
.risk-slider-ticks {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 10px;
  color: var(--text-muted);
  padding: 0 4px;
  user-select: none;
}
.risk-output {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
  white-space: nowrap;
}
.risk-output-days {
  font-size: 26px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  line-height: 1;
}
.risk-output-days small { font-size: 12px; font-weight: 500; color: var(--text-muted); }
.risk-output-date {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted);
  font-variant-numeric: tabular-nums;
}
.risk-output-arrow { font-size: 16px; color: var(--text-muted); }
.risk-output-profit {
  font-size: 20px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--green-600);
  transition: color 0.2s;
}
.risk-output-profit.neg { color: var(--red-600); }
.risk-reminder {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 20px;
  border-top: 1px solid var(--border);
  font-size: 12px;
  color: var(--text-secondary);
  background: var(--bg);
}
.risk-reminder svg { color: #f59e0b; flex-shrink: 0; }
.risk-reminder strong { color: var(--text); font-weight: 700; }
.risk-reminder-note { color: var(--text-muted); font-size: 11px; }
.risk-reminder.urgent { background: #fef3c7; color: #92400e; }
.reminder-copy-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-secondary);
  padding: 2px;
  margin-left: auto;
  transition: color 0.2s;
  display: flex;
  align-items: center;
  flex-shrink: 0;
}
@media (max-width: 768px) {
  .risk-slider-area { flex-direction: column; gap: 12px; }
  .risk-output { justify-content: center; }
}

/* ===== TOAST ===== */
.toast {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--text);
  color: var(--surface);
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  font-weight: 500;
  opacity: 0;
  pointer-events: none;
  transition: all 0.3s cubic-bezier(0.16,1,0.3,1);
  z-index: 2000;
  box-shadow: 0 8px 30px rgba(0,0,0,0.2);
}
.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* ===== BRAND STRIPE & FOOTER ===== */
.brand-stripe {
  display: flex;
  gap: 4px;
  height: 4px;
  margin: 16px 0 0;
  border-radius: 2px;
  overflow: hidden;
}
.brand-stripe .stripe { height: 100%; border-radius: 2px; }
.brand-stripe .s1 { flex: 4; background: #008e51; }
.brand-stripe .s2 { flex: 2; background: #39bc48; }
.brand-stripe .s3 { flex: 3; background: #03663f; }
.brand-stripe .s4 { flex: 1.5; background: #d8efd8; }
.app-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-muted);
  padding: 8px 0;
  border-top: 1px solid var(--border);
}

/* ===== СТАТУСЫ СДЕЛОК ===== */
.badge-status-draft {
    background: #e3f2fd;
    color: #1565c0;
}
.badge-status-pending {
    background: #fff3e0;
    color: #e65100;
}
.badge-status-approved {
    background: #e8f5e9;
    color: #2e7d32;
}
.badge-status-rejected {
    background: #ffebee;
    color: #c62828;
}
.action-btn-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}
.action-btn-success:hover {
    background: #c8e6c9;
    border-color: #2e7d32;
}
.action-btn-primary {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}
.action-btn-primary:hover {
    background: #bbdef5;
    border-color: #1976d2;
}

.action-btn-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}
.action-btn-success:hover {
    background: #c8e6c9;
    border-color: #2e7d32;
}
.action-btn-danger {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}
.action-btn-danger:hover {
    background: #ffcdd2;
    border-color: #e53935;
}

/* ===== ANIMATIONS ===== */
.synced-input.flash { animation: syncFlash 0.4s ease; }
@keyframes syncFlash {
  0% { background: rgba(0,142,81,0.2); }
  100% { background: var(--green-50); }
}
.value-changed { animation: valueHighlight 0.5s ease; }
@keyframes valueHighlight {
  0% { transform: scale(1.05); color: var(--green-600); }
  100% { transform: scale(1); }
}
@keyframes modalSlideIn {
  from { opacity: 0; transform: translateY(-20px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1200px) {
  .header-logo{ height: 28px; }
  .main-grid { grid-template-columns: 1fr 1fr; }
  .section-expenses { grid-column: 1 / -1; }
  .section-expenses .section-body {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 16px;
  }
  .header-title { display: none; }
  .user-profile{ gap: 10px; }
}
@media (max-width: 991px) {}
@media (max-width: 768px) {
  #app { padding: 8px; }
  .main-grid { grid-template-columns: 1fr; }
  .kpi-bar { grid-template-columns: repeat(2, 1fr); }
  .btn-label { display: none; }
  .header-title { font-size: 14px; }
  .section-expenses .section-body { grid-template-columns: 1fr; }
  .stats-grid{ grid-template-columns: repeat(1, 1fr); }
}
@media (max-width: 480px) {
  .header { gap: 8px; padding: 6px 0 8px; }
  .header-logo { height: 24px; }
  .header-title { display: none; }
  .header-divider { display: none; }
  .header-actions { gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
  .btn { padding: 5px 8px; font-size: 11px; }
  .btn-icon { padding: 5px; }
  .btn-icon svg { width: 16px; height: 16px; }
  .rate-indicator { padding: 3px 7px; font-size: 11px; }
  .date-badge { font-size: 10px; padding: 3px 6px; }
  .kpi-card { padding: 8px 10px; }
  .kpi-value { font-size: 16px; }
  .kpi-label { font-size: 9px; }
  .fin-hero { padding: 12px 14px; gap: 12px; }
  .fin-hero-value { font-size: 22px; }
  .fin-hero-kpis {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px 24px;
    width: 100%;
  }
  .fin-hero-kpi { min-width: 0; text-align: center; align-items: center; }
  .fin-hero-kpi-val { font-size: 16px; }
  .fin-hero-kpi-lbl { font-size: 8px; }
  .meter-bar { width: 60%; margin: 3px auto 0; }
  .risk-head { flex-direction: column; align-items: flex-start; gap: 6px; padding: 7px 12px; }
  .risk-badge { font-size: 11px; padding: 2px 8px; }
  .risk-badge-date { font-size: 10px; }
  .risk-slider-area { padding: 12px 12px 8px; gap: 12px; }
  .risk-output-days { font-size: 20px; }
  .risk-output-profit { font-size: 16px; }
  .risk-reminder { flex-wrap: wrap; font-size: 11px; padding: 6px 12px; }
  .risk-reminder-note { width: 100%; margin-top: 2px; }
  .app-footer { flex-direction: column; text-align: center; gap: 4px; font-size: 10px; }
}
/* ===== DEALS TABLE STYLES ===== */
.deals-table-container {
    overflow-x: auto;
    margin: 0;
}

.deals-table {
    width: 100%;
    border-collapse: collapse;
    min-width: 1000px;
}

.deals-table th,
.deals-table td {
    padding: 12px 12px;
    text-align: left;
    vertical-align: middle;
    border-bottom: 1px solid var(--border);
}

.deals-table th {
    background: var(--green-50);
    font-weight: 600;
    color: var(--green-700);
    white-space: nowrap;
}

.deals-table tbody tr {
    cursor: pointer;
    transition: background 0.2s;
}

.deals-table tbody tr:hover {
    background: var(--green-50);
}

/* Фиксированная ширина колонок */
.deals-table th:nth-child(1) { min-width: 140px; }
.deals-table th:nth-child(2) { min-width: 160px; }
.deals-table th:nth-child(3) { min-width: 160px; }
.deals-table th:nth-child(4) { min-width: 100px; }
.deals-table th:nth-child(5) { min-width: 120px; }
.deals-table th:nth-child(6) { min-width: 110px; }
.deals-table th:nth-child(7) { min-width: 110px; }
.deals-table th:nth-child(8) { min-width: 80px; }
.deals-table th:nth-child(9) { min-width: 200px; }

/* Сортировка */
.sortable-header {
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
}

.sortable-header:hover {
    background: var(--green-100);
}

.sort-icon {
    display: inline-block;
    margin-left: 6px;
    font-size: 12px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.sort-icon.active {
    color: var(--green-600);
    font-weight: bold;
}

/* Кнопки действий */
.deal-actions-group {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

.action-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 6px 8px;
    border-radius: 6px;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text);
    white-space: nowrap;
}

.action-btn svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

.action-btn:hover {
    background: var(--green-50);
    border-color: var(--green-600);
}

.action-btn-primary {
    background: #e3f2fd;
    border-color: #2196f3;
    color: #1565c0;
}

.action-btn-primary:hover {
    background: #bbdef5;
}

.action-btn-success {
    background: #e8f5e9;
    border-color: #4caf50;
    color: #2e7d32;
}

.action-btn-success:hover {
    background: #c8e6c9;
}

.action-btn-danger {
    background: #ffebee;
    border-color: #ef9a9a;
    color: #c62828;
}

.action-btn-danger:hover {
    background: #ffcdd2;
}

/* Бейджи статусов */
.badge-status-draft { background: #e3f2fd; color: #1565c0; }
.badge-status-pending { background: #fff3e0; color: #e65100; }
.badge-status-approved { background: #e8f5e9; color: #2e7d32; }
.badge-status-rejected { background: #ffebee; color: #c62828; }

.badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 11px;
    font-weight: 600;
}

.profit-positive { color: #2e7d32; font-weight: 600; }
.profit-negative { color: #c62828; font-weight: 600; }

/* Адаптация */
@media (max-width: 768px) {
  .deals-table th,
  .deals-table td {
    padding: 8px 8px;
    font-size: 12px;
  }
  
  .action-btn {
    padding: 4px 6px;
    font-size: 11px;
  }
  
  .action-btn svg {
    width: 12px;
    height: 12px;
  }
}