/* ============ APP SHELL ============ */
.app-header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 2rem;
}

.app-header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-brand {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.brand-mono {
  font-family: var(--font-mono);
  font-size: 0.9rem;
  font-weight: 500;
  letter-spacing: 0.3em;
  color: var(--fg-primary);
}

.brand-status {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-family: var(--font-mono);
  font-size: 0.65rem;
  letter-spacing: 0.15em;
  color: var(--accent);
  background: var(--accent-dim);
  border: 1px solid rgba(0, 229, 160, 0.2);
  border-radius: 100px;
  padding: 0.2rem 0.7rem;
}

.app-nav {
  display: flex;
  gap: 1.5rem;
}

.nav-link {
  font-size: 0.85rem;
  color: var(--fg-secondary);
  text-decoration: none;
  transition: color 0.2s;
}

.nav-link:hover {
  color: var(--fg-primary);
}

/* ============ MAIN LAYOUT ============ */
.app-main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 2rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 1.5rem;
  margin-top: 1.5rem;
}

/* ============ PANELS ============ */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
}

/* ============ ADD FORM ============ */
.add-panel {
  margin-bottom: 0;
}

.add-form {
  display: flex;
  gap: 0.75rem;
  padding: 1.25rem;
  flex-wrap: wrap;
}

.form-input {
  flex: 1;
  min-width: 180px;
  background: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.6rem 1rem;
  color: var(--fg-primary);
  font-family: var(--font-display);
  font-size: 0.875rem;
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--accent);
}

.form-input::placeholder {
  color: var(--fg-muted);
}

.form-error {
  padding: 0 1.25rem 1rem;
  font-size: 0.8rem;
  color: #ff6b6b;
}

/* ============ BUTTONS ============ */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.6rem 1.25rem;
  border-radius: 8px;
  font-family: var(--font-display);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  border: none;
  transition: opacity 0.2s, transform 0.1s;
  white-space: nowrap;
}

.btn:active { transform: scale(0.97); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.btn-primary {
  background: var(--accent);
  color: #0a0a0f;
}

.btn-primary:hover:not(:disabled) { opacity: 0.9; }

.btn-accent {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 229, 160, 0.25);
}

.btn-accent:hover:not(:disabled) { background: rgba(0, 229, 160, 0.2); }

.btn-ghost {
  background: transparent;
  color: var(--fg-secondary);
  border: 1px solid var(--border);
}

.btn-ghost:hover:not(:disabled) { color: var(--fg-primary); border-color: var(--fg-muted); }

.btn-sm {
  padding: 0.35rem 0.8rem;
  font-size: 0.75rem;
}

.btn-danger {
  background: transparent;
  color: #ff6b6b;
  border: 1px solid rgba(255, 107, 107, 0.25);
}

.btn-danger:hover:not(:disabled) { background: rgba(255, 107, 107, 0.08); }

/* ============ COMPETITORS LIST ============ */
.competitors-list {
  padding: 0.5rem 0;
  min-height: 120px;
}

.competitor-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.competitor-item:last-child {
  border-bottom: none;
}

.competitor-item:hover {
  background: var(--bg-secondary);
}

.competitor-info {
  flex: 1;
  min-width: 0;
}

.competitor-name {
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--fg-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.competitor-url {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.competitor-actions {
  display: flex;
  gap: 0.4rem;
  flex-shrink: 0;
}

/* ============ BRIEFINGS FEED ============ */
.briefings-feed {
  padding: 0;
  max-height: calc(100vh - 260px);
  overflow-y: auto;
}

.briefing-card {
  padding: 1.25rem;
  border-bottom: 1px solid var(--border);
  transition: background 0.15s;
}

.briefing-card:last-child {
  border-bottom: none;
}

.briefing-card:hover {
  background: var(--bg-secondary);
}

.briefing-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.briefing-competitor {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--accent);
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
}

.briefing-time {
  font-size: 0.75rem;
  color: var(--fg-muted);
  font-family: var(--font-mono);
  margin-left: auto;
}

.change-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  font-size: 0.65rem;
  font-family: var(--font-mono);
  letter-spacing: 0.1em;
  padding: 0.15rem 0.5rem;
  border-radius: 100px;
}

.change-badge.changed {
  background: rgba(255, 200, 0, 0.12);
  color: #ffc800;
  border: 1px solid rgba(255, 200, 0, 0.25);
}

.change-badge.no-change {
  background: var(--accent-dim);
  color: var(--accent);
  border: 1px solid rgba(0, 229, 160, 0.2);
}

.briefing-summary {
  font-size: 0.875rem;
  color: var(--fg-secondary);
  line-height: 1.7;
  white-space: pre-wrap;
}

/* ============ MISC ============ */
.empty-state {
  padding: 2.5rem 1.25rem;
  text-align: center;
  font-size: 0.875rem;
  color: var(--fg-muted);
}

.count-badge {
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--fg-muted);
}

.hidden { display: none !important; }

/* ============ SPINNER ============ */
.spinner {
  width: 14px;
  height: 14px;
  border: 2px solid rgba(0, 229, 160, 0.3);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  display: inline-block;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* ============ TOAST ============ */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.85rem 1.25rem;
  font-size: 0.875rem;
  color: var(--fg-primary);
  z-index: 999;
  animation: slideUp 0.25s ease;
}

.toast.success { border-color: rgba(0, 229, 160, 0.4); }
.toast.error { border-color: rgba(255, 107, 107, 0.4); color: #ff6b6b; }

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

/* ============ RESPONSIVE ============ */
@media (max-width: 900px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
  .briefings-feed {
    max-height: 60vh;
  }
}

@media (max-width: 600px) {
  .app-main { padding: 1rem; }
  .add-form { flex-direction: column; }
  .form-input { min-width: 0; width: 100%; }
}
