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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f5f5;
  color: #333;
  font-size: 18px;
  line-height: 1.5;
}

.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 20px;
}

/* ========== NEW DASHBOARD LAYOUT ========== */
.dashboard-layout {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-width: 900px;
}

/* Dashboard Header - compact single line */
.dashboard-header {
  background: #e8e8e8;
  border-radius: 12px;
  padding: 15px 25px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 25px;
}

.header-left {
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}

.header-left .brand {
  font-size: 20px;
  font-weight: 600;
  color: #333;
}

.header-left .separator {
  color: #666;
  font-weight: 300;
}

.header-left .tagline {
  font-size: 16px;
  color: #555;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

.header-right .worker-id {
  font-size: 16px;
  color: #333;
  font-weight: 500;
}

.btn-logout {
  background: transparent;
  border: none;
  color: #333;
  font-size: 16px;
  cursor: pointer;
  padding: 5px 10px;
  border-radius: 6px;
  transition: background 0.2s;
}

.btn-logout:hover {
  background: rgba(0,0,0,0.1);
}

/* Dashboard Main */
.dashboard-main {
  flex: 1;
}

/* Main Menu - 2x3 grid */
.main-menu {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 15px;
  margin-bottom: 25px;
}

.menu-card {
  background: #e8e8e8;
  border: none;
  border-radius: 25px;
  padding: 25px 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  text-align: center;
}

.menu-card:hover {
  background: #d8d8d8;
  transform: translateY(-2px);
}

.menu-card:active {
  transform: translateY(0);
}

.menu-card .menu-label {
  font-size: 18px;
  font-weight: 500;
  color: #333;
}

/* Dashboard Footer */
.dashboard-footer {
  background: #e8e8e8;
  border-radius: 12px;
  padding: 15px 25px;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 15px;
  flex-wrap: wrap;
  font-size: 14px;
  color: #555;
  margin-top: auto;
}

.status-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
}

.status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.online {
  background: #27ae60;
}

.status-dot.offline {
  background: #e74c3c;
}

