:root{
  --bg:#0a0a0a;
  --card:#1a1a1a;
  --card-elevated:#2a2a2a;
  --muted:#6b7280;
  --text:#f8fafc;
  --primary:#6366f1;
  --primary-600:#4f46e5;
  --secondary:#8b5cf6;
  --ring:#6366f1;
  --gradient-primary:linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
  --gradient-card:linear-gradient(135deg, #1a1a1a 0%, #2a2a2a 100%);
  --shadow-soft:0 4px 20px rgba(0,0,0,0.3);
  --shadow-elevated:0 8px 32px rgba(0,0,0,0.4);
  --border-radius:16px;
  --border-radius-sm:12px;
}

*{box-sizing:border-box}
html,body{height:100%}
body{
  margin:0;
  font-family:'Inter',system-ui,-apple-system,Segoe UI,Roboto,Ubuntu,Cantarell,Noto Sans,sans-serif;
  background:var(--bg);
  color:var(--text);
  line-height:1.6;
  overflow-x:hidden;
  font-weight:400;
  letter-spacing:-0.01em;
}

.app-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:24px 32px;
  background:var(--gradient-card);
  border-bottom:1px solid rgba(255,255,255,0.05);
  backdrop-filter:blur(20px);
  position:sticky;
  top:0;
  z-index:100;
}
.app-title{
  margin:0;
  font-size:28px;
  font-weight:700;
  background:var(--gradient-primary);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.icon-button{
  display:inline-flex;align-items:center;justify-content:center;
  width:48px;height:48px;border-radius:var(--border-radius-sm);
  border:1px solid rgba(255,255,255,0.1);
  background:var(--card-elevated);
  color:var(--text);
  cursor:pointer;
  transition:all 0.2s ease;
  box-shadow:var(--shadow-soft);
}
.icon-button:hover{
  border-color:var(--primary);
  background:var(--card);
  transform:translateY(-2px);
  box-shadow:var(--shadow-elevated);
}
.icon-button:focus{outline:2px solid var(--ring);outline-offset:2px}

.app-main{
  display:grid;
  place-items:center;
  padding:16px 12px;
  min-height:calc(100vh - 80px);
  max-height:calc(100vh - 80px);
  overflow:hidden;
}
.button-grid{
  display:grid;
  gap:20px;
  width:66vw; /* Занимает 2/3 ширины экрана */
  max-width:800px; /* Но не более 800px на больших экранах */
  margin: 0 auto; /* Центрирует сетку кнопок */
  grid-template-columns:1fr;
}

.button-icon {
  width: 20px;
  height: 20px;
  margin-right: 8px;
  vertical-align: middle;
}

/* Версия приложения */
.version-info {
  position: fixed;
  bottom: 12px;
  right: 12px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.4);
  font-weight: 400;
  z-index: 1000;
  pointer-events: none;
  user-select: none;
}

/* График коэффициента выработки */
.efficiency-chart-container {
  margin-top: 24px;
  padding: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  width: 100%;
  box-sizing: border-box; /* учитывать padding в ширине */
}

.chart-title {
  margin: 0 0 16px 0;
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  text-align: center;
}

.chart-title div:first-child {
  margin-bottom: 4px;
}

#chartMonthsTitle {
  font-size: 16px;
  font-weight: 500;
}

#chartMonthsTitle .prev-month {
  color: #60a5fa; /* Синий цвет кривой предыдущего месяца */
  margin-right: 8px;
}

#chartMonthsTitle .current-month {
  color: #22c55e; /* Зеленый цвет кривой текущего месяца */
}

.chart-wrapper {
  position: relative;
  height: 200px;
  display: flex;
  flex-direction: row;
  gap: 8px;
  width: 100%;
  padding: 0 8px 0 0; /* Отступ справа для подписей оси Y */
  min-width: 0; /* Позволяет сжиматься */
  overflow: hidden; /* Скрывает выходящие элементы */
  max-width: 100%;
}

.chart-y-axis {
  position: relative;
  height: 160px;
  min-width: 40px;
  flex-shrink: 0;
  padding: 8px 0; /* Отступы сверху и снизу для первого и последнего значений */
}

