/* Collapsible Task Form */
.new-task-details {
  margin-bottom: 16px;
}

.new-task-details summary.task-form-toggle {
  display: inline-flex;
  cursor: pointer;
  margin-bottom: 12px;
  list-style: none;
}

.new-task-details summary::-webkit-details-marker {
  display: none;
}

.selected-refs-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #0f172a;
  padding: 6px 10px;
  border-radius: 4px;
  border: 1px solid #334155;
  font-size: 0.8rem;
}

.btn-link-sm {
  background: none;
  border: none;
  color: #f87171;
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0;
  text-decoration: underline;
}

.btn-link-sm:hover {
  color: #ef4444;
}

/* Owner Import Section */
.owner-import-section {
  background: #182238;
  border: 1px solid #28354f;
  border-radius: 6px;
  padding: 14px 16px;
  margin-bottom: 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.owner-import-section h4 {
  font-size: 0.92rem;
  color: #38bdf8;
}

.import-controls {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.import-controls input[type="file"] {
  font-size: 0.82rem;
  color: #94a3b8;
}

/* Manual Auth Details in Modal */
.manual-auth-details {
  margin-top: 8px;
  border-top: 1px solid #1e293b;
  padding-top: 10px;
}

.manual-auth-summary {
  font-size: 0.82rem;
  color: #38bdf8;
  cursor: pointer;
}

/* Reset & Base */
*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  background-color: #0b1120;
  color: #f1f5f9;
  line-height: 1.5;
  padding-bottom: 60px;
}

/* Environment Banner */
.banner {
  background: #1e3a8a;
  color: #ffffff;
  padding: 8px 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-size: 0.85rem;
  font-weight: 600;
  text-align: center;
  letter-spacing: 0.5px;
}

.banner-tag {
  background: #1d4ed8;
  padding: 2px 8px;
  border-radius: 4px;
  font-weight: 800;
  font-size: 0.75rem;
  letter-spacing: 0.5px;
}

/* Brand Header */
.brand-header {
  background: #0f172a;
  border-bottom: 1px solid #1e293b;
  padding: 14px 20px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.brand-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.brand-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 1.25rem;
  font-weight: 700;
}

.brand-allpro {
  color: #38bdf8;
  letter-spacing: -0.5px;
}

.brand-sep {
  color: #64748b;
  font-weight: 400;
}

.brand-project {
  color: #f8fafc;
}

.brand-tagline {
  font-size: 0.82rem;
  color: #94a3b8;
}

/* Connectors & Freshness Bar */
.connector-bar {
  background: #1e293b;
  border-bottom: 1px solid #334155;
  padding: 10px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 20px;
  font-size: 0.8rem;
}

.connector-item {
  display: flex;
  align-items: center;
  gap: 8px;
}

.connector-item .label {
  color: #94a3b8;
  font-weight: 600;
}

.connector-item .val {
  color: #f1f5f9;
  font-weight: 500;
}

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.live {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}

.dot.pending {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}

.dot.isolated {
  background: #6366f1;
  box-shadow: 0 0 6px rgba(99, 102, 241, 0.6);
}

/* Layout Container */
.container {
  max-width: 1080px;
  margin: 0 auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 20px;
}

/* Cards */
.card {
  background: #131d31;
  border: 1px solid #1e293b;
  border-radius: 8px;
  padding: 20px;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}

.card-header h2 {
  font-size: 1.25rem;
  font-weight: 700;
  color: #f8fafc;
}

.section-desc {
  font-size: 0.85rem;
  color: #94a3b8;
  margin-top: 2px;
}

/* Freshness Bar */
.freshness-card {
  background: #1e293b;
  border: 1px solid #334155;
  border-radius: 6px;
  padding: 10px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  flex-wrap: wrap;
  gap: 12px;
}

.freshness-meta strong {
  color: #38bdf8;
}

/* Gate Banner */
.gate-banner {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid #f59e0b;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 16px;
  font-size: 0.88rem;
  color: #fef3c7;
}

.gate-icon {
  font-size: 1.2rem;
  color: #f59e0b;
  line-height: 1;
}

.gate-text strong {
  color: #fbbf24;
  display: block;
  margin-bottom: 2px;
}

/* Brief Overview */
.brief-overview {
  background: #1e293b;
  border: 1px solid #38bdf8;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 16px;
}

.brief-overview h4 {
  color: #38bdf8;
  font-size: 0.95rem;
  margin-bottom: 6px;
}

.brief-overview p {
  font-size: 0.9rem;
  color: #e2e8f0;
  line-height: 1.6;
}

.brief-meta {
  margin-top: 10px;
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Suggested Actions */
.actions-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.action-card {
  background: #182238;
  border: 1px solid #28354f;
  border-left: 4px solid #38bdf8;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.action-top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  flex-wrap: wrap;
}

.action-title {
  font-size: 1rem;
  font-weight: 600;
  color: #f8fafc;
}

.action-note {
  font-size: 0.88rem;
  color: #cbd5e1;
}

.action-footer-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding-top: 6px;
  border-top: 1px solid #232f48;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.badge-pm {
  background: #0284c7;
  color: #ffffff;
}

.badge-neutral {
  background: #334155;
  color: #cbd5e1;
}

.badge-internal {
  background: #6366f1;
  color: #ffffff;
}

.badge-client {
  background: #059669;
  color: #ffffff;
}

.badge-uncertainty-low {
  background: #065f46;
  color: #6ee7b7;
}

.badge-uncertainty-medium {
  background: #854d0e;
  color: #fde047;
}

.badge-uncertainty-high {
  background: #991b1b;
  color: #fca5a5;
}

.badge-task-open {
  background: #0369a1;
  color: #e0f2fe;
}

.badge-task-done {
  background: #15803d;
  color: #dcfce7;
}

.badge-task-blocked {
  background: #b91c1c;
  color: #fee2e2;
}

/* Reference links */
.refs-container {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.ref-link-btn {
  background: #1e293b;
  border: 1px solid #475569;
  color: #38bdf8;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.ref-link-btn:hover {
  background: #334155;
  border-color: #38bdf8;
}

/* Tasks Form & List */
.new-task-form {
  background: #182238;
  border: 1px solid #28354f;
  border-radius: 6px;
  padding: 16px;
  margin-bottom: 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.form-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flex-1 { flex: 1; min-width: 160px; }
.flex-2 { flex: 2; min-width: 220px; }

.form-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: #94a3b8;
}

input[type="text"], input[type="date"] {
  background: #0f172a;
  border: 1px solid #334155;
  border-radius: 4px;
  padding: 8px 12px;
  color: #f1f5f9;
  font-size: 0.9rem;
  outline: none;
  transition: border-color 0.15s;
}

input[type="text"]:focus, input[type="date"]:focus {
  border-color: #38bdf8;
}

.form-btn-align {
  justify-content: flex-end;
}

.btn-full {
  width: 100%;
}

.tasks-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.task-card {
  background: #182238;
  border: 1px solid #28354f;
  border-radius: 6px;
  padding: 12px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.task-card.status-done {
  opacity: 0.75;
  border-left: 4px solid #10b981;
}

.task-card.status-blocked {
  border-left: 4px solid #ef4444;
}

.task-card.status-open {
  border-left: 4px solid #0284c7;
}

.task-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.task-header-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.task-title {
  font-size: 0.95rem;
  font-weight: 600;
  color: #f1f5f9;
}

.task-due {
  font-size: 0.8rem;
  color: #94a3b8;
}

.task-meta-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.task-actions-group {
  display: flex;
  gap: 6px;
}

/* Source Inbox */
.inbox-filter-group {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}

.filter-btn {
  background: #1e293b;
  border: 1px solid #334155;
  color: #94a3b8;
  padding: 4px 10px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.filter-btn:hover {
  background: #334155;
  color: #f1f5f9;
}

.filter-btn.active {
  background: #0284c7;
  border-color: #0284c7;
  color: #ffffff;
}

.messages-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.message-card {
  background: #182238;
  border: 1px solid #28354f;
  border-radius: 6px;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: border-color 0.2s, background-color 0.2s;
}

.message-card.message-highlight {
  border-color: #38bdf8;
  background-color: #1e3a8a33;
  box-shadow: 0 0 10px rgba(56, 189, 248, 0.4);
}

.message-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
}

.message-header-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.message-id {
  font-family: monospace;
  font-size: 0.8rem;
  color: #64748b;
}

.message-time {
  font-size: 0.78rem;
  color: #94a3b8;
}

.message-body {
  font-size: 0.9rem;
  color: #cbd5e1;
  line-height: 1.5;
}

.message-text {
  white-space: pre-wrap;
  word-break: break-word;
}

.expand-btn {
  background: none;
  border: none;
  color: #38bdf8;
  font-size: 0.8rem;
  cursor: pointer;
  margin-top: 4px;
  padding: 0;
  display: inline-block;
}

.expand-btn:hover {
  text-decoration: underline;
}

/* Owner Panel */
.owner-panel {
  cursor: pointer;
}

.panel-summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.92rem;
  color: #cbd5e1;
  outline: none;
}

.summary-sub {
  font-size: 0.8rem;
  color: #94a3b8;
}

.panel-body {
  margin-top: 16px;
  padding-top: 14px;
  border-top: 1px solid #28354f;
  cursor: default;
}

.gov-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
}

.gov-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: #182238;
  padding: 10px 14px;
  border-radius: 4px;
  font-size: 0.84rem;
}

