:root {
  --master-bg: #090d16;
  --master-card: #121826;
  --master-border: #1e293b;
  --gold: #f59e0b;
  --gold-glow: rgba(245, 158, 11, 0.2);
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --green: #10b981;
  --blue: #3b82f6;
  --red: #ef4444;
}

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

.hidden {
  display: none !important;
}

body {
  background-color: var(--master-bg);
  color: var(--text-main);
  font-family: 'Montserrat', sans-serif;
  line-height: 1.5;
  overflow-x: hidden;
}

.gold { color: var(--gold); }

@keyframes goldPulse {
  0% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
  50% { transform: scale(1.18); filter: drop-shadow(0 0 16px #f59e0b) drop-shadow(0 0 25px #10b981); color: #fff; }
  100% { transform: scale(1); filter: drop-shadow(0 0 0 transparent); }
}

.kpi-glow-pulse {
  animation: goldPulse 0.9s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  display: inline-block;
}

/* ШАПКА КАБИНЕТА */
.master-header {
  background: var(--master-card);
  border-bottom: 1px solid var(--master-border);
  padding: 16px 24px;
  width: 100%;
  box-sizing: border-box;
}

.header-main-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 14px;
}

.master-logo {
  font-size: 1.25rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: 10px;
}

.badge-role {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid #3b82f6;
  padding: 3px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
}

.header-nav-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.nav-btn {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.82rem;
  border: 1px solid var(--master-border);
  padding: 7px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  white-space: nowrap;
}

.nav-btn:hover {
  border-color: var(--gold);
  color: var(--gold);
}

.master-switcher-box {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255,255,255,0.05);
  flex-wrap: wrap;
  width: 100%;
}

.master-switcher-box label {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  white-space: nowrap;
}

.master-select {
  background: #090d16;
  border: 1px solid var(--gold);
  color: #fff;
  padding: 8px 14px;
  border-radius: 6px;
  font-size: 0.9rem;
  font-weight: 600;
  outline: none;
  font-family: inherit;
  flex: 1;
  min-width: 260px;
  max-width: 100%;
}

.master-main {
  padding: 24px 0;
}

.master-container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 0 20px;
  box-sizing: border-box;
}

/* KPI КАРТОЧКИ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.kpi-card {
  background: var(--master-card);
  border: 1px solid var(--master-border);
  border-radius: 12px;
  padding: 20px;
  display: flex;
  align-items: center;
  gap: 16px;
}

.kpi-icon {
  font-size: 2.2rem;
  background: rgba(255, 255, 255, 0.04);
  padding: 12px;
  border-radius: 10px;
}

.kpi-value {
  font-size: 1.6rem;
  font-weight: 800;
}

.kpi-label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.kpi-sub {
  font-size: 0.75rem;
  color: #64748b;
  margin-top: 2px;
}

/* ВКЛАДКИ */
.tab-nav {
  display: flex;
  gap: 10px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}

.tab-btn {
  background: #0d121f;
  border: 1px solid var(--master-border);
  color: var(--text-muted);
  padding: 10px 18px;
  border-radius: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
}

.tab-btn.active, .tab-btn:hover {
  background: var(--master-card);
  border-color: var(--gold);
  color: #fff;
}

.tab-pane {
  display: block;
}

/* СЕКЦИИ И КАРТОЧКИ */
.section-card {
  background: var(--master-card);
  border: 1px solid var(--master-border);
  border-radius: 14px;
  padding: 24px;
  margin-bottom: 24px;
  box-sizing: border-box;
}

.card-header-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.section-desc {
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-top: 4px;
}

/* КНОПКИ ПЕРИОДОВ ГРАФИКА */
.period-button-group {
  display: inline-flex;
  background: #090d16;
  border: 1px solid var(--master-border);
  border-radius: 8px;
  padding: 3px;
  gap: 4px;
}