.chart-y-label {
  position: absolute;
  right: 4px;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.7);
  font-weight: 500;
  text-align: right;
  line-height: 1;
  white-space: nowrap;
  padding: 2px 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.5);
  min-width: 24px;
}

.chart-area {
  flex: 1;
  position: relative;
  height: 160px;
  margin: 8px 0; /* Отступы сверху и снизу для выравнивания с осью Y */
  background: transparent; /* Используем SVG-градиент вместо CSS */
  border-radius: 4px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden; /* Скрывает выходящие элементы */
  min-width: 0; /* Позволяет сжиматься */
  max-width: 100%; /* Не превышает контейнер */
  will-change: background; /* Оптимизация для мобильных */
  -webkit-transform: translateZ(0); /* Принудительное аппаратное ускорение */
  transform: translateZ(0);
}

.chart-grid {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
}

.chart-grid-line {
  position: absolute;
  background: rgba(255, 255, 255, 0.2);
  z-index: 1;
}

.chart-grid-line.horizontal {
  width: 100%;
  height: 1px;
}

.chart-grid-line.vertical {
  height: 100%;
  width: 1px;
}

.chart-line {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  pointer-events: none;
  z-index: 2;
}

.chart-point {
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #22c55e; /* Зеленый цвет для текущего месяца */
  border: 2px solid rgba(255, 255, 255, 0.9);
  cursor: pointer;
  transition: all 0.3s ease;
  transform: translate(-50%, -50%);
  z-index: 10;
}

.chart-point:hover {
  transform: translate(-50%, -50%) scale(1.5);
  box-shadow: 0 0 12px rgba(34, 197, 94, 0.8);
}

.chart-point.no-data {
  background: rgba(255, 255, 255, 0.3);
  border: 1px dashed rgba(255, 255, 255, 0.5);
}

.chart-point.future {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Точки предыдущего месяца */
.chart-point.prev {
  background: #60a5fa; /* Синий цвет для предыдущего месяца */
  border-color: rgba(255,255,255,0.9);
}

.chart-point-value {
  position: absolute;
  top: -25px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  font-weight: 600;
  color: var(--text);
  background: rgba(0, 0, 0, 0.8);
  padding: 2px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.3s ease;
  white-space: nowrap;
}

.chart-point:hover .chart-point-value {
  opacity: 1;
}

.chart-labels {
  position: absolute; /* Привязка к области графика */
  left: 0;
  right: 0;
  bottom: -24px; /* располагем подписи непосредственно под областью графика */
  height: 20px;
}

.chart-label {
  position: absolute;
  top: 0;
  text-align: center;
  font-size: 10px;
  color: rgba(255, 255, 255, 0.6);
  font-weight: 500;
  padding: 2px 4px;
  border-radius: 2px;
  background: rgba(0, 0, 0, 0.3);
  white-space: nowrap;
  min-width: 20px;
  transform: translateX(-50%); /* Центрирование относительно точки */
}

/* Адаптивность графика */
@media (max-width: 768px) {
  .chart-wrapper {
    height: 180px;
    gap: 6px;
    padding: 0 6px 0 0;
  }
  
  .chart-y-axis {
    height: 140px;
    min-width: 35px;
  }
  
  .chart-area {
    height: 140px;
  }
  
  .chart-y-label {
    font-size: 9px;
    padding: 1px 3px;
    min-width: 20px;
  }
  
  .chart-label {
    font-size: 9px;
    padding: 1px 3px;
    min-width: 18px;
  }
}

@media (max-width: 480px) {
  .chart-wrapper {
    height: 160px;
    gap: 4px;
    padding: 0 4px 0 0;
  }
  
  .chart-y-axis {
    height: 120px;
    min-width: 30px;
  }
  
  .chart-area {
    height: 120px;
  }
  
  .chart-y-label {
    font-size: 8px;
    padding: 1px 2px;
    min-width: 18px;
  }
  
  .chart-label {
    font-size: 8px;
    padding: 1px 2px;
    min-width: 16px;
  }
  
  .chart-title {
    font-size: 16px;
  }
  
  #chartMonthsTitle {
    font-size: 14px;
  }
}

