/* TWM-ERP Integration - simple admin UI */

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: #f4f6f9;
  color: #1f2937;
}

a { color: #2563eb; text-decoration: none; }
a:hover { text-decoration: underline; }

/* Layout */
.app {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: #1e293b;
  color: white;
  padding: 12px 24px;
}
.topbar h1 { margin: 0; font-size: 18px; font-weight: 600; }
.topbar .user { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar button {
  background: #334155;
  color: white;
  border: none;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
}
.topbar button:hover { background: #475569; }

.tabs {
  display: flex;
  background: white;
  border-bottom: 1px solid #e5e7eb;
  padding: 0 24px;
}
.tab {
  padding: 14px 18px;
  cursor: pointer;
  color: #6b7280;
  border-bottom: 2px solid transparent;
  font-size: 14px;
  font-weight: 500;
}
.tab.active {
  color: #1e293b;
  border-bottom-color: #2563eb;
}
.tab:hover { color: #1e293b; }

.content {
  flex: 1;
  padding: 24px;
  max-width: 1400px;
  width: 100%;
  margin: 0 auto;
}

/* Login */
.login-card {
  max-width: 380px;
  margin: 80px auto;
  background: white;
  padding: 32px;
  border-radius: 8px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08);
}
.login-card h1 { margin: 0 0 4px; font-size: 22px; }
.login-card .subtitle { margin: 0 0 24px; color: #6b7280; font-size: 14px; }
.login-card form { display: flex; flex-direction: column; gap: 14px; }
.login-card label { display: flex; flex-direction: column; font-size: 13px; gap: 4px; color: #374151; }
.login-card input {
  padding: 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
}
.login-card button {
  margin-top: 6px;
  background: #2563eb;
  color: white;
  border: none;
  padding: 11px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
}
.login-card button:hover { background: #1d4ed8; }
.error { color: #dc2626; font-size: 13px; margin: 4px 0 0; }

/* Sections */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
}
.section-header h2 { margin: 0; font-size: 22px; }

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  background: white;
  border-radius: 6px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
}
th, td {
  padding: 10px 14px;
  text-align: left;
  font-size: 14px;
  border-bottom: 1px solid #e5e7eb;
}
th {
  background: #f9fafb;
  font-weight: 600;
  color: #374151;
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover { background: #f9fafb; }

/* Buttons */
.btn {
  background: #2563eb;
  color: white;
  border: none;
  padding: 8px 14px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.btn:hover { background: #1d4ed8; }
.btn-secondary {
  background: #e5e7eb;
  color: #1f2937;
}
.btn-secondary:hover { background: #d1d5db; }
.btn-danger {
  background: #dc2626;
}
.btn-danger:hover { background: #b91c1c; }
.btn-small { padding: 4px 10px; font-size: 12px; }
.btn-row { display: flex; gap: 6px; }

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.badge-success { background: #dcfce7; color: #15803d; }
.badge-failed { background: #fee2e2; color: #b91c1c; }
.badge-running { background: #dbeafe; color: #1d4ed8; }
.badge-pending { background: #fef3c7; color: #a16207; }
.badge-active { background: #dcfce7; color: #15803d; }
.badge-inactive { background: #e5e7eb; color: #6b7280; }
.badge-scheduled { background: #e0e7ff; color: #4338ca; }
.badge-manual { background: #fce7f3; color: #be185d; }
.badge-webhook { background: #fef3c7; color: #a16207; }

/* Forms */
.form-card {
  background: white;
  border-radius: 6px;
  padding: 22px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
  max-width: 720px;
}
.form-row {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
}
.form-row label {
  font-size: 13px;
  color: #374151;
  font-weight: 500;
}
.form-row input,
.form-row select {
  padding: 8px 10px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  font-size: 14px;
  width: 100%;
}
.form-row .help { font-size: 12px; color: #6b7280; margin-top: 2px; }
.form-actions {
  display: flex;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 18px;
}

/* Modal */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}
.modal {
  background: white;
  border-radius: 8px;
  max-width: 600px;
  width: 90%;
  max-height: 90vh;
  overflow: auto;
  padding: 22px;
}
.modal h3 { margin: 0 0 16px; }

/* Status indicator */
.status-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 6px;
}
.status-dot.green { background: #16a34a; }
.status-dot.gray { background: #9ca3af; }
.status-dot.red { background: #dc2626; }

/* Code */
code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #f1f5f9;
  padding: 2px 6px;
  border-radius: 3px;
  font-size: 12px;
  color: #1e293b;
}

/* Empty state */
.empty {
  background: white;
  padding: 40px;
  border-radius: 6px;
  text-align: center;
  color: #6b7280;
  font-size: 14px;
}

/* Bins import result summary */
.result-summary {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-bottom: 12px;
}
.result-summary .badge { font-size: 13px; padding: 6px 12px; }

/* File input row */
.form-row input[type="file"] {
  padding: 6px;
  background: #f9fafb;
}

/* Error row highlight */
.error-row td {
  color: #b91c1c;
  font-size: 13px;
}