/* ========== LEGACY HEADER (keep for compatibility) ========== */
.terminal-header {
  background: #2c3e50;
  color: white;
  padding: 10px 20px;
  border-radius: 10px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.header-content {
  display: flex;
  flex-direction: row;
  align-items: baseline;
  gap: 12px;
}

.terminal-header h1 {
  font-size: 24px;
  font-weight: 600;
  margin: 0;
}

.tagline {
  font-size: 13px;
  opacity: 0.75;
  font-style: italic;
  letter-spacing: 0.3px;
  margin: 0;
}

.terminal-header p {
  font-size: 14px;
  opacity: 0.8;
  margin: 0;
}

/* Section Title - current menu name */
.section-title {
  background: #34495e;
  color: white;
  padding: 12px 20px;
  border-radius: 8px;
  margin-bottom: 15px;
  font-size: 20px;
  font-weight: 600;
}

.worker-info {
  display: flex;
  align-items: center;
  gap: 15px;
  font-size: 18px;
}

/* Login Page */
.login-page {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
}

.login-form {
  background: white;
  padding: 40px;
  border-radius: 10px;
  box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  max-width: 400px;
  width: 100%;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
  font-size: 16px;
}

.form-input {
  width: 100%;
  padding: 15px;
  font-size: 20px;
  border: 2px solid #ddd;
  border-radius: 8px;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: #3498db;
}

/* Buttons */
.btn {
  padding: 18px 30px;
  font-size: 20px;
  font-weight: 600;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  width: 100%;
  transition: all 0.2s;
}

.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-primary {
  background: #3498db;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #2980b9;
}

.btn-success {
  background: #27ae60;
  color: white;
}

.btn-success:hover:not(:disabled) {
  background: #229954;
}

.btn-danger {
  background: #e74c3c;
  color: white;
}

.btn-danger:hover:not(:disabled) {
  background: #c0392b;
}

.btn-small {
  padding: 8px 15px;
  font-size: 14px;
  background: rgba(255,255,255,0.2);
  color: white;
  border: none;
  border-radius: 5px;
  cursor: pointer;
}

.btn-small:hover {
  background: rgba(255,255,255,0.3);
}

/* Info Panel */
.info-panel {
  background: white;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

/* Context Buttons - combined info + action */
.context-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-bottom: 15px;
}

.context-btn {
  background: #f8f9fa;
  border: 2px solid #dee2e6;
  border-radius: 8px;
  padding: 10px 16px;
  font-size: 15px;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  gap: 6px;
}

.context-btn:hover {
  border-color: #3498db;
  background: #e3f2fd;
}

.context-btn .label {
  color: #666;
  font-weight: 400;
}

.context-btn .value {
  color: #2c3e50;
  font-weight: 600;
}

.context-btn.empty .value {
  color: #999;
  font-style: italic;
}

.info-item {
  display: flex;
  justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid #eee;
}

.info-item:last-child {
  border-bottom: none;
}

.info-item .label {
  font-weight: 600;
  color: #666;
}

/* Menu Buttons (for sub-menus) */
.menu-buttons {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 20px;
  width: 100%;
}

.menu-btn {
  background: white;
  padding: 18px 25px;
  border-radius: 10px;
  border: 2px solid #ddd;
  font-size: 18px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  width: 100%;
  text-align: center;
  text-align: center;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.menu-btn:hover {
  border-color: #3498db;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

.menu-btn:active {
  transform: translateY(0);
}

/* Content Area */
.content-area {
  background: white;
  padding: 25px;
  border-radius: 10px;
  box-shadow: 0 2px 5px rgba(0,0,0,0.05);
  min-height: 300px;
}

.content-area h2 {
  margin-bottom: 20px;
  color: #2c3e50;
}

/* Error Message */
.error-message {
  color: #e74c3c;
  padding: 10px;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}

/* Success Message */
.success-message {
  color: #27ae60;
  padding: 10px;
  margin-top: 10px;
  text-align: center;
  font-weight: 500;
}

/* List */
.item-list {
  display: grid;
  gap: 10px;
}

.list-item {
  background: #f8f9fa;
  padding: 15px;
  border-radius: 8px;
  border: 2px solid transparent;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 16px;
}

.list-item:hover {
  border-color: #3498db;
  background: #e3f2fd;
}

/* Loading */
.loading {
  text-align: center;
  padding: 40px;
  color: #999;
}

/* Responsive */
@media (max-width: 768px) {
  .container {
    padding: 10px;
  }
  
  .dashboard-layout {
    padding: 10px;
  }

  .dashboard-header {
    flex-direction: column;
    gap: 10px;
    text-align: center;
    padding: 15px;
  }
  
  .header-left {
    justify-content: center;
  }
  
  .header-right {
    justify-content: center;
  }

  .terminal-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .worker-info {
    margin-top: 10px;
  }

  .main-menu {
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
  }
  
  .menu-card {
    padding: 20px 15px;
    border-radius: 20px;
  }
  
  .menu-card .menu-label {
    font-size: 16px;
  }

  .menu-buttons {
    grid-template-columns: 1fr;
  }
  
  .dashboard-footer {
    flex-direction: column;
    gap: 8px;
    text-align: center;
    padding: 15px;
  }
}

/* Very small screens */
@media (max-width: 400px) {
  .main-menu {
    grid-template-columns: 1fr;
  }
}

/* Legacy Footer */
.footer {
  background: #2c3e50;
  color: white;
  padding: 15px 20px;
  border-radius: 8px;
  margin-top: 30px;
  text-align: center;
}

.version-info {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 10px;
  font-size: 14px;
  opacity: 0.9;
}

.version-info .separator {
  opacity: 0.5;
}

@media (max-width: 768px) {
  .version-info {
    flex-direction: column;
    gap: 5px;
  }
  
  .version-info .separator {
    display: none;
  }
}

/* Section title card */
.section-title-card {
  background: #f0f0f0;
  padding: 12px 20px;
  margin: 15px 0;
  border-radius: 8px;
  font-size: 18px;
  font-weight: 600;
  text-align: center;
}

/* Info buttons (Участок, Проект, Изделие) */
.info-buttons {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.info-btn {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 16px;
  background: #f8f9fa;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  text-align: left;
  transition: background 0.2s;
}

.info-btn:hover {
  background: #e9ecef;
}

.info-btn .label {
  font-weight: 500;
  color: #666;
}

/* В работе - отдельный блок */
.in-work-panel {
  margin-top: 15px;
  padding: 12px 16px;
  background: #e8f5e9;
  border-radius: 8px;
  display: flex;
  justify-content: space-between;
}

.in-work-panel .label {
  font-weight: 500;
  color: #2e7d32;
}

/* Menu buttons 2 columns (for section menus) */
.menu-buttons.two-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

@media (max-width: 500px) {
  .menu-buttons.two-columns {
    grid-template-columns: 1fr;
  }
}