.gov-title {
  color: #94a3b8;
  font-size: 0.76rem;
  font-weight: 700;
  text-transform: uppercase;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 0.88rem;
  font-weight: 600;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8rem;
}

.btn-xs {
  padding: 3px 8px;
  font-size: 0.72rem;
  border-radius: 3px;
}

.btn-primary {
  background: #0284c7;
  color: #ffffff;
}

.btn-primary:hover {
  background: #0369a1;
}

.btn-secondary {
  background: #334155;
  color: #f1f5f9;
}

.btn-secondary:hover {
  background: #475569;
}

.btn-success {
  background: #15803d;
  color: #ffffff;
}

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

.btn-outline {
  background: transparent;
  border: 1px solid #475569;
  color: #cbd5e1;
}

.btn-outline:hover {
  border-color: #94a3b8;
  color: #f8fafc;
}

.btn-outline-success {
  background: transparent;
  border: 1px solid #15803d;
  color: #4ade80;
}

.btn-outline-success:hover {
  background: #15803d22;
}

.btn-outline-warning {
  background: transparent;
  border: 1px solid #b45309;
  color: #fbbf24;
}

.btn-outline-warning:hover {
  background: #b4530922;
}

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

/* Modal Overlay */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(11, 17, 32, 0.88);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}

.modal-overlay.hidden {
  display: none;
}