.btn-period {
  background: transparent;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-period.active {
  background: var(--gold) !important;
  color: #000 !important;
  box-shadow: 0 2px 8px rgba(245, 158, 11, 0.3);
}

.btn-period:hover:not(.active) {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}

.chart-summary-badge {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid #10b981;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}

/* КОНТЕЙНЕР ГРАФИКА */
.chart-container {
  background: #090d16;
  border: 1px solid var(--master-border);
  border-radius: 12px;
  padding: 30px 16px 36px 16px;
  position: relative;
  overflow-x: auto;
  margin-top: 14px;
  box-sizing: border-box;
}

.chart-grid-bg {
  position: absolute;
  top: 30px;
  left: 16px;
  right: 16px;
  bottom: 36px;
  pointer-events: none;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.grid-line {
  width: 100%;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.06);
}

.chart-bars-wrap {
  display: flex;
  align-items: flex-end;
  justify-content: space-around;
  gap: 12px;
  height: 220px;
  min-height: 220px;
  position: relative;
  z-index: 2;
  min-width: 100%;
  box-sizing: border-box;
}

.chart-bar-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex: 1;
  min-width: 36px;
  max-width: 64px;
  height: 100%;
  justify-content: flex-end;
  position: relative;
  cursor: pointer;
}

.bar-val {
  font-size: 0.75rem;
  font-weight: 800;
  color: var(--gold);
  margin-bottom: 8px;
  white-space: nowrap;
  transition: all 0.2s ease;
}

.bar-track {
  width: 100%;
  height: 100%;
  max-height: 160px;
  display: flex;
  align-items: flex-end;
  background: rgba(255, 255, 255, 0.02);
  border-radius: 8px 8px 3px 3px;
}

.bar-fill {
  width: 100%;
  background: linear-gradient(180deg, #f59e0b 0%, rgba(245, 158, 11, 0.35) 100%);
  border-radius: 8px 8px 3px 3px;
  min-height: 4px;
  transition: height 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), background 0.2s ease;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.15);
}

