body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  margin: 0;
  padding: 0;
  background-color: #f3f4f6;
  touch-action: manipulation;
  height: 100vh;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

/* Handle safe areas on modern devices */
@supports (padding: max(0px)) {
  body {
    padding-top: env(safe-area-inset-top);
    padding-bottom: env(safe-area-inset-bottom);
    padding-left: env(safe-area-inset-left);
    padding-right: env(safe-area-inset-right);
  }
}

.container {
  max-width: 600px;
  margin: 0 auto;
  padding: 16px;
}

h1 {
  text-align: center;
  color: #3b82f6;
  margin-top: 0.5em;
  margin-bottom: 0.75em;
}

.install-prompt {
  text-align: center;
  margin-bottom: 20px;
  display: none; /* Hidden by default, shown via JS when install is available */
}

.install-button {
  background-color: #10b981;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 8px 16px;
  font-weight: 500;
  cursor: pointer;
  display: inline-block;
  width: auto;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background-color: white;
  padding: 16px;
  border-radius: 8px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  text-align: center;
}

.stat-label {
  font-size: 14px;
  color: #6b7280;
  margin-bottom: 4px;
}

.stat-value {
  font-size: 18px;
  font-weight: 700;
}

.positive {
  color: #10b981;
}

.negative {
  color: #ef4444;
}

.panel {
  background-color: white;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 20px;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.panel-title {
  font-size: 18px;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 16px;
}

#chart {
  width: 100%;
  height: 250px;
  margin-bottom: 20px;
}

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

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

label {
  display: block;
  font-size: 14px;
  font-weight: 500;
  margin-bottom: 4px;
  color: #374151;
}

input {
  width: 100%;
  padding: 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  box-sizing: border-box;
}

button {
  background-color: #3b82f6;
  color: white;
  border: none;
  border-radius: 4px;
  padding: 10px 16px;
  font-weight: 500;
  cursor: pointer;
  width: 100%;
}

button:hover {
  background-color: #2563eb;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th {
  text-align: left;
  padding: 8px;
  border-bottom: 1px solid #d1d5db;
  background-color: #f9fafb;
}

td {
  padding: 8px;
  border-bottom: 1px solid #e5e7eb;
}

.delete-btn {
  color: #ef4444;
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  width: auto;
}

.chart-placeholder {
  width: 100%;
  height: 250px;
  background-color: #f9fafb;
  border: 1px dashed #d1d5db;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  font-size: 14px;
}

.status-indicator {
  margin-top: 20px;
  text-align: center;
  font-size: 14px;
}

#online-status {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 4px;
  font-weight: 500;
}

#online-status.online {
  background-color: rgba(16, 185, 129, 0.1);
  color: #10b981;
}

#online-status.offline {
  background-color: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}

/* Standalone app styles */
@media all and (display-mode: standalone) {
  .install-prompt {
    display: none !important;
  }
  
  h1 {
    margin-top: 0.25em;
  }
}

/* Responsive adjustments */
@media (max-width: 480px) {
  .form-row {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .stats-panel {
    gap: 8px;
  }
  
  .panel {
    padding: 12px;
  }
}

/* Update Panel Styles */
.updates-panel {
  margin-top: 20px;
}

.update-list {
  max-height: 300px;
  overflow-y: auto;
}

.update-item {
  padding: 10px 0;
  border-bottom: 1px solid #e5e7eb;
}

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

.update-date {
  font-weight: 500;
  color: #4b5563;
  display: inline-block;
}

.update-version {
  display: inline-block;
  font-size: 14px;
  background-color: #eef2ff;
  color: #4f46e5;
  padding: 2px 8px;
  border-radius: 12px;
  margin-left: 8px;
}

.update-details {
  margin-top: 8px;
  margin-bottom: 0;
  padding-left: 20px;
  color: #6b7280;
}

.update-details li {
  margin-bottom: 4px;
}

.update-details li:last-child {
  margin-bottom: 0;
}

/* Version Footer */
.version-footer {
  text-align: center;
  font-size: 12px;
  color: #9ca3af;
  margin-top: 20px;
  margin-bottom: 10px;
}

.advanced-controls {
  margin-bottom: 15px;
}

.advanced-row {
  display: flex;
  margin-bottom: 10px;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start; /* Align from top */
}

/* All shared button styles */
.secondary-btn {
  display: inline-block;
  background-color: #f3f4f6;
  color: #4b5563;
  border: 1px solid #d1d5db;
  padding: 8px 16px;
  border-radius: 4px;
  font-weight: 500;
  cursor: pointer;
  transition: background-color 0.2s;
  text-align: center;
  width: 100%;
  box-sizing: border-box;
  height: 36px;
  line-height: 18px;
  vertical-align: top;
  font-family: inherit;
  font-size: inherit;
}

.secondary-btn:hover {
  background-color: #e5e7eb;
}

/* File input container styles */
.file-input-label {
  cursor: pointer;
  display: block;
  flex: 1;
  margin: 0;
  padding: 0;
}

/* Make both containers equal width */
.advanced-row > button,
.advanced-row > label {
  width: calc(50% - 8px);
  max-width: none;
  min-width: 0;
}

.import-status {
  margin-top: 8px;
  font-size: 14px;
  min-height: 20px;
}

.import-success {
  color: #10b981;
}

.import-error {
  color: #ef4444;
}