/*
 * This is a manifest file that'll be compiled into application.css.
 *
 * With Propshaft, assets are served efficiently without preprocessing steps. You can still include
 * application-wide styles in this file, but keep in mind that CSS precedence will follow the standard
 * cascading order, meaning styles declared later in the document or manifest will override earlier ones,
 * depending on specificity.
 *
 * Consider organizing styles into separate files for maintainability.
 */

body { margin: 0; }
header, nav { margin: 0 !important; }

/* Base */
body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  line-height: 1.6;
  color: #333;
}

/* ===== App Shell (Paperclip-style three-column layout) ===== */
.app-shell {
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* Company Rail - 56px vertical icon strip */
.company-rail {
  width: 56px;
  min-width: 56px;
  background: #1a1a2e;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 0;
  gap: 8px;
  overflow-y: auto;
}

.rail-logo {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 8px;
  color: #9ca3af;
}

.rail-logo a { color: inherit; text-decoration: none; }
.rail-logo a:hover { text-decoration: none; opacity: 0.85; }

.rail-companies {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
}

.rail-company-icon {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #2d2d44;
  color: #9ca3af;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-decoration: none;
  transition: background 0.1s, color 0.1s, border-radius 0.1s;
  position: relative;
}

.rail-company-icon:hover {
  background: #3d3d5c;
  color: #fff;
  text-decoration: none;
  border-radius: 12px;
}

.rail-company-icon.active {
  background: #4f46e5;
  color: #fff;
  border-radius: 12px;
}

.rail-company-icon.active::before {
  content: '';
  position: absolute;
  left: -10px;
  top: 8px;
  bottom: 8px;
  width: 3px;
  background: #fff;
  border-radius: 0 2px 2px 0;
}

.rail-add {
  padding-top: 8px;
}

.rail-bottom {
  margin-top: auto;
  padding-top: 8px;
}

.rail-admin-icon {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  border-radius: 50%;
  margin-bottom: 4px;
  transition: opacity 0.1s;
}

.rail-admin-icon:hover {
  opacity: 0.8;
}

.rail-user-icon {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: opacity 0.1s;
}

.rail-user-icon:hover {
  opacity: 0.8;
  text-decoration: none;
}

.rail-user-avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
}

.rail-user-initials {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #2d2d44;
  color: #9ca3af;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rail-add a {
  width: 36px;
  height: 36px;
  border: 2px dashed #4b5563;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  text-decoration: none;
  transition: border-color 0.1s, color 0.1s;
}

.rail-add a:hover {
  border-color: #9ca3af;
  color: #d1d5db;
  text-decoration: none;
}

/* Sidebar - 220px navigation panel */
.sidebar {
  width: 220px;
  min-width: 220px;
  background: #f8f9fa;
  border-right: 1px solid #e5e7eb;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.sidebar-header {
  height: 48px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  border-bottom: 1px solid #e5e7eb;
  flex-shrink: 0;
}

.sidebar-company-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-company-name {
  font-size: 13px;
  font-weight: 700;
  color: #111;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 8px;
}

.sidebar-section-label {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #9ca3af;
  padding: 12px 8px 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
}

.sidebar-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 13px;
  font-weight: 500;
  color: #374151;
  text-decoration: none;
  transition: background 0.1s, color 0.1s;
  border: none;
  background: none;
  cursor: pointer;
  width: 100%;
  text-align: left;
}

.sidebar-item:hover {
  background: #e5e7eb;
  color: #111;
  text-decoration: none;
}

.sidebar-item.active {
  background: #e0e7ff;
  color: #3730a3;
}

.sidebar-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.sidebar-footer {
  border-top: 1px solid #e5e7eb;
  padding: 8px;
  flex-shrink: 0;
  overflow: hidden;
  position: relative;
}

.sidebar-user {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px;
  margin-bottom: 4px;
  text-decoration: none;
  color: inherit;
  border-radius: 6px;
}