@media (max-width: 360px) {
  .chart-wrapper {
    height: 140px;
    gap: 3px;
    padding: 0 3px 0 0;
  }
  
  .chart-y-axis {
    height: 100px;
    min-width: 25px;
  }
  
  .chart-area {
    height: 100px;
  }
  
  .chart-y-label {
    font-size: 7px;
    padding: 1px;
    min-width: 16px;
  }
  
  .chart-label {
    font-size: 7px;
    padding: 1px;
    min-width: 14px;
  }
  
  .chart-title {
    font-size: 14px;
  }
  
  #chartMonthsTitle {
    font-size: 12px;
  }
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .efficiency-chart-container {
    margin-top: 16px;
    padding: 16px;
  }
  
  .chart-wrapper {
    height: 180px;
    flex-direction: row;
    gap: 8px;
    padding: 0 6px 0 0;
  }
  
  .chart-y-axis {
    height: 160px;
    flex-direction: column;
    justify-content: space-between;
    min-width: 35px;
    padding: 8px 0;
  }
  
  .chart-area {
    height: 160px;
    flex: 1;
  }
  
  .chart-title {
    font-size: 16px;
  }
  
  .chart-y-label {
    font-size: 9px;
    text-align: right;
  }
  
  .chart-label {
    font-size: 9px;
  }
  
  .chart-labels {
    left: 0;
    right: 0;
    bottom: -22px;
  }
}

@media (max-width: 480px) {
  .efficiency-chart-container {
    padding: 12px;
  }
  
  .chart-wrapper {
    height: 160px;
    flex-direction: row;
    gap: 6px;
  }
  
  .chart-y-axis {
    min-width: 35px;
    padding: 4px 0;
  }
  
  .chart-area {
    height: 160px;
    flex: 1;
  }
  
  .chart-title {
    font-size: 14px;
  }
  
  .chart-y-label {
    font-size: 8px;
  }
  
  .chart-label {
    font-size: 8px;
  }
}

