:root {
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --bg: #f3f4f6;
  --surface: #ffffff;
  --text: #1f2937;
  --border: #e5e7eb;
  --danger: #ef4444;
  --success: #10b981;
  --warning: #f59e0b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--bg);
  color: var(--text);
  height: 100vh;
  display: flex;
  flex-direction: column;
}

/* Login View */
.login-container {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #1e293b 0%, #0f172a 100%);
}

.login-box {
  background: var(--surface);
  padding: 2rem;
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
  width: 100%;
  max-width: 400px;
}

.login-box h2 {
  margin-bottom: 1.5rem;
  text-align: center;
}

.login-box input {
  width: 100%;
  padding: 0.75rem;
  margin-bottom: 1rem;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.login-box button {
  width: 100%;
  padding: 0.75rem;
  background: var(--primary);
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 600;
}

.login-box button:hover {
  background: var(--primary-dark);
}

#error {
  color: var(--danger);
  text-align: center;
  margin-top: 1rem;
  min-height: 1.5em;
}

/* App Layout */
.app-container {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.top-bar {
  background: #1e293b;
  color: white;
  padding: 0 1.5rem;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.logo {
  font-size: 1.25rem;
  font-weight: bold;
}

.user-info {
  display: flex;
  gap: 1rem;
  align-items: center;
}

#logout-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.main-nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0 1.5rem;
  display: flex;
  gap: 1rem;
  overflow-x: auto;
}

.nav-btn {
  background: none;
  border: none;
  padding: 1rem 0.5rem;
  color: #6b7280;
  cursor: pointer;
  font-weight: 500;
  border-bottom: 2px solid transparent;
}

.nav-btn.active {
  color: var(--primary);
  border-bottom-color: var(--primary);
}

.content-area {
  flex: 1;
  padding: 2rem;
  overflow-y: auto;
}

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
  animation: fadeIn 0.3s ease;
}

/* Dashboard Cards */
.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 1.5rem;
  margin-top: 1.5rem;
}

.summary-card {
  background: var(--surface);
  padding: 1.5rem;
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.summary-card h3 {
  font-size: 0.875rem;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.summary-card .metric {
  font-size: 1.5rem;
  font-weight: bold;
  margin-bottom: 0.5rem;
}

.status-indicator {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
}

.status-indicator.green {
  background: #d1fae5;
  color: #065f46;
}

.status-indicator.yellow {
  background: #fef3c7;
  color: #92400e;
}

.status-indicator.red {
  background: #fee2e2;
  color: #991b1b;
}

/* Tables & Forms */
.section-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.5rem 1rem;
  border-radius: 4px;
  cursor: pointer;
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  background: var(--surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.data-table th,
.data-table td {
  padding: 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

.data-table th {
  background: #f8fafc;
  font-weight: 600;
}

.scope-editor textarea {
  width: 100%;
  height: 400px;
  padding: 1rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  resize: vertical;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(5px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scope Tab Styles */
.project-pane {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1.5rem;
  margin-bottom: 2rem;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
}

.project-pane-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--border);
}

.project-pane-header h3 {
  font-size: 1.25rem;
  color: var(--text);
}

.project-details {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  margin-bottom: 2rem;
}

.project-details .full-width {
  grid-column: 1 / -1;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.form-group label {
  font-weight: 500;
  font-size: 0.875rem;
  color: #4b5563;
}

.form-group input,
.form-group textarea {
  padding: 0.75rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-family: inherit;
}

.scope-table-section {
  margin-top: 1.5rem;
}

.scope-table-section h4 {
  margin-bottom: 1rem;
  font-size: 1rem;
  color: #374151;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.scope-table-section button.small {
  padding: 0.25rem 0.5rem;
  font-size: 0.75rem;
}


/* Complex Table Styles */
.table-scroll-container {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
}

.complex-header th {
  text-align: center;
  border: 1px solid var(--border);
  background: #f8fafc;
  padding: 0.75rem;
  white-space: nowrap;
}

.complex-header td {
  border: 1px solid var(--border);
  padding: 0.5rem;
  min-width: 150px;
}

.complex-header input {
  width: 100%;
  border: none;
  background: transparent;
  padding: 0.25rem;
}

.complex-header input:focus {
  outline: 2px solid var(--primary);
  background: white;
  border-radius: 2px;
}