:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --gray-50: #f9fafb;
  --gray-100: #f3f4f6;
  --gray-200: #e5e7eb;
  --gray-300: #d1d5db;
  --gray-500: #6b7280;
  --gray-700: #374151;
  --gray-900: #111827;
}

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

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--gray-50);
  color: var(--gray-900);
  line-height: 1.5;
}

.app-container {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
}

header {
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: white;
  padding: 20px 28px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 4px 6px -1px rgb(0 0 0 / 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
}

header h1 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 4px;
}

header p {
  opacity: 0.9;
  font-size: 0.95rem;
}

.workflow-steps {
  display: flex;
  gap: 8px;
  margin-bottom: 24px;
  overflow-x: auto;
  padding-bottom: 8px;
}

.step {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: white;
  border: 2px solid var(--gray-200);
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s, transform 0.2s;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.step:hover {
  border-color: var(--primary);
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgb(0 0 0 / 0.06);
}

.step.active {
  border-color: var(--primary);
  background: #eff6ff;
}

.step.completed {
  border-color: var(--success);
  background: #ecfdf5;
}

.step-number {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--gray-200);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  font-size: 0.875rem;
}

.step.active .step-number {
  background: var(--primary);
  color: white;
}

.step.completed .step-number {
  background: var(--success);
  color: white;
}

.card {
  background: white;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
  box-shadow: 0 1px 3px rgb(0 0 0 / 0.1);
}

.auth-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  border: 1px solid var(--gray-200);
}

.auth-details {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.auth-status {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.auth-actions {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

body.auth-locked #appBody {
  opacity: 0.45;
  pointer-events: none;
  filter: grayscale(0.1);
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--gray-200);
}

.card-title {
  font-size: 1.125rem;
  font-weight: 600;
}

.upload-zone {
  border: 2px dashed var(--gray-300);
  border-radius: 8px;
  padding: 40px 24px;
  text-align: center;
  transition: all 0.2s;
  cursor: pointer;
}

.upload-zone:hover, .upload-zone.dragover {
  border-color: var(--primary);
  background: #eff6ff;
}

.upload-icon {
  width: 48px;
  height: 48px;
  margin: 0 auto 16px;
  color: var(--gray-500);
}

.upload-zone h3 {
  font-size: 1rem;
  margin-bottom: 4px;
}

.upload-zone p {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 20px;
  border-radius: 8px;
  font-weight: 500;
  font-size: 0.9375rem;
  cursor: pointer;
  border: none;
  transition: all 0.2s;
}

.btn-primary {
  background: var(--primary);
  color: white;
}

.btn-primary:hover {
  background: var(--primary-dark);
}

.btn-secondary {
  background: white;
  color: var(--gray-700);
  border: 1px solid var(--gray-300);
}

.btn-secondary:hover {
  background: var(--gray-50);
}

.btn-success {
  background: var(--success);
  color: white;
}

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

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

.form-label {
  display: block;
  font-weight: 500;
  margin-bottom: 6px;
  font-size: 0.875rem;
}

.form-input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--gray-300);
  border-radius: 6px;
  font-size: 0.9375rem;
  transition: border-color 0.2s;
}

.form-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgb(37 99 235 / 0.1);
}

.form-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
}

.form-help {
  margin-top: 6px;
  font-size: 0.8125rem;
  color: var(--gray-500);
  line-height: 1.35;
}

.summary-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.summary-card {
  padding: 16px;
  border-radius: 8px;
  text-align: center;
}

.summary-card.total {
  background: var(--gray-100);
}

.summary-card.pass {
  background: #ecfdf5;
}

.summary-card.warning {
  background: #fffbeb;
}

.summary-card.fail {
  background: #fef2f2;
}

.summary-value {
  font-size: 2rem;
  font-weight: 700;
}

.summary-card.pass .summary-value { color: var(--success); }
.summary-card.warning .summary-value { color: var(--warning); }
.summary-card.fail .summary-value { color: var(--error); }

.summary-label {
  font-size: 0.875rem;
  color: var(--gray-500);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

.data-table th {
  background: var(--gray-50);
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid var(--gray-200);
  position: sticky;
  top: 0;
}

.data-table td {
  padding: 12px;
  border-bottom: 1px solid var(--gray-200);
}

.data-table tr:hover {
  background: var(--gray-50);
}

.data-table tr.editable-row {
  background: #fffdf7;
}

.data-table tr.appliance-row {
  background: #f0fdf4;
}

.data-table tr.appliance-row:hover {
  background: #ecfdf5;
}

.editable-cell {
  min-width: 120px;
}

.editable-cell .form-input {
  min-width: 110px;
  padding: 7px 8px;
  font-size: 0.8125rem;
}

.editable-cell .rent-input {
  min-width: 92px;
  text-align: right;
}

.editable-cell .unit-input {
  min-width: 72px;
}

.row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 96px;
}

.row-actions .btn {
  padding: 7px 10px;
  font-size: 0.8125rem;
  white-space: nowrap;
}

.inline-edit-status {
  font-size: 0.75rem;
  color: var(--gray-500);
  white-space: nowrap;
}

.order-table th,
.order-table td {
  white-space: nowrap;
}

.order-table input {
  width: 100%;
  min-width: 90px;
}

.order-table .notes-input {
  min-width: 180px;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.status-pass {
  background: #ecfdf5;
  color: #059669;
}

.status-warning {
  background: #fffbeb;
  color: #d97706;
}

.status-fail {
  background: #fef2f2;
  color: #dc2626;
}

.review-badge {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  padding: 3px 8px;
  border-radius: 9999px;
  background: #dcfce7;
  color: #15803d;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  white-space: nowrap;
}

.issue-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.issue-item {
  font-size: 0.8125rem;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--gray-100);
}

.issue-item.error {
  background: #fef2f2;
  color: #dc2626;
}

.issue-item.warning {
  background: #fffbeb;
  color: #d97706;
}

.issue-item.info {
  background: #eff6ff;
  color: var(--primary);
}

.table-container {
  overflow-x: auto;
  max-height: 500px;
  overflow-y: auto;
}

.actions-bar {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.file-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--gray-50);
  border-radius: 8px;
  margin-top: 16px;
}

.file-icon {
  width: 40px;
  height: 40px;
  background: var(--success);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
}

.file-details h4 {
  font-size: 0.9375rem;
  font-weight: 500;
}

.file-details p {
  font-size: 0.8125rem;
  color: var(--gray-500);
}

.hidden {
  display: none !important;
}

.app-update-button {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 50;
  width: 46px;
  height: 46px;
  border: 0;
  border-radius: 999px;
  background: var(--warning);
  color: var(--gray-900);
  box-shadow: 0 12px 28px rgb(0 0 0 / 0.22);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s, box-shadow 0.2s, background 0.2s;
}

.app-update-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 32px rgb(0 0 0 / 0.24);
}

.app-update-button:disabled {
  cursor: wait;
  opacity: 0.78;
}

.app-update-icon {
  font-size: 1.35rem;
  line-height: 1;
}

.app-update-button::after {
  content: '';
  position: absolute;
  top: 6px;
  right: 7px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--error);
  border: 2px solid white;
}

.app-update-button.updating .app-update-icon {
  animation: spin 0.8s linear infinite;
}

.loading {
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid var(--gray-200);
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.alert {
  padding: 12px 16px;
  border-radius: 8px;
  margin-bottom: 16px;
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.alert-info {
  background: #eff6ff;
  border: 1px solid #bfdbfe;
}

.alert-success {
  background: #ecfdf5;
  border: 1px solid #a7f3d0;
}

.alert-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
}
