:root {
  --primary-color: #2563eb; /* Modern Blue */
  --primary-hover: #1d4ed8;
  --secondary-color: #64748b; /* Slate */
  --background-color: #f1f5f9; /* Light Gray Blue */
  --card-bg: #ffffff;
  --text-primary: #1e293b; /* Dark Slate */
  --text-secondary: #475569;
  --success-color: #10b981;
  --warning-color: #f59e0b;
  --danger-color: #ef4444;
  --border-radius: 12px;
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

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

body {
  font-family: var(--font-family);
  background-color: var(--background-color);
  color: var(--text-primary);
  line-height: 1.5;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 1000px; /* Tighter width for better reading */
  margin: 0 auto;
  padding: 40px 20px;
}

.header {
  text-align: center;
  margin-bottom: 40px;
}

.header h1 {
  font-size: 2.25rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.header p {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.card {
  background: var(--card-bg);
  border-radius: var(--border-radius);
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: var(--shadow-md);
  border: 1px solid #e2e8f0;
}

/* Tabs */
.tabs {
  display: flex;
  margin-bottom: 24px;
  background: #f8fafc;
  padding: 4px;
  border-radius: calc(var(--border-radius) - 4px);
  border: 1px solid #e2e8f0;
}

.tab {
  flex: 1;
  text-align: center;
  padding: 10px 20px;
  cursor: pointer;
  border-radius: calc(var(--border-radius) - 6px);
  font-weight: 600;
  color: var(--text-secondary);
  transition: all 0.2s ease;
  font-size: 0.95rem;
}

.tab:hover {
  color: var(--text-primary);
  background: rgba(255,255,255,0.5);
}

.tab.active {
  background: white;
  color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

.tab-content {
  display: none;
  animation: fadeIn 0.3s ease;
}

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

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(5px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Upload Area */
.upload-area {
  border: 2px dashed #cbd5e1;
  padding: 60px 40px;
  text-align: center;
  border-radius: var(--border-radius);
  cursor: pointer;
  transition: all 0.2s ease;
  background: #f8fafc;
}

.upload-area:hover {
  border-color: var(--primary-color);
  background: #eff6ff; /* Light blue tint */
}

.upload-area h3 {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-primary);
  margin: 16px 0 8px;
}

.upload-area p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

.upload-icon {
  font-size: 48px;
  color: var(--text-secondary);
  transition: transform 0.2s;
}

.upload-area:hover .upload-icon {
  transform: scale(1.1);
  color: var(--primary-color);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s;
  background: var(--primary-color);
  color: white;
  box-shadow: 0 1px 2px 0 rgba(0,0,0,0.05);
  margin: 4px;
}

.btn:hover {
  background: var(--primary-hover);
  transform: translateY(-1px);
  box-shadow: 0 4px 6px -1px rgba(0,0,0,0.1);
}

.btn:disabled {
  background: #94a3b8;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: white;
  color: var(--text-secondary);
  border: 1px solid #cbd5e1;
}

.btn-secondary:hover {
  background: #f8fafc;
  color: var(--text-primary);
  border-color: #94a3b8;
}

.btn-danger {
  background: #fee2e2;
  color: #991b1b;
}

.btn-danger:hover {
  background: #fecaca;
}

.btn-warning {
  background: #fffbeb;
  color: #92400e;
}

.btn-warning:hover {
  background: #fde68a;
}

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

.btn-success:hover {
  background: #059669;
}

/* Document List */
.draft-list {
  max-height: 500px;
  overflow-y: auto;
  padding-right: 5px; /* space for scrollbar */
}

.draft-item {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  margin-bottom: 12px;
  transition: all 0.2s;
}

.draft-item:hover {
  border-color: var(--primary-color);
  box-shadow: var(--shadow-sm);
}

/* Documents inside Result */
.document {
  background: white;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 20px;
  margin-bottom: 16px;
  position: relative;
  transition: box-shadow 0.2s;
}

.document:hover {
  box-shadow: var(--shadow-md);
}

.document h4 {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.document p {
  color: var(--text-secondary);
  font-size: 0.9rem;
}

/* Status Badges replaces full coloring */
.document::before {
  content: '';
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 4px;
  border-radius: 0 4px 4px 0;
  background-color: #cbd5e1; /* Default */
}

/* Style variants for document types using CSS classes added by JS */
.document.constating-documents::before { background-color: #10b981; }
.document.resolutions::before { background-color: #ef4444; }
.document.shareholder-documents::before { background-color: #3b82f6; }
.document.director-documents::before { background-color: #8b5cf6; }
.document.miscellaneous::before { background-color: #f59e0b; }
/* Add more mappings as needed, default handles others gracefully */

.document.editing {
  border: 2px solid var(--primary-color);
  background: #eff6ff;
}

.document-actions {
  position: absolute;
  top: 20px;
  right: 20px;
  display: flex;
  gap: 8px;
}

/* Stats */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 16px;
  margin: 24px 0;
}

.stat {
  background: #f8fafc;
  padding: 16px;
  border-radius: 8px;
  text-align: center;
  border: 1px solid #e2e8f0;
}

.stat h3 {
  font-size: 1.5rem;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.stat p {
  color: var(--text-secondary);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* Forms */
.form-group label {
  display: block;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 6px;
  color: var(--text-secondary);
}

.form-group input, .form-group select {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: border-color 0.2s;
}

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

.edit-form {
  background: white;
  border-top: 1px solid #e2e8f0;
  margin-top: 16px;
  padding-top: 16px;
  display: none;
}

/* Loading/Progress */
.loading {
  text-align: center;
  margin: 40px 0;
}

.spinner {
  border: 3px solid #e2e8f0;
  border-top: 3px solid var(--primary-color);
  width: 40px;
  height: 40px;
}

.progress-container {
  height: 8px;
  background: #e2e8f0;
  border-radius: 4px;
  margin: 16px 0;
  overflow: hidden;
}

.progress-bar {
  height: 100%;
  background: var(--primary-color);
  transition: width 0.3s ease;
  font-size: 0; /* Hide text inside thin bar */
}

/* Notifications */
.success, .error {
  padding: 16px;
  border-radius: 8px;
  margin: 16px 0;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 12px;
}

.success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .container {
    padding: 20px 15px;
  }
  
  .header h1 {
    font-size: 1.75rem;
  }

  .card {
    padding: 20px;
  }

  .tabs {
    flex-wrap: wrap;
    background: transparent;
    border: none;
    padding: 0;
  }

  .tab {
    flex: 1 1 100%;
    margin-bottom: 8px;
    background: white;
    border: 1px solid #e2e8f0;
  }
  
  .document-actions {
    position: static;
    margin-bottom: 16px;
    justify-content: flex-start;
  }

  .btn {
    width: 100%;
    margin: 4px 0;
  }
  
  .draft-item > div {
    flex-direction: column;
    align-items: flex-start !important;
    gap: 12px;
  }
}