.modal {
  background: #131d31;
  border: 1px solid #334155;
  border-radius: 8px;
  padding: 24px;
  max-width: 520px;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 14px;
  box-shadow: 0 10px 25px -5px rgba(0, 0, 0, 0.5);
}

.modal h2 {
  font-size: 1.25rem;
  color: #f8fafc;
}

.modal p {
  font-size: 0.88rem;
  color: #cbd5e1;
}

.code-box {
  background: #0f172a;
  border: 1px solid #1e293b;
  padding: 8px 12px;
  border-radius: 4px;
  font-family: monospace;
  font-size: 0.8rem;
  color: #94a3b8;
}

.input-group {
  display: flex;
  gap: 8px;
  margin-top: 6px;
}

.input-group input {
  flex: 1;
}

.error-text {
  color: #f87171;
  font-size: 0.84rem;
  min-height: 18px;
}

/* Utilities */
.hidden { display: none !important; }
.empty-state {
  text-align: center;
  color: #64748b;
  font-size: 0.88rem;
  padding: 24px 12px;
}
.inline-status {
  font-size: 0.82rem;
  margin-top: 4px;
}
.text-alert { color: #f87171; }
.text-success { color: #4ade80; }
.meta-sub {
  font-size: 0.78rem;
  color: #94a3b8;
}

/* Footer */
.footer {
  text-align: center;
  font-size: 0.78rem;
  color: #64748b;
  padding: 24px 16px;
  border-top: 1px solid #1e293b;
  margin-top: 40px;
}

/* Mobile responsive adjustments */
@media (max-width: 640px) {
  .brand-bar {
    flex-direction: column;
    align-items: flex-start;
  }
  .card-header {
    flex-direction: column;
    align-items: flex-start;
  }
  .input-group {
    flex-direction: column;
  }
}