a.sidebar-user:hover {
  background: #f3f4f6;
}

.sidebar-user-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  flex-shrink: 0;
}

.sidebar-user-initials {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  font-size: 11px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.sidebar-user-info {
  overflow: hidden;
  min-width: 0;
}

.sidebar-user-name {
  font-size: 13px;
  font-weight: 500;
  color: #111827;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-user-email {
  font-size: 11px;
  color: #9ca3af;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sidebar-footer form {
  margin: 0;
}

.sidebar-build {
  position: absolute;
  bottom: 4px;
  right: 8px;
  font-size: 9px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace;
  color: #d1d5db;
  pointer-events: none;
}

.sidebar-logout {
  font-size: 13px;
  color: #6b7280;
}

/* Main content area */
.main-content {
  flex: 1;
  min-width: 0;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
}

.main-content > .breadcrumbs {
  padding: 4px 16px;
  background: #f9fafb;
  font-size: 13px;
  border-bottom: 1px solid #e5e7eb;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-shrink: 0;
}

.main-content > .breadcrumbs a { color: #0066cc; }
.main-content > .breadcrumbs a:hover { text-decoration: underline; }
.main-content > .breadcrumbs .current { color: #6b7280; }
.breadcrumb-actions { display: flex; gap: 0.5rem; }
.breadcrumb-actions form { display: inline; margin: 0; }

/* Search bar in breadcrumb area */
.search-bar { margin: 0; display: flex; }
.search-input {
  font-size: 13px;
  padding: 2px 8px;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  width: 200px;
  outline: none;
  background: #fff;
  transition: border-color 0.15s, width 0.2s;
}
.search-input:focus {
  border-color: #4f46e5;
  box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.15);
  width: 300px;
}

.main-content > main {
  flex: 1;
  padding: 16px 24px;
}

.main-content .notice { color: #059669; margin-bottom: 1rem; }
.main-content .alert { color: #dc2626; margin-bottom: 1rem; }

/* Simple layout (logged out / no companies) */
.simple-header {
  padding: 4px 16px;
  background: #f5f5f5;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.simple-nav {
  padding: 4px 16px;
  background: #333;
  display: flex;
  gap: 16px;
  font-size: 14px;
}

.simple-nav a {
  color: #fff;
  text-decoration: none;
}

/* Override nav defaults when inside sidebar */
.sidebar nav { background: transparent; padding: 0; margin: 0; }
.sidebar nav a { color: #374151; margin-right: 0; }
.sidebar nav a:hover { opacity: 1; }

/* Override form max-width inside main content */
.main-content form { max-width: 600px; }

/* Container */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem 1rem;
}

/* Page Headers */
h1 {
  font-size: 2rem;
  font-weight: 600;
  margin-bottom: 1.5rem;
  color: #212529;
}

/* Links */
a {
  color: #0066cc;
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

/* Secondary Links */
.link-secondary {
  color: #6c757d;
  font-size: 0.9rem;
  margin-top: 1rem;
  display: inline-block;
}

.link-secondary:hover {
  color: #5a6268;
}

/* Images */
img {
  max-width: 100%;
  height: auto;
}

img.photo {
  width: 80px !important;
  height: 80px !important;
  max-width: 80px !important;
  object-fit: cover;
  border-radius: 50%;
  display: block;
}

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
}

th {
  padding: 10px;
  text-align: left;
  vertical-align: top;
  border-bottom: 2px solid #e5e7eb;
}

td {
  padding: 10px;
  text-align: left;
  vertical-align: middle;
}

tbody tr:nth-child(even) { background: #f9fafb; }
tbody tr:hover { background: #f3f4f6; }
tr[data-href] { cursor: pointer; }

td form { display: inline; }

/* Navigation */
nav {
  background: #333;
  padding: 10px;
  margin-bottom: 20px;
}

nav a {
  color: white;
  margin-right: 20px;
}

nav a:hover {
  opacity: 0.8;
}

/* Empty States */
.empty {
  text-align: center;
  color: #999;
  font-style: italic;
  padding: 40px;
}

/* Utility */
.center {
  text-align: center;
}

.muted {
  color: #666;
  font-size: 0.9em;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.25em 0.6em;
  font-size: 0.75em;
  font-weight: 600;
  border-radius: 0.25rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-draft {
  background-color: #6c757d;
  color: white;
}

.badge-pending {
  background-color: #ffc107;
  color: #212529;
}

.badge-active {
  background-color: #28a745;
  color: white;
}

.badge-completed {
  background-color: #17a2b8;
  color: white;
}

.badge-terminated {
  background-color: #dc3545;
  color: white;
}

.badge-expired {
  background-color: #868e96;
  color: white;
}

.badge-paused {
  background-color: #eab308;
  color: #1a1a1a;
}

.badge-founding {
  background-color: #6366f1;
  color: white;
}

/* Pause/resume on hover */
.badge-pausable {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.badge-pausable .badge-pause-btn,
.badge-pausable .badge-resume-btn {
  display: none;
  position: absolute;
  inset: 0;
  border: none;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  padding: 2px 8px;
  white-space: nowrap;
}
.badge-pausable .badge-pause-btn {
  background: #dc3545;
  color: white;
}
.badge-pausable .badge-resume-btn {
  background: #28a745;
  color: white;
}
.badge-pausable:hover .badge-pause-btn,
.badge-pausable:hover .badge-resume-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.badge-pausable:hover .badge {
  visibility: hidden;
}

.badge-approved {
  background-color: #28a745;
  color: white;
}

.badge-rejected {
  background-color: #dc3545;
  color: white;
}

.badge-revision_requested {
  background-color: #fd7e14;
  color: white;
}

.approval-comment {
  border-left: 3px solid #dee2e6;
  padding: 0.5rem 0.75rem;
  margin-bottom: 0.75rem;
}

/* Kanban board */
.kanban-board {
  display: flex;
  gap: 0.75rem;
  overflow-x: auto;
  padding-bottom: 1rem;
}

.kanban-column {
  min-width: 220px;
  flex: 1;
  background: #f8f9fa;
  border-radius: 6px;
  display: flex;
  flex-direction: column;
}

.kanban-column-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  font-weight: 600;
  font-size: 0.85rem;
  border-bottom: 2px solid #dee2e6;
}

.kanban-column-count {
  background: #dee2e6;
  color: #495057;
  border-radius: 10px;
  padding: 0 0.5rem;
  font-size: 0.75rem;
}

.kanban-column-cards {
  padding: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  min-height: 60px;
}

.kanban-card {
  display: block;
  background: #fff;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.75rem;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
  cursor: pointer;
}

.kanban-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.kanban-card-title {
  font-size: 0.85rem;
  line-height: 1.3;
  margin-bottom: 0.35rem;
  color: #212529;
}

.kanban-card-meta {
  display: flex;
  gap: 0.35rem;
  align-items: center;
  flex-wrap: wrap;
  font-size: 0.75rem;
}

.kanban-card-assignee {
  color: #495057;
}

.kanban-card-assignee.unassigned {
  color: #dc3545;
  font-style: italic;
}

.kanban-card-subtasks {
  margin-top: 0.35rem;
  font-size: 0.7rem;
  color: #6c757d;
}

.kanban-subtask-progress {
  display: block;
  margin-bottom: 0.2rem;
}

.kanban-subtask-bar {
  height: 4px;
  background: #dee2e6;
  border-radius: 2px;
  overflow: hidden;
}

.kanban-subtask-fill {
  height: 100%;
  background: #28a745;
  border-radius: 2px;
}

.badge-backlog {
  background-color: #6c757d;
  color: white;
}

.badge-todo {
  background-color: #ffc107;
  color: #212529;
}

.badge-in_progress {
  background-color: #007bff;
  color: white;
}

.badge-done {
  background-color: #28a745;
  color: white;
}

.badge-blocked {
  background-color: #dc3545;
  color: white;
}

.badge-cancelled {
  background-color: #868e96;
  color: white;
}

.badge-priority-urgent {
  background-color: #dc3545;
  color: white;
}

.badge-priority-high {
  background-color: #fd7e14;
  color: white;
}

.badge-priority-medium {
  background-color: #ffc107;
  color: #212529;
}

.badge-priority-low {
  background-color: #6c757d;
  color: white;
}

/* Buttons */
.btn {
  display: inline-block;
  padding: 0.375rem 0.75rem;
  font-size: 1rem;
  line-height: 1.5;
  border-radius: 0.25rem;
  text-decoration: none;
  text-align: center;
  vertical-align: middle;
  cursor: pointer;
  background-color: #0066cc;
  color: white;
  border: 1px solid #0066cc;
  transition: all 0.15s ease-in-out;
}

.btn:hover {
  background-color: #0056b3;
  border-color: #0056b3;
  text-decoration: none;
}

.btn-sm {
  padding: 0.25rem 0.5rem;
  font-size: 0.875rem;
  line-height: 1.5;
  border-radius: 0.2rem;
}

.btn-primary {
  background-color: #007bff;
  border-color: #007bff;
}

.btn-primary:hover {
  background-color: #0069d9;
  border-color: #0062cc;
}

.btn-primary:disabled {
  background-color: #6c757d;
  border-color: #6c757d;
  cursor: not-allowed;
}

/* Forms */
form {
  max-width: 600px;
  margin: 0 auto;
}

/* Settings sections: description left, content right */
.settings-section {
  display: grid;
  grid-template-columns: 1fr 2fr;
  gap: 2rem;
  padding: 2rem 0;
  border-bottom: 1px solid #e5e7eb;
}

.settings-section:last-child { border-bottom: none; }
.section-content form { max-width: none; margin: 0; }

/* Repo picker */
.repo-picker {
  border: 1px solid #d1d5db;
  border-radius: 6px;
  overflow: hidden;
}
.repo-picker-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 12px;
  background: #f9fafb;
  border-bottom: 1px solid #e5e7eb;
  font-size: 0.9rem;
}
.repo-picker-list {
  max-height: 320px;
  overflow-y: auto;
}
.repo-picker-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  border-bottom: 1px solid #f3f4f6;
  cursor: pointer;
  font-size: 0.9rem;
}
.repo-picker-item:last-child { border-bottom: none; }
.repo-picker-item:hover { background: #f9fafb; }
.repo-picker-item input[type="checkbox"] { flex-shrink: 0; }
.repo-picker-info { display: flex; align-items: center; gap: 8px; }
.repo-picker-name { font-family: ui-monospace, monospace; font-size: 0.85rem; }
.repo-picker-badge {
  font-size: 0.7rem;
  padding: 1px 6px;
  border-radius: 10px;
  background: #f3f4f6;
  color: #6b7280;
  border: 1px solid #e5e7eb;
}
.repo-picker-footer {
  display: flex;
  align-items: center;
  padding: 10px 12px;
  border-top: 1px solid #e5e7eb;
  background: #f9fafb;
  font-size: 0.85rem;
}

.section-desc h3 {
  margin: 0 0 0.25rem;
  font-size: 1.1rem;
}

.section-desc p {
  margin: 0;
  color: #6b7280;
  font-size: 0.9rem;
}

.field {
  margin-bottom: 1.5rem;
}

.field label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 500;
  color: #495057;
}

.field input[type="text"],
.field input[type="email"],
.field input[type="password"],
.field input[type="number"],
.field input[type="tel"],
.field input[type="url"],
.field textarea,
.field select {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
  transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
  box-sizing: border-box;
}

.field input[type="text"]:focus,
.field input[type="email"]:focus,
.field input[type="password"]:focus,
.field input[type="number"]:focus,
.field input[type="tel"]:focus,
.field input[type="url"]:focus,
.field textarea:focus,
.field select:focus {
  color: #495057;
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}

.field textarea {
  min-height: 120px;
  resize: vertical;
}

.field input[type="file"] {
  display: block;
  width: 100%;
  padding: 0.5rem;
  font-size: 0.9rem;
  line-height: 1.5;
  color: #495057;
  background-color: #fff;
  background-clip: padding-box;
  border: 1px solid #ced4da;
  border-radius: 0.375rem;
}

.field input[type="file"]:focus {
  color: #495057;
  background-color: #fff;
  border-color: #80bdff;
  outline: 0;
}

.actions {
  margin-top: 2rem;
  text-align: right;
}

.actions input[type="submit"],
.actions button {
  padding: 0.75rem 1.5rem;
  font-size: 1rem;
  font-weight: 500;
  line-height: 1.5;
  color: #fff;
  background-color: #007bff;
  border: 1px solid #007bff;
  border-radius: 0.375rem;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

.actions input[type="submit"]:hover,
.actions button:hover {
  background-color: #0069d9;
  border-color: #0062cc;
}

.actions input[type="submit"]:focus,
.actions button:focus {
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.5);
  outline: 0;
}

/* Error messages */
#error_explanation {
  background-color: #f8d7da;
  color: #721c24;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
  border: 1px solid #f5c6cb;
  border-radius: 0.375rem;
}

#error_explanation h2 {
  margin-top: 0;
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
  font-weight: 600;
}

#error_explanation ul {
  margin-bottom: 0;
  padding-left: 1.5rem;
}

#error_explanation li {
  margin-bottom: 0.25rem;
}

/* Field with errors */
.field_with_errors {
  display: contents;
}

.field_with_errors input,
.field_with_errors textarea,
.field_with_errors select {
  border-color: #dc3545;
}

.field_with_errors label {
  color: #dc3545;
}

/* Model preference badges */
.model-badge .badge {
  font-size: 0.875rem;
  padding: 0.4rem 0.8rem;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
}

.model-badge .badge i {
  font-size: 1rem;
}

.model-badge .badge.bg-info {
  background-color: #0dcaf0 !important;
  color: #000;
}

.model-badge .badge.bg-warning {
  background-color: #ffc107 !important;
  color: #000;
}

.model-badge .badge.bg-success {
  background-color: #198754 !important;
  color: #fff;
}

/* Agent card enhancements */
.agent-card .model-badge {
  margin-top: 0.5rem;
}

/* Character sheet — agent generator */
.character-sheet {
  max-width: 540px;
  border: 1px solid #e2e8f0;
  border-radius: 12px;
  padding: 1.5rem;
  background: #fff;
  margin: 1rem 0;
}

.character-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.character-portrait {
  width: 120px;
  height: 120px;
  flex-shrink: 0;
}

.character-portrait canvas {
  width: 120px;
  height: 120px;
  border-radius: 50%;
}

.portrait-placeholder {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.5rem;
  flex-shrink: 0;
}

.portrait-image {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.skeleton-text {
  display: inline-block;
  height: 1em;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: skeleton-shimmer 1.5s infinite;
  border-radius: 4px;
  width: 100%;
}

.skeleton-short { width: 60%; }

@keyframes skeleton-shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.character-identity { flex: 1; }
.character-name { margin: 0; font-size: 1.25rem; }
.character-demo { font-size: 0.8rem; color: #64748b; }
.character-tagline { font-style: italic; color: #475569; margin: 0.25rem 0 0; font-size: 0.9rem; }

.character-body {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1.25rem;
}

.character-style {
  flex: 1;
  font-size: 0.85rem;
  color: #475569;
  line-height: 1.5;
  margin: 0;
}

.character-stats {
  flex-shrink: 0;
  width: 130px;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  padding: 0.5rem 0.625rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
}

.stat-row {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.stat-abbr {
  width: 28px;
  font-size: 0.65rem;
  font-weight: 700;
  color: #64748b;
  letter-spacing: 0.03em;
}

.stat-bar-mini {
  flex: 1;
  height: 4px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.stat-bar-fill-mini {
  height: 100%;
  border-radius: 2px;
  transition: width 0.4s ease;
}

.stat-bar-fill-mini.stat-high { background: #22c55e; }
.stat-bar-fill-mini.stat-mid { background: #eab308; }
.stat-bar-fill-mini.stat-low { background: #ef4444; }

.stat-val {
  width: 18px;
  text-align: right;
  font-size: 0.7rem;
  font-weight: 700;
  color: #334155;
}

.character-actions {
  display: flex;
  justify-content: flex-end;
}

.hire-wrap {
  margin-top: 0.75rem;
  display: flex;
  justify-content: center;
  max-width: 540px;
}

.hire-wrap .btn { width: 100%; }

/* Team grid — company show */
.team-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.team-card {
  display: block;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
}

.team-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.team-card-photo {
  display: flex;
  justify-content: center;
  margin-bottom: 0.75rem;
}

.team-avatar {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  object-fit: cover;
}

.team-avatar-placeholder {
  width: 80px;
  height: 80px;
  border-radius: 50%;
  background: #e5e7eb;
  color: #6b7280;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.25rem;
}

.team-card-info {
  text-align: center;
  margin-bottom: 0.5rem;
}

.team-card-name {
  display: block;
  font-size: 1rem;
}

.team-card-role {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: #6366f1;
  background: #eef2ff;
  padding: 0.1rem 0.4rem;
  border-radius: 3px;
  margin-top: 0.2rem;
}

.team-card-stats {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 3px;
  margin: 0.5rem 0;
}

.team-stat {
  display: flex;
  flex-direction: column;
}

.team-stat-bar {
  height: 3px;
  background: #e2e8f0;
  border-radius: 2px;
  overflow: hidden;
}

.team-stat-fill {
  height: 100%;
  border-radius: 2px;
}

.team-stat-fill.stat-high { background: #22c55e; }
.team-stat-fill.stat-mid { background: #eab308; }
.team-stat-fill.stat-low { background: #ef4444; }

.team-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.75rem;
  margin-top: 0.5rem;
}

/* Activity feed */
.activity-feed { margin-bottom: 2rem; }
.activity-item {
  display: flex;
  gap: 0.5rem;
  align-items: baseline;
  padding: 0.4rem 0;
  border-bottom: 1px solid #f1f5f9;
  font-size: 0.9rem;
}
.activity-actor { font-weight: 600; white-space: nowrap; }
.activity-body { flex: 1; }
.activity-time { white-space: nowrap; font-size: 0.8rem; }

/* Agent detail page */
/* ===== Agent Detail Page ===== */
.agent-detail {
  max-width: 660px;
}

.agent-detail h3 {
  font-size: 1rem;
  margin: 0 0 0.5rem;
  color: #334155;
}

/* Hero */
.agent-detail-hero {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-bottom: 1.25rem;
}

.agent-photo-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.agent-photo-placeholder-lg {
  width: 96px;
  height: 96px;
  border-radius: 50%;
  background: linear-gradient(135deg, #6366f1, #8b5cf6);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 1.75rem;
  flex-shrink: 0;
}

.agent-detail-identity {
  flex: 1;
  min-width: 0;
}

.agent-detail-name {
  margin: 0 0 0.2rem;
  font-size: 1.4rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.agent-detail-name .badge {
  font-size: 0.6rem;
}

.agent-detail-desc {
  color: #475569;
  font-size: 0.85rem;
  margin: 0.35rem 0 0;
  line-height: 1.4;
}

.agent-detail-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.6rem;
}

.agent-detail-actions form {
  max-width: none;
  margin: 0;
}

/* Heartbeat pulse bar */
.heartbeat-pulse {
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.25rem;
}

.heartbeat-pulse-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.heartbeat-pulse-action {
  margin-left: auto;
}

.heartbeat-pulse-action form {
  max-width: none;
  margin: 0;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #cbd5e1;
  flex-shrink: 0;
}

.pulse-dot--ok { background: #22c55e; }
.pulse-dot--active { background: #eab308; animation: pulse-blink 1.5s infinite; }
.pulse-dot--overdue { background: #f97316; }
.pulse-dot--error { background: #ef4444; }

@keyframes pulse-blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.pulse-label {
  font-size: 0.85rem;
  color: #334155;
}

.heartbeat-pulse .heartbeat-actions {
  margin: 0.4rem 0 0;
  padding-left: 1rem;
}

/* Heartbeat actions list */
.heartbeat-actions {
  list-style: none;
  padding: 0;
  margin: 0;
  font-size: 0.8rem;
}
.heartbeat-actions li {
  padding: 0.15rem 0;
  color: #334155;
}
.heartbeat-actions li::before {
  content: ">";
  margin-right: 0.35rem;
  color: #94a3b8;
  font-weight: 600;
}
.heartbeat-actions a {
  color: #2563eb;
  text-decoration: none;
}
.heartbeat-actions a:hover {
  text-decoration: underline;
}

/* Sections */
.agent-detail-section {
  margin-bottom: 1.25rem;
}

.agent-detail-section strong {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #64748b;
  margin-bottom: 0.1rem;
}

.agent-detail-section p {
  margin: 0;
  font-size: 0.85rem;
  color: #334155;
  line-height: 1.4;
}

/* Org chart */
.agent-detail-org p {
  margin: 0 0 0.15rem;
}

/* About (collapsible) */
.agent-detail-about {
  border: 1px solid #e2e8f0;
  border-radius: 8px;
  padding: 0.6rem 0.8rem;
  margin-bottom: 1.25rem;
}

.agent-detail-about > summary {
  cursor: pointer;
  list-style: none;
}

.agent-detail-about > summary::-webkit-details-marker { display: none; }

.agent-detail-about > summary h3 {
  display: inline;
  font-size: 0.9rem;
}

.agent-detail-about > summary::before {
  content: "\25B6";
  font-size: 0.6rem;
  margin-right: 0.4rem;
  color: #94a3b8;
}

.agent-detail-about[open] > summary::before {
  content: "\25BC";
}

.agent-detail-about .agent-detail-stats {
  margin-top: 0.75rem;
}

.agent-detail-about .agent-detail-profile {
  margin-top: 0.75rem;
}

.agent-detail-about .agent-detail-meta {
  margin-top: 0.75rem;
  padding-top: 0.5rem;
  border-top: 1px solid #e2e8f0;
  font-size: 0.8rem;
  color: #64748b;
}

.agent-detail-about .agent-detail-meta p {
  margin: 0.15rem 0;
  font-size: 0.8rem;
  color: #64748b;
}

.agent-detail-about .agent-detail-meta strong {
  display: inline;
  font-size: 0.8rem;
  text-transform: none;
  letter-spacing: normal;
  color: #64748b;
  margin-right: 0.25rem;
}

/* Stats */
.agent-detail-stats {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-family: "SF Mono", "Menlo", "Consolas", monospace;
  max-width: 200px;
}

.agent-detail-profile {
  margin-bottom: 0;
}

/* Debug */
.agent-detail-debug {
  margin-bottom: 1rem;
}

.agent-detail-response {
  font-size: 0.75rem;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 4px;
  padding: 0.5rem;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 300px;
  overflow-y: auto;
  margin-top: 0.25rem;
}

.badge-sm { font-size: 0.6rem; padding: 0.1rem 0.35rem; }

/* Danger button */
.btn-danger {
  background-color: #dc3545;
  border-color: #dc3545;
  color: #fff;
}

.btn-danger:hover {
  background-color: #c82333;
  border-color: #bd2130;
}

.btn-warning {
  background-color: #fd7e14;
  border-color: #fd7e14;
  color: #fff;
}

.btn-warning:hover {
  background-color: #e8690b;
  border-color: #dc6009;
}

.btn-secondary {
  background-color: #6c757d;
  border-color: #6c757d;
  color: #fff;
}

.btn-secondary:hover {
  background-color: #5a6268;
  border-color: #545b62;
}

/* ===== Company Cards (cross-company dashboard) ===== */
.company-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 1rem;
}

.company-card {
  display: flex;
  flex-direction: column;
  border: 1px solid #e2e8f0;
  border-radius: 10px;
  padding: 1.25rem;
  background: #fff;
  text-decoration: none;
  color: inherit;
  transition: box-shadow 0.2s, transform 0.2s;
  min-height: 160px;
}

.company-card:hover {
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  transform: translateY(-1px);
  text-decoration: none;
  color: inherit;
}

.company-card-link {
  display: flex;
  flex-direction: column;
  flex: 1;
  text-decoration: none;
  color: inherit;
}
.company-card-link:hover { text-decoration: none; color: inherit; }

.company-card-icon {
  margin-bottom: 0.75rem;
}

.company-card-initials {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #4f46e5;
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.5px;
}

.company-card-body {
  flex: 1;
}

.company-card-name {
  display: block;
  font-size: 1.1rem;
  color: #111827;
}

.company-card-mission {
  margin: 0.25rem 0 0;
  font-size: 0.85rem;
  color: #6b7280;
  line-height: 1.4;
}

.company-card-footer {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.75rem;
  padding-top: 0.75rem;
  border-top: 1px solid #f1f5f9;
}

.company-card-stat {
  font-size: 0.8rem;
  color: #6b7280;
}

.company-card-pending {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #b45309;
  background: #fef3c7;
  padding: 0.1rem 0.5rem;
  border-radius: 9999px;
}

.company-card-pending svg {
  stroke: #d97706;
}

/* "New company" card */
.company-card-new {
  border: 2px dashed #d1d5db;
  background: transparent;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  color: #9ca3af;
}

.company-card-new:hover {
  border-color: #9ca3af;
  color: #6b7280;
  background: #f9fafb;
}

.company-card-new-icon {
  color: inherit;
}

.company-card-new-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.task-output {
  margin-top: 1rem;
  padding: 1rem;
  background: #f8f9fa;
  border-radius: 6px;
  border: 1px solid #e1e4e8;
  font-size: 0.9rem;
  line-height: 1.6;
  white-space: pre-wrap;
}
.badge-executing {
  background: #0969da;
  color: white;
  animation: pulse 2s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

/* Auth steps checklist */
.auth-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem;
}
.auth-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  font-size: 0.9rem;
  color: #6b7280;
}
.auth-step-icon {
  width: 1.25rem;
  text-align: center;
  flex-shrink: 0;
  font-size: 0.95rem;
}
.auth-step--done { color: #059669; }
.auth-step--done .auth-step-icon { font-weight: 700; }
.auth-step--active { color: #1d4ed8; font-weight: 500; }
.auth-step-spinner { animation: auth-spin 1.2s linear infinite; display: inline-block; }
@keyframes auth-spin { to { transform: rotate(360deg); } }
.auth-step--pending { color: #9ca3af; }
.auth-step-timer {
  font-size: 0.8rem;
  color: #6b7280;
  font-weight: 400;
  margin-left: 0.25rem;
  font-variant-numeric: tabular-nums;
}

.terminal-output {
  background: #1a1b26;
  color: #a9b1d6;
  font-family: 'SF Mono', 'Monaco', 'Menlo', 'Consolas', monospace;
  font-size: 0.8rem;
  line-height: 1.4;
  padding: 0.75rem;
  border-radius: 6px;
  white-space: pre-wrap;
  word-break: break-all;
  overflow-y: auto;
  height: 24em;
  margin: 0;
}