.chart-bar-item:hover .bar-fill {
  background: linear-gradient(180deg, #fde047 0%, #f59e0b 100%);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.4);
}

.chart-bar-item:hover .bar-val {
  transform: scale(1.15);
  color: #fff;
}

.chart-bar-item.is-today .bar-fill {
  background: linear-gradient(180deg, #34d399 0%, #10b981 100%);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.35);
}

.chart-bar-item.is-today .bar-val {
  color: #34d399;
}

.bar-label {
  position: absolute;
  bottom: -28px;
  font-size: 0.72rem;
  color: var(--text-muted);
  white-space: nowrap;
  text-align: center;
  font-weight: 600;
}

.chart-bar-item.is-today .bar-label {
  color: #fff;
  font-weight: 700;
}

/* ФИЛЬТРЫ РАСПИСАНИЯ */
.schedule-filters {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #0d121f;
  border: 1px solid var(--master-border);
  border-radius: 10px;
  padding: 12px 16px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  gap: 12px;
}

.filter-btn-group {
  display: flex;
  gap: 8px;
}

.btn-chip {
  background: #1e293b;
  border: 1px solid var(--master-border);
  color: var(--text-main);
  padding: 6px 12px;
  border-radius: 20px;
  font-size: 0.78rem;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s;
}

.btn-chip.active, .btn-chip:hover {
  background: var(--gold);
  color: #000;
  border-color: var(--gold);
}

.modal-cat-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.filter-date-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-date-group label {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.master-input-date {
  background: #090d16;
  border: 1px solid var(--master-border);
  color: #fff;
  padding: 7px 12px;
  border-radius: 6px;
  font-size: 0.85rem;
  outline: none;
}

/* ТАБЛИЦА РАСПИСАНИЯ */
.table-responsive {
  overflow-x: auto;
  width: 100%;
}

.master-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.88rem;
}

.master-table th {
  background: #0d121f;
  color: var(--text-muted);
  font-weight: 600;
  padding: 12px 14px;
  border-bottom: 1px solid var(--master-border);
  white-space: nowrap;
}

.master-table td {
  padding: 13px 14px;
  border-bottom: 1px solid #1a2336;
  vertical-align: middle;
}

.master-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.table-empty {
  text-align: center;
  padding: 32px;
  color: var(--text-muted);
}

/* ПОРТФОЛИО */
.portfolio-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 20px;
}

.portfolio-card {
  background: #0d121f;
  border: 1px solid var(--master-border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.portfolio-images {
  display: flex;
  height: 180px;
  position: relative;
}

.work-img-col {
  flex: 1;
  position: relative;
  overflow: hidden;
}

.work-img-col img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.img-tag {
  position: absolute;
  bottom: 8px;
  left: 8px;
  background: rgba(0,0,0,0.8);
  color: #fff;
  font-size: 0.7rem;
  font-weight: 800;
  padding: 2px 6px;
  border-radius: 4px;
}

.tag-after {
  color: var(--gold);
  border: 1px solid var(--gold);
}

.portfolio-info {
  padding: 16px;
  display: flex;
  flex-direction: column;
  flex: 1;
  justify-content: space-between;
}

.portfolio-title { font-weight: 700; color: #fff; margin-bottom: 4px; }
.portfolio-cat { font-size: 0.78rem; color: var(--gold); margin-bottom: 8px; }
.portfolio-desc { font-size: 0.8rem; color: var(--text-muted); line-height: 1.4; margin-bottom: 12px; }

.portfolio-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 10px;
  border-top: 1px solid var(--master-border);
}

.btn-del-work {
  background: rgba(239, 68, 68, 0.15);
  border: 1px solid #ef4444;
  color: #fca5a5;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
}

/* ФОРМЫ */
.profile-form {
  max-width: 680px;
}

.form-input, .form-select, .form-textarea {
  width: 100%;
  background: #090d16;
  border: 1px solid var(--master-border);
  color: #fff;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 0.88rem;
  outline: none;
  font-family: inherit;
}

.form-input:focus, .form-select:focus, .form-textarea:focus {
  border-color: var(--gold);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 14px;
}

.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.82rem; font-weight: 600; color: var(--text-muted); margin-bottom: 6px; }

.avatar-preview-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 20px;
}

.avatar-preview-box span { font-size: 0.82rem; color: var(--text-muted); }
.avatar-preview { width: 64px; height: 64px; border-radius: 50%; object-fit: cover; border: 2px solid var(--gold); }

.preview-mini {
  margin-top: 8px;
}
.preview-mini img {
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid var(--gold);
}

/* КНОПКИ */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-gold { background: var(--gold); color: #000; }
.btn-gold:hover { opacity: 0.9; }

.btn-outline { background: transparent; border: 1px solid var(--master-border); color: var(--text-main); }
.btn-outline:hover { border-color: var(--gold); color: var(--gold); }

.btn-block { width: 100%; }
.btn-sm { padding: 7px 14px; font-size: 0.8rem; }

/* МОДАЛКА */
.modal {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

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

.modal-card {
  position: relative;
  z-index: 2;
  background: var(--master-card);
  border: 1px solid var(--gold);
  border-radius: 14px;
  padding: 28px;
  max-width: 520px;
  width: 100%;
  box-sizing: border-box;
}

.modal-card h3 { margin-bottom: 18px; color: #fff; }
.modal-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 20px; }

/* АДАПТАЦИЯ ДЛЯ СМАРТФОНОВ (ПОЛНАЯ ОПТИМИЗАЦИЯ БЕЗ ГОРИЗОНТАЛЬНОГО СКРОЛЛА) */
@media (max-width: 768px) {
  .master-container {
    padding: 0 12px;
    margin: 16px auto;
  }

  .master-header {
    padding: 12px 14px;
  }

  .header-main-row {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .header-nav-actions {
    width: 100%;
    justify-content: space-between;
  }

  .master-switcher-box {
    flex-direction: column;
    align-items: flex-start;
  }

  .master-select {
    width: 100%;
    min-width: 100%;
  }

  .kpi-grid {
    grid-template-columns: 1fr;
    gap: 10px;
    margin-bottom: 18px;
  }

  .kpi-card {
    padding: 14px 16px;
  }

  .section-card {
    padding: 16px 14px;
    border-radius: 12px;
    margin-bottom: 18px;
  }

  .card-header-flex {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
  }

  .tab-nav {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 6px;
    flex-wrap: nowrap;
  }

  .tab-btn {
    white-space: nowrap;
    flex-shrink: 0;
    padding: 8px 14px;
    font-size: 0.82rem;
  }

  /* ТАБЛИЦЫ РАСПИСАНИЯ И УСЛУГ ПРЕВРАЩАЮТСЯ В НАГЛЯДНЫЕ КАРТОЧКИ */
  .table-responsive {
    overflow-x: visible !important;
  }

  .master-table {
    display: block;
    width: 100%;
  }

  .master-table thead {
    display: none !important;
  }

  .master-table tbody {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
  }

  .master-table tr {
    display: flex;
    flex-direction: column;
    background: #090e18;
    border: 1px solid var(--master-border);
    border-radius: 12px;
    padding: 14px 16px;
    gap: 8px;
    box-sizing: border-box;
  }

  .master-table td {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 6px 0;
    border-bottom: 1px dashed rgba(255, 255, 255, 0.08);
    box-sizing: border-box;
  }

  .master-table td:first-child {
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(245, 158, 11, 0.3);
  }

  .master-table td:last-child {
    border-bottom: none;
    padding-top: 8px;
  }

  .master-table td::before {
    content: attr(data-label);
    font-size: 0.76rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
  }

  .master-table td:first-child::before {
    display: none;
  }

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

  .schedule-filters {
    flex-direction: column;
    align-items: stretch;
    gap: 10px;
  }

  .filter-btn-group {
    display: flex;
    overflow-x: auto;
    scrollbar-width: none;
    padding-bottom: 4px;
  }

  .filter-date-group {
    width: 100%;
    justify-content: space-between;
  }

  .master-input-date {
    flex: 1;
  }

  .portfolio-grid {
    grid-template-columns: 1fr;
    gap: 14px;
  }

  .chart-container {
    padding: 20px 10px 30px 10px;
  }

  .chart-bars-wrap {
    gap: 4px;
  }

  .chart-bar-item {
    min-width: 22px;
  }

  .bar-val {
    font-size: 0.68rem;
  }

  .bar-label {
    font-size: 0.65rem;
    bottom: -24px;
  }
}
