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

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Auth Screen */
.auth-screen {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #1a1a2e;
}

.auth-card {
  background: #fff;
  border-radius: 12px;
  padding: 40px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.3);
  text-align: center;
}

.auth-card h1 {
  font-size: 24px;
  color: #1a1a2e;
  margin-bottom: 4px;
}

.auth-subtitle {
  color: #888;
  font-size: 13px;
  margin-bottom: 24px;
}

.auth-field {
  text-align: left;
  margin-bottom: 16px;
}

.auth-field label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #444;
  margin-bottom: 4px;
}

.auth-field input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
  font-family: inherit;
}

.auth-field input:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 2px rgba(233,69,96,0.15);
}

.btn-auth-primary {
  width: 100%;
  padding: 12px;
  background: #e94560;
  color: #fff;
  border: none;
  border-radius: 8px;
  font-size: 16px;
  font-weight: 600;
  cursor: pointer;
  margin-top: 8px;
}

.btn-auth-primary:hover { background: #d63851; }
.btn-auth-primary:disabled { background: #ccc; cursor: not-allowed; }

.auth-toggle {
  margin-top: 16px;
  font-size: 13px;
  color: #666;
}

.btn-auth-link {
  background: none;
  border: none;
  color: #e94560;
  font-weight: 600;
  cursor: pointer;
  font-size: 13px;
}

.btn-auth-link:hover { text-decoration: underline; }

.auth-error {
  background: #fee2e2;
  color: #dc2626;
  padding: 10px;
  border-radius: 6px;
  font-size: 13px;
  margin-bottom: 16px;
}

.user-email {
  color: #a0a0b8;
  font-size: 12px;
}

body {
  background: #f0f2f5;
  color: #1a1a2e;
  line-height: 1.5;
}

/* Header */
header {
  background: #1a1a2e;
  color: #fff;
  padding: 16px 24px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 3px solid #e94560;
}

.header-content h1 {
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.subtitle {
  color: #a0a0b8;
  font-size: 13px;
}

.header-actions {
  display: flex;
  gap: 8px;
}

.btn-export {
  background: #e94560;
  color: #fff;
  border: none;
  padding: 10px 24px;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.btn-export:hover {
  background: #d63851;
}

.btn-data {
  background: transparent;
  color: #a0a0b8;
  border: 1px solid #444;
  padding: 10px 16px;
  border-radius: 6px;
  font-size: 13px;
  cursor: pointer;
}

.btn-data:hover {
  background: #2a2a4a;
  color: #fff;
}

/* Tab Navigation */
.tab-nav {
  background: #fff;
  display: flex;
  gap: 0;
  border-bottom: 1px solid #d0d0d0;
  overflow-x: auto;
  padding: 0 16px;
}

.tab-btn {
  background: none;
  border: none;
  padding: 12px 20px;
  font-size: 14px;
  font-weight: 500;
  color: #666;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
}

.tab-btn:hover {
  color: #1a1a2e;
  background: #f8f8fa;
}

.tab-btn.active {
  color: #e94560;
  border-bottom-color: #e94560;
  font-weight: 600;
}

/* Main */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 20px 16px 60px;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.section-header h2 {
  font-size: 20px;
}

.section-desc {
  font-size: 13px;
  color: #666;
  flex-basis: 100%;
  margin-top: -8px;
}

.btn-add {
  background: #2d8a4e;
  color: #fff;
  border: none;
  padding: 8px 16px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  margin-left: auto;
}

.btn-add:hover {
  background: #246d3e;
}

/* Filter */
.filter-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.filter-row label {
  font-size: 13px;
  font-weight: 600;
}

.filter-row select {
  padding: 6px 12px;
  border: 1px solid #d0d0d0;
  border-radius: 6px;
  font-size: 14px;
}

/* Color Key */
.color-key {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  font-size: 12px;
  color: #666;
}

.key-item {
  display: flex;
  align-items: center;
  gap: 4px;
}

.dot {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  display: inline-block;
}

.dot.input { background: #dbeafe; }
.dot.formula { background: #e0e7ff; }
.dot.attention { background: #fef3c7; }
.dot.alert { background: #fee2e2; }

/* Summary Cards */
.summary-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.summary-card {
  background: #fff;
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
}

.card-label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #666;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 4px;
}

.card-value {
  display: block;
  font-size: 24px;
  font-weight: 700;
  color: #1a1a2e;
}

/* KPI Tiles */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 12px;
  margin-bottom: 24px;
}

.kpi-tile {
  background: #fff;
  border-radius: 8px;
  padding: 14px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  text-align: center;
  border-left: 4px solid #e94560;
}

.kpi-tile-label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: #888;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.kpi-tile-value {
  font-size: 22px;
  font-weight: 700;
}

/* Status colors */
.status-good { color: #2d8a4e; }
.status-warn { color: #b45309; }
.status-bad { color: #dc2626; }

/* Tables */
h3 {
  font-size: 16px;
  margin: 20px 0 8px;
}

.table-scroll {
  overflow-x: auto;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  font-size: 13px;
}

.data-table th {
  background: #1a1a2e;
  color: #fff;
  padding: 10px 12px;
  text-align: left;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
}

.data-table td {
  padding: 8px 12px;
  border-bottom: 1px solid #eee;
  white-space: nowrap;
}

.data-table tbody tr:hover {
  background: #f8f9ff;
}

/* Inline inputs in tables */
.entry-table input,
.entry-table select {
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
  background: #fff;
}

.entry-table input:focus,
.entry-table select:focus {
  outline: none;
  border-color: #e94560;
  box-shadow: 0 0 0 2px rgba(233,69,96,0.15);
}

.entry-table input[type="text"] { width: 120px; }
.entry-table input[type="number"] { width: 90px; }
.entry-table input[type="date"] { width: 130px; }
.entry-table select { width: 130px; }

.calc-cell {
  font-weight: 700;
  background: #f0f4ff;
  color: #1a1a2e;
}

.alert-cell {
  background: #fee2e2;
  color: #dc2626;
  font-weight: 700;
}

.btn-remove {
  background: none;
  border: none;
  color: #999;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
}

.btn-remove:hover {
  color: #dc2626;
}

/* Inspector Groups */
.inspector-group {
  background: #fff;
  border-radius: 8px;
  margin-bottom: 16px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.08);
  border-left: 4px solid #e94560;
}

.inspector-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: #f8f9fa;
  cursor: pointer;
  flex-wrap: wrap;
}

.inspector-header:hover {
  background: #f0f2f5;
}

.inspector-name {
  font-size: 16px;
  font-weight: 700;
  color: #1a1a2e;
}

.inspector-classification {
  font-size: 12px;
  color: #888;
  background: #eee;
  padding: 2px 8px;
  border-radius: 4px;
}

.inspector-stats {
  display: flex;
  gap: 16px;
  margin-left: auto;
  font-size: 12px;
}

.inspector-stat {
  text-align: center;
}

.inspector-stat-label {
  display: block;
  color: #888;
  font-size: 10px;
  text-transform: uppercase;
}

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

.inspector-actions {
  display: flex;
  gap: 6px;
  margin-left: 8px;
}

.inspector-body {
  padding: 0 16px 20px;
  overflow: visible;
}

.inspector-body.collapsed {
  display: none;
}

.btn-add-day {
  background: #2d8a4e;
  color: #fff;
  border: none;
  padding: 6px 14px;
  border-radius: 4px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  margin: 8px 0;
}

.btn-add-day:hover { background: #246d3e; }

.btn-remove-inspector {
  background: none;
  border: 1px solid #ddd;
  color: #999;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 11px;
  cursor: pointer;
}

.btn-remove-inspector:hover { color: #dc2626; border-color: #dc2626; }

.inspector-edit {
  display: flex;
  gap: 8px;
  align-items: center;
}

.inspector-edit input,
.inspector-edit select {
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 5px 8px;
  font-size: 13px;
  font-family: inherit;
}

.inspector-edit input:focus,
.inspector-edit select:focus {
  outline: none;
  border-color: #e94560;
}

/* Responsive */
@media (max-width: 768px) {
  header {
    flex-direction: column;
    gap: 8px;
    text-align: center;
  }
  .section-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .filter-row {
    margin-left: 0;
  }
  .btn-add {
    margin-left: 0;
  }
}