button.primary,button.secondary{
  appearance:none;
  border:0;
  border-radius:var(--border-radius);
  padding:20px 24px;
  font-weight:600;
  cursor:pointer;
  transition:all 0.3s ease;
  font-size:16px;
  position:relative;
  overflow:hidden;
}
button.primary, button.secondary{
  background:linear-gradient(145deg, #4f46e5, #3730a3);
  color:white;
  box-shadow:
    8px 8px 16px rgba(0, 0, 0, 0.3),
    -8px -8px 16px rgba(255, 255, 255, 0.1),
    inset 2px 2px 4px rgba(255, 255, 255, 0.2),
    inset -2px -2px 4px rgba(0, 0, 0, 0.2);
  border:1px solid rgba(79, 70, 229, 0.3);
  border-radius:16px;
}
button.primary:hover, button.secondary:hover{
  transform:translateY(-2px);
  box-shadow:
    12px 12px 24px rgba(0, 0, 0, 0.4),
    -12px -12px 24px rgba(255, 255, 255, 0.15),
    inset 1px 1px 2px rgba(255, 255, 255, 0.3),
    inset -1px -1px 2px rgba(0, 0, 0, 0.3);
  background:linear-gradient(145deg, #3730a3, #312e81);
}
button.primary:active, button.secondary:active{
  transform:translateY(1px);
  box-shadow:
    4px 4px 8px rgba(0, 0, 0, 0.4),
    -4px -4px 8px rgba(255, 255, 255, 0.1),
    inset 3px 3px 6px rgba(0, 0, 0, 0.3),
    inset -3px -3px 6px rgba(255, 255, 255, 0.1);
}

/* dialog */
.settings-dialog{
  border:0;
  border-radius:var(--border-radius);
  padding:0;
  background:var(--gradient-card);
  color:var(--text);
  box-shadow:var(--shadow-elevated);
  border:1px solid rgba(255,255,255,0.1);
}
.settings-dialog::backdrop{
  background:rgba(0,0,0,0.7);
  backdrop-filter:blur(8px);
}
.settings-content{
  display:flex;
  flex-direction:column;
  gap:0;
  min-width:320px;
  max-width:min(94vw,800px);
  max-height:min(90vh,800px);
  overflow:auto;
}
.settings-header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:24px 24px 0 24px;
  border-bottom:1px solid rgba(255,255,255,0.05);
}
.settings-header h2{
  margin:0;
  font-size:24px;
  font-weight:700;
  background:var(--gradient-primary);
  -webkit-background-clip:text;
  -webkit-text-fill-color:transparent;
  background-clip:text;
}
.tabs{
  display:flex;
  gap:12px;
  padding:20px 24px 0 24px;
}
.tab{
  cursor:pointer;
  border:1px solid rgba(255,255,255,0.1);
  background:var(--card);
  color:var(--muted);
  padding:12px 20px;
  border-radius:var(--border-radius-sm);
  transition:all 0.2s ease;
  font-weight:500;
}
.tab.active{
  border-color:var(--primary);
  color:var(--text);
  background:var(--card-elevated);
  box-shadow:var(--shadow-soft);
}
.tab:hover:not(.active){
  border-color:rgba(255,255,255,0.2);
  color:var(--text);
}
.settings-body{
  padding:24px;
  color:var(--muted);
  display:flex;
  flex-direction:column;
  gap:20px;
}
.field{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.field input,.field select{
  background:var(--card-elevated);
  border:1px solid rgba(255,255,255,0.1);
  color:var(--text);
  border-radius:var(--border-radius-sm);
  padding:16px;
  font-size:16px;
  transition:all 0.2s ease;
  box-shadow:var(--shadow-soft);
}
.field input:focus,.field select:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(99,102,241,0.1);
  outline:none;
}
.row{
  display:flex;
  gap:12px;
  flex-wrap:wrap;
}
.list{
  list-style:none;
  margin:8px 0 0 0;
  padding:0;
  display:flex;
  flex-direction:column;
  gap:12px;
}
.list li{
  display:flex;
  align-items:center;
  justify-content:space-between;
  background:var(--gradient-card);
  border:1px solid rgba(255,255,255,0.1);
  border-radius:var(--border-radius);
  padding:16px;
  gap:12px;
  transition:all 0.2s ease;
  box-shadow:var(--shadow-soft);
}
.list li:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-elevated);
  border-color:var(--primary);
}
.list .actions{
  display:flex;
  gap:8px;
}
.parts{
  display:flex;
  flex-direction:column;
  gap:16px;
}
.part{
  border:1px solid rgba(255,255,255,0.1);
  background:var(--gradient-card);
  border-radius:var(--border-radius);
  box-shadow:var(--shadow-soft);
}
.part header{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 20px;
  gap:12px;
  border-bottom:1px solid rgba(255,255,255,0.05);
}
.part-simple{
  display:flex;
  align-items:center;
  justify-content:space-between;
  padding:16px 20px;
  border:1px solid rgba(255,255,255,0.1);
  background:var(--gradient-card);
  border-radius:var(--border-radius);
  margin-bottom:12px;
  transition:all 0.2s ease;
  box-shadow:var(--shadow-soft);
}
.part-simple:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-elevated);
  border-color:var(--primary);
}
.part-simple .name{
  flex:1;
  font-weight:600;
  font-size:16px;
}
.part-simple .actions{
  display:flex;
  gap:8px;
}
.icon-only{
  width:44px;
  height:44px;
  border-radius:var(--border-radius-sm);
  border:1px solid rgba(255,255,255,0.1);
  background:var(--card-elevated);
  color:var(--text);
  display:inline-flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  transition:all 0.2s ease;
  box-shadow:var(--shadow-soft);
}
.icon-only:hover{
  transform:translateY(-2px);
  box-shadow:var(--shadow-elevated);
  border-color:var(--primary);
  background:var(--card);
}
.icon-only svg{
  width:20px;
  height:20px;
}
.part .ops{
  padding:20px;
  display:flex;
  flex-direction:column;
  gap:16px;
  max-width:100%;
  overflow:auto;
}
.op-row{
  display:grid;
  grid-template-columns:1.5fr 1fr 1fr 1fr auto;
  gap:12px;
  align-items:end;
  max-width:100%;
  padding:16px;
  background:var(--card-elevated);
  border-radius:var(--border-radius-sm);
  border:1px solid rgba(255,255,255,0.05);
}
.op-row *{
  min-width:0;
}
.op-row input{
  background:var(--card);
  border:1px solid rgba(255,255,255,0.1);
  color:var(--text);
  border-radius:var(--border-radius-sm);
  padding:12px;
  width:100%;
  transition:all 0.2s ease;
}
.op-row input:focus{
  border-color:var(--primary);
  box-shadow:0 0 0 3px rgba(99,102,241,0.1);
  outline:none;
}
.field-inline{
  display:flex;
  flex-direction:column;
  gap:8px;
}
.field-inline label{
  font-size:14px;
  color:var(--muted);
  font-weight:500;
  margin-bottom:4px;
}
.badge{display:inline-flex;align-items:center;gap:6px;border-radius:999px;padding:4px 10px;font-size:12px}
.badge.day{background:#1e3a8a;color:#bfdbfe}
.badge.night{background:#581c87;color:#e9d5ff}
.badge.off{background:#334155;color:#cbd5e1}
.hidden{display:none}

/* Стили для карточек станков */
.machine-card {
  background: var(--card);
  border-radius: var(--border-radius);
  margin: 16px 0;
  overflow: hidden;
  box-shadow: var(--shadow-soft);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

.machine-header {
  background: linear-gradient(135deg, #ff8c00, #e67e00);
  color: white;
  padding: 16px 20px;
  font-size: 18px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  text-align: center;
  border-bottom: 2px solid rgba(255, 140, 0, 0.3);
}

.operations-container {
  padding: 20px;
  background: var(--background);
}

.operation-card {
  background: var(--card-elevated);
  border-radius: 8px;
  margin-bottom: 16px;
  padding: 16px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  position: relative;
}

.operation-card:last-child {
  margin-bottom: 0;
}

.operation-header {
  color: #ff8c00;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding-right: 80px; /* Оставляем место для кнопок */
  line-height: 1.4;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.part-name {
  font-size: 16px;
  font-weight: 700;
  color: #ff8c00;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  line-height: 1.2;
}

.part-number {
  font-size: 14px;
  font-weight: 600;
  color: #ff8c00;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  line-height: 1.2;
  white-space: nowrap; /* Предотвращаем перенос */
}

.operation-data {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.data-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 4px 0;
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
}

.data-row:last-child {
  border-bottom: none;
}

.data-label {
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
}

.data-value {
  color: var(--text-primary);
  font-size: 14px;
  font-weight: 600;
  text-align: right;
}

.action-buttons {
  position: absolute;
  top: 16px;
  right: 16px;
  display: flex;
  gap: 8px;
  z-index: 10;
}

.edit-btn, .delete-btn {
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  padding: 6px 10px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 32px;
  height: 28px;
}

.edit-btn:hover {
  background: #e67e00;
  transform: translateY(-1px);
}

.delete-btn {
  background: #dc2626;
}

.delete-btn:hover {
  background: #b91c1c;
  transform: translateY(-1px);
}

/* Стили для таблиц результатов (старые, оставляем для совместимости) */
.results-table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
  background: var(--card);
  border: 1px solid rgba(148, 163, 184, 0.2);
  font-size: 0.7rem;
  table-layout: fixed;
}

.results-table th {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  color: white;
  padding: 6px 4px;
  text-align: center;
  font-weight: 600;
  font-size: 0.65rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.results-table td {
  padding: 6px 4px;
  border: 1px solid rgba(148, 163, 184, 0.1);
  font-size: 0.65rem;
  text-align: center;
  background: rgba(15, 23, 42, 0.5);
}

.results-table tr:last-child td {
  font-weight: 600;
  background: rgba(59, 130, 246, 0.3);
  color: #ffffff !important;
}

.results-table tr:hover {
  background: rgba(148, 163, 184, 0.1);
}

/* Фиксированные ширины колонок для мобильных */
.results-table th:nth-child(1),
.results-table td:nth-child(1) { width: 15%; } /* Деталь */
.results-table th:nth-child(2),
.results-table td:nth-child(2) { width: 15%; } /* Операция */
.results-table th:nth-child(3),
.results-table td:nth-child(3) { width: 12%; } /* Машинное время */
.results-table th:nth-child(4),
.results-table td:nth-child(4) { width: 12%; } /* Доп. время */
.results-table th:nth-child(5),
.results-table td:nth-child(5) { width: 10%; } /* Количество */
.results-table th:nth-child(6),
.results-table td:nth-child(6) { width: 15%; } /* Общее время */
.results-table th:nth-child(7),
.results-table td:nth-child(7) { width: 12%; } /* Коэффициент */

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .machine-header {
    font-size: 16px;
    padding: 12px 16px;
  }
  
  .operations-container {
    padding: 16px;
  }
  
  .operation-card {
    padding: 12px;
    margin-bottom: 12px;
  }
  
  .operation-header {
    font-size: 14px;
    margin-bottom: 8px;
    padding-right: 70px; /* Меньше места для мобильных */
    gap: 3px;
  }
  
  .part-name {
    font-size: 14px;
    line-height: 1.1;
  }
  
  .part-number {
    font-size: 12px;
    line-height: 1.1;
  }
  
  .data-row {
    padding: 3px 0;
  }
  
  .data-label {
    font-size: 13px;
  }
  
  .data-value {
    font-size: 13px;
  }
  
  .action-buttons {
    top: 12px;
    right: 12px;
    gap: 6px;
    z-index: 10;
  }
  
  .edit-btn, .delete-btn {
    padding: 4px 8px;
    font-size: 11px;
    min-width: 28px;
    height: 24px;
  }
  
  .results-table {
    font-size: 0.6rem;
    width: 100%;
    table-layout: fixed;
  }
  
  .results-table th,
  .results-table td {
    padding: 4px 2px;
    font-size: 0.6rem;
    word-wrap: break-word;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  
  /* Уменьшенные ширины для мобильных */
  .results-table th:nth-child(1),
  .results-table td:nth-child(1) { width: 12%; } /* Деталь */
  .results-table th:nth-child(2),
  .results-table td:nth-child(2) { width: 12%; } /* Операция */
  .results-table th:nth-child(3),
  .results-table td:nth-child(3) { width: 10%; } /* Машинное время */
  .results-table th:nth-child(4),
  .results-table td:nth-child(4) { width: 10%; } /* Доп. время */
  .results-table th:nth-child(5),
  .results-table td:nth-child(5) { width: 8%; } /* Количество */
  .results-table th:nth-child(6),
  .results-table td:nth-child(6) { width: 12%; } /* Общее время */
  .results-table th:nth-child(7),
  .results-table td:nth-child(7) { width: 10%; } /* Коэффициент */
  
  .summary-table {
    font-size: 0.7rem;
  }
  
  .summary-table th,
  .summary-table td {
    padding: 6px 8px;
    font-size: 0.7rem;
  }
  
  .coefficient,
  .total-time {
    font-size: 0.8rem;
    font-weight: 800;
    text-shadow: 0 0 4px currentColor, 0 1px 2px rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.4) !important;
    border: 1px solid currentColor;
    padding: 6px 8px !important;
  }
}

.machine-group {
  margin: 24px 0;
  background: var(--gradient-card);
  border-radius: var(--border-radius);
  padding: 20px;
  box-shadow: var(--shadow-soft);
}

.machine-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--text);
  margin: 0 0 16px 0;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--primary);
}

.summary-table {
  background: linear-gradient(135deg, #0f172a, #1e293b);
  color: #ffffff;
  margin-top: 24px;
  border: 2px solid rgba(59, 130, 246, 0.5);
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.summary-table th {
  background: linear-gradient(135deg, #1e40af, #3b82f6);
  font-weight: 700;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 0.8rem;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
  border: 1px solid rgba(255, 255, 255, 0.1);
  text-align: center;
}

.summary-table td {
  font-weight: 700;
  text-align: center;
  color: #ffffff;
  padding: 8px 12px;
  font-size: 0.9rem;
  background: rgba(0, 0, 0, 0.3);
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.7);
  border: 1px solid rgba(148, 163, 184, 0.2);
}

/* Фиксированные ширины для итоговой таблицы */
.summary-table th:nth-child(1),
.summary-table td:nth-child(1) { width: 50%; } /* Общее время */
.summary-table th:nth-child(2),
.summary-table td:nth-child(2) { width: 50%; } /* Коэффициент */

.coefficient {
  color: #fbbf24 !important;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 0 4px rgba(251, 191, 36, 0.8), 0 1px 2px rgba(0, 0, 0, 0.8);
  background: rgba(251, 191, 36, 0.2) !important;
  border: 2px solid #fbbf24;
  padding: 4px 8px !important;
}

.total-time {
  color: #34d399 !important;
  font-weight: 700;
  font-size: 1rem;
  text-shadow: 0 0 4px rgba(52, 211, 153, 0.8), 0 1px 2px rgba(0, 0, 0, 0.8);
  background: rgba(52, 211, 153, 0.2) !important;
  border: 2px solid #34d399;
  padding: 4px 8px !important;
}

/* Адаптивность для мобильных устройств */
@media (max-width: 768px) {
  .summary-table {
    font-size: 0.8rem;
    border: 3px solid rgba(59, 130, 246, 0.5);
  }
  
  .summary-table th,
  .summary-table td {
    padding: 10px 12px;
    font-size: 0.9rem;
  }
  
  .coefficient,
  .total-time {
    font-size: 1.1rem;
    font-weight: 800;
    text-shadow: 0 0 8px currentColor, 0 2px 4px rgba(0, 0, 0, 0.9);
    background: rgba(0, 0, 0, 0.4) !important;
    border: 2px solid currentColor;
    border-radius: 8px;
    padding: 10px 14px !important;
  }
}

/* calendar */
.card{width:100%;max-width:960px;margin-top:16px;border:1px solid #1f2937;background:#0f172a;border-radius:12px}
.section-header{display:flex;align-items:center;justify-content:space-between;padding:12px 16px;flex-wrap:nowrap;gap:8px;background:linear-gradient(135deg, #1e293b, #334155);border:2px solid #ff8c00;border-radius:8px;margin-bottom:16px;width:100%;box-sizing:border-box}
.calendar-nav{display:flex;align-items:center;gap:8px}
.calendar-nav button{background:#ff8c00;color:white;border:none;padding:8px 12px;border-radius:4px;cursor:pointer;font-weight:600;transition:all 0.3s ease;width:32px;height:32px;display:flex;align-items:center;justify-content:center;flex-shrink:0}
.calendar-nav button:hover{background:#e67e00;transform:translateY(-1px)}
#monthLabel{text-align:center;flex:1 1 auto;min-width:0;color:white;font-weight:700;font-size:clamp(1rem,3vw,1.2rem);text-transform:uppercase;letter-spacing:1px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.calendar{display:grid;grid-template-columns:repeat(7,1fr);gap:2px;padding:8px;background:#0f172a;border-radius:8px;width:100%;box-sizing:border-box}
.calendar .cell{border:0;border-radius:4px;padding:0;aspect-ratio:1;min-height:40px;overflow:hidden;display:flex;align-items:center;justify-content:center;background:#1e293b;box-sizing:border-box;position:relative;color:white;font-weight:600;font-size:clamp(0.8rem,2.5vw,1rem);cursor:pointer;transition:all 0.3s ease;width:100%;height:auto}
.calendar .cell:hover{background:#334155;transform:translateY(-1px)}
.calendar .cell.today{border:2px solid #ff8c00;box-shadow:0 0 8px rgba(255,140,0,0.3)}
/* Индикаторы статуса данных */
.status-indicator{position:absolute;top:4px;right:4px;width:16px;height:16px;border-radius:50%;display:flex;align-items:center;justify-content:center;font-size:10px;font-weight:bold;color:white;z-index:10;box-shadow:0 1px 3px rgba(0,0,0,0.3)}
.status-indicator.has-data{background:#22c55e}
.status-indicator.no-data{background:#ef4444}
.calendar .cell .date{font-weight:700;line-height:1}
.shift-mark{font-size:.5em;font-weight:800;margin-left:4px;vertical-align:baseline;opacity:.9}
.shift-mark.day{color:#7c2d12} /* тёмно-оранжевый акцент на жёлтом фоне */
.shift-mark.night{color:#93c5fd} /* светлый акцент на синем фоне */

/* Color fill instead of text badges */
.cell.day{background:#FDE68A;color:#0b1220} /* дневная: мягкий солнечный жёлтый */
.cell.night{background:#1e3a8a;color:#e5e7eb} /* ночная: глубокий синий */
.cell.off{background:#166534;color:#e5e7eb;box-shadow:inset 0 0 0 3px #34d399} /* выходной: усилен светло-зелёной окантовкой */
.cell.off .date{font-weight:800}
.cell.off::after{content:"";position:absolute;inset:0;background:repeating-linear-gradient(-45deg, rgba(255,255,255,.08) 0 6px, transparent 6px 12px);pointer-events:none;border-radius:12px}

/* Текущий день */
.cell.today{box-shadow:inset 0 0 0 3px #f59e0b, 0 0 0 2px rgba(0,0,0,0)}
.cell.today .date{font-weight:900;text-decoration:underline}

/* Праздничный индикатор: закрашенный нижний левый угол */
.holiday-corner{position:absolute;left:0;bottom:0;width:35%;height:35%;background:#ef4444;clip-path:polygon(0 100%,0 0,100% 100%)}
.cell.day{box-shadow:inset 0 0 0 2px rgba(30,58,138,.45)}
.cell.night{box-shadow:inset 0 0 0 2px rgba(88,28,135,.45)}
.cell.off{box-shadow:inset 0 0 0 2px rgba(51,65,85,.55)}
.settings-footer{display:flex;gap:8px;justify-content:flex-end;padding:0 16px 16px}

@media (min-width:560px){
  .settings-content{min-width:420px}
}

/* Small phones */
@media (max-width:480px){
  .app-header{padding:8px}
  .app-main{
    padding:8px;
    min-height:calc(100vh - 64px);
    max-height:calc(100vh - 64px);
  }
  .button-grid{
    gap:8px;
    width:95vw; /* Почти на всю ширину на очень маленьких экранах */
    max-width:350px;
  }
  button.primary,button.secondary{
    padding:12px 16px;
    font-size:14px;
  }
  .section-header{padding:10px 12px}
  .calendar{gap:4px;padding:8px}
  .calendar .cell{padding:8px;min-height:56px}
  .tabs{padding:6px 10px 0 10px;gap:6px}
  .tab{padding:6px 10px;border-radius:6px}
  .op-row{grid-template-columns:1fr}
  .op-row button{width:100%}
}

@media (min-width:640px){
  .app-main{
    padding:20px 16px;
  }
  .button-grid{
    grid-template-columns:repeat(2,1fr);
    width:70vw; /* Немного больше на планшетах */
    max-width:600px;
    gap:16px;
  }
  button.primary,button.secondary{
    padding:16px 20px;
  }
}
@media (min-width:960px){
  .app-main{
    padding:24px 20px;
  }
  .button-grid{
    grid-template-columns:repeat(3,1fr);
    width:75vw; /* Еще больше на десктопах */
    max-width:800px;
    gap:20px;
  }
  button.primary,button.secondary{
    padding:20px 24px;
  }
  .calendar .cell{aspect-ratio:1/1}
}
@media (min-width:1280px){
  .calendar{gap:8px}
  .calendar .cell{padding:12px}
}

/* Make header cells smaller than date cells */
.calendar .cell.header{aspect-ratio:auto;min-height:auto;padding:6px;border:0;background:#0f172a;box-shadow:none}

/* Очень маленькие экраны по высоте */
@media (max-height:600px){
  .app-main{
    padding:8px;
    min-height:calc(100vh - 60px);
    max-height:calc(100vh - 60px);
  }
  .button-grid{
    gap:8px;
  }
  button.primary,button.secondary{
    padding:12px 16px;
    font-size:14px;
  }
}

/* Стили для панели экспорта/импорта */
.export-section, .import-section {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: linear-gradient(135deg, rgba(15, 23, 42, 0.8), rgba(30, 41, 59, 0.6));
  border: 1px solid rgba(148, 163, 184, 0.2);
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.export-section h3, .import-section h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
}

.export-section p, .import-section p {
  margin: 0 0 1rem 0;
  color: var(--text-secondary);
  font-size: 0.9rem;
  line-height: 1.5;
}

.file-input-wrapper {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.import-status {
  margin-top: 1rem;
  padding: 0.75rem;
  border-radius: 8px;
  font-size: 0.9rem;
  display: none;
}

.import-status.success {
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.3);
  color: #22c55e;
  display: block;
}

.import-status.error {
  background: rgba(239, 68, 68, 0.1);
  border: 1px solid rgba(239, 68, 68, 0.3);
  color: #ef4444;
  display: block;
}

.import-status.info {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.3);
  color: #3b82f6;
  display: block;
}